From 2e3a1e0f028ae5498d96a4a3618a3533e062d2eb Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Sat, 29 May 2021 18:08:52 +0300 Subject: Remove the concept of process owner Now that it's completely unused. procinfo.owner is now simply set to the first UID that a process has. proc_setowner () is kept for compatibility, but now does nothing. The clients still try to call it, though, for compatibility with older proc server versions. --- proc/info.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'proc/info.c') diff --git a/proc/info.c b/proc/info.c index ab74fb39..c2d7ad67 100644 --- a/proc/info.c +++ b/proc/info.c @@ -500,6 +500,7 @@ S_proc_getprocinfo (struct proc *callerp, struct proc *tp; task_t task; /* P's task port. */ mach_port_t msgport; /* P's msgport, or MACH_PORT_NULL if none. */ + int owned; /* No need to check CALLERP here; we don't use it. */ @@ -624,6 +625,8 @@ S_proc_getprocinfo (struct proc *callerp, *piarraylen = structsize / sizeof (int); pi = (struct procinfo *) *piarray; + owned = p->p_id && p->p_id->i_nuids; + pi->state = ((p->p_stopped ? PI_STOPPED : 0) | (p->p_exec ? PI_EXECED : 0) @@ -631,12 +634,12 @@ S_proc_getprocinfo (struct proc *callerp, | (!p->p_pgrp->pg_orphcnt ? PI_ORPHAN : 0) | (p->p_msgport == MACH_PORT_NULL ? PI_NOMSG : 0) | (p->p_pgrp->pg_session->s_sid == p->p_pid ? PI_SESSLD : 0) - | (p->p_noowner ? PI_NOTOWNED : 0) + | (owned ? 0 : PI_NOTOWNED) | (!p->p_parentset ? PI_NOPARENT : 0) | (p->p_traced ? PI_TRACED : 0) | (p->p_msgportwait ? PI_GETMSG : 0) | (p->p_loginleader ? PI_LOGINLD : 0)); - pi->owner = p->p_owner; + pi->owner = owned ? p->p_id->i_uids[0] : 0; pi->ppid = p->p_parent->p_pid; pi->pgrp = p->p_pgrp->pg_pgid; pi->session = p->p_pgrp->pg_session->s_sid; -- cgit v1.2.3