/*
- * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*
- * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. The rights granted to you under the
- * License may not be used to create, or enable the creation or
- * redistribution of, unlawful or unlicensed copies of an Apple operating
- * system, or to circumvent, violate, or enable the circumvention or
- * violation of, any terms of an Apple operating system software license
- * agreement.
- *
- * Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
* limitations under the License.
- *
- * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/* $NetBSD: sem.h,v 1.5 1994/06/29 06:45:15 cgd Exp $ */
* NOTE: The definition of the key_t type is implicit from the
* inclusion of <sys/ipc.h>
*/
-#ifndef _PID_T
-typedef __darwin_pid_t pid_t;
-#define _PID_T
-#endif
-
-#ifndef _TIME_T
-#define _TIME_T
-typedef __darwin_time_t time_t;
-#endif
-
-#ifndef _SIZE_T
-#define _SIZE_T
-typedef __darwin_size_t size_t;
-#endif
+#include <sys/_types/_pid_t.h>
+#include <sys/_types/_time_t.h>
+#include <sys/_types/_size_t.h>
/*
* Technically, we should force all code references to the new structure
* legacy interface there for binary compatibility only. Currently, we
* are only forcing this for programs requesting standards conformance.
*/
-#if defined(__POSIX_C_SOURCE) || defined(kernel) || defined(__LP64__)
+#if __DARWIN_UNIX03 || defined(KERNEL)
+#pragma pack(4)
/*
* Structure used internally.
*
* Note: only the fields sem_perm, sem_nsems, sem_otime, and sem_ctime
* are meaningful in user space.
*/
-struct __semid_ds_new {
+#if (defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE))
+struct semid_ds
+#else
+#define semid_ds __semid_ds_new
+struct __semid_ds_new
+#endif
+{
struct __ipc_perm_new sem_perm; /* [XSI] operation permission struct */
__int32_t sem_base; /* 32 bit base ptr for semaphore set */
unsigned short sem_nsems; /* [XSI] number of sems in set */
__int32_t sem_pad2; /* RESERVED: DO NOT USE! */
__int32_t sem_pad3[4]; /* RESERVED: DO NOT USE! */
};
-#define semid_ds __semid_ds_new
-#else /* !_POSIX_C_SOURCE */
+#pragma pack()
+#else /* !__DARWIN_UNIX03 */
#define semid_ds __semid_ds_old
-#endif /* !_POSIX_C_SOURCE */
+#endif /* __DARWIN_UNIX03 */
-#if !defined(__POSIX_C_SOURCE) && !defined(__LP64__)
+#if !__DARWIN_UNIX03
struct __semid_ds_old {
struct __ipc_perm_old sem_perm; /* [XSI] operation permission struct */
__int32_t sem_base; /* 32 bit base ptr for semaphore set */
__int32_t sem_pad2; /* RESERVED: DO NOT USE! */
__int32_t sem_pad3[4]; /* RESERVED: DO NOT USE! */
};
-#endif /* !_POSIX_C_SOURCE */
+#endif /* !__DARWIN_UNIX03 */
/*
* Possible values for the third argument to semctl()
#define SEM_UNDO 010000 /* [XSI] Set up adjust on exit entry */
-#ifndef _POSIX_C_SOURCE
-
-/*
- * System imposed limit on the value of the third parameter to semop().
- * This is arbitrary, and the standards unfortunately do not provide a
- * way for user applications to retrieve this value (e.g. via sysconf()
- * or from a manifest value in <unistd.h>). The value shown here is
- * informational, and subject to change in future revisions.
- */
-#define MAX_SOPS 5 /* maximum # of sembuf's per semop call */
-
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
/*
* Union used as the fourth argment to semctl() in all cases. Specific
#define SEM_A 0200 /* alter permission */
#define SEM_R 0400 /* read permission */
-#endif /* !_POSIX_C_SOURCE */
+#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
#ifndef KERNEL
__BEGIN_DECLS
-#ifndef _POSIX_C_SOURCE
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
int semsys(int, ...);
-#endif /* !_POSIX_C_SOURCE */
+#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
int semctl(int, int, int, ...) __DARWIN_ALIAS(semctl);
int semget(key_t, int, int);
int semop(int, struct sembuf *, size_t);