Index: head/share/man/man9/stack.9 =================================================================== --- head/share/man/man9/stack.9 +++ head/share/man/man9/stack.9 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 10, 2015 +.Dd October 6, 2017 .Dt STACK 9 .Os .Sh NAME @@ -42,7 +42,7 @@ .Cd "options STACK" .Pp .Ft struct stack * -.Fn stack_create "void" +.Fn stack_create "int flags" .Ft void .Fn stack_destroy "struct stack *st" .Ft int @@ -85,8 +85,11 @@ .Vt "struct stack" . Before a trace may be created or otherwise manipulated, storage for the trace must be allocated with -.Fn stack_create , -which may sleep. +.Fn stack_create . +The +.Ar flags +argument is passed to +.Xr malloc 9 . Memory associated with a trace is freed by calling .Fn stack_destroy . .Pp Index: head/sys/kern/kern_proc.c =================================================================== --- head/sys/kern/kern_proc.c +++ head/sys/kern/kern_proc.c @@ -2547,7 +2547,7 @@ return (error); kkstp = malloc(sizeof(*kkstp), M_TEMP, M_WAITOK); - st = stack_create(); + st = stack_create(M_WAITOK); lwpidarray = NULL; PROC_LOCK(p); Index: head/sys/kern/subr_sleepqueue.c =================================================================== --- head/sys/kern/subr_sleepqueue.c +++ head/sys/kern/subr_sleepqueue.c @@ -1163,7 +1163,7 @@ M_TEMP, M_WAITOK); for (stack_idx = 0; stack_idx < stacks_to_allocate; stack_idx++) - st[stack_idx] = stack_create(); + st[stack_idx] = stack_create(M_WAITOK); /* Where we will store the td name, tid, etc. */ td_infos = malloc(sizeof(struct sbuf *) * stacks_to_allocate, Index: head/sys/kern/subr_stack.c =================================================================== --- head/sys/kern/subr_stack.c +++ head/sys/kern/subr_stack.c @@ -50,11 +50,11 @@ static int stack_symbol_ddb(vm_offset_t pc, const char **name, long *offset); struct stack * -stack_create(void) +stack_create(int flags) { struct stack *st; - st = malloc(sizeof *st, M_STACK, M_WAITOK | M_ZERO); + st = malloc(sizeof(*st), M_STACK, flags | M_ZERO); return (st); } Index: head/sys/sys/stack.h =================================================================== --- head/sys/sys/stack.h +++ head/sys/sys/stack.h @@ -34,7 +34,7 @@ struct sbuf; /* MI Routines. */ -struct stack *stack_create(void); +struct stack *stack_create(int); void stack_destroy(struct stack *); int stack_put(struct stack *, vm_offset_t); void stack_copy(const struct stack *, struct stack *);