Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153269315
D25487.id73759.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D25487.id73759.diff
View Options
Index: sys/kern/subr_stack.c
===================================================================
--- sys/kern/subr_stack.c
+++ sys/kern/subr_stack.c
@@ -182,9 +182,13 @@
&offset, flags);
if (error == EWOULDBLOCK)
return (error);
- sbuf_printf(sb, "#%d %p at %s+%#lx\n", i, (void *)st->pcs[i],
- namebuf, offset);
+ if (tty_info_kstacks == 1)
+ sbuf_printf(sb, "#%d %p at %s+%#lx\n", i,
+ (void *)st->pcs[i], namebuf, offset);
+ else if (tty_info_kstacks == 2)
+ sbuf_printf(sb, "%s+%#lx ", namebuf, offset);
}
+ sbuf_nl_terminate(sb);
return (0);
}
Index: sys/kern/tty_info.c
===================================================================
--- sys/kern/tty_info.c
+++ sys/kern/tty_info.c
@@ -239,9 +239,33 @@
}
#ifdef STACK
-static bool tty_info_kstacks = true;
-SYSCTL_BOOL(_kern, OID_AUTO, tty_info_kstacks, CTLFLAG_RWTUN,
- &tty_info_kstacks, 0,
+int tty_info_kstacks = 1;
+
+static int
+sysctl_tty_info_kstacks(SYSCTL_HANDLER_ARGS)
+{
+ int error, val;
+
+ val = tty_info_kstacks;
+ error = sysctl_handle_int(oidp, &val, 0, req);
+ if (error != 0 || req->newptr == NULL)
+ return (error);
+
+ switch (val) {
+ case 0:
+ case 1:
+ case 2:
+ tty_info_kstacks = val;
+ break;
+ default:
+ error = EINVAL;
+ }
+
+ return (error);
+}
+SYSCTL_PROC(_kern, OID_AUTO, tty_info_kstacks,
+ CTLFLAG_RWTUN | CTLFLAG_MPSAFE | CTLTYPE_INT, NULL, 0,
+ sysctl_tty_info_kstacks, "I",
"Enable printing kernel stack(9) traces on ^T (tty info)");
#endif
@@ -337,7 +361,7 @@
state = "unknown";
pctcpu = (sched_pctcpu(td) * 10000 + FSCALE / 2) >> FSHIFT;
#ifdef STACK
- if (tty_info_kstacks) {
+ if (tty_info_kstacks > 0) {
if (TD_IS_SWAPPED(td))
sterr = ENOENT;
else
@@ -366,7 +390,7 @@
pctcpu / 100, rss);
#ifdef STACK
- if (tty_info_kstacks && sterr == 0)
+ if (tty_info_kstacks > 0 && sterr == 0)
stack_sbuf_print_flags(&sb, &stack, M_NOWAIT);
#endif
Index: sys/sys/stack.h
===================================================================
--- sys/sys/stack.h
+++ sys/sys/stack.h
@@ -31,6 +31,8 @@
#ifndef _SYS_STACK_H_
#define _SYS_STACK_H_
+#ifdef _KERNEL
+
#include <sys/_stack.h>
#ifdef _SYS_MALLOC_H_
@@ -39,6 +41,8 @@
struct sbuf;
+extern int tty_info_kstacks;
+
/* MI Routines. */
struct stack *stack_create(int);
void stack_destroy(struct stack *);
@@ -69,4 +73,6 @@
void stack_save(struct stack *);
int stack_save_td(struct stack *, struct thread *);
+#endif /* _KERNEL */
+
#endif
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 21, 4:09 AM (16 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31887135
Default Alt Text
D25487.id73759.diff (2 KB)
Attached To
Mode
D25487: kern.tty_info_kstacks: add a compact format
Attached
Detach File
Event Timeline
Log In to Comment