X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/ff6e181ae92fc6f1e89841290f461d1f2f9badd9..7ddcb079202367355dddccdfa4318e57d50318be:/bsd/sys/sem.h?ds=inline diff --git a/bsd/sys/sem.h b/bsd/sys/sem.h index caa9ed491..18eeb2061 100644 --- a/bsd/sys/sem.h +++ b/bsd/sys/sem.h @@ -1,14 +1,19 @@ /* - * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2007 Apple Inc. All rights reserved. * - * @APPLE_LICENSE_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. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. + * 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 @@ -18,7 +23,7 @@ * Please see the License for the specific language governing rights and * limitations under the License. * - * @APPLE_LICENSE_HEADER_END@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* $NetBSD: sem.h,v 1.5 1994/06/29 06:45:15 cgd Exp $ */ @@ -71,7 +76,8 @@ typedef __darwin_size_t size_t; * 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. * @@ -82,7 +88,13 @@ typedef __darwin_size_t size_t; * 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 */ @@ -94,12 +106,12 @@ struct __semid_ds_new { __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 */ @@ -112,7 +124,7 @@ struct __semid_ds_old { __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() @@ -150,7 +162,7 @@ struct sembuf { #define SEM_UNDO 010000 /* [XSI] Set up adjust on exit entry */ -#ifndef _POSIX_C_SOURCE +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) /* * System imposed limit on the value of the third parameter to semop(). @@ -196,16 +208,16 @@ typedef union semun semun_t; #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);