summaryrefslogtreecommitdiff
path: root/system/procps/use-utmpx.patch
diff options
context:
space:
mode:
Diffstat (limited to 'system/procps/use-utmpx.patch')
-rw-r--r--system/procps/use-utmpx.patch104
1 files changed, 5 insertions, 99 deletions
diff --git a/system/procps/use-utmpx.patch b/system/procps/use-utmpx.patch
index 83047cf22..608ea6182 100644
--- a/system/procps/use-utmpx.patch
+++ b/system/procps/use-utmpx.patch
@@ -1,20 +1,6 @@
-diff --git a/configure.ac b/configure.ac
-index bc84a0d..da2916e 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -44,7 +44,7 @@ AC_PROG_MAKE_SET
-
- # Checks for header files.
- AC_HEADER_MAJOR
--AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h langinfo.h libintl.h limits.h locale.h netinet/in.h stdint.h stdio_ext.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/time.h termios.h unistd.h utmp.h values.h wchar.h wctype.h])
-+AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h langinfo.h libintl.h limits.h locale.h netinet/in.h stdint.h stdio_ext.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/time.h termios.h unistd.h utmp.h utmpx.h values.h wchar.h wctype.h])
-
- # Checks for typedefs, structures, and compiler characteristics.
- AC_CHECK_HEADER_STDBOOL
-diff --git a/proc/whattime.c b/proc/whattime.c
-index c223cad..d55fd22 100644
---- a/proc/whattime.c
-+++ b/proc/whattime.c
+diff -ur a/proc/whattime.c b/proc/whattime.c
+--- a/proc/whattime.c 2022-05-04 07:08:11.390000000 +0000
++++ b/proc/whattime.c 2022-05-04 07:08:42.860000000 +0000
@@ -33,7 +33,7 @@
#include <fcntl.h>
#include <unistd.h>
@@ -24,7 +10,7 @@ index c223cad..d55fd22 100644
#include <sys/ioctl.h>
#include "whattime.h"
#include "sysinfo.h"
-@@ -42,7 +42,7 @@ static char buf[256];
+@@ -42,7 +43,7 @@
static double av[3];
char *sprint_uptime(int human_readable) {
@@ -33,7 +19,7 @@ index c223cad..d55fd22 100644
int upminutes, uphours, updays, upweeks, upyears, updecades;
int pos;
int comma;
-@@ -98,13 +98,13 @@ char *sprint_uptime(int human_readable) {
+@@ -98,13 +99,13 @@
/* count the number of users */
numuser = 0;
@@ -50,83 +36,3 @@ index c223cad..d55fd22 100644
pos += sprintf(buf + pos, "%2d user%s, ", numuser, numuser == 1 ? "" : "s");
-diff --git a/w.c b/w.c
-index 35710a3..6caa8a6 100644
---- a/w.c
-+++ b/w.c
-@@ -23,6 +23,7 @@
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-+#include "config.h"
- #include "c.h"
- #include "fileutils.h"
- #include "nls.h"
-@@ -54,14 +55,22 @@
- #include <termios.h>
- #include <time.h>
- #include <unistd.h>
--#include <utmp.h>
-+#ifdef HAVE_UTMPX_H
-+# include <utmpx.h>
-+#else
-+# include <utmp.h>
-+#endif
- #include <arpa/inet.h>
-
- static int ignoreuser = 0; /* for '-u' */
- static int oldstyle = 0; /* for '-o' */
- static proc_t **procs; /* our snapshot of the process table */
-
-+#ifdef HAVE_UTMPX_H
-+typedef struct utmpx utmp_t;
-+#else
- typedef struct utmp utmp_t;
-+#endif
-
- #ifdef W_SHOWFROM
- # define FROM_STRING "on"
-@@ -604,11 +613,19 @@ int main(int argc, char **argv)
- printf(_(" IDLE WHAT\n"));
- }
-
-+#ifdef HAVE_UTMPX_H
-+ setutxent();
-+#else
- utmpname(UTMP_FILE);
- setutent();
-+#endif
- if (user) {
- for (;;) {
-+#ifdef HAVE_UTMPX_H
-+ u = getutxent();
-+#else
- u = getutent();
-+#endif
- if (unlikely(!u))
- break;
- if (u->ut_type != USER_PROCESS)
-@@ -619,7 +636,11 @@ int main(int argc, char **argv)
- }
- } else {
- for (;;) {
-+#ifdef HAVE_UTMPX_H
-+ u = getutxent();
-+#else
- u = getutent();
-+#endif
- if (unlikely(!u))
- break;
- if (u->ut_type != USER_PROCESS)
-@@ -629,7 +650,11 @@ int main(int argc, char **argv)
- fromlen, ip_addresses);
- }
- }
-+#ifdef HAVE_UTMPX_H
-+ endutxent();
-+#else
- endutent();
-+#endif
-
- return EXIT_SUCCESS;
- }