projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
need init of fromlen once per loop
[unix-history]
/
usr
/
src
/
sbin
/
init
/
init.c
diff --git
a/usr/src/sbin/init/init.c
b/usr/src/sbin/init/init.c
index
4215579
..
7ee9b1d
100644
(file)
--- a/
usr/src/sbin/init/init.c
+++ b/
usr/src/sbin/init/init.c
@@
-5,38
+5,36
@@
*/
#ifndef lint
*/
#ifndef lint
-static char sccsid[] = "@(#)init.c 5.1
1
(Berkeley) %G%";
+static char sccsid[] = "@(#)init.c 5.1
4
(Berkeley) %G%";
#endif not lint
#endif not lint
-#include <signal.h>
#include <sys/types.h>
#include <sys/types.h>
-#include <utmp.h>
-#include <setjmp.h>
-#include <sys/reboot.h>
-#include <errno.h>
#include <sys/file.h>
#include <sys/file.h>
-#include <ttyent.h>
+#include <sys/signal.h>
+#include <sys/reboot.h>
#include <sys/syslog.h>
#include <sys/stat.h>
#include <sys/syslog.h>
#include <sys/stat.h>
+#include <setjmp.h>
+#include <utmp.h>
+#include <errno.h>
+#include <ttyent.h>
+#include "pathnames.h"
-#define LINSIZ sizeof(wtmp.ut_line)
#define CMDSIZ 200 /* max string length for getty or window command*/
#define ALL p = itab; p ; p = p->next
#define EVER ;;
#define SCPYN(a, b) strncpy(a, b, sizeof(a))
#define SCMPN(a, b) strncmp(a, b, sizeof(a))
#define CMDSIZ 200 /* max string length for getty or window command*/
#define ALL p = itab; p ; p = p->next
#define EVER ;;
#define SCPYN(a, b) strncpy(a, b, sizeof(a))
#define SCMPN(a, b) strncmp(a, b, sizeof(a))
-char shell[] =
"/bin/sh"
;
+char shell[] =
_PATH_BSHELL
;
char minus[] = "-";
char minus[] = "-";
-char runc[] = "/etc/rc";
-char utmpf[] = "/etc/utmp";
-char wtmpf[] = "/usr/adm/wtmp";
-char ctty[] = "/dev/console";
+char runc[] = _PATH_RC;
+char utmpf[] = _PATH_UTMP;
+char ctty[] = _PATH_CONSOLE;
-struct utmp wtmp;
struct tab
{
struct tab
{
- char line[
LINSIZ
];
+ char line[
UT_LINESIZE
];
char comn[CMDSIZ];
char xflag;
int pid;
char comn[CMDSIZ];
char xflag;
int pid;
@@
-53,7
+51,6
@@
int fi;
int mergflag;
char tty[20];
jmp_buf sjbuf, shutpass;
int mergflag;
char tty[20];
jmp_buf sjbuf, shutpass;
-time_t time0;
int reset();
int idle();
int reset();
int idle();
@@
-77,7
+74,6
@@
main(argc, argv)
#endif
int howto, oldhowto;
#endif
int howto, oldhowto;
- time0 = time(0);
#if defined(vax) || defined(tahoe)
howto = r11;
#else
#if defined(vax) || defined(tahoe)
howto = r11;
#else
@@
-172,23
+168,14
@@
shutend()
signal(SIGALRM, SIG_DFL);
for (i = 0; i < 10; i++)
close(i);
signal(SIGALRM, SIG_DFL);
for (i = 0; i < 10; i++)
close(i);
- f = open(wtmpf, O_WRONLY|O_APPEND);
- if (f >= 0) {
- SCPYN(wtmp.ut_line, "~");
- SCPYN(wtmp.ut_name, "shutdown");
- SCPYN(wtmp.ut_host, "");
- time(&wtmp.ut_time);
- write(f, (char *)&wtmp, sizeof(wtmp));
- close(f);
- }
- return (1);
+ logwtmp("~", "shutdown", "");
}
single()
{
register pid;
register xpid;
}
single()
{
register pid;
register xpid;
- extern errno;
+ extern
int
errno;
do {
pid = fork();
do {
pid = fork();
@@
-231,19
+218,7
@@
runcom(oldhowto)
;
if (status)
return (0);
;
if (status)
return (0);
- f = open(wtmpf, O_WRONLY|O_APPEND);
- if (f >= 0) {
- SCPYN(wtmp.ut_line, "~");
- SCPYN(wtmp.ut_name, "reboot");
- SCPYN(wtmp.ut_host, "");
- if (time0) {
- wtmp.ut_time = time0;
- time0 = 0;
- } else
- time(&wtmp.ut_time);
- write(f, (char *)&wtmp, sizeof(wtmp));
- close(f);
- }
+ logwtmp("~", "reboot", "");
return (1);
}
return (1);
}