mirror of
https://github.com/troglobit/finit.git
synced 2026-11-13 17:00:16 +00:00
UTMP: Only account for getty processes
This patch removes accounting for all processes to instead implement the traditional SysV getty accounting. (Telnet/SSH et al maintain their own accounding for UTMP.) TODO: WTMP support Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
b6bf8bf518
commit
5bab329178
3 files changed
+4
-11
No files matched your search
@@ -106,9 +106,6 @@ int run(char *cmd)
|
|||||||
for (i = 1; i < NSIG; i++)
|
for (i = 1; i < NSIG; i++)
|
||||||
DFLSIG(sa, i, 0);
|
DFLSIG(sa, i, 0);
|
||||||
|
|
||||||
/* Set INIT_PROCESS UTMP entry */
|
|
||||||
utmp_set_init(ttyname(0), 0);
|
|
||||||
|
|
||||||
/* Always redirect stdio for run() */
|
/* Always redirect stdio for run() */
|
||||||
fp = fopen("/dev/null", "w");
|
fp = fopen("/dev/null", "w");
|
||||||
if (fp) {
|
if (fp) {
|
||||||
|
|||||||
@@ -152,7 +152,6 @@ static int service_start(svc_t *svc)
|
|||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
int status;
|
int status;
|
||||||
char id[5];
|
|
||||||
char *home = NULL;
|
char *home = NULL;
|
||||||
#ifdef ENABLE_STATIC
|
#ifdef ENABLE_STATIC
|
||||||
int uid = 0; /* XXX: Fix better warning that dropprivs is disabled. */
|
int uid = 0; /* XXX: Fix better warning that dropprivs is disabled. */
|
||||||
@@ -161,10 +160,6 @@ static int service_start(svc_t *svc)
|
|||||||
#endif
|
#endif
|
||||||
char *args[MAX_NUM_SVC_ARGS];
|
char *args[MAX_NUM_SVC_ARGS];
|
||||||
|
|
||||||
/* Set INIT_PROCESS UTMP entry */
|
|
||||||
snprintf(id, sizeof(id), "%d", svc->job);
|
|
||||||
utmp_set_init(ttyname(0), id);
|
|
||||||
|
|
||||||
/* Set desired user */
|
/* Set desired user */
|
||||||
if (uid >= 0) {
|
if (uid >= 0) {
|
||||||
setuid(uid);
|
setuid(uid);
|
||||||
@@ -667,9 +662,6 @@ void service_monitor(pid_t lost)
|
|||||||
svc_t *svc;
|
svc_t *svc;
|
||||||
char pidfile[MAX_ARG_LEN];
|
char pidfile[MAX_ARG_LEN];
|
||||||
|
|
||||||
/* Set DEAD_PROCESS UTMP entry */
|
|
||||||
utmp_set_dead(lost);
|
|
||||||
|
|
||||||
if (fexist(SYNC_SHUTDOWN) || lost <= 1)
|
if (fexist(SYNC_SHUTDOWN) || lost <= 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
|
#include "utmp-api.h"
|
||||||
|
|
||||||
LIST_HEAD(, tty_node) tty_list = LIST_HEAD_INITIALIZER();
|
LIST_HEAD(, tty_node) tty_list = LIST_HEAD_INITIALIZER();
|
||||||
|
|
||||||
@@ -198,6 +199,9 @@ int tty_respawn(pid_t pid)
|
|||||||
if (!entry)
|
if (!entry)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/* Set DEAD_PROCESS UTMP entry */
|
||||||
|
utmp_set_dead(pid);
|
||||||
|
|
||||||
/* Clear PID to be able to respawn it. */
|
/* Clear PID to be able to respawn it. */
|
||||||
entry->data.pid = 0;
|
entry->data.pid = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user