[Glibc-bsd-commits] r5049 - in trunk/glibc-ports/kfreebsd: . bits

Petr Salinger ps-guest at alioth.debian.org
Sun Oct 13 10:38:18 UTC 2013


Author: ps-guest
Date: 2013-10-13 10:38:18 +0000 (Sun, 13 Oct 2013)
New Revision: 5049

Added:
   trunk/glibc-ports/kfreebsd/waitid.c
Modified:
   trunk/glibc-ports/kfreebsd/Versions
   trunk/glibc-ports/kfreebsd/bits/waitflags.h
Log:
waitid migration - kbsd part


Modified: trunk/glibc-ports/kfreebsd/Versions
===================================================================
--- trunk/glibc-ports/kfreebsd/Versions	2013-10-13 10:37:18 UTC (rev 5048)
+++ trunk/glibc-ports/kfreebsd/Versions	2013-10-13 10:38:18 UTC (rev 5049)
@@ -102,6 +102,7 @@
     msgctl;
     semctl;
     shmctl;
+    waitid;
     #errlist-compat 97
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }

Modified: trunk/glibc-ports/kfreebsd/bits/waitflags.h
===================================================================
--- trunk/glibc-ports/kfreebsd/bits/waitflags.h	2013-10-13 10:37:18 UTC (rev 5048)
+++ trunk/glibc-ports/kfreebsd/bits/waitflags.h	2013-10-13 10:38:18 UTC (rev 5049)
@@ -30,8 +30,53 @@
 #define	WSTOPPED	2	/* Report stopped child (same as WUNTRACED). */
 #define	WCONTINUED	4	/* Report continued child.  */
 #define	WNOWAIT		8	/* Poll only. Don't delete the proc entry. */
-
+#define WEXITED         16      /* Wait for exited processes. */
+#define WTRAPPED        32      /* Wait for a process to hit a trap or
+                                   a breakpoint. */
+                                   
 #define __WCLONE	0x80000000	/* Wait for cloned process.  */
 #ifdef __USE_BSD
 # define WLINUXCLONE	__WCLONE	/* FreeBSD name for __WCLONE.  */
 #endif
+
+
+/* The following values are used by the `waitid' function.  */
+#if defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8
+# ifndef __ENUM_IDTYPE_T
+# define __ENUM_IDTYPE_T 1
+
+typedef enum
+{
+        /*
+         * These names were mostly lifted from Solaris source code and
+         * still use Solaris style naming to avoid breaking any
+         * OpenSolaris code which has been ported to FreeBSD.  There
+         * is no clear FreeBSD counterpart for all of the names, but
+         * some have a clear correspondence to FreeBSD entities.
+         *
+         * The numerical values are kept synchronized with the Solaris
+         * values.
+         */
+        P_PID,                  /* A process identifier. */
+        P_PPID,                 /* A parent process identifier. */
+        P_PGID,                 /* A process group identifier. */
+        P_SID,                  /* A session identifier. */
+        P_CID,                  /* A scheduling class identifier. */
+        P_UID,                  /* A user identifier. */
+        P_GID,                  /* A group identifier. */
+        P_ALL,                  /* All processes. */
+        P_LWPID,                /* An LWP identifier. */
+        P_TASKID,               /* A task identifier. */
+        P_PROJID,               /* A project identifier. */
+        P_POOLID,               /* A pool identifier. */
+        P_JAILID,               /* A zone identifier. */
+        P_CTID,                 /* A (process) contract identifier. */
+        P_CPUID,                /* CPU identifier. */
+        P_PSETID                /* Processor set identifier. */
+} idtype_t;                     /* The type of id_t we are using. */
+
+#  if defined __USE_BSD
+#  define P_ZONEID        P_JAILID
+#  endif
+# endif
+#endif

Added: trunk/glibc-ports/kfreebsd/waitid.c
===================================================================
--- trunk/glibc-ports/kfreebsd/waitid.c	                        (rev 0)
+++ trunk/glibc-ports/kfreebsd/waitid.c	2013-10-13 10:38:18 UTC (rev 5049)
@@ -0,0 +1,64 @@
+/* 
+   Copyright (C) 2004-2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <shlib-compat.h>
+#include <stddef.h>
+#include <errno.h>
+#include <sys/wait.h>
+#include <sysdep.h>
+
+/* for now only the wrapper implementation */
+/* later on we will try to use wait6 when available */
+
+#define waitid __unused_waitid_alias
+#include <sysdeps/posix/waitid.c>
+#undef waitid
+
+versioned_symbol (libc, __waitid, waitid, GLIBC_2_18);
+
+#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_18)
+
+/* it used to be: */
+
+#define OLD_P_ALL	0
+#define OLD_P_PID	1
+#define OLD_P_PGID	2
+
+int
+__waitid_old (idtype_t oldtype, id_t id, siginfo_t *infop, int options)
+{
+  idtype_t newtype;
+
+  switch (oldtype)
+  {
+      case OLD_P_ALL:
+          newtype = P_ALL;
+      break;
+      case OLD_P_PID:
+          newtype = P_PID;
+      break;
+      case OLD_P_PGID:
+          newtype = P_PGID;
+      break;
+      default:
+          newtype = oldtype;
+   }
+  return __waitid(newtype, id, infop, options);
+}
+compat_symbol (libc, __waitid_old, waitid, GLIBC_2_1);
+#endif




More information about the Glibc-bsd-commits mailing list