1303 files changed, 32187 insertions, 57138 deletions
diff --git a/procps/uptime.c b/procps/uptime.c index 778812a..88f896a 100644 --- a/procps/uptime.c +++ b/procps/uptime.c @@ -11,9 +11,6 @@ * * Added FEATURE_UPTIME_UTMP_SUPPORT flag. */ - -/* getopt not needed */ - //config:config UPTIME //config: bool "uptime" //config: default y @@ -30,6 +27,10 @@ //config: help //config: Makes uptime display the number of users currently logged on. +//applet:IF_UPTIME(APPLET(uptime, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_UPTIME) += uptime.o + //usage:#define uptime_trivial_usage //usage: "" //usage:#define uptime_full_usage "\n\n" @@ -43,6 +44,8 @@ #ifdef __linux__ # include <sys/sysinfo.h> #endif +# include <utmp.h> + #ifndef FSHIFT @@ -81,10 +84,10 @@ int uptime_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) #if ENABLE_FEATURE_UPTIME_UTMP_SUPPORT { - struct utmp *ut; + struct utmpx *ut; unsigned users = 0; - while ((ut = getutent()) != NULL) { - if ((ut->ut_type == USER_PROCESS) && (ut->ut_name[0] != '\0')) + while ((ut = getutxent()) != NULL) { + if ((ut->ut_type == USER_PROCESS) && (ut->ut_user[0] != '\0')) users++; } printf(", %u users", users); |