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;
+}
+
+static int pr_sd_session(char *restrict const outbuf, const proc_t *restrict const pp){
+ int r;
+ size_t len;
+ char *session;
+
+ r = sd_pid_get_session(pp->tgid, &session);
+ if(r<0) goto fail;
+ len = snprintf(outbuf, COLWID, "%s", session);
+ free(session);
+ return len;
+
+fail:
+ outbuf[0] = '-';
+ outbuf[1] = '\0';
+ return 1;
+}
+
+static int pr_sd_ouid(char *restrict const outbuf, const proc_t *restrict const pp){
+ int r;
+ size_t len;
+ uid_t ouid;
+
+ r = sd_pid_get_owner_uid(pp->tgid, &ouid);
+ if(r<0) goto fail;
+ return snprintf(outbuf, COLWID, "%d", ouid);
+
+fail:
+ outbuf[0] = '-';
+ outbuf[1] = '\0';
+ return 1;
+}
+
+static int pr_sd_machine(char *restrict const outbuf, const proc_t *restrict const pp){
+ int r;
+ size_t len;
+ char *machine;
+ r = sd_pid_get_machine_name(pp->tgid, &machine);
+ if(r<0) goto fail;
+ len = snprintf(outbuf, COLWID, "%s", machine);
+ free(machine);
+ return len;
+
+fail:
+ outbuf[0] = '-';
+ outbuf[1] = '\0';
+ return 1;
+}
+
+static int pr_sd_uunit(char *restrict const outbuf, const proc_t *restrict const pp){
+ int r;
+ size_t len;
+ char *unit;
+
+ r = sd_pid_get_user_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;
+}
+
+static int pr_sd_seat(char *restrict const outbuf, const proc_t *restrict const pp){
+ int r;
+ size_t len;
+ char *session;
+ char *seat;
+ r = sd_pid_get_session(pp->tgid, &session);
+ if(r<0) goto fail;
+ r = sd_session_get_seat(session, &seat);
+ free(session);
+ if(r<0) goto fail;
+ len = snprintf(outbuf, COLWID, "%s", seat);
+ free(seat);
+ return len;
+
+fail:
+ outbuf[0] = '-';
+ outbuf[1] = '\0';
+ return 1;
+}
+
+#endif
+ /************************ Linux namespaces ******************************/
+
+ #define _pr_ns(NAME, ID)\
+ static int pr_##NAME(char *restrict const outbuf, const proc_t *restrict const pp) {\
+ if (pp->ns[ID])\
+ return snprintf(outbuf, COLWID, "%li", pp->ns[ID]);\
+ else\
+ return snprintf(outbuf, COLWID, "-");\
+ }
+ _pr_ns(ipcns, IPCNS);
+ _pr_ns(mntns, MNTNS);
+ _pr_ns(netns, NETNS);
+ _pr_ns(pidns, PIDNS);
+ _pr_ns(userns, USERNS);
+ _pr_ns(utsns, UTSNS);
+
/****************** FLASK & seLinux security stuff **********************/
// move the bulk of this to libproc sometime
{"usrpri", "UPR", pr_nop, sr_nop, 3, 0, DEC, TO|RIGHT}, /*upr*/
{"util", "C", pr_c, sr_pcpu, 2, 0, SGI, ET|RIGHT}, // not sure about "C"
{"utime", "UTIME", pr_nop, sr_utime, 6, 0, LNx, ET|RIGHT},
+ {"utsns", "UTSNS", pr_utsns, sr_utsns, 10, NS, LNX, ET|RIGHT},
+#ifdef WITH_SYSTEMD
+{"uunit", "UUNIT", pr_sd_uunit, sr_nop, 31, 0, LNX, ET|LEFT},
+#endif
{"vm_data", "DATA", pr_nop, sr_vm_data, 5, 0, LNx, PO|RIGHT},
{"vm_exe", "EXE", pr_nop, sr_vm_exe, 5, 0, LNx, PO|RIGHT},
{"vm_lib", "LIB", pr_nop, sr_vm_lib, 5, 0, LNx, PO|RIGHT},