[Glibc-bsd-commits] r3583 - in trunk/glibc-ports/kfreebsd: . sys

Petr Salinger ps-guest at alioth.debian.org
Wed Jul 13 17:07:10 UTC 2011


Author: ps-guest
Date: 2011-07-13 17:07:06 +0000 (Wed, 13 Jul 2011)
New Revision: 3583

Modified:
   trunk/glibc-ports/kfreebsd/clone.c
   trunk/glibc-ports/kfreebsd/sys/rfork.h
Log:
preliminary support for RFTSIGZMB



Modified: trunk/glibc-ports/kfreebsd/clone.c
===================================================================
--- trunk/glibc-ports/kfreebsd/clone.c	2011-07-13 16:17:53 UTC (rev 3582)
+++ trunk/glibc-ports/kfreebsd/clone.c	2011-07-13 17:07:06 UTC (rev 3583)
@@ -26,6 +26,29 @@
 #include <stddef.h>
 #undef __clone
 
+
+#include <sys/sysctl.h>
+
+static inline int
+__kernel_osreldate(void)
+{
+    static int osreldate;
+
+    int mib[2];
+    size_t size;
+    char *temp;
+
+    if (osreldate == 0)
+    {
+	mib[0] = CTL_KERN;
+	mib[1] = KERN_OSRELDATE;
+	size = sizeof osreldate;
+	if (__sysctl(mib, 2, &osreldate, &size, NULL, 0) == -1)
+		return (-1);
+    }		
+    return (osreldate);
+}
+
 /* __start_thread (flags, child_stack, fn, arg)
    is roughly equivalent to
 
@@ -63,7 +86,20 @@
     }
 
   if ((flags & CSIGNAL) != SIGCHLD)
+  {
+    if (__kernel_osreldate() >= 802509)    /* XXX have to be updated after upstream merge */
+                /* we slightly cheat here, */
+                /* the 9.x snapshot prior to r223966 does not support it too */
     {
+      if ((flags & CSIGNAL) & ~RFTSIGMASK)
+	{
+	  __set_errno (EINVAL);
+	  return -1;
+	}
+        rfork_flags |= (RFTSIGZMB | RFTSIGFLAGS(flags & CSIGNAL));
+    }
+    else
+    {
       if ((flags & CSIGNAL) & ~RFTHPNMASK)
 	{
 	  __set_errno (EINVAL);
@@ -74,7 +110,7 @@
       else
         rfork_flags |= (RFLINUXTHPN | ((flags & CSIGNAL) <<  RFTHPNSHIFT));
     }
-
+  } 
   if (flags & CLONE_VM)
     rfork_flags |= RFMEM;
 

Modified: trunk/glibc-ports/kfreebsd/sys/rfork.h
===================================================================
--- trunk/glibc-ports/kfreebsd/sys/rfork.h	2011-07-13 16:17:53 UTC (rev 3582)
+++ trunk/glibc-ports/kfreebsd/sys/rfork.h	2011-07-13 17:07:06 UTC (rev 3583)
@@ -71,6 +71,13 @@
 #define RFTHREAD	(1<<13)	/* enable kernel thread support */
 #define RFSIGSHARE	(1<<14)	/* share signal handlers */
 #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 RFTHPNSHIFT	24	/* reserve bits 24-30 */




More information about the Glibc-bsd-commits mailing list