X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/8ad349bb6ed4a0be06e34c92be0d98b92e078db4..060df5ea7c632b1ac8cc8aac1fb59758165c2084:/bsd/sys/sem.h diff --git a/bsd/sys/sem.h b/bsd/sys/sem.h index fbb1b4f56..18eeb2061 100644 --- a/bsd/sys/sem.h +++ b/bsd/sys/sem.h @@ -1,31 +1,29 @@ /* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. + * Copyright (c) 2000-2007 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * - * @APPLE_LICENSE_OSREFERENCE_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. * - * 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 + * 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 $ */ @@ -78,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. * @@ -89,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 */ @@ -101,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 */ @@ -119,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() @@ -157,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(). @@ -203,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);