diff options
author | kib <kib@FreeBSD.org> | 2011-07-12 20:37:18 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2011-07-12 20:37:18 +0000 |
commit | 09ee3c95a50245039079062566f7368fc034ba87 (patch) | |
tree | 8add58a7d0d1796d3df9902e1188f5aa16bd89fe /sys/kern | |
parent | 751d3abdea3b16734bff1812e7e8e18b69c9fdd9 (diff) | |
download | FreeBSD-src-09ee3c95a50245039079062566f7368fc034ba87.zip FreeBSD-src-09ee3c95a50245039079062566f7368fc034ba87.tar.gz |
Implement an RFTSIGZMB flag to rfork(2) to specify a signal that is
delivered to parent when the child exists.
Submitted by: Petr Salinger <Petr.Salinger seznam cz> (Debian/kFreeBSD)
MFC after: 1 week
X-MFC-note: bump __FreeBSD_version
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_fork.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index a8abd8e..9d3e22d 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -476,7 +476,10 @@ do_fork(struct thread *td, int flags, struct proc *p2, struct thread *td2, sigacts_copy(newsigacts, p1->p_sigacts); p2->p_sigacts = newsigacts; } - if (flags & RFLINUXTHPN) + + if (flags & RFTSIGZMB) + p2->p_sigparent = RFTSIGNUM(flags); + else if (flags & RFLINUXTHPN) p2->p_sigparent = SIGUSR1; else p2->p_sigparent = SIGCHLD; @@ -719,10 +722,22 @@ fork1(struct thread *td, int flags, int pages, struct proc **procp) static int curfail; static struct timeval lastfail; + /* Check for the undefined or unimplemented flags. */ + if ((flags & ~(RFFLAGS | RFTSIGFLAGS(RFTSIGMASK))) != 0) + return (EINVAL); + + /* Signal value requires RFTSIGZMB. */ + if ((flags & RFTSIGFLAGS(RFTSIGMASK)) != 0 && (flags & RFTSIGZMB) == 0) + return (EINVAL); + /* Can't copy and clear. */ if ((flags & (RFFDG|RFCFDG)) == (RFFDG|RFCFDG)) return (EINVAL); + /* Check the validity of the signal number. */ + if ((flags & RFTSIGZMB) != 0 && (u_int)RFTSIGNUM(flags) > _SIG_MAXSIG) + return (EINVAL); + p1 = td->td_proc; /* |