Emulation had multiple sets of hooks; here's the diff to kill the hooks
used at exec, fork, and exit time, as they are always NULL.
ok?
Philip
Index: sys/proc.h
===================================================================
RCS file: /cvs/src/sys/sys/proc.h,v
retrieving revision 1.232
diff -u -p -r1.232 proc.h
--- sys/proc.h 31 Jan 2017 07:44:55 -0000 1.232
+++ sys/proc.h 8 Feb 2017 05:59:48 -0000
@@ -115,10 +115,6 @@ struct emul {
char *e_esigret; /* sigaction RET position */
int e_flags; /* Flags, see below */
struct uvm_object *e_sigobject; /* shared sigcode object */
- /* Per-process hooks */
- void (*e_proc_exec)(struct proc *, struct exec_package *);
- void (*e_proc_fork)(struct proc *p, struct proc *parent);
- void (*e_proc_exit)(struct proc *);
};
/* Flags for e_flags */
#define EMUL_ENABLED 0x0001 /* Allow exec to continue */
@@ -324,8 +320,6 @@ struct proc {
struct tusage p_tu; /* accumulated times. */
struct timespec p_rtime; /* Real time. */
- void *p_emuldata; /* Per-process emulation data, or */
- /* NULL. Malloc type M_EMULDATA */
int p_siglist; /* Signals arrived but not delivered. */
/* End area that is zeroed on creation. */
Index: kern/kern_exec.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_exec.c,v
retrieving revision 1.185
diff -u -p -r1.185 kern_exec.c
--- kern/kern_exec.c 21 Jan 2017 05:42:03 -0000 1.185
+++ kern/kern_exec.c 8 Feb 2017 05:59:51 -0000
@@ -680,20 +680,6 @@ sys_execve(struct proc *p, void *v, regi
free(pack.ep_hdr, M_EXEC, pack.ep_hdrlen);
- /*
- * Call emulation specific exec hook. This can setup per-process
- * p->p_emuldata or do any other per-process stuff an emulation needs.
- *
- * If we are executing process of different emulation than the
- * original forked process, call e_proc_exit() of the old emulation
- * first, then e_proc_exec() of new emulation. If the emulation is
- * same, the exec hook code should deallocate any old emulation
- * resources held previously by this process.
- */
- if (pr->ps_emul && pr->ps_emul->e_proc_exit &&
- pr->ps_emul != pack.ep_emul)
- (*pr->ps_emul->e_proc_exit)(p);
-
p->p_descfd = 255;
if ((pack.ep_flags & EXEC_HASFD) && pack.ep_fd < 255)
p->p_descfd = pack.ep_fd;
@@ -702,13 +688,6 @@ sys_execve(struct proc *p, void *v, regi
p->p_p->ps_flags |= PS_WXNEEDED;
else
p->p_p->ps_flags &= ~PS_WXNEEDED;
-
- /*
- * Call exec hook. Emulation code may NOT store reference to anything
- * from &pack.
- */
- if (pack.ep_emul->e_proc_exec)
- (*pack.ep_emul->e_proc_exec)(p, &pack);
/* update ps_emul, the old value is no longer needed */
pr->ps_emul = pack.ep_emul;
Index: kern/kern_exit.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_exit.c,v
retrieving revision 1.158
diff -u -p -r1.158 kern_exit.c
--- kern/kern_exit.c 7 Nov 2016 00:26:32 -0000 1.158
+++ kern/kern_exit.c 8 Feb 2017 05:59:51 -0000
@@ -242,12 +242,6 @@ exit1(struct proc *p, int rv, int flags)
p->p_fd = NULL; /* zap the thread's copy */
- /*
- * If emulation has thread exit hook, call it now.
- */
- if (pr->ps_emul->e_proc_exit)
- (*pr->ps_emul->e_proc_exit)(p);
-
/*
* Remove proc from pidhash chain and allproc so looking
* it up won't work. We will put the proc on the
Index: kern/kern_fork.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_fork.c,v
retrieving revision 1.193
diff -u -p -r1.193 kern_fork.c
--- kern/kern_fork.c 24 Jan 2017 00:58:55 -0000 1.193
+++ kern/kern_fork.c 8 Feb 2017 05:59:51 -0000
@@ -395,12 +395,6 @@ fork1(struct proc *curp, int flags, void
if (flags & FORK_THREAD)
sigstkinit(&p->p_sigstk);
- /*
- * If emulation has thread fork hook, call it now.
- */
- if (pr->ps_emul->e_proc_fork)
- (*pr->ps_emul->e_proc_fork)(p, curp);
-
p->p_addr = (struct user *)uaddr;
/*