summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
Diffstat (limited to 'sbin')
-rw-r--r--sbin/init/Makefile4
-rw-r--r--sbin/init/init.c16
-rw-r--r--sbin/reboot/Makefile4
-rw-r--r--sbin/reboot/reboot.c9
4 files changed, 22 insertions, 11 deletions
diff --git a/sbin/init/Makefile b/sbin/init/Makefile
index 7497a4b..7778c71 100644
--- a/sbin/init/Makefile
+++ b/sbin/init/Makefile
@@ -6,8 +6,8 @@ MAN= init.8
PRECIOUSPROG=
INSTALLFLAGS=-b -B.bak
CFLAGS+=-DDEBUGSHELL -DSECURE -DLOGIN_CAP -DCOMPAT_SYSV_INIT
-DPADD= ${LIBUTIL} ${LIBCRYPT}
-LDADD= -lutil -lcrypt
+DPADD= ${LIBUTIL} ${LIBULOG} ${LIBCRYPT}
+LDADD= -lutil -lulog -lcrypt
NO_SHARED?= YES
diff --git a/sbin/init/init.c b/sbin/init/init.c
index 8629b90..58e6739 100644
--- a/sbin/init/init.c
+++ b/sbin/init/init.c
@@ -65,6 +65,8 @@ static const char rcsid[] =
#include <syslog.h>
#include <time.h>
#include <ttyent.h>
+#define _ULOG_POSIX_NAMES
+#include <ulog.h>
#include <unistd.h>
#include <sys/reboot.h>
#include <err.h>
@@ -569,10 +571,8 @@ transition(state_t s)
static void
clear_session_logs(session_t *sp)
{
- char *line = sp->se_device + sizeof(_PATH_DEV) - 1;
- if (logout(line))
- logwtmp(line, "", "");
+ ulog_logout(sp->se_device);
}
/*
@@ -775,6 +775,7 @@ single_user(void)
static state_func_t
runcom(void)
{
+ struct utmpx utx;
state_func_t next_transition;
if ((next_transition = run_script(_PATH_RUNCOM)) != 0)
@@ -782,7 +783,9 @@ runcom(void)
runcom_mode = AUTOBOOT; /* the default */
/* NB: should send a message to the session logger to avoid blocking. */
- logwtmp("~", "reboot", "");
+ utx.ut_type = BOOT_TIME;
+ gettimeofday(&utx.ut_tv, NULL);
+ pututxline(&utx);
return (state_func_t) read_ttys;
}
@@ -1487,13 +1490,16 @@ alrm_handler(int sig)
static state_func_t
death(void)
{
+ struct utmpx utx;
session_t *sp;
int i;
pid_t pid;
static const int death_sigs[2] = { SIGTERM, SIGKILL };
/* NB: should send a message to the session logger to avoid blocking. */
- logwtmp("~", "shutdown", "");
+ utx.ut_type = SHUTDOWN_TIME;
+ gettimeofday(&utx.ut_tv, NULL);
+ pututxline(&utx);
/*
* Also revoke the TTY here. Because runshutdown() may reopen
diff --git a/sbin/reboot/Makefile b/sbin/reboot/Makefile
index fe02f26..2a2f6f1 100644
--- a/sbin/reboot/Makefile
+++ b/sbin/reboot/Makefile
@@ -2,8 +2,8 @@
# $FreeBSD$
PROG= reboot
-DPADD= ${LIBUTIL}
-LDADD= -lutil
+DPADD= ${LIBULOG}
+LDADD= -lulog
MAN= reboot.8 nextboot.8
MLINKS= reboot.8 halt.8 reboot.8 fastboot.8 reboot.8 fasthalt.8
diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c
index cae709f..0a9ac51 100644
--- a/sbin/reboot/reboot.c
+++ b/sbin/reboot/reboot.c
@@ -42,18 +42,20 @@ static char sccsid[] = "@(#)reboot.c 8.1 (Berkeley) 6/5/93";
__FBSDID("$FreeBSD$");
#include <sys/reboot.h>
+#include <sys/time.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <signal.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
-#include <libutil.h>
#include <pwd.h>
#include <syslog.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#define _ULOG_POSIX_NAMES
+#include <ulog.h>
#include <unistd.h>
static void usage(void);
@@ -64,6 +66,7 @@ int dohalt;
int
main(int argc, char *argv[])
{
+ struct utmpx utx;
const struct passwd *pw;
int ch, howto, i, fd, lflag, nflag, qflag, sverrno;
u_int pageins;
@@ -140,7 +143,9 @@ main(int argc, char *argv[])
syslog(LOG_CRIT, "rebooted by %s", user);
}
}
- logwtmp("~", "shutdown", "");
+ utx.ut_type = SHUTDOWN_TIME;
+ gettimeofday(&utx.ut_tv, NULL);
+ pututxline(&utx);
/*
* Do a sync early on, so disks start transfers while we're off
OpenPOWER on IntegriCloud