Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_exec.c
Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | |||||
int coredump_pack_vmmapinfo = 1; | int coredump_pack_vmmapinfo = 1; | ||||
SYSCTL_INT(_kern, OID_AUTO, coredump_pack_vmmapinfo, CTLFLAG_RWTUN, | SYSCTL_INT(_kern, OID_AUTO, coredump_pack_vmmapinfo, CTLFLAG_RWTUN, | ||||
&coredump_pack_vmmapinfo, 0, | &coredump_pack_vmmapinfo, 0, | ||||
"Enable file path packing in 'procstat -v' coredump notes"); | "Enable file path packing in 'procstat -v' coredump notes"); | ||||
static int sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS); | static int sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS); | ||||
static int sysctl_kern_usrstack(SYSCTL_HANDLER_ARGS); | static int sysctl_kern_usrstack(SYSCTL_HANDLER_ARGS); | ||||
static int sysctl_kern_stacktop(SYSCTL_HANDLER_ARGS); | |||||
static int sysctl_kern_stackprot(SYSCTL_HANDLER_ARGS); | static int sysctl_kern_stackprot(SYSCTL_HANDLER_ARGS); | ||||
static int do_execve(struct thread *td, struct image_args *args, | static int do_execve(struct thread *td, struct image_args *args, | ||||
struct mac *mac_p, struct vmspace *oldvmspace); | struct mac *mac_p, struct vmspace *oldvmspace); | ||||
/* XXX This should be vm_size_t. */ | /* XXX This should be vm_size_t. */ | ||||
SYSCTL_PROC(_kern, KERN_PS_STRINGS, ps_strings, CTLTYPE_ULONG|CTLFLAG_RD| | SYSCTL_PROC(_kern, KERN_PS_STRINGS, ps_strings, CTLTYPE_ULONG|CTLFLAG_RD| | ||||
CTLFLAG_CAPRD|CTLFLAG_MPSAFE, NULL, 0, sysctl_kern_ps_strings, "LU", | CTLFLAG_CAPRD|CTLFLAG_MPSAFE, NULL, 0, sysctl_kern_ps_strings, "LU", | ||||
"Location of process' ps_strings structure"); | "Location of process' ps_strings structure"); | ||||
/* XXX This should be vm_size_t. */ | /* XXX This should be vm_size_t. */ | ||||
SYSCTL_PROC(_kern, KERN_USRSTACK, usrstack, CTLTYPE_ULONG|CTLFLAG_RD| | SYSCTL_PROC(_kern, KERN_USRSTACK, usrstack, CTLTYPE_ULONG|CTLFLAG_RD| | ||||
CTLFLAG_CAPRD|CTLFLAG_MPSAFE, NULL, 0, sysctl_kern_usrstack, "LU", | CTLFLAG_CAPRD|CTLFLAG_MPSAFE, NULL, 0, sysctl_kern_usrstack, "LU", | ||||
"Top of process stack"); | "Top of process stack"); | ||||
SYSCTL_PROC(_kern, KERN_STACKTOP, stacktop, CTLTYPE_ULONG | CTLFLAG_RD | | |||||
kib: Style: need spaces around binary op '|'. Ignore other examples in this file, do it right for… | |||||
CTLFLAG_CAPRD | CTLFLAG_MPSAFE, NULL, 0, sysctl_kern_stacktop, "LU", | |||||
"Top of process stack with stack gap."); | |||||
SYSCTL_PROC(_kern, OID_AUTO, stackprot, CTLTYPE_INT|CTLFLAG_RD|CTLFLAG_MPSAFE, | SYSCTL_PROC(_kern, OID_AUTO, stackprot, CTLTYPE_INT|CTLFLAG_RD|CTLFLAG_MPSAFE, | ||||
NULL, 0, sysctl_kern_stackprot, "I", | NULL, 0, sysctl_kern_stackprot, "I", | ||||
"Stack memory permissions"); | "Stack memory permissions"); | ||||
u_long ps_arg_cache_limit = PAGE_SIZE / 16; | u_long ps_arg_cache_limit = PAGE_SIZE / 16; | ||||
SYSCTL_ULONG(_kern, OID_AUTO, ps_arg_cache_limit, CTLFLAG_RW, | SYSCTL_ULONG(_kern, OID_AUTO, ps_arg_cache_limit, CTLFLAG_RW, | ||||
&ps_arg_cache_limit, 0, | &ps_arg_cache_limit, 0, | ||||
"Process' command line characters cache limit"); | "Process' command line characters cache limit"); | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | #ifdef SCTL_MASK32 | ||||
if (req->flags & SCTL_MASK32) { | if (req->flags & SCTL_MASK32) { | ||||
unsigned int val; | unsigned int val; | ||||
val = (unsigned int)p->p_sysent->sv_usrstack; | val = (unsigned int)p->p_sysent->sv_usrstack; | ||||
error = SYSCTL_OUT(req, &val, sizeof(val)); | error = SYSCTL_OUT(req, &val, sizeof(val)); | ||||
} else | } else | ||||
#endif | #endif | ||||
error = SYSCTL_OUT(req, &p->p_sysent->sv_usrstack, | error = SYSCTL_OUT(req, &p->p_sysent->sv_usrstack, | ||||
sizeof(p->p_sysent->sv_usrstack)); | sizeof(p->p_sysent->sv_usrstack)); | ||||
return error; | return (error); | ||||
} | |||||
static int | |||||
sysctl_kern_stacktop(SYSCTL_HANDLER_ARGS) | |||||
{ | |||||
vm_offset_t stacktop; | |||||
struct proc *p; | |||||
int error; | |||||
p = curproc; | |||||
#ifdef SCTL_MASK32 | |||||
if (req->flags & SCTL_MASK32) { | |||||
unsigned int val; | |||||
Not Done Inline ActionsThere should be a blank line after local variable declaration. kib: There should be a blank line after local variable declaration. | |||||
val = (unsigned int)(p->p_sysent->sv_usrstack - | |||||
p->p_vmspace->vm_stkgap); | |||||
error = SYSCTL_OUT(req, &val, sizeof(val)); | |||||
} else | |||||
#endif | |||||
{ | |||||
stacktop = p->p_sysent->sv_usrstack - p->p_vmspace->vm_stkgap; | |||||
error = SYSCTL_OUT(req, &stacktop, sizeof(stacktop)); | |||||
} | |||||
return (error); | |||||
Not Done Inline ActionsFix style while there: return (error); kib: Fix style while there: `return (error);` | |||||
} | } | ||||
static int | static int | ||||
sysctl_kern_stackprot(SYSCTL_HANDLER_ARGS) | sysctl_kern_stackprot(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct proc *p; | struct proc *p; | ||||
p = curproc; | p = curproc; | ||||
return (SYSCTL_OUT(req, &p->p_sysent->sv_stackprot, | return (SYSCTL_OUT(req, &p->p_sysent->sv_stackprot, | ||||
sizeof(p->p_sysent->sv_stackprot))); | sizeof(p->p_sysent->sv_stackprot))); | ||||
} | } | ||||
/* | /* | ||||
* Each of the items is a pointer to a `const struct execsw', hence the | * Each of the items is a pointer to a `const struct execsw', hence the | ||||
Not Done Inline ActionsThe op ('-') should be on the previous line, before line split. Also, why not to do single cast, instead of two: val = (unsigned)(p->p_sysent->sv_usrstack - p->p_vmspace->vm_stkgap); kib: The op ('-') should be on the previous line, before line split. Also, why not to do single… | |||||
* double pointer here. | * double pointer here. | ||||
*/ | */ | ||||
static const struct execsw **execsw; | static const struct execsw **execsw; | ||||
#ifndef _SYS_SYSPROTO_H_ | #ifndef _SYS_SYSPROTO_H_ | ||||
struct execve_args { | struct execve_args { | ||||
char *fname; | char *fname; | ||||
char **argv; | char **argv; | ||||
char **envv; | char **envv; | ||||
Not Done Inline Actionsreturn (error); kib: `return (error);` | |||||
}; | }; | ||||
#endif | #endif | ||||
int | int | ||||
sys_execve(struct thread *td, struct execve_args *uap) | sys_execve(struct thread *td, struct execve_args *uap) | ||||
{ | { | ||||
struct image_args args; | struct image_args args; | ||||
struct vmspace *oldvmspace; | struct vmspace *oldvmspace; | ||||
▲ Show 20 Lines • Show All 1,743 Lines • Show Last 20 Lines |
Style: need spaces around binary op '|'. Ignore other examples in this file, do it right for added code.