summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornetchild <netchild@FreeBSD.org>2006-08-15 12:10:57 +0000
committernetchild <netchild@FreeBSD.org>2006-08-15 12:10:57 +0000
commitb2a39f267af537affffa1c52b22f5128d4c0a4d3 (patch)
tree0ec3c426b5856dcb47a9ee601bee63a1ef397973
parentc6539b3d3ec0c97a3e6a13593770d554202805c3 (diff)
downloadFreeBSD-src-b2a39f267af537affffa1c52b22f5128d4c0a4d3.zip
FreeBSD-src-b2a39f267af537affffa1c52b22f5128d4c0a4d3.tar.gz
- 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@)
-rw-r--r--sys/kern/kern_exec.c3
-rw-r--r--sys/kern/kern_fork.c2
-rw-r--r--sys/kern/kern_time.c15
-rw-r--r--sys/kern/uipc_sem.c9
-rw-r--r--sys/kern/vfs_aio.c9
-rw-r--r--sys/sys/eventhandler.h6
-rw-r--r--sys/sys/imgact.h1
7 files changed, 37 insertions, 8 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index cb61b86..d8f196b 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -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.
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 66361b2..c0b30e6 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -827,6 +827,8 @@ fork_exit(callout, arg, frame)
kthread_exit(0);
}
mtx_assert(&Giant, MA_NOTOWNED);
+
+ EVENTHANDLER_INVOKE(schedtail, p);
}
/*
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index 77a4f76..0569c4b 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -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;
diff --git a/sys/kern/uipc_sem.c b/sys/kern/uipc_sem.c
index 42dc33b..a1b63f6 100644
--- a/sys/kern/uipc_sem.c
+++ b/sys/kern/uipc_sem.c
@@ -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 @@ race_lost:
}
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;
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index 8dfbf96..2f8de18 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -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.
*/
diff --git a/sys/sys/eventhandler.h b/sys/sys/eventhandler.h
index 804ff03..f4f1b8c 100644
--- a/sys/sys/eventhandler.h
+++ b/sys/sys/eventhandler.h
@@ -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 */
diff --git a/sys/sys/imgact.h b/sys/sys/imgact.h
index 20c65e9..6560d1c 100644
--- a/sys/sys/imgact.h
+++ b/sys/sys/imgact.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
OpenPOWER on IntegriCloud