ps: changed to exploit a newly added UID used at login

This patch represents a newlib adaptation of the merge
request offered by Jan Rybar that is referenced below.

Reference(s):
https://gitlab.com/procps-ng/procps/merge_requests/57
https://bugzilla.redhat.com/show_bug.cgi?id=1518986

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2018-02-11 02:22:22 -06:00 committed by Craig Small
parent f341bd4632
commit 22887a61e1
4 changed files with 13 additions and 2 deletions

View File

@ -88,6 +88,7 @@ makEXT(ID_FGID)
makEXT(ID_FGROUP)
makEXT(ID_FUID)
makEXT(ID_FUSER)
makEXT(ID_LOGIN)
makEXT(ID_PGRP)
makEXT(ID_PID)
makEXT(ID_PPID)

View File

@ -78,6 +78,7 @@ makREL(ID_FGID)
makREL(ID_FGROUP)
makREL(ID_FUID)
makREL(ID_FUSER)
makREL(ID_LOGIN)
makREL(ID_PGRP)
makREL(ID_PID)
makREL(ID_PPID)

View File

@ -999,6 +999,11 @@ static int pr_fuid(char *restrict const outbuf, const proc_t *restrict const pp)
setREL1(ID_FUID)
return snprintf(outbuf, COLWID, "%d", rSv(ID_FUID, u_int, pp));
}
static int pr_luid(char *restrict const outbuf, const proc_t *restrict const pp){
setREL1(ID_LOGIN)
if(rSv(ID_LOGIN, s_int, pp)==-1) return snprintf(outbuf, COLWID, "-");
return snprintf(outbuf, COLWID, "%d", rSv(ID_LOGIN, s_int, pp));
}
// The Open Group Base Specifications Issue 6 (IEEE Std 1003.1, 2004 Edition)
// requires that user and group names print as decimal numbers if there is
@ -1428,7 +1433,7 @@ static const format_struct format_array[] = { /*
{"longtname", "TTY", pr_tty8, PIDS_TTY_NAME, 8, DEC, PO|LEFT},
{"lsession", "SESSION", pr_sd_session, PIDS_SD_SESS, 11, LNX, ET|LEFT},
{"lstart", "STARTED", pr_lstart, PIDS_TIME_START, 24, XXX, ET|RIGHT},
{"luid", "LUID", pr_nop, PIDS_noop, 5, LNX, ET|RIGHT}, /* login ID */
{"luid", "LUID", pr_luid, PIDS_ID_LOGIN, 5, LNX, ET|RIGHT}, /* login ID */
{"luser", "LUSER", pr_nop, PIDS_noop, 8, LNX, ET|USER}, /* login USER */
{"lwp", "LWP", pr_tasks, PIDS_ID_PID, 5, SUN, TO|PIDMAX|RIGHT},
{"lxc", "LXC", pr_lxcname, PIDS_LXCNAME, 8, LNX, ET|LEFT},

View File

@ -4,7 +4,7 @@
.\" Quick hack conversion by Albert Cahalan, 1998.
.\" Licensed under version 2 of the Gnu General Public License.
.\"
.TH PS 1 2018-01-13 "procps-ng" "User Commands"
.TH PS 1 "February, 2018" "procps-ng" "User Commands"
.\"
.\" To render this page:
.\" groff -t -b -man -X -P-resolution -P100 -Tps ps.1 &
@ -1329,6 +1329,10 @@ displays the login session identifier of a process,
if systemd support has been included.
T}
luid LUID T{
displays Login ID associated with a process.
T}
lwp LWP T{
light weight process (thread) ID of the dispatchable entity (alias
.BR spid , \ tid ).