aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/user.h
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2007-12-02 21:52:18 +0000
committerRobert Watson <rwatson@FreeBSD.org>2007-12-02 21:52:18 +0000
commit1cc8c45c54e9955fa69423473727be0056662cbd (patch)
tree5568edda37125a23b81e8e575a2b52506d89a7cd /sys/sys/user.h
parent4ed8baa00aeed05ae105eb36206bd0f20967aaa9 (diff)
downloadsrc-1cc8c45c54e9955fa69423473727be0056662cbd.tar.gz
src-1cc8c45c54e9955fa69423473727be0056662cbd.zip
Add another new sysctl in support of the forthcoming procstat(1) to
support its -k argument: kern.proc.kstack - dump the kernel stack of a process, if debugging is permitted. This sysctl is present if either "options DDB" or "options STACK" is compiled into the kernel. Having support for tracing the kernel stacks of processes from user space makes it much easier to debug (or understand) specific wmesg's while avoiding the need to enter DDB in order to determine the path by which a process came to be blocked on a particular wait channel or lock.
Notes
Notes: svn path=/head/; revision=174197
Diffstat (limited to 'sys/sys/user.h')
-rw-r--r--sys/sys/user.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/sys/user.h b/sys/sys/user.h
index 9e4f14f163cf..92203f07539e 100644
--- a/sys/sys/user.h
+++ b/sys/sys/user.h
@@ -319,4 +319,23 @@ struct kinfo_vmentry {
int _kve_ispare[8]; /* Space for more stuff. */
};
+/*
+ * The KERN_PROC_KSTACK sysctl allows a process to dump the kernel stacks of
+ * another process as a series of entries. Each stack is represented by a
+ * series of symbol names and offsets as generated by stack_sbuf_print(9).
+ */
+#define KKST_MAXLEN 1024
+
+#define KKST_STATE_STACKOK 0 /* Stack is valid. */
+#define KKST_STATE_SWAPPED 1 /* Stack swapped out. */
+#define KKST_STATE_RUNNING 2 /* Stack ephemeral. */
+
+struct kinfo_kstack {
+ lwpid_t kkst_tid; /* ID of thread. */
+ int kkst_state; /* Validity of stack. */
+ char kkst_trace[KKST_MAXLEN]; /* String representing stack. */
+ void *_kkst_pspare[8]; /* Space for more stuff. */
+ int _kkst_ispare[8]; /* Space for more stuff. */
+};
+
#endif