sysv: get rid of fork/exit hooks if the code is compiled in
Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
977b479291
commit
e4f7c7c91c
@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/proc.h>
|
||||
#include <sys/ucred.h>
|
||||
|
||||
#ifndef SYSVSHM
|
||||
void (*shmfork_hook)(struct proc *, struct proc *) = NULL;
|
||||
void (*shmexit_hook)(struct vmspace *) = NULL;
|
||||
|
||||
@ -73,6 +74,7 @@ shmexit(struct vmspace *vm)
|
||||
shmexit_hook(vm);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Check for IPC permission.
|
||||
|
@ -137,8 +137,10 @@ static void shmrealloc(void);
|
||||
static int shminit(void);
|
||||
static int sysvshm_modload(struct module *, int, void *);
|
||||
static int shmunload(void);
|
||||
#ifndef SYSVSHM
|
||||
static void shmexit_myhook(struct vmspace *vm);
|
||||
static void shmfork_myhook(struct proc *p1, struct proc *p2);
|
||||
#endif
|
||||
static int sysctl_shmsegs(SYSCTL_HANDLER_ARGS);
|
||||
static void shm_remove(struct shmid_kernel *, int);
|
||||
static struct prison *shm_find_prison(struct ucred *);
|
||||
@ -810,8 +812,13 @@ sys_shmget(struct thread *td, struct shmget_args *uap)
|
||||
return (error);
|
||||
}
|
||||
|
||||
#ifdef SYSVSHM
|
||||
void
|
||||
shmfork(struct proc *p1, struct proc *p2)
|
||||
#else
|
||||
static void
|
||||
shmfork_myhook(struct proc *p1, struct proc *p2)
|
||||
#endif
|
||||
{
|
||||
struct shmmap_state *shmmap_s;
|
||||
size_t size;
|
||||
@ -834,8 +841,13 @@ shmfork_myhook(struct proc *p1, struct proc *p2)
|
||||
SYSVSHM_UNLOCK();
|
||||
}
|
||||
|
||||
#ifdef SYSVSHM
|
||||
void
|
||||
shmexit(struct vmspace *vm)
|
||||
#else
|
||||
static void
|
||||
shmexit_myhook(struct vmspace *vm)
|
||||
#endif
|
||||
{
|
||||
struct shmmap_state *base, *shm;
|
||||
int i;
|
||||
@ -956,8 +968,10 @@ shminit(void)
|
||||
shm_nused = 0;
|
||||
shm_committed = 0;
|
||||
sx_init(&sysvshmsx, "sysvshmsx");
|
||||
#ifndef SYSVSHM
|
||||
shmexit_hook = &shmexit_myhook;
|
||||
shmfork_hook = &shmfork_myhook;
|
||||
#endif
|
||||
|
||||
/* Set current prisons according to their allow.sysvipc. */
|
||||
shm_prison_slot = osd_jail_register(NULL, methods);
|
||||
@ -1021,8 +1035,10 @@ shmunload(void)
|
||||
vm_object_deallocate(shmsegs[i].object);
|
||||
}
|
||||
free(shmsegs, M_SHM);
|
||||
#ifndef SYSVSHM
|
||||
shmexit_hook = NULL;
|
||||
shmfork_hook = NULL;
|
||||
#endif
|
||||
sx_destroy(&sysvshmsx);
|
||||
return (0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user