Seems this interface be acceptable ?

Looks good to me.

The proposed code changes are in the attached patch.

Proposed wording of addition into RFORK(2):

DESCRIPTION:

RFTSIGZMB       If set, the kernel will return selected signal number instead
                of SIGCHILD upon thread exit for the child.
                The selected signal number have to be encoded into flags
                by ORing RFTSIGFLAGS(signum).

ERRORS:

EINVAL          An invalid signal was specified.


Petr
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -476,7 +476,10 @@
 		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;
@@ -723,6 +726,9 @@
 	if ((flags & (RFFDG|RFCFDG)) == (RFFDG|RFCFDG))
 		return (EINVAL);
 
+	if ((flags & RFTSIGZMB) && (RFTSIGNUM(flags) > _SIG_MAXSIG))
+		return (EINVAL);
+
 	p1 = td->td_proc;
 
 	/*
--- a/sys/sys/unistd.h
+++ b/sys/sys/unistd.h
@@ -180,6 +180,11 @@
 #define	RFLINUXTHPN	(1<<16)	/* do linux clone exit parent notification */
 #define	RFSTOPPED	(1<<17)	/* leave child in a stopped state */
 #define	RFHIGHPID	(1<<18)	/* use a pid higher than 10 (idleproc) */
+#define	RFTSIGZMB	(1<<19)	/* select signal for exit parent notification */
+#define	RFTSIGSHIFT	20	/* selected signal number is in bits 20-27  */
+#define	RFTSIGMASK	0xFF
+#define	RFTSIGNUM(flags)	(((flags) >> RFTSIGSHIFT) & RFTSIGMASK)
+#define	RFTSIGFLAGS(signum)	((signum) << RFTSIGSHIFT)
 #define	RFPPWAIT	(1<<31)	/* parent sleeps until child exits (vfork) */
 #define	RFKERNELONLY	(RFSTOPPED | RFHIGHPID | RFPPWAIT)
 
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to