diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2013-09-22 17:28:35 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2013-09-22 17:28:35 +0000 |
commit | f8caf955c3775ce75e26a7247df8959d1c2230cc (patch) | |
tree | e3eb5e1bdb728245e5fa1f77bb5b3b94e2ae6980 /bin | |
parent | 9a50a70472a4c05f1f8bfd17e5a13abd50327b78 (diff) |
Stop merging the per-thread and per-process flags when reporting
them via sysctl(KERN_PROC). In struct kinfo_proc the per-process
flags move to p_psflags, leaving the per-thread flags in p_flags.
Flag descriptions in ps(1) updated to be less obtuse.
discussed with matthew@ some time ago; ok jca@, manpage bits ok jmc@
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ps/keyword.c | 4 | ||||
-rw-r--r-- | bin/ps/print.c | 8 | ||||
-rw-r--r-- | bin/ps/ps.1 | 59 | ||||
-rw-r--r-- | bin/ps/ps.c | 4 |
4 files changed, 42 insertions, 33 deletions
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index 21eac632377..fadd0fc79c9 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -1,4 +1,4 @@ -/* $OpenBSD: keyword.c,v 1.37 2012/04/11 17:33:26 guenther Exp $ */ +/* $OpenBSD: keyword.c,v 1.38 2013/09/22 17:28:34 guenther Exp $ */ /* $NetBSD: keyword.c,v 1.12.6.1 1996/05/30 21:25:13 cgd Exp $ */ /*- @@ -84,6 +84,7 @@ int utime(), stime(), ixrss(), idrss(), isrss(); #define CWDLEN 40 /* Bit types must match their respective entries in struct kinfo_proc */ +/* Entries must be sorted in lexical ascending order! */ VAR var[] = { {"%cpu", "%CPU", NULL, NLIST, pcpu, 4}, {"%mem", "%MEM", NULL, NLIST, pmem, 4}, @@ -144,6 +145,7 @@ VAR var[] = { {"pmem", "", "%mem"}, PID("ppid", "PPID", pvar, POFF(p_ppid)), {"pri", "PRI", NULL, 0, pri, 3}, + {"procflags", "PROCF", NULL, 0, pvar, 7, 0, POFF(p_psflags), INT32, "x"}, {"re", "RE", NULL, INF127, pvar, 3, 0, POFF(p_swtime), UINT32, "u"}, GID("rgid", "RGID", pvar, POFF(p_rgid)), /* XXX */ diff --git a/bin/ps/print.c b/bin/ps/print.c index 46d06c66c82..835d345dadb 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print.c,v 1.54 2013/03/23 21:12:31 tedu Exp $ */ +/* $OpenBSD: print.c,v 1.55 2013/09/22 17:28:34 guenther Exp $ */ /* $NetBSD: print.c,v 1.27 1995/09/29 21:58:12 cgd Exp $ */ /*- @@ -255,13 +255,13 @@ state(const struct kinfo_proc *kp, VARENT *ve) *cp++ = '<'; else if (kp->p_nice > NZERO) *cp++ = 'N'; - if (flag & P_TRACED) + if (kp->p_psflags & PS_TRACED) *cp++ = 'X'; if (flag & P_SYSTRACE) *cp++ = 'x'; if (flag & P_WEXIT && kp->p_stat != SZOMB) *cp++ = 'E'; - if (flag & PS_ISPWAIT) + if (kp->p_psflags & PS_ISPWAIT) *cp++ = 'V'; if (flag & P_SYSTEM) *cp++ = 'K'; @@ -270,7 +270,7 @@ state(const struct kinfo_proc *kp, VARENT *ve) *cp++ = '>'; if (kp->p_eflag & EPROC_SLEADER) *cp++ = 's'; - if ((flag & P_CONTROLT) && kp->p__pgid == kp->p_tpgid) + if ((kp->p_psflags & PS_CONTROLT) && kp->p__pgid == kp->p_tpgid) *cp++ = '+'; *cp = '\0'; diff --git a/bin/ps/ps.1 b/bin/ps/ps.1 index 432df90e1f9..b9b855d64ab 100644 --- a/bin/ps/ps.1 +++ b/bin/ps/ps.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ps.1,v 1.83 2012/08/02 03:18:48 guenther Exp $ +.\" $OpenBSD: ps.1,v 1.84 2013/09/22 17:28:34 guenther Exp $ .\" $NetBSD: ps.1,v 1.16 1996/03/21 01:36:28 jtc Exp $ .\" .\" Copyright (c) 1980, 1990, 1991, 1993, 1994 @@ -30,7 +30,7 @@ .\" .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" -.Dd $Mdocdate: August 2 2012 $ +.Dd $Mdocdate: September 22 2013 $ .Dt PS 1 .Os .Sh NAME @@ -218,40 +218,25 @@ Name of system call emulation environment. .It Cm flags Alias: .Cm f . -The union of the flags (in hexadecimal) associated with the process -and the thread as in the include file +The thread flags (in hexadecimal), as defined in the include file .Aq Pa sys/proc.h : .Bd -literal -PS_CONTROLT 0x2 process has a controlling terminal +P_INKTR 0x1 writing ktrace(2) record P_SIGSUSPEND 0x8 need to restore before-suspend mask -PS_PPWAIT 0x10 parent is waiting for child to - exec/exit -PS_PROFIL 0x20 process has started profiling P_SELECT 0x40 selecting; wakeup/waiting danger P_SINTR 0x80 sleep is interruptible -PS_SUGID 0x100 process had set ID privileges since - last exec P_SYSTEM 0x200 system process: no sigs, stats, or - swapping + swapping P_TIMEOUT 0x400 timing out during sleep -P_TRACED 0x800 process is being traced -P_WAITED 0x1000 debugging process has waited for - child P_WEXIT 0x2000 working on exiting -PS_EXEC 0x4000 process called exec(3) -P_OWEUPC 0x8000 owe process an addupc() call at next - ast -.\" the routine addupc is not documented in the man pages -PS_ISPWAIT 0x10000 is parent of PPWAIT child -P_SSTEP 0x20000 process needs single-step fixup -PS_SUGIDEXEC 0x40000 last exec(3) was set[ug]id +P_OWEUPC 0x8000 profiling sample needs recording P_NOZOMBIE 0x100000 pid 1 waits for me instead of dad -P_INEXEC 0x200000 process is doing an exec right now -P_SYSTRACE 0x400000 process system call tracing is active -P_THREAD 0x4000000 only a thread, not a real process -P_IGNEXITRV 0x8000000 for thread kills +P_SYSTRACE 0x400000 systrace(4) policy is active +P_CONTINUED 0x800000 thread has continued after a stop +P_THREAD 0x4000000 not the original thread +P_SUSPSIG 0x8000000 stopped because of a signal P_SOFTDEP 0x10000000 stuck processing softdep worklist -P_STOPPED 0x20000000 just stopped +P_STOPPED 0x20000000 just stopped, need to send SIGCHLD P_CPUPEG 0x40000000 do not move to another cpu .Ed .It Cm gid @@ -326,6 +311,28 @@ Process ID. Parent process ID. .It Cm pri Scheduling priority. +.It Cm procflags +The process flags (in hexadecimal), as defined in the include file +.Aq Pa sys/proc.h : +.Bd -literal +PS_CONTROLT 0x1 process has a controlling terminal +PS_EXEC 0x2 process called exec(3) +PS_INEXEC 0x4 process is doing an exec right now +PS_EXITING 0x8 process is exiting +PS_SUGID 0x10 process had set ID privileges since + last exec +PS_SUGIDEXEC 0x20 last exec(3) was set[ug]id +PS_PPWAIT 0x40 parent is waiting for process to + exec/exit +PS_ISPWAIT 0x80 process is parent of PPWAIT child +PS_PROFIL 0x100 process has started profiling +PS_TRACED 0x200 process is being traced +PS_WAITED 0x400 debugging process has waited for + child +PS_COREDUMP 0x800 busy coredumping +PS_SINGLEEXIT 0x1000 other threads must die +PS_SINGLEUNWIND 0x2000 other threads must unwind +.Ed .It Cm re Core residency time (in seconds; 127 = infinity). .It Cm rgid diff --git a/bin/ps/ps.c b/bin/ps/ps.c index 95f6f49b309..c321963a4c2 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ps.c,v 1.55 2012/04/21 03:14:50 guenther Exp $ */ +/* $OpenBSD: ps.c,v 1.56 2013/09/22 17:28:34 guenther Exp $ */ /* $NetBSD: ps.c,v 1.15 1995/05/18 20:33:25 mycroft Exp $ */ /*- @@ -339,7 +339,7 @@ main(int argc, char *argv[]) if (showthreads == 0 && (kinfo[i]->p_flag & P_THREAD) != 0) continue; if (xflg == 0 && ((int)kinfo[i]->p_tdev == NODEV || - (kinfo[i]->p_flag & P_CONTROLT ) == 0)) + (kinfo[i]->p_psflags & PS_CONTROLT ) == 0)) continue; if (showthreads && kinfo[i]->p_tid == -1) continue; |