Let stack_create(9) take a malloc flags argument.
Reviewed by: cem Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12614
This commit is contained in:
parent
c0b63519b0
commit
f38c0c46c5
@ -27,7 +27,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd September 10, 2015
|
||||
.Dd October 6, 2017
|
||||
.Dt STACK 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -42,7 +42,7 @@ In the kernel configuration file:
|
||||
.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 @@ Each stack trace is described by a
|
||||
.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
|
||||
|
@ -2547,7 +2547,7 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS)
|
||||
return (error);
|
||||
|
||||
kkstp = malloc(sizeof(*kkstp), M_TEMP, M_WAITOK);
|
||||
st = stack_create();
|
||||
st = stack_create(M_WAITOK);
|
||||
|
||||
lwpidarray = NULL;
|
||||
PROC_LOCK(p);
|
||||
|
@ -1163,7 +1163,7 @@ sleepq_sbuf_print_stacks(struct sbuf *sb, void *wchan, int queue,
|
||||
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,
|
||||
|
@ -50,11 +50,11 @@ static int stack_symbol(vm_offset_t pc, char *namebuf, u_int buflen,
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -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 *);
|
||||
|
Loading…
Reference in New Issue
Block a user