2 * Pretty-print the prstatus flags.
4 * Arguments: unsigned long flags, int verbose
10 #if defined (NEW_PROC_API)
11 #define _STRUCTURED_PROC 1
15 #include <sys/types.h>
16 #include <sys/procfs.h>
18 /* Much of the information used in the /proc interface, particularly for
19 printing status information, is kept as tables of structures of the
20 following form. These tables can be used to map numeric values to
21 their symbolic names and to a string that describes their specific use. */
24 int value
; /* The numeric value */
25 char *name
; /* The equivalent symbolic value */
26 char *desc
; /* Short description of value */
29 /* Translate bits in the pr_flags member of the prstatus structure,
30 into the names and desc information. */
32 static struct trans pr_flag_table
[] =
34 #if defined (PR_STOPPED)
35 /* Sol2.5: lwp is stopped
36 * Sol2.6: lwp is stopped
37 * Sol2.7: lwp is stopped
38 * IRIX6: process is stopped
39 * OSF: task/thread is stopped
42 { PR_STOPPED
, "PR_STOPPED", "Process (LWP) is stopped" },
44 #if defined (PR_ISTOP)
45 /* Sol2.5: lwp is stopped on an event of interest
46 * Sol2.6: lwp is stopped on an event of interest
47 * Sol2.7: lwp is stopped on an event of interest
48 * IRIX6: process is stopped on event of interest
49 * OSF: task/thread stopped on event of interest
50 * UW: LWP stopped on an event of interest
52 { PR_ISTOP
, "PR_ISTOP", "Stopped on an event of interest" },
54 #if defined (PR_DSTOP)
55 /* Sol2.5: lwp has a stop directive in effect
56 * Sol2.6: lwp has a stop directive in effect
57 * Sol2.7: lwp has a stop directive in effect
58 * IRIX6: process has stop directive in effect
59 * OSF: task/thread has stop directive in effect
60 * UW: A stop directive is in effect
62 { PR_DSTOP
, "PR_DSTOP", "A stop directive is in effect" },
65 /* Sol2.5: lwp has a single-step directive in effect
66 * Sol2.6: lwp has a single-step directive in effect
67 * Sol2.7: lwp has a single-step directive in effect
68 * IRIX6: process has single step pending
70 { PR_STEP
, "PR_STEP", "A single step directive is in effect" },
72 #if defined (PR_ASLEEP)
73 /* Sol2.5: lwp is sleeping in a system call
74 * Sol2.6: lwp is sleeping in a system call
75 * Sol2.7: lwp is sleeping in a system call
76 * IRIX6: process is in an interruptible sleep
77 * OSF: task/thread is asleep within a system call
78 * UW: LWP is sleep()ing in a system call
80 { PR_ASLEEP
, "PR_ASLEEP", "Sleeping in an (interruptible) system call" },
82 #if defined (PR_PCINVAL)
83 /* Sol2.5: contents of pr_instr undefined
84 * Sol2.6: contents of pr_instr undefined
85 * Sol2.7: contents of pr_instr undefined
86 * IRIX6: current pc is invalid
87 * OSF: program counter contains invalid address
88 * UW: %pc refers to an invalid virtual address
90 { PR_PCINVAL
, "PR_PCINVAL", "PC (pr_instr) is invalid" },
92 #if defined (PR_ASLWP)
93 /* Sol2.5: this lwp is the aslwp
94 * Sol2.6: this lwp is the aslwp
95 * Sol2.7: this lwp is the aslwp
97 { PR_ASLWP
, "PR_ASLWP", "This is the asynchronous signal LWP" },
99 #if defined (PR_AGENT)
100 /* Sol2.6: this lwp is the /proc agent lwp
101 * Sol2.7: this lwp is the /proc agent lwp
103 { PR_AGENT
, "PR_AGENT", "This is the /proc agent LWP" },
105 #if defined (PR_ISSYS)
106 /* Sol2.5: system process
107 * Sol2.6: this is a system process
108 * Sol2.7: this is a system process
109 * IRIX6: process is a system process
110 * OSF: task/thread is a system task/thread
113 { PR_ISSYS
, "PR_ISSYS", "Is a system process/thread" },
115 #if defined (PR_VFORKP)
116 /* Sol2.6: process is the parent of a vfork()d child
117 * Sol2.7: process is the parent of a vfork()d child
119 { PR_VFORKP
, "PR_VFORKP", "Process is the parent of a vforked child" },
122 /* Sol2.6: process's process group is orphaned
123 * Sol2.7: process's process group is orphaned
125 { PR_ORPHAN
, "PR_ORPHAN", "Process's process group is orphaned" },
127 #if defined (PR_FORK)
128 /* Sol2.5: inherit-on-fork is in effect
129 * Sol2.6: inherit-on-fork is in effect
130 * Sol2.7: inherit-on-fork is in effect
131 * IRIX6: process has inherit-on-fork flag set
132 * OSF: task/thread has inherit-on-fork flag set
133 * UW: inherit-on-fork is in effect
135 { PR_FORK
, "PR_FORK", "Inherit-on-fork is in effect" },
138 /* Sol2.5: run-on-last-close is in effect
139 * Sol2.6: run-on-last-close is in effect
140 * Sol2.7: run-on-last-close is in effect
141 * IRIX6: process has run-on-last-close flag set
142 * OSF: task/thread has run-on-last-close flag set
143 * UW: Run-on-last-close is in effect
145 { PR_RLC
, "PR_RLC", "Run-on-last-close is in effect" },
148 /* Sol2.5: kill-on-last-close is in effect
149 * Sol2.6: kill-on-last-close is in effect
150 * Sol2.7: kill-on-last-close is in effect
151 * IRIX6: process has kill-on-last-close flag set
152 * OSF: kill-on-last-close, superceeds RLC
153 * UW: kill-on-last-close is in effect
155 { PR_KLC
, "PR_KLC", "Kill-on-last-close is in effect" },
157 #if defined (PR_ASYNC)
158 /* Sol2.5: asynchronous-stop is in effect
159 * Sol2.6: asynchronous-stop is in effect
160 * Sol2.7: asynchronous-stop is in effect
161 * OSF: asynchronous stop mode is in effect
162 * UW: asynchronous stop mode is in effect
164 { PR_ASYNC
, "PR_ASYNC", "Asynchronous stop is in effect" },
166 #if defined (PR_MSACCT)
167 /* Sol2.5: micro-state usage accounting is in effect
168 * Sol2.6: micro-state usage accounting is in effect
169 * Sol2.7: micro-state usage accounting is in effect
171 { PR_MSACCT
, "PR_MSACCT", "Microstate accounting enabled" },
173 #if defined (PR_BPTADJ)
174 /* Sol2.5: breakpoint trap pc adjustment is in effect
175 * Sol2.6: breakpoint trap pc adjustment is in effect
176 * Sol2.7: breakpoint trap pc adjustment is in effect
178 { PR_BPTADJ
, "PR_BPTADJ", "Breakpoint PC adjustment in effect" },
180 #if defined (PR_PTRACE)
181 /* Note: different meanings on Solaris and Irix 6
182 * Sol2.5: obsolete, never set in SunOS5.0
183 * Sol2.6: ptrace-compatibility mode is in effect
184 * Sol2.7: ptrace-compatibility mode is in effect
185 * IRIX6: process is traced with ptrace() too
186 * OSF: task/thread is being traced by ptrace
187 * UW: Process is being controlled by ptrace(2)
189 { PR_PTRACE
, "PR_PTRACE", "Process is being controlled by ptrace" },
191 #if defined (PR_PCOMPAT)
192 /* Note: PCOMPAT on Sol2.5 means same thing as PTRACE on Sol2.6
193 * Sol2.5 (only): ptrace-compatibility mode is in effect
195 { PR_PCOMPAT
, "PR_PCOMPAT", "Ptrace compatibility mode in effect" },
198 /* Sol2.6: micro-state accounting inherited on fork
199 * Sol2.7: micro-state accounting inherited on fork
201 { PR_MSFORK
, "PR_PCOMPAT", "Micro-state accounting inherited on fork" },
205 /* Irix6: process is a kernel thread */
206 { PR_ISKTHREAD
, "PR_KTHREAD", "Process is a kernel thread" },
210 /* OSF (only): abort the current stop condition */
211 { PR_ABORT
, "PR_ABORT", "Abort the current stop condition" },
215 /* OSF: task is traced */
216 { PR_TRACING
, "PR_TRACING", "Task is traced" },
220 /* OSF: stop child on fork */
221 { PR_STOPFORK
, "PR_STOPFORK", "Stop child on fork" },
225 /* OSF: stop on exec */
226 { PR_STOPEXEC
, "PR_STOPEXEC", "Stop on exec" },
230 /* OSF: stop on task exit */
231 { PR_STOPTERM
, "PR_STOPTERM", "Stop on task exit" },
235 /* OSF: stop on thread creation */
236 { PR_STOPTCR
, "PR_STOPTCR", "Stop on thread creation" },
240 /* OSF: stop on thread exit */
241 { PR_STOPTTERM
, "PR_STOPTTERM", "Stop on thread exit" },
245 /* OSF: user level scheduling is in effect */
246 { PR_USCHED
, "PR_USCHED", "User level scheduling is in effect" },
251 proc_prettyfprint_flags (file
, flags
, verbose
)
258 for (i
= 0; i
< sizeof (pr_flag_table
) / sizeof (pr_flag_table
[0]); i
++)
259 if (flags
& pr_flag_table
[i
].value
)
261 fprintf (file
, "%s ", pr_flag_table
[i
].name
);
263 fprintf (file
, "%s\n", pr_flag_table
[i
].desc
);
266 fprintf (file
, "\n");
270 proc_prettyprint_flags (flags
, verbose
)
274 proc_prettyfprint_flags (stdout
, flags
, verbose
);
This page took 0.041645 seconds and 4 git commands to generate.