2 * Pretty-print the pr_why value.
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 values in the pr_why field of the prstatus struct. */
31 static struct trans pr_why_table
[] =
33 #if defined (PR_REQUESTED)
35 { PR_REQUESTED
, "PR_REQUESTED",
36 "Directed to stop by debugger via P(IO)CSTOP or P(IO)CWSTOP" },
38 #if defined (PR_SIGNALLED)
40 { PR_SIGNALLED
, "PR_SIGNALLED", "Receipt of a traced signal" },
42 #if defined (PR_SYSENTRY)
44 { PR_SYSENTRY
, "PR_SYSENTRY", "Entry to a traced system call" },
46 #if defined (PR_SYSEXIT)
48 { PR_SYSEXIT
, "PR_SYSEXIT", "Exit from a traced system call" },
50 #if defined (PR_JOBCONTROL)
52 { PR_JOBCONTROL
, "PR_JOBCONTROL", "Default job control stop signal action" },
54 #if defined (PR_FAULTED)
56 { PR_FAULTED
, "PR_FAULTED", "Incurred a traced hardware fault" },
58 #if defined (PR_SUSPENDED)
59 /* Solaris and UnixWare */
60 { PR_SUSPENDED
, "PR_SUSPENDED", "Process suspended" },
62 #if defined (PR_CHECKPOINT)
64 { PR_CHECKPOINT
, "PR_CHECKPOINT", "Process stopped at checkpoint" },
66 #if defined (PR_FORKSTOP)
68 { PR_FORKSTOP
, "PR_FORKSTOP", "Process stopped at end of fork call" },
70 #if defined (PR_TCRSTOP)
72 { PR_TCRSTOP
, "PR_TCRSTOP", "Process stopped on thread creation" },
74 #if defined (PR_TTSTOP)
76 { PR_TTSTOP
, "PR_TTSTOP", "Process stopped on thread termination" },
80 { PR_DEAD
, "PR_DEAD", "Process stopped in exit system call" },
85 proc_prettyfprint_why (file
, why
, what
, verbose
)
96 for (i
= 0; i
< sizeof (pr_why_table
) / sizeof (pr_why_table
[0]); i
++)
97 if (why
== pr_why_table
[i
].value
)
99 fprintf (file
, "%s ", pr_why_table
[i
].name
);
101 fprintf (file
, ": %s ", pr_why_table
[i
].desc
);
106 break; /* Nothing more to print. */
110 proc_prettyfprint_signal (file
, what
, verbose
);
115 proc_prettyfprint_fault (file
, what
, verbose
);
120 fprintf (file
, "Entry to ");
121 proc_prettyfprint_syscall (file
, what
, verbose
);
126 fprintf (file
, "Exit from ");
127 proc_prettyfprint_syscall (file
, what
, verbose
);
132 proc_prettyfprint_signal (file
, what
, verbose
);
137 fprintf (file
, "Exit status: %d\n", what
);
141 fprintf (file
, "Unknown why %d, what %d\n", why
, what
);
144 fprintf (file
, "\n");
148 fprintf (file
, "Unknown pr_why.\n");
152 proc_prettyprint_why (why
, what
, verbose
)
157 proc_prettyfprint_why (stdout
, why
, what
, verbose
);
This page took 0.032825 seconds and 4 git commands to generate.