ps: possibility to display machine name for a process

Library systemd-login offers possibility to display
the name of the VM or container which process belongs to.

This patch adds output option "sd_machine" which will
show machine name or "-" when the name can not be determined.

To maintain compatibility with non-systemd systems,
procps must be configured with --with-systemd option
to enable this option.
This commit is contained in:
Lukas Nykryn
2013-04-22 12:33:31 +02:00
parent 785776c10d
commit 4c1536d5f1
3 changed files with 22 additions and 2 deletions

View File

@@ -269,8 +269,8 @@ AC_ARG_WITH([systemd],
[], [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])
PKG_CHECK_MODULES([SYSTEMD], [libsystemd-login >= 202], [], [
AC_CHECK_LIB(systemd-login, sd_pid_get_machine_name, [have_systemd=yes], [have_systemd=no])
if test "x$have_systemd" = xno; then
AC_MSG_ERROR([systemd support missing/incomplete])
fi