- Change process_exec function handlers prototype to include struct
image_params arg. - Change struct image_params to include struct sysentvec pointer and initialize it. - Change all consumers of process_exit/process_exec eventhandlers to new prototypes (includes splitting up into distinct exec/exit functions). - Add eventhandler to userret. Sponsored by: Google SoC 2006 Submitted by: rdivacky Parts suggested by: jhb (on hackers@)
This commit is contained in:
parent
3cd78e6c42
commit
993182e57c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=161302
@ -889,9 +889,10 @@ exec_new_vmspace(imgp, sv)
|
||||
vm_map_t map;
|
||||
|
||||
imgp->vmspace_destroyed = 1;
|
||||
imgp->sysent = sv;
|
||||
|
||||
/* Called with Giant held, do not depend on it! */
|
||||
EVENTHANDLER_INVOKE(process_exec, p);
|
||||
EVENTHANDLER_INVOKE(process_exec, p, imgp);
|
||||
|
||||
/*
|
||||
* Here is as good a place as any to do any resource limit cleanups.
|
||||
|
@ -827,6 +827,8 @@ fork_exit(callout, arg, frame)
|
||||
kthread_exit(0);
|
||||
}
|
||||
mtx_assert(&Giant, MA_NOTOWNED);
|
||||
|
||||
EVENTHANDLER_INVOKE(schedtail, p);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -88,7 +88,8 @@ static void itimer_enter(struct itimer *);
|
||||
static void itimer_leave(struct itimer *);
|
||||
static struct itimer *itimer_find(struct proc *, int, int);
|
||||
static void itimers_alloc(struct proc *);
|
||||
static void itimers_event_hook(void *arg, struct proc *p);
|
||||
static void itimers_event_hook_exec(void *arg, struct proc *p, struct image_params *imgp);
|
||||
static void itimers_event_hook_exit(void *arg, struct proc *p);
|
||||
static int realtimer_create(struct itimer *);
|
||||
static int realtimer_gettime(struct itimer *, struct itimerspec *);
|
||||
static int realtimer_settime(struct itimer *, int,
|
||||
@ -892,9 +893,9 @@ itimer_start(void)
|
||||
p31b_setcfg(CTL_P1003_1B_TIMERS, 200112L);
|
||||
p31b_setcfg(CTL_P1003_1B_DELAYTIMER_MAX, INT_MAX);
|
||||
p31b_setcfg(CTL_P1003_1B_TIMER_MAX, TIMER_MAX);
|
||||
EVENTHANDLER_REGISTER(process_exit, itimers_event_hook,
|
||||
EVENTHANDLER_REGISTER(process_exit, itimers_event_hook_exit,
|
||||
(void *)ITIMER_EV_EXIT, EVENTHANDLER_PRI_ANY);
|
||||
EVENTHANDLER_REGISTER(process_exec, itimers_event_hook,
|
||||
EVENTHANDLER_REGISTER(process_exec, itimers_event_hook_exec,
|
||||
(void *)ITIMER_EV_EXEC, EVENTHANDLER_PRI_ANY);
|
||||
}
|
||||
|
||||
@ -1510,9 +1511,15 @@ itimers_alloc(struct proc *p)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
itimers_event_hook_exec(void *arg, struct proc *p, struct image_params *imgp __unused)
|
||||
{
|
||||
itimers_event_hook_exit(arg, p);
|
||||
}
|
||||
|
||||
/* Clean up timers when some process events are being triggered. */
|
||||
static void
|
||||
itimers_event_hook(void *arg, struct proc *p)
|
||||
itimers_event_hook_exit(void *arg, struct proc *p)
|
||||
{
|
||||
struct itimers *its;
|
||||
struct itimer *it;
|
||||
|
@ -71,6 +71,7 @@ static void sem_free(struct ksem *ksnew);
|
||||
static int sem_perm(struct thread *td, struct ksem *ks);
|
||||
static void sem_enter(struct proc *p, struct ksem *ks);
|
||||
static int sem_leave(struct proc *p, struct ksem *ks);
|
||||
static void sem_exechook(void *arg, struct proc *p, struct image_params *imgp);
|
||||
static void sem_exithook(void *arg, struct proc *p);
|
||||
static void sem_forkhook(void *arg, struct proc *p1, struct proc *p2,
|
||||
int flags);
|
||||
@ -919,7 +920,13 @@ sem_forkhook(void *arg, struct proc *p1, struct proc *p2, int flags)
|
||||
}
|
||||
|
||||
static void
|
||||
sem_exithook(void *arg, struct proc *p)
|
||||
sem_exithook(void *arg, struct proc *p, struct image_params *imgp __unused)
|
||||
{
|
||||
sem_exechook(arg, p);
|
||||
}
|
||||
|
||||
static void
|
||||
sem_exechook(void *arg, struct proc *p)
|
||||
{
|
||||
struct ksem *ks, *ksnext;
|
||||
|
||||
|
@ -322,6 +322,7 @@ static int aio_aqueue(struct thread *td, struct aiocb *job,
|
||||
struct aioliojob *lio, int type, int osigev);
|
||||
static void aio_physwakeup(struct buf *bp);
|
||||
static void aio_proc_rundown(void *arg, struct proc *p);
|
||||
static void aio_proc_rundown_exec(void *arg, struct proc *p, struct image_params *imgp);
|
||||
static int aio_qphysio(struct proc *p, struct aiocblist *iocb);
|
||||
static void biohelper(void *, int);
|
||||
static void aio_daemon(void *param);
|
||||
@ -419,7 +420,7 @@ aio_onceonly(void)
|
||||
aio_swake = &aio_swake_cb;
|
||||
exit_tag = EVENTHANDLER_REGISTER(process_exit, aio_proc_rundown, NULL,
|
||||
EVENTHANDLER_PRI_ANY);
|
||||
exec_tag = EVENTHANDLER_REGISTER(process_exec, aio_proc_rundown, NULL,
|
||||
exec_tag = EVENTHANDLER_REGISTER(process_exec, aio_proc_rundown_exec, NULL,
|
||||
EVENTHANDLER_PRI_ANY);
|
||||
kqueue_add_filteropts(EVFILT_AIO, &aio_filtops);
|
||||
kqueue_add_filteropts(EVFILT_LIO, &lio_filtops);
|
||||
@ -630,6 +631,12 @@ aio_free_entry(struct aiocblist *aiocbe)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
aio_proc_rundown_exec(void *arg, struct proc *p, struct image_params *imgp __unused)
|
||||
{
|
||||
aio_proc_rundown(arg, p);
|
||||
}
|
||||
|
||||
/*
|
||||
* Rundown the jobs for a given process.
|
||||
*/
|
||||
|
@ -162,10 +162,11 @@ EVENTHANDLER_DECLARE(vm_lowmem, vm_lowmem_handler_t);
|
||||
* exec handlers are called with Giant, but that is by accident.
|
||||
*/
|
||||
struct proc;
|
||||
struct image_params;
|
||||
|
||||
typedef void (*exitlist_fn)(void *, struct proc *);
|
||||
typedef void (*forklist_fn)(void *, struct proc *, struct proc *, int);
|
||||
typedef void (*execlist_fn)(void *, struct proc *);
|
||||
typedef void (*execlist_fn)(void *, struct proc *, struct image_params *);
|
||||
|
||||
EVENTHANDLER_DECLARE(process_exit, exitlist_fn);
|
||||
EVENTHANDLER_DECLARE(process_fork, forklist_fn);
|
||||
@ -174,4 +175,7 @@ EVENTHANDLER_DECLARE(process_exec, execlist_fn);
|
||||
typedef void (*uma_zone_chfn)(void *);
|
||||
EVENTHANDLER_DECLARE(nmbclusters_change, uma_zone_chfn);
|
||||
EVENTHANDLER_DECLARE(maxsockets_change, uma_zone_chfn);
|
||||
|
||||
typedef void(*schedtail_fn)(void *, struct proc *);
|
||||
EVENTHANDLER_DECLARE(schedtail, schedtail_fn);
|
||||
#endif /* SYS_EVENTHANDLER_H */
|
||||
|
@ -63,6 +63,7 @@ struct image_params {
|
||||
unsigned long ps_strings; /* PS_STRINGS for BSD/OS binaries */
|
||||
size_t auxarg_size;
|
||||
struct image_args *args; /* system call arguments */
|
||||
struct sysentvec *sysent; /* system entry vector */
|
||||
};
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
Loading…
Reference in New Issue
Block a user