fi
AC_SUBST(DEJAGNU)
+AC_ARG_WITH([systemd],
+ [AS_HELP_STRING([--with-systemd], [enable systemd support])],
+ [], [with_systemd=no])
+
+if test "x$with_systemd" != xno; then
+ PKG_CHECK_MODULES([SYSTEMD], [libsystemd-login], [], [
+ AC_CHECK_LIB(systemd-login, sd_pid_get_unit, [have_systemd=yes], [have_systemd=no])
+ if test "x$have_systemd" = xno; then
+ AC_MSG_ERROR([systemd support missing/incomplete])
+ fi
+ SYSTEMD_LIBS="-lsystemd-login"
+ ])
+ AM_CONDITIONAL(WITH_SYSTEMD, true)
+ AC_DEFINE(WITH_SYSTEMD, 1, [enable systemd support])
+else
+ AM_CONDITIONAL(WITH_SYSTEMD, false)
+fi
+
AC_CONFIG_FILES([
Makefile
include/Makefile
#include "common.h"
+#ifdef WITH_SYSTEMD
+#include <systemd/sd-login.h>
+#endif
+
/* TODO:
* Stop assuming system time is local time.
*/
return snprintf(outbuf, COLWID, "*");
}
+#ifdef WITH_SYSTEMD
+/************************* Systemd stuff ********************************/
+static int pr_sd_unit(char *restrict const outbuf, const proc_t *restrict const pp){
+ int r;
+ size_t len;
+ char *unit;
+
+ r = sd_pid_get_unit(pp->tgid, &unit);
+ if(r<0) goto fail;
+ len = snprintf(outbuf, COLWID, "%s", unit);
+ free(unit);
+ return len;
+fail:
+ outbuf[0] = '-';
+ outbuf[1] = '\0';
+ return 1;
+}
+#endif
/****************** FLASK & seLinux security stuff **********************/
// move the bulk of this to libproc sometime
{"sched", "SCH", pr_sched, sr_sched, 3, 0, AIX, TO|RIGHT},
{"scnt", "SCNT", pr_nop, sr_nop, 4, 0, DEC, AN|RIGHT}, /* man page misspelling of scount? */
{"scount", "SC", pr_nop, sr_nop, 4, 0, AIX, AN|RIGHT}, /* scnt==scount, DEC claims both */
+#ifdef WITH_SYSTEMD
+{"sd_unit", "UNIT", pr_sd_unit, sr_nop, 31, 0, LNX, ET|LEFT},
+#endif
{"sess", "SESS", pr_sess, sr_session, 5, 0, XXX, PO|PIDMAX|RIGHT},
{"session", "SESS", pr_sess, sr_session, 5, 0, LNX, PO|PIDMAX|RIGHT},
{"sgi_p", "P", pr_sgi_p, sr_nop, 1, 0, LNX, TO|RIGHT}, /* "cpu" number */