diff --git a/configure.ac b/configure.ac index 20bc3ce0..f08867cf 100644 --- a/configure.ac +++ b/configure.ac @@ -154,8 +154,8 @@ AC_ARG_WITH([systemd], [], [with_systemd=no] ) if test "x$with_systemd" != xno; then - PKG_CHECK_MODULES([SYSTEMD], [libsystemd-login >= 202], [], [ - AC_CHECK_LIB(systemd-login, sd_pid_get_machine_name, [have_systemd=yes], [have_systemd=no]) + PKG_CHECK_MODULES([SYSTEMD], [libsystemd-login >= 206], [], [ + AC_CHECK_LIB(systemd-login, sd_pid_get_slice, [have_systemd=yes], [have_systemd=no]) if test "x$have_systemd" = xno; then AC_MSG_ERROR([systemd support missing/incomplete]) fi diff --git a/ps/output.c b/ps/output.c index 2e9056e5..9be334e6 100644 --- a/ps/output.c +++ b/ps/output.c @@ -1292,6 +1292,23 @@ fail: return 1; } +static int pr_sd_slice(char *restrict const outbuf, const proc_t *restrict const pp){ + int r; + size_t len; + char *slice; + + r = sd_pid_get_slice(pp->tgid, &slice); + if(r<0) goto fail; + len = snprintf(outbuf, COLWID, "%s", slice); + free(slice); + return len; + +fail: + outbuf[0] = '-'; + outbuf[1] = '\0'; + return 1; +} + #endif /************************ Linux namespaces ******************************/ @@ -1675,6 +1692,9 @@ static const format_struct format_array[] = { {"sigmask", "BLOCKED", pr_sigmask, sr_nop, 9, 0, XXX, TO|SIGNAL}, /*blocked*/ {"size", "SIZE", pr_swapable, sr_swapable, 5, 0, SCO, PO|RIGHT}, {"sl", "SL", pr_nop, sr_nop, 3, 0, XXX, AN|RIGHT}, +#ifdef WITH_SYSTEMD +{"slice", "SLICE", pr_sd_slice, sr_nop, 31, 0, LNX, ET|LEFT}, +#endif {"spid", "SPID", pr_tasks, sr_tasks, 5, 0, SGI, TO|PIDMAX|RIGHT}, {"stackp", "STACKP", pr_stackp, sr_start_stack, 8, 0, LNX, PO|RIGHT}, /*start_stack*/ {"start", "STARTED", pr_start, sr_nop, 8, 0, XXX, ET|RIGHT}, diff --git a/ps/ps.1 b/ps/ps.1 index 80e5ce87..cdb7536b 100644 --- a/ps/ps.1 +++ b/ps/ps.1 @@ -1582,6 +1582,10 @@ to dirty all writable pages and then be swapped out. This number is very rough! T} +slice SLICE T{ +displays slice unit which a process belongs to. +T} + spid SPID T{ see .BR lwp .