SOURCES: initng-utmpx.patch (NEW) - pld has utmpx, attempt to use ...

glen glen at pld-linux.org
Fri Jul 29 19:42:22 CEST 2005


Author: glen                         Date: Fri Jul 29 17:42:22 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- pld has utmpx, attempt to use that

---- Files affected:
SOURCES:
   initng-utmpx.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/initng-utmpx.patch
diff -u /dev/null SOURCES/initng-utmpx.patch:1.1
--- /dev/null	Fri Jul 29 19:42:22 2005
+++ SOURCES/initng-utmpx.patch	Fri Jul 29 19:42:16 2005
@@ -0,0 +1,69 @@
+--- ./plugins/initctl/initng_initctl.c~	2005-07-29 19:24:19.000000000 +0300
++++ ./plugins/initctl/initng_initctl.c	2005-07-29 19:24:22.000000000 +0300
+@@ -32,6 +32,7 @@
+ #include <errno.h>
+ #include <dirent.h>
+ #include <ctype.h>
++#include <sys/time.h>
+ 
+ #include "../../src/initng_global.h"
+ #include "../../src/process_db.h"
+@@ -43,7 +44,7 @@
+ #include "../../src/initng_toolbox.h"
+ #include "../../src/initng_plugin_hook.h"
+ 
+-#include <utmp.h>
++#include <utmpx.h>
+ #include "initreq.h"
+ 
+ #include "initng_initctl.h"
+@@ -191,15 +192,15 @@
+ static void makeutmp(int runlevel)
+ {
+     D_("Making utmp file for runlevel %d\n", runlevel);
+-    struct utmp utmp;
+-    time_t t;
++    struct utmpx utmpx;
++	struct timeval tv;
+ 
+     /*
+      * this is created by bootmisc, if this isn't there we can't set runlevel.
+      */
+-    if (access(UTMP_FILE, F_OK) < 0)
++    if (access(UTMPX_FILE, F_OK) < 0)
+     {
+-        F_("/var/run/utmp does not exist, this should be created by bootmisc.i\n");
++        F_("%s not exist, this should be created by bootmisc.i\n", UTMPX_FILE);
+         return;
+     }
+     /*
+@@ -207,19 +208,20 @@
+        utmpname("/var/run/utmp");
+      */
+ 
+-    setutent();
+-    memset(&utmp, 0, sizeof(utmp));
+-    utmp.ut_type = RUN_LVL;
+-    utmp.ut_pid = ('#' << 8) + runlevel + '0';
+-    time(&t);
+-    utmp.ut_time = (int) t;
+-    if (pututline(&utmp) == NULL)
++    setutxent();
++    memset(&utmpx, 0, sizeof(utmpx));
++    utmpx.ut_type = RUN_LVL;
++    utmpx.ut_pid = ('#' << 8) + runlevel + '0';
++	gettimeofday (&tv, NULL);
++	utmpx.ut_tv.tv_sec = tv.tv_sec;
++	utmpx.ut_tv.tv_usec = tv.tv_usec;
++    if (pututxline(&utmpx) == NULL)
+     {
+         F_("pututline failed\n");
+-        endutent();
++        endutxent();
+         return;
+     }
+-    endutent();
++    endutxent();
+     return;
+ }
+ 
================================================================



More information about the pld-cvs-commit mailing list