Check that p->p_pptr is not NULL - kernel processes have no parents!

This commit is contained in:
des 2000-11-06 03:23:56 +00:00
parent c328a51c63
commit 3ea354e48a
3 changed files with 6 additions and 6 deletions

View File

@ -349,7 +349,7 @@ linprocfs_doprocstat(curp, p, pfs, uio)
#define PS_ADD(name, fmt, arg) ps += sprintf(ps, " " fmt, arg)
PS_ADD("comm", "(%s)", p->p_comm);
PS_ADD("statr", "%c", '0'); /* XXX */
PS_ADD("ppid", "%d", p->p_pptr->p_pid);
PS_ADD("ppid", "%d", p->p_pptr ? p->p_pptr->p_pid : 0);
PS_ADD("pgrp", "%d", p->p_pgid);
PS_ADD("session", "%d", p->p_session->s_sid);
PS_ADD("tty", "%d", 0); /* XXX */
@ -432,7 +432,7 @@ linprocfs_doprocstatus(curp, p, pfs, uio)
* Credentials
*/
PS_ADD(ps, "Pid:\t%d\n", p->p_pid);
PS_ADD(ps, "PPid:\t%d\n", p->p_pptr->p_pid);
PS_ADD(ps, "PPid:\t%d\n", p->p_pptr ? p->p_pptr->p_pid : 0);
PS_ADD(ps, "Uid:\t%d %d %d %d\n", p->p_cred->p_ruid,
p->p_ucred->cr_uid,
p->p_cred->p_svuid,

View File

@ -349,7 +349,7 @@ linprocfs_doprocstat(curp, p, pfs, uio)
#define PS_ADD(name, fmt, arg) ps += sprintf(ps, " " fmt, arg)
PS_ADD("comm", "(%s)", p->p_comm);
PS_ADD("statr", "%c", '0'); /* XXX */
PS_ADD("ppid", "%d", p->p_pptr->p_pid);
PS_ADD("ppid", "%d", p->p_pptr ? p->p_pptr->p_pid : 0);
PS_ADD("pgrp", "%d", p->p_pgid);
PS_ADD("session", "%d", p->p_session->s_sid);
PS_ADD("tty", "%d", 0); /* XXX */
@ -432,7 +432,7 @@ linprocfs_doprocstatus(curp, p, pfs, uio)
* Credentials
*/
PS_ADD(ps, "Pid:\t%d\n", p->p_pid);
PS_ADD(ps, "PPid:\t%d\n", p->p_pptr->p_pid);
PS_ADD(ps, "PPid:\t%d\n", p->p_pptr ? p->p_pptr->p_pid : 0);
PS_ADD(ps, "Uid:\t%d %d %d %d\n", p->p_cred->p_ruid,
p->p_ucred->cr_uid,
p->p_cred->p_svuid,

View File

@ -349,7 +349,7 @@ linprocfs_doprocstat(curp, p, pfs, uio)
#define PS_ADD(name, fmt, arg) ps += sprintf(ps, " " fmt, arg)
PS_ADD("comm", "(%s)", p->p_comm);
PS_ADD("statr", "%c", '0'); /* XXX */
PS_ADD("ppid", "%d", p->p_pptr->p_pid);
PS_ADD("ppid", "%d", p->p_pptr ? p->p_pptr->p_pid : 0);
PS_ADD("pgrp", "%d", p->p_pgid);
PS_ADD("session", "%d", p->p_session->s_sid);
PS_ADD("tty", "%d", 0); /* XXX */
@ -432,7 +432,7 @@ linprocfs_doprocstatus(curp, p, pfs, uio)
* Credentials
*/
PS_ADD(ps, "Pid:\t%d\n", p->p_pid);
PS_ADD(ps, "PPid:\t%d\n", p->p_pptr->p_pid);
PS_ADD(ps, "PPid:\t%d\n", p->p_pptr ? p->p_pptr->p_pid : 0);
PS_ADD(ps, "Uid:\t%d %d %d %d\n", p->p_cred->p_ruid,
p->p_ucred->cr_uid,
p->p_cred->p_svuid,