authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-11-08 17:40:41-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-11-08 20:21:29-08:00
logeed5814d7594e64b08b9a51697f2766df5fcb5f0
treead8d530075a70e39612ec909b52647ec24eca24d
parent4d67c3d8878b99fc7b5912dafc50c9a5c01ba169

macOS libc headers: add POSIX headers


147 files changed, 19922 insertions(+), 0 deletions(-)

lib/libc/include/x86_64-macos-gnu/_regex.h created+121
......@@ -0,0 +1,121 @@
1/*
2 * Copyright (c) 2000, 2011 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 * Copyright (c) 2001-2009 Ville Laurikari <vl@iki.fi>
25 * All rights reserved.
26 *
27 * Redistribution and use in source and binary forms, with or without
28 * modification, are permitted provided that the following conditions
29 * are met:
30 *
31 * 1. Redistributions of source code must retain the above copyright
32 * notice, this list of conditions and the following disclaimer.
33 *
34 * 2. Redistributions in binary form must reproduce the above copyright
35 * notice, this list of conditions and the following disclaimer in the
36 * documentation and/or other materials provided with the distribution.
37 *
38 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS
39 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
40 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
41 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
42 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
44 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
45 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
46 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
47 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
48 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49 */
50/*-
51 * Copyright (c) 1992 Henry Spencer.
52 * Copyright (c) 1992, 1993
53 * The Regents of the University of California. All rights reserved.
54 *
55 * This code is derived from software contributed to Berkeley by
56 * Henry Spencer of the University of Toronto.
57 *
58 * Redistribution and use in source and binary forms, with or without
59 * modification, are permitted provided that the following conditions
60 * are met:
61 * 1. Redistributions of source code must retain the above copyright
62 * notice, this list of conditions and the following disclaimer.
63 * 2. Redistributions in binary form must reproduce the above copyright
64 * notice, this list of conditions and the following disclaimer in the
65 * documentation and/or other materials provided with the distribution.
66 * 3. All advertising materials mentioning features or use of this software
67 * must display the following acknowledgement:
68 * This product includes software developed by the University of
69 * California, Berkeley and its contributors.
70 * 4. Neither the name of the University nor the names of its contributors
71 * may be used to endorse or promote products derived from this software
72 * without specific prior written permission.
73 *
74 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
75 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
76 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
77 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
78 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
79 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
80 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
81 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
82 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
83 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
84 * SUCH DAMAGE.
85 *
86 * @(#)regex.h 8.2 (Berkeley) 1/3/94
87 */
88
89/*
90 * Common header for regex.h and xlocale/_regex.h
91 */
92
93#ifndef __REGEX_H_
94#define __REGEX_H_
95
96#include <_types.h>
97#include <Availability.h>
98#include <sys/_types/_size_t.h>
99
100/*********/
101/* types */
102/*********/
103#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
104#include <sys/_types/_wchar_t.h>
105#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
106
107typedef __darwin_off_t regoff_t;
108
109typedef struct {
110 int re_magic;
111 size_t re_nsub; /* number of parenthesized subexpressions */
112 const char *re_endp; /* end pointer for REG_PEND */
113 struct re_guts *re_g; /* none of your business :-) */
114} regex_t;
115
116typedef struct {
117 regoff_t rm_so; /* start of match */
118 regoff_t rm_eo; /* end of match */
119} regmatch_t;
120
121#endif /* !__REGEX_H_ */
lib/libc/include/x86_64-macos-gnu/_types/_nl_item.h created+33
......@@ -0,0 +1,33 @@
1/*
2 * Copyright (c) 2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#ifndef _NL_ITEM
30#define _NL_ITEM
31#include <_types.h>
32typedef __darwin_nl_item nl_item;
33#endif /* _NL_ITEM */
\ No newline at end of file
lib/libc/include/x86_64-macos-gnu/aio.h created+37
......@@ -0,0 +1,37 @@
1/*
2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 * File: aio.h
25 * Author: Umesh Vaishampayan [umeshv@apple.com]
26 * 05-Feb-2003 umeshv Created.
27 *
28 * Header file for POSIX Asynchronous IO APIs
29 *
30 */
31
32#ifndef _AIO_H_
33#define _AIO_H_
34
35#include <sys/aio.h>
36
37#endif /* _AIO_H_ */
lib/libc/include/x86_64-macos-gnu/arpa/inet.h created+97
......@@ -0,0 +1,97 @@
1/*
2 * ++Copyright++ 1983, 1993
3 * -
4 * Copyright (c) 1983, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by the University of
18 * California, Berkeley and its contributors.
19 * 4. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 * -
35 * Portions Copyright (c) 1993 by Digital Equipment Corporation.
36 *
37 * Permission to use, copy, modify, and distribute this software for any
38 * purpose with or without fee is hereby granted, provided that the above
39 * copyright notice and this permission notice appear in all copies, and that
40 * the name of Digital Equipment Corporation not be used in advertising or
41 * publicity pertaining to distribution of the document or software without
42 * specific, written prior permission.
43 *
44 * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
45 * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
46 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
47 * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
48 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
49 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
50 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
51 * SOFTWARE.
52 * -
53 * --Copyright--
54 */
55
56/*
57 * @(#)inet.h 8.1 (Berkeley) 6/2/93
58 * $Id: inet.h,v 1.10 2006/02/01 18:09:47 majka Exp $
59 */
60
61#ifndef _ARPA_INET_H_
62#define _ARPA_INET_H_
63
64/* External definitions for functions in inet(3), addr2ascii(3) */
65
66#include <sys/cdefs.h>
67#include <sys/_types.h>
68#include <stdint.h> /* uint32_t uint16_t */
69#include <machine/endian.h> /* htonl() and family if (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
70#include <sys/_endian.h> /* htonl() and family if (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
71#include <netinet/in.h> /* in_addr */
72
73__BEGIN_DECLS
74
75in_addr_t inet_addr(const char *);
76char *inet_ntoa(struct in_addr);
77const char *inet_ntop(int, const void *, char *, socklen_t);
78int inet_pton(int, const char *, void *);
79
80#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
81int ascii2addr(int, const char *, void *);
82char *addr2ascii(int, const void *, int, char *);
83int inet_aton(const char *, struct in_addr *);
84in_addr_t inet_lnaof(struct in_addr);
85struct in_addr inet_makeaddr(in_addr_t, in_addr_t);
86in_addr_t inet_netof(struct in_addr);
87in_addr_t inet_network(const char *);
88char *inet_net_ntop(int, const void *, int, char *, __darwin_size_t);
89int inet_net_pton(int, const char *, void *, __darwin_size_t);
90char *inet_neta(in_addr_t, char *, __darwin_size_t);
91unsigned int inet_nsap_addr(const char *, unsigned char *, int);
92char *inet_nsap_ntoa(int, const unsigned char *, char *);
93#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
94
95__END_DECLS
96
97#endif /* !_ARPA_INET_H_ */
lib/libc/include/x86_64-macos-gnu/cpio.h created+55
......@@ -0,0 +1,55 @@
1/*-
2 * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: src/include/cpio.h,v 1.1 2002/08/01 07:18:38 mike Exp $
27 */
28
29#ifndef _CPIO_H_
30#define _CPIO_H_
31
32#define C_ISSOCK 0140000 /* Socket. */
33#define C_ISLNK 0120000 /* Symbolic link. */
34#define C_ISCTG 0110000 /* Reserved. */
35#define C_ISREG 0100000 /* Regular file. */
36#define C_ISBLK 0060000 /* Block special. */
37#define C_ISDIR 0040000 /* Directory. */
38#define C_ISCHR 0020000 /* Character special. */
39#define C_ISFIFO 0010000 /* FIFO. */
40#define C_ISUID 0004000 /* Set user ID. */
41#define C_ISGID 0002000 /* Set group ID. */
42#define C_ISVTX 0001000 /* On directories, restricted deletion flag. */
43#define C_IRUSR 0000400 /* Read by owner. */
44#define C_IWUSR 0000200 /* Write by owner. */
45#define C_IXUSR 0000100 /* Execute by owner. */
46#define C_IRGRP 0000040 /* Read by group. */
47#define C_IWGRP 0000020 /* Write by group. */
48#define C_IXGRP 0000010 /* Execute by group. */
49#define C_IROTH 0000004 /* Read by others. */
50#define C_IWOTH 0000002 /* Write by others. */
51#define C_IXOTH 0000001 /* Execute by others. */
52
53#define MAGIC "070707"
54
55#endif /* _CPIO_H_ */
lib/libc/include/x86_64-macos-gnu/dirent.h created+191
......@@ -0,0 +1,191 @@
1/*
2 * Copyright (c) 2000, 2002-2008 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*-
24 * Copyright (c) 1989, 1993
25 * The Regents of the University of California. All rights reserved.
26 *
27 * Redistribution and use in source and binary forms, with or without
28 * modification, are permitted provided that the following conditions
29 * are met:
30 * 1. Redistributions of source code must retain the above copyright
31 * notice, this list of conditions and the following disclaimer.
32 * 2. Redistributions in binary form must reproduce the above copyright
33 * notice, this list of conditions and the following disclaimer in the
34 * documentation and/or other materials provided with the distribution.
35 * 3. All advertising materials mentioning features or use of this software
36 * must display the following acknowledgement:
37 * This product includes software developed by the University of
38 * California, Berkeley and its contributors.
39 * 4. Neither the name of the University nor the names of its contributors
40 * may be used to endorse or promote products derived from this software
41 * without specific prior written permission.
42 *
43 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
44 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
46 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
47 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53 * SUCH DAMAGE.
54 *
55 * @(#)dirent.h 8.2 (Berkeley) 7/28/94
56 */
57
58#ifndef _DIRENT_H_
59#define _DIRENT_H_
60
61/*
62 * The kernel defines the format of directory entries
63 */
64#include <_types.h>
65#include <sys/dirent.h>
66#include <sys/cdefs.h>
67#include <Availability.h>
68#include <sys/_pthread/_pthread_types.h> /* __darwin_pthread_mutex_t */
69
70struct _telldir; /* forward reference */
71
72/* structure describing an open directory. */
73typedef struct {
74 int __dd_fd; /* file descriptor associated with directory */
75 long __dd_loc; /* offset in current buffer */
76 long __dd_size; /* amount of data returned */
77 char *__dd_buf; /* data buffer */
78 int __dd_len; /* size of data buffer */
79 long __dd_seek; /* magic cookie returned */
80 __unused long __padding; /* (__dd_rewind space left for bincompat) */
81 int __dd_flags; /* flags for readdir */
82 __darwin_pthread_mutex_t __dd_lock; /* for thread locking */
83 struct _telldir *__dd_td; /* telldir position recording */
84} DIR;
85
86#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
87
88/* definitions for library routines operating on directories. */
89#define DIRBLKSIZ 1024
90
91/* flags for opendir2 */
92#define DTF_HIDEW 0x0001 /* hide whiteout entries */
93#define DTF_NODUP 0x0002 /* don't return duplicate names */
94#define DTF_REWIND 0x0004 /* rewind after reading union stack */
95#define __DTF_READALL 0x0008 /* everything has been read */
96#define __DTF_SKIPREAD 0x0010 /* assume internal buffer is populated */
97#define __DTF_ATEND 0x0020 /* there's nothing more to read in the kernel */
98
99#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
100
101#ifndef KERNEL
102
103__BEGIN_DECLS
104
105int closedir(DIR *) __DARWIN_ALIAS(closedir);
106
107DIR *opendir(const char *) __DARWIN_ALIAS_I(opendir);
108
109struct dirent *readdir(DIR *) __DARWIN_INODE64(readdir);
110int readdir_r(DIR *, struct dirent *, struct dirent **) __DARWIN_INODE64(readdir_r);
111
112void rewinddir(DIR *) __DARWIN_ALIAS_I(rewinddir);
113
114void seekdir(DIR *, long) __DARWIN_ALIAS_I(seekdir);
115
116long telldir(DIR *) __DARWIN_ALIAS_I(telldir);
117
118__END_DECLS
119
120
121/* Additional functionality provided by:
122 * POSIX.1-2008
123 */
124
125#if __DARWIN_C_LEVEL >= 200809L
126__BEGIN_DECLS
127
128__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
129DIR *fdopendir(int) __DARWIN_ALIAS_I(fdopendir);
130
131int alphasort(const struct dirent **, const struct dirent **) __DARWIN_INODE64(alphasort);
132
133#if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8) || (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0)
134#include <errno.h>
135#include <stdlib.h>
136#define dirfd(dirp) ({ \
137 DIR *_dirp = (dirp); \
138 int ret = -1; \
139 if (_dirp == NULL || _dirp->__dd_fd < 0) \
140 errno = EINVAL; \
141 else \
142 ret = _dirp->__dd_fd; \
143 ret; \
144})
145#else
146int dirfd(DIR *dirp) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
147#endif
148
149int scandir(const char *, struct dirent ***,
150 int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **)) __DARWIN_INODE64(scandir);
151#ifdef __BLOCKS__
152#if __has_attribute(noescape)
153#define __scandir_noescape __attribute__((__noescape__))
154#else
155#define __scandir_noescape
156#endif
157
158int scandir_b(const char *, struct dirent ***,
159 int (^)(const struct dirent *) __scandir_noescape,
160 int (^)(const struct dirent **, const struct dirent **) __scandir_noescape)
161 __DARWIN_INODE64(scandir_b) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
162#endif /* __BLOCKS__ */
163
164__END_DECLS
165#endif /* __DARWIN_C_LEVEL >= 200809L */
166
167
168#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
169__BEGIN_DECLS
170
171int getdirentries(int, char *, int, long *)
172
173#if __DARWIN_64_BIT_INO_T
174/*
175 * getdirentries() doesn't work when 64-bit inodes is in effect, so we
176 * generate a link error.
177 */
178 __asm("_getdirentries_is_not_available_when_64_bit_inodes_are_in_effect")
179#else /* !__DARWIN_64_BIT_INO_T */
180 __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_6, __IPHONE_2_0,__IPHONE_2_0)
181#endif /* __DARWIN_64_BIT_INO_T */
182;
183
184DIR *__opendir2(const char *, int) __DARWIN_ALIAS_I(__opendir2);
185
186__END_DECLS
187#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
188
189#endif /* !KERNEL */
190
191#endif /* !_DIRENT_H_ */
lib/libc/include/x86_64-macos-gnu/dlfcn.h created+97
......@@ -0,0 +1,97 @@
1/*
2 * Copyright (c) 2004-2008 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24/*
25 Based on the dlcompat work done by:
26 Jorge Acereda <jacereda@users.sourceforge.net> &
27 Peter O'Gorman <ogorman@users.sourceforge.net>
28*/
29
30#ifndef _DLFCN_H_
31#define _DLFCN_H_
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#include <sys/cdefs.h>
38
39#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
40#include <stdbool.h>
41#include <Availability.h>
42
43#ifdef __DRIVERKIT_19_0
44 #define __DYLDDL_DRIVERKIT_UNAVAILABLE __API_UNAVAILABLE(driverkit)
45#else
46 #define __DYLDDL_DRIVERKIT_UNAVAILABLE
47#endif
48
49/*
50 * Structure filled in by dladdr().
51 */
52typedef struct dl_info {
53 const char *dli_fname; /* Pathname of shared object */
54 void *dli_fbase; /* Base address of shared object */
55 const char *dli_sname; /* Name of nearest symbol */
56 void *dli_saddr; /* Address of nearest symbol */
57} Dl_info;
58
59extern int dladdr(const void *, Dl_info *);
60#else
61 #define __DYLDDL_DRIVERKIT_UNAVAILABLE
62#endif /* not POSIX */
63
64extern int dlclose(void * __handle) __DYLDDL_DRIVERKIT_UNAVAILABLE;
65extern char * dlerror(void) __DYLDDL_DRIVERKIT_UNAVAILABLE;
66extern void * dlopen(const char * __path, int __mode) __DYLDDL_DRIVERKIT_UNAVAILABLE;
67extern void * dlsym(void * __handle, const char * __symbol) __DYLDDL_DRIVERKIT_UNAVAILABLE;
68
69#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
70extern bool dlopen_preflight(const char* __path) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) __DYLDDL_DRIVERKIT_UNAVAILABLE;
71#endif /* not POSIX */
72
73
74#define RTLD_LAZY 0x1
75#define RTLD_NOW 0x2
76#define RTLD_LOCAL 0x4
77#define RTLD_GLOBAL 0x8
78
79#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
80#define RTLD_NOLOAD 0x10
81#define RTLD_NODELETE 0x80
82#define RTLD_FIRST 0x100 /* Mac OS X 10.5 and later */
83
84/*
85 * Special handle arguments for dlsym().
86 */
87#define RTLD_NEXT ((void *) -1) /* Search subsequent objects. */
88#define RTLD_DEFAULT ((void *) -2) /* Use default search algorithm. */
89#define RTLD_SELF ((void *) -3) /* Search this and subsequent objects (Mac OS X 10.5 and later) */
90#define RTLD_MAIN_ONLY ((void *) -5) /* Search main executable only (Mac OS X 10.5 and later) */
91#endif /* not POSIX */
92
93#ifdef __cplusplus
94}
95#endif
96
97#endif /* _DLFCN_H_ */
lib/libc/include/x86_64-macos-gnu/fcntl.h created+23
......@@ -0,0 +1,23 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23#include <sys/fcntl.h>
lib/libc/include/x86_64-macos-gnu/fmtmsg.h created+73
......@@ -0,0 +1,73 @@
1/*-
2 * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: src/include/fmtmsg.h,v 1.2 2002/08/05 16:37:05 mike Exp $
27 */
28
29#ifndef _FMTMSG_H_
30#define _FMTMSG_H_
31
32/* Source of condition is... */
33#define MM_HARD 0x0001 /* ...hardware. */
34#define MM_SOFT 0x0002 /* ...software. */
35#define MM_FIRM 0x0004 /* ...fireware. */
36
37/* Condition detected by... */
38#define MM_APPL 0x0010 /* ...application. */
39#define MM_UTIL 0x0020 /* ...utility. */
40#define MM_OPSYS 0x0040 /* ...operating system. */
41
42/* Display on... */
43#define MM_PRINT 0x0100 /* ...standard error. */
44#define MM_CONSOLE 0x0200 /* ...system console. */
45
46#define MM_RECOVER 0x1000 /* Recoverable error. */
47#define MM_NRECOV 0x2000 /* Non-recoverable error. */
48
49/* Severity levels. */
50#define MM_NOSEV 0 /* No severity level provided. */
51#define MM_HALT 1 /* Error causing application to halt. */
52#define MM_ERROR 2 /* Non-fault fault. */
53#define MM_WARNING 3 /* Unusual non-error condition. */
54#define MM_INFO 4 /* Informative message. */
55
56/* Null options. */
57#define MM_NULLLBL (char *)0
58#define MM_NULLSEV 0
59#define MM_NULLMC 0L
60#define MM_NULLTXT (char *)0
61#define MM_NULLACT (char *)0
62#define MM_NULLTAG (char *)0
63
64/* Return values. */
65#define MM_OK 0 /* Success. */
66#define MM_NOMSG 1 /* Failed to output to stderr. */
67#define MM_NOCON 2 /* Failed to output to console. */
68#define MM_NOTOK 3 /* Failed to output anything. */
69
70int fmtmsg(long, const char *, int, const char *, const char *,
71 const char *);
72
73#endif /* !_FMTMSG_H_ */
lib/libc/include/x86_64-macos-gnu/fnmatch.h created+82
......@@ -0,0 +1,82 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*-
24 * Copyright (c) 1992, 1993
25 * The Regents of the University of California. All rights reserved.
26 *
27 * Redistribution and use in source and binary forms, with or without
28 * modification, are permitted provided that the following conditions
29 * are met:
30 * 1. Redistributions of source code must retain the above copyright
31 * notice, this list of conditions and the following disclaimer.
32 * 2. Redistributions in binary form must reproduce the above copyright
33 * notice, this list of conditions and the following disclaimer in the
34 * documentation and/or other materials provided with the distribution.
35 * 3. All advertising materials mentioning features or use of this software
36 * must display the following acknowledgement:
37 * This product includes software developed by the University of
38 * California, Berkeley and its contributors.
39 * 4. Neither the name of the University nor the names of its contributors
40 * may be used to endorse or promote products derived from this software
41 * without specific prior written permission.
42 *
43 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
44 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
46 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
47 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53 * SUCH DAMAGE.
54 *
55 * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93
56 */
57
58#ifndef _FNMATCH_H_
59#define _FNMATCH_H_
60
61#include <sys/cdefs.h>
62
63#define FNM_NOMATCH 1 /* Match failed. */
64
65#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
66#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */
67#define FNM_PERIOD 0x04 /* Period must be matched by period. */
68
69#define FNM_NOSYS (-1) /* Reserved. */
70
71#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
72#define FNM_LEADING_DIR 0x08 /* Ignore /<tail> after Imatch. */
73#define FNM_CASEFOLD 0x10 /* Case insensitive search. */
74#define FNM_IGNORECASE FNM_CASEFOLD
75#define FNM_FILE_NAME FNM_PATHNAME
76#endif
77
78__BEGIN_DECLS
79int fnmatch(const char *, const char *, int) __DARWIN_ALIAS(fnmatch);
80__END_DECLS
81
82#endif /* !_FNMATCH_H_ */
lib/libc/include/x86_64-macos-gnu/ftw.h created+60
......@@ -0,0 +1,60 @@
1/* $OpenBSD: ftw.h,v 1.1 2003/07/21 21:13:18 millert Exp $ */
2
3/*
4 * Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 *
18 * Sponsored in part by the Defense Advanced Research Projects
19 * Agency (DARPA) and Air Force Research Laboratory, Air Force
20 * Materiel Command, USAF, under agreement number F39502-99-1-0512.
21 */
22
23#ifndef _FTW_H
24#define _FTW_H
25
26#include <sys/stat.h>
27
28/*
29 * Valid flags for the 3rd argument to the function that is passed as the
30 * second argument to ftw(3) and nftw(3). Say it three times fast!
31 */
32#define FTW_F 0 /* File. */
33#define FTW_D 1 /* Directory. */
34#define FTW_DNR 2 /* Directory without read permission. */
35#define FTW_DP 3 /* Directory with subdirectories visited. */
36#define FTW_NS 4 /* Unknown type; stat() failed. */
37#define FTW_SL 5 /* Symbolic link. */
38#define FTW_SLN 6 /* Sym link that names a nonexistent file. */
39
40/*
41 * Flags for use as the 4th argument to nftw(3). These may be ORed together.
42 */
43#define FTW_PHYS 0x01 /* Physical walk, don't follow sym links. */
44#define FTW_MOUNT 0x02 /* The walk does not cross a mount point. */
45#define FTW_DEPTH 0x04 /* Subdirs visited before the dir itself. */
46#define FTW_CHDIR 0x08 /* Change to a directory before reading it. */
47
48struct FTW {
49 int base;
50 int level;
51};
52
53__BEGIN_DECLS
54int ftw(const char *, int (*)(const char *, const struct stat *, int), int)
55 __DARWIN_ALIAS_I(ftw);
56int nftw(const char *, int (*)(const char *, const struct stat *, int,
57 struct FTW *), int, int) __DARWIN_ALIAS_I(nftw);
58__END_DECLS
59
60#endif /* !_FTW_H */
lib/libc/include/x86_64-macos-gnu/gethostuuid.h created+42
......@@ -0,0 +1,42 @@
1/*
2 * Copyright (c) 2013 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#ifndef __GETHOSTUUID_H
30#define __GETHOSTUUID_H
31
32#include <sys/_types/_timespec.h>
33#include <sys/_types/_uuid_t.h>
34#include <Availability.h>
35
36#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0)
37int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0, "gethostuuid() is no longer supported");
38#else
39int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);
40#endif
41
42#endif /* __GETHOSTUUID_H */
lib/libc/include/x86_64-macos-gnu/glob.h created+130
......@@ -0,0 +1,130 @@
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Guido van Rossum.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the University nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * @(#)glob.h 8.1 (Berkeley) 6/2/93
33 * $FreeBSD: /repoman/r/ncvs/src/include/glob.h,v 1.7 2002/07/17 04:58:09 mikeh Exp $
34 */
35
36#ifndef _GLOB_H_
37#define _GLOB_H_
38
39#include <_types.h>
40#include <sys/cdefs.h>
41#include <Availability.h>
42#include <sys/_types/_size_t.h>
43
44#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
45struct dirent;
46struct stat;
47#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
48typedef struct {
49 size_t gl_pathc; /* Count of total paths so far. */
50 int gl_matchc; /* Count of paths matching pattern. */
51 size_t gl_offs; /* Reserved at beginning of gl_pathv. */
52 int gl_flags; /* Copy of flags parameter to glob. */
53 char **gl_pathv; /* List of paths matching pattern. */
54 /* Copy of errfunc parameter to glob. */
55#ifdef __BLOCKS__
56 union {
57#endif /* __BLOCKS__ */
58 int (*gl_errfunc)(const char *, int);
59#ifdef __BLOCKS__
60 int (^gl_errblk)(const char *, int);
61 };
62#endif /* __BLOCKS__ */
63
64 /*
65 * Alternate filesystem access methods for glob; replacement
66 * versions of closedir(3), readdir(3), opendir(3), stat(2)
67 * and lstat(2).
68 */
69 void (*gl_closedir)(void *);
70#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
71 struct dirent *(*gl_readdir)(void *);
72#else /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
73 void *(*gl_readdir)(void *);
74#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
75 void *(*gl_opendir)(const char *);
76#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
77 int (*gl_lstat)(const char *, struct stat *);
78 int (*gl_stat)(const char *, struct stat *);
79#else /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
80 int (*gl_lstat)(const char *, void *);
81 int (*gl_stat)(const char *, void *);
82#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
83} glob_t;
84
85/* Believed to have been introduced in 1003.2-1992 */
86#define GLOB_APPEND 0x0001 /* Append to output from previous call. */
87#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */
88#define GLOB_ERR 0x0004 /* Return on error. */
89#define GLOB_MARK 0x0008 /* Append / to matching directories. */
90#define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */
91#define GLOB_NOSORT 0x0020 /* Don't sort. */
92#define GLOB_NOESCAPE 0x2000 /* Disable backslash escaping. */
93
94/* Error values returned by glob(3) */
95#define GLOB_NOSPACE (-1) /* Malloc call failed. */
96#define GLOB_ABORTED (-2) /* Unignored error. */
97#define GLOB_NOMATCH (-3) /* No match and GLOB_NOCHECK was not set. */
98#define GLOB_NOSYS (-4) /* Obsolete: source comptability only. */
99
100#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */
101#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */
102#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */
103#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */
104#define GLOB_QUOTE 0x0400 /* Quote special chars with \. */
105#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */
106#define GLOB_LIMIT 0x1000 /* limit number of returned paths */
107#ifdef __BLOCKS__
108#define _GLOB_ERR_BLOCK 0x80000000 /* (internal) error callback is a block */
109#endif /* __BLOCKS__ */
110
111/* source compatibility, these are the old names */
112#define GLOB_MAXPATH GLOB_LIMIT
113#define GLOB_ABEND GLOB_ABORTED
114
115__BEGIN_DECLS
116int glob(const char * __restrict, int, int (*)(const char *, int),
117 glob_t * __restrict) __DARWIN_INODE64(glob);
118#ifdef __BLOCKS__
119#if __has_attribute(noescape)
120#define __glob_noescape __attribute__((__noescape__))
121#else
122#define __glob_noescape
123#endif
124int glob_b(const char * __restrict, int, int (^)(const char *, int) __glob_noescape,
125 glob_t * __restrict) __DARWIN_INODE64(glob_b) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
126#endif /* __BLOCKS__ */
127void globfree(glob_t *);
128__END_DECLS
129
130#endif /* !_GLOB_H_ */
lib/libc/include/x86_64-macos-gnu/grp.h created+93
......@@ -0,0 +1,93 @@
1/*-
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the University of
21 * California, Berkeley and its contributors.
22 * 4. Neither the name of the University nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)grp.h 8.2 (Berkeley) 1/21/94
39 */
40/* Portions copyright (c) 2000-2018 Apple Inc. All rights reserved. */
41
42#ifndef _GRP_H_
43#define _GRP_H_
44
45#include <_types.h>
46#include <sys/_types/_gid_t.h> /* [XBD] */
47#include <sys/_types/_size_t.h> /* SUSv4 */
48
49#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
50#define _PATH_GROUP "/etc/group"
51#endif
52
53struct group {
54 char *gr_name; /* [XBD] group name */
55 char *gr_passwd; /* [???] group password */
56 gid_t gr_gid; /* [XBD] group id */
57 char **gr_mem; /* [XBD] group members */
58};
59
60#include <sys/cdefs.h>
61
62__BEGIN_DECLS
63/* [XBD] */
64struct group *getgrgid(gid_t);
65struct group *getgrnam(const char *);
66/* [TSF] */
67int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
68int getgrnam_r(const char *, struct group *, char *, size_t, struct group **);
69/* [XSI] */
70struct group *getgrent(void);
71void setgrent(void);
72void endgrent(void);
73__END_DECLS
74
75#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
76#include <uuid/uuid.h>
77__BEGIN_DECLS
78char *group_from_gid(gid_t, int);
79struct group *getgruuid(uuid_t);
80int getgruuid_r(uuid_t, struct group *, char *, size_t, struct group **);
81__END_DECLS
82#endif
83
84#if !defined(_XOPEN_SOURCE) || defined(_DARWIN_C_SOURCE)
85__BEGIN_DECLS
86#if (!defined(LIBINFO_INSTALL_API) || !LIBINFO_INSTALL_API)
87void setgrfile(const char *);
88#endif
89int setgroupent(int);
90__END_DECLS
91#endif
92
93#endif /* !_GRP_H_ */
lib/libc/include/x86_64-macos-gnu/i386/_param.h created+46
......@@ -0,0 +1,46 @@
1/*
2 * Copyright (c) 2008 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#ifndef _I386__PARAM_H_
30#define _I386__PARAM_H_
31
32#include <i386/_types.h>
33
34/*
35 * Round p (pointer or byte index) up to a correctly-aligned value for all
36 * data types (int, long, ...). The result is unsigned int and must be
37 * cast to any desired pointer type.
38 */
39#define __DARWIN_ALIGNBYTES (sizeof(__darwin_size_t) - 1)
40#define __DARWIN_ALIGN(p) ((__darwin_size_t)((char *)(__darwin_size_t)(p) + __DARWIN_ALIGNBYTES) &~ __DARWIN_ALIGNBYTES)
41
42#define __DARWIN_ALIGNBYTES32 (sizeof(__uint32_t) - 1)
43#define __DARWIN_ALIGN32(p) ((__darwin_size_t)((char *)(__darwin_size_t)(p) + __DARWIN_ALIGNBYTES32) &~ __DARWIN_ALIGNBYTES32)
44
45
46#endif /* _I386__PARAM_H_ */
lib/libc/include/x86_64-macos-gnu/i386/eflags.h created+94
......@@ -0,0 +1,94 @@
1/*
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 */
58
59#ifndef _I386_EFLAGS_H_
60#define _I386_EFLAGS_H_
61
62/*
63 * i386 flags register
64 */
65
66#ifndef EFL_CF
67#define EFL_CF 0x00000001 /* carry */
68#define EFL_PF 0x00000004 /* parity of low 8 bits */
69#define EFL_AF 0x00000010 /* carry out of bit 3 */
70#define EFL_ZF 0x00000040 /* zero */
71#define EFL_SF 0x00000080 /* sign */
72#define EFL_TF 0x00000100 /* trace trap */
73#define EFL_IF 0x00000200 /* interrupt enable */
74#define EFL_DF 0x00000400 /* direction */
75#define EFL_OF 0x00000800 /* overflow */
76#define EFL_IOPL 0x00003000 /* IO privilege level: */
77#define EFL_IOPL_KERNEL 0x00000000 /* kernel */
78#define EFL_IOPL_USER 0x00003000 /* user */
79#define EFL_NT 0x00004000 /* nested task */
80#define EFL_RF 0x00010000 /* resume without tracing */
81#define EFL_VM 0x00020000 /* virtual 8086 mode */
82#define EFL_AC 0x00040000 /* alignment check */
83#define EFL_VIF 0x00080000 /* virtual interrupt flag */
84#define EFL_VIP 0x00100000 /* virtual interrupt pending */
85#define EFL_ID 0x00200000 /* cpuID instruction */
86#endif
87
88#define EFL_CLR 0xfff88028
89#define EFL_SET 0x00000002
90
91#define EFL_USER_SET (EFL_IF)
92#define EFL_USER_CLEAR (EFL_IOPL|EFL_NT|EFL_RF)
93
94#endif /* _I386_EFLAGS_H_ */
lib/libc/include/x86_64-macos-gnu/iconv.h created+193
......@@ -0,0 +1,193 @@
1/* Copyright (C) 1999-2003, 2005-2006 Free Software Foundation, Inc.
2 This file is part of the GNU LIBICONV Library.
3
4 The GNU LIBICONV Library is free software; you can redistribute it
5 and/or modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 The GNU LIBICONV Library is distributed in the hope that it will be
10 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU LIBICONV Library; see the file COPYING.LIB.
16 If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
17 Fifth Floor, Boston, MA 02110-1301, USA. */
18
19/* When installed, this file is called "iconv.h". */
20
21#ifndef _LIBICONV_H
22#define _LIBICONV_H
23
24#include <sys/cdefs.h>
25#include <_types.h>
26#include <sys/_types/_size_t.h>
27
28#define _LIBICONV_VERSION 0x010B /* version number: (major<<8) + minor */
29
30#if BUILDING_LIBICONV
31#define __LIBICONV_DLL_EXPORTED __attribute__((__visibility__("default")))
32#else
33#define __LIBICONV_DLL_EXPORTED
34#endif
35extern __LIBICONV_DLL_EXPORTED int _libiconv_version; /* Likewise */
36
37/* We would like to #include any system header file which could define
38 iconv_t, 1. in order to eliminate the risk that the user gets compilation
39 errors because some other system header file includes /usr/include/iconv.h
40 which defines iconv_t or declares iconv after this file, 2. when compiling
41 for LIBICONV_PLUG, we need the proper iconv_t type in order to produce
42 binary compatible code.
43 But gcc's #include_next is not portable. Thus, once libiconv's iconv.h
44 has been installed in /usr/local/include, there is no way any more to
45 include the original /usr/include/iconv.h. We simply have to get away
46 without it.
47 Ad 1. The risk that a system header file does
48 #include "iconv.h" or #include_next "iconv.h"
49 is small. They all do #include <iconv.h>.
50 Ad 2. The iconv_t type is a pointer type in all cases I have seen. (It
51 has to be a scalar type because (iconv_t)(-1) is a possible return value
52 from iconv_open().) */
53
54/* Define iconv_t ourselves. */
55#ifndef _ICONV_T
56#define _ICONV_T
57typedef void* iconv_t;
58#endif
59
60
61#ifdef __cplusplus
62extern "C" {
63#endif
64
65
66/* Allocates descriptor for code conversion from encoding `fromcode' to
67 encoding `tocode'. */
68extern __LIBICONV_DLL_EXPORTED iconv_t iconv_open (const char* __tocode, const char* __fromcode);
69
70/* Converts, using conversion descriptor `cd', at most `*inbytesleft' bytes
71 starting at `*inbuf', writing at most `*outbytesleft' bytes starting at
72 `*outbuf'.
73 Decrements `*inbytesleft' and increments `*inbuf' by the same amount.
74 Decrements `*outbytesleft' and increments `*outbuf' by the same amount. */
75extern __LIBICONV_DLL_EXPORTED size_t iconv (iconv_t __cd, char* * __restrict __inbuf, size_t * __restrict __inbytesleft, char* * __restrict __outbuf, size_t * __restrict __outbytesleft);
76
77/* Frees resources allocated for conversion descriptor `cd'. */
78extern __LIBICONV_DLL_EXPORTED int iconv_close (iconv_t _cd);
79
80#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
81
82/* Nonstandard extensions. */
83
84#include <sys/_types/_wchar_t.h>
85
86/* Control of attributes. */
87extern __LIBICONV_DLL_EXPORTED int iconvctl (iconv_t cd, int request, void* argument);
88
89/* Hook performed after every successful conversion of a Unicode character. */
90typedef void (*iconv_unicode_char_hook) (unsigned int uc, void* data);
91/* Hook performed after every successful conversion of a wide character. */
92typedef void (*iconv_wide_char_hook) (wchar_t wc, void* data);
93/* Set of hooks. */
94struct iconv_hooks {
95 iconv_unicode_char_hook uc_hook;
96 iconv_wide_char_hook wc_hook;
97 void* data;
98};
99
100/* Fallback function. Invoked when a small number of bytes could not be
101 converted to a Unicode character. This function should process all
102 bytes from inbuf and may produce replacement Unicode characters by calling
103 the write_replacement callback repeatedly. */
104typedef void (*iconv_unicode_mb_to_uc_fallback)
105 (const char* inbuf, size_t inbufsize,
106 void (*write_replacement) (const unsigned int *buf, size_t buflen,
107 void* callback_arg),
108 void* callback_arg,
109 void* data);
110/* Fallback function. Invoked when a Unicode character could not be converted
111 to the target encoding. This function should process the character and
112 may produce replacement bytes (in the target encoding) by calling the
113 write_replacement callback repeatedly. */
114typedef void (*iconv_unicode_uc_to_mb_fallback)
115 (unsigned int code,
116 void (*write_replacement) (const char *buf, size_t buflen,
117 void* callback_arg),
118 void* callback_arg,
119 void* data);
120#if 1
121/* Fallback function. Invoked when a number of bytes could not be converted to
122 a wide character. This function should process all bytes from inbuf and may
123 produce replacement wide characters by calling the write_replacement
124 callback repeatedly. */
125typedef void (*iconv_wchar_mb_to_wc_fallback)
126 (const char* inbuf, size_t inbufsize,
127 void (*write_replacement) (const wchar_t *buf, size_t buflen,
128 void* callback_arg),
129 void* callback_arg,
130 void* data);
131/* Fallback function. Invoked when a wide character could not be converted to
132 the target encoding. This function should process the character and may
133 produce replacement bytes (in the target encoding) by calling the
134 write_replacement callback repeatedly. */
135typedef void (*iconv_wchar_wc_to_mb_fallback)
136 (wchar_t code,
137 void (*write_replacement) (const char *buf, size_t buflen,
138 void* callback_arg),
139 void* callback_arg,
140 void* data);
141#else
142/* If the wchar_t type does not exist, these two fallback functions are never
143 invoked. Their argument list therefore does not matter. */
144typedef void (*iconv_wchar_mb_to_wc_fallback) ();
145typedef void (*iconv_wchar_wc_to_mb_fallback) ();
146#endif
147/* Set of fallbacks. */
148struct iconv_fallbacks {
149 iconv_unicode_mb_to_uc_fallback mb_to_uc_fallback;
150 iconv_unicode_uc_to_mb_fallback uc_to_mb_fallback;
151 iconv_wchar_mb_to_wc_fallback mb_to_wc_fallback;
152 iconv_wchar_wc_to_mb_fallback wc_to_mb_fallback;
153 void* data;
154};
155
156/* Requests for iconvctl. */
157#define ICONV_TRIVIALP 0 /* int *argument */
158#define ICONV_GET_TRANSLITERATE 1 /* int *argument */
159#define ICONV_SET_TRANSLITERATE 2 /* const int *argument */
160#define ICONV_GET_DISCARD_ILSEQ 3 /* int *argument */
161#define ICONV_SET_DISCARD_ILSEQ 4 /* const int *argument */
162#define ICONV_SET_HOOKS 5 /* const struct iconv_hooks *argument */
163#define ICONV_SET_FALLBACKS 6 /* const struct iconv_fallbacks *argument */
164
165/* Listing of locale independent encodings. */
166extern __LIBICONV_DLL_EXPORTED void iconvlist (int (*do_one) (unsigned int namescount,
167 const char * const * names,
168 void* data),
169 void* data);
170
171/* Canonicalize an encoding name.
172 The result is either a canonical encoding name, or name itself. */
173extern __LIBICONV_DLL_EXPORTED const char * iconv_canonicalize (const char * name);
174
175/* Support for relocatable packages. */
176
177/* Sets the original and the current installation prefix of the package.
178 Relocation simply replaces a pathname starting with the original prefix
179 by the corresponding pathname with the current prefix instead. Both
180 prefixes should be directory names without trailing slash (i.e. use ""
181 instead of "/"). */
182extern __LIBICONV_DLL_EXPORTED void libiconv_set_relocation_prefix (const char *orig_prefix,
183 const char *curr_prefix);
184
185#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
186
187
188#ifdef __cplusplus
189}
190#endif
191
192
193#endif /* _LIBICONV_H */
lib/libc/include/x86_64-macos-gnu/langinfo.h created+120
......@@ -0,0 +1,120 @@
1/*-
2 * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: /repoman/r/ncvs/src/include/langinfo.h,v 1.6 2002/09/18 05:54:25 mike Exp $
27 */
28
29#ifndef _LANGINFO_H_
30#define _LANGINFO_H_
31
32#include <_types.h>
33#include <_types/_nl_item.h>
34
35#define CODESET 0 /* codeset name */
36#define D_T_FMT 1 /* string for formatting date and time */
37#define D_FMT 2 /* date format string */
38#define T_FMT 3 /* time format string */
39#define T_FMT_AMPM 4 /* a.m. or p.m. time formatting string */
40#define AM_STR 5 /* Ante Meridian affix */
41#define PM_STR 6 /* Post Meridian affix */
42
43/* week day names */
44#define DAY_1 7
45#define DAY_2 8
46#define DAY_3 9
47#define DAY_4 10
48#define DAY_5 11
49#define DAY_6 12
50#define DAY_7 13
51
52/* abbreviated week day names */
53#define ABDAY_1 14
54#define ABDAY_2 15
55#define ABDAY_3 16
56#define ABDAY_4 17
57#define ABDAY_5 18
58#define ABDAY_6 19
59#define ABDAY_7 20
60
61/* month names */
62#define MON_1 21
63#define MON_2 22
64#define MON_3 23
65#define MON_4 24
66#define MON_5 25
67#define MON_6 26
68#define MON_7 27
69#define MON_8 28
70#define MON_9 29
71#define MON_10 30
72#define MON_11 31
73#define MON_12 32
74
75/* abbreviated month names */
76#define ABMON_1 33
77#define ABMON_2 34
78#define ABMON_3 35
79#define ABMON_4 36
80#define ABMON_5 37
81#define ABMON_6 38
82#define ABMON_7 39
83#define ABMON_8 40
84#define ABMON_9 41
85#define ABMON_10 42
86#define ABMON_11 43
87#define ABMON_12 44
88
89#define ERA 45 /* era description segments */
90#define ERA_D_FMT 46 /* era date format string */
91#define ERA_D_T_FMT 47 /* era date and time format string */
92#define ERA_T_FMT 48 /* era time format string */
93#define ALT_DIGITS 49 /* alternative symbols for digits */
94
95#define RADIXCHAR 50 /* radix char */
96#define THOUSEP 51 /* separator for thousands */
97
98#define YESEXPR 52 /* affirmative response expression */
99#define NOEXPR 53 /* negative response expression */
100
101#if (__DARWIN_C_LEVEL > __DARWIN_C_ANSI && __DARWIN_C_LEVEL < 200112L) || __DARWIN_C_LEVEL == __DARWIN_C_FULL
102#define YESSTR 54 /* affirmative response for yes/no queries */
103#define NOSTR 55 /* negative response for yes/no queries */
104#endif
105
106#define CRNCYSTR 56 /* currency symbol */
107
108#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
109#define D_MD_ORDER 57 /* month/day order (local extension) */
110#endif
111
112__BEGIN_DECLS
113char *nl_langinfo(nl_item);
114__END_DECLS
115
116#ifdef _USE_EXTENDED_LOCALES_
117#include <xlocale/_langinfo.h>
118#endif /* _USE_EXTENDED_LOCALES_ */
119
120#endif /* !_LANGINFO_H_ */
lib/libc/include/x86_64-macos-gnu/libgen.h created+63
......@@ -0,0 +1,63 @@
1/* $OpenBSD: libgen.h,v 1.4 1999/05/28 22:00:22 espie Exp $ */
2/* $FreeBSD: src/include/libgen.h,v 1.1.2.1 2000/11/12 18:01:51 adrian Exp $ */
3
4/*
5 * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22 * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#ifndef _LIBGEN_H_
32#define _LIBGEN_H_
33
34#include <sys/cdefs.h>
35
36__BEGIN_DECLS
37
38#if __DARWIN_UNIX03
39
40char *basename(char *);
41char *dirname(char *);
42
43#else /* !__DARWIN_UNIX03 */
44
45char *basename(const char *);
46char *dirname(const char *);
47
48#endif /* __DARWIN_UNIX_03 */
49
50#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
51#include <Availability.h>
52char *basename_r(const char *, char *)
53 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
54 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
55
56char *dirname_r(const char *, char *)
57 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
58 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
59#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
60
61__END_DECLS
62
63#endif /* _LIBGEN_H_ */
lib/libc/include/x86_64-macos-gnu/mach/boolean.h created+88
......@@ -0,0 +1,88 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 */
58/*
59 * File: mach/boolean.h
60 *
61 * Boolean data type.
62 *
63 */
64
65#ifndef _MACH_BOOLEAN_H_
66#define _MACH_BOOLEAN_H_
67
68/*
69 * Pick up "boolean_t" type definition
70 */
71
72#ifndef ASSEMBLER
73#include <mach/machine/boolean.h>
74#endif /* ASSEMBLER */
75
76/*
77 * Define TRUE and FALSE if not defined.
78 */
79
80#ifndef TRUE
81#define TRUE 1
82#endif /* TRUE */
83
84#ifndef FALSE
85#define FALSE 0
86#endif /* FALSE */
87
88#endif /* _MACH_BOOLEAN_H_ */
lib/libc/include/x86_64-macos-gnu/mach/exception_types.h created+204
......@@ -0,0 +1,204 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 */
58
59#ifndef _MACH_EXCEPTION_TYPES_H_
60#define _MACH_EXCEPTION_TYPES_H_
61
62#include <mach/machine/exception.h>
63
64/*
65 * Machine-independent exception definitions.
66 */
67
68#define EXC_BAD_ACCESS 1 /* Could not access memory */
69/* Code contains kern_return_t describing error. */
70/* Subcode contains bad memory address. */
71
72#define EXC_BAD_INSTRUCTION 2 /* Instruction failed */
73/* Illegal or undefined instruction or operand */
74
75#define EXC_ARITHMETIC 3 /* Arithmetic exception */
76/* Exact nature of exception is in code field */
77
78#define EXC_EMULATION 4 /* Emulation instruction */
79/* Emulation support instruction encountered */
80/* Details in code and subcode fields */
81
82#define EXC_SOFTWARE 5 /* Software generated exception */
83/* Exact exception is in code field. */
84/* Codes 0 - 0xFFFF reserved to hardware */
85/* Codes 0x10000 - 0x1FFFF reserved for OS emulation (Unix) */
86
87#define EXC_BREAKPOINT 6 /* Trace, breakpoint, etc. */
88/* Details in code field. */
89
90#define EXC_SYSCALL 7 /* System calls. */
91
92#define EXC_MACH_SYSCALL 8 /* Mach system calls. */
93
94#define EXC_RPC_ALERT 9 /* RPC alert */
95
96#define EXC_CRASH 10 /* Abnormal process exit */
97
98#define EXC_RESOURCE 11 /* Hit resource consumption limit */
99/* Exact resource is in code field. */
100
101#define EXC_GUARD 12 /* Violated guarded resource protections */
102
103#define EXC_CORPSE_NOTIFY 13 /* Abnormal process exited to corpse state */
104
105#define EXC_CORPSE_VARIANT_BIT 0x100 /* bit set for EXC_*_CORPSE variants of EXC_* */
106
107
108/*
109 * Machine-independent exception behaviors
110 */
111
112# define EXCEPTION_DEFAULT 1
113/* Send a catch_exception_raise message including the identity.
114 */
115
116# define EXCEPTION_STATE 2
117/* Send a catch_exception_raise_state message including the
118 * thread state.
119 */
120
121# define EXCEPTION_STATE_IDENTITY 3
122/* Send a catch_exception_raise_state_identity message including
123 * the thread identity and state.
124 */
125
126#define MACH_EXCEPTION_ERRORS 0x40000000
127/* include additional exception specific errors, not used yet. */
128
129#define MACH_EXCEPTION_CODES 0x80000000
130/* Send 64-bit code and subcode in the exception header */
131
132#define MACH_EXCEPTION_MASK (MACH_EXCEPTION_CODES | MACH_EXCEPTION_ERRORS)
133/*
134 * Masks for exception definitions, above
135 * bit zero is unused, therefore 1 word = 31 exception types
136 */
137
138#define EXC_MASK_BAD_ACCESS (1 << EXC_BAD_ACCESS)
139#define EXC_MASK_BAD_INSTRUCTION (1 << EXC_BAD_INSTRUCTION)
140#define EXC_MASK_ARITHMETIC (1 << EXC_ARITHMETIC)
141#define EXC_MASK_EMULATION (1 << EXC_EMULATION)
142#define EXC_MASK_SOFTWARE (1 << EXC_SOFTWARE)
143#define EXC_MASK_BREAKPOINT (1 << EXC_BREAKPOINT)
144#define EXC_MASK_SYSCALL (1 << EXC_SYSCALL)
145#define EXC_MASK_MACH_SYSCALL (1 << EXC_MACH_SYSCALL)
146#define EXC_MASK_RPC_ALERT (1 << EXC_RPC_ALERT)
147#define EXC_MASK_CRASH (1 << EXC_CRASH)
148#define EXC_MASK_RESOURCE (1 << EXC_RESOURCE)
149#define EXC_MASK_GUARD (1 << EXC_GUARD)
150#define EXC_MASK_CORPSE_NOTIFY (1 << EXC_CORPSE_NOTIFY)
151
152#define EXC_MASK_ALL (EXC_MASK_BAD_ACCESS | \
153 EXC_MASK_BAD_INSTRUCTION | \
154 EXC_MASK_ARITHMETIC | \
155 EXC_MASK_EMULATION | \
156 EXC_MASK_SOFTWARE | \
157 EXC_MASK_BREAKPOINT | \
158 EXC_MASK_SYSCALL | \
159 EXC_MASK_MACH_SYSCALL | \
160 EXC_MASK_RPC_ALERT | \
161 EXC_MASK_RESOURCE | \
162 EXC_MASK_GUARD | \
163 EXC_MASK_MACHINE)
164
165
166#define FIRST_EXCEPTION 1 /* ZERO is illegal */
167
168/*
169 * Machine independent codes for EXC_SOFTWARE
170 * Codes 0x10000 - 0x1FFFF reserved for OS emulation (Unix)
171 * 0x10000 - 0x10002 in use for unix signals
172 * 0x20000 - 0x2FFFF reserved for MACF
173 */
174#define EXC_SOFT_SIGNAL 0x10003 /* Unix signal exceptions */
175
176#define EXC_MACF_MIN 0x20000 /* MACF exceptions */
177#define EXC_MACF_MAX 0x2FFFF
178
179#ifndef ASSEMBLER
180
181#include <mach/port.h>
182#include <mach/thread_status.h>
183#include <mach/machine/vm_types.h>
184/*
185 * Exported types
186 */
187
188typedef int exception_type_t;
189typedef integer_t exception_data_type_t;
190typedef int64_t mach_exception_data_type_t;
191typedef int exception_behavior_t;
192typedef exception_data_type_t *exception_data_t;
193typedef mach_exception_data_type_t *mach_exception_data_t;
194typedef unsigned int exception_mask_t;
195typedef exception_mask_t *exception_mask_array_t;
196typedef exception_behavior_t *exception_behavior_array_t;
197typedef thread_state_flavor_t *exception_flavor_array_t;
198typedef mach_port_t *exception_port_array_t;
199typedef mach_exception_data_type_t mach_exception_code_t;
200typedef mach_exception_data_type_t mach_exception_subcode_t;
201
202#endif /* ASSEMBLER */
203
204#endif /* _MACH_EXCEPTION_TYPES_H_ */
lib/libc/include/x86_64-macos-gnu/mach/i386/boolean.h created+74
......@@ -0,0 +1,74 @@
1/*
2 * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 */
58
59/*
60 * File: boolean.h
61 *
62 * Boolean type, for I386.
63 */
64
65#ifndef _MACH_I386_BOOLEAN_H_
66#define _MACH_I386_BOOLEAN_H_
67
68#if defined(__x86_64__) && !defined(KERNEL)
69typedef unsigned int boolean_t;
70#else
71typedef int boolean_t;
72#endif
73
74#endif /* _MACH_I386_BOOLEAN_H_ */
lib/libc/include/x86_64-macos-gnu/mach/i386/exception.h created+135
......@@ -0,0 +1,135 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 */
58
59#ifndef _MACH_I386_EXCEPTION_H_
60#define _MACH_I386_EXCEPTION_H_
61
62/*
63 * No machine dependent types for the 80386
64 */
65
66#define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */
67
68/*
69 * Codes and subcodes for 80386 exceptions.
70 */
71
72#define EXCEPTION_CODE_MAX 2 /* currently code and subcode */
73
74/*
75 * EXC_BAD_INSTRUCTION
76 */
77
78#define EXC_I386_INVOP 1
79
80/*
81 * EXC_ARITHMETIC
82 */
83
84#define EXC_I386_DIV 1
85#define EXC_I386_INTO 2
86#define EXC_I386_NOEXT 3
87#define EXC_I386_EXTOVR 4
88#define EXC_I386_EXTERR 5
89#define EXC_I386_EMERR 6
90#define EXC_I386_BOUND 7
91#define EXC_I386_SSEEXTERR 8
92
93/*
94 * EXC_SOFTWARE
95 * Note: 0x10000-0x10003 in use for unix signal
96 */
97
98/*
99 * EXC_BAD_ACCESS
100 */
101
102/*
103 * EXC_BREAKPOINT
104 */
105
106#define EXC_I386_SGL 1
107#define EXC_I386_BPT 2
108
109#define EXC_I386_DIVERR 0 /* divide by 0 eprror */
110#define EXC_I386_SGLSTP 1 /* single step */
111#define EXC_I386_NMIFLT 2 /* NMI */
112#define EXC_I386_BPTFLT 3 /* breakpoint fault */
113#define EXC_I386_INTOFLT 4 /* INTO overflow fault */
114#define EXC_I386_BOUNDFLT 5 /* BOUND instruction fault */
115#define EXC_I386_INVOPFLT 6 /* invalid opcode fault */
116#define EXC_I386_NOEXTFLT 7 /* extension not available fault*/
117#define EXC_I386_DBLFLT 8 /* double fault */
118#define EXC_I386_EXTOVRFLT 9 /* extension overrun fault */
119#define EXC_I386_INVTSSFLT 10 /* invalid TSS fault */
120#define EXC_I386_SEGNPFLT 11 /* segment not present fault */
121#define EXC_I386_STKFLT 12 /* stack fault */
122#define EXC_I386_GPFLT 13 /* general protection fault */
123#define EXC_I386_PGFLT 14 /* page fault */
124#define EXC_I386_EXTERRFLT 16 /* extension error fault */
125#define EXC_I386_ALIGNFLT 17 /* Alignment fault */
126#define EXC_I386_ENDPERR 33 /* emulated extension error flt */
127#define EXC_I386_ENOEXTFLT 32 /* emulated ext not present */
128
129
130/*
131 * machine dependent exception masks
132 */
133#define EXC_MASK_MACHINE 0
134
135#endif /* _MACH_I386_EXCEPTION_H_ */
lib/libc/include/x86_64-macos-gnu/mach/i386/fp_reg.h created+118
......@@ -0,0 +1,118 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1992-1989 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 */
58
59#ifndef _I386_FP_SAVE_H_
60#define _I386_FP_SAVE_H_
61
62/*
63 * Control register
64 */
65#define FPC_IE 0x0001 /* enable invalid operation
66 * exception */
67#define FPC_IM FPC_IE
68#define FPC_DE 0x0002 /* enable denormalized operation
69 * exception */
70#define FPC_DM FPC_DE
71#define FPC_ZE 0x0004 /* enable zero-divide exception */
72#define FPC_ZM FPC_ZE
73#define FPC_OE 0x0008 /* enable overflow exception */
74#define FPC_OM FPC_OE
75#define FPC_UE 0x0010 /* enable underflow exception */
76#define FPC_PE 0x0020 /* enable precision exception */
77#define FPC_PC 0x0300 /* precision control: */
78#define FPC_PC_24 0x0000 /* 24 bits */
79#define FPC_PC_53 0x0200 /* 53 bits */
80#define FPC_PC_64 0x0300 /* 64 bits */
81#define FPC_RC 0x0c00 /* rounding control: */
82#define FPC_RC_RN 0x0000 /* round to nearest or even */
83#define FPC_RC_RD 0x0400 /* round down */
84#define FPC_RC_RU 0x0800 /* round up */
85#define FPC_RC_CHOP 0x0c00 /* chop */
86#define FPC_IC 0x1000 /* infinity control (obsolete) */
87#define FPC_IC_PROJ 0x0000 /* projective infinity */
88#define FPC_IC_AFF 0x1000 /* affine infinity (std) */
89
90/*
91 * Status register
92 */
93#define FPS_IE 0x0001 /* invalid operation */
94#define FPS_DE 0x0002 /* denormalized operand */
95#define FPS_ZE 0x0004 /* divide by zero */
96#define FPS_OE 0x0008 /* overflow */
97#define FPS_UE 0x0010 /* underflow */
98#define FPS_PE 0x0020 /* precision */
99#define FPS_SF 0x0040 /* stack flag */
100#define FPS_ES 0x0080 /* error summary */
101#define FPS_C0 0x0100 /* condition code bit 0 */
102#define FPS_C1 0x0200 /* condition code bit 1 */
103#define FPS_C2 0x0400 /* condition code bit 2 */
104#define FPS_TOS 0x3800 /* top-of-stack pointer */
105#define FPS_TOS_SHIFT 11
106#define FPS_C3 0x4000 /* condition code bit 3 */
107#define FPS_BUSY 0x8000 /* FPU busy */
108
109/*
110 * Kind of floating-point support provided by kernel.
111 */
112#define FP_NO 0 /* no floating point */
113#define FP_SOFT 1 /* software FP emulator */
114#define FP_287 2 /* 80287 */
115#define FP_387 3 /* 80387 or 80486 */
116#define FP_FXSR 4 /* Fast save/restore SIMD Extension */
117
118#endif /* _I386_FP_SAVE_H_ */
lib/libc/include/x86_64-macos-gnu/mach/i386/kern_return.h created+74
......@@ -0,0 +1,74 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 */
58
59/*
60 * File: kern_return.h
61 * Author: Avadis Tevanian, Jr., Michael Wayne Young
62 * Date: 1985
63 *
64 * Machine-dependent kernel return definitions.
65 */
66
67#ifndef _MACH_I386_KERN_RETURN_H_
68#define _MACH_I386_KERN_RETURN_H_
69
70#ifndef ASSEMBLER
71typedef int kern_return_t;
72#endif /* ASSEMBLER */
73
74#endif /* _MACH_I386_KERN_RETURN_H_ */
lib/libc/include/x86_64-macos-gnu/mach/i386/thread_state.h created+42
......@@ -0,0 +1,42 @@
1/*
2 * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31
32#ifndef _MACH_I386_THREAD_STATE_H_
33#define _MACH_I386_THREAD_STATE_H_
34
35/* Size of maximum exported thread state in words */
36#define I386_THREAD_STATE_MAX (614) /* Size of biggest state possible */
37
38#if defined (__i386__) || defined(__x86_64__)
39#define THREAD_STATE_MAX I386_THREAD_STATE_MAX
40#endif
41
42#endif /* _MACH_I386_THREAD_STATE_H_ */
lib/libc/include/x86_64-macos-gnu/mach/i386/thread_status.h created+345
......@@ -0,0 +1,345 @@
1/*
2 * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 */
58/*
59 * File: thread_status.h
60 * Author: Avadis Tevanian, Jr.
61 * Date: 1985
62 *
63 * This file contains the structure definitions for the thread
64 * state as applied to I386 processors.
65 */
66
67#ifndef _MACH_I386_THREAD_STATUS_H_
68#define _MACH_I386_THREAD_STATUS_H_
69
70#include <mach/machine/_structs.h>
71#include <mach/message.h>
72#include <mach/i386/fp_reg.h>
73#include <mach/i386/thread_state.h>
74#include <i386/eflags.h>
75
76
77/*
78 * the i386_xxxx form is kept for legacy purposes since these types
79 * are externally known... eventually they should be deprecated.
80 * our internal implementation has moved to the following naming convention
81 *
82 * x86_xxxx32 names are used to deal with 32 bit states
83 * x86_xxxx64 names are used to deal with 64 bit states
84 * x86_xxxx names are used to deal with either 32 or 64 bit states
85 * via a self-describing mechanism
86 */
87
88/*
89 * these are the legacy names which should be deprecated in the future
90 * they are externally known which is the only reason we don't just get
91 * rid of them
92 */
93#define i386_THREAD_STATE 1
94#define i386_FLOAT_STATE 2
95#define i386_EXCEPTION_STATE 3
96
97/*
98 * THREAD_STATE_FLAVOR_LIST 0
99 * these are the supported flavors
100 */
101#define x86_THREAD_STATE32 1
102#define x86_FLOAT_STATE32 2
103#define x86_EXCEPTION_STATE32 3
104#define x86_THREAD_STATE64 4
105#define x86_FLOAT_STATE64 5
106#define x86_EXCEPTION_STATE64 6
107#define x86_THREAD_STATE 7
108#define x86_FLOAT_STATE 8
109#define x86_EXCEPTION_STATE 9
110#define x86_DEBUG_STATE32 10
111#define x86_DEBUG_STATE64 11
112#define x86_DEBUG_STATE 12
113#define THREAD_STATE_NONE 13
114/* 14 and 15 are used for the internal x86_SAVED_STATE flavours */
115/* Arrange for flavors to take sequential values, 32-bit, 64-bit, non-specific */
116#define x86_AVX_STATE32 16
117#define x86_AVX_STATE64 (x86_AVX_STATE32 + 1)
118#define x86_AVX_STATE (x86_AVX_STATE32 + 2)
119#define x86_AVX512_STATE32 19
120#define x86_AVX512_STATE64 (x86_AVX512_STATE32 + 1)
121#define x86_AVX512_STATE (x86_AVX512_STATE32 + 2)
122#define x86_PAGEIN_STATE 22
123#define x86_THREAD_FULL_STATE64 23
124
125/*
126 * Largest state on this machine:
127 * (be sure mach/machine/thread_state.h matches!)
128 */
129#define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX
130
131/*
132 * VALID_THREAD_STATE_FLAVOR is a platform specific macro that when passed
133 * an exception flavor will return if that is a defined flavor for that
134 * platform. The macro must be manually updated to include all of the valid
135 * exception flavors as defined above.
136 */
137#define VALID_THREAD_STATE_FLAVOR(x) \
138 ((x == x86_THREAD_STATE32) || \
139 (x == x86_FLOAT_STATE32) || \
140 (x == x86_EXCEPTION_STATE32) || \
141 (x == x86_DEBUG_STATE32) || \
142 (x == x86_THREAD_STATE64) || \
143 (x == x86_THREAD_FULL_STATE64) || \
144 (x == x86_FLOAT_STATE64) || \
145 (x == x86_EXCEPTION_STATE64) || \
146 (x == x86_DEBUG_STATE64) || \
147 (x == x86_THREAD_STATE) || \
148 (x == x86_FLOAT_STATE) || \
149 (x == x86_EXCEPTION_STATE) || \
150 (x == x86_DEBUG_STATE) || \
151 (x == x86_AVX_STATE32) || \
152 (x == x86_AVX_STATE64) || \
153 (x == x86_AVX_STATE) || \
154 (x == x86_AVX512_STATE32) || \
155 (x == x86_AVX512_STATE64) || \
156 (x == x86_AVX512_STATE) || \
157 (x == x86_PAGEIN_STATE) || \
158 (x == THREAD_STATE_NONE))
159
160struct x86_state_hdr {
161 uint32_t flavor;
162 uint32_t count;
163};
164typedef struct x86_state_hdr x86_state_hdr_t;
165
166/*
167 * Default segment register values.
168 */
169
170#define USER_CODE_SELECTOR 0x0017
171#define USER_DATA_SELECTOR 0x001f
172#define KERN_CODE_SELECTOR 0x0008
173#define KERN_DATA_SELECTOR 0x0010
174
175/*
176 * to be deprecated in the future
177 */
178typedef _STRUCT_X86_THREAD_STATE32 i386_thread_state_t;
179#define i386_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
180 ( sizeof (i386_thread_state_t) / sizeof (int) ))
181
182typedef _STRUCT_X86_THREAD_STATE32 x86_thread_state32_t;
183#define x86_THREAD_STATE32_COUNT ((mach_msg_type_number_t) \
184 ( sizeof (x86_thread_state32_t) / sizeof (int) ))
185
186/*
187 * to be deprecated in the future
188 */
189typedef _STRUCT_X86_FLOAT_STATE32 i386_float_state_t;
190#define i386_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \
191 (sizeof(i386_float_state_t)/sizeof(unsigned int)))
192
193typedef _STRUCT_X86_FLOAT_STATE32 x86_float_state32_t;
194#define x86_FLOAT_STATE32_COUNT ((mach_msg_type_number_t) \
195 (sizeof(x86_float_state32_t)/sizeof(unsigned int)))
196
197typedef _STRUCT_X86_AVX_STATE32 x86_avx_state32_t;
198#define x86_AVX_STATE32_COUNT ((mach_msg_type_number_t) \
199 (sizeof(x86_avx_state32_t)/sizeof(unsigned int)))
200
201typedef _STRUCT_X86_AVX512_STATE32 x86_avx512_state32_t;
202#define x86_AVX512_STATE32_COUNT ((mach_msg_type_number_t) \
203 (sizeof(x86_avx512_state32_t)/sizeof(unsigned int)))
204
205/*
206 * to be deprecated in the future
207 */
208typedef _STRUCT_X86_EXCEPTION_STATE32 i386_exception_state_t;
209#define i386_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
210 ( sizeof (i386_exception_state_t) / sizeof (int) ))
211
212typedef _STRUCT_X86_EXCEPTION_STATE32 x86_exception_state32_t;
213#define x86_EXCEPTION_STATE32_COUNT ((mach_msg_type_number_t) \
214 ( sizeof (x86_exception_state32_t) / sizeof (int) ))
215
216#define I386_EXCEPTION_STATE_COUNT i386_EXCEPTION_STATE_COUNT
217
218typedef _STRUCT_X86_DEBUG_STATE32 x86_debug_state32_t;
219#define x86_DEBUG_STATE32_COUNT ((mach_msg_type_number_t) \
220 ( sizeof (x86_debug_state32_t) / sizeof (int) ))
221
222#define X86_DEBUG_STATE32_COUNT x86_DEBUG_STATE32_COUNT
223
224typedef _STRUCT_X86_THREAD_STATE64 x86_thread_state64_t;
225#define x86_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \
226 ( sizeof (x86_thread_state64_t) / sizeof (int) ))
227
228typedef _STRUCT_X86_THREAD_FULL_STATE64 x86_thread_full_state64_t;
229#define x86_THREAD_FULL_STATE64_COUNT ((mach_msg_type_number_t) \
230 ( sizeof (x86_thread_full_state64_t) / sizeof (int) ))
231
232typedef _STRUCT_X86_FLOAT_STATE64 x86_float_state64_t;
233#define x86_FLOAT_STATE64_COUNT ((mach_msg_type_number_t) \
234 (sizeof(x86_float_state64_t)/sizeof(unsigned int)))
235
236typedef _STRUCT_X86_AVX_STATE64 x86_avx_state64_t;
237#define x86_AVX_STATE64_COUNT ((mach_msg_type_number_t) \
238 (sizeof(x86_avx_state64_t)/sizeof(unsigned int)))
239
240typedef _STRUCT_X86_AVX512_STATE64 x86_avx512_state64_t;
241#define x86_AVX512_STATE64_COUNT ((mach_msg_type_number_t) \
242 (sizeof(x86_avx512_state64_t)/sizeof(unsigned int)))
243
244typedef _STRUCT_X86_EXCEPTION_STATE64 x86_exception_state64_t;
245#define x86_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \
246 ( sizeof (x86_exception_state64_t) / sizeof (int) ))
247
248#define X86_EXCEPTION_STATE64_COUNT x86_EXCEPTION_STATE64_COUNT
249
250typedef _STRUCT_X86_DEBUG_STATE64 x86_debug_state64_t;
251#define x86_DEBUG_STATE64_COUNT ((mach_msg_type_number_t) \
252 ( sizeof (x86_debug_state64_t) / sizeof (int) ))
253
254#define X86_DEBUG_STATE64_COUNT x86_DEBUG_STATE64_COUNT
255
256typedef _STRUCT_X86_PAGEIN_STATE x86_pagein_state_t;
257#define x86_PAGEIN_STATE_COUNT \
258 ((mach_msg_type_number_t)(sizeof(x86_pagein_state_t) / sizeof(int)))
259
260#define X86_PAGEIN_STATE_COUNT x86_PAGEIN_STATE_COUNT
261
262/*
263 * Combined thread, float and exception states
264 */
265struct x86_thread_state {
266 x86_state_hdr_t tsh;
267 union {
268 x86_thread_state32_t ts32;
269 x86_thread_state64_t ts64;
270 } uts;
271};
272
273struct x86_float_state {
274 x86_state_hdr_t fsh;
275 union {
276 x86_float_state32_t fs32;
277 x86_float_state64_t fs64;
278 } ufs;
279};
280
281struct x86_exception_state {
282 x86_state_hdr_t esh;
283 union {
284 x86_exception_state32_t es32;
285 x86_exception_state64_t es64;
286 } ues;
287};
288
289struct x86_debug_state {
290 x86_state_hdr_t dsh;
291 union {
292 x86_debug_state32_t ds32;
293 x86_debug_state64_t ds64;
294 } uds;
295};
296
297struct x86_avx_state {
298 x86_state_hdr_t ash;
299 union {
300 x86_avx_state32_t as32;
301 x86_avx_state64_t as64;
302 } ufs;
303};
304
305struct x86_avx512_state {
306 x86_state_hdr_t ash;
307 union {
308 x86_avx512_state32_t as32;
309 x86_avx512_state64_t as64;
310 } ufs;
311};
312
313typedef struct x86_thread_state x86_thread_state_t;
314#define x86_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
315 ( sizeof (x86_thread_state_t) / sizeof (int) ))
316
317typedef struct x86_float_state x86_float_state_t;
318#define x86_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \
319 (sizeof(x86_float_state_t)/sizeof(unsigned int)))
320
321typedef struct x86_exception_state x86_exception_state_t;
322#define x86_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
323 (sizeof(x86_exception_state_t)/sizeof(unsigned int)))
324
325typedef struct x86_debug_state x86_debug_state_t;
326#define x86_DEBUG_STATE_COUNT ((mach_msg_type_number_t) \
327 (sizeof(x86_debug_state_t)/sizeof(unsigned int)))
328
329typedef struct x86_avx_state x86_avx_state_t;
330#define x86_AVX_STATE_COUNT ((mach_msg_type_number_t) \
331 (sizeof(x86_avx_state_t)/sizeof(unsigned int)))
332
333typedef struct x86_avx512_state x86_avx512_state_t;
334#define x86_AVX512_STATE_COUNT ((mach_msg_type_number_t) \
335 (sizeof(x86_avx512_state_t)/sizeof(unsigned int)))
336
337/*
338 * Machine-independent way for servers and Mach's exception mechanism to
339 * choose the most efficient state flavor for exception RPC's:
340 */
341#define MACHINE_THREAD_STATE x86_THREAD_STATE
342#define MACHINE_THREAD_STATE_COUNT x86_THREAD_STATE_COUNT
343
344
345#endif /* _MACH_I386_THREAD_STATUS_H_ */
lib/libc/include/x86_64-macos-gnu/mach/i386/vm_param.h created+170
......@@ -0,0 +1,170 @@
1/*
2 * Copyright (c) 2000-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56
57/*
58 * Copyright (c) 1994 The University of Utah and
59 * the Computer Systems Laboratory at the University of Utah (CSL).
60 * All rights reserved.
61 *
62 * Permission to use, copy, modify and distribute this software is hereby
63 * granted provided that (1) source code retains these copyright, permission,
64 * and disclaimer notices, and (2) redistributions including binaries
65 * reproduce the notices in supporting documentation, and (3) all advertising
66 * materials mentioning features or use of this software display the following
67 * acknowledgement: ``This product includes software developed by the
68 * Computer Systems Laboratory at the University of Utah.''
69 *
70 * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
71 * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
72 * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
73 *
74 * CSL requests users of this software to return to csl-dist@cs.utah.edu any
75 * improvements that they make and grant CSL redistribution rights.
76 *
77 */
78
79/*
80 * File: vm_param.h
81 * Author: Avadis Tevanian, Jr.
82 * Date: 1985
83 *
84 * I386 machine dependent virtual memory parameters.
85 * Most of the declarations are preceeded by I386_ (or i386_)
86 * which is OK because only I386 specific code will be using
87 * them.
88 */
89
90#ifndef _MACH_I386_VM_PARAM_H_
91#define _MACH_I386_VM_PARAM_H_
92
93#define BYTE_SIZE 8 /* byte size in bits */
94
95#define I386_PGBYTES 4096 /* bytes per 80386 page */
96#define I386_PGSHIFT 12 /* bitshift for pages */
97
98#define PAGE_SIZE I386_PGBYTES
99#define PAGE_SHIFT I386_PGSHIFT
100#define PAGE_MASK (PAGE_SIZE - 1)
101
102#define PAGE_MAX_SHIFT PAGE_SHIFT
103#define PAGE_MAX_SIZE PAGE_SIZE
104#define PAGE_MAX_MASK PAGE_MASK
105
106#define PAGE_MIN_SHIFT PAGE_SHIFT
107#define PAGE_MIN_SIZE PAGE_SIZE
108#define PAGE_MIN_MASK PAGE_MASK
109
110#define I386_LPGBYTES 2*1024*1024 /* bytes per large page */
111#define I386_LPGSHIFT 21 /* bitshift for large pages */
112#define I386_LPGMASK (I386_LPGBYTES-1)
113
114/*
115 * Convert bytes to pages and convert pages to bytes.
116 * No rounding is used.
117 */
118
119#define i386_btop(x) ((ppnum_t)((x) >> I386_PGSHIFT))
120#define machine_btop(x) i386_btop(x)
121#define i386_ptob(x) (((pmap_paddr_t)(x)) << I386_PGSHIFT)
122#define machine_ptob(x) i386_ptob(x)
123
124/*
125 * Round off or truncate to the nearest page. These will work
126 * for either addresses or counts. (i.e. 1 byte rounds to 1 page
127 * bytes.
128 */
129
130#define i386_round_page(x) ((((pmap_paddr_t)(x)) + I386_PGBYTES - 1) & \
131 ~(I386_PGBYTES-1))
132#define i386_trunc_page(x) (((pmap_paddr_t)(x)) & ~(I386_PGBYTES-1))
133
134
135
136#define VM_MIN_ADDRESS64 ((user_addr_t) 0x0000000000000000ULL)
137/*
138 * default top of user stack... it grows down from here
139 */
140#define VM_USRSTACK64 ((user_addr_t) 0x00007FFEEFC00000ULL)
141
142/*
143 * XXX TODO: Obsolete?
144 */
145#define VM_DYLD64 ((user_addr_t) 0x00007FFF5FC00000ULL)
146#define VM_LIB64_SHR_DATA ((user_addr_t) 0x00007FFF60000000ULL)
147#define VM_LIB64_SHR_TEXT ((user_addr_t) 0x00007FFF80000000ULL)
148/*
149 * the end of the usable user address space , for now about 47 bits.
150 * the 64 bit commpage is past the end of this
151 */
152#define VM_MAX_PAGE_ADDRESS ((user_addr_t) 0x00007FFFFFE00000ULL)
153/*
154 * canonical end of user address space for limits checking
155 */
156#define VM_MAX_USER_PAGE_ADDRESS ((user_addr_t)0x00007FFFFFFFF000ULL)
157
158
159/* system-wide values */
160#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) 0)
161#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) VM_MAX_PAGE_ADDRESS)
162
163/* process-relative values (all 32-bit legacy only for now) */
164#define VM_MIN_ADDRESS ((vm_offset_t) 0)
165#define VM_USRSTACK32 ((vm_offset_t) 0xC0000000) /* ASLR slides stack down by up to 1 MB */
166#define VM_MAX_ADDRESS ((vm_offset_t) 0xFFE00000)
167
168
169
170#endif /* _MACH_I386_VM_PARAM_H_ */
lib/libc/include/x86_64-macos-gnu/mach/i386/vm_types.h created+142
......@@ -0,0 +1,142 @@
1/*
2 * Copyright (c) 2000-2016 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 */
58
59/*
60 * File: vm_types.h
61 * Author: Avadis Tevanian, Jr.
62 * Date: 1985
63 *
64 * Header file for VM data types. I386 version.
65 */
66
67#ifndef _MACH_I386_VM_TYPES_H_
68#define _MACH_I386_VM_TYPES_H_
69
70#ifndef ASSEMBLER
71
72#include <i386/_types.h>
73#include <mach/i386/vm_param.h>
74#include <stdint.h>
75
76/*
77 * natural_t and integer_t are Mach's legacy types for machine-
78 * independent integer types (unsigned, and signed, respectively).
79 * Their original purpose was to define other types in a machine/
80 * compiler independent way.
81 *
82 * They also had an implicit "same size as pointer" characteristic
83 * to them (i.e. Mach's traditional types are very ILP32 or ILP64
84 * centric). We support x86 ABIs that do not follow either of
85 * these models (specifically LP64). Therefore, we had to make a
86 * choice between making these types scale with pointers or stay
87 * tied to integers. Because their use is predominantly tied to
88 * to the size of an integer, we are keeping that association and
89 * breaking free from pointer size guarantees.
90 *
91 * New use of these types is discouraged.
92 */
93typedef __darwin_natural_t natural_t;
94typedef int integer_t;
95
96/*
97 * A vm_offset_t is a type-neutral pointer,
98 * e.g. an offset into a virtual memory space.
99 */
100#ifdef __LP64__
101typedef uintptr_t vm_offset_t;
102#else /* __LP64__ */
103typedef natural_t vm_offset_t;
104#endif /* __LP64__ */
105
106/*
107 * A vm_size_t is the proper type for e.g.
108 * expressing the difference between two
109 * vm_offset_t entities.
110 */
111#ifdef __LP64__
112typedef uintptr_t vm_size_t;
113#else /* __LP64__ */
114typedef natural_t vm_size_t;
115#endif /* __LP64__ */
116
117/*
118 * This new type is independent of a particular vm map's
119 * implementation size - and represents appropriate types
120 * for all possible maps. This is used for interfaces
121 * where the size of the map is not known - or we don't
122 * want to have to distinguish.
123 */
124typedef uint64_t mach_vm_address_t;
125typedef uint64_t mach_vm_offset_t;
126typedef uint64_t mach_vm_size_t;
127
128typedef uint64_t vm_map_offset_t;
129typedef uint64_t vm_map_address_t;
130typedef uint64_t vm_map_size_t;
131
132typedef mach_vm_address_t mach_port_context_t;
133
134
135#endif /* ASSEMBLER */
136
137/*
138 * If composing messages by hand (please do not)
139 */
140#define MACH_MSG_TYPE_INTEGER_T MACH_MSG_TYPE_INTEGER_32
141
142#endif /* _MACH_I386_VM_TYPES_H_ */
lib/libc/include/x86_64-macos-gnu/mach/kern_return.h created+330
......@@ -0,0 +1,330 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 */
58/*
59 * File: h/kern_return.h
60 * Author: Avadis Tevanian, Jr.
61 * Date: 1985
62 *
63 * Kernel return codes.
64 *
65 */
66
67#ifndef _MACH_KERN_RETURN_H_
68#define _MACH_KERN_RETURN_H_
69
70#include <mach/machine/kern_return.h>
71
72#define KERN_SUCCESS 0
73
74#define KERN_INVALID_ADDRESS 1
75/* Specified address is not currently valid.
76 */
77
78#define KERN_PROTECTION_FAILURE 2
79/* Specified memory is valid, but does not permit the
80 * required forms of access.
81 */
82
83#define KERN_NO_SPACE 3
84/* The address range specified is already in use, or
85 * no address range of the size specified could be
86 * found.
87 */
88
89#define KERN_INVALID_ARGUMENT 4
90/* The function requested was not applicable to this
91 * type of argument, or an argument is invalid
92 */
93
94#define KERN_FAILURE 5
95/* The function could not be performed. A catch-all.
96 */
97
98#define KERN_RESOURCE_SHORTAGE 6
99/* A system resource could not be allocated to fulfill
100 * this request. This failure may not be permanent.
101 */
102
103#define KERN_NOT_RECEIVER 7
104/* The task in question does not hold receive rights
105 * for the port argument.
106 */
107
108#define KERN_NO_ACCESS 8
109/* Bogus access restriction.
110 */
111
112#define KERN_MEMORY_FAILURE 9
113/* During a page fault, the target address refers to a
114 * memory object that has been destroyed. This
115 * failure is permanent.
116 */
117
118#define KERN_MEMORY_ERROR 10
119/* During a page fault, the memory object indicated
120 * that the data could not be returned. This failure
121 * may be temporary; future attempts to access this
122 * same data may succeed, as defined by the memory
123 * object.
124 */
125
126#define KERN_ALREADY_IN_SET 11
127/* The receive right is already a member of the portset.
128 */
129
130#define KERN_NOT_IN_SET 12
131/* The receive right is not a member of a port set.
132 */
133
134#define KERN_NAME_EXISTS 13
135/* The name already denotes a right in the task.
136 */
137
138#define KERN_ABORTED 14
139/* The operation was aborted. Ipc code will
140 * catch this and reflect it as a message error.
141 */
142
143#define KERN_INVALID_NAME 15
144/* The name doesn't denote a right in the task.
145 */
146
147#define KERN_INVALID_TASK 16
148/* Target task isn't an active task.
149 */
150
151#define KERN_INVALID_RIGHT 17
152/* The name denotes a right, but not an appropriate right.
153 */
154
155#define KERN_INVALID_VALUE 18
156/* A blatant range error.
157 */
158
159#define KERN_UREFS_OVERFLOW 19
160/* Operation would overflow limit on user-references.
161 */
162
163#define KERN_INVALID_CAPABILITY 20
164/* The supplied (port) capability is improper.
165 */
166
167#define KERN_RIGHT_EXISTS 21
168/* The task already has send or receive rights
169 * for the port under another name.
170 */
171
172#define KERN_INVALID_HOST 22
173/* Target host isn't actually a host.
174 */
175
176#define KERN_MEMORY_PRESENT 23
177/* An attempt was made to supply "precious" data
178 * for memory that is already present in a
179 * memory object.
180 */
181
182#define KERN_MEMORY_DATA_MOVED 24
183/* A page was requested of a memory manager via
184 * memory_object_data_request for an object using
185 * a MEMORY_OBJECT_COPY_CALL strategy, with the
186 * VM_PROT_WANTS_COPY flag being used to specify
187 * that the page desired is for a copy of the
188 * object, and the memory manager has detected
189 * the page was pushed into a copy of the object
190 * while the kernel was walking the shadow chain
191 * from the copy to the object. This error code
192 * is delivered via memory_object_data_error
193 * and is handled by the kernel (it forces the
194 * kernel to restart the fault). It will not be
195 * seen by users.
196 */
197
198#define KERN_MEMORY_RESTART_COPY 25
199/* A strategic copy was attempted of an object
200 * upon which a quicker copy is now possible.
201 * The caller should retry the copy using
202 * vm_object_copy_quickly. This error code
203 * is seen only by the kernel.
204 */
205
206#define KERN_INVALID_PROCESSOR_SET 26
207/* An argument applied to assert processor set privilege
208 * was not a processor set control port.
209 */
210
211#define KERN_POLICY_LIMIT 27
212/* The specified scheduling attributes exceed the thread's
213 * limits.
214 */
215
216#define KERN_INVALID_POLICY 28
217/* The specified scheduling policy is not currently
218 * enabled for the processor set.
219 */
220
221#define KERN_INVALID_OBJECT 29
222/* The external memory manager failed to initialize the
223 * memory object.
224 */
225
226#define KERN_ALREADY_WAITING 30
227/* A thread is attempting to wait for an event for which
228 * there is already a waiting thread.
229 */
230
231#define KERN_DEFAULT_SET 31
232/* An attempt was made to destroy the default processor
233 * set.
234 */
235
236#define KERN_EXCEPTION_PROTECTED 32
237/* An attempt was made to fetch an exception port that is
238 * protected, or to abort a thread while processing a
239 * protected exception.
240 */
241
242#define KERN_INVALID_LEDGER 33
243/* A ledger was required but not supplied.
244 */
245
246#define KERN_INVALID_MEMORY_CONTROL 34
247/* The port was not a memory cache control port.
248 */
249
250#define KERN_INVALID_SECURITY 35
251/* An argument supplied to assert security privilege
252 * was not a host security port.
253 */
254
255#define KERN_NOT_DEPRESSED 36
256/* thread_depress_abort was called on a thread which
257 * was not currently depressed.
258 */
259
260#define KERN_TERMINATED 37
261/* Object has been terminated and is no longer available
262 */
263
264#define KERN_LOCK_SET_DESTROYED 38
265/* Lock set has been destroyed and is no longer available.
266 */
267
268#define KERN_LOCK_UNSTABLE 39
269/* The thread holding the lock terminated before releasing
270 * the lock
271 */
272
273#define KERN_LOCK_OWNED 40
274/* The lock is already owned by another thread
275 */
276
277#define KERN_LOCK_OWNED_SELF 41
278/* The lock is already owned by the calling thread
279 */
280
281#define KERN_SEMAPHORE_DESTROYED 42
282/* Semaphore has been destroyed and is no longer available.
283 */
284
285#define KERN_RPC_SERVER_TERMINATED 43
286/* Return from RPC indicating the target server was
287 * terminated before it successfully replied
288 */
289
290#define KERN_RPC_TERMINATE_ORPHAN 44
291/* Terminate an orphaned activation.
292 */
293
294#define KERN_RPC_CONTINUE_ORPHAN 45
295/* Allow an orphaned activation to continue executing.
296 */
297
298#define KERN_NOT_SUPPORTED 46
299/* Empty thread activation (No thread linked to it)
300 */
301
302#define KERN_NODE_DOWN 47
303/* Remote node down or inaccessible.
304 */
305
306#define KERN_NOT_WAITING 48
307/* A signalled thread was not actually waiting. */
308
309#define KERN_OPERATION_TIMED_OUT 49
310/* Some thread-oriented operation (semaphore_wait) timed out
311 */
312
313#define KERN_CODESIGN_ERROR 50
314/* During a page fault, indicates that the page was rejected
315 * as a result of a signature check.
316 */
317
318#define KERN_POLICY_STATIC 51
319/* The requested property cannot be changed at this time.
320 */
321
322#define KERN_INSUFFICIENT_BUFFER_SIZE 52
323/* The provided buffer is of insufficient size for the requested data.
324 */
325
326#define KERN_RETURN_MAX 0x100
327/* Maximum return value allowable
328 */
329
330#endif /* _MACH_KERN_RETURN_H_ */
lib/libc/include/x86_64-macos-gnu/mach/machine.h created+395
......@@ -0,0 +1,395 @@
1/*
2 * Copyright (c) 2007-2016 Apple, Inc. All rights reserved.
3 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 *
5 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 *
7 * This file contains Original Code and/or Modifications of Original Code
8 * as defined in and that are subject to the Apple Public Source License
9 * Version 2.0 (the 'License'). You may not use this file except in
10 * compliance with the License. The rights granted to you under the License
11 * may not be used to create, or enable the creation or redistribution of,
12 * unlawful or unlicensed copies of an Apple operating system, or to
13 * circumvent, violate, or enable the circumvention or violation of, any
14 * terms of an Apple operating system software license agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 *
19 * The Original Code and all software distributed under the License are
20 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
21 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
22 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
24 * Please see the License for the specific language governing rights and
25 * limitations under the License.
26 *
27 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
28 */
29/*
30 * Mach Operating System
31 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
32 * All Rights Reserved.
33 *
34 * Permission to use, copy, modify and distribute this software and its
35 * documentation is hereby granted, provided that both the copyright
36 * notice and this permission notice appear in all copies of the
37 * software, derivative works or modified versions, and any portions
38 * thereof, and that both notices appear in supporting documentation.
39 *
40 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
41 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
42 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
43 *
44 * Carnegie Mellon requests users of this software to return to
45 *
46 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
47 * School of Computer Science
48 * Carnegie Mellon University
49 * Pittsburgh PA 15213-3890
50 *
51 * any improvements or extensions that they make and grant Carnegie Mellon
52 * the rights to redistribute these changes.
53 */
54/* File: machine.h
55 * Author: Avadis Tevanian, Jr.
56 * Date: 1986
57 *
58 * Machine independent machine abstraction.
59 */
60
61#ifndef _MACH_MACHINE_H_
62#define _MACH_MACHINE_H_
63
64#ifndef __ASSEMBLER__
65
66#include <stdint.h>
67#include <mach/machine/vm_types.h>
68#include <mach/boolean.h>
69
70typedef integer_t cpu_type_t;
71typedef integer_t cpu_subtype_t;
72typedef integer_t cpu_threadtype_t;
73
74#define CPU_STATE_MAX 4
75
76#define CPU_STATE_USER 0
77#define CPU_STATE_SYSTEM 1
78#define CPU_STATE_IDLE 2
79#define CPU_STATE_NICE 3
80
81
82
83/*
84 * Capability bits used in the definition of cpu_type.
85 */
86#define CPU_ARCH_MASK 0xff000000 /* mask for architecture bits */
87#define CPU_ARCH_ABI64 0x01000000 /* 64 bit ABI */
88#define CPU_ARCH_ABI64_32 0x02000000 /* ABI for 64-bit hardware with 32-bit types; LP32 */
89
90/*
91 * Machine types known by all.
92 */
93
94#define CPU_TYPE_ANY ((cpu_type_t) -1)
95
96#define CPU_TYPE_VAX ((cpu_type_t) 1)
97/* skip ((cpu_type_t) 2) */
98/* skip ((cpu_type_t) 3) */
99/* skip ((cpu_type_t) 4) */
100/* skip ((cpu_type_t) 5) */
101#define CPU_TYPE_MC680x0 ((cpu_type_t) 6)
102#define CPU_TYPE_X86 ((cpu_type_t) 7)
103#define CPU_TYPE_I386 CPU_TYPE_X86 /* compatibility */
104#define CPU_TYPE_X86_64 (CPU_TYPE_X86 | CPU_ARCH_ABI64)
105
106/* skip CPU_TYPE_MIPS ((cpu_type_t) 8) */
107/* skip ((cpu_type_t) 9) */
108#define CPU_TYPE_MC98000 ((cpu_type_t) 10)
109#define CPU_TYPE_HPPA ((cpu_type_t) 11)
110#define CPU_TYPE_ARM ((cpu_type_t) 12)
111#define CPU_TYPE_ARM64 (CPU_TYPE_ARM | CPU_ARCH_ABI64)
112#define CPU_TYPE_ARM64_32 (CPU_TYPE_ARM | CPU_ARCH_ABI64_32)
113#define CPU_TYPE_MC88000 ((cpu_type_t) 13)
114#define CPU_TYPE_SPARC ((cpu_type_t) 14)
115#define CPU_TYPE_I860 ((cpu_type_t) 15)
116/* skip CPU_TYPE_ALPHA ((cpu_type_t) 16) */
117/* skip ((cpu_type_t) 17) */
118#define CPU_TYPE_POWERPC ((cpu_type_t) 18)
119#define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | CPU_ARCH_ABI64)
120/* skip ((cpu_type_t) 19) */
121
122/*
123 * Machine subtypes (these are defined here, instead of in a machine
124 * dependent directory, so that any program can get all definitions
125 * regardless of where is it compiled).
126 */
127
128/*
129 * Capability bits used in the definition of cpu_subtype.
130 */
131#define CPU_SUBTYPE_MASK 0xff000000 /* mask for feature flags */
132#define CPU_SUBTYPE_LIB64 0x80000000 /* 64 bit libraries */
133
134
135/*
136 * Object files that are hand-crafted to run on any
137 * implementation of an architecture are tagged with
138 * CPU_SUBTYPE_MULTIPLE. This functions essentially the same as
139 * the "ALL" subtype of an architecture except that it allows us
140 * to easily find object files that may need to be modified
141 * whenever a new implementation of an architecture comes out.
142 *
143 * It is the responsibility of the implementor to make sure the
144 * software handles unsupported implementations elegantly.
145 */
146#define CPU_SUBTYPE_MULTIPLE ((cpu_subtype_t) -1)
147#define CPU_SUBTYPE_LITTLE_ENDIAN ((cpu_subtype_t) 0)
148#define CPU_SUBTYPE_BIG_ENDIAN ((cpu_subtype_t) 1)
149
150/*
151 * Machine threadtypes.
152 * This is none - not defined - for most machine types/subtypes.
153 */
154#define CPU_THREADTYPE_NONE ((cpu_threadtype_t) 0)
155
156/*
157 * VAX subtypes (these do *not* necessary conform to the actual cpu
158 * ID assigned by DEC available via the SID register).
159 */
160
161#define CPU_SUBTYPE_VAX_ALL ((cpu_subtype_t) 0)
162#define CPU_SUBTYPE_VAX780 ((cpu_subtype_t) 1)
163#define CPU_SUBTYPE_VAX785 ((cpu_subtype_t) 2)
164#define CPU_SUBTYPE_VAX750 ((cpu_subtype_t) 3)
165#define CPU_SUBTYPE_VAX730 ((cpu_subtype_t) 4)
166#define CPU_SUBTYPE_UVAXI ((cpu_subtype_t) 5)
167#define CPU_SUBTYPE_UVAXII ((cpu_subtype_t) 6)
168#define CPU_SUBTYPE_VAX8200 ((cpu_subtype_t) 7)
169#define CPU_SUBTYPE_VAX8500 ((cpu_subtype_t) 8)
170#define CPU_SUBTYPE_VAX8600 ((cpu_subtype_t) 9)
171#define CPU_SUBTYPE_VAX8650 ((cpu_subtype_t) 10)
172#define CPU_SUBTYPE_VAX8800 ((cpu_subtype_t) 11)
173#define CPU_SUBTYPE_UVAXIII ((cpu_subtype_t) 12)
174
175/*
176 * 680x0 subtypes
177 *
178 * The subtype definitions here are unusual for historical reasons.
179 * NeXT used to consider 68030 code as generic 68000 code. For
180 * backwards compatability:
181 *
182 * CPU_SUBTYPE_MC68030 symbol has been preserved for source code
183 * compatability.
184 *
185 * CPU_SUBTYPE_MC680x0_ALL has been defined to be the same
186 * subtype as CPU_SUBTYPE_MC68030 for binary comatability.
187 *
188 * CPU_SUBTYPE_MC68030_ONLY has been added to allow new object
189 * files to be tagged as containing 68030-specific instructions.
190 */
191
192#define CPU_SUBTYPE_MC680x0_ALL ((cpu_subtype_t) 1)
193#define CPU_SUBTYPE_MC68030 ((cpu_subtype_t) 1) /* compat */
194#define CPU_SUBTYPE_MC68040 ((cpu_subtype_t) 2)
195#define CPU_SUBTYPE_MC68030_ONLY ((cpu_subtype_t) 3)
196
197/*
198 * I386 subtypes
199 */
200
201#define CPU_SUBTYPE_INTEL(f, m) ((cpu_subtype_t) (f) + ((m) << 4))
202
203#define CPU_SUBTYPE_I386_ALL CPU_SUBTYPE_INTEL(3, 0)
204#define CPU_SUBTYPE_386 CPU_SUBTYPE_INTEL(3, 0)
205#define CPU_SUBTYPE_486 CPU_SUBTYPE_INTEL(4, 0)
206#define CPU_SUBTYPE_486SX CPU_SUBTYPE_INTEL(4, 8) // 8 << 4 = 128
207#define CPU_SUBTYPE_586 CPU_SUBTYPE_INTEL(5, 0)
208#define CPU_SUBTYPE_PENT CPU_SUBTYPE_INTEL(5, 0)
209#define CPU_SUBTYPE_PENTPRO CPU_SUBTYPE_INTEL(6, 1)
210#define CPU_SUBTYPE_PENTII_M3 CPU_SUBTYPE_INTEL(6, 3)
211#define CPU_SUBTYPE_PENTII_M5 CPU_SUBTYPE_INTEL(6, 5)
212#define CPU_SUBTYPE_CELERON CPU_SUBTYPE_INTEL(7, 6)
213#define CPU_SUBTYPE_CELERON_MOBILE CPU_SUBTYPE_INTEL(7, 7)
214#define CPU_SUBTYPE_PENTIUM_3 CPU_SUBTYPE_INTEL(8, 0)
215#define CPU_SUBTYPE_PENTIUM_3_M CPU_SUBTYPE_INTEL(8, 1)
216#define CPU_SUBTYPE_PENTIUM_3_XEON CPU_SUBTYPE_INTEL(8, 2)
217#define CPU_SUBTYPE_PENTIUM_M CPU_SUBTYPE_INTEL(9, 0)
218#define CPU_SUBTYPE_PENTIUM_4 CPU_SUBTYPE_INTEL(10, 0)
219#define CPU_SUBTYPE_PENTIUM_4_M CPU_SUBTYPE_INTEL(10, 1)
220#define CPU_SUBTYPE_ITANIUM CPU_SUBTYPE_INTEL(11, 0)
221#define CPU_SUBTYPE_ITANIUM_2 CPU_SUBTYPE_INTEL(11, 1)
222#define CPU_SUBTYPE_XEON CPU_SUBTYPE_INTEL(12, 0)
223#define CPU_SUBTYPE_XEON_MP CPU_SUBTYPE_INTEL(12, 1)
224
225#define CPU_SUBTYPE_INTEL_FAMILY(x) ((x) & 15)
226#define CPU_SUBTYPE_INTEL_FAMILY_MAX 15
227
228#define CPU_SUBTYPE_INTEL_MODEL(x) ((x) >> 4)
229#define CPU_SUBTYPE_INTEL_MODEL_ALL 0
230
231/*
232 * X86 subtypes.
233 */
234
235#define CPU_SUBTYPE_X86_ALL ((cpu_subtype_t)3)
236#define CPU_SUBTYPE_X86_64_ALL ((cpu_subtype_t)3)
237#define CPU_SUBTYPE_X86_ARCH1 ((cpu_subtype_t)4)
238#define CPU_SUBTYPE_X86_64_H ((cpu_subtype_t)8) /* Haswell feature subset */
239
240
241#define CPU_THREADTYPE_INTEL_HTT ((cpu_threadtype_t) 1)
242
243/*
244 * Mips subtypes.
245 */
246
247#define CPU_SUBTYPE_MIPS_ALL ((cpu_subtype_t) 0)
248#define CPU_SUBTYPE_MIPS_R2300 ((cpu_subtype_t) 1)
249#define CPU_SUBTYPE_MIPS_R2600 ((cpu_subtype_t) 2)
250#define CPU_SUBTYPE_MIPS_R2800 ((cpu_subtype_t) 3)
251#define CPU_SUBTYPE_MIPS_R2000a ((cpu_subtype_t) 4) /* pmax */
252#define CPU_SUBTYPE_MIPS_R2000 ((cpu_subtype_t) 5)
253#define CPU_SUBTYPE_MIPS_R3000a ((cpu_subtype_t) 6) /* 3max */
254#define CPU_SUBTYPE_MIPS_R3000 ((cpu_subtype_t) 7)
255
256/*
257 * MC98000 (PowerPC) subtypes
258 */
259#define CPU_SUBTYPE_MC98000_ALL ((cpu_subtype_t) 0)
260#define CPU_SUBTYPE_MC98601 ((cpu_subtype_t) 1)
261
262/*
263 * HPPA subtypes for Hewlett-Packard HP-PA family of
264 * risc processors. Port by NeXT to 700 series.
265 */
266
267#define CPU_SUBTYPE_HPPA_ALL ((cpu_subtype_t) 0)
268#define CPU_SUBTYPE_HPPA_7100 ((cpu_subtype_t) 0) /* compat */
269#define CPU_SUBTYPE_HPPA_7100LC ((cpu_subtype_t) 1)
270
271/*
272 * MC88000 subtypes.
273 */
274#define CPU_SUBTYPE_MC88000_ALL ((cpu_subtype_t) 0)
275#define CPU_SUBTYPE_MC88100 ((cpu_subtype_t) 1)
276#define CPU_SUBTYPE_MC88110 ((cpu_subtype_t) 2)
277
278/*
279 * SPARC subtypes
280 */
281#define CPU_SUBTYPE_SPARC_ALL ((cpu_subtype_t) 0)
282
283/*
284 * I860 subtypes
285 */
286#define CPU_SUBTYPE_I860_ALL ((cpu_subtype_t) 0)
287#define CPU_SUBTYPE_I860_860 ((cpu_subtype_t) 1)
288
289/*
290 * PowerPC subtypes
291 */
292#define CPU_SUBTYPE_POWERPC_ALL ((cpu_subtype_t) 0)
293#define CPU_SUBTYPE_POWERPC_601 ((cpu_subtype_t) 1)
294#define CPU_SUBTYPE_POWERPC_602 ((cpu_subtype_t) 2)
295#define CPU_SUBTYPE_POWERPC_603 ((cpu_subtype_t) 3)
296#define CPU_SUBTYPE_POWERPC_603e ((cpu_subtype_t) 4)
297#define CPU_SUBTYPE_POWERPC_603ev ((cpu_subtype_t) 5)
298#define CPU_SUBTYPE_POWERPC_604 ((cpu_subtype_t) 6)
299#define CPU_SUBTYPE_POWERPC_604e ((cpu_subtype_t) 7)
300#define CPU_SUBTYPE_POWERPC_620 ((cpu_subtype_t) 8)
301#define CPU_SUBTYPE_POWERPC_750 ((cpu_subtype_t) 9)
302#define CPU_SUBTYPE_POWERPC_7400 ((cpu_subtype_t) 10)
303#define CPU_SUBTYPE_POWERPC_7450 ((cpu_subtype_t) 11)
304#define CPU_SUBTYPE_POWERPC_970 ((cpu_subtype_t) 100)
305
306/*
307 * ARM subtypes
308 */
309#define CPU_SUBTYPE_ARM_ALL ((cpu_subtype_t) 0)
310#define CPU_SUBTYPE_ARM_V4T ((cpu_subtype_t) 5)
311#define CPU_SUBTYPE_ARM_V6 ((cpu_subtype_t) 6)
312#define CPU_SUBTYPE_ARM_V5TEJ ((cpu_subtype_t) 7)
313#define CPU_SUBTYPE_ARM_XSCALE ((cpu_subtype_t) 8)
314#define CPU_SUBTYPE_ARM_V7 ((cpu_subtype_t) 9) /* ARMv7-A and ARMv7-R */
315#define CPU_SUBTYPE_ARM_V7F ((cpu_subtype_t) 10) /* Cortex A9 */
316#define CPU_SUBTYPE_ARM_V7S ((cpu_subtype_t) 11) /* Swift */
317#define CPU_SUBTYPE_ARM_V7K ((cpu_subtype_t) 12)
318#define CPU_SUBTYPE_ARM_V8 ((cpu_subtype_t) 13)
319#define CPU_SUBTYPE_ARM_V6M ((cpu_subtype_t) 14) /* Not meant to be run under xnu */
320#define CPU_SUBTYPE_ARM_V7M ((cpu_subtype_t) 15) /* Not meant to be run under xnu */
321#define CPU_SUBTYPE_ARM_V7EM ((cpu_subtype_t) 16) /* Not meant to be run under xnu */
322#define CPU_SUBTYPE_ARM_V8M ((cpu_subtype_t) 17) /* Not meant to be run under xnu */
323
324/*
325 * ARM64 subtypes
326 */
327#define CPU_SUBTYPE_ARM64_ALL ((cpu_subtype_t) 0)
328#define CPU_SUBTYPE_ARM64_V8 ((cpu_subtype_t) 1)
329#define CPU_SUBTYPE_ARM64E ((cpu_subtype_t) 2)
330
331/* CPU subtype feature flags for ptrauth on arm64e platforms */
332#define CPU_SUBTYPE_ARM64_PTR_AUTH_MASK 0x0f000000
333#define CPU_SUBTYPE_ARM64_PTR_AUTH_VERSION(x) (((x) & CPU_SUBTYPE_ARM64_PTR_AUTH_MASK) >> 24)
334
335/*
336 * ARM64_32 subtypes
337 */
338#define CPU_SUBTYPE_ARM64_32_ALL ((cpu_subtype_t) 0)
339#define CPU_SUBTYPE_ARM64_32_V8 ((cpu_subtype_t) 1)
340
341#endif /* !__ASSEMBLER__ */
342
343/*
344 * CPU families (sysctl hw.cpufamily)
345 *
346 * These are meant to identify the CPU's marketing name - an
347 * application can map these to (possibly) localized strings.
348 * NB: the encodings of the CPU families are intentionally arbitrary.
349 * There is no ordering, and you should never try to deduce whether
350 * or not some feature is available based on the family.
351 * Use feature flags (eg, hw.optional.altivec) to test for optional
352 * functionality.
353 */
354#define CPUFAMILY_UNKNOWN 0
355#define CPUFAMILY_POWERPC_G3 0xcee41549
356#define CPUFAMILY_POWERPC_G4 0x77c184ae
357#define CPUFAMILY_POWERPC_G5 0xed76d8aa
358#define CPUFAMILY_INTEL_6_13 0xaa33392b
359#define CPUFAMILY_INTEL_PENRYN 0x78ea4fbc
360#define CPUFAMILY_INTEL_NEHALEM 0x6b5a4cd2
361#define CPUFAMILY_INTEL_WESTMERE 0x573b5eec
362#define CPUFAMILY_INTEL_SANDYBRIDGE 0x5490b78c
363#define CPUFAMILY_INTEL_IVYBRIDGE 0x1f65e835
364#define CPUFAMILY_INTEL_HASWELL 0x10b282dc
365#define CPUFAMILY_INTEL_BROADWELL 0x582ed09c
366#define CPUFAMILY_INTEL_SKYLAKE 0x37fc219f
367#define CPUFAMILY_INTEL_KABYLAKE 0x0f817246
368#if !defined(RC_HIDE_XNU_ICELAKE)
369#define CPUFAMILY_INTEL_ICELAKE 0x38435547
370#endif /* not RC_HIDE_XNU_ICELAKE */
371#if !defined(RC_HIDE_XNU_COMETLAKE)
372#define CPUFAMILY_INTEL_COMETLAKE 0x1cf8a03e
373#endif /* not RC_HIDE_XNU_COMETLAKE */
374#define CPUFAMILY_ARM_9 0xe73283ae
375#define CPUFAMILY_ARM_11 0x8ff620d8
376#define CPUFAMILY_ARM_XSCALE 0x53b005f5
377#define CPUFAMILY_ARM_12 0xbd1b0ae9
378#define CPUFAMILY_ARM_13 0x0cc90e64
379#define CPUFAMILY_ARM_14 0x96077ef1
380#define CPUFAMILY_ARM_15 0xa8511bca
381#define CPUFAMILY_ARM_SWIFT 0x1e2d6381
382#define CPUFAMILY_ARM_CYCLONE 0x37a09642
383#define CPUFAMILY_ARM_TYPHOON 0x2c91a47e
384#define CPUFAMILY_ARM_TWISTER 0x92fb37c8
385#define CPUFAMILY_ARM_HURRICANE 0x67ceee93
386#define CPUFAMILY_ARM_MONSOON_MISTRAL 0xe81e7ef6
387#define CPUFAMILY_ARM_VORTEX_TEMPEST 0x07d34b9f
388#define CPUFAMILY_ARM_LIGHTNING_THUNDER 0x462504d2
389
390/* The following synonyms are deprecated: */
391#define CPUFAMILY_INTEL_6_23 CPUFAMILY_INTEL_PENRYN
392#define CPUFAMILY_INTEL_6_26 CPUFAMILY_INTEL_NEHALEM
393
394
395#endif /* _MACH_MACHINE_H_ */
lib/libc/include/x86_64-macos-gnu/mach/machine/boolean.h created+38
......@@ -0,0 +1,38 @@
1/*
2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#ifndef _MACH_MACHINE_BOOLEAN_H_
30#define _MACH_MACHINE_BOOLEAN_H_
31
32#if defined (__i386__) || defined(__x86_64__)
33#include "mach/i386/boolean.h"
34#else
35#error architecture not supported
36#endif
37
38#endif /* _MACH_MACHINE_BOOLEAN_H_ */
lib/libc/include/x86_64-macos-gnu/mach/machine/exception.h created+38
......@@ -0,0 +1,38 @@
1/*
2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#ifndef _MACH_MACHINE_EXCEPTION_H_
30#define _MACH_MACHINE_EXCEPTION_H_
31
32#if defined (__i386__) || defined(__x86_64__)
33#include "mach/i386/exception.h"
34#else
35#error architecture not supported
36#endif
37
38#endif /* _MACH_MACHINE_EXCEPTION_H_ */
lib/libc/include/x86_64-macos-gnu/mach/machine/kern_return.h created+38
......@@ -0,0 +1,38 @@
1/*
2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#ifndef _MACH_MACHINE_KERN_RETURN_H_
30#define _MACH_MACHINE_KERN_RETURN_H_
31
32#if defined (__i386__) || defined(__x86_64__)
33#include "mach/i386/kern_return.h"
34#else
35#error architecture not supported
36#endif
37
38#endif /* _MACH_MACHINE_KERN_RETURN_H_ */
lib/libc/include/x86_64-macos-gnu/mach/machine/thread_state.h created+38
......@@ -0,0 +1,38 @@
1/*
2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#ifndef _MACH_MACHINE_THREAD_STATE_H_
30#define _MACH_MACHINE_THREAD_STATE_H_
31
32#if defined (__i386__) || defined(__x86_64__)
33#include "mach/i386/thread_state.h"
34#else
35#error architecture not supported
36#endif
37
38#endif /* _MACH_MACHINE_THREAD_STATE_H_ */
lib/libc/include/x86_64-macos-gnu/mach/machine/thread_status.h created+38
......@@ -0,0 +1,38 @@
1/*
2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#ifndef _MACH_MACHINE_THREAD_STATUS_H_
30#define _MACH_MACHINE_THREAD_STATUS_H_
31
32#if defined (__i386__) || defined(__x86_64__)
33#include "mach/i386/thread_status.h"
34#else
35#error architecture not supported
36#endif
37
38#endif /* _MACH_MACHINE_THREAD_STATUS_H_ */
lib/libc/include/x86_64-macos-gnu/mach/machine/vm_types.h created+38
......@@ -0,0 +1,38 @@
1/*
2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#ifndef _MACH_MACHINE_VM_TYPES_H_
30#define _MACH_MACHINE_VM_TYPES_H_
31
32#if defined (__i386__) || defined(__x86_64__)
33#include "mach/i386/vm_types.h"
34#else
35#error architecture not supported
36#endif
37
38#endif /* _MACH_MACHINE_VM_TYPES_H_ */
lib/libc/include/x86_64-macos-gnu/mach/message.h created+902
......@@ -0,0 +1,902 @@
1/*
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 * NOTICE: This file was modified by McAfee Research in 2004 to introduce
58 * support for mandatory and extensible security protections. This notice
59 * is included in support of clause 2.2 (b) of the Apple Public License,
60 * Version 2.0.
61 * Copyright (c) 2005 SPARTA, Inc.
62 */
63/*
64 */
65/*
66 * File: mach/message.h
67 *
68 * Mach IPC message and primitive function definitions.
69 */
70
71#ifndef _MACH_MESSAGE_H_
72#define _MACH_MESSAGE_H_
73
74#include <stdint.h>
75#include <mach/port.h>
76#include <mach/boolean.h>
77#include <mach/kern_return.h>
78#include <mach/machine/vm_types.h>
79
80#include <sys/cdefs.h>
81#include <sys/appleapiopts.h>
82#include <Availability.h>
83
84/*
85 * The timeout mechanism uses mach_msg_timeout_t values,
86 * passed by value. The timeout units are milliseconds.
87 * It is controlled with the MACH_SEND_TIMEOUT
88 * and MACH_RCV_TIMEOUT options.
89 */
90
91typedef natural_t mach_msg_timeout_t;
92
93/*
94 * The value to be used when there is no timeout.
95 * (No MACH_SEND_TIMEOUT/MACH_RCV_TIMEOUT option.)
96 */
97
98#define MACH_MSG_TIMEOUT_NONE ((mach_msg_timeout_t) 0)
99
100/*
101 * The kernel uses MACH_MSGH_BITS_COMPLEX as a hint. If it isn't on, it
102 * assumes the body of the message doesn't contain port rights or OOL
103 * data. The field is set in received messages. A user task must
104 * use caution in interpreting the body of a message if the bit isn't
105 * on, because the mach_msg_type's in the body might "lie" about the
106 * contents. If the bit isn't on, but the mach_msg_types
107 * in the body specify rights or OOL data, the behavior is undefined.
108 * (Ie, an error may or may not be produced.)
109 *
110 * The value of MACH_MSGH_BITS_REMOTE determines the interpretation
111 * of the msgh_remote_port field. It is handled like a msgt_name,
112 * but must result in a send or send-once type right.
113 *
114 * The value of MACH_MSGH_BITS_LOCAL determines the interpretation
115 * of the msgh_local_port field. It is handled like a msgt_name,
116 * and also must result in a send or send-once type right.
117 *
118 * The value of MACH_MSGH_BITS_VOUCHER determines the interpretation
119 * of the msgh_voucher_port field. It is handled like a msgt_name,
120 * but must result in a send right (and the msgh_voucher_port field
121 * must be the name of a send right to a Mach voucher kernel object.
122 *
123 * MACH_MSGH_BITS() combines two MACH_MSG_TYPE_* values, for the remote
124 * and local fields, into a single value suitable for msgh_bits.
125 *
126 * MACH_MSGH_BITS_CIRCULAR should be zero; is is used internally.
127 *
128 * The unused bits should be zero and are reserved for the kernel
129 * or for future interface expansion.
130 */
131
132#define MACH_MSGH_BITS_ZERO 0x00000000
133
134#define MACH_MSGH_BITS_REMOTE_MASK 0x0000001f
135#define MACH_MSGH_BITS_LOCAL_MASK 0x00001f00
136#define MACH_MSGH_BITS_VOUCHER_MASK 0x001f0000
137
138#define MACH_MSGH_BITS_PORTS_MASK \
139 (MACH_MSGH_BITS_REMOTE_MASK | \
140 MACH_MSGH_BITS_LOCAL_MASK | \
141 MACH_MSGH_BITS_VOUCHER_MASK)
142
143#define MACH_MSGH_BITS_COMPLEX 0x80000000U /* message is complex */
144
145#define MACH_MSGH_BITS_USER 0x801f1f1fU /* allowed bits user->kernel */
146
147#define MACH_MSGH_BITS_RAISEIMP 0x20000000U /* importance raised due to msg */
148#define MACH_MSGH_BITS_DENAP MACH_MSGH_BITS_RAISEIMP
149
150#define MACH_MSGH_BITS_IMPHOLDASRT 0x10000000U /* assertion help, userland private */
151#define MACH_MSGH_BITS_DENAPHOLDASRT MACH_MSGH_BITS_IMPHOLDASRT
152
153#define MACH_MSGH_BITS_CIRCULAR 0x10000000U /* message circular, kernel private */
154
155#define MACH_MSGH_BITS_USED 0xb01f1f1fU
156
157/* setter macros for the bits */
158#define MACH_MSGH_BITS(remote, local) /* legacy */ \
159 ((remote) | ((local) << 8))
160#define MACH_MSGH_BITS_SET_PORTS(remote, local, voucher) \
161 (((remote) & MACH_MSGH_BITS_REMOTE_MASK) | \
162 (((local) << 8) & MACH_MSGH_BITS_LOCAL_MASK) | \
163 (((voucher) << 16) & MACH_MSGH_BITS_VOUCHER_MASK))
164#define MACH_MSGH_BITS_SET(remote, local, voucher, other) \
165 (MACH_MSGH_BITS_SET_PORTS((remote), (local), (voucher)) \
166 | ((other) &~ MACH_MSGH_BITS_PORTS_MASK))
167
168/* getter macros for pulling values out of the bits field */
169#define MACH_MSGH_BITS_REMOTE(bits) \
170 ((bits) & MACH_MSGH_BITS_REMOTE_MASK)
171#define MACH_MSGH_BITS_LOCAL(bits) \
172 (((bits) & MACH_MSGH_BITS_LOCAL_MASK) >> 8)
173#define MACH_MSGH_BITS_VOUCHER(bits) \
174 (((bits) & MACH_MSGH_BITS_VOUCHER_MASK) >> 16)
175#define MACH_MSGH_BITS_PORTS(bits) \
176 ((bits) & MACH_MSGH_BITS_PORTS_MASK)
177#define MACH_MSGH_BITS_OTHER(bits) \
178 ((bits) &~ MACH_MSGH_BITS_PORTS_MASK)
179
180/* checking macros */
181#define MACH_MSGH_BITS_HAS_REMOTE(bits) \
182 (MACH_MSGH_BITS_REMOTE(bits) != MACH_MSGH_BITS_ZERO)
183#define MACH_MSGH_BITS_HAS_LOCAL(bits) \
184 (MACH_MSGH_BITS_LOCAL(bits) != MACH_MSGH_BITS_ZERO)
185#define MACH_MSGH_BITS_HAS_VOUCHER(bits) \
186 (MACH_MSGH_BITS_VOUCHER(bits) != MACH_MSGH_BITS_ZERO)
187#define MACH_MSGH_BITS_IS_COMPLEX(bits) \
188 (((bits) & MACH_MSGH_BITS_COMPLEX) != MACH_MSGH_BITS_ZERO)
189
190/* importance checking macros */
191#define MACH_MSGH_BITS_RAISED_IMPORTANCE(bits) \
192 (((bits) & MACH_MSGH_BITS_RAISEIMP) != MACH_MSGH_BITS_ZERO)
193#define MACH_MSGH_BITS_HOLDS_IMPORTANCE_ASSERTION(bits) \
194 (((bits) & MACH_MSGH_BITS_IMPHOLDASRT) != MACH_MSGH_BITS_ZERO)
195
196/*
197 * Every message starts with a message header.
198 * Following the message header, if the message is complex, are a count
199 * of type descriptors and the type descriptors themselves
200 * (mach_msg_descriptor_t). The size of the message must be specified in
201 * bytes, and includes the message header, descriptor count, descriptors,
202 * and inline data.
203 *
204 * The msgh_remote_port field specifies the destination of the message.
205 * It must specify a valid send or send-once right for a port.
206 *
207 * The msgh_local_port field specifies a "reply port". Normally,
208 * This field carries a send-once right that the receiver will use
209 * to reply to the message. It may carry the values MACH_PORT_NULL,
210 * MACH_PORT_DEAD, a send-once right, or a send right.
211 *
212 * The msgh_voucher_port field specifies a Mach voucher port. Only
213 * send rights to kernel-implemented Mach Voucher kernel objects in
214 * addition to MACH_PORT_NULL or MACH_PORT_DEAD may be passed.
215 *
216 * The msgh_id field is uninterpreted by the message primitives.
217 * It normally carries information specifying the format
218 * or meaning of the message.
219 */
220
221typedef unsigned int mach_msg_bits_t;
222typedef natural_t mach_msg_size_t;
223typedef integer_t mach_msg_id_t;
224
225#define MACH_MSG_SIZE_NULL (mach_msg_size_t *) 0
226
227typedef unsigned int mach_msg_priority_t;
228
229#define MACH_MSG_PRIORITY_UNSPECIFIED (mach_msg_priority_t) 0
230
231typedef unsigned int mach_msg_type_name_t;
232
233#define MACH_MSG_TYPE_MOVE_RECEIVE 16 /* Must hold receive right */
234#define MACH_MSG_TYPE_MOVE_SEND 17 /* Must hold send right(s) */
235#define MACH_MSG_TYPE_MOVE_SEND_ONCE 18 /* Must hold sendonce right */
236#define MACH_MSG_TYPE_COPY_SEND 19 /* Must hold send right(s) */
237#define MACH_MSG_TYPE_MAKE_SEND 20 /* Must hold receive right */
238#define MACH_MSG_TYPE_MAKE_SEND_ONCE 21 /* Must hold receive right */
239#define MACH_MSG_TYPE_COPY_RECEIVE 22 /* NOT VALID */
240#define MACH_MSG_TYPE_DISPOSE_RECEIVE 24 /* must hold receive right */
241#define MACH_MSG_TYPE_DISPOSE_SEND 25 /* must hold send right(s) */
242#define MACH_MSG_TYPE_DISPOSE_SEND_ONCE 26 /* must hold sendonce right */
243
244typedef unsigned int mach_msg_copy_options_t;
245
246#define MACH_MSG_PHYSICAL_COPY 0
247#define MACH_MSG_VIRTUAL_COPY 1
248#define MACH_MSG_ALLOCATE 2
249#define MACH_MSG_OVERWRITE 3 /* deprecated */
250#ifdef MACH_KERNEL
251#define MACH_MSG_KALLOC_COPY_T 4
252#endif /* MACH_KERNEL */
253
254#define MACH_MSG_GUARD_FLAGS_NONE 0x0000
255#define MACH_MSG_GUARD_FLAGS_IMMOVABLE_RECEIVE 0x0001 /* Move the receive right and mark it as immovable */
256#define MACH_MSG_GUARD_FLAGS_UNGUARDED_ON_SEND 0x0002 /* Verify that the port is unguarded */
257#define MACH_MSG_GUARD_FLAGS_MASK 0x0003 /* Valid flag bits */
258typedef unsigned int mach_msg_guard_flags_t;
259
260/*
261 * In a complex mach message, the mach_msg_header_t is followed by
262 * a descriptor count, then an array of that number of descriptors
263 * (mach_msg_*_descriptor_t). The type field of mach_msg_type_descriptor_t
264 * (which any descriptor can be cast to) indicates the flavor of the
265 * descriptor.
266 *
267 * Note that in LP64, the various types of descriptors are no longer all
268 * the same size as mach_msg_descriptor_t, so the array cannot be indexed
269 * as expected.
270 */
271
272typedef unsigned int mach_msg_descriptor_type_t;
273
274#define MACH_MSG_PORT_DESCRIPTOR 0
275#define MACH_MSG_OOL_DESCRIPTOR 1
276#define MACH_MSG_OOL_PORTS_DESCRIPTOR 2
277#define MACH_MSG_OOL_VOLATILE_DESCRIPTOR 3
278#define MACH_MSG_GUARDED_PORT_DESCRIPTOR 4
279
280#pragma pack(push, 4)
281
282typedef struct{
283 natural_t pad1;
284 mach_msg_size_t pad2;
285 unsigned int pad3 : 24;
286 mach_msg_descriptor_type_t type : 8;
287} mach_msg_type_descriptor_t;
288
289typedef struct{
290 mach_port_t name;
291// Pad to 8 bytes everywhere except the K64 kernel where mach_port_t is 8 bytes
292 mach_msg_size_t pad1;
293 unsigned int pad2 : 16;
294 mach_msg_type_name_t disposition : 8;
295 mach_msg_descriptor_type_t type : 8;
296} mach_msg_port_descriptor_t;
297
298typedef struct{
299 uint32_t address;
300 mach_msg_size_t size;
301 boolean_t deallocate: 8;
302 mach_msg_copy_options_t copy: 8;
303 unsigned int pad1: 8;
304 mach_msg_descriptor_type_t type: 8;
305} mach_msg_ool_descriptor32_t;
306
307typedef struct{
308 uint64_t address;
309 boolean_t deallocate: 8;
310 mach_msg_copy_options_t copy: 8;
311 unsigned int pad1: 8;
312 mach_msg_descriptor_type_t type: 8;
313 mach_msg_size_t size;
314} mach_msg_ool_descriptor64_t;
315
316typedef struct{
317 void* address;
318#if !defined(__LP64__)
319 mach_msg_size_t size;
320#endif
321 boolean_t deallocate: 8;
322 mach_msg_copy_options_t copy: 8;
323 unsigned int pad1: 8;
324 mach_msg_descriptor_type_t type: 8;
325#if defined(__LP64__)
326 mach_msg_size_t size;
327#endif
328} mach_msg_ool_descriptor_t;
329
330typedef struct{
331 uint32_t address;
332 mach_msg_size_t count;
333 boolean_t deallocate: 8;
334 mach_msg_copy_options_t copy: 8;
335 mach_msg_type_name_t disposition : 8;
336 mach_msg_descriptor_type_t type : 8;
337} mach_msg_ool_ports_descriptor32_t;
338
339typedef struct{
340 uint64_t address;
341 boolean_t deallocate: 8;
342 mach_msg_copy_options_t copy: 8;
343 mach_msg_type_name_t disposition : 8;
344 mach_msg_descriptor_type_t type : 8;
345 mach_msg_size_t count;
346} mach_msg_ool_ports_descriptor64_t;
347
348typedef struct{
349 void* address;
350#if !defined(__LP64__)
351 mach_msg_size_t count;
352#endif
353 boolean_t deallocate: 8;
354 mach_msg_copy_options_t copy: 8;
355 mach_msg_type_name_t disposition : 8;
356 mach_msg_descriptor_type_t type : 8;
357#if defined(__LP64__)
358 mach_msg_size_t count;
359#endif
360} mach_msg_ool_ports_descriptor_t;
361
362typedef struct{
363 uint32_t context;
364 mach_port_name_t name;
365 mach_msg_guard_flags_t flags : 16;
366 mach_msg_type_name_t disposition : 8;
367 mach_msg_descriptor_type_t type : 8;
368} mach_msg_guarded_port_descriptor32_t;
369
370typedef struct{
371 uint64_t context;
372 mach_msg_guard_flags_t flags : 16;
373 mach_msg_type_name_t disposition : 8;
374 mach_msg_descriptor_type_t type : 8;
375 mach_port_name_t name;
376} mach_msg_guarded_port_descriptor64_t;
377
378typedef struct{
379 mach_port_context_t context;
380#if !defined(__LP64__)
381 mach_port_name_t name;
382#endif
383 mach_msg_guard_flags_t flags : 16;
384 mach_msg_type_name_t disposition : 8;
385 mach_msg_descriptor_type_t type : 8;
386#if defined(__LP64__)
387 mach_port_name_t name;
388#endif /* defined(__LP64__) */
389} mach_msg_guarded_port_descriptor_t;
390
391/*
392 * LP64support - This union definition is not really
393 * appropriate in LP64 mode because not all descriptors
394 * are of the same size in that environment.
395 */
396typedef union{
397 mach_msg_port_descriptor_t port;
398 mach_msg_ool_descriptor_t out_of_line;
399 mach_msg_ool_ports_descriptor_t ool_ports;
400 mach_msg_type_descriptor_t type;
401 mach_msg_guarded_port_descriptor_t guarded_port;
402} mach_msg_descriptor_t;
403
404typedef struct{
405 mach_msg_size_t msgh_descriptor_count;
406} mach_msg_body_t;
407
408#define MACH_MSG_BODY_NULL (mach_msg_body_t *) 0
409#define MACH_MSG_DESCRIPTOR_NULL (mach_msg_descriptor_t *) 0
410
411typedef struct{
412 mach_msg_bits_t msgh_bits;
413 mach_msg_size_t msgh_size;
414 mach_port_t msgh_remote_port;
415 mach_port_t msgh_local_port;
416 mach_port_name_t msgh_voucher_port;
417 mach_msg_id_t msgh_id;
418} mach_msg_header_t;
419
420#define msgh_reserved msgh_voucher_port
421#define MACH_MSG_NULL (mach_msg_header_t *) 0
422
423typedef struct{
424 mach_msg_header_t header;
425 mach_msg_body_t body;
426} mach_msg_base_t;
427
428typedef unsigned int mach_msg_trailer_type_t;
429
430#define MACH_MSG_TRAILER_FORMAT_0 0
431
432typedef unsigned int mach_msg_trailer_size_t;
433typedef char *mach_msg_trailer_info_t;
434
435typedef struct{
436 mach_msg_trailer_type_t msgh_trailer_type;
437 mach_msg_trailer_size_t msgh_trailer_size;
438} mach_msg_trailer_t;
439
440/*
441 * The msgh_seqno field carries a sequence number
442 * associated with the received-from port. A port's
443 * sequence number is incremented every time a message
444 * is received from it and included in the received
445 * trailer to help put messages back in sequence if
446 * multiple threads receive and/or process received
447 * messages.
448 */
449typedef struct{
450 mach_msg_trailer_type_t msgh_trailer_type;
451 mach_msg_trailer_size_t msgh_trailer_size;
452 mach_port_seqno_t msgh_seqno;
453} mach_msg_seqno_trailer_t;
454
455typedef struct{
456 unsigned int val[2];
457} security_token_t;
458
459typedef struct{
460 mach_msg_trailer_type_t msgh_trailer_type;
461 mach_msg_trailer_size_t msgh_trailer_size;
462 mach_port_seqno_t msgh_seqno;
463 security_token_t msgh_sender;
464} mach_msg_security_trailer_t;
465
466/*
467 * The audit token is an opaque token which identifies
468 * Mach tasks and senders of Mach messages as subjects
469 * to the BSM audit system. Only the appropriate BSM
470 * library routines should be used to interpret the
471 * contents of the audit token as the representation
472 * of the subject identity within the token may change
473 * over time.
474 */
475typedef struct{
476 unsigned int val[8];
477} audit_token_t;
478
479typedef struct{
480 mach_msg_trailer_type_t msgh_trailer_type;
481 mach_msg_trailer_size_t msgh_trailer_size;
482 mach_port_seqno_t msgh_seqno;
483 security_token_t msgh_sender;
484 audit_token_t msgh_audit;
485} mach_msg_audit_trailer_t;
486
487typedef struct{
488 mach_msg_trailer_type_t msgh_trailer_type;
489 mach_msg_trailer_size_t msgh_trailer_size;
490 mach_port_seqno_t msgh_seqno;
491 security_token_t msgh_sender;
492 audit_token_t msgh_audit;
493 mach_port_context_t msgh_context;
494} mach_msg_context_trailer_t;
495
496
497
498typedef struct{
499 mach_port_name_t sender;
500} msg_labels_t;
501
502/*
503 * Trailer type to pass MAC policy label info as a mach message trailer.
504 *
505 */
506
507typedef struct{
508 mach_msg_trailer_type_t msgh_trailer_type;
509 mach_msg_trailer_size_t msgh_trailer_size;
510 mach_port_seqno_t msgh_seqno;
511 security_token_t msgh_sender;
512 audit_token_t msgh_audit;
513 mach_port_context_t msgh_context;
514 int msgh_ad;
515 msg_labels_t msgh_labels;
516} mach_msg_mac_trailer_t;
517
518
519#define MACH_MSG_TRAILER_MINIMUM_SIZE sizeof(mach_msg_trailer_t)
520
521/*
522 * These values can change from release to release - but clearly
523 * code cannot request additional trailer elements one was not
524 * compiled to understand. Therefore, it is safe to use this
525 * constant when the same module specified the receive options.
526 * Otherwise, you run the risk that the options requested by
527 * another module may exceed the local modules notion of
528 * MAX_TRAILER_SIZE.
529 */
530
531typedef mach_msg_mac_trailer_t mach_msg_max_trailer_t;
532#define MAX_TRAILER_SIZE ((mach_msg_size_t)sizeof(mach_msg_max_trailer_t))
533
534/*
535 * Legacy requirements keep us from ever updating these defines (even
536 * when the format_0 trailers gain new option data fields in the future).
537 * Therefore, they shouldn't be used going forward. Instead, the sizes
538 * should be compared against the specific element size requested using
539 * REQUESTED_TRAILER_SIZE.
540 */
541typedef mach_msg_security_trailer_t mach_msg_format_0_trailer_t;
542
543/*typedef mach_msg_mac_trailer_t mach_msg_format_0_trailer_t;
544 */
545
546#define MACH_MSG_TRAILER_FORMAT_0_SIZE sizeof(mach_msg_format_0_trailer_t)
547
548#define KERNEL_SECURITY_TOKEN_VALUE { {0, 1} }
549extern const security_token_t KERNEL_SECURITY_TOKEN;
550
551#define KERNEL_AUDIT_TOKEN_VALUE { {0, 0, 0, 0, 0, 0, 0, 0} }
552extern const audit_token_t KERNEL_AUDIT_TOKEN;
553
554typedef integer_t mach_msg_options_t;
555
556typedef struct{
557 mach_msg_header_t header;
558} mach_msg_empty_send_t;
559
560typedef struct{
561 mach_msg_header_t header;
562 mach_msg_trailer_t trailer;
563} mach_msg_empty_rcv_t;
564
565typedef union{
566 mach_msg_empty_send_t send;
567 mach_msg_empty_rcv_t rcv;
568} mach_msg_empty_t;
569
570#pragma pack(pop)
571
572/* utility to round the message size - will become machine dependent */
573#define round_msg(x) (((mach_msg_size_t)(x) + sizeof (natural_t) - 1) & \
574 ~(sizeof (natural_t) - 1))
575
576
577/*
578 * There is no fixed upper bound to the size of Mach messages.
579 */
580#define MACH_MSG_SIZE_MAX ((mach_msg_size_t) ~0)
581
582#if defined(__APPLE_API_PRIVATE)
583/*
584 * But architectural limits of a given implementation, or
585 * temporal conditions may cause unpredictable send failures
586 * for messages larger than MACH_MSG_SIZE_RELIABLE.
587 *
588 * In either case, waiting for memory is [currently] outside
589 * the scope of send timeout values provided to IPC.
590 */
591#define MACH_MSG_SIZE_RELIABLE ((mach_msg_size_t) 256 * 1024)
592#endif
593/*
594 * Compatibility definitions, for code written
595 * when there was a msgh_kind instead of msgh_seqno.
596 */
597#define MACH_MSGH_KIND_NORMAL 0x00000000
598#define MACH_MSGH_KIND_NOTIFICATION 0x00000001
599#define msgh_kind msgh_seqno
600#define mach_msg_kind_t mach_port_seqno_t
601
602typedef natural_t mach_msg_type_size_t;
603typedef natural_t mach_msg_type_number_t;
604
605/*
606 * Values received/carried in messages. Tells the receiver what
607 * sort of port right he now has.
608 *
609 * MACH_MSG_TYPE_PORT_NAME is used to transfer a port name
610 * which should remain uninterpreted by the kernel. (Port rights
611 * are not transferred, just the port name.)
612 */
613
614#define MACH_MSG_TYPE_PORT_NONE 0
615
616#define MACH_MSG_TYPE_PORT_NAME 15
617#define MACH_MSG_TYPE_PORT_RECEIVE MACH_MSG_TYPE_MOVE_RECEIVE
618#define MACH_MSG_TYPE_PORT_SEND MACH_MSG_TYPE_MOVE_SEND
619#define MACH_MSG_TYPE_PORT_SEND_ONCE MACH_MSG_TYPE_MOVE_SEND_ONCE
620
621#define MACH_MSG_TYPE_LAST 22 /* Last assigned */
622
623/*
624 * A dummy value. Mostly used to indicate that the actual value
625 * will be filled in later, dynamically.
626 */
627
628#define MACH_MSG_TYPE_POLYMORPHIC ((mach_msg_type_name_t) -1)
629
630/*
631 * Is a given item a port type?
632 */
633
634#define MACH_MSG_TYPE_PORT_ANY(x) \
635 (((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) && \
636 ((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE))
637
638#define MACH_MSG_TYPE_PORT_ANY_SEND(x) \
639 (((x) >= MACH_MSG_TYPE_MOVE_SEND) && \
640 ((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE))
641
642#define MACH_MSG_TYPE_PORT_ANY_RIGHT(x) \
643 (((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) && \
644 ((x) <= MACH_MSG_TYPE_MOVE_SEND_ONCE))
645
646typedef integer_t mach_msg_option_t;
647
648#define MACH_MSG_OPTION_NONE 0x00000000
649
650#define MACH_SEND_MSG 0x00000001
651#define MACH_RCV_MSG 0x00000002
652
653#define MACH_RCV_LARGE 0x00000004 /* report large message sizes */
654#define MACH_RCV_LARGE_IDENTITY 0x00000008 /* identify source of large messages */
655
656#define MACH_SEND_TIMEOUT 0x00000010 /* timeout value applies to send */
657#define MACH_SEND_OVERRIDE 0x00000020 /* priority override for send */
658#define MACH_SEND_INTERRUPT 0x00000040 /* don't restart interrupted sends */
659#define MACH_SEND_NOTIFY 0x00000080 /* arm send-possible notify */
660#define MACH_SEND_ALWAYS 0x00010000 /* ignore qlimits - kernel only */
661#define MACH_SEND_TRAILER 0x00020000 /* sender-provided trailer */
662#define MACH_SEND_NOIMPORTANCE 0x00040000 /* msg won't carry importance */
663#define MACH_SEND_NODENAP MACH_SEND_NOIMPORTANCE
664#define MACH_SEND_IMPORTANCE 0x00080000 /* msg carries importance - kernel only */
665#define MACH_SEND_SYNC_OVERRIDE 0x00100000 /* msg should do sync ipc override */
666#define MACH_SEND_PROPAGATE_QOS 0x00200000 /* IPC should propagate the caller's QoS */
667#define MACH_SEND_SYNC_USE_THRPRI MACH_SEND_PROPAGATE_QOS /* obsolete name */
668#define MACH_SEND_KERNEL 0x00400000 /* full send from kernel space - kernel only */
669#define MACH_SEND_SYNC_BOOTSTRAP_CHECKIN 0x00800000 /* special reply port should boost thread doing sync bootstrap checkin */
670
671#define MACH_RCV_TIMEOUT 0x00000100 /* timeout value applies to receive */
672#define MACH_RCV_NOTIFY 0x00000000 /* legacy name (value was: 0x00000200) */
673#define MACH_RCV_INTERRUPT 0x00000400 /* don't restart interrupted receive */
674#define MACH_RCV_VOUCHER 0x00000800 /* willing to receive voucher port */
675#define MACH_RCV_OVERWRITE 0x00000000 /* scatter receive (deprecated) */
676#define MACH_RCV_GUARDED_DESC 0x00001000 /* Can receive new guarded descriptor */
677#define MACH_RCV_SYNC_WAIT 0x00004000 /* sync waiter waiting for rcv */
678#define MACH_RCV_SYNC_PEEK 0x00008000 /* sync waiter waiting to peek */
679
680#define MACH_MSG_STRICT_REPLY 0x00000200 /* Enforce specific properties about the reply port, and
681 * the context in which a thread replies to a message.
682 * This flag must be passed on both the SEND and RCV */
683
684
685/*
686 * NOTE: a 0x00------ RCV mask implies to ask for
687 * a MACH_MSG_TRAILER_FORMAT_0 with 0 Elements,
688 * which is equivalent to a mach_msg_trailer_t.
689 *
690 * XXXMAC: unlike the rest of the MACH_RCV_* flags, MACH_RCV_TRAILER_LABELS
691 * needs its own private bit since we only calculate its fields when absolutely
692 * required.
693 */
694#define MACH_RCV_TRAILER_NULL 0
695#define MACH_RCV_TRAILER_SEQNO 1
696#define MACH_RCV_TRAILER_SENDER 2
697#define MACH_RCV_TRAILER_AUDIT 3
698#define MACH_RCV_TRAILER_CTX 4
699#define MACH_RCV_TRAILER_AV 7
700#define MACH_RCV_TRAILER_LABELS 8
701
702#define MACH_RCV_TRAILER_TYPE(x) (((x) & 0xf) << 28)
703#define MACH_RCV_TRAILER_ELEMENTS(x) (((x) & 0xf) << 24)
704#define MACH_RCV_TRAILER_MASK ((0xf << 24))
705
706#define GET_RCV_ELEMENTS(y) (((y) >> 24) & 0xf)
707
708
709/*
710 * XXXMAC: note that in the case of MACH_RCV_TRAILER_LABELS,
711 * we just fall through to mach_msg_max_trailer_t.
712 * This is correct behavior since mach_msg_max_trailer_t is defined as
713 * mac_msg_mac_trailer_t which is used for the LABELS trailer.
714 * It also makes things work properly if MACH_RCV_TRAILER_LABELS is ORed
715 * with one of the other options.
716 */
717
718#define REQUESTED_TRAILER_SIZE_NATIVE(y) \
719 ((mach_msg_trailer_size_t) \
720 ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_NULL) ? \
721 sizeof(mach_msg_trailer_t) : \
722 ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_SEQNO) ? \
723 sizeof(mach_msg_seqno_trailer_t) : \
724 ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_SENDER) ? \
725 sizeof(mach_msg_security_trailer_t) : \
726 ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_AUDIT) ? \
727 sizeof(mach_msg_audit_trailer_t) : \
728 ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_CTX) ? \
729 sizeof(mach_msg_context_trailer_t) : \
730 ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_AV) ? \
731 sizeof(mach_msg_mac_trailer_t) : \
732 sizeof(mach_msg_max_trailer_t))))))))
733
734
735#define REQUESTED_TRAILER_SIZE(y) REQUESTED_TRAILER_SIZE_NATIVE(y)
736
737/*
738 * Much code assumes that mach_msg_return_t == kern_return_t.
739 * This definition is useful for descriptive purposes.
740 *
741 * See <mach/error.h> for the format of error codes.
742 * IPC errors are system 4. Send errors are subsystem 0;
743 * receive errors are subsystem 1. The code field is always non-zero.
744 * The high bits of the code field communicate extra information
745 * for some error codes. MACH_MSG_MASK masks off these special bits.
746 */
747
748typedef kern_return_t mach_msg_return_t;
749
750#define MACH_MSG_SUCCESS 0x00000000
751
752
753#define MACH_MSG_MASK 0x00003e00
754/* All special error code bits defined below. */
755#define MACH_MSG_IPC_SPACE 0x00002000
756/* No room in IPC name space for another capability name. */
757#define MACH_MSG_VM_SPACE 0x00001000
758/* No room in VM address space for out-of-line memory. */
759#define MACH_MSG_IPC_KERNEL 0x00000800
760/* Kernel resource shortage handling an IPC capability. */
761#define MACH_MSG_VM_KERNEL 0x00000400
762/* Kernel resource shortage handling out-of-line memory. */
763
764#define MACH_SEND_IN_PROGRESS 0x10000001
765/* Thread is waiting to send. (Internal use only.) */
766#define MACH_SEND_INVALID_DATA 0x10000002
767/* Bogus in-line data. */
768#define MACH_SEND_INVALID_DEST 0x10000003
769/* Bogus destination port. */
770#define MACH_SEND_TIMED_OUT 0x10000004
771/* Message not sent before timeout expired. */
772#define MACH_SEND_INVALID_VOUCHER 0x10000005
773/* Bogus voucher port. */
774#define MACH_SEND_INTERRUPTED 0x10000007
775/* Software interrupt. */
776#define MACH_SEND_MSG_TOO_SMALL 0x10000008
777/* Data doesn't contain a complete message. */
778#define MACH_SEND_INVALID_REPLY 0x10000009
779/* Bogus reply port. */
780#define MACH_SEND_INVALID_RIGHT 0x1000000a
781/* Bogus port rights in the message body. */
782#define MACH_SEND_INVALID_NOTIFY 0x1000000b
783/* Bogus notify port argument. */
784#define MACH_SEND_INVALID_MEMORY 0x1000000c
785/* Invalid out-of-line memory pointer. */
786#define MACH_SEND_NO_BUFFER 0x1000000d
787/* No message buffer is available. */
788#define MACH_SEND_TOO_LARGE 0x1000000e
789/* Send is too large for port */
790#define MACH_SEND_INVALID_TYPE 0x1000000f
791/* Invalid msg-type specification. */
792#define MACH_SEND_INVALID_HEADER 0x10000010
793/* A field in the header had a bad value. */
794#define MACH_SEND_INVALID_TRAILER 0x10000011
795/* The trailer to be sent does not match kernel format. */
796#define MACH_SEND_INVALID_CONTEXT 0x10000012
797/* The sending thread context did not match the context on the dest port */
798#define MACH_SEND_INVALID_RT_OOL_SIZE 0x10000015
799/* compatibility: no longer a returned error */
800#define MACH_SEND_NO_GRANT_DEST 0x10000016
801/* The destination port doesn't accept ports in body */
802
803#define MACH_RCV_IN_PROGRESS 0x10004001
804/* Thread is waiting for receive. (Internal use only.) */
805#define MACH_RCV_INVALID_NAME 0x10004002
806/* Bogus name for receive port/port-set. */
807#define MACH_RCV_TIMED_OUT 0x10004003
808/* Didn't get a message within the timeout value. */
809#define MACH_RCV_TOO_LARGE 0x10004004
810/* Message buffer is not large enough for inline data. */
811#define MACH_RCV_INTERRUPTED 0x10004005
812/* Software interrupt. */
813#define MACH_RCV_PORT_CHANGED 0x10004006
814/* compatibility: no longer a returned error */
815#define MACH_RCV_INVALID_NOTIFY 0x10004007
816/* Bogus notify port argument. */
817#define MACH_RCV_INVALID_DATA 0x10004008
818/* Bogus message buffer for inline data. */
819#define MACH_RCV_PORT_DIED 0x10004009
820/* Port/set was sent away/died during receive. */
821#define MACH_RCV_IN_SET 0x1000400a
822/* compatibility: no longer a returned error */
823#define MACH_RCV_HEADER_ERROR 0x1000400b
824/* Error receiving message header. See special bits. */
825#define MACH_RCV_BODY_ERROR 0x1000400c
826/* Error receiving message body. See special bits. */
827#define MACH_RCV_INVALID_TYPE 0x1000400d
828/* Invalid msg-type specification in scatter list. */
829#define MACH_RCV_SCATTER_SMALL 0x1000400e
830/* Out-of-line overwrite region is not large enough */
831#define MACH_RCV_INVALID_TRAILER 0x1000400f
832/* trailer type or number of trailer elements not supported */
833#define MACH_RCV_IN_PROGRESS_TIMED 0x10004011
834/* Waiting for receive with timeout. (Internal use only.) */
835#define MACH_RCV_INVALID_REPLY 0x10004012
836/* invalid reply port used in a STRICT_REPLY message */
837
838
839
840__BEGIN_DECLS
841
842/*
843 * Routine: mach_msg_overwrite
844 * Purpose:
845 * Send and/or receive a message. If the message operation
846 * is interrupted, and the user did not request an indication
847 * of that fact, then restart the appropriate parts of the
848 * operation silently (trap version does not restart).
849 *
850 * Distinct send and receive buffers may be specified. If
851 * no separate receive buffer is specified, the msg parameter
852 * will be used for both send and receive operations.
853 *
854 * In addition to a distinct receive buffer, that buffer may
855 * already contain scatter control information to direct the
856 * receiving of the message.
857 */
858__WATCHOS_PROHIBITED __TVOS_PROHIBITED
859extern mach_msg_return_t mach_msg_overwrite(
860 mach_msg_header_t *msg,
861 mach_msg_option_t option,
862 mach_msg_size_t send_size,
863 mach_msg_size_t rcv_size,
864 mach_port_name_t rcv_name,
865 mach_msg_timeout_t timeout,
866 mach_port_name_t notify,
867 mach_msg_header_t *rcv_msg,
868 mach_msg_size_t rcv_limit);
869
870
871/*
872 * Routine: mach_msg
873 * Purpose:
874 * Send and/or receive a message. If the message operation
875 * is interrupted, and the user did not request an indication
876 * of that fact, then restart the appropriate parts of the
877 * operation silently (trap version does not restart).
878 */
879__WATCHOS_PROHIBITED __TVOS_PROHIBITED
880extern mach_msg_return_t mach_msg(
881 mach_msg_header_t *msg,
882 mach_msg_option_t option,
883 mach_msg_size_t send_size,
884 mach_msg_size_t rcv_size,
885 mach_port_name_t rcv_name,
886 mach_msg_timeout_t timeout,
887 mach_port_name_t notify);
888
889/*
890 * Routine: mach_voucher_deallocate
891 * Purpose:
892 * Deallocate a mach voucher created or received in a message. Drops
893 * one (send right) reference to the voucher.
894 */
895__WATCHOS_PROHIBITED __TVOS_PROHIBITED
896extern kern_return_t mach_voucher_deallocate(
897 mach_port_name_t voucher);
898
899
900__END_DECLS
901
902#endif /* _MACH_MESSAGE_H_ */
lib/libc/include/x86_64-macos-gnu/mach/port.h created+422
......@@ -0,0 +1,422 @@
1/*
2 * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 * NOTICE: This file was modified by McAfee Research in 2004 to introduce
58 * support for mandatory and extensible security protections. This notice
59 * is included in support of clause 2.2 (b) of the Apple Public License,
60 * Version 2.0.
61 */
62/*
63 */
64/*
65 * File: mach/port.h
66 *
67 * Definition of a Mach port
68 *
69 * Mach ports are the endpoints to Mach-implemented communications
70 * channels (usually uni-directional message queues, but other types
71 * also exist).
72 *
73 * Unique collections of these endpoints are maintained for each
74 * Mach task. Each Mach port in the task's collection is given a
75 * [task-local] name to identify it - and the the various "rights"
76 * held by the task for that specific endpoint.
77 *
78 * This header defines the types used to identify these Mach ports
79 * and the various rights associated with them. For more info see:
80 *
81 * <mach/mach_port.h> - manipulation of port rights in a given space
82 * <mach/message.h> - message queue [and port right passing] mechanism
83 *
84 */
85
86#ifndef _MACH_PORT_H_
87#define _MACH_PORT_H_
88
89#include <sys/cdefs.h>
90#include <stdint.h>
91#include <mach/boolean.h>
92#include <mach/machine/vm_types.h>
93
94/*
95 * mach_port_name_t - the local identity for a Mach port
96 *
97 * The name is Mach port namespace specific. It is used to
98 * identify the rights held for that port by the task whose
99 * namespace is implied [or specifically provided].
100 *
101 * Use of this type usually implies just a name - no rights.
102 * See mach_port_t for a type that implies a "named right."
103 *
104 */
105
106typedef natural_t mach_port_name_t;
107typedef mach_port_name_t *mach_port_name_array_t;
108
109
110/*
111 * mach_port_t - a named port right
112 *
113 * In user-space, "rights" are represented by the name of the
114 * right in the Mach port namespace. Even so, this type is
115 * presented as a unique one to more clearly denote the presence
116 * of a right coming along with the name.
117 *
118 * Often, various rights for a port held in a single name space
119 * will coalesce and are, therefore, be identified by a single name
120 * [this is the case for send and receive rights]. But not
121 * always [send-once rights currently get a unique name for
122 * each right].
123 *
124 */
125
126#include <sys/_types.h>
127#include <sys/_types/_mach_port_t.h>
128
129
130typedef mach_port_t *mach_port_array_t;
131
132/*
133 * MACH_PORT_NULL is a legal value that can be carried in messages.
134 * It indicates the absence of any port or port rights. (A port
135 * argument keeps the message from being "simple", even if the
136 * value is MACH_PORT_NULL.) The value MACH_PORT_DEAD is also a legal
137 * value that can be carried in messages. It indicates
138 * that a port right was present, but it died.
139 */
140
141#define MACH_PORT_NULL 0 /* intentional loose typing */
142#define MACH_PORT_DEAD ((mach_port_name_t) ~0)
143#define MACH_PORT_VALID(name) \
144 (((name) != MACH_PORT_NULL) && \
145 ((name) != MACH_PORT_DEAD))
146
147
148/*
149 * For kernel-selected [assigned] port names, the name is
150 * comprised of two parts: a generation number and an index.
151 * This approach keeps the exact same name from being generated
152 * and reused too quickly [to catch right/reference counting bugs].
153 * The dividing line between the constituent parts is exposed so
154 * that efficient "mach_port_name_t to data structure pointer"
155 * conversion implementation can be made. But it is possible
156 * for user-level code to assign their own names to Mach ports.
157 * These are not required to participate in this algorithm. So
158 * care should be taken before "assuming" this model.
159 *
160 */
161
162#ifndef NO_PORT_GEN
163
164#define MACH_PORT_INDEX(name) ((name) >> 8)
165#define MACH_PORT_GEN(name) (((name) & 0xff) << 24)
166#define MACH_PORT_MAKE(index, gen) \
167 (((index) << 8) | (gen) >> 24)
168
169#else /* NO_PORT_GEN */
170
171#define MACH_PORT_INDEX(name) (name)
172#define MACH_PORT_GEN(name) (0)
173#define MACH_PORT_MAKE(index, gen) (index)
174
175#endif /* NO_PORT_GEN */
176
177
178/*
179 * These are the different rights a task may have for a port.
180 * The MACH_PORT_RIGHT_* definitions are used as arguments
181 * to mach_port_allocate, mach_port_get_refs, etc, to specify
182 * a particular right to act upon. The mach_port_names and
183 * mach_port_type calls return bitmasks using the MACH_PORT_TYPE_*
184 * definitions. This is because a single name may denote
185 * multiple rights.
186 */
187
188typedef natural_t mach_port_right_t;
189
190#define MACH_PORT_RIGHT_SEND ((mach_port_right_t) 0)
191#define MACH_PORT_RIGHT_RECEIVE ((mach_port_right_t) 1)
192#define MACH_PORT_RIGHT_SEND_ONCE ((mach_port_right_t) 2)
193#define MACH_PORT_RIGHT_PORT_SET ((mach_port_right_t) 3)
194#define MACH_PORT_RIGHT_DEAD_NAME ((mach_port_right_t) 4)
195#define MACH_PORT_RIGHT_LABELH ((mach_port_right_t) 5) /* obsolete right */
196#define MACH_PORT_RIGHT_NUMBER ((mach_port_right_t) 6) /* right not implemented */
197
198
199typedef natural_t mach_port_type_t;
200typedef mach_port_type_t *mach_port_type_array_t;
201
202#define MACH_PORT_TYPE(right) \
203 ((mach_port_type_t)(((mach_port_type_t) 1) \
204 << ((right) + ((mach_port_right_t) 16))))
205#define MACH_PORT_TYPE_NONE ((mach_port_type_t) 0L)
206#define MACH_PORT_TYPE_SEND MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND)
207#define MACH_PORT_TYPE_RECEIVE MACH_PORT_TYPE(MACH_PORT_RIGHT_RECEIVE)
208#define MACH_PORT_TYPE_SEND_ONCE MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND_ONCE)
209#define MACH_PORT_TYPE_PORT_SET MACH_PORT_TYPE(MACH_PORT_RIGHT_PORT_SET)
210#define MACH_PORT_TYPE_DEAD_NAME MACH_PORT_TYPE(MACH_PORT_RIGHT_DEAD_NAME)
211#define MACH_PORT_TYPE_LABELH MACH_PORT_TYPE(MACH_PORT_RIGHT_LABELH) /* obsolete */
212
213
214
215/* Convenient combinations. */
216
217#define MACH_PORT_TYPE_SEND_RECEIVE \
218 (MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_RECEIVE)
219#define MACH_PORT_TYPE_SEND_RIGHTS \
220 (MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_SEND_ONCE)
221#define MACH_PORT_TYPE_PORT_RIGHTS \
222 (MACH_PORT_TYPE_SEND_RIGHTS|MACH_PORT_TYPE_RECEIVE)
223#define MACH_PORT_TYPE_PORT_OR_DEAD \
224 (MACH_PORT_TYPE_PORT_RIGHTS|MACH_PORT_TYPE_DEAD_NAME)
225#define MACH_PORT_TYPE_ALL_RIGHTS \
226 (MACH_PORT_TYPE_PORT_OR_DEAD|MACH_PORT_TYPE_PORT_SET)
227
228/* Dummy type bits that mach_port_type/mach_port_names can return. */
229
230#define MACH_PORT_TYPE_DNREQUEST 0x80000000
231#define MACH_PORT_TYPE_SPREQUEST 0x40000000
232#define MACH_PORT_TYPE_SPREQUEST_DELAYED 0x20000000
233
234/* User-references for capabilities. */
235
236typedef natural_t mach_port_urefs_t;
237typedef integer_t mach_port_delta_t; /* change in urefs */
238
239/* Attributes of ports. (See mach_port_get_receive_status.) */
240
241typedef natural_t mach_port_seqno_t; /* sequence number */
242typedef natural_t mach_port_mscount_t; /* make-send count */
243typedef natural_t mach_port_msgcount_t; /* number of msgs */
244typedef natural_t mach_port_rights_t; /* number of rights */
245
246/*
247 * Are there outstanding send rights for a given port?
248 */
249#define MACH_PORT_SRIGHTS_NONE 0 /* no srights */
250#define MACH_PORT_SRIGHTS_PRESENT 1 /* srights */
251typedef unsigned int mach_port_srights_t; /* status of send rights */
252
253typedef struct mach_port_status {
254 mach_port_rights_t mps_pset; /* count of containing port sets */
255 mach_port_seqno_t mps_seqno; /* sequence number */
256 mach_port_mscount_t mps_mscount; /* make-send count */
257 mach_port_msgcount_t mps_qlimit; /* queue limit */
258 mach_port_msgcount_t mps_msgcount; /* number in the queue */
259 mach_port_rights_t mps_sorights; /* how many send-once rights */
260 boolean_t mps_srights; /* do send rights exist? */
261 boolean_t mps_pdrequest; /* port-deleted requested? */
262 boolean_t mps_nsrequest; /* no-senders requested? */
263 natural_t mps_flags; /* port flags */
264} mach_port_status_t;
265
266/* System-wide values for setting queue limits on a port */
267#define MACH_PORT_QLIMIT_ZERO (0)
268#define MACH_PORT_QLIMIT_BASIC (5)
269#define MACH_PORT_QLIMIT_SMALL (16)
270#define MACH_PORT_QLIMIT_LARGE (1024)
271#define MACH_PORT_QLIMIT_KERNEL (65534)
272#define MACH_PORT_QLIMIT_MIN MACH_PORT_QLIMIT_ZERO
273#define MACH_PORT_QLIMIT_DEFAULT MACH_PORT_QLIMIT_BASIC
274#define MACH_PORT_QLIMIT_MAX MACH_PORT_QLIMIT_LARGE
275
276typedef struct mach_port_limits {
277 mach_port_msgcount_t mpl_qlimit; /* number of msgs */
278} mach_port_limits_t;
279
280/* Possible values for mps_flags (part of mach_port_status_t) */
281#define MACH_PORT_STATUS_FLAG_TEMPOWNER 0x01
282#define MACH_PORT_STATUS_FLAG_GUARDED 0x02
283#define MACH_PORT_STATUS_FLAG_STRICT_GUARD 0x04
284#define MACH_PORT_STATUS_FLAG_IMP_DONATION 0x08
285#define MACH_PORT_STATUS_FLAG_REVIVE 0x10
286#define MACH_PORT_STATUS_FLAG_TASKPTR 0x20
287#define MACH_PORT_STATUS_FLAG_GUARD_IMMOVABLE_RECEIVE 0x40
288#define MACH_PORT_STATUS_FLAG_NO_GRANT 0x80
289
290typedef struct mach_port_info_ext {
291 mach_port_status_t mpie_status;
292 mach_port_msgcount_t mpie_boost_cnt;
293 uint32_t reserved[6];
294} mach_port_info_ext_t;
295
296typedef integer_t *mach_port_info_t; /* varying array of natural_t */
297
298/* Flavors for mach_port_get/set_attributes() */
299typedef int mach_port_flavor_t;
300#define MACH_PORT_LIMITS_INFO 1 /* uses mach_port_limits_t */
301#define MACH_PORT_RECEIVE_STATUS 2 /* uses mach_port_status_t */
302#define MACH_PORT_DNREQUESTS_SIZE 3 /* info is int */
303#define MACH_PORT_TEMPOWNER 4 /* indicates receive right will be reassigned to another task */
304#define MACH_PORT_IMPORTANCE_RECEIVER 5 /* indicates recieve right accepts priority donation */
305#define MACH_PORT_DENAP_RECEIVER 6 /* indicates receive right accepts de-nap donation */
306#define MACH_PORT_INFO_EXT 7 /* uses mach_port_info_ext_t */
307
308#define MACH_PORT_LIMITS_INFO_COUNT ((natural_t) \
309 (sizeof(mach_port_limits_t)/sizeof(natural_t)))
310#define MACH_PORT_RECEIVE_STATUS_COUNT ((natural_t) \
311 (sizeof(mach_port_status_t)/sizeof(natural_t)))
312#define MACH_PORT_DNREQUESTS_SIZE_COUNT 1
313#define MACH_PORT_INFO_EXT_COUNT ((natural_t) \
314 (sizeof(mach_port_info_ext_t)/sizeof(natural_t)))
315/*
316 * Structure used to pass information about port allocation requests.
317 * Must be padded to 64-bits total length.
318 */
319typedef struct mach_port_qos {
320 unsigned int name:1; /* name given */
321 unsigned int prealloc:1; /* prealloced message */
322 boolean_t pad1:30;
323 natural_t len;
324} mach_port_qos_t;
325
326/* Mach Port Guarding definitions */
327
328/*
329 * Flags for mach_port_options (used for
330 * invocation of mach_port_construct).
331 * Indicates attributes to be set for the newly
332 * allocated port.
333 */
334#define MPO_CONTEXT_AS_GUARD 0x01 /* Add guard to the port */
335#define MPO_QLIMIT 0x02 /* Set qlimit for the port msg queue */
336#define MPO_TEMPOWNER 0x04 /* Set the tempowner bit of the port */
337#define MPO_IMPORTANCE_RECEIVER 0x08 /* Mark the port as importance receiver */
338#define MPO_INSERT_SEND_RIGHT 0x10 /* Insert a send right for the port */
339#define MPO_STRICT 0x20 /* Apply strict guarding for port */
340#define MPO_DENAP_RECEIVER 0x40 /* Mark the port as App de-nap receiver */
341#define MPO_IMMOVABLE_RECEIVE 0x80 /* Mark the port as immovable; protected by the guard context */
342/*
343 * Structure to define optional attributes for a newly
344 * constructed port.
345 */
346typedef struct mach_port_options {
347 uint32_t flags; /* Flags defining attributes for port */
348 mach_port_limits_t mpl; /* Message queue limit for port */
349 uint64_t reserved[2]; /* Reserved */
350}mach_port_options_t;
351
352typedef mach_port_options_t *mach_port_options_ptr_t;
353
354/*
355 * EXC_GUARD represents a guard violation for both
356 * mach ports and file descriptors. GUARD_TYPE_ is used
357 * to differentiate among them.
358 */
359#define GUARD_TYPE_MACH_PORT 0x1
360
361/* Reasons for exception for a guarded mach port */
362enum mach_port_guard_exception_codes {
363 kGUARD_EXC_DESTROY = 1u << 0,
364 kGUARD_EXC_MOD_REFS = 1u << 1,
365 kGUARD_EXC_SET_CONTEXT = 1u << 2,
366 kGUARD_EXC_UNGUARDED = 1u << 3,
367 kGUARD_EXC_INCORRECT_GUARD = 1u << 4,
368 kGUARD_EXC_IMMOVABLE = 1u << 5,
369 kGUARD_EXC_STRICT_REPLY = 1u << 6,
370 /* start of [optionally] non-fatal guards */
371 kGUARD_EXC_INVALID_RIGHT = 1u << 8,
372 kGUARD_EXC_INVALID_NAME = 1u << 9,
373 kGUARD_EXC_INVALID_VALUE = 1u << 10,
374 kGUARD_EXC_INVALID_ARGUMENT = 1u << 11,
375 kGUARD_EXC_RIGHT_EXISTS = 1u << 12,
376 kGUARD_EXC_KERN_NO_SPACE = 1u << 13,
377 kGUARD_EXC_KERN_FAILURE = 1u << 14,
378 kGUARD_EXC_KERN_RESOURCE = 1u << 15,
379 kGUARD_EXC_SEND_INVALID_REPLY = 1u << 16,
380 kGUARD_EXC_SEND_INVALID_VOUCHER = 1u << 17,
381 kGUARD_EXC_SEND_INVALID_RIGHT = 1u << 18,
382 kGUARD_EXC_RCV_INVALID_NAME = 1u << 19,
383 kGUARD_EXC_RCV_GUARDED_DESC = 1u << 20, /* should never be fatal; for development only */
384};
385
386#define MAX_FATAL_kGUARD_EXC_CODE (1u << 6)
387
388/*
389 * These flags are used as bits in the subcode of kGUARD_EXC_STRICT_REPLY exceptions.
390 */
391#define MPG_FLAGS_STRICT_REPLY_INVALID_REPLY_DISP (0x01ull << 56)
392#define MPG_FLAGS_STRICT_REPLY_INVALID_REPLY_PORT (0x02ull << 56)
393#define MPG_FLAGS_STRICT_REPLY_INVALID_VOUCHER (0x04ull << 56)
394#define MPG_FLAGS_STRICT_REPLY_NO_BANK_ATTR (0x08ull << 56)
395#define MPG_FLAGS_STRICT_REPLY_MISMATCHED_PERSONA (0x10ull << 56)
396#define MPG_FLAGS_STRICT_REPLY_MASK (0xffull << 56)
397
398/*
399 * Flags for mach_port_guard_with_flags. These flags extend
400 * the attributes associated with a guarded port.
401 */
402#define MPG_STRICT 0x01 /* Apply strict guarding for a port */
403#define MPG_IMMOVABLE_RECEIVE 0x02 /* Receive right cannot be moved out of the space */
404
405#if !__DARWIN_UNIX03 && !defined(_NO_PORT_T_FROM_MACH)
406/*
407 * Mach 3.0 renamed everything to have mach_ in front of it.
408 * These types and macros are provided for backward compatibility
409 * but are deprecated.
410 */
411typedef mach_port_t port_t;
412typedef mach_port_name_t port_name_t;
413typedef mach_port_name_t *port_name_array_t;
414
415#define PORT_NULL ((port_t) 0)
416#define PORT_DEAD ((port_t) ~0)
417#define PORT_VALID(name) \
418 ((port_t)(name) != PORT_NULL && (port_t)(name) != PORT_DEAD)
419
420#endif /* !__DARWIN_UNIX03 && !_NO_PORT_T_FROM_MACH */
421
422#endif /* _MACH_PORT_H_ */
lib/libc/include/x86_64-macos-gnu/mach/thread_status.h created+97
......@@ -0,0 +1,97 @@
1/*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 */
58/*
59 * File: mach/thread_status.h
60 * Author: Avadis Tevanian, Jr.
61 *
62 * This file contains the structure definitions for the user-visible
63 * thread state. This thread state is examined with the thread_get_state
64 * kernel call and may be changed with the thread_set_state kernel call.
65 *
66 */
67
68#ifndef _MACH_THREAD_STATUS_H_
69#define _MACH_THREAD_STATUS_H_
70
71/*
72 * The actual structure that comprises the thread state is defined
73 * in the machine dependent module.
74 */
75#include <mach/machine/vm_types.h>
76#include <mach/machine/thread_status.h>
77#include <mach/machine/thread_state.h>
78
79/*
80 * Generic definition for machine-dependent thread status.
81 */
82
83typedef natural_t *thread_state_t; /* Variable-length array */
84
85/* THREAD_STATE_MAX is now defined in <mach/machine/thread_state.h> */
86typedef natural_t thread_state_data_t[THREAD_STATE_MAX];
87
88#define THREAD_STATE_FLAVOR_LIST 0 /* List of valid flavors */
89#define THREAD_STATE_FLAVOR_LIST_NEW 128
90#define THREAD_STATE_FLAVOR_LIST_10_9 129
91#define THREAD_STATE_FLAVOR_LIST_10_13 130
92#define THREAD_STATE_FLAVOR_LIST_10_15 131
93
94typedef int thread_state_flavor_t;
95typedef thread_state_flavor_t *thread_state_flavor_array_t;
96
97#endif /* _MACH_THREAD_STATUS_H_ */
lib/libc/include/x86_64-macos-gnu/machine/_param.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#if defined (__i386__) || defined (__x86_64__)
29#include "i386/_param.h"
30#else
31#error architecture not supported
32#endif
lib/libc/include/x86_64-macos-gnu/monetary.h created+45
......@@ -0,0 +1,45 @@
1/*-
2 * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: /repoman/r/ncvs/src/include/monetary.h,v 1.7 2002/09/20 08:22:48 mike Exp $
27 */
28
29#ifndef _MONETARY_H_
30#define _MONETARY_H_
31
32#include <sys/cdefs.h>
33#include <_types.h>
34#include <sys/_types/_size_t.h>
35#include <sys/_types/_ssize_t.h>
36
37__BEGIN_DECLS
38ssize_t strfmon(char *, size_t, const char *, ...);
39__END_DECLS
40
41#ifdef _USE_EXTENDED_LOCALES_
42#include <xlocale/_monetary.h>
43#endif /* _USE_EXTENDED_LOCALES_ */
44
45#endif /* !_MONETARY_H_ */
lib/libc/include/x86_64-macos-gnu/ndbm.h created+120
......@@ -0,0 +1,120 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*-
24 * Copyright (c) 1990, 1993
25 * The Regents of the University of California. All rights reserved.
26 *
27 * This code is derived from software contributed to Berkeley by
28 * Margo Seltzer.
29 *
30 * Redistribution and use in source and binary forms, with or without
31 * modification, are permitted provided that the following conditions
32 * are met:
33 * 1. Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * 2. Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in the
37 * documentation and/or other materials provided with the distribution.
38 * 3. All advertising materials mentioning features or use of this software
39 * must display the following acknowledgement:
40 * This product includes software developed by the University of
41 * California, Berkeley and its contributors.
42 * 4. Neither the name of the University nor the names of its contributors
43 * may be used to endorse or promote products derived from this software
44 * without specific prior written permission.
45 *
46 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
47 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
50 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
52 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56 * SUCH DAMAGE.
57 *
58 * @(#)ndbm.h 8.1 (Berkeley) 6/2/93
59 */
60
61#ifndef _NDBM_H_
62#define _NDBM_H_
63
64#include <_types.h>
65#include <sys/_types/_mode_t.h>
66#include <sys/_types/_size_t.h>
67
68#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
69/* Map dbm interface onto db(3). */
70#include <fcntl.h>
71#define DBM_RDONLY O_RDONLY
72#endif
73
74/* Flags to dbm_store(). */
75#define DBM_INSERT 0
76#define DBM_REPLACE 1
77
78#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
79/*
80 * The db(3) support for ndbm(3) always appends this suffix to the
81 * file name to avoid overwriting the user's original database.
82 */
83#define DBM_SUFFIX ".db"
84#endif
85
86typedef struct {
87 void *dptr;
88 size_t dsize;
89} datum;
90
91#ifndef _DBM
92#define _DBM
93typedef struct {
94 char __opaque[sizeof(int) + 8 * sizeof(void *)];
95} DBM;
96#endif /* _DBM */
97
98#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
99#define dbm_pagfno(a) DBM_PAGFNO_NOT_AVAILABLE
100#endif
101
102__BEGIN_DECLS
103int dbm_clearerr( DBM *);
104void dbm_close(DBM *);
105int dbm_delete(DBM *, datum);
106#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
107int dbm_dirfno(DBM *);
108#endif
109int dbm_error( DBM *);
110datum dbm_fetch(DBM *, datum);
111datum dbm_firstkey(DBM *);
112#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
113long dbm_forder(DBM *, datum);
114#endif
115datum dbm_nextkey(DBM *);
116DBM *dbm_open(const char *, int, mode_t);
117int dbm_store(DBM *, datum, datum, int);
118__END_DECLS
119
120#endif /* !_NDBM_H_ */
lib/libc/include/x86_64-macos-gnu/net/if.h created+442
......@@ -0,0 +1,442 @@
1/*
2 * Copyright (c) 2000-2019 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * Copyright (c) 1982, 1986, 1989, 1993
30 * The Regents of the University of California. All rights reserved.
31 *
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
34 * are met:
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.
40 * 3. All advertising materials mentioning features or use of this software
41 * must display the following acknowledgement:
42 * This product includes software developed by the University of
43 * California, Berkeley and its contributors.
44 * 4. Neither the name of the University nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 *
60 * @(#)if.h 8.1 (Berkeley) 6/10/93
61 */
62
63#ifndef _NET_IF_H_
64#define _NET_IF_H_
65
66#include <sys/cdefs.h>
67#include <net/net_kev.h>
68
69#define IF_NAMESIZE 16
70
71#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
72#include <sys/appleapiopts.h>
73#ifdef __APPLE__
74
75#include <net/if_var.h>
76#include <sys/types.h>
77#include <sys/socket.h>
78
79#endif
80
81struct if_clonereq {
82 int ifcr_total; /* total cloners (out) */
83 int ifcr_count; /* room for this many in user buffer */
84 char *ifcr_buffer; /* buffer for cloner names */
85};
86
87
88#define IFF_UP 0x1 /* interface is up */
89#define IFF_BROADCAST 0x2 /* broadcast address valid */
90#define IFF_DEBUG 0x4 /* turn on debugging */
91#define IFF_LOOPBACK 0x8 /* is a loopback net */
92#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */
93#define IFF_NOTRAILERS 0x20 /* obsolete: avoid use of trailers */
94#define IFF_RUNNING 0x40 /* resources allocated */
95#define IFF_NOARP 0x80 /* no address resolution protocol */
96#define IFF_PROMISC 0x100 /* receive all packets */
97#define IFF_ALLMULTI 0x200 /* receive all multicast packets */
98#define IFF_OACTIVE 0x400 /* transmission in progress */
99#define IFF_SIMPLEX 0x800 /* can't hear own transmissions */
100#define IFF_LINK0 0x1000 /* per link layer defined bit */
101#define IFF_LINK1 0x2000 /* per link layer defined bit */
102#define IFF_LINK2 0x4000 /* per link layer defined bit */
103#define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */
104#define IFF_MULTICAST 0x8000 /* supports multicast */
105
106
107
108/*
109 * Capabilities that interfaces can advertise.
110 *
111 * struct ifnet.if_capabilities
112 * contains the optional features & capabilities a particular interface
113 * supports (not only the driver but also the detected hw revision).
114 * Capabilities are defined by IFCAP_* below.
115 * struct ifnet.if_capenable
116 * contains the enabled (either by default or through ifconfig) optional
117 * features & capabilities on this interface.
118 * Capabilities are defined by IFCAP_* below.
119 * struct if_data.ifi_hwassist in IFNET_* form, defined in net/kpi_interface.h,
120 * contains the enabled optional features & capabilites that can be used
121 * individually per packet and are specified in the mbuf pkthdr.csum_flags
122 * field. IFCAP_* and IFNET_* do not match one to one and IFNET_* may be
123 * more detailed or differentiated than IFCAP_*.
124 * IFNET_* hwassist flags have corresponding CSUM_* in sys/mbuf.h
125 */
126#define IFCAP_RXCSUM 0x00001 /* can offload checksum on RX */
127#define IFCAP_TXCSUM 0x00002 /* can offload checksum on TX */
128#define IFCAP_VLAN_MTU 0x00004 /* VLAN-compatible MTU */
129#define IFCAP_VLAN_HWTAGGING 0x00008 /* hardware VLAN tag support */
130#define IFCAP_JUMBO_MTU 0x00010 /* 9000 byte MTU supported */
131#define IFCAP_TSO4 0x00020 /* can do TCP Segmentation Offload */
132#define IFCAP_TSO6 0x00040 /* can do TCP6 Segmentation Offload */
133#define IFCAP_LRO 0x00080 /* can do Large Receive Offload */
134#define IFCAP_AV 0x00100 /* can do 802.1 AV Bridging */
135#define IFCAP_TXSTATUS 0x00200 /* can return linklevel xmit status */
136#define IFCAP_SKYWALK 0x00400 /* Skywalk mode supported/enabled */
137#define IFCAP_HW_TIMESTAMP 0x00800 /* Time stamping in hardware */
138#define IFCAP_SW_TIMESTAMP 0x01000 /* Time stamping in software */
139#define IFCAP_CSUM_PARTIAL 0x02000 /* can offload partial checksum */
140#define IFCAP_CSUM_ZERO_INVERT 0x04000 /* can invert 0 to -0 (0xffff) */
141
142#define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM)
143#define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6)
144
145#define IFCAP_VALID (IFCAP_HWCSUM | IFCAP_TSO | IFCAP_LRO | IFCAP_VLAN_MTU | \
146 IFCAP_VLAN_HWTAGGING | IFCAP_JUMBO_MTU | IFCAP_AV | IFCAP_TXSTATUS | \
147 IFCAP_SKYWALK | IFCAP_SW_TIMESTAMP | IFCAP_HW_TIMESTAMP | \
148 IFCAP_CSUM_PARTIAL | IFCAP_CSUM_ZERO_INVERT)
149
150#define IFQ_MAXLEN 128
151#define IFNET_SLOWHZ 1 /* granularity is 1 second */
152#define IFQ_TARGET_DELAY (10ULL * 1000 * 1000) /* 10 ms */
153#define IFQ_UPDATE_INTERVAL (100ULL * 1000 * 1000) /* 100 ms */
154
155/*
156 * Message format for use in obtaining information about interfaces
157 * from sysctl and the routing socket
158 */
159struct if_msghdr {
160 unsigned short ifm_msglen; /* to skip non-understood messages */
161 unsigned char ifm_version; /* future binary compatability */
162 unsigned char ifm_type; /* message type */
163 int ifm_addrs; /* like rtm_addrs */
164 int ifm_flags; /* value of if_flags */
165 unsigned short ifm_index; /* index for associated ifp */
166 struct if_data ifm_data; /* statistics and other data about if */
167};
168
169/*
170 * Message format for use in obtaining information about interface addresses
171 * from sysctl and the routing socket
172 */
173struct ifa_msghdr {
174 unsigned short ifam_msglen; /* to skip non-understood messages */
175 unsigned char ifam_version; /* future binary compatability */
176 unsigned char ifam_type; /* message type */
177 int ifam_addrs; /* like rtm_addrs */
178 int ifam_flags; /* value of ifa_flags */
179 unsigned short ifam_index; /* index for associated ifp */
180 int ifam_metric; /* value of ifa_metric */
181};
182
183/*
184 * Message format for use in obtaining information about multicast addresses
185 * from the routing socket
186 */
187struct ifma_msghdr {
188 unsigned short ifmam_msglen; /* to skip non-understood messages */
189 unsigned char ifmam_version; /* future binary compatability */
190 unsigned char ifmam_type; /* message type */
191 int ifmam_addrs; /* like rtm_addrs */
192 int ifmam_flags; /* value of ifa_flags */
193 unsigned short ifmam_index; /* index for associated ifp */
194};
195
196/*
197 * Message format for use in obtaining information about interfaces
198 * from sysctl
199 */
200struct if_msghdr2 {
201 u_short ifm_msglen; /* to skip over non-understood messages */
202 u_char ifm_version; /* future binary compatability */
203 u_char ifm_type; /* message type */
204 int ifm_addrs; /* like rtm_addrs */
205 int ifm_flags; /* value of if_flags */
206 u_short ifm_index; /* index for associated ifp */
207 int ifm_snd_len; /* instantaneous length of send queue */
208 int ifm_snd_maxlen; /* maximum length of send queue */
209 int ifm_snd_drops; /* number of drops in send queue */
210 int ifm_timer; /* time until if_watchdog called */
211 struct if_data64 ifm_data; /* statistics and other data */
212};
213
214/*
215 * Message format for use in obtaining information about multicast addresses
216 * from sysctl
217 */
218struct ifma_msghdr2 {
219 u_short ifmam_msglen; /* to skip over non-understood messages */
220 u_char ifmam_version; /* future binary compatability */
221 u_char ifmam_type; /* message type */
222 int ifmam_addrs; /* like rtm_addrs */
223 int ifmam_flags; /* value of ifa_flags */
224 u_short ifmam_index; /* index for associated ifp */
225 int32_t ifmam_refcount;
226};
227
228/*
229 * ifdevmtu: interface device mtu
230 * Used with SIOCGIFDEVMTU to get the current mtu in use by the device,
231 * as well as the minimum and maximum mtu allowed by the device.
232 */
233struct ifdevmtu {
234 int ifdm_current;
235 int ifdm_min;
236 int ifdm_max;
237};
238
239#pragma pack(4)
240
241/*
242 * ifkpi: interface kpi ioctl
243 * Used with SIOCSIFKPI and SIOCGIFKPI.
244 *
245 * ifk_module_id - From in the kernel, a value from kev_vendor_code_find. From
246 * user space, a value from SIOCGKEVVENDOR ioctl on a kernel event socket.
247 * ifk_type - The type. Types are specific to each module id.
248 * ifk_data - The data. ifk_ptr may be a 64bit pointer for 64 bit processes.
249 *
250 * Copying data between user space and kernel space is done using copyin
251 * and copyout. A process may be running in 64bit mode. In such a case,
252 * the pointer will be a 64bit pointer, not a 32bit pointer. The following
253 * sample is a safe way to copy the data in to the kernel from either a
254 * 32bit or 64bit process:
255 *
256 * user_addr_t tmp_ptr;
257 * if (IS_64BIT_PROCESS(current_proc())) {
258 * tmp_ptr = CAST_USER_ADDR_T(ifkpi.ifk_data.ifk_ptr64);
259 * }
260 * else {
261 * tmp_ptr = CAST_USER_ADDR_T(ifkpi.ifk_data.ifk_ptr);
262 * }
263 * error = copyin(tmp_ptr, allocated_dst_buffer, size of allocated_dst_buffer);
264 */
265
266struct ifkpi {
267 unsigned int ifk_module_id;
268 unsigned int ifk_type;
269 union {
270 void *ifk_ptr;
271 int ifk_value;
272 } ifk_data;
273};
274
275/* Wake capabilities of a interface */
276#define IF_WAKE_ON_MAGIC_PACKET 0x01
277
278
279#pragma pack()
280
281/*
282 * Interface request structure used for socket
283 * ioctl's. All interface ioctl's must have parameter
284 * definitions which begin with ifr_name. The
285 * remainder may be interface specific.
286 */
287struct ifreq {
288#ifndef IFNAMSIZ
289#define IFNAMSIZ IF_NAMESIZE
290#endif
291 char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
292 union {
293 struct sockaddr ifru_addr;
294 struct sockaddr ifru_dstaddr;
295 struct sockaddr ifru_broadaddr;
296 short ifru_flags;
297 int ifru_metric;
298 int ifru_mtu;
299 int ifru_phys;
300 int ifru_media;
301 int ifru_intval;
302 caddr_t ifru_data;
303 struct ifdevmtu ifru_devmtu;
304 struct ifkpi ifru_kpi;
305 u_int32_t ifru_wake_flags;
306 u_int32_t ifru_route_refcnt;
307 int ifru_cap[2];
308 u_int32_t ifru_functional_type;
309#define IFRTYPE_FUNCTIONAL_UNKNOWN 0
310#define IFRTYPE_FUNCTIONAL_LOOPBACK 1
311#define IFRTYPE_FUNCTIONAL_WIRED 2
312#define IFRTYPE_FUNCTIONAL_WIFI_INFRA 3
313#define IFRTYPE_FUNCTIONAL_WIFI_AWDL 4
314#define IFRTYPE_FUNCTIONAL_CELLULAR 5
315#define IFRTYPE_FUNCTIONAL_INTCOPROC 6
316#define IFRTYPE_FUNCTIONAL_COMPANIONLINK 7
317#define IFRTYPE_FUNCTIONAL_LAST 7
318 } ifr_ifru;
319#define ifr_addr ifr_ifru.ifru_addr /* address */
320#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
321#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
322#ifdef __APPLE__
323#define ifr_flags ifr_ifru.ifru_flags /* flags */
324#else
325#define ifr_flags ifr_ifru.ifru_flags[0] /* flags */
326#define ifr_prevflags ifr_ifru.ifru_flags[1] /* flags */
327#endif /* __APPLE__ */
328#define ifr_metric ifr_ifru.ifru_metric /* metric */
329#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
330#define ifr_phys ifr_ifru.ifru_phys /* physical wire */
331#define ifr_media ifr_ifru.ifru_media /* physical media */
332#define ifr_data ifr_ifru.ifru_data /* for use by interface */
333#define ifr_devmtu ifr_ifru.ifru_devmtu
334#define ifr_intval ifr_ifru.ifru_intval /* integer value */
335#define ifr_kpi ifr_ifru.ifru_kpi
336#define ifr_wake_flags ifr_ifru.ifru_wake_flags /* wake capabilities */
337#define ifr_route_refcnt ifr_ifru.ifru_route_refcnt /* route references count */
338#define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */
339#define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */
340};
341
342#define _SIZEOF_ADDR_IFREQ(ifr) \
343 ((ifr).ifr_addr.sa_len > sizeof (struct sockaddr) ? \
344 (sizeof (struct ifreq) - sizeof (struct sockaddr) + \
345 (ifr).ifr_addr.sa_len) : sizeof (struct ifreq))
346
347struct ifaliasreq {
348 char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
349 struct sockaddr ifra_addr;
350 struct sockaddr ifra_broadaddr;
351 struct sockaddr ifra_mask;
352};
353
354struct rslvmulti_req {
355 struct sockaddr *sa;
356 struct sockaddr **llsa;
357};
358
359#pragma pack(4)
360
361struct ifmediareq {
362 char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */
363 int ifm_current; /* current media options */
364 int ifm_mask; /* don't care mask */
365 int ifm_status; /* media status */
366 int ifm_active; /* active options */
367 int ifm_count; /* # entries in ifm_ulist array */
368 int *ifm_ulist; /* media words */
369};
370
371#pragma pack()
372
373
374
375#pragma pack(4)
376struct ifdrv {
377 char ifd_name[IFNAMSIZ]; /* if name, e.g. "en0" */
378 unsigned long ifd_cmd;
379 size_t ifd_len; /* length of ifd_data buffer */
380 void *ifd_data;
381};
382#pragma pack()
383
384
385/*
386 * Structure used to retrieve aux status data from interfaces.
387 * Kernel suppliers to this interface should respect the formatting
388 * needed by ifconfig(8): each line starts with a TAB and ends with
389 * a newline.
390 */
391
392#define IFSTATMAX 800 /* 10 lines of text */
393struct ifstat {
394 char ifs_name[IFNAMSIZ]; /* if name, e.g. "en0" */
395 char ascii[IFSTATMAX + 1];
396};
397
398/*
399 * Structure used in SIOCGIFCONF request.
400 * Used to retrieve interface configuration
401 * for machine (useful for programs which
402 * must know all networks accessible).
403 */
404#pragma pack(4)
405struct ifconf {
406 int ifc_len; /* size of associated buffer */
407 union {
408 caddr_t ifcu_buf;
409 struct ifreq *ifcu_req;
410 } ifc_ifcu;
411};
412#pragma pack()
413#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
414#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */
415
416
417/*
418 * DLIL KEV_DL_PROTO_ATTACHED/DETACHED structure
419 */
420struct kev_dl_proto_data {
421 struct net_event_data link_data;
422 u_int32_t proto_family;
423 u_int32_t proto_remaining_count;
424};
425
426
427#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
428
429struct if_nameindex {
430 unsigned int if_index; /* 1, 2, ... */
431 char *if_name; /* null terminated name: "le0", ... */
432};
433
434__BEGIN_DECLS
435unsigned int if_nametoindex(const char *);
436char *if_indextoname(unsigned int, char *);
437struct if_nameindex *if_nameindex(void);
438void if_freenameindex(struct if_nameindex *);
439__END_DECLS
440
441
442#endif /* !_NET_IF_H_ */
lib/libc/include/x86_64-macos-gnu/net/if_var.h created+242
......@@ -0,0 +1,242 @@
1/*
2 * Copyright (c) 2000-2019 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * Copyright (c) 1982, 1986, 1989, 1993
30 * The Regents of the University of California. All rights reserved.
31 *
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
34 * are met:
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.
40 * 3. All advertising materials mentioning features or use of this software
41 * must display the following acknowledgement:
42 * This product includes software developed by the University of
43 * California, Berkeley and its contributors.
44 * 4. Neither the name of the University nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 *
60 * From: @(#)if.h 8.1 (Berkeley) 6/10/93
61 * $FreeBSD: src/sys/net/if_var.h,v 1.18.2.7 2001/07/24 19:10:18 brooks Exp $
62 */
63
64#ifndef _NET_IF_VAR_H_
65#define _NET_IF_VAR_H_
66
67#include <sys/appleapiopts.h>
68#include <stdint.h>
69#include <sys/types.h>
70#include <sys/time.h>
71#include <sys/queue.h> /* get TAILQ macros */
72#ifdef BSD_KERN_PRIVATE
73#include <sys/eventhandler.h>
74#endif
75
76
77#ifdef __APPLE__
78#define APPLE_IF_FAM_LOOPBACK 1
79#define APPLE_IF_FAM_ETHERNET 2
80#define APPLE_IF_FAM_SLIP 3
81#define APPLE_IF_FAM_TUN 4
82#define APPLE_IF_FAM_VLAN 5
83#define APPLE_IF_FAM_PPP 6
84#define APPLE_IF_FAM_PVC 7
85#define APPLE_IF_FAM_DISC 8
86#define APPLE_IF_FAM_MDECAP 9
87#define APPLE_IF_FAM_GIF 10
88#define APPLE_IF_FAM_FAITH 11 /* deprecated */
89#define APPLE_IF_FAM_STF 12
90#define APPLE_IF_FAM_FIREWIRE 13
91#define APPLE_IF_FAM_BOND 14
92#define APPLE_IF_FAM_CELLULAR 15
93#define APPLE_IF_FAM_6LOWPAN 16
94#define APPLE_IF_FAM_UTUN 17
95#define APPLE_IF_FAM_IPSEC 18
96#endif /* __APPLE__ */
97
98/*
99 * 72 was chosen below because it is the size of a TCP/IP
100 * header (40) + the minimum mss (32).
101 */
102#define IF_MINMTU 72
103#define IF_MAXMTU 65535
104
105/*
106 * Structures defining a network interface, providing a packet
107 * transport mechanism (ala level 0 of the PUP protocols).
108 *
109 * Each interface accepts output datagrams of a specified maximum
110 * length, and provides higher level routines with input datagrams
111 * received from its medium.
112 *
113 * Output occurs when the routine if_output is called, with three parameters:
114 * (*ifp->if_output)(ifp, m, dst, rt)
115 * Here m is the mbuf chain to be sent and dst is the destination address.
116 * The output routine encapsulates the supplied datagram if necessary,
117 * and then transmits it on its medium.
118 *
119 * On input, each interface unwraps the data received by it, and either
120 * places it on the input queue of a internetwork datagram routine
121 * and posts the associated software interrupt, or passes the datagram to a raw
122 * packet input routine.
123 *
124 * Routines exist for locating interfaces by their addresses
125 * or for locating a interface on a certain network, as well as more general
126 * routing and gateway routines maintaining information used to locate
127 * interfaces. These routines live in the files if.c and route.c
128 */
129
130#define IFNAMSIZ 16
131
132/* This belongs up in socket.h or socketvar.h, depending on how far the
133 * event bubbles up.
134 */
135
136struct net_event_data {
137 u_int32_t if_family;
138 u_int32_t if_unit;
139 char if_name[IFNAMSIZ];
140};
141
142#if defined(__LP64__)
143#include <sys/_types/_timeval32.h>
144#define IF_DATA_TIMEVAL timeval32
145#else
146#define IF_DATA_TIMEVAL timeval
147#endif
148
149#pragma pack(4)
150
151/*
152 * Structure describing information about an interface
153 * which may be of interest to management entities.
154 */
155struct if_data {
156 /* generic interface information */
157 u_char ifi_type; /* ethernet, tokenring, etc */
158 u_char ifi_typelen; /* Length of frame type id */
159 u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */
160 u_char ifi_addrlen; /* media address length */
161 u_char ifi_hdrlen; /* media header length */
162 u_char ifi_recvquota; /* polling quota for receive intrs */
163 u_char ifi_xmitquota; /* polling quota for xmit intrs */
164 u_char ifi_unused1; /* for future use */
165 u_int32_t ifi_mtu; /* maximum transmission unit */
166 u_int32_t ifi_metric; /* routing metric (external only) */
167 u_int32_t ifi_baudrate; /* linespeed */
168 /* volatile statistics */
169 u_int32_t ifi_ipackets; /* packets received on interface */
170 u_int32_t ifi_ierrors; /* input errors on interface */
171 u_int32_t ifi_opackets; /* packets sent on interface */
172 u_int32_t ifi_oerrors; /* output errors on interface */
173 u_int32_t ifi_collisions; /* collisions on csma interfaces */
174 u_int32_t ifi_ibytes; /* total number of octets received */
175 u_int32_t ifi_obytes; /* total number of octets sent */
176 u_int32_t ifi_imcasts; /* packets received via multicast */
177 u_int32_t ifi_omcasts; /* packets sent via multicast */
178 u_int32_t ifi_iqdrops; /* dropped on input, this interface */
179 u_int32_t ifi_noproto; /* destined for unsupported protocol */
180 u_int32_t ifi_recvtiming; /* usec spent receiving when timing */
181 u_int32_t ifi_xmittiming; /* usec spent xmitting when timing */
182 struct IF_DATA_TIMEVAL ifi_lastchange; /* time of last administrative change */
183 u_int32_t ifi_unused2; /* used to be the default_proto */
184 u_int32_t ifi_hwassist; /* HW offload capabilities */
185 u_int32_t ifi_reserved1; /* for future use */
186 u_int32_t ifi_reserved2; /* for future use */
187};
188
189/*
190 * Structure describing information about an interface
191 * which may be of interest to management entities.
192 */
193struct if_data64 {
194 /* generic interface information */
195 u_char ifi_type; /* ethernet, tokenring, etc */
196 u_char ifi_typelen; /* Length of frame type id */
197 u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */
198 u_char ifi_addrlen; /* media address length */
199 u_char ifi_hdrlen; /* media header length */
200 u_char ifi_recvquota; /* polling quota for receive intrs */
201 u_char ifi_xmitquota; /* polling quota for xmit intrs */
202 u_char ifi_unused1; /* for future use */
203 u_int32_t ifi_mtu; /* maximum transmission unit */
204 u_int32_t ifi_metric; /* routing metric (external only) */
205 u_int64_t ifi_baudrate; /* linespeed */
206 /* volatile statistics */
207 u_int64_t ifi_ipackets; /* packets received on interface */
208 u_int64_t ifi_ierrors; /* input errors on interface */
209 u_int64_t ifi_opackets; /* packets sent on interface */
210 u_int64_t ifi_oerrors; /* output errors on interface */
211 u_int64_t ifi_collisions; /* collisions on csma interfaces */
212 u_int64_t ifi_ibytes; /* total number of octets received */
213 u_int64_t ifi_obytes; /* total number of octets sent */
214 u_int64_t ifi_imcasts; /* packets received via multicast */
215 u_int64_t ifi_omcasts; /* packets sent via multicast */
216 u_int64_t ifi_iqdrops; /* dropped on input, this interface */
217 u_int64_t ifi_noproto; /* destined for unsupported protocol */
218 u_int32_t ifi_recvtiming; /* usec spent receiving when timing */
219 u_int32_t ifi_xmittiming; /* usec spent xmitting when timing */
220 struct IF_DATA_TIMEVAL ifi_lastchange; /* time of last administrative change */
221};
222
223
224#pragma pack()
225
226/*
227 * Structure defining a queue for a network interface.
228 */
229struct ifqueue {
230 void *ifq_head;
231 void *ifq_tail;
232 int ifq_len;
233 int ifq_maxlen;
234 int ifq_drops;
235};
236
237
238
239
240
241
242#endif /* !_NET_IF_VAR_H_ */
lib/libc/include/x86_64-macos-gnu/net/net_kev.h created+98
......@@ -0,0 +1,98 @@
1/*
2 * Copyright (c) 2016-2018 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#ifndef _NET_NETKEV_H_
30#define _NET_NETKEV_H_
31
32#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
33
34/* Kernel event subclass identifiers for KEV_NETWORK_CLASS */
35#define KEV_INET_SUBCLASS 1 /* inet subclass */
36/* KEV_INET_SUBCLASS event codes */
37#define KEV_INET_NEW_ADDR 1 /* Userland configured IP address */
38#define KEV_INET_CHANGED_ADDR 2 /* Address changed event */
39#define KEV_INET_ADDR_DELETED 3 /* IPv6 address was deleted */
40#define KEV_INET_SIFDSTADDR 4 /* Dest. address was set */
41#define KEV_INET_SIFBRDADDR 5 /* Broadcast address was set */
42#define KEV_INET_SIFNETMASK 6 /* Netmask was set */
43#define KEV_INET_ARPCOLLISION 7 /* ARP collision detected */
44#ifdef __APPLE_API_PRIVATE
45#define KEV_INET_PORTINUSE 8 /* use ken_in_portinuse */
46#endif
47#define KEV_INET_ARPRTRFAILURE 9 /* ARP resolution failed for router */
48#define KEV_INET_ARPRTRALIVE 10 /* ARP resolution succeeded for router */
49
50#define KEV_DL_SUBCLASS 2 /* Data Link subclass */
51/*
52 * Define Data-Link event subclass, and associated
53 * events.
54 */
55#define KEV_DL_SIFFLAGS 1
56#define KEV_DL_SIFMETRICS 2
57#define KEV_DL_SIFMTU 3
58#define KEV_DL_SIFPHYS 4
59#define KEV_DL_SIFMEDIA 5
60#define KEV_DL_SIFGENERIC 6
61#define KEV_DL_ADDMULTI 7
62#define KEV_DL_DELMULTI 8
63#define KEV_DL_IF_ATTACHED 9
64#define KEV_DL_IF_DETACHING 10
65#define KEV_DL_IF_DETACHED 11
66#define KEV_DL_LINK_OFF 12
67#define KEV_DL_LINK_ON 13
68#define KEV_DL_PROTO_ATTACHED 14
69#define KEV_DL_PROTO_DETACHED 15
70#define KEV_DL_LINK_ADDRESS_CHANGED 16
71#define KEV_DL_WAKEFLAGS_CHANGED 17
72#define KEV_DL_IF_IDLE_ROUTE_REFCNT 18
73#define KEV_DL_IFCAP_CHANGED 19
74#define KEV_DL_LINK_QUALITY_METRIC_CHANGED 20
75#define KEV_DL_NODE_PRESENCE 21
76#define KEV_DL_NODE_ABSENCE 22
77#define KEV_DL_MASTER_ELECTED 23
78#define KEV_DL_ISSUES 24
79#define KEV_DL_IFDELEGATE_CHANGED 25
80#define KEV_DL_AWDL_RESTRICTED 26
81#define KEV_DL_AWDL_UNRESTRICTED 27
82#define KEV_DL_RRC_STATE_CHANGED 28
83#define KEV_DL_QOS_MODE_CHANGED 29
84#define KEV_DL_LOW_POWER_MODE_CHANGED 30
85
86
87#define KEV_INET6_SUBCLASS 6 /* inet6 subclass */
88/* KEV_INET6_SUBCLASS event codes */
89#define KEV_INET6_NEW_USER_ADDR 1 /* Userland configured IPv6 address */
90#define KEV_INET6_CHANGED_ADDR 2 /* Address changed event (future) */
91#define KEV_INET6_ADDR_DELETED 3 /* IPv6 address was deleted */
92#define KEV_INET6_NEW_LL_ADDR 4 /* Autoconf LL address appeared */
93#define KEV_INET6_NEW_RTADV_ADDR 5 /* Autoconf address has appeared */
94#define KEV_INET6_DEFROUTER 6 /* Default router detected */
95#define KEV_INET6_REQUEST_NAT64_PREFIX 7 /* Asking for the NAT64-prefix */
96
97#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
98#endif /* _NET_NETKEV_H_ */
lib/libc/include/x86_64-macos-gnu/netdb.h created+319
......@@ -0,0 +1,319 @@
1/*
2 * Copyright (c) 2000-2009 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 * ++Copyright++ 1980, 1983, 1988, 1993
25 * -
26 * Copyright (c) 1980, 1983, 1988, 1993
27 * The Regents of the University of California. All rights reserved.
28 *
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
32 * 1. Redistributions of source code must retain the above copyright
33 * notice, this list of conditions and the following disclaimer.
34 * 2. Redistributions in binary form must reproduce the above copyright
35 * notice, this list of conditions and the following disclaimer in the
36 * documentation and/or other materials provided with the distribution.
37 * 3. All advertising materials mentioning features or use of this software
38 * must display the following acknowledgement:
39 * This product includes software developed by the University of
40 * California, Berkeley and its contributors.
41 * 4. Neither the name of the University nor the names of its contributors
42 * may be used to endorse or promote products derived from this software
43 * without specific prior written permission.
44 *
45 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
46 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
49 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55 * SUCH DAMAGE.
56 *
57 * -
58 * Portions Copyright (c) 1993 by Digital Equipment Corporation.
59 *
60 * Permission to use, copy, modify, and distribute this software for any
61 * purpose with or without fee is hereby granted, provided that the above
62 * copyright notice and this permission notice appear in all copies, and that
63 * the name of Digital Equipment Corporation not be used in advertising or
64 * publicity pertaining to distribution of the document or software without
65 * specific, written prior permission.
66 *
67 * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
68 * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
69 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
70 * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
71 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
72 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
73 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
74 * SOFTWARE.
75 * -
76 * --Copyright--
77 */
78
79/*
80 * @(#)netdb.h 8.1 (Berkeley) 6/2/93
81 */
82
83#ifndef _NETDB_H_
84#define _NETDB_H_
85
86#include <_types.h>
87#include <sys/_types/_size_t.h>
88#include <sys/_types/_socklen_t.h>
89
90#include <stdint.h>
91#include <netinet/in.h> /* IPPORT_RESERVED */
92
93#ifndef _PATH_HEQUIV
94# define _PATH_HEQUIV "/etc/hosts.equiv"
95#endif
96#define _PATH_HOSTS "/etc/hosts"
97#define _PATH_NETWORKS "/etc/networks"
98#define _PATH_PROTOCOLS "/etc/protocols"
99#define _PATH_SERVICES "/etc/services"
100
101extern int h_errno;
102
103#ifndef IPPORT_RESERVED
104#define IPPORT_RESERVED __DARWIN_IPPORT_RESERVED
105#endif
106
107/*
108 * Structures returned by network data base library. All addresses are
109 * supplied in host order, and returned in network order (suitable for
110 * use in system calls).
111 */
112struct hostent {
113 char *h_name; /* official name of host */
114 char **h_aliases; /* alias list */
115 int h_addrtype; /* host address type */
116 int h_length; /* length of address */
117 char **h_addr_list; /* list of addresses from name server */
118#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
119#define h_addr h_addr_list[0] /* address, for backward compatibility */
120#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
121};
122
123/*
124 * Assumption here is that a network number
125 * fits in an unsigned long -- probably a poor one.
126 */
127struct netent {
128 char *n_name; /* official name of net */
129 char **n_aliases; /* alias list */
130 int n_addrtype; /* net address type */
131 uint32_t n_net; /* network # */
132};
133
134struct servent {
135 char *s_name; /* official service name */
136 char **s_aliases; /* alias list */
137 int s_port; /* port # */
138 char *s_proto; /* protocol to use */
139};
140
141struct protoent {
142 char *p_name; /* official protocol name */
143 char **p_aliases; /* alias list */
144 int p_proto; /* protocol # */
145};
146
147struct addrinfo {
148 int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
149 int ai_family; /* PF_xxx */
150 int ai_socktype; /* SOCK_xxx */
151 int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
152 socklen_t ai_addrlen; /* length of ai_addr */
153 char *ai_canonname; /* canonical name for hostname */
154 struct sockaddr *ai_addr; /* binary address */
155 struct addrinfo *ai_next; /* next structure in linked list */
156};
157
158#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
159struct rpcent {
160 char *r_name; /* name of server for this rpc program */
161 char **r_aliases; /* alias list */
162 int r_number; /* rpc program number */
163};
164#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
165
166/*
167 * Error return codes from gethostbyname() and gethostbyaddr()
168 * (left in h_errno).
169 */
170#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
171#define NETDB_INTERNAL -1 /* see errno */
172#define NETDB_SUCCESS 0 /* no problem */
173#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
174#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
175#define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL */
176#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
177#define NO_DATA 4 /* Valid name, no data record of requested type */
178#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
179#define NO_ADDRESS NO_DATA /* no address, look for MX record */
180#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
181/*
182 * Error return codes from getaddrinfo()
183 */
184#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
185#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
186#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
187#define EAI_AGAIN 2 /* temporary failure in name resolution */
188#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
189#define EAI_FAIL 4 /* non-recoverable failure in name resolution */
190#define EAI_FAMILY 5 /* ai_family not supported */
191#define EAI_MEMORY 6 /* memory allocation failure */
192#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
193#define EAI_NODATA 7 /* no address associated with hostname */
194#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
195#define EAI_NONAME 8 /* hostname nor servname provided, or not known */
196#define EAI_SERVICE 9 /* servname not supported for ai_socktype */
197#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
198#define EAI_SYSTEM 11 /* system error returned in errno */
199#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
200#define EAI_BADHINTS 12 /* invalid value for hints */
201#define EAI_PROTOCOL 13 /* resolved protocol is unknown */
202#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
203#define EAI_OVERFLOW 14 /* argument buffer overflow */
204#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
205#define EAI_MAX 15
206#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
207
208/*
209 * Flag values for getaddrinfo()
210 */
211#define AI_PASSIVE 0x00000001 /* get address to use bind() */
212#define AI_CANONNAME 0x00000002 /* fill ai_canonname */
213#define AI_NUMERICHOST 0x00000004 /* prevent host name resolution */
214#define AI_NUMERICSERV 0x00001000 /* prevent service name resolution */
215/* valid flags for addrinfo (not a standard def, apps should not use it) */
216#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
217#define AI_MASK \
218 (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \
219 AI_ADDRCONFIG)
220
221#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
222#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
223#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
224#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */
225#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
226#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */
227#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */
228/* special recommended flags for getipnodebyname */
229#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
230#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
231/* If the hints pointer is null or ai_flags is zero, getaddrinfo() automatically defaults to the AI_DEFAULT behavior.
232 * To override this default behavior, thereby causing unusable addresses to be included in the results, pass any nonzero
233 * value for ai_flags, by setting any desired flag values, or by setting AI_UNUSABLE if no other flags are desired. */
234#define AI_UNUSABLE 0x10000000 /* return addresses even if unusable (i.e. opposite of AI_DEFAULT) */
235#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
236
237/*
238 * Constants for getnameinfo()
239 */
240#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
241#define NI_MAXHOST 1025
242#define NI_MAXSERV 32
243#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
244/*
245 * Flag values for getnameinfo()
246 */
247#define NI_NOFQDN 0x00000001
248#define NI_NUMERICHOST 0x00000002
249#define NI_NAMEREQD 0x00000004
250#define NI_NUMERICSERV 0x00000008
251#define NI_NUMERICSCOPE 0x00000100
252#define NI_DGRAM 0x00000010
253#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
254#define NI_WITHSCOPEID 0x00000020
255
256/*
257 * Scope delimit character
258 */
259#define SCOPE_DELIMITER '%'
260#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
261
262__BEGIN_DECLS
263
264void endhostent(void);
265void endnetent(void);
266void endprotoent(void);
267void endservent(void);
268
269void freeaddrinfo(struct addrinfo *);
270const char *gai_strerror(int);
271int getaddrinfo(const char * __restrict, const char * __restrict,
272 const struct addrinfo * __restrict,
273 struct addrinfo ** __restrict);
274struct hostent *gethostbyaddr(const void *, socklen_t, int);
275struct hostent *gethostbyname(const char *);
276struct hostent *gethostent(void);
277int getnameinfo(const struct sockaddr * __restrict, socklen_t,
278 char * __restrict, socklen_t, char * __restrict,
279 socklen_t, int);
280struct netent *getnetbyaddr(uint32_t, int);
281struct netent *getnetbyname(const char *);
282struct netent *getnetent(void);
283struct protoent *getprotobyname(const char *);
284struct protoent *getprotobynumber(int);
285struct protoent *getprotoent(void);
286struct servent *getservbyname(const char *, const char *);
287struct servent *getservbyport(int, const char *);
288struct servent *getservent(void);
289void sethostent(int);
290/* void sethostfile(const char *); */
291void setnetent(int);
292void setprotoent(int);
293void setservent(int);
294
295#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
296void freehostent(struct hostent *);
297struct hostent *gethostbyname2(const char *, int);
298struct hostent *getipnodebyaddr(const void *, size_t, int, int *);
299struct hostent *getipnodebyname(const char *, int, int, int *);
300struct rpcent *getrpcbyname(const char *name);
301#ifdef __LP64__
302struct rpcent *getrpcbynumber(int number);
303#else
304struct rpcent *getrpcbynumber(long number);
305#endif
306struct rpcent *getrpcent(void);
307void setrpcent(int stayopen);
308void endrpcent(void);
309void herror(const char *);
310const char *hstrerror(int);
311int innetgr(const char *, const char *, const char *, const char *);
312int getnetgrent(char **, char **, char **);
313void endnetgrent(void);
314void setnetgrent(const char *);
315#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
316
317__END_DECLS
318
319#endif /* !_NETDB_H_ */
lib/libc/include/x86_64-macos-gnu/netinet/in.h created+671
......@@ -0,0 +1,671 @@
1/*
2 * Copyright (c) 2000-2018 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * Copyright (c) 1982, 1986, 1990, 1993
30 * The Regents of the University of California. All rights reserved.
31 *
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
34 * are met:
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.
40 * 3. All advertising materials mentioning features or use of this software
41 * must display the following acknowledgement:
42 * This product includes software developed by the University of
43 * California, Berkeley and its contributors.
44 * 4. Neither the name of the University nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 *
60 * @(#)in.h 8.3 (Berkeley) 1/3/94
61 * $FreeBSD: src/sys/netinet/in.h,v 1.48.2.2 2001/04/21 14:53:06 ume Exp $
62 */
63
64#ifndef _NETINET_IN_H_
65#define _NETINET_IN_H_
66#include <sys/appleapiopts.h>
67#include <sys/_types.h>
68#include <stdint.h> /* uint(8|16|32)_t */
69
70#include <Availability.h>
71
72#include <sys/_types/_in_addr_t.h>
73
74#include <sys/_types/_in_port_t.h>
75
76/*
77 * POSIX 1003.1-2003
78 * "Inclusion of the <netinet/in.h> header may also make visible all
79 * symbols from <inttypes.h> and <sys/socket.h>".
80 */
81#include <sys/socket.h>
82
83/*
84 * The following two #includes insure htonl and family are defined
85 */
86#include <machine/endian.h>
87#include <sys/_endian.h>
88
89/*
90 * Constants and structures defined by the internet system,
91 * Per RFC 790, September 1981, and numerous additions.
92 */
93
94/*
95 * Protocols (RFC 1700)
96 */
97#define IPPROTO_IP 0 /* dummy for IP */
98#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
99#define IPPROTO_HOPOPTS 0 /* IP6 hop-by-hop options */
100#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
101#define IPPROTO_ICMP 1 /* control message protocol */
102#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
103#define IPPROTO_IGMP 2 /* group mgmt protocol */
104#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
105#define IPPROTO_IPV4 4 /* IPv4 encapsulation */
106#define IPPROTO_IPIP IPPROTO_IPV4 /* for compatibility */
107#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
108#define IPPROTO_TCP 6 /* tcp */
109#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
110#define IPPROTO_ST 7 /* Stream protocol II */
111#define IPPROTO_EGP 8 /* exterior gateway protocol */
112#define IPPROTO_PIGP 9 /* private interior gateway */
113#define IPPROTO_RCCMON 10 /* BBN RCC Monitoring */
114#define IPPROTO_NVPII 11 /* network voice protocol*/
115#define IPPROTO_PUP 12 /* pup */
116#define IPPROTO_ARGUS 13 /* Argus */
117#define IPPROTO_EMCON 14 /* EMCON */
118#define IPPROTO_XNET 15 /* Cross Net Debugger */
119#define IPPROTO_CHAOS 16 /* Chaos*/
120#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
121#define IPPROTO_UDP 17 /* user datagram protocol */
122#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
123#define IPPROTO_MUX 18 /* Multiplexing */
124#define IPPROTO_MEAS 19 /* DCN Measurement Subsystems */
125#define IPPROTO_HMP 20 /* Host Monitoring */
126#define IPPROTO_PRM 21 /* Packet Radio Measurement */
127#define IPPROTO_IDP 22 /* xns idp */
128#define IPPROTO_TRUNK1 23 /* Trunk-1 */
129#define IPPROTO_TRUNK2 24 /* Trunk-2 */
130#define IPPROTO_LEAF1 25 /* Leaf-1 */
131#define IPPROTO_LEAF2 26 /* Leaf-2 */
132#define IPPROTO_RDP 27 /* Reliable Data */
133#define IPPROTO_IRTP 28 /* Reliable Transaction */
134#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */
135#define IPPROTO_BLT 30 /* Bulk Data Transfer */
136#define IPPROTO_NSP 31 /* Network Services */
137#define IPPROTO_INP 32 /* Merit Internodal */
138#define IPPROTO_SEP 33 /* Sequential Exchange */
139#define IPPROTO_3PC 34 /* Third Party Connect */
140#define IPPROTO_IDPR 35 /* InterDomain Policy Routing */
141#define IPPROTO_XTP 36 /* XTP */
142#define IPPROTO_DDP 37 /* Datagram Delivery */
143#define IPPROTO_CMTP 38 /* Control Message Transport */
144#define IPPROTO_TPXX 39 /* TP++ Transport */
145#define IPPROTO_IL 40 /* IL transport protocol */
146#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
147#define IPPROTO_IPV6 41 /* IP6 header */
148#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
149#define IPPROTO_SDRP 42 /* Source Demand Routing */
150#define IPPROTO_ROUTING 43 /* IP6 routing header */
151#define IPPROTO_FRAGMENT 44 /* IP6 fragmentation header */
152#define IPPROTO_IDRP 45 /* InterDomain Routing*/
153#define IPPROTO_RSVP 46 /* resource reservation */
154#define IPPROTO_GRE 47 /* General Routing Encap. */
155#define IPPROTO_MHRP 48 /* Mobile Host Routing */
156#define IPPROTO_BHA 49 /* BHA */
157#define IPPROTO_ESP 50 /* IP6 Encap Sec. Payload */
158#define IPPROTO_AH 51 /* IP6 Auth Header */
159#define IPPROTO_INLSP 52 /* Integ. Net Layer Security */
160#define IPPROTO_SWIPE 53 /* IP with encryption */
161#define IPPROTO_NHRP 54 /* Next Hop Resolution */
162/* 55-57: Unassigned */
163#define IPPROTO_ICMPV6 58 /* ICMP6 */
164#define IPPROTO_NONE 59 /* IP6 no next header */
165#define IPPROTO_DSTOPTS 60 /* IP6 destination option */
166#define IPPROTO_AHIP 61 /* any host internal protocol */
167#define IPPROTO_CFTP 62 /* CFTP */
168#define IPPROTO_HELLO 63 /* "hello" routing protocol */
169#define IPPROTO_SATEXPAK 64 /* SATNET/Backroom EXPAK */
170#define IPPROTO_KRYPTOLAN 65 /* Kryptolan */
171#define IPPROTO_RVD 66 /* Remote Virtual Disk */
172#define IPPROTO_IPPC 67 /* Pluribus Packet Core */
173#define IPPROTO_ADFS 68 /* Any distributed FS */
174#define IPPROTO_SATMON 69 /* Satnet Monitoring */
175#define IPPROTO_VISA 70 /* VISA Protocol */
176#define IPPROTO_IPCV 71 /* Packet Core Utility */
177#define IPPROTO_CPNX 72 /* Comp. Prot. Net. Executive */
178#define IPPROTO_CPHB 73 /* Comp. Prot. HeartBeat */
179#define IPPROTO_WSN 74 /* Wang Span Network */
180#define IPPROTO_PVP 75 /* Packet Video Protocol */
181#define IPPROTO_BRSATMON 76 /* BackRoom SATNET Monitoring */
182#define IPPROTO_ND 77 /* Sun net disk proto (temp.) */
183#define IPPROTO_WBMON 78 /* WIDEBAND Monitoring */
184#define IPPROTO_WBEXPAK 79 /* WIDEBAND EXPAK */
185#define IPPROTO_EON 80 /* ISO cnlp */
186#define IPPROTO_VMTP 81 /* VMTP */
187#define IPPROTO_SVMTP 82 /* Secure VMTP */
188#define IPPROTO_VINES 83 /* Banyon VINES */
189#define IPPROTO_TTP 84 /* TTP */
190#define IPPROTO_IGP 85 /* NSFNET-IGP */
191#define IPPROTO_DGP 86 /* dissimilar gateway prot. */
192#define IPPROTO_TCF 87 /* TCF */
193#define IPPROTO_IGRP 88 /* Cisco/GXS IGRP */
194#define IPPROTO_OSPFIGP 89 /* OSPFIGP */
195#define IPPROTO_SRPC 90 /* Strite RPC protocol */
196#define IPPROTO_LARP 91 /* Locus Address Resoloution */
197#define IPPROTO_MTP 92 /* Multicast Transport */
198#define IPPROTO_AX25 93 /* AX.25 Frames */
199#define IPPROTO_IPEIP 94 /* IP encapsulated in IP */
200#define IPPROTO_MICP 95 /* Mobile Int.ing control */
201#define IPPROTO_SCCSP 96 /* Semaphore Comm. security */
202#define IPPROTO_ETHERIP 97 /* Ethernet IP encapsulation */
203#define IPPROTO_ENCAP 98 /* encapsulation header */
204#define IPPROTO_APES 99 /* any private encr. scheme */
205#define IPPROTO_GMTP 100 /* GMTP*/
206/* 101-252: Partly Unassigned */
207#define IPPROTO_PIM 103 /* Protocol Independent Mcast */
208#define IPPROTO_IPCOMP 108 /* payload compression (IPComp) */
209#define IPPROTO_PGM 113 /* PGM */
210#define IPPROTO_SCTP 132 /* SCTP */
211/* 253-254: Experimentation and testing; 255: Reserved (RFC3692) */
212/* BSD Private, local use, namespace incursion */
213#define IPPROTO_DIVERT 254 /* divert pseudo-protocol */
214#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
215#define IPPROTO_RAW 255 /* raw IP packet */
216
217#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
218#define IPPROTO_MAX 256
219
220/* last return value of *_input(), meaning "all job for this pkt is done". */
221#define IPPROTO_DONE 257
222#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
223
224/*
225 * Local port number conventions:
226 *
227 * When a user does a bind(2) or connect(2) with a port number of zero,
228 * a non-conflicting local port address is chosen.
229 * The default range is IPPORT_RESERVED through
230 * IPPORT_USERRESERVED, although that is settable by sysctl.
231 *
232 * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
233 * default assignment range.
234 *
235 * The value IP_PORTRANGE_DEFAULT causes the default behavior.
236 *
237 * The value IP_PORTRANGE_HIGH changes the range of candidate port numbers
238 * into the "high" range. These are reserved for client outbound connections
239 * which do not want to be filtered by any firewalls.
240 *
241 * The value IP_PORTRANGE_LOW changes the range to the "low" are
242 * that is (by convention) restricted to privileged processes. This
243 * convention is based on "vouchsafe" principles only. It is only secure
244 * if you trust the remote host to restrict these ports.
245 *
246 * The default range of ports and the high range can be changed by
247 * sysctl(3). (net.inet.ip.port{hi,low}{first,last}_auto)
248 *
249 * Changing those values has bad security implications if you are
250 * using a a stateless firewall that is allowing packets outside of that
251 * range in order to allow transparent outgoing connections.
252 *
253 * Such a firewall configuration will generally depend on the use of these
254 * default values. If you change them, you may find your Security
255 * Administrator looking for you with a heavy object.
256 *
257 * For a slightly more orthodox text view on this:
258 *
259 * ftp://ftp.isi.edu/in-notes/iana/assignments/port-numbers
260 *
261 * port numbers are divided into three ranges:
262 *
263 * 0 - 1023 Well Known Ports
264 * 1024 - 49151 Registered Ports
265 * 49152 - 65535 Dynamic and/or Private Ports
266 *
267 */
268
269#define __DARWIN_IPPORT_RESERVED 1024
270
271#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
272/*
273 * Ports < IPPORT_RESERVED are reserved for
274 * privileged processes (e.g. root). (IP_PORTRANGE_LOW)
275 * Ports > IPPORT_USERRESERVED are reserved
276 * for servers, not necessarily privileged. (IP_PORTRANGE_DEFAULT)
277 */
278#ifndef IPPORT_RESERVED
279#define IPPORT_RESERVED __DARWIN_IPPORT_RESERVED
280#endif
281#define IPPORT_USERRESERVED 5000
282
283/*
284 * Default local port range to use by setting IP_PORTRANGE_HIGH
285 */
286#define IPPORT_HIFIRSTAUTO 49152
287#define IPPORT_HILASTAUTO 65535
288
289/*
290 * Scanning for a free reserved port return a value below IPPORT_RESERVED,
291 * but higher than IPPORT_RESERVEDSTART. Traditionally the start value was
292 * 512, but that conflicts with some well-known-services that firewalls may
293 * have a fit if we use.
294 */
295#define IPPORT_RESERVEDSTART 600
296#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
297
298/*
299 * Internet address (a structure for historical reasons)
300 */
301struct in_addr {
302 in_addr_t s_addr;
303};
304
305/*
306 * Definitions of bits in internet address integers.
307 * On subnets, the decomposition of addresses to host and net parts
308 * is done according to subnet mask, not the masks here.
309 */
310#define INADDR_ANY (u_int32_t)0x00000000
311#define INADDR_BROADCAST (u_int32_t)0xffffffff /* must be masked */
312
313#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
314#define IN_CLASSA(i) (((u_int32_t)(i) & 0x80000000) == 0)
315#define IN_CLASSA_NET 0xff000000
316#define IN_CLASSA_NSHIFT 24
317#define IN_CLASSA_HOST 0x00ffffff
318#define IN_CLASSA_MAX 128
319
320#define IN_CLASSB(i) (((u_int32_t)(i) & 0xc0000000) == 0x80000000)
321#define IN_CLASSB_NET 0xffff0000
322#define IN_CLASSB_NSHIFT 16
323#define IN_CLASSB_HOST 0x0000ffff
324#define IN_CLASSB_MAX 65536
325
326#define IN_CLASSC(i) (((u_int32_t)(i) & 0xe0000000) == 0xc0000000)
327#define IN_CLASSC_NET 0xffffff00
328#define IN_CLASSC_NSHIFT 8
329#define IN_CLASSC_HOST 0x000000ff
330
331#define IN_CLASSD(i) (((u_int32_t)(i) & 0xf0000000) == 0xe0000000)
332#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */
333#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */
334#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */
335#define IN_MULTICAST(i) IN_CLASSD(i)
336
337#define IN_EXPERIMENTAL(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
338#define IN_BADCLASS(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
339
340#define INADDR_LOOPBACK (u_int32_t)0x7f000001
341
342#define INADDR_NONE 0xffffffff /* -1 return */
343
344#define INADDR_UNSPEC_GROUP (u_int32_t)0xe0000000 /* 224.0.0.0 */
345#define INADDR_ALLHOSTS_GROUP (u_int32_t)0xe0000001 /* 224.0.0.1 */
346#define INADDR_ALLRTRS_GROUP (u_int32_t)0xe0000002 /* 224.0.0.2 */
347#define INADDR_ALLRPTS_GROUP (u_int32_t)0xe0000016 /* 224.0.0.22, IGMPv3 */
348#define INADDR_CARP_GROUP (u_int32_t)0xe0000012 /* 224.0.0.18 */
349#define INADDR_PFSYNC_GROUP (u_int32_t)0xe00000f0 /* 224.0.0.240 */
350#define INADDR_ALLMDNS_GROUP (u_int32_t)0xe00000fb /* 224.0.0.251 */
351#define INADDR_MAX_LOCAL_GROUP (u_int32_t)0xe00000ff /* 224.0.0.255 */
352
353#ifdef __APPLE__
354#define IN_LINKLOCALNETNUM (u_int32_t)0xA9FE0000 /* 169.254.0.0 */
355#define IN_LINKLOCAL(i) (((u_int32_t)(i) & IN_CLASSB_NET) == IN_LINKLOCALNETNUM)
356#define IN_LOOPBACK(i) (((u_int32_t)(i) & 0xff000000) == 0x7f000000)
357#define IN_ZERONET(i) (((u_int32_t)(i) & 0xff000000) == 0)
358
359#define IN_PRIVATE(i) ((((u_int32_t)(i) & 0xff000000) == 0x0a000000) || \
360 (((u_int32_t)(i) & 0xfff00000) == 0xac100000) || \
361 (((u_int32_t)(i) & 0xffff0000) == 0xc0a80000))
362
363
364#define IN_LOCAL_GROUP(i) (((u_int32_t)(i) & 0xffffff00) == 0xe0000000)
365
366#define IN_ANY_LOCAL(i) (IN_LINKLOCAL(i) || IN_LOCAL_GROUP(i))
367#endif /* __APPLE__ */
368
369#define IN_LOOPBACKNET 127 /* official! */
370#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
371
372/*
373 * Socket address, internet style.
374 */
375struct sockaddr_in {
376 __uint8_t sin_len;
377 sa_family_t sin_family;
378 in_port_t sin_port;
379 struct in_addr sin_addr;
380 char sin_zero[8];
381};
382
383#define IN_ARE_ADDR_EQUAL(a, b) \
384 (bcmp(&(a)->s_addr, &(b)->s_addr, \
385 sizeof (struct in_addr)) == 0)
386
387
388#define INET_ADDRSTRLEN 16
389
390#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
391/*
392 * Structure used to describe IP options.
393 * Used to store options internally, to pass them to a process,
394 * or to restore options retrieved earlier.
395 * The ip_dst is used for the first-hop gateway when using a source route
396 * (this gets put into the header proper).
397 */
398struct ip_opts {
399 struct in_addr ip_dst; /* first hop, 0 w/o src rt */
400 char ip_opts[40]; /* actually variable in size */
401};
402
403/*
404 * Options for use with [gs]etsockopt at the IP level.
405 * First word of comment is data type; bool is stored in int.
406 */
407#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */
408#define IP_HDRINCL 2 /* int; header is included with data */
409#define IP_TOS 3 /* int; IP type of service and preced. */
410#define IP_TTL 4 /* int; IP time to live */
411#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */
412#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */
413#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */
414#define IP_RETOPTS 8 /* ip_opts; set/get IP options */
415#define IP_MULTICAST_IF 9 /* u_char; set/get IP multicast i/f */
416#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */
417#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */
418#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
419#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
420#define IP_MULTICAST_VIF 14 /* set/get IP mcast virt. iface */
421#define IP_RSVP_ON 15 /* enable RSVP in kernel */
422#define IP_RSVP_OFF 16 /* disable RSVP in kernel */
423#define IP_RSVP_VIF_ON 17 /* set RSVP per-vif socket */
424#define IP_RSVP_VIF_OFF 18 /* unset RSVP per-vif socket */
425#define IP_PORTRANGE 19 /* int; range to choose for unspec port */
426#define IP_RECVIF 20 /* bool; receive reception if w/dgram */
427/* for IPSEC */
428#define IP_IPSEC_POLICY 21 /* int; set/get security policy */
429#define IP_FAITH 22 /* deprecated */
430#ifdef __APPLE__
431#define IP_STRIPHDR 23 /* bool: drop receive of raw IP header */
432#endif
433#define IP_RECVTTL 24 /* bool; receive reception TTL w/dgram */
434#define IP_BOUND_IF 25 /* int; set/get bound interface */
435#define IP_PKTINFO 26 /* get pktinfo on recv socket, set src on sent dgram */
436#define IP_RECVPKTINFO IP_PKTINFO /* receive pktinfo w/dgram */
437#define IP_RECVTOS 27 /* bool; receive IP TOS w/dgram */
438
439#define IP_FW_ADD 40 /* add a firewall rule to chain */
440#define IP_FW_DEL 41 /* delete a firewall rule from chain */
441#define IP_FW_FLUSH 42 /* flush firewall rule chain */
442#define IP_FW_ZERO 43 /* clear single/all firewall counter(s) */
443#define IP_FW_GET 44 /* get entire firewall rule chain */
444#define IP_FW_RESETLOG 45 /* reset logging counters */
445
446/* These older firewall socket option codes are maintained for backward compatibility. */
447#define IP_OLD_FW_ADD 50 /* add a firewall rule to chain */
448#define IP_OLD_FW_DEL 51 /* delete a firewall rule from chain */
449#define IP_OLD_FW_FLUSH 52 /* flush firewall rule chain */
450#define IP_OLD_FW_ZERO 53 /* clear single/all firewall counter(s) */
451#define IP_OLD_FW_GET 54 /* get entire firewall rule chain */
452#define IP_NAT__XXX 55 /* set/get NAT opts XXX Deprecated, do not use */
453#define IP_OLD_FW_RESETLOG 56 /* reset logging counters */
454
455#define IP_DUMMYNET_CONFIGURE 60 /* add/configure a dummynet pipe */
456#define IP_DUMMYNET_DEL 61 /* delete a dummynet pipe from chain */
457#define IP_DUMMYNET_FLUSH 62 /* flush dummynet */
458#define IP_DUMMYNET_GET 64 /* get entire dummynet pipes */
459
460#define IP_TRAFFIC_MGT_BACKGROUND 65 /* int*; get background IO flags; set background IO */
461#define IP_MULTICAST_IFINDEX 66 /* int*; set/get IP multicast i/f index */
462
463/* IPv4 Source Filter Multicast API [RFC3678] */
464#define IP_ADD_SOURCE_MEMBERSHIP 70 /* join a source-specific group */
465#define IP_DROP_SOURCE_MEMBERSHIP 71 /* drop a single source */
466#define IP_BLOCK_SOURCE 72 /* block a source */
467#define IP_UNBLOCK_SOURCE 73 /* unblock a source */
468
469/* The following option is private; do not use it from user applications. */
470#define IP_MSFILTER 74 /* set/get filter list */
471
472/* Protocol Independent Multicast API [RFC3678] */
473#define MCAST_JOIN_GROUP 80 /* join an any-source group */
474#define MCAST_LEAVE_GROUP 81 /* leave all sources for group */
475#define MCAST_JOIN_SOURCE_GROUP 82 /* join a source-specific group */
476#define MCAST_LEAVE_SOURCE_GROUP 83 /* leave a single source */
477#define MCAST_BLOCK_SOURCE 84 /* block a source */
478#define MCAST_UNBLOCK_SOURCE 85 /* unblock a source */
479
480
481/*
482 * Defaults and limits for options
483 */
484#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */
485#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
486
487/*
488 * The imo_membership vector for each socket is now dynamically allocated at
489 * run-time, bounded by USHRT_MAX, and is reallocated when needed, sized
490 * according to a power-of-two increment.
491 */
492#define IP_MIN_MEMBERSHIPS 31
493#define IP_MAX_MEMBERSHIPS 4095
494
495/*
496 * Default resource limits for IPv4 multicast source filtering.
497 * These may be modified by sysctl.
498 */
499#define IP_MAX_GROUP_SRC_FILTER 512 /* sources per group */
500#define IP_MAX_SOCK_SRC_FILTER 128 /* sources per socket/group */
501#define IP_MAX_SOCK_MUTE_FILTER 128 /* XXX no longer used */
502
503/*
504 * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
505 */
506struct ip_mreq {
507 struct in_addr imr_multiaddr; /* IP multicast address of group */
508 struct in_addr imr_interface; /* local IP address of interface */
509};
510
511/*
512 * Modified argument structure for IP_MULTICAST_IF, obtained from Linux.
513 * This is used to specify an interface index for multicast sends, as
514 * the IPv4 legacy APIs do not support this (unless IP_SENDIF is available).
515 */
516struct ip_mreqn {
517 struct in_addr imr_multiaddr; /* IP multicast address of group */
518 struct in_addr imr_address; /* local IP address of interface */
519 int imr_ifindex; /* Interface index; cast to uint32_t */
520};
521
522#pragma pack(4)
523/*
524 * Argument structure for IPv4 Multicast Source Filter APIs. [RFC3678]
525 */
526struct ip_mreq_source {
527 struct in_addr imr_multiaddr; /* IP multicast address of group */
528 struct in_addr imr_sourceaddr; /* IP address of source */
529 struct in_addr imr_interface; /* local IP address of interface */
530};
531
532/*
533 * Argument structures for Protocol-Independent Multicast Source
534 * Filter APIs. [RFC3678]
535 */
536struct group_req {
537 uint32_t gr_interface; /* interface index */
538 struct sockaddr_storage gr_group; /* group address */
539};
540
541struct group_source_req {
542 uint32_t gsr_interface; /* interface index */
543 struct sockaddr_storage gsr_group; /* group address */
544 struct sockaddr_storage gsr_source; /* source address */
545};
546
547#ifndef __MSFILTERREQ_DEFINED
548#define __MSFILTERREQ_DEFINED
549/*
550 * The following structure is private; do not use it from user applications.
551 * It is used to communicate IP_MSFILTER/IPV6_MSFILTER information between
552 * the RFC 3678 libc functions and the kernel.
553 */
554struct __msfilterreq {
555 uint32_t msfr_ifindex; /* interface index */
556 uint32_t msfr_fmode; /* filter mode for group */
557 uint32_t msfr_nsrcs; /* # of sources in msfr_srcs */
558 uint32_t __msfr_align;
559 struct sockaddr_storage msfr_group; /* group address */
560 struct sockaddr_storage *msfr_srcs;
561};
562
563#endif /* __MSFILTERREQ_DEFINED */
564
565#pragma pack()
566struct sockaddr;
567
568/*
569 * Advanced (Full-state) APIs [RFC3678]
570 * The RFC specifies uint_t for the 6th argument to [sg]etsourcefilter().
571 * We use uint32_t here to be consistent.
572 */
573int setipv4sourcefilter(int, struct in_addr, struct in_addr, uint32_t,
574 uint32_t, struct in_addr *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
575int getipv4sourcefilter(int, struct in_addr, struct in_addr, uint32_t *,
576 uint32_t *, struct in_addr *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
577int setsourcefilter(int, uint32_t, struct sockaddr *, socklen_t,
578 uint32_t, uint32_t, struct sockaddr_storage *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
579int getsourcefilter(int, uint32_t, struct sockaddr *, socklen_t,
580 uint32_t *, uint32_t *, struct sockaddr_storage *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
581
582/*
583 * Filter modes; also used to represent per-socket filter mode internally.
584 */
585#define MCAST_UNDEFINED 0 /* fmode: not yet defined */
586#define MCAST_INCLUDE 1 /* fmode: include these source(s) */
587#define MCAST_EXCLUDE 2 /* fmode: exclude these source(s) */
588
589/*
590 * Argument for IP_PORTRANGE:
591 * - which range to search when port is unspecified at bind() or connect()
592 */
593#define IP_PORTRANGE_DEFAULT 0 /* default range */
594#define IP_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */
595#define IP_PORTRANGE_LOW 2 /* "low" - vouchsafe security */
596
597
598/*
599 * IP_PKTINFO: Packet information (equivalent to RFC2292 sec 5 for IPv4)
600 * This structure is used for
601 *
602 * 1) Receiving ancilliary data about the datagram if IP_PKTINFO sockopt is
603 * set on the socket. In this case ipi_ifindex will contain the interface
604 * index the datagram was received on, ipi_addr is the IP address the
605 * datagram was received to.
606 *
607 * 2) Sending a datagram using a specific interface or IP source address.
608 * if ipi_ifindex is set to non-zero when in_pktinfo is passed as
609 * ancilliary data of type IP_PKTINFO, this will be used as the source
610 * interface to send the datagram from. If ipi_ifindex is null, ip_spec_dst
611 * will be used for the source address.
612 *
613 * Note: if IP_BOUND_IF is set on the socket, ipi_ifindex in the ancillary
614 * IP_PKTINFO option silently overrides the bound interface when it is
615 * specified during send time.
616 */
617struct in_pktinfo {
618 unsigned int ipi_ifindex; /* send/recv interface index */
619 struct in_addr ipi_spec_dst; /* Local address */
620 struct in_addr ipi_addr; /* IP Header dst address */
621};
622
623/*
624 * Definitions for inet sysctl operations.
625 *
626 * Third level is protocol number.
627 * Fourth level is desired variable within that protocol.
628 */
629#define IPPROTO_MAXID (IPPROTO_AH + 1) /* don't list to IPPROTO_MAX */
630
631
632/*
633 * Names for IP sysctl objects
634 */
635#define IPCTL_FORWARDING 1 /* act as router */
636#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */
637#define IPCTL_DEFTTL 3 /* default TTL */
638#ifdef notyet
639#define IPCTL_DEFMTU 4 /* default MTU */
640#endif
641#define IPCTL_RTEXPIRE 5 /* cloned route expiration time */
642#define IPCTL_RTMINEXPIRE 6 /* min value for expiration time */
643#define IPCTL_RTMAXCACHE 7 /* trigger level for dynamic expire */
644#define IPCTL_SOURCEROUTE 8 /* may perform source routes */
645#define IPCTL_DIRECTEDBROADCAST 9 /* may re-broadcast received packets */
646#define IPCTL_INTRQMAXLEN 10 /* max length of netisr queue */
647#define IPCTL_INTRQDROPS 11 /* number of netisr q drops */
648#define IPCTL_STATS 12 /* ipstat structure */
649#define IPCTL_ACCEPTSOURCEROUTE 13 /* may accept source routed packets */
650#define IPCTL_FASTFORWARDING 14 /* use fast IP forwarding code */
651#define IPCTL_KEEPFAITH 15 /* deprecated */
652#define IPCTL_GIF_TTL 16 /* default TTL for gif encap packet */
653#define IPCTL_MAXID 17
654
655#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
656
657/* INET6 stuff */
658#define __KAME_NETINET_IN_H_INCLUDED_
659#include <netinet6/in6.h>
660#undef __KAME_NETINET_IN_H_INCLUDED_
661
662
663
664#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
665__BEGIN_DECLS
666int bindresvport(int, struct sockaddr_in *);
667struct sockaddr;
668int bindresvport_sa(int, struct sockaddr *);
669__END_DECLS
670#endif
671#endif /* _NETINET_IN_H_ */
lib/libc/include/x86_64-macos-gnu/netinet/tcp.h created+283
......@@ -0,0 +1,283 @@
1/*
2 * Copyright (c) 2000-2018 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * Copyright (c) 1982, 1986, 1993
30 * The Regents of the University of California. All rights reserved.
31 *
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
34 * are met:
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.
40 * 3. All advertising materials mentioning features or use of this software
41 * must display the following acknowledgement:
42 * This product includes software developed by the University of
43 * California, Berkeley and its contributors.
44 * 4. Neither the name of the University nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 *
60 * @(#)tcp.h 8.1 (Berkeley) 6/10/93
61 * $FreeBSD: src/sys/netinet/tcp.h,v 1.13.2.3 2001/03/01 22:08:42 jlemon Exp $
62 */
63
64#ifndef _NETINET_TCP_H_
65#define _NETINET_TCP_H_
66#include <sys/types.h>
67#include <sys/appleapiopts.h>
68#include <machine/endian.h>
69#include <machine/types.h> /* __uint32_t */
70
71#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
72typedef __uint32_t tcp_seq;
73typedef __uint32_t tcp_cc; /* connection count per rfc1644 */
74
75#define tcp6_seq tcp_seq /* for KAME src sync over BSD*'s */
76#define tcp6hdr tcphdr /* for KAME src sync over BSD*'s */
77
78/*
79 * TCP header.
80 * Per RFC 793, September, 1981.
81 */
82struct tcphdr {
83 unsigned short th_sport; /* source port */
84 unsigned short th_dport; /* destination port */
85 tcp_seq th_seq; /* sequence number */
86 tcp_seq th_ack; /* acknowledgement number */
87#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
88 unsigned int th_x2:4, /* (unused) */
89 th_off:4; /* data offset */
90#endif
91#if __DARWIN_BYTE_ORDER == __DARWIN_BIG_ENDIAN
92 unsigned int th_off:4, /* data offset */
93 th_x2:4; /* (unused) */
94#endif
95 unsigned char th_flags;
96#define TH_FIN 0x01
97#define TH_SYN 0x02
98#define TH_RST 0x04
99#define TH_PUSH 0x08
100#define TH_ACK 0x10
101#define TH_URG 0x20
102#define TH_ECE 0x40
103#define TH_CWR 0x80
104#define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG|TH_ECE|TH_CWR)
105#define TH_ACCEPT (TH_FIN|TH_SYN|TH_RST|TH_ACK)
106
107 unsigned short th_win; /* window */
108 unsigned short th_sum; /* checksum */
109 unsigned short th_urp; /* urgent pointer */
110};
111
112#define TCPOPT_EOL 0
113#define TCPOPT_NOP 1
114#define TCPOPT_MAXSEG 2
115#define TCPOLEN_MAXSEG 4
116#define TCPOPT_WINDOW 3
117#define TCPOLEN_WINDOW 3
118#define TCPOPT_SACK_PERMITTED 4 /* Experimental */
119#define TCPOLEN_SACK_PERMITTED 2
120#define TCPOPT_SACK 5 /* Experimental */
121#define TCPOLEN_SACK 8 /* len of sack block */
122#define TCPOPT_TIMESTAMP 8
123#define TCPOLEN_TIMESTAMP 10
124#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
125#define TCPOPT_TSTAMP_HDR \
126 (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
127
128#define MAX_TCPOPTLEN 40 /* Absolute maximum TCP options len */
129
130#define TCPOPT_CC 11 /* CC options: RFC-1644 */
131#define TCPOPT_CCNEW 12
132#define TCPOPT_CCECHO 13
133#define TCPOLEN_CC 6
134#define TCPOLEN_CC_APPA (TCPOLEN_CC+2)
135#define TCPOPT_CC_HDR(ccopt) \
136 (TCPOPT_NOP<<24|TCPOPT_NOP<<16|(ccopt)<<8|TCPOLEN_CC)
137#define TCPOPT_SIGNATURE 19 /* Keyed MD5: RFC 2385 */
138#define TCPOLEN_SIGNATURE 18
139#if MPTCP
140#define TCPOPT_MULTIPATH 30
141#endif
142
143#define TCPOPT_FASTOPEN 34
144#define TCPOLEN_FASTOPEN_REQ 2
145
146/* Option definitions */
147#define TCPOPT_SACK_PERMIT_HDR \
148(TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_SACK_PERMITTED<<8|TCPOLEN_SACK_PERMITTED)
149#define TCPOPT_SACK_HDR (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_SACK<<8)
150/* Miscellaneous constants */
151#define MAX_SACK_BLKS 6 /* Max # SACK blocks stored at sender side */
152
153/*
154 * A SACK option that specifies n blocks will have a length of (8*n + 2)
155 * bytes, so the 40 bytes available for TCP options can specify a
156 * maximum of 4 blocks.
157 */
158
159#define TCP_MAX_SACK 4 /* MAX # SACKs sent in any segment */
160
161
162/*
163 * Default maximum segment size for TCP.
164 * With an IP MTU of 576, this is 536,
165 * but 512 is probably more convenient.
166 * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)).
167 */
168#define TCP_MSS 512
169
170/*
171 * TCP_MINMSS is defined to be 216 which is fine for the smallest
172 * link MTU (256 bytes, SLIP interface) in the Internet.
173 * However it is very unlikely to come across such low MTU interfaces
174 * these days (anno dato 2004).
175 * Probably it can be set to 512 without ill effects. But we play safe.
176 * See tcp_subr.c tcp_minmss SYSCTL declaration for more comments.
177 * Setting this to "0" disables the minmss check.
178 */
179#define TCP_MINMSS 216
180
181/*
182 * Default maximum segment size for TCP6.
183 * With an IP6 MSS of 1280, this is 1220,
184 * but 1024 is probably more convenient. (xxx kazu in doubt)
185 * This should be defined as MIN(1024, IP6_MSS - sizeof (struct tcpip6hdr))
186 */
187#define TCP6_MSS 1024
188
189#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */
190#define TTCP_CLIENT_SND_WND 4096 /* dflt send window for T/TCP client */
191
192#define TCP_MAX_WINSHIFT 14 /* maximum window shift */
193
194#define TCP_MAXHLEN (0xf<<2) /* max length of header in bytes */
195#define TCP_MAXOLEN (TCP_MAXHLEN - sizeof(struct tcphdr))
196/* max space left for options */
197#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
198
199/*
200 * User-settable options (used with setsockopt).
201 */
202#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
203#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
204#define TCP_MAXSEG 0x02 /* set maximum segment size */
205#define TCP_NOPUSH 0x04 /* don't push last block of write */
206#define TCP_NOOPT 0x08 /* don't use TCP options */
207#define TCP_KEEPALIVE 0x10 /* idle time used when SO_KEEPALIVE is enabled */
208#define TCP_CONNECTIONTIMEOUT 0x20 /* connection timeout */
209#define PERSIST_TIMEOUT 0x40 /* time after which a connection in
210 * persist timeout will terminate.
211 * see draft-ananth-tcpm-persist-02.txt
212 */
213#define TCP_RXT_CONNDROPTIME 0x80 /* time after which tcp retransmissions will be
214 * stopped and the connection will be dropped
215 */
216#define TCP_RXT_FINDROP 0x100 /* when this option is set, drop a connection
217 * after retransmitting the FIN 3 times. It will
218 * prevent holding too many mbufs in socket
219 * buffer queues.
220 */
221#define TCP_KEEPINTVL 0x101 /* interval between keepalives */
222#define TCP_KEEPCNT 0x102 /* number of keepalives before close */
223#define TCP_SENDMOREACKS 0x103 /* always ack every other packet */
224#define TCP_ENABLE_ECN 0x104 /* Enable ECN on a connection */
225#define TCP_FASTOPEN 0x105 /* Enable/Disable TCP Fastopen on this socket */
226#define TCP_CONNECTION_INFO 0x106 /* State of TCP connection */
227
228
229
230#define TCP_NOTSENT_LOWAT 0x201 /* Low water mark for TCP unsent data */
231
232
233struct tcp_connection_info {
234 u_int8_t tcpi_state; /* connection state */
235 u_int8_t tcpi_snd_wscale; /* Window scale for send window */
236 u_int8_t tcpi_rcv_wscale; /* Window scale for receive window */
237 u_int8_t __pad1;
238 u_int32_t tcpi_options; /* TCP options supported */
239#define TCPCI_OPT_TIMESTAMPS 0x00000001 /* Timestamps enabled */
240#define TCPCI_OPT_SACK 0x00000002 /* SACK enabled */
241#define TCPCI_OPT_WSCALE 0x00000004 /* Window scaling enabled */
242#define TCPCI_OPT_ECN 0x00000008 /* ECN enabled */
243 u_int32_t tcpi_flags; /* flags */
244#define TCPCI_FLAG_LOSSRECOVERY 0x00000001
245#define TCPCI_FLAG_REORDERING_DETECTED 0x00000002
246 u_int32_t tcpi_rto; /* retransmit timeout in ms */
247 u_int32_t tcpi_maxseg; /* maximum segment size supported */
248 u_int32_t tcpi_snd_ssthresh; /* slow start threshold in bytes */
249 u_int32_t tcpi_snd_cwnd; /* send congestion window in bytes */
250 u_int32_t tcpi_snd_wnd; /* send widnow in bytes */
251 u_int32_t tcpi_snd_sbbytes; /* bytes in send socket buffer, including in-flight data */
252 u_int32_t tcpi_rcv_wnd; /* receive window in bytes*/
253 u_int32_t tcpi_rttcur; /* most recent RTT in ms */
254 u_int32_t tcpi_srtt; /* average RTT in ms */
255 u_int32_t tcpi_rttvar; /* RTT variance */
256 u_int32_t
257 tcpi_tfo_cookie_req:1, /* Cookie requested? */
258 tcpi_tfo_cookie_rcv:1, /* Cookie received? */
259 tcpi_tfo_syn_loss:1, /* Fallback to reg. TCP after SYN-loss */
260 tcpi_tfo_syn_data_sent:1, /* SYN+data has been sent out */
261 tcpi_tfo_syn_data_acked:1, /* SYN+data has been fully acknowledged */
262 tcpi_tfo_syn_data_rcv:1, /* Server received SYN+data with a valid cookie */
263 tcpi_tfo_cookie_req_rcv:1, /* Server received cookie-request */
264 tcpi_tfo_cookie_sent:1, /* Server announced cookie */
265 tcpi_tfo_cookie_invalid:1, /* Server received an invalid cookie */
266 tcpi_tfo_cookie_wrong:1, /* Our sent cookie was wrong */
267 tcpi_tfo_no_cookie_rcv:1, /* We did not receive a cookie upon our request */
268 tcpi_tfo_heuristics_disable:1, /* TFO-heuristics disabled it */
269 tcpi_tfo_send_blackhole:1, /* A sending-blackhole got detected */
270 tcpi_tfo_recv_blackhole:1, /* A receiver-blackhole got detected */
271 tcpi_tfo_onebyte_proxy:1, /* A proxy acknowledges all but one byte of the SYN */
272 __pad2:17;
273 u_int64_t tcpi_txpackets __attribute__((aligned(8)));
274 u_int64_t tcpi_txbytes __attribute__((aligned(8)));
275 u_int64_t tcpi_txretransmitbytes __attribute__((aligned(8)));
276 u_int64_t tcpi_rxpackets __attribute__((aligned(8)));
277 u_int64_t tcpi_rxbytes __attribute__((aligned(8)));
278 u_int64_t tcpi_rxoutoforderbytes __attribute__((aligned(8)));
279 u_int64_t tcpi_txretransmitpackets __attribute__((aligned(8)));
280};
281#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
282
283#endif
lib/libc/include/x86_64-macos-gnu/netinet6/in6.h created+667
......@@ -0,0 +1,667 @@
1/*
2 * Copyright (c) 2008-2018 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29/*
30 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
31 * All rights reserved.
32 *
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
35 * are met:
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in the
40 * documentation and/or other materials provided with the distribution.
41 * 3. Neither the name of the project nor the names of its contributors
42 * may be used to endorse or promote products derived from this software
43 * without specific prior written permission.
44 *
45 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
46 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
49 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55 * SUCH DAMAGE.
56 */
57
58/*
59 * Copyright (c) 1982, 1986, 1990, 1993
60 * The Regents of the University of California. All rights reserved.
61 *
62 * Redistribution and use in source and binary forms, with or without
63 * modification, are permitted provided that the following conditions
64 * are met:
65 * 1. Redistributions of source code must retain the above copyright
66 * notice, this list of conditions and the following disclaimer.
67 * 2. Redistributions in binary form must reproduce the above copyright
68 * notice, this list of conditions and the following disclaimer in the
69 * documentation and/or other materials provided with the distribution.
70 * 3. All advertising materials mentioning features or use of this software
71 * must display the following acknowledgement:
72 * This product includes software developed by the University of
73 * California, Berkeley and its contributors.
74 * 4. Neither the name of the University nor the names of its contributors
75 * may be used to endorse or promote products derived from this software
76 * without specific prior written permission.
77 *
78 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
79 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
80 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
81 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
82 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
83 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
84 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
85 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
86 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
87 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
88 * SUCH DAMAGE.
89 *
90 * @(#)in.h 8.3 (Berkeley) 1/3/94
91 */
92
93#ifndef __KAME_NETINET_IN_H_INCLUDED_
94#error "do not include netinet6/in6.h directly, include netinet/in.h. " \
95 " see RFC2553"
96#endif
97
98#ifndef _NETINET6_IN6_H_
99#define _NETINET6_IN6_H_
100#include <sys/appleapiopts.h>
101#include <sys/_types.h>
102#include <sys/_types/_sa_family_t.h>
103
104/*
105 * Identification of the network protocol stack
106 * for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE
107 * has the table of implementation/integration differences.
108 */
109#define __KAME__
110#define __KAME_VERSION "2009/apple-darwin"
111
112#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
113/*
114 * Local port number conventions:
115 *
116 * Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),
117 * unless a kernel is compiled with IPNOPRIVPORTS defined.
118 *
119 * When a user does a bind(2) or connect(2) with a port number of zero,
120 * a non-conflicting local port address is chosen.
121 *
122 * The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although
123 * that is settable by sysctl(3); net.inet.ip.anonportmin and
124 * net.inet.ip.anonportmax respectively.
125 *
126 * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
127 * default assignment range.
128 *
129 * The value IP_PORTRANGE_DEFAULT causes the default behavior.
130 *
131 * The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,
132 * and exists only for FreeBSD compatibility purposes.
133 *
134 * The value IP_PORTRANGE_LOW changes the range to the "low" are
135 * that is (by convention) restricted to privileged processes.
136 * This convention is based on "vouchsafe" principles only.
137 * It is only secure if you trust the remote host to restrict these ports.
138 * The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.
139 */
140
141#define IPV6PORT_RESERVED 1024
142#define IPV6PORT_ANONMIN 49152
143#define IPV6PORT_ANONMAX 65535
144#define IPV6PORT_RESERVEDMIN 600
145#define IPV6PORT_RESERVEDMAX (IPV6PORT_RESERVED-1)
146#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
147
148/*
149 * IPv6 address
150 */
151typedef struct in6_addr {
152 union {
153 __uint8_t __u6_addr8[16];
154 __uint16_t __u6_addr16[8];
155 __uint32_t __u6_addr32[4];
156 } __u6_addr; /* 128-bit IP6 address */
157} in6_addr_t;
158
159#define s6_addr __u6_addr.__u6_addr8
160
161#define INET6_ADDRSTRLEN 46
162
163/*
164 * Socket address for IPv6
165 */
166#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
167#define SIN6_LEN
168#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
169struct sockaddr_in6 {
170 __uint8_t sin6_len; /* length of this struct(sa_family_t) */
171 sa_family_t sin6_family; /* AF_INET6 (sa_family_t) */
172 in_port_t sin6_port; /* Transport layer port # (in_port_t) */
173 __uint32_t sin6_flowinfo; /* IP6 flow information */
174 struct in6_addr sin6_addr; /* IP6 address */
175 __uint32_t sin6_scope_id; /* scope zone index */
176};
177
178
179
180
181/*
182 * Definition of some useful macros to handle IP6 addresses
183 */
184#define IN6ADDR_ANY_INIT \
185 {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
187#define IN6ADDR_LOOPBACK_INIT \
188 {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
190#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
191#define IN6ADDR_NODELOCAL_ALLNODES_INIT \
192 {{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
193 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
194#define IN6ADDR_INTFACELOCAL_ALLNODES_INIT \
195 {{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
196 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
197#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
198 {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
199 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
200#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
201 {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
202 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
203#define IN6ADDR_LINKLOCAL_ALLV2ROUTERS_INIT \
204 {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
205 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16 }}}
206#define IN6ADDR_V4MAPPED_INIT \
207 {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
208 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}
209#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
210
211extern const struct in6_addr in6addr_any;
212extern const struct in6_addr in6addr_loopback;
213#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
214extern const struct in6_addr in6addr_nodelocal_allnodes;
215extern const struct in6_addr in6addr_linklocal_allnodes;
216extern const struct in6_addr in6addr_linklocal_allrouters;
217extern const struct in6_addr in6addr_linklocal_allv2routers;
218#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
219
220/*
221 * Equality
222 * NOTE: Some of kernel programming environment (for example, openbsd/sparc)
223 * does not supply memcmp(). For userland memcmp() is preferred as it is
224 * in ANSI standard.
225 */
226#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
227#define IN6_ARE_ADDR_EQUAL(a, b) \
228 (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof (struct in6_addr)) \
229 == 0)
230#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
231
232
233/*
234 * Unspecified
235 */
236#define IN6_IS_ADDR_UNSPECIFIED(a) \
237 ((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
238 (*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
239 (*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
240 (*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) == 0))
241
242/*
243 * Loopback
244 */
245#define IN6_IS_ADDR_LOOPBACK(a) \
246 ((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
247 (*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
248 (*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
249 (*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(1)))
250
251/*
252 * IPv4 compatible
253 */
254#define IN6_IS_ADDR_V4COMPAT(a) \
255 ((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
256 (*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
257 (*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
258 (*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) != 0) && \
259 (*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) != ntohl(1)))
260
261/*
262 * Mapped
263 */
264#define IN6_IS_ADDR_V4MAPPED(a) \
265 ((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
266 (*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
267 (*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == \
268 ntohl(0x0000ffff)))
269
270/*
271 * 6to4
272 */
273#define IN6_IS_ADDR_6TO4(x) (ntohs((x)->s6_addr16[0]) == 0x2002)
274
275/*
276 * KAME Scope Values
277 */
278
279#define __IPV6_ADDR_SCOPE_NODELOCAL 0x01
280#define __IPV6_ADDR_SCOPE_INTFACELOCAL 0x01
281#define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02
282#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05
283#define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */
284#define __IPV6_ADDR_SCOPE_GLOBAL 0x0e
285
286/*
287 * Unicast Scope
288 * Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).
289 */
290#define IN6_IS_ADDR_LINKLOCAL(a) \
291 (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
292#define IN6_IS_ADDR_SITELOCAL(a) \
293 (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
294
295/*
296 * Multicast
297 */
298#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff)
299
300/*
301 * Unique Local IPv6 Unicast Addresses (per RFC 4193)
302 */
303#define IN6_IS_ADDR_UNIQUE_LOCAL(a) \
304 (((a)->s6_addr[0] == 0xfc) || ((a)->s6_addr[0] == 0xfd))
305
306#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
307
308/*
309 * Multicast Scope
310 */
311#define IN6_IS_ADDR_MC_NODELOCAL(a) \
312 (IN6_IS_ADDR_MULTICAST(a) && \
313 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))
314#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
315 (IN6_IS_ADDR_MULTICAST(a) && \
316 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL))
317#define IN6_IS_ADDR_MC_SITELOCAL(a) \
318 (IN6_IS_ADDR_MULTICAST(a) && \
319 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
320#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
321 (IN6_IS_ADDR_MULTICAST(a) && \
322 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
323#define IN6_IS_ADDR_MC_GLOBAL(a) \
324 (IN6_IS_ADDR_MULTICAST(a) && \
325 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))
326
327
328
329
330/*
331 * Options for use with [gs]etsockopt at the IPV6 level.
332 * First word of comment is data type; bool is stored in int.
333 */
334/* no hdrincl */
335#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
336/*
337 * RFC 3542 define the following socket options in a manner incompatible
338 * with RFC 2292:
339 * IPV6_PKTINFO
340 * IPV6_HOPLIMIT
341 * IPV6_NEXTHOP
342 * IPV6_HOPOPTS
343 * IPV6_DSTOPTS
344 * IPV6_RTHDR
345 *
346 * To use the new IPv6 Sockets options introduced by RFC 3542
347 * the constant __APPLE_USE_RFC_3542 must be defined before
348 * including <netinet/in.h>
349 *
350 * To use the old IPv6 Sockets options from RFC 2292
351 * the constant __APPLE_USE_RFC_2292 must be defined before
352 * including <netinet/in.h>
353 *
354 * Note that eventually RFC 3542 is going to be the
355 * default and RFC 2292 will be obsolete.
356 */
357
358#if defined(__APPLE_USE_RFC_3542) && defined(__APPLE_USE_RFC_2292)
359#error "__APPLE_USE_RFC_3542 and __APPLE_USE_RFC_2292 cannot be both defined"
360#endif
361
362#if 0 /* the followings are relic in IPv4 and hence are disabled */
363#define IPV6_OPTIONS 1 /* buf/ip6_opts; set/get IP6 options */
364#define IPV6_RECVOPTS 5 /* bool; receive all IP6 opts w/dgram */
365#define IPV6_RECVRETOPTS 6 /* bool; receive IP6 opts for response */
366#define IPV6_RECVDSTADDR 7 /* bool; receive IP6 dst addr w/dgram */
367#define IPV6_RETOPTS 8 /* ip6_opts; set/get IP6 options */
368#endif /* 0 */
369#define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */
370#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
371#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */
372#define IPV6_MULTICAST_IF 9 /* __uint8_t; set/get IP6 multicast i/f */
373#define IPV6_MULTICAST_HOPS 10 /* __uint8_t; set/get IP6 multicast hops */
374#define IPV6_MULTICAST_LOOP 11 /* __uint8_t; set/get IP6 mcast loopback */
375#define IPV6_JOIN_GROUP 12 /* ip6_mreq; join a group membership */
376#define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */
377
378#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
379#define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */
380#define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */
381#define IPV6_2292PKTINFO 19 /* bool; send/recv if, src/dst addr */
382#define IPV6_2292HOPLIMIT 20 /* bool; hop limit */
383#define IPV6_2292NEXTHOP 21 /* bool; next hop addr */
384#define IPV6_2292HOPOPTS 22 /* bool; hop-by-hop option */
385#define IPV6_2292DSTOPTS 23 /* bool; destinaion option */
386#define IPV6_2292RTHDR 24 /* ip6_rthdr: routing header */
387
388/* buf/cmsghdr; set/get IPv6 options [obsoleted by RFC3542] */
389#define IPV6_2292PKTOPTIONS 25
390
391#ifdef __APPLE_USE_RFC_2292
392#define IPV6_PKTINFO IPV6_2292PKTINFO
393#define IPV6_HOPLIMIT IPV6_2292HOPLIMIT
394#define IPV6_NEXTHOP IPV6_2292NEXTHOP
395#define IPV6_HOPOPTS IPV6_2292HOPOPTS
396#define IPV6_DSTOPTS IPV6_2292DSTOPTS
397#define IPV6_RTHDR IPV6_2292RTHDR
398#define IPV6_PKTOPTIONS IPV6_2292PKTOPTIONS
399#endif /* __APPLE_USE_RFC_2292 */
400
401#define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */
402#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
403#define IPV6_V6ONLY 27 /* bool; only bind INET6 at wildcard bind */
404#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
405#define IPV6_BINDV6ONLY IPV6_V6ONLY
406
407
408#if 1 /* IPSEC */
409#define IPV6_IPSEC_POLICY 28 /* struct; get/set security policy */
410#endif /* 1 */
411#define IPV6_FAITH 29 /* deprecated */
412
413#if 1 /* IPV6FIREWALL */
414#define IPV6_FW_ADD 30 /* add a firewall rule to chain */
415#define IPV6_FW_DEL 31 /* delete a firewall rule from chain */
416#define IPV6_FW_FLUSH 32 /* flush firewall rule chain */
417#define IPV6_FW_ZERO 33 /* clear single/all firewall counter(s) */
418#define IPV6_FW_GET 34 /* get entire firewall rule chain */
419#endif /* 1 */
420
421/*
422 * APPLE: NOTE the value of those 2 options is kept unchanged from
423 * previous version of darwin/OS X for binary compatibility reasons
424 * and differ from FreeBSD (values 57 and 61). See below.
425 */
426#define IPV6_RECVTCLASS 35 /* bool; recv traffic class values */
427#define IPV6_TCLASS 36 /* int; send traffic class value */
428
429#ifdef __APPLE_USE_RFC_3542
430/* new socket options introduced in RFC3542 */
431/*
432 * ip6_dest; send dst option before rthdr
433 * APPLE: Value purposely different than FreeBSD (35) to avoid
434 * collision with definition of IPV6_RECVTCLASS in previous
435 * darwin implementations
436 */
437#define IPV6_RTHDRDSTOPTS 57
438
439/*
440 * bool; recv if, dst addr
441 * APPLE: Value purposely different than FreeBSD(36) to avoid
442 * collision with definition of IPV6_TCLASS in previous
443 * darwin implementations
444 */
445#define IPV6_RECVPKTINFO 61
446
447#define IPV6_RECVHOPLIMIT 37 /* bool; recv hop limit */
448#define IPV6_RECVRTHDR 38 /* bool; recv routing header */
449#define IPV6_RECVHOPOPTS 39 /* bool; recv hop-by-hop option */
450#define IPV6_RECVDSTOPTS 40 /* bool; recv dst option after rthdr */
451
452#define IPV6_USE_MIN_MTU 42 /* bool; send packets at the minimum MTU */
453#define IPV6_RECVPATHMTU 43 /* bool; notify an according MTU */
454
455/*
456 * mtuinfo; get the current path MTU (sopt), 4 bytes int;
457 * MTU notification (cmsg)
458 */
459#define IPV6_PATHMTU 44
460
461#if 0 /* obsoleted during 2292bis -> 3542 */
462/* no data; ND reachability confirm (cmsg only/not in of RFC3542) */
463#define IPV6_REACHCONF 45
464#endif
465/* more new socket options introduced in RFC3542 */
466#define IPV6_3542PKTINFO 46 /* in6_pktinfo; send if, src addr */
467#define IPV6_3542HOPLIMIT 47 /* int; send hop limit */
468#define IPV6_3542NEXTHOP 48 /* sockaddr; next hop addr */
469#define IPV6_3542HOPOPTS 49 /* ip6_hbh; send hop-by-hop option */
470#define IPV6_3542DSTOPTS 50 /* ip6_dest; send dst option befor rthdr */
471#define IPV6_3542RTHDR 51 /* ip6_rthdr; send routing header */
472
473#define IPV6_PKTINFO IPV6_3542PKTINFO
474#define IPV6_HOPLIMIT IPV6_3542HOPLIMIT
475#define IPV6_NEXTHOP IPV6_3542NEXTHOP
476#define IPV6_HOPOPTS IPV6_3542HOPOPTS
477#define IPV6_DSTOPTS IPV6_3542DSTOPTS
478#define IPV6_RTHDR IPV6_3542RTHDR
479
480#define IPV6_AUTOFLOWLABEL 59 /* bool; attach flowlabel automagically */
481
482#define IPV6_DONTFRAG 62 /* bool; disable IPv6 fragmentation */
483
484/* int; prefer temporary addresses as the source address. */
485#define IPV6_PREFER_TEMPADDR 63
486
487/*
488 * The following option is private; do not use it from user applications.
489 * It is deliberately defined to the same value as IP_MSFILTER.
490 */
491#define IPV6_MSFILTER 74 /* struct __msfilterreq; */
492#endif /* __APPLE_USE_RFC_3542 */
493
494#define IPV6_BOUND_IF 125 /* int; set/get bound interface */
495
496
497/* to define items, should talk with KAME guys first, for *BSD compatibility */
498
499#define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor. */
500#define IPV6_RTHDR_STRICT 1 /* this hop must be a neighbor. */
501#define IPV6_RTHDR_TYPE_0 0 /* IPv6 routing header type 0 */
502
503/*
504 * Defaults and limits for options
505 */
506#define IPV6_DEFAULT_MULTICAST_HOPS 1 /* normally limit m'casts to 1 hop */
507#define IPV6_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
508
509/*
510 * The im6o_membership vector for each socket is now dynamically allocated at
511 * run-time, bounded by USHRT_MAX, and is reallocated when needed, sized
512 * according to a power-of-two increment.
513 */
514#define IPV6_MIN_MEMBERSHIPS 31
515#define IPV6_MAX_MEMBERSHIPS 4095
516
517/*
518 * Default resource limits for IPv6 multicast source filtering.
519 * These may be modified by sysctl.
520 */
521#define IPV6_MAX_GROUP_SRC_FILTER 512 /* sources per group */
522#define IPV6_MAX_SOCK_SRC_FILTER 128 /* sources per socket/group */
523
524/*
525 * Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
526 */
527struct ipv6_mreq {
528 struct in6_addr ipv6mr_multiaddr;
529 unsigned int ipv6mr_interface;
530};
531
532/*
533 * IPV6_2292PKTINFO: Packet information(RFC2292 sec 5)
534 */
535struct in6_pktinfo {
536 struct in6_addr ipi6_addr; /* src/dst IPv6 address */
537 unsigned int ipi6_ifindex; /* send/recv interface index */
538};
539
540/*
541 * Control structure for IPV6_RECVPATHMTU socket option.
542 */
543struct ip6_mtuinfo {
544 struct sockaddr_in6 ip6m_addr; /* or sockaddr_storage? */
545 uint32_t ip6m_mtu;
546};
547
548/*
549 * Argument for IPV6_PORTRANGE:
550 * - which range to search when port is unspecified at bind() or connect()
551 */
552#define IPV6_PORTRANGE_DEFAULT 0 /* default range */
553#define IPV6_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */
554#define IPV6_PORTRANGE_LOW 2 /* "low" - vouchsafe security */
555
556/*
557 * Definitions for inet6 sysctl operations.
558 *
559 * Third level is protocol number.
560 * Fourth level is desired variable within that protocol.
561 */
562#define IPV6PROTO_MAXID (IPPROTO_PIM + 1) /* don't list to IPV6PROTO_MAX */
563
564/*
565 * Names for IP sysctl objects
566 */
567#define IPV6CTL_FORWARDING 1 /* act as router */
568#define IPV6CTL_SENDREDIRECTS 2 /* may send redirects when forwarding */
569#define IPV6CTL_DEFHLIM 3 /* default Hop-Limit */
570#ifdef notyet
571#define IPV6CTL_DEFMTU 4 /* default MTU */
572#endif
573#define IPV6CTL_FORWSRCRT 5 /* forward source-routed dgrams */
574#define IPV6CTL_STATS 6 /* stats */
575#define IPV6CTL_MRTSTATS 7 /* multicast forwarding stats */
576#define IPV6CTL_MRTPROTO 8 /* multicast routing protocol */
577#define IPV6CTL_MAXFRAGPACKETS 9 /* max packets reassembly queue */
578#define IPV6CTL_SOURCECHECK 10 /* verify source route and intf */
579#define IPV6CTL_SOURCECHECK_LOGINT 11 /* minimume logging interval */
580#define IPV6CTL_ACCEPT_RTADV 12
581#define IPV6CTL_KEEPFAITH 13 /* deprecated */
582#define IPV6CTL_LOG_INTERVAL 14
583#define IPV6CTL_HDRNESTLIMIT 15
584#define IPV6CTL_DAD_COUNT 16
585#define IPV6CTL_AUTO_FLOWLABEL 17
586#define IPV6CTL_DEFMCASTHLIM 18
587#define IPV6CTL_GIF_HLIM 19 /* default HLIM for gif encap packet */
588#define IPV6CTL_KAME_VERSION 20
589#define IPV6CTL_USE_DEPRECATED 21 /* use deprec addr (RFC2462 5.5.4) */
590#define IPV6CTL_RR_PRUNE 22 /* walk timer for router renumbering */
591#if 0 /* obsolete */
592#define IPV6CTL_MAPPED_ADDR 23
593#endif
594#define IPV6CTL_V6ONLY 24
595#define IPV6CTL_RTEXPIRE 25 /* cloned route expiration time */
596#define IPV6CTL_RTMINEXPIRE 26 /* min value for expiration time */
597#define IPV6CTL_RTMAXCACHE 27 /* trigger level for dynamic expire */
598
599#define IPV6CTL_USETEMPADDR 32 /* use temporary addresses [RFC 4941] */
600#define IPV6CTL_TEMPPLTIME 33 /* preferred lifetime for tmpaddrs */
601#define IPV6CTL_TEMPVLTIME 34 /* valid lifetime for tmpaddrs */
602#define IPV6CTL_AUTO_LINKLOCAL 35 /* automatic link-local addr assign */
603#define IPV6CTL_RIP6STATS 36 /* raw_ip6 stats */
604#define IPV6CTL_PREFER_TEMPADDR 37 /* prefer temporary addr as src */
605#define IPV6CTL_ADDRCTLPOLICY 38 /* get/set address selection policy */
606#define IPV6CTL_USE_DEFAULTZONE 39 /* use default scope zone */
607
608#define IPV6CTL_MAXFRAGS 41 /* max fragments */
609#define IPV6CTL_MCAST_PMTU 44 /* enable pMTU discovery for mcast? */
610
611#define IPV6CTL_NEIGHBORGCTHRESH 46
612#define IPV6CTL_MAXIFPREFIXES 47
613#define IPV6CTL_MAXIFDEFROUTERS 48
614#define IPV6CTL_MAXDYNROUTES 49
615#define ICMPV6CTL_ND6_ONLINKNSRFC4861 50
616
617/* New entries should be added here from current IPV6CTL_MAXID value. */
618/* to define items, should talk with KAME guys first, for *BSD compatibility */
619#define IPV6CTL_MAXID 51
620
621
622
623
624
625__BEGIN_DECLS
626struct cmsghdr;
627
628extern int inet6_option_space(int);
629extern int inet6_option_init(void *, struct cmsghdr **, int);
630extern int inet6_option_append(struct cmsghdr *, const __uint8_t *, int, int);
631extern __uint8_t *inet6_option_alloc(struct cmsghdr *, int, int, int);
632extern int inet6_option_next(const struct cmsghdr *, __uint8_t **);
633extern int inet6_option_find(const struct cmsghdr *, __uint8_t **, int);
634
635extern size_t inet6_rthdr_space(int, int);
636extern struct cmsghdr *inet6_rthdr_init(void *, int);
637extern int inet6_rthdr_add(struct cmsghdr *, const struct in6_addr *,
638 unsigned int);
639extern int inet6_rthdr_lasthop(struct cmsghdr *, unsigned int);
640#if 0 /* not implemented yet */
641extern int inet6_rthdr_reverse(const struct cmsghdr *, struct cmsghdr *);
642#endif
643extern int inet6_rthdr_segments(const struct cmsghdr *);
644extern struct in6_addr *inet6_rthdr_getaddr(struct cmsghdr *, int);
645extern int inet6_rthdr_getflags(const struct cmsghdr *, int);
646
647extern int inet6_opt_init(void *, socklen_t);
648extern int inet6_opt_append(void *, socklen_t, int, __uint8_t, socklen_t,
649 __uint8_t, void **);
650extern int inet6_opt_finish(void *, socklen_t, int);
651extern int inet6_opt_set_val(void *, int, void *, socklen_t);
652
653extern int inet6_opt_next(void *, socklen_t, int, __uint8_t *, socklen_t *,
654 void **);
655extern int inet6_opt_find(void *, socklen_t, int, __uint8_t, socklen_t *,
656 void **);
657extern int inet6_opt_get_val(void *, int, void *, socklen_t);
658extern socklen_t inet6_rth_space(int, int);
659extern void *inet6_rth_init(void *, socklen_t, int, int);
660extern int inet6_rth_add(void *, const struct in6_addr *);
661extern int inet6_rth_reverse(const void *, void *);
662extern int inet6_rth_segments(const void *);
663extern struct in6_addr *inet6_rth_getaddr(const void *, int);
664
665__END_DECLS
666#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
667#endif /* !_NETINET6_IN6_H_ */
lib/libc/include/x86_64-macos-gnu/nl_types.h created+103
......@@ -0,0 +1,103 @@
1/* $NetBSD: nl_types.h,v 1.9 2000/10/03 19:53:32 sommerfeld Exp $ */
2
3/*-
4 * Copyright (c) 1996 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by J.T. Conklin.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 *
38 * $FreeBSD: src/include/nl_types.h,v 1.11 2005/02/27 16:20:53 phantom Exp $
39 */
40
41#ifndef _NL_TYPES_H_
42#define _NL_TYPES_H_
43
44#include <sys/cdefs.h>
45#include <sys/types.h>
46#include <_types.h>
47
48#ifdef _NLS_PRIVATE
49/*
50 * MESSAGE CATALOG FILE FORMAT.
51 *
52 * The NetBSD/FreeBSD message catalog format is similar to the format used by
53 * Svr4 systems. The differences are:
54 * * fixed byte order (big endian)
55 * * fixed data field sizes
56 *
57 * A message catalog contains four data types: a catalog header, one
58 * or more set headers, one or more message headers, and one or more
59 * text strings.
60 */
61
62#define _NLS_MAGIC 0xff88ff89
63
64struct _nls_cat_hdr {
65 int32_t __magic;
66 int32_t __nsets;
67 int32_t __mem;
68 int32_t __msg_hdr_offset;
69 int32_t __msg_txt_offset;
70} ;
71
72struct _nls_set_hdr {
73 int32_t __setno; /* set number: 0 < x <= NL_SETMAX */
74 int32_t __nmsgs; /* number of messages in the set */
75 int32_t __index; /* index of first msg_hdr in msg_hdr table */
76} ;
77
78struct _nls_msg_hdr {
79 int32_t __msgno; /* msg number: 0 < x <= NL_MSGMAX */
80 int32_t __msglen;
81 int32_t __offset;
82} ;
83
84#endif /* _NLS_PRIVATE */
85
86#define NL_SETD 1
87#define NL_CAT_LOCALE 1
88
89typedef struct __nl_cat_d {
90 void *__data;
91 int __size;
92} *nl_catd;
93
94#include <_types/_nl_item.h>
95
96__BEGIN_DECLS
97nl_catd catopen(const char *, int);
98char *catgets(nl_catd, int, int, const char *)
99 __attribute__((__format_arg__(4)));
100int catclose(nl_catd);
101__END_DECLS
102
103#endif /* _NL_TYPES_H_ */
lib/libc/include/x86_64-macos-gnu/poll.h created+26
......@@ -0,0 +1,26 @@
1/*
2 * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23#include <sys/poll.h>
24
25
26
lib/libc/include/x86_64-macos-gnu/pthread.h created+568
......@@ -0,0 +1,568 @@
1/*
2 * Copyright (c) 2000-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 * Copyright 1996 1995 by Open Software Foundation, Inc. 1997 1996 1995 1994 1993 1992 1991
25 * All Rights Reserved
26 *
27 * Permission to use, copy, modify, and distribute this software and
28 * its documentation for any purpose and without fee is hereby granted,
29 * provided that the above copyright notice appears in all copies and
30 * that both the copyright notice and this permission notice appear in
31 * supporting documentation.
32 *
33 * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
34 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
35 * FOR A PARTICULAR PURPOSE.
36 *
37 * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
38 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
39 * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
40 * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
41 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
42 *
43 */
44/*
45 * MkLinux
46 */
47
48/*
49 * POSIX Threads - IEEE 1003.1c
50 */
51
52#ifndef _PTHREAD_H
53#define _PTHREAD_H
54
55#include <_types.h>
56#ifndef __POSIX_LIB__
57#include <pthread/pthread_impl.h>
58#endif
59#include <pthread/sched.h>
60#include <time.h>
61#include <sys/_pthread/_pthread_types.h>
62#include <sys/_pthread/_pthread_attr_t.h>
63#include <sys/_pthread/_pthread_cond_t.h>
64#include <sys/_pthread/_pthread_condattr_t.h>
65#include <sys/_pthread/_pthread_key_t.h>
66#include <sys/_pthread/_pthread_mutex_t.h>
67#include <sys/_pthread/_pthread_mutexattr_t.h>
68#include <sys/_pthread/_pthread_once_t.h>
69#include <sys/_pthread/_pthread_rwlock_t.h>
70#include <sys/_pthread/_pthread_rwlockattr_t.h>
71#include <sys/_pthread/_pthread_t.h>
72
73#include <pthread/qos.h>
74
75#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE) || defined(__cplusplus)
76
77#include <sys/_types/_mach_port_t.h>
78#include <sys/_types/_sigset_t.h>
79
80#endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE || __cplusplus */
81
82/*
83 * These symbols indicate which [optional] features are available
84 * They can be tested at compile time via '#ifdef XXX'
85 * The way to check for pthreads is like so:
86
87 * #include <unistd.h>
88 * #ifdef _POSIX_THREADS
89 * #include <pthread.h>
90 * #endif
91
92 */
93
94/* These will be moved to unistd.h */
95
96/*
97 * Note: These data structures are meant to be opaque. Only enough
98 * structure is exposed to support initializers.
99 * All of the typedefs will be moved to <sys/types.h>
100 */
101
102#include <sys/cdefs.h>
103#include <Availability.h>
104
105#if __has_feature(assume_nonnull)
106_Pragma("clang assume_nonnull begin")
107#endif
108__BEGIN_DECLS
109/*
110 * Threads
111 */
112
113
114/*
115 * Cancel cleanup handler management. Note, since these are implemented as macros,
116 * they *MUST* occur in matched pairs!
117 */
118
119#define pthread_cleanup_push(func, val) \
120 { \
121 struct __darwin_pthread_handler_rec __handler; \
122 pthread_t __self = pthread_self(); \
123 __handler.__routine = func; \
124 __handler.__arg = val; \
125 __handler.__next = __self->__cleanup_stack; \
126 __self->__cleanup_stack = &__handler;
127
128#define pthread_cleanup_pop(execute) \
129 /* Note: 'handler' must be in this same lexical context! */ \
130 __self->__cleanup_stack = __handler.__next; \
131 if (execute) (__handler.__routine)(__handler.__arg); \
132 }
133
134/*
135 * Thread attributes
136 */
137
138#define PTHREAD_CREATE_JOINABLE 1
139#define PTHREAD_CREATE_DETACHED 2
140
141#define PTHREAD_INHERIT_SCHED 1
142#define PTHREAD_EXPLICIT_SCHED 2
143
144#define PTHREAD_CANCEL_ENABLE 0x01 /* Cancel takes place at next cancellation point */
145#define PTHREAD_CANCEL_DISABLE 0x00 /* Cancel postponed */
146#define PTHREAD_CANCEL_DEFERRED 0x02 /* Cancel waits until cancellation point */
147#define PTHREAD_CANCEL_ASYNCHRONOUS 0x00 /* Cancel occurs immediately */
148
149/* Value returned from pthread_join() when a thread is canceled */
150#define PTHREAD_CANCELED ((void *) 1)
151
152/* We only support PTHREAD_SCOPE_SYSTEM */
153#define PTHREAD_SCOPE_SYSTEM 1
154#define PTHREAD_SCOPE_PROCESS 2
155
156#define PTHREAD_PROCESS_SHARED 1
157#define PTHREAD_PROCESS_PRIVATE 2
158
159/*
160 * Mutex protocol attributes
161 */
162#define PTHREAD_PRIO_NONE 0
163#define PTHREAD_PRIO_INHERIT 1
164#define PTHREAD_PRIO_PROTECT 2
165
166/*
167 * Mutex type attributes
168 */
169#define PTHREAD_MUTEX_NORMAL 0
170#define PTHREAD_MUTEX_ERRORCHECK 1
171#define PTHREAD_MUTEX_RECURSIVE 2
172#define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
173
174/*
175 * Mutex policy attributes
176 */
177#define PTHREAD_MUTEX_POLICY_FAIRSHARE_NP 1
178#define PTHREAD_MUTEX_POLICY_FIRSTFIT_NP 3
179
180/*
181 * RWLock variables
182 */
183#define PTHREAD_RWLOCK_INITIALIZER {_PTHREAD_RWLOCK_SIG_init, {0}}
184
185/*
186 * Mutex variables
187 */
188#define PTHREAD_MUTEX_INITIALIZER {_PTHREAD_MUTEX_SIG_init, {0}}
189
190/* <rdar://problem/10854763> */
191#if ((__MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) || (__IPHONE_OS_VERSION_MIN_REQUIRED && __IPHONE_OS_VERSION_MIN_REQUIRED >= 50000)) || defined(__DRIVERKIT_VERSION_MIN_REQUIRED)
192# if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
193# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER {_PTHREAD_ERRORCHECK_MUTEX_SIG_init, {0}}
194# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER {_PTHREAD_RECURSIVE_MUTEX_SIG_init, {0}}
195# endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE */
196#endif
197
198/* <rdar://problem/25944576> */
199#define _PTHREAD_SWIFT_IMPORTER_NULLABILITY_COMPAT \
200 defined(SWIFT_CLASS_EXTRA) && (!defined(SWIFT_SDK_OVERLAY_PTHREAD_EPOCH) || (SWIFT_SDK_OVERLAY_PTHREAD_EPOCH < 1))
201
202/*
203 * Condition variable attributes
204 */
205
206/*
207 * Condition variables
208 */
209
210#define PTHREAD_COND_INITIALIZER {_PTHREAD_COND_SIG_init, {0}}
211
212/*
213 * Initialization control (once) variables
214 */
215
216#define PTHREAD_ONCE_INIT {_PTHREAD_ONCE_SIG_init, {0}}
217
218/*
219 * Prototypes for all PTHREAD interfaces
220 */
221__API_AVAILABLE(macos(10.4), ios(2.0))
222int pthread_atfork(void (* _Nullable)(void), void (* _Nullable)(void),
223 void (* _Nullable)(void));
224
225__API_AVAILABLE(macos(10.4), ios(2.0))
226int pthread_attr_destroy(pthread_attr_t *);
227
228__API_AVAILABLE(macos(10.4), ios(2.0))
229int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
230
231__API_AVAILABLE(macos(10.4), ios(2.0))
232int pthread_attr_getguardsize(const pthread_attr_t * __restrict, size_t * __restrict);
233
234__API_AVAILABLE(macos(10.4), ios(2.0))
235int pthread_attr_getinheritsched(const pthread_attr_t * __restrict, int * __restrict);
236
237__API_AVAILABLE(macos(10.4), ios(2.0))
238int pthread_attr_getschedparam(const pthread_attr_t * __restrict,
239 struct sched_param * __restrict);
240
241__API_AVAILABLE(macos(10.4), ios(2.0))
242int pthread_attr_getschedpolicy(const pthread_attr_t * __restrict, int * __restrict);
243
244__API_AVAILABLE(macos(10.4), ios(2.0))
245int pthread_attr_getscope(const pthread_attr_t * __restrict, int * __restrict);
246
247__API_AVAILABLE(macos(10.4), ios(2.0))
248int pthread_attr_getstack(const pthread_attr_t * __restrict,
249 void * _Nullable * _Nonnull __restrict, size_t * __restrict);
250
251__API_AVAILABLE(macos(10.4), ios(2.0))
252int pthread_attr_getstackaddr(const pthread_attr_t * __restrict,
253 void * _Nullable * _Nonnull __restrict);
254
255__API_AVAILABLE(macos(10.4), ios(2.0))
256int pthread_attr_getstacksize(const pthread_attr_t * __restrict, size_t * __restrict);
257
258__API_AVAILABLE(macos(10.4), ios(2.0))
259int pthread_attr_init(pthread_attr_t *);
260
261__API_AVAILABLE(macos(10.4), ios(2.0))
262int pthread_attr_setdetachstate(pthread_attr_t *, int);
263
264__API_AVAILABLE(macos(10.4), ios(2.0))
265int pthread_attr_setguardsize(pthread_attr_t *, size_t);
266
267__API_AVAILABLE(macos(10.4), ios(2.0))
268int pthread_attr_setinheritsched(pthread_attr_t *, int);
269
270__API_AVAILABLE(macos(10.4), ios(2.0))
271int pthread_attr_setschedparam(pthread_attr_t * __restrict,
272 const struct sched_param * __restrict);
273
274__API_AVAILABLE(macos(10.4), ios(2.0))
275int pthread_attr_setschedpolicy(pthread_attr_t *, int);
276
277__API_AVAILABLE(macos(10.4), ios(2.0))
278int pthread_attr_setscope(pthread_attr_t *, int);
279
280__API_AVAILABLE(macos(10.4), ios(2.0))
281int pthread_attr_setstack(pthread_attr_t *, void *, size_t);
282
283__API_AVAILABLE(macos(10.4), ios(2.0))
284int pthread_attr_setstackaddr(pthread_attr_t *, void *);
285
286__API_AVAILABLE(macos(10.4), ios(2.0))
287int pthread_attr_setstacksize(pthread_attr_t *, size_t);
288
289__API_AVAILABLE(macos(10.4), ios(2.0))
290int pthread_cancel(pthread_t) __DARWIN_ALIAS(pthread_cancel);
291
292__API_AVAILABLE(macos(10.4), ios(2.0))
293int pthread_cond_broadcast(pthread_cond_t *);
294
295__API_AVAILABLE(macos(10.4), ios(2.0))
296int pthread_cond_destroy(pthread_cond_t *);
297
298__API_AVAILABLE(macos(10.4), ios(2.0))
299int pthread_cond_init(
300 pthread_cond_t * __restrict,
301 const pthread_condattr_t * _Nullable __restrict)
302 __DARWIN_ALIAS(pthread_cond_init);
303
304__API_AVAILABLE(macos(10.4), ios(2.0))
305int pthread_cond_signal(pthread_cond_t *);
306
307__API_AVAILABLE(macos(10.4), ios(2.0))
308int pthread_cond_timedwait(
309 pthread_cond_t * __restrict, pthread_mutex_t * __restrict,
310 const struct timespec * _Nullable __restrict)
311 __DARWIN_ALIAS_C(pthread_cond_timedwait);
312
313__API_AVAILABLE(macos(10.4), ios(2.0))
314int pthread_cond_wait(pthread_cond_t * __restrict,
315 pthread_mutex_t * __restrict) __DARWIN_ALIAS_C(pthread_cond_wait);
316
317__API_AVAILABLE(macos(10.4), ios(2.0))
318int pthread_condattr_destroy(pthread_condattr_t *);
319
320__API_AVAILABLE(macos(10.4), ios(2.0))
321int pthread_condattr_init(pthread_condattr_t *);
322
323__API_AVAILABLE(macos(10.4), ios(2.0))
324int pthread_condattr_getpshared(const pthread_condattr_t * __restrict,
325 int * __restrict);
326
327__API_AVAILABLE(macos(10.4), ios(2.0))
328int pthread_condattr_setpshared(pthread_condattr_t *, int);
329
330__API_AVAILABLE(macos(10.4), ios(2.0))
331#if !_PTHREAD_SWIFT_IMPORTER_NULLABILITY_COMPAT
332int pthread_create(pthread_t _Nullable * _Nonnull __restrict,
333 const pthread_attr_t * _Nullable __restrict,
334 void * _Nullable (* _Nonnull)(void * _Nullable),
335 void * _Nullable __restrict);
336#else
337int pthread_create(pthread_t * __restrict,
338 const pthread_attr_t * _Nullable __restrict,
339 void *(* _Nonnull)(void *), void * _Nullable __restrict);
340#endif // _PTHREAD_SWIFT_IMPORTER_NULLABILITY_COMPAT
341
342__API_AVAILABLE(macos(10.4), ios(2.0))
343int pthread_detach(pthread_t);
344
345__API_AVAILABLE(macos(10.4), ios(2.0))
346int pthread_equal(pthread_t _Nullable, pthread_t _Nullable);
347
348__API_AVAILABLE(macos(10.4), ios(2.0))
349void pthread_exit(void * _Nullable) __dead2;
350
351__API_AVAILABLE(macos(10.4), ios(2.0))
352int pthread_getconcurrency(void);
353
354__API_AVAILABLE(macos(10.4), ios(2.0))
355int pthread_getschedparam(pthread_t , int * _Nullable __restrict,
356 struct sched_param * _Nullable __restrict);
357
358__API_AVAILABLE(macos(10.4), ios(2.0))
359void* _Nullable pthread_getspecific(pthread_key_t);
360
361__API_AVAILABLE(macos(10.4), ios(2.0))
362int pthread_join(pthread_t , void * _Nullable * _Nullable)
363 __DARWIN_ALIAS_C(pthread_join);
364
365__API_AVAILABLE(macos(10.4), ios(2.0))
366int pthread_key_create(pthread_key_t *, void (* _Nullable)(void *));
367
368__API_AVAILABLE(macos(10.4), ios(2.0))
369int pthread_key_delete(pthread_key_t);
370
371__API_AVAILABLE(macos(10.4), ios(2.0))
372int pthread_mutex_destroy(pthread_mutex_t *);
373
374__API_AVAILABLE(macos(10.4), ios(2.0))
375int pthread_mutex_getprioceiling(const pthread_mutex_t * __restrict,
376 int * __restrict);
377
378__API_AVAILABLE(macos(10.4), ios(2.0))
379int pthread_mutex_init(pthread_mutex_t * __restrict,
380 const pthread_mutexattr_t * _Nullable __restrict);
381
382__API_AVAILABLE(macos(10.4), ios(2.0))
383int pthread_mutex_lock(pthread_mutex_t *);
384
385__API_AVAILABLE(macos(10.4), ios(2.0))
386int pthread_mutex_setprioceiling(pthread_mutex_t * __restrict, int,
387 int * __restrict);
388
389__API_AVAILABLE(macos(10.4), ios(2.0))
390int pthread_mutex_trylock(pthread_mutex_t *);
391
392__API_AVAILABLE(macos(10.4), ios(2.0))
393int pthread_mutex_unlock(pthread_mutex_t *);
394
395__API_AVAILABLE(macos(10.4), ios(2.0))
396int pthread_mutexattr_destroy(pthread_mutexattr_t *) __DARWIN_ALIAS(pthread_mutexattr_destroy);
397
398__API_AVAILABLE(macos(10.4), ios(2.0))
399int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t * __restrict,
400 int * __restrict);
401
402__API_AVAILABLE(macos(10.4), ios(2.0))
403int pthread_mutexattr_getprotocol(const pthread_mutexattr_t * __restrict,
404 int * __restrict);
405
406__API_AVAILABLE(macos(10.4), ios(2.0))
407int pthread_mutexattr_getpshared(const pthread_mutexattr_t * __restrict,
408 int * __restrict);
409
410__API_AVAILABLE(macos(10.4), ios(2.0))
411int pthread_mutexattr_gettype(const pthread_mutexattr_t * __restrict,
412 int * __restrict);
413
414__API_AVAILABLE(macos(10.13.4), ios(11.3), watchos(4.3), tvos(11.3))
415int pthread_mutexattr_getpolicy_np(const pthread_mutexattr_t * __restrict,
416 int * __restrict);
417
418__API_AVAILABLE(macos(10.4), ios(2.0))
419int pthread_mutexattr_init(pthread_mutexattr_t *);
420
421__API_AVAILABLE(macos(10.4), ios(2.0))
422int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
423
424__API_AVAILABLE(macos(10.4), ios(2.0))
425int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
426
427__API_AVAILABLE(macos(10.4), ios(2.0))
428int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
429
430__API_AVAILABLE(macos(10.4), ios(2.0))
431int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
432
433__API_AVAILABLE(macos(10.7), ios(5.0))
434int pthread_mutexattr_setpolicy_np(pthread_mutexattr_t *, int);
435
436__SWIFT_UNAVAILABLE_MSG("Use lazily initialized globals instead")
437__API_AVAILABLE(macos(10.4), ios(2.0))
438int pthread_once(pthread_once_t *, void (* _Nonnull)(void));
439
440__API_AVAILABLE(macos(10.4), ios(2.0))
441int pthread_rwlock_destroy(pthread_rwlock_t * ) __DARWIN_ALIAS(pthread_rwlock_destroy);
442
443__API_AVAILABLE(macos(10.4), ios(2.0))
444int pthread_rwlock_init(pthread_rwlock_t * __restrict,
445 const pthread_rwlockattr_t * _Nullable __restrict)
446 __DARWIN_ALIAS(pthread_rwlock_init);
447
448__API_AVAILABLE(macos(10.4), ios(2.0))
449int pthread_rwlock_rdlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_rdlock);
450
451__API_AVAILABLE(macos(10.4), ios(2.0))
452int pthread_rwlock_tryrdlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_tryrdlock);
453
454__API_AVAILABLE(macos(10.4), ios(2.0))
455int pthread_rwlock_trywrlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_trywrlock);
456
457__API_AVAILABLE(macos(10.4), ios(2.0))
458int pthread_rwlock_wrlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_wrlock);
459
460__API_AVAILABLE(macos(10.4), ios(2.0))
461int pthread_rwlock_unlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_unlock);
462
463__API_AVAILABLE(macos(10.4), ios(2.0))
464int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
465
466__API_AVAILABLE(macos(10.4), ios(2.0))
467int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t * __restrict,
468 int * __restrict);
469
470__API_AVAILABLE(macos(10.4), ios(2.0))
471int pthread_rwlockattr_init(pthread_rwlockattr_t *);
472
473__API_AVAILABLE(macos(10.4), ios(2.0))
474int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
475
476__API_AVAILABLE(macos(10.4), ios(2.0))
477pthread_t pthread_self(void);
478
479__API_AVAILABLE(macos(10.4), ios(2.0))
480int pthread_setcancelstate(int , int * _Nullable)
481 __DARWIN_ALIAS(pthread_setcancelstate);
482
483__API_AVAILABLE(macos(10.4), ios(2.0))
484int pthread_setcanceltype(int , int * _Nullable)
485 __DARWIN_ALIAS(pthread_setcanceltype);
486
487__API_AVAILABLE(macos(10.4), ios(2.0))
488int pthread_setconcurrency(int);
489
490__API_AVAILABLE(macos(10.4), ios(2.0))
491int pthread_setschedparam(pthread_t, int, const struct sched_param *);
492
493__API_AVAILABLE(macos(10.4), ios(2.0))
494int pthread_setspecific(pthread_key_t , const void * _Nullable);
495
496__API_AVAILABLE(macos(10.4), ios(2.0))
497void pthread_testcancel(void) __DARWIN_ALIAS(pthread_testcancel);
498
499#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE) || defined(__cplusplus)
500
501/* returns non-zero if pthread_create or cthread_fork have been called */
502__API_AVAILABLE(macos(10.4), ios(2.0))
503int pthread_is_threaded_np(void);
504
505__API_AVAILABLE(macos(10.6), ios(3.2))
506int pthread_threadid_np(pthread_t _Nullable,__uint64_t* _Nullable);
507
508/*SPI to set and get pthread name*/
509__API_AVAILABLE(macos(10.6), ios(3.2))
510int pthread_getname_np(pthread_t,char*,size_t);
511
512__API_AVAILABLE(macos(10.6), ios(3.2))
513int pthread_setname_np(const char*);
514
515/* returns non-zero if the current thread is the main thread */
516__API_AVAILABLE(macos(10.4), ios(2.0))
517int pthread_main_np(void);
518
519/* return the mach thread bound to the pthread */
520__API_AVAILABLE(macos(10.4), ios(2.0))
521mach_port_t pthread_mach_thread_np(pthread_t);
522
523__API_AVAILABLE(macos(10.4), ios(2.0))
524size_t pthread_get_stacksize_np(pthread_t);
525
526__API_AVAILABLE(macos(10.4), ios(2.0))
527void* pthread_get_stackaddr_np(pthread_t);
528
529/* Like pthread_cond_signal(), but only wake up the specified pthread */
530__API_AVAILABLE(macos(10.4), ios(2.0))
531int pthread_cond_signal_thread_np(pthread_cond_t *, pthread_t _Nullable);
532
533/* Like pthread_cond_timedwait, but use a relative timeout */
534__API_AVAILABLE(macos(10.4), ios(2.0))
535int pthread_cond_timedwait_relative_np(pthread_cond_t *, pthread_mutex_t *,
536 const struct timespec * _Nullable);
537
538/* Like pthread_create(), but leaves the thread suspended */
539__API_AVAILABLE(macos(10.4), ios(2.0))
540#if !_PTHREAD_SWIFT_IMPORTER_NULLABILITY_COMPAT
541int pthread_create_suspended_np(
542 pthread_t _Nullable * _Nonnull, const pthread_attr_t * _Nullable,
543 void * _Nullable (* _Nonnull)(void * _Nullable), void * _Nullable);
544#else
545int pthread_create_suspended_np(pthread_t *, const pthread_attr_t * _Nullable,
546 void *(* _Nonnull)(void *), void * _Nullable);
547#endif
548
549__API_AVAILABLE(macos(10.4), ios(2.0))
550int pthread_kill(pthread_t, int);
551
552__API_AVAILABLE(macos(10.5), ios(2.0))
553_Nullable pthread_t pthread_from_mach_thread_np(mach_port_t);
554
555__API_AVAILABLE(macos(10.4), ios(2.0))
556int pthread_sigmask(int, const sigset_t * _Nullable, sigset_t * _Nullable)
557 __DARWIN_ALIAS(pthread_sigmask);
558
559__API_AVAILABLE(macos(10.4), ios(2.0))
560void pthread_yield_np(void);
561
562#endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE || __cplusplus */
563__END_DECLS
564#if __has_feature(assume_nonnull)
565_Pragma("clang assume_nonnull end")
566#endif
567
568#endif /* _PTHREAD_H */
lib/libc/include/x86_64-macos-gnu/pthread/pthread_impl.h created+66
......@@ -0,0 +1,66 @@
1/*
2 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef _PTHREAD_IMPL_H_
25#define _PTHREAD_IMPL_H_
26/*
27 * Internal implementation details
28 */
29
30/* This whole header file will disappear, so don't depend on it... */
31
32#if __has_feature(assume_nonnull)
33_Pragma("clang assume_nonnull begin")
34#endif
35
36#ifndef __POSIX_LIB__
37
38/*
39 * [Internal] data structure signatures
40 */
41#define _PTHREAD_MUTEX_SIG_init 0x32AAABA7
42
43#define _PTHREAD_ERRORCHECK_MUTEX_SIG_init 0x32AAABA1
44#define _PTHREAD_RECURSIVE_MUTEX_SIG_init 0x32AAABA2
45#define _PTHREAD_FIRSTFIT_MUTEX_SIG_init 0x32AAABA3
46
47#define _PTHREAD_COND_SIG_init 0x3CB0B1BB
48#define _PTHREAD_ONCE_SIG_init 0x30B1BCBA
49#define _PTHREAD_RWLOCK_SIG_init 0x2DA8B3B4
50
51/*
52 * POSIX scheduling policies
53 */
54#define SCHED_OTHER 1
55#define SCHED_FIFO 4
56#define SCHED_RR 2
57
58#define __SCHED_PARAM_SIZE__ 4
59
60#endif /* __POSIX_LIB__ */
61
62#if __has_feature(assume_nonnull)
63_Pragma("clang assume_nonnull end")
64#endif
65
66#endif /* _PTHREAD_IMPL_H_ */
lib/libc/include/x86_64-macos-gnu/pthread/qos.h created+304
......@@ -0,0 +1,304 @@
1/*
2 * Copyright (c) 2013-2014 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef _PTHREAD_QOS_H
25#define _PTHREAD_QOS_H
26
27#include <sys/cdefs.h>
28#include <sys/_pthread/_pthread_attr_t.h> /* pthread_attr_t */
29#include <sys/_pthread/_pthread_t.h> /* pthread_t */
30#include <Availability.h>
31
32#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
33
34#include <sys/qos.h>
35
36#ifndef KERNEL
37
38#if __has_feature(assume_nonnull)
39_Pragma("clang assume_nonnull begin")
40#endif
41__BEGIN_DECLS
42
43/*!
44 * @function pthread_attr_set_qos_class_np
45 *
46 * @abstract
47 * Sets the QOS class and relative priority of a pthread attribute structure
48 * which may be used to specify the requested QOS class of newly created
49 * threads.
50 *
51 * @discussion
52 * The QOS class and relative priority represent an overall combination of
53 * system quality of service attributes on a thread.
54 *
55 * Subsequent calls to interfaces such as pthread_attr_setschedparam() that are
56 * incompatible or in conflict with the QOS class system will unset the QOS
57 * class requested with this interface and pthread_attr_get_qos_class_np() will
58 * return QOS_CLASS_UNSPECIFIED.
59 *
60 * @param __attr
61 * The pthread attribute structure to modify.
62 *
63 * @param __qos_class
64 * A QOS class value:
65 * - QOS_CLASS_USER_INTERACTIVE
66 * - QOS_CLASS_USER_INITIATED
67 * - QOS_CLASS_DEFAULT
68 * - QOS_CLASS_UTILITY
69 * - QOS_CLASS_BACKGROUND
70 * EINVAL will be returned if any other value is provided.
71 *
72 * @param __relative_priority
73 * A relative priority within the QOS class. This value is a negative offset
74 * from the maximum supported scheduler priority for the given class.
75 * EINVAL will be returned if the value is greater than zero or less than
76 * QOS_MIN_RELATIVE_PRIORITY.
77 *
78 * @return
79 * Zero if successful, otherwise an errno value.
80 */
81__API_AVAILABLE(macos(10.10), ios(8.0))
82int
83pthread_attr_set_qos_class_np(pthread_attr_t *__attr,
84 qos_class_t __qos_class, int __relative_priority);
85
86/*!
87 * @function pthread_attr_get_qos_class_np
88 *
89 * @abstract
90 * Gets the QOS class and relative priority of a pthread attribute structure.
91 *
92 * @param __attr
93 * The pthread attribute structure to inspect.
94 *
95 * @param __qos_class
96 * On output, a QOS class value:
97 * - QOS_CLASS_USER_INTERACTIVE
98 * - QOS_CLASS_USER_INITIATED
99 * - QOS_CLASS_DEFAULT
100 * - QOS_CLASS_UTILITY
101 * - QOS_CLASS_BACKGROUND
102 * - QOS_CLASS_UNSPECIFIED
103 * This value may be NULL in which case no value is returned.
104 *
105 * @param __relative_priority
106 * On output, a relative priority offset within the QOS class.
107 * This value may be NULL in which case no value is returned.
108 *
109 * @return
110 * Zero if successful, otherwise an errno value.
111 */
112__API_AVAILABLE(macos(10.10), ios(8.0))
113int
114pthread_attr_get_qos_class_np(pthread_attr_t * __restrict __attr,
115 qos_class_t * _Nullable __restrict __qos_class,
116 int * _Nullable __restrict __relative_priority);
117
118/*!
119 * @function pthread_set_qos_class_self_np
120 *
121 * @abstract
122 * Sets the requested QOS class and relative priority of the current thread.
123 *
124 * @discussion
125 * The QOS class and relative priority represent an overall combination of
126 * system quality of service attributes on a thread.
127 *
128 * Subsequent calls to interfaces such as pthread_setschedparam() that are
129 * incompatible or in conflict with the QOS class system will unset the QOS
130 * class requested with this interface and pthread_get_qos_class_np() will
131 * return QOS_CLASS_UNSPECIFIED thereafter. A thread so modified is permanently
132 * opted-out of the QOS class system and calls to this function to request a QOS
133 * class for such a thread will fail and return EPERM.
134 *
135 * @param __qos_class
136 * A QOS class value:
137 * - QOS_CLASS_USER_INTERACTIVE
138 * - QOS_CLASS_USER_INITIATED
139 * - QOS_CLASS_DEFAULT
140 * - QOS_CLASS_UTILITY
141 * - QOS_CLASS_BACKGROUND
142 * EINVAL will be returned if any other value is provided.
143 *
144 * @param __relative_priority
145 * A relative priority within the QOS class. This value is a negative offset
146 * from the maximum supported scheduler priority for the given class.
147 * EINVAL will be returned if the value is greater than zero or less than
148 * QOS_MIN_RELATIVE_PRIORITY.
149 *
150 * @return
151 * Zero if successful, otherwise an errno value.
152 */
153__API_AVAILABLE(macos(10.10), ios(8.0))
154int
155pthread_set_qos_class_self_np(qos_class_t __qos_class,
156 int __relative_priority);
157
158/*!
159 * @function pthread_get_qos_class_np
160 *
161 * @abstract
162 * Gets the requested QOS class and relative priority of a thread.
163 *
164 * @param __pthread
165 * The target thread to inspect.
166 *
167 * @param __qos_class
168 * On output, a QOS class value:
169 * - QOS_CLASS_USER_INTERACTIVE
170 * - QOS_CLASS_USER_INITIATED
171 * - QOS_CLASS_DEFAULT
172 * - QOS_CLASS_UTILITY
173 * - QOS_CLASS_BACKGROUND
174 * - QOS_CLASS_UNSPECIFIED
175 * This value may be NULL in which case no value is returned.
176 *
177 * @param __relative_priority
178 * On output, a relative priority offset within the QOS class.
179 * This value may be NULL in which case no value is returned.
180 *
181 * @return
182 * Zero if successful, otherwise an errno value.
183 */
184__API_AVAILABLE(macos(10.10), ios(8.0))
185int
186pthread_get_qos_class_np(pthread_t __pthread,
187 qos_class_t * _Nullable __restrict __qos_class,
188 int * _Nullable __restrict __relative_priority);
189
190/*!
191 * @typedef pthread_override_t
192 *
193 * @abstract
194 * An opaque object representing a QOS class override of a thread.
195 *
196 * @discussion
197 * A QOS class override of a target thread expresses that an item of pending
198 * work classified with a specific QOS class and relative priority depends on
199 * the completion of the work currently being executed by the thread (e.g. due
200 * to ordering requirements).
201 *
202 * While overrides are in effect, the target thread will execute at the maximum
203 * QOS class and relative priority of all overrides and of the QOS class
204 * requested by the thread itself.
205 *
206 * A QOS class override does not modify the target thread's requested QOS class
207 * value and the effect of an override is not visible to the qos_class_self()
208 * and pthread_get_qos_class_np() interfaces.
209 */
210
211typedef struct pthread_override_s* pthread_override_t;
212
213/*!
214 * @function pthread_override_qos_class_start_np
215 *
216 * @abstract
217 * Starts a QOS class override of the specified target thread.
218 *
219 * @discussion
220 * Starting a QOS class override of the specified target thread expresses that
221 * an item of pending work classified with the specified QOS class and relative
222 * priority depends on the completion of the work currently being executed by
223 * the thread (e.g. due to ordering requirements).
224 *
225 * While overrides are in effect, the specified target thread will execute at
226 * the maximum QOS class and relative priority of all overrides and of the QOS
227 * class requested by the thread itself.
228 *
229 * Starting a QOS class override does not modify the target thread's requested
230 * QOS class value and the effect of an override is not visible to the
231 * qos_class_self() and pthread_get_qos_class_np() interfaces.
232 *
233 * The returned newly allocated override object is intended to be associated
234 * with the item of pending work in question. Once the dependency has been
235 * satisfied and enabled that work to begin executing, the QOS class override
236 * must be ended by passing the associated override object to
237 * pthread_override_qos_class_end_np(). Failure to do so will result in the
238 * associated resources to be leaked and the target thread to be permanently
239 * executed at an inappropriately elevated QOS class.
240 *
241 * @param __pthread
242 * The target thread to modify.
243 *
244 * @param __qos_class
245 * A QOS class value:
246 * - QOS_CLASS_USER_INTERACTIVE
247 * - QOS_CLASS_USER_INITIATED
248 * - QOS_CLASS_DEFAULT
249 * - QOS_CLASS_UTILITY
250 * - QOS_CLASS_BACKGROUND
251 * NULL will be returned if any other value is provided.
252 *
253 * @param __relative_priority
254 * A relative priority within the QOS class. This value is a negative offset
255 * from the maximum supported scheduler priority for the given class.
256 * NULL will be returned if the value is greater than zero or less than
257 * QOS_MIN_RELATIVE_PRIORITY.
258 *
259 * @return
260 * A newly allocated override object if successful, or NULL if the override
261 * could not be started.
262 */
263__API_AVAILABLE(macos(10.10), ios(8.0))
264pthread_override_t
265pthread_override_qos_class_start_np(pthread_t __pthread,
266 qos_class_t __qos_class, int __relative_priority);
267
268/*!
269 * @function pthread_override_qos_class_end_np
270 *
271 * @abstract
272 * Ends a QOS class override.
273 *
274 * @discussion
275 * Passing an override object returned by pthread_override_qos_class_start_np()
276 * ends the QOS class override started by that call and deallocates all
277 * associated resources as well as the override object itself.
278 *
279 * The thread starting and the thread ending a QOS class override need not be
280 * identical. If the thread ending the override is the the target thread of the
281 * override itself, it should take care to elevate its requested QOS class
282 * appropriately with pthread_set_qos_class_self_np() before ending the
283 * override.
284 *
285 * @param __override
286 * An override object returned by pthread_override_qos_class_start_np().
287 *
288 * @return
289 * Zero if successful, otherwise an errno value.
290 */
291__API_AVAILABLE(macos(10.10), ios(8.0))
292int
293pthread_override_qos_class_end_np(pthread_override_t __override);
294
295__END_DECLS
296#if __has_feature(assume_nonnull)
297_Pragma("clang assume_nonnull end")
298#endif
299
300#endif // KERNEL
301
302#endif // __DARWIN_C_LEVEL >= __DARWIN_C_FULL
303
304#endif // _PTHREAD_QOS_H
lib/libc/include/x86_64-macos-gnu/pthread/sched.h created+44
......@@ -0,0 +1,44 @@
1/*
2 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef _SCHED_H_
25#define _SCHED_H_
26
27#include <sys/cdefs.h>
28#include <pthread_impl.h>
29
30__BEGIN_DECLS
31/*
32 * Scheduling paramters
33 */
34#ifndef __POSIX_LIB__
35struct sched_param { int sched_priority; char __opaque[__SCHED_PARAM_SIZE__]; };
36#endif
37
38extern int sched_yield(void);
39extern int sched_get_priority_min(int);
40extern int sched_get_priority_max(int);
41__END_DECLS
42
43#endif /* _SCHED_H_ */
44
lib/libc/include/x86_64-macos-gnu/pthread_impl.h created+66
......@@ -0,0 +1,66 @@
1/*
2 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef _PTHREAD_IMPL_H_
25#define _PTHREAD_IMPL_H_
26/*
27 * Internal implementation details
28 */
29
30/* This whole header file will disappear, so don't depend on it... */
31
32#if __has_feature(assume_nonnull)
33_Pragma("clang assume_nonnull begin")
34#endif
35
36#ifndef __POSIX_LIB__
37
38/*
39 * [Internal] data structure signatures
40 */
41#define _PTHREAD_MUTEX_SIG_init 0x32AAABA7
42
43#define _PTHREAD_ERRORCHECK_MUTEX_SIG_init 0x32AAABA1
44#define _PTHREAD_RECURSIVE_MUTEX_SIG_init 0x32AAABA2
45#define _PTHREAD_FIRSTFIT_MUTEX_SIG_init 0x32AAABA3
46
47#define _PTHREAD_COND_SIG_init 0x3CB0B1BB
48#define _PTHREAD_ONCE_SIG_init 0x30B1BCBA
49#define _PTHREAD_RWLOCK_SIG_init 0x2DA8B3B4
50
51/*
52 * POSIX scheduling policies
53 */
54#define SCHED_OTHER 1
55#define SCHED_FIFO 4
56#define SCHED_RR 2
57
58#define __SCHED_PARAM_SIZE__ 4
59
60#endif /* __POSIX_LIB__ */
61
62#if __has_feature(assume_nonnull)
63_Pragma("clang assume_nonnull end")
64#endif
65
66#endif /* _PTHREAD_IMPL_H_ */
lib/libc/include/x86_64-macos-gnu/pwd.h created+119
......@@ -0,0 +1,119 @@
1/*-
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.
9 * Portions Copyright(C) 1995, Jason Downs. All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by the University of
22 * California, Berkeley and its contributors.
23 * 4. Neither the name of the University nor the names of its contributors
24 * may be used to endorse or promote products derived from this software
25 * without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 * @(#)pwd.h 8.2 (Berkeley) 1/21/94
40 */
41/* Portions copyright (c) 2000-2011 Apple Inc. All rights reserved. */
42
43#ifndef _PWD_H_
44#define _PWD_H_
45
46#include <_types.h>
47#include <sys/_types/_gid_t.h>
48#include <sys/_types/_size_t.h>
49#include <sys/_types/_uid_t.h>
50
51#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
52#define _PATH_PWD "/etc"
53#define _PATH_PASSWD "/etc/passwd"
54#define _PASSWD "passwd"
55#define _PATH_MASTERPASSWD "/etc/master.passwd"
56#define _PATH_MASTERPASSWD_LOCK "/etc/ptmp"
57#define _MASTERPASSWD "master.passwd"
58
59#define _PATH_MP_DB "/etc/pwd.db"
60#define _MP_DB "pwd.db"
61#define _PATH_SMP_DB "/etc/spwd.db"
62#define _SMP_DB "spwd.db"
63
64#define _PATH_PWD_MKDB "/usr/sbin/pwd_mkdb"
65
66#define _PW_KEYBYNAME '1' /* stored by name */
67#define _PW_KEYBYNUM '2' /* stored by entry in the "file" */
68#define _PW_KEYBYUID '3' /* stored by uid */
69
70#define _PASSWORD_EFMT1 '_' /* extended encryption format */
71
72#define _PASSWORD_LEN 128 /* max length, not counting NULL */
73
74#define _PASSWORD_NOUID 0x01 /* flag for no specified uid. */
75#define _PASSWORD_NOGID 0x02 /* flag for no specified gid. */
76#define _PASSWORD_NOCHG 0x04 /* flag for no specified change. */
77#define _PASSWORD_NOEXP 0x08 /* flag for no specified expire. */
78
79#define _PASSWORD_WARNDAYS 14 /* days to warn about expiry */
80#define _PASSWORD_CHGNOW -1 /* special day to force password
81 * change at next login */
82#endif
83
84struct passwd {
85 char *pw_name; /* user name */
86 char *pw_passwd; /* encrypted password */
87 uid_t pw_uid; /* user uid */
88 gid_t pw_gid; /* user gid */
89 __darwin_time_t pw_change; /* password change time */
90 char *pw_class; /* user access class */
91 char *pw_gecos; /* Honeywell login info */
92 char *pw_dir; /* home directory */
93 char *pw_shell; /* default shell */
94 __darwin_time_t pw_expire; /* account expiration */
95};
96
97#include <sys/cdefs.h>
98
99__BEGIN_DECLS
100struct passwd *getpwuid(uid_t);
101struct passwd *getpwnam(const char *);
102int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **);
103int getpwnam_r(const char *, struct passwd *, char *, size_t, struct passwd **);
104struct passwd *getpwent(void);
105void setpwent(void);
106void endpwent(void);
107__END_DECLS
108
109#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
110#include <uuid/uuid.h>
111__BEGIN_DECLS
112int setpassent(int);
113char *user_from_uid(uid_t, int);
114struct passwd *getpwuuid(uuid_t);
115int getpwuuid_r(uuid_t, struct passwd *, char *, size_t, struct passwd **);
116__END_DECLS
117#endif
118
119#endif /* !_PWD_H_ */
lib/libc/include/x86_64-macos-gnu/regex.h created+217
......@@ -0,0 +1,217 @@
1/*
2 * Copyright (c) 2000, 2011 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 * Copyright (c) 2001-2009 Ville Laurikari <vl@iki.fi>
25 * All rights reserved.
26 *
27 * Redistribution and use in source and binary forms, with or without
28 * modification, are permitted provided that the following conditions
29 * are met:
30 *
31 * 1. Redistributions of source code must retain the above copyright
32 * notice, this list of conditions and the following disclaimer.
33 *
34 * 2. Redistributions in binary form must reproduce the above copyright
35 * notice, this list of conditions and the following disclaimer in the
36 * documentation and/or other materials provided with the distribution.
37 *
38 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS
39 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
40 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
41 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
42 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
44 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
45 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
46 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
47 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
48 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49 */
50/*-
51 * Copyright (c) 1992 Henry Spencer.
52 * Copyright (c) 1992, 1993
53 * The Regents of the University of California. All rights reserved.
54 *
55 * This code is derived from software contributed to Berkeley by
56 * Henry Spencer of the University of Toronto.
57 *
58 * Redistribution and use in source and binary forms, with or without
59 * modification, are permitted provided that the following conditions
60 * are met:
61 * 1. Redistributions of source code must retain the above copyright
62 * notice, this list of conditions and the following disclaimer.
63 * 2. Redistributions in binary form must reproduce the above copyright
64 * notice, this list of conditions and the following disclaimer in the
65 * documentation and/or other materials provided with the distribution.
66 * 3. All advertising materials mentioning features or use of this software
67 * must display the following acknowledgement:
68 * This product includes software developed by the University of
69 * California, Berkeley and its contributors.
70 * 4. Neither the name of the University nor the names of its contributors
71 * may be used to endorse or promote products derived from this software
72 * without specific prior written permission.
73 *
74 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
75 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
76 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
77 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
78 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
79 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
80 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
81 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
82 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
83 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
84 * SUCH DAMAGE.
85 *
86 * @(#)regex.h 8.2 (Berkeley) 1/3/94
87 */
88
89#ifndef _REGEX_H_
90#define _REGEX_H_
91
92#include <_regex.h>
93
94/*******************/
95/* regcomp() flags */
96/*******************/
97#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
98#define REG_BASIC 0000 /* Basic regular expressions (synonym for 0) */
99#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
100
101#define REG_EXTENDED 0001 /* Extended regular expressions */
102#define REG_ICASE 0002 /* Compile ignoring upper/lower case */
103#define REG_NOSUB 0004 /* Compile only reporting success/failure */
104#define REG_NEWLINE 0010 /* Compile for newline-sensitive matching */
105
106#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
107#define REG_NOSPEC 0020 /* Compile turning off all special characters */
108
109#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8 \
110 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0 \
111 || defined(__DRIVERKIT_VERSION_MIN_REQUIRED)
112#define REG_LITERAL REG_NOSPEC
113#endif
114
115#define REG_PEND 0040 /* Use re_endp as end pointer */
116
117#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8 \
118 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0 \
119 || defined(__DRIVERKIT_VERSION_MIN_REQUIRED)
120#define REG_MINIMAL 0100 /* Compile using minimal repetition */
121#define REG_UNGREEDY REG_MINIMAL
122#endif
123
124#define REG_DUMP 0200 /* Unused */
125
126#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8 \
127 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0 \
128 || defined(__DRIVERKIT_VERSION_MIN_REQUIRED)
129#define REG_ENHANCED 0400 /* Additional (non-POSIX) features */
130#endif
131#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
132
133/********************/
134/* regerror() flags */
135/********************/
136#define REG_ENOSYS (-1) /* Reserved */
137#define REG_NOMATCH 1 /* regexec() function failed to match */
138#define REG_BADPAT 2 /* invalid regular expression */
139#define REG_ECOLLATE 3 /* invalid collating element */
140#define REG_ECTYPE 4 /* invalid character class */
141#define REG_EESCAPE 5 /* trailing backslash (\) */
142#define REG_ESUBREG 6 /* invalid backreference number */
143#define REG_EBRACK 7 /* brackets ([ ]) not balanced */
144#define REG_EPAREN 8 /* parentheses not balanced */
145#define REG_EBRACE 9 /* braces not balanced */
146#define REG_BADBR 10 /* invalid repetition count(s) */
147#define REG_ERANGE 11 /* invalid character range */
148#define REG_ESPACE 12 /* out of memory */
149#define REG_BADRPT 13 /* repetition-operator operand invalid */
150
151#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
152#define REG_EMPTY 14 /* Unused */
153#define REG_ASSERT 15 /* Unused */
154#define REG_INVARG 16 /* invalid argument to regex routine */
155#define REG_ILLSEQ 17 /* illegal byte sequence */
156
157#define REG_ATOI 255 /* convert name to number (!) */
158#define REG_ITOA 0400 /* convert number to name (!) */
159#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
160
161/*******************/
162/* regexec() flags */
163/*******************/
164#define REG_NOTBOL 00001 /* First character not at beginning of line */
165#define REG_NOTEOL 00002 /* Last character not at end of line */
166
167#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
168#define REG_STARTEND 00004 /* String start/end in pmatch[0] */
169#define REG_TRACE 00400 /* Unused */
170#define REG_LARGE 01000 /* Unused */
171#define REG_BACKR 02000 /* force use of backref code */
172
173#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8 \
174 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0 \
175 || defined(__DRIVERKIT_VERSION_MIN_REQUIRED)
176#define REG_BACKTRACKING_MATCHER REG_BACKR
177#endif
178#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
179
180__BEGIN_DECLS
181int regcomp(regex_t * __restrict, const char * __restrict, int) __DARWIN_ALIAS(regcomp);
182size_t regerror(int, const regex_t * __restrict, char * __restrict, size_t) __cold;
183/*
184 * gcc under c99 mode won't compile "[ __restrict]" by itself. As a workaround,
185 * a dummy argument name is added.
186 */
187int regexec(const regex_t * __restrict, const char * __restrict, size_t,
188 regmatch_t __pmatch[ __restrict], int);
189void regfree(regex_t *);
190
191#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
192
193/* Darwin extensions */
194int regncomp(regex_t * __restrict, const char * __restrict, size_t, int)
195 __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
196int regnexec(const regex_t * __restrict, const char * __restrict, size_t,
197 size_t, regmatch_t __pmatch[ __restrict], int)
198 __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
199int regwcomp(regex_t * __restrict, const wchar_t * __restrict, int)
200 __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
201int regwexec(const regex_t * __restrict, const wchar_t * __restrict, size_t,
202 regmatch_t __pmatch[ __restrict], int)
203 __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
204int regwncomp(regex_t * __restrict, const wchar_t * __restrict, size_t, int)
205 __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
206int regwnexec(const regex_t * __restrict, const wchar_t * __restrict,
207 size_t, size_t, regmatch_t __pmatch[ __restrict], int)
208 __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
209
210#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
211__END_DECLS
212
213#ifdef _USE_EXTENDED_LOCALES_
214#include <xlocale/_regex.h>
215#endif /* _USE_EXTENDED_LOCALES_ */
216
217#endif /* !_REGEX_H_ */
lib/libc/include/x86_64-macos-gnu/sched.h created+44
......@@ -0,0 +1,44 @@
1/*
2 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef _SCHED_H_
25#define _SCHED_H_
26
27#include <sys/cdefs.h>
28#include <pthread_impl.h>
29
30__BEGIN_DECLS
31/*
32 * Scheduling paramters
33 */
34#ifndef __POSIX_LIB__
35struct sched_param { int sched_priority; char __opaque[__SCHED_PARAM_SIZE__]; };
36#endif
37
38extern int sched_yield(void);
39extern int sched_get_priority_min(int);
40extern int sched_get_priority_max(int);
41__END_DECLS
42
43#endif /* _SCHED_H_ */
44
lib/libc/include/x86_64-macos-gnu/search.h created+62
......@@ -0,0 +1,62 @@
1/*-
2 * Written by J.T. Conklin <jtc@netbsd.org>
3 * Public domain.
4 *
5 * $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $
6 * $FreeBSD: src/include/search.h,v 1.10 2002/10/16 14:29:23 robert Exp $
7 */
8
9#ifndef _SEARCH_H_
10#define _SEARCH_H_
11
12#include <sys/cdefs.h>
13#include <_types.h>
14#include <sys/_types/_size_t.h>
15
16typedef struct entry {
17 char *key;
18 void *data;
19} ENTRY;
20
21typedef enum {
22 FIND, ENTER
23} ACTION;
24
25typedef enum {
26 preorder,
27 postorder,
28 endorder,
29 leaf
30} VISIT;
31
32#ifdef _SEARCH_PRIVATE
33typedef struct node {
34 char *key;
35 struct node *llink, *rlink;
36} node_t;
37
38struct que_elem {
39 struct que_elem *next;
40 struct que_elem *prev;
41};
42#endif
43
44__BEGIN_DECLS
45int hcreate(size_t);
46void hdestroy(void);
47ENTRY *hsearch(ENTRY, ACTION);
48void insque(void *, void *);
49void *lfind(const void *, const void *, size_t *, size_t,
50 int (*)(const void *, const void *));
51void *lsearch(const void *, void *, size_t *, size_t,
52 int (*)(const void *, const void *));
53void remque(void *);
54void *tdelete(const void * __restrict, void ** __restrict,
55 int (*)(const void *, const void *));
56void *tfind(const void *, void * const *,
57 int (*)(const void *, const void *));
58void *tsearch(const void *, void **, int (*)(const void *, const void *));
59void twalk(const void *, void (*)(const void *, VISIT, int));
60__END_DECLS
61
62#endif /* !_SEARCH_H_ */
lib/libc/include/x86_64-macos-gnu/semaphore.h created+31
......@@ -0,0 +1,31 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23#ifndef _BSD_SEMAPHORE_H
24#define _BSD_SEMAPHORE_H
25
26#include <sys/types.h>
27#include <sys/fcntl.h>
28
29#include <sys/semaphore.h>
30
31#endif /* _BSD_SEMAPHORE_H */
lib/libc/include/x86_64-macos-gnu/spawn.h created+165
......@@ -0,0 +1,165 @@
1/*
2 * Copyright (c) 2006, 2010 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24
25#ifndef _SPAWN_H_
26#define _SPAWN_H_
27
28/*
29 * [SPN] Support for _POSIX_SPAWN
30 */
31
32#include <sys/cdefs.h>
33#include <_types.h>
34#include <sys/spawn.h> /* shared types */
35
36#include <Availability.h>
37
38/*
39 * [SPN] Inclusion of the <spawn.h> header may make visible symbols defined
40 * in the <sched.h>, <signal.h>, and <sys/types.h> headers.
41 */
42#include <sys/_types/_pid_t.h>
43#include <sys/_types/_sigset_t.h>
44#include <sys/_types/_mode_t.h>
45
46/*
47 * Opaque types for use with posix_spawn() family functions. Internals are
48 * not defined, and should not be accessed directly. Types are defined as
49 * mandated by POSIX.
50 */
51typedef void *posix_spawnattr_t;
52typedef void *posix_spawn_file_actions_t;
53
54__BEGIN_DECLS
55/*
56 * gcc under c99 mode won't compile "[ __restrict]" by itself. As a workaround,
57 * a dummy argument name is added.
58 */
59
60int posix_spawn(pid_t * __restrict, const char * __restrict,
61 const posix_spawn_file_actions_t *,
62 const posix_spawnattr_t * __restrict,
63 char *const __argv[__restrict],
64 char *const __envp[__restrict]) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
65
66int posix_spawnp(pid_t * __restrict, const char * __restrict,
67 const posix_spawn_file_actions_t *,
68 const posix_spawnattr_t * __restrict,
69 char *const __argv[__restrict],
70 char *const __envp[__restrict]) __API_AVAILABLE(macos(10.5), ios(2.0));
71
72int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
73
74int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int,
75 int) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
76
77int posix_spawn_file_actions_addopen(
78 posix_spawn_file_actions_t * __restrict, int,
79 const char * __restrict, int, mode_t) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
80
81int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
82
83int posix_spawn_file_actions_init(posix_spawn_file_actions_t *) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
84
85int posix_spawnattr_destroy(posix_spawnattr_t *) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
86
87int posix_spawnattr_getsigdefault(const posix_spawnattr_t * __restrict,
88 sigset_t * __restrict) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
89
90int posix_spawnattr_getflags(const posix_spawnattr_t * __restrict,
91 short * __restrict) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
92
93int posix_spawnattr_getpgroup(const posix_spawnattr_t * __restrict,
94 pid_t * __restrict) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
95
96int posix_spawnattr_getsigmask(const posix_spawnattr_t * __restrict,
97 sigset_t * __restrict) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
98
99int posix_spawnattr_init(posix_spawnattr_t *) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
100
101int posix_spawnattr_setsigdefault(posix_spawnattr_t * __restrict,
102 const sigset_t * __restrict) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
103
104int posix_spawnattr_setflags(posix_spawnattr_t *, short) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
105
106int posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
107
108int posix_spawnattr_setsigmask(posix_spawnattr_t * __restrict,
109 const sigset_t * __restrict) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
110
111#if 0 /* _POSIX_PRIORITY_SCHEDULING [PS] : not supported */
112int posix_spawnattr_setschedparam(posix_spawnattr_t * __restrict,
113 const struct sched_param * __restrict);
114int posix_spawnattr_setschedpolicy(posix_spawnattr_t *, int);
115int posix_spawnattr_getschedparam(const posix_spawnattr_t * __restrict,
116 struct sched_param * __restrict);
117int posix_spawnattr_getschedpolicy(const posix_spawnattr_t * __restrict,
118 int * __restrict);
119#endif /* 0 */
120
121__END_DECLS
122
123#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
124/*
125 * Darwin-specific extensions below
126 */
127#include <mach/exception_types.h>
128#include <mach/machine.h>
129#include <mach/port.h>
130
131#include <sys/_types/_size_t.h>
132
133__BEGIN_DECLS
134
135int posix_spawnattr_getbinpref_np(const posix_spawnattr_t * __restrict,
136 size_t, cpu_type_t *__restrict, size_t *__restrict) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
137
138int posix_spawnattr_setauditsessionport_np(posix_spawnattr_t * __restrict,
139 mach_port_t) __API_AVAILABLE(macos(10.6), ios(3.2));
140
141int posix_spawnattr_setbinpref_np(posix_spawnattr_t * __restrict,
142 size_t, cpu_type_t *__restrict, size_t *__restrict) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
143
144int posix_spawnattr_setexceptionports_np(posix_spawnattr_t * __restrict,
145 exception_mask_t, mach_port_t,
146 exception_behavior_t, thread_state_flavor_t) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
147
148int posix_spawnattr_setspecialport_np(posix_spawnattr_t * __restrict,
149 mach_port_t, int) __API_AVAILABLE(macos(10.5), ios(2.0)) __API_UNAVAILABLE(watchos, tvos);
150
151int posix_spawnattr_setsuidcredport_np(posix_spawnattr_t * __restrict, mach_port_t) __API_UNAVAILABLE(ios, macos);
152
153int posix_spawn_file_actions_addinherit_np(posix_spawn_file_actions_t *,
154 int) __API_AVAILABLE(macos(10.7), ios(4.3)) __API_UNAVAILABLE(watchos, tvos);
155
156int posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *,
157 const char * __restrict) __API_AVAILABLE(macos(10.15)) __API_UNAVAILABLE(ios, tvos, watchos);
158
159int posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *,
160 int) __API_AVAILABLE(macos(10.15)) __API_UNAVAILABLE(ios, tvos, watchos);
161
162__END_DECLS
163
164#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
165#endif /* _SPAWN_H_ */
lib/libc/include/x86_64-macos-gnu/sys/_pthread/_pthread_cond_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _PTHREAD_COND_T
29#define _PTHREAD_COND_T
30#include <sys/_pthread/_pthread_types.h> /* __darwin_pthread_cond_t */
31typedef __darwin_pthread_cond_t pthread_cond_t;
32#endif /* _PTHREAD_COND_T */
lib/libc/include/x86_64-macos-gnu/sys/_pthread/_pthread_condattr_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _PTHREAD_CONDATTR_T
29#define _PTHREAD_CONDATTR_T
30#include <sys/_pthread/_pthread_types.h> /* __darwin_pthread_condattr_t */
31typedef __darwin_pthread_condattr_t pthread_condattr_t;
32#endif /* _PTHREAD_CONDATTR_T */
lib/libc/include/x86_64-macos-gnu/sys/_pthread/_pthread_key_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _PTHREAD_KEY_T
29#define _PTHREAD_KEY_T
30#include <sys/_pthread/_pthread_types.h> /* __darwin_pthread_key_t */
31typedef __darwin_pthread_key_t pthread_key_t;
32#endif /* _PTHREAD_KEY_T */
lib/libc/include/x86_64-macos-gnu/sys/_pthread/_pthread_mutex_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _PTHREAD_MUTEX_T
29#define _PTHREAD_MUTEX_T
30#include <sys/_pthread/_pthread_types.h> /* __darwin_pthread_mutex_t */
31typedef __darwin_pthread_mutex_t pthread_mutex_t;
32#endif /*_PTHREAD_MUTEX_T */
lib/libc/include/x86_64-macos-gnu/sys/_pthread/_pthread_mutexattr_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _PTHREAD_MUTEXATTR_T
29#define _PTHREAD_MUTEXATTR_T
30#include <sys/_pthread/_pthread_types.h> /* __darwin_pthread_mutexattr_t */
31typedef __darwin_pthread_mutexattr_t pthread_mutexattr_t;
32#endif /* _PTHREAD_MUTEXATTR_T */
lib/libc/include/x86_64-macos-gnu/sys/_pthread/_pthread_once_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _PTHREAD_ONCE_T
29#define _PTHREAD_ONCE_T
30#include <sys/_pthread/_pthread_types.h> /* __darwin_pthread_once_t */
31typedef __darwin_pthread_once_t pthread_once_t;
32#endif /* _PTHREAD_ONCE_T */
lib/libc/include/x86_64-macos-gnu/sys/_pthread/_pthread_rwlock_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _PTHREAD_RWLOCK_T
29#define _PTHREAD_RWLOCK_T
30#include <sys/_pthread/_pthread_types.h> /* __darwin_pthread_rwlock_t */
31typedef __darwin_pthread_rwlock_t pthread_rwlock_t;
32#endif /* _PTHREAD_RWLOCK_T */
lib/libc/include/x86_64-macos-gnu/sys/_pthread/_pthread_rwlockattr_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _PTHREAD_RWLOCKATTR_T
29#define _PTHREAD_RWLOCKATTR_T
30#include <sys/_pthread/_pthread_types.h> /* __darwin_pthread_rwlockattr_t */
31typedef __darwin_pthread_rwlockattr_t pthread_rwlockattr_t;
32#endif /* _PTHREAD_RWLOCKATTR_T */
lib/libc/include/x86_64-macos-gnu/sys/_select.h created+52
......@@ -0,0 +1,52 @@
1/*
2 * Copyright (c) 2005, 2007 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29/*
30 * This is called from sys/select.h and sys/time.h for the common prototype
31 * of select(). Setting _DARWIN_C_SOURCE or _DARWIN_UNLIMITED_SELECT uses
32 * the version of select() that does not place a limit on the first argument
33 * (nfds). In the UNIX conformance case, values of nfds greater than
34 * FD_SETSIZE will return an error of EINVAL.
35 */
36#ifndef _SYS__SELECT_H_
37#define _SYS__SELECT_H_
38
39int select(int, fd_set * __restrict, fd_set * __restrict,
40 fd_set * __restrict, struct timeval * __restrict)
41#if defined(_DARWIN_C_SOURCE) || defined(_DARWIN_UNLIMITED_SELECT)
42__DARWIN_EXTSN_C(select)
43#else /* !_DARWIN_C_SOURCE && !_DARWIN_UNLIMITED_SELECT */
44# if defined(__LP64__) && !__DARWIN_NON_CANCELABLE
45__DARWIN_1050(select)
46# else /* !__LP64__ || __DARWIN_NON_CANCELABLE */
47__DARWIN_ALIAS_C(select)
48# endif /* __LP64__ && !__DARWIN_NON_CANCELABLE */
49#endif /* _DARWIN_C_SOURCE || _DARWIN_UNLIMITED_SELECT */
50;
51
52#endif /* !_SYS__SELECT_H_ */
lib/libc/include/x86_64-macos-gnu/sys/_types/_blkcnt_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _BLKCNT_T
29#define _BLKCNT_T
30#include <sys/_types.h> /* __darwin_blkcnt_t */
31typedef __darwin_blkcnt_t blkcnt_t;
32#endif /* _BLKCNT_T */
lib/libc/include/x86_64-macos-gnu/sys/_types/_blksize_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _BLKSIZE_T
29#define _BLKSIZE_T
30#include <sys/_types.h> /* __darwin_blksize_t */
31typedef __darwin_blksize_t blksize_t;
32#endif /* _BLKSIZE_T */
lib/libc/include/x86_64-macos-gnu/sys/_types/_caddr_t.h created+31
......@@ -0,0 +1,31 @@
1/*
2 * Copyright (c) 2017 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _CADDR_T
29#define _CADDR_T
30typedef char * caddr_t;
31#endif /* _CADDR_T */
lib/libc/include/x86_64-macos-gnu/sys/_types/_fd_clr.h created+30
......@@ -0,0 +1,30 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef FD_CLR
29#define FD_CLR(n, p) __DARWIN_FD_CLR(n, p)
30#endif /* FD_CLR */
lib/libc/include/x86_64-macos-gnu/sys/_types/_fd_copy.h created+30
......@@ -0,0 +1,30 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef FD_COPY
29#define FD_COPY(f, t) __DARWIN_FD_COPY(f, t)
30#endif /* FD_COPY */
lib/libc/include/x86_64-macos-gnu/sys/_types/_fd_def.h created+114
......@@ -0,0 +1,114 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _FD_SET
29#define _FD_SET
30
31#include <machine/types.h> /* __int32_t and uintptr_t */
32#include <Availability.h>
33
34/*
35 * Select uses bit masks of file descriptors in longs. These macros
36 * manipulate such bit fields (the filesystem macros use chars). The
37 * extra protection here is to permit application redefinition above
38 * the default size.
39 */
40#ifdef FD_SETSIZE
41#define __DARWIN_FD_SETSIZE FD_SETSIZE
42#else /* !FD_SETSIZE */
43#define __DARWIN_FD_SETSIZE 1024
44#endif /* FD_SETSIZE */
45#define __DARWIN_NBBY 8 /* bits in a byte */
46#define __DARWIN_NFDBITS (sizeof(__int32_t) * __DARWIN_NBBY) /* bits per mask */
47#define __DARWIN_howmany(x, y) ((((x) % (y)) == 0) ? ((x) / (y)) : (((x) / (y)) + 1)) /* # y's == x bits? */
48
49__BEGIN_DECLS
50typedef struct fd_set {
51 __int32_t fds_bits[__DARWIN_howmany(__DARWIN_FD_SETSIZE, __DARWIN_NFDBITS)];
52} fd_set;
53
54int __darwin_check_fd_set_overflow(int, const void *, int) __attribute__((__weak_import__));
55__END_DECLS
56
57__header_always_inline int
58__darwin_check_fd_set(int _a, const void *_b)
59{
60 if ((uintptr_t)&__darwin_check_fd_set_overflow != (uintptr_t) 0) {
61#if defined(_DARWIN_UNLIMITED_SELECT) || defined(_DARWIN_C_SOURCE)
62 return __darwin_check_fd_set_overflow(_a, _b, 1);
63#else
64 return __darwin_check_fd_set_overflow(_a, _b, 0);
65#endif
66 } else {
67 return 1;
68 }
69}
70
71/* This inline avoids argument side-effect issues with FD_ISSET() */
72__header_always_inline int
73__darwin_fd_isset(int _fd, const struct fd_set *_p)
74{
75 if (__darwin_check_fd_set(_fd, (const void *) _p)) {
76 return _p->fds_bits[(unsigned long)_fd / __DARWIN_NFDBITS] & ((__int32_t)(((unsigned long)1) << ((unsigned long)_fd % __DARWIN_NFDBITS)));
77 }
78
79 return 0;
80}
81
82__header_always_inline void
83__darwin_fd_set(int _fd, struct fd_set *const _p)
84{
85 if (__darwin_check_fd_set(_fd, (const void *) _p)) {
86 (_p->fds_bits[(unsigned long)_fd / __DARWIN_NFDBITS] |= ((__int32_t)(((unsigned long)1) << ((unsigned long)_fd % __DARWIN_NFDBITS))));
87 }
88}
89
90__header_always_inline void
91__darwin_fd_clr(int _fd, struct fd_set *const _p)
92{
93 if (__darwin_check_fd_set(_fd, (const void *) _p)) {
94 (_p->fds_bits[(unsigned long)_fd / __DARWIN_NFDBITS] &= ~((__int32_t)(((unsigned long)1) << ((unsigned long)_fd % __DARWIN_NFDBITS))));
95 }
96}
97
98
99#define __DARWIN_FD_SET(n, p) __darwin_fd_set((n), (p))
100#define __DARWIN_FD_CLR(n, p) __darwin_fd_clr((n), (p))
101#define __DARWIN_FD_ISSET(n, p) __darwin_fd_isset((n), (p))
102
103#if __GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 3
104/*
105 * Use the built-in bzero function instead of the library version so that
106 * we do not pollute the namespace or introduce prototype warnings.
107 */
108#define __DARWIN_FD_ZERO(p) __builtin_bzero(p, sizeof(*(p)))
109#else
110#define __DARWIN_FD_ZERO(p) bzero(p, sizeof(*(p)))
111#endif
112
113#define __DARWIN_FD_COPY(f, t) bcopy(f, t, sizeof(*(f)))
114#endif /* _FD_SET */
lib/libc/include/x86_64-macos-gnu/sys/_types/_fd_isset.h created+30
......@@ -0,0 +1,30 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef FD_ISSET
29#define FD_ISSET(n, p) __DARWIN_FD_ISSET(n, p)
30#endif /* FD_ISSET */
lib/libc/include/x86_64-macos-gnu/sys/_types/_fd_set.h created+30
......@@ -0,0 +1,30 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef FD_SET
29#define FD_SET(n, p) __DARWIN_FD_SET(n, p)
30#endif /* FD_SET */
lib/libc/include/x86_64-macos-gnu/sys/_types/_fd_setsize.h created+30
......@@ -0,0 +1,30 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef FD_SETSIZE
29#define FD_SETSIZE __DARWIN_FD_SETSIZE
30#endif /* FD_SETSIZE */
lib/libc/include/x86_64-macos-gnu/sys/_types/_fd_zero.h created+30
......@@ -0,0 +1,30 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef FD_ZERO
29#define FD_ZERO(p) __DARWIN_FD_ZERO(p)
30#endif /* FD_ZERO */
lib/libc/include/x86_64-macos-gnu/sys/_types/_filesec_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _FILESEC_T
29#define _FILESEC_T
30struct _filesec;
31typedef struct _filesec *filesec_t;
32#endif /* _FILESEC_T */
lib/libc/include/x86_64-macos-gnu/sys/_types/_fsblkcnt_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _FSBLKCNT_T
29#define _FSBLKCNT_T
30#include <sys/_types.h> /* __darwin_fsblkcnt_t */
31typedef __darwin_fsblkcnt_t fsblkcnt_t;
32#endif /* _FSBLKCNT_T */
lib/libc/include/x86_64-macos-gnu/sys/_types/_fsfilcnt_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _FSFILCNT_T
29#define _FSFILCNT_T
30#include <sys/_types.h> /* __darwin_fsfilcnt_t */
31typedef __darwin_fsfilcnt_t fsfilcnt_t;
32#endif /* _FSFILCNT_T */
lib/libc/include/x86_64-macos-gnu/sys/_types/_gid_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _GID_T
29#define _GID_T
30#include <sys/_types.h> /* __darwin_gid_t */
31typedef __darwin_gid_t gid_t;
32#endif
lib/libc/include/x86_64-macos-gnu/sys/_types/_in_addr_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _IN_ADDR_T
29#define _IN_ADDR_T
30#include <machine/types.h> /* __uint32_t */
31typedef __uint32_t in_addr_t; /* base type for internet address */
32#endif /* _IN_ADDR_T */
lib/libc/include/x86_64-macos-gnu/sys/_types/_in_port_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _IN_PORT_T
29#define _IN_PORT_T
30#include <machine/types.h> /* __uint16_t */
31typedef __uint16_t in_port_t;
32#endif /* _IN_PORT_T */
lib/libc/include/x86_64-macos-gnu/sys/_types/_ino64_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _INO64_T
29#define _INO64_T
30#include <sys/_types.h> /* __darwin_ino64_t */
31typedef __darwin_ino64_t ino64_t; /* 64bit inode number */
32#endif /* _INO64_T */
lib/libc/include/x86_64-macos-gnu/sys/_types/_ino_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _INO_T
29#define _INO_T
30#include <sys/_types.h> /* __darwin_ino_t */
31typedef __darwin_ino_t ino_t; /* inode number */
32#endif /* _INO_T */
lib/libc/include/x86_64-macos-gnu/sys/_types/_iovec_t.h created+35
......@@ -0,0 +1,35 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _STRUCT_IOVEC
29#define _STRUCT_IOVEC
30#include <sys/_types/_size_t.h> /* size_t */
31struct iovec {
32 void * iov_base; /* [XSI] Base address of I/O memory region */
33 size_t iov_len; /* [XSI] Size of region iov_base points to */
34};
35#endif /* _STRUCT_IOVEC */
lib/libc/include/x86_64-macos-gnu/sys/_types/_key_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _KEY_T
29#define _KEY_T
30#include <machine/types.h> /* __int32_t */
31typedef __int32_t key_t; /* IPC key (for Sys V IPC) */
32#endif /* _KEY_T */
lib/libc/include/x86_64-macos-gnu/sys/_types/_mach_port_t.h created+51
......@@ -0,0 +1,51 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29/*
30 * mach_port_t - a named port right
31 *
32 * In user-space, "rights" are represented by the name of the
33 * right in the Mach port namespace. Even so, this type is
34 * presented as a unique one to more clearly denote the presence
35 * of a right coming along with the name.
36 *
37 * Often, various rights for a port held in a single name space
38 * will coalesce and are, therefore, be identified by a single name
39 * [this is the case for send and receive rights]. But not
40 * always [send-once rights currently get a unique name for
41 * each right].
42 *
43 * This definition of mach_port_t is only for user-space.
44 *
45 */
46
47#ifndef _MACH_PORT_T
48#define _MACH_PORT_T
49#include <sys/_types.h> /* __darwin_mach_port_t */
50typedef __darwin_mach_port_t mach_port_t;
51#endif /* _MACH_PORT_T */
lib/libc/include/x86_64-macos-gnu/sys/_types/_nlink_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _NLINK_T
29#define _NLINK_T
30#include <machine/types.h> /* __uint16_t */
31typedef __uint16_t nlink_t; /* link count */
32#endif /* _NLINK_T */
lib/libc/include/x86_64-macos-gnu/sys/_types/_o_dsync.h created+30
......@@ -0,0 +1,30 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef O_DSYNC
29#define O_DSYNC 0x400000 /* synch I/O data integrity */
30#endif /* O_DSYNC */
lib/libc/include/x86_64-macos-gnu/sys/_types/_o_sync.h created+30
......@@ -0,0 +1,30 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef O_SYNC
29#define O_SYNC 0x0080 /* synch I/O file integrity */
30#endif /* O_SYNC */
lib/libc/include/x86_64-macos-gnu/sys/_types/_posix_vdisable.h created+30
......@@ -0,0 +1,30 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _POSIX_VDISABLE
29#define _POSIX_VDISABLE ((unsigned char)'\377')
30#endif /* POSIX_VDISABLE */
lib/libc/include/x86_64-macos-gnu/sys/_types/_s_ifmt.h created+74
......@@ -0,0 +1,74 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29/*
30 * [XSI] The symbolic names for file modes for use as values of mode_t
31 * shall be defined as described in <sys/stat.h>
32 */
33#ifndef S_IFMT
34/* File type */
35#define S_IFMT 0170000 /* [XSI] type of file mask */
36#define S_IFIFO 0010000 /* [XSI] named pipe (fifo) */
37#define S_IFCHR 0020000 /* [XSI] character special */
38#define S_IFDIR 0040000 /* [XSI] directory */
39#define S_IFBLK 0060000 /* [XSI] block special */
40#define S_IFREG 0100000 /* [XSI] regular */
41#define S_IFLNK 0120000 /* [XSI] symbolic link */
42#define S_IFSOCK 0140000 /* [XSI] socket */
43#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
44#define S_IFWHT 0160000 /* OBSOLETE: whiteout */
45#endif
46
47/* File mode */
48/* Read, write, execute/search by owner */
49#define S_IRWXU 0000700 /* [XSI] RWX mask for owner */
50#define S_IRUSR 0000400 /* [XSI] R for owner */
51#define S_IWUSR 0000200 /* [XSI] W for owner */
52#define S_IXUSR 0000100 /* [XSI] X for owner */
53/* Read, write, execute/search by group */
54#define S_IRWXG 0000070 /* [XSI] RWX mask for group */
55#define S_IRGRP 0000040 /* [XSI] R for group */
56#define S_IWGRP 0000020 /* [XSI] W for group */
57#define S_IXGRP 0000010 /* [XSI] X for group */
58/* Read, write, execute/search by others */
59#define S_IRWXO 0000007 /* [XSI] RWX mask for other */
60#define S_IROTH 0000004 /* [XSI] R for other */
61#define S_IWOTH 0000002 /* [XSI] W for other */
62#define S_IXOTH 0000001 /* [XSI] X for other */
63
64#define S_ISUID 0004000 /* [XSI] set user id on execution */
65#define S_ISGID 0002000 /* [XSI] set group id on execution */
66#define S_ISVTX 0001000 /* [XSI] directory restrcted delete */
67
68#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
69#define S_ISTXT S_ISVTX /* sticky bit: not supported */
70#define S_IREAD S_IRUSR /* backward compatability */
71#define S_IWRITE S_IWUSR /* backward compatability */
72#define S_IEXEC S_IXUSR /* backward compatability */
73#endif
74#endif /* !S_IFMT */
lib/libc/include/x86_64-macos-gnu/sys/_types/_sa_family_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _SA_FAMILY_T
29#define _SA_FAMILY_T
30#include <machine/types.h> /* __uint8_t */
31typedef __uint8_t sa_family_t;
32#endif /* _SA_FAMILY_T */
lib/libc/include/x86_64-macos-gnu/sys/_types/_seek_set.h created+46
......@@ -0,0 +1,46 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#include <sys/cdefs.h>
30
31/* whence values for lseek(2) */
32#ifndef SEEK_SET
33#define SEEK_SET 0 /* set file offset to offset */
34#define SEEK_CUR 1 /* set file offset to current plus offset */
35#define SEEK_END 2 /* set file offset to EOF plus offset */
36#endif /* !SEEK_SET */
37
38#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
39#ifndef SEEK_HOLE
40#define SEEK_HOLE 3 /* set file offset to the start of the next hole greater than or equal to the supplied offset */
41#endif
42
43#ifndef SEEK_DATA
44#define SEEK_DATA 4 /* set file offset to the start of the next non-hole file region greater than or equal to the supplied offset */
45#endif
46#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
lib/libc/include/x86_64-macos-gnu/sys/_types/_socklen_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _SOCKLEN_T
29#define _SOCKLEN_T
30#include <machine/types.h> /* __darwin_socklen_t */
31typedef __darwin_socklen_t socklen_t;
32#endif
lib/libc/include/x86_64-macos-gnu/sys/_types/_suseconds_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _SUSECONDS_T
29#define _SUSECONDS_T
30#include <sys/_types.h> /* __darwin_suseconds_t */
31typedef __darwin_suseconds_t suseconds_t;
32#endif /* _SUSECONDS_T */
lib/libc/include/x86_64-macos-gnu/sys/_types/_timeval32.h created+38
......@@ -0,0 +1,38 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _STRUCT_TIMEVAL32
29#define _STRUCT_TIMEVAL32 struct timeval32
30
31#include <machine/types.h> /* __int32_t */
32
33_STRUCT_TIMEVAL32
34{
35 __int32_t tv_sec; /* seconds */
36 __int32_t tv_usec; /* and microseconds */
37};
38#endif /* _STRUCT_TIMEVAL32 */
lib/libc/include/x86_64-macos-gnu/sys/_types/_timeval64.h created+38
......@@ -0,0 +1,38 @@
1/*
2 * Copyright (c) 2015 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#ifndef _STRUCT_TIMEVAL64
30#define _STRUCT_TIMEVAL64
31
32#include <machine/types.h> /* __int64_t */
33
34struct timeval64 {
35 __int64_t tv_sec; /* seconds */
36 __int64_t tv_usec; /* and microseconds */
37};
38#endif /* _STRUCT_TIMEVAL32 */
lib/libc/include/x86_64-macos-gnu/sys/_types/_u_char.h created+31
......@@ -0,0 +1,31 @@
1/*
2 * Copyright (c) 2017 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _U_CHAR
29#define _U_CHAR
30typedef unsigned char u_char;
31#endif /* _U_CHAR */
lib/libc/include/x86_64-macos-gnu/sys/_types/_u_int.h created+31
......@@ -0,0 +1,31 @@
1/*
2 * Copyright (c) 2017 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _U_INT
29#define _U_INT
30typedef unsigned int u_int;
31#endif /* _U_INT */
lib/libc/include/x86_64-macos-gnu/sys/_types/_u_short.h created+31
......@@ -0,0 +1,31 @@
1/*
2 * Copyright (c) 2017 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _U_SHORT
29#define _U_SHORT
30typedef unsigned short u_short;
31#endif /* _U_SHORT */
lib/libc/include/x86_64-macos-gnu/sys/_types/_useconds_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _USECONDS_T
29#define _USECONDS_T
30#include <sys/_types.h> /* __darwin_useconds_t */
31typedef __darwin_useconds_t useconds_t;
32#endif /* _USECONDS_T */
lib/libc/include/x86_64-macos-gnu/sys/_types/_uuid_t.h created+32
......@@ -0,0 +1,32 @@
1/*
2 * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _UUID_T
29#define _UUID_T
30#include <sys/_types.h> /* __darwin_uuid_t */
31typedef __darwin_uuid_t uuid_t;
32#endif /* _UUID_T */
lib/libc/include/x86_64-macos-gnu/sys/aio.h created+248
......@@ -0,0 +1,248 @@
1/*
2 * Copyright (c) 2003-2006 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * File: sys/aio.h
30 * Author: Umesh Vaishampayan [umeshv@apple.com]
31 * 05-Feb-2003 umeshv Created.
32 *
33 * Header file for POSIX Asynchronous IO APIs
34 *
35 */
36
37#ifndef _SYS_AIO_H_
38#define _SYS_AIO_H_
39
40#include <sys/signal.h>
41#include <sys/_types.h>
42#include <sys/cdefs.h>
43
44/*
45 * [XSI] Inclusion of the <aio.h> header may make visible symbols defined
46 * in the headers <fcntl.h>, <signal.h>, <sys/types.h>, and <time.h>.
47 *
48 * In our case, this is limited to struct timespec, off_t and ssize_t.
49 */
50#include <sys/_types/_timespec.h>
51
52#include <sys/_types/_off_t.h>
53#include <sys/_types/_ssize_t.h>
54
55/*
56 * A aio_fsync() options that the calling thread is to continue execution
57 * while the lio_listio() operation is being performed, and no notification
58 * is given when the operation is complete
59 *
60 * [XSI] from <fcntl.h>
61 */
62#include <sys/_types/_o_sync.h>
63#include <sys/_types/_o_dsync.h>
64
65struct aiocb {
66 int aio_fildes; /* File descriptor */
67 off_t aio_offset; /* File offset */
68 volatile void *aio_buf; /* Location of buffer */
69 size_t aio_nbytes; /* Length of transfer */
70 int aio_reqprio; /* Request priority offset */
71 struct sigevent aio_sigevent; /* Signal number and value */
72 int aio_lio_opcode; /* Operation to be performed */
73};
74
75
76/*
77 * aio_cancel() return values
78 */
79
80/*
81 * none of the requested operations could be canceled since they are
82 * already complete.
83 */
84#define AIO_ALLDONE 0x1
85
86/* all requested operations have been canceled */
87#define AIO_CANCELED 0x2
88
89/*
90 * some of the requested operations could not be canceled since
91 * they are in progress
92 */
93#define AIO_NOTCANCELED 0x4
94
95
96/*
97 * lio_listio operation options
98 */
99
100#define LIO_NOP 0x0 /* option indicating that no transfer is requested */
101#define LIO_READ 0x1 /* option requesting a read */
102#define LIO_WRITE 0x2 /* option requesting a write */
103
104/*
105 * lio_listio() modes
106 */
107
108/*
109 * A lio_listio() synchronization operation indicating
110 * that the calling thread is to continue execution while
111 * the lio_listio() operation is being performed, and no
112 * notification is given when the operation is complete
113 */
114#define LIO_NOWAIT 0x1
115
116/*
117 * A lio_listio() synchronization operation indicating
118 * that the calling thread is to suspend until the
119 * lio_listio() operation is complete.
120 */
121#define LIO_WAIT 0x2
122
123/*
124 * Maximum number of operations in single lio_listio call
125 */
126#define AIO_LISTIO_MAX 16
127
128
129/*
130 * Prototypes
131 */
132
133__BEGIN_DECLS
134
135/*
136 * Attempt to cancel one or more asynchronous I/O requests currently outstanding
137 * against file descriptor fd. The aiocbp argument points to the asynchronous I/O
138 * control block for a particular request to be canceled. If aiocbp is NULL, then
139 * all outstanding cancelable asynchronous I/O requests against fd shall be canceled.
140 */
141int aio_cancel( int fd,
142 struct aiocb * aiocbp );
143
144/*
145 * Return the error status associated with the aiocb structure referenced by the
146 * aiocbp argument. The error status for an asynchronous I/O operation is the errno
147 * value that would be set by the corresponding read(), write(), or fsync()
148 * operation. If the operation has not yet completed, then the error status shall
149 * be equal to [EINPROGRESS].
150 */
151int aio_error( const struct aiocb * aiocbp );
152
153/*
154 * Asynchronously force all I/O operations associated with the file indicated by
155 * the file descriptor aio_fildes member of the aiocb structure referenced by the
156 * aiocbp argument and queued at the time of the call to aio_fsync() to the
157 * synchronized I/O completion state. The function call shall return when the
158 * synchronization request has been initiated or queued. op O_SYNC is the only
159 * supported opertation at this time.
160 * The aiocbp argument refers to an asynchronous I/O control block. The aiocbp
161 * value may be used as an argument to aio_error() and aio_return() in order to
162 * determine the error status and return status, respectively, of the asynchronous
163 * operation while it is proceeding. When the request is queued, the error status
164 * for the operation is [EINPROGRESS]. When all data has been successfully
165 * transferred, the error status shall be reset to reflect the success or failure
166 * of the operation.
167 */
168int aio_fsync( int op,
169 struct aiocb * aiocbp );
170
171/*
172 * Read aiocbp->aio_nbytes from the file associated with aiocbp->aio_fildes into
173 * the buffer pointed to by aiocbp->aio_buf. The function call shall return when
174 * the read request has been initiated or queued.
175 * The aiocbp value may be used as an argument to aio_error() and aio_return() in
176 * order to determine the error status and return status, respectively, of the
177 * asynchronous operation while it is proceeding. If an error condition is
178 * encountered during queuing, the function call shall return without having
179 * initiated or queued the request. The requested operation takes place at the
180 * absolute position in the file as given by aio_offset, as if lseek() were called
181 * immediately prior to the operation with an offset equal to aio_offset and a
182 * whence equal to SEEK_SET. After a successful call to enqueue an asynchronous
183 * I/O operation, the value of the file offset for the file is unspecified.
184 */
185int aio_read( struct aiocb * aiocbp );
186
187/*
188 * Return the return status associated with the aiocb structure referenced by
189 * the aiocbp argument. The return status for an asynchronous I/O operation is
190 * the value that would be returned by the corresponding read(), write(), or
191 * fsync() function call. If the error status for the operation is equal to
192 * [EINPROGRESS], then the return status for the operation is undefined. The
193 * aio_return() function may be called exactly once to retrieve the return status
194 * of a given asynchronous operation; thereafter, if the same aiocb structure
195 * is used in a call to aio_return() or aio_error(), an error may be returned.
196 * When the aiocb structure referred to by aiocbp is used to submit another
197 * asynchronous operation, then aio_return() may be successfully used to
198 * retrieve the return status of that operation.
199 */
200ssize_t aio_return( struct aiocb * aiocbp );
201
202/*
203 * Suspend the calling thread until at least one of the asynchronous I/O
204 * operations referenced by the aiocblist argument has completed, until a signal
205 * interrupts the function, or, if timeout is not NULL, until the time
206 * interval specified by timeout has passed. If any of the aiocb structures
207 * in the aiocblist correspond to completed asynchronous I/O operations (that is,
208 * the error status for the operation is not equal to [EINPROGRESS]) at the
209 * time of the call, the function shall return without suspending the calling
210 * thread. The aiocblist argument is an array of pointers to asynchronous I/O
211 * control blocks. The nent argument indicates the number of elements in the
212 * array. Each aiocb structure pointed to has been used in initiating an
213 * asynchronous I/O request via aio_read(), aio_write(), or lio_listio(). This
214 * array may contain NULL pointers, which are ignored.
215 */
216int aio_suspend( const struct aiocb *const aiocblist[],
217 int nent,
218 const struct timespec * timeoutp ) __DARWIN_ALIAS_C(aio_suspend);
219
220/*
221 * Write aiocbp->aio_nbytes to the file associated with aiocbp->aio_fildes from
222 * the buffer pointed to by aiocbp->aio_buf. The function shall return when the
223 * write request has been initiated or, at a minimum, queued.
224 * The aiocbp argument may be used as an argument to aio_error() and aio_return()
225 * in order to determine the error status and return status, respectively, of the
226 * asynchronous operation while it is proceeding.
227 */
228int aio_write( struct aiocb * aiocbp );
229
230/*
231 * Initiate a list of I/O requests with a single function call. The mode
232 * argument takes one of the values LIO_WAIT or LIO_NOWAIT and determines whether
233 * the function returns when the I/O operations have been completed, or as soon
234 * as the operations have been queued. If the mode argument is LIO_WAIT, the
235 * function shall wait until all I/O is complete and the sig argument shall be
236 * ignored.
237 * If the mode argument is LIO_NOWAIT, the function shall return immediately, and
238 * asynchronous notification shall occur, according to the sig argument, when all
239 * the I/O operations complete. If sig is NULL, then no asynchronous notification
240 * shall occur.
241 */
242int lio_listio( int mode,
243 struct aiocb *const aiocblist[],
244 int nent,
245 struct sigevent *sigp );
246__END_DECLS
247
248#endif /* _SYS_AIO_H_ */
lib/libc/include/x86_64-macos-gnu/sys/dirent.h created+141
......@@ -0,0 +1,141 @@
1/*
2 * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
29/*-
30 * Copyright (c) 1989, 1993
31 * The Regents of the University of California. All rights reserved.
32 *
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
35 * are met:
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in the
40 * documentation and/or other materials provided with the distribution.
41 * 3. All advertising materials mentioning features or use of this software
42 * must display the following acknowledgement:
43 * This product includes software developed by the University of
44 * California, Berkeley and its contributors.
45 * 4. Neither the name of the University nor the names of its contributors
46 * may be used to endorse or promote products derived from this software
47 * without specific prior written permission.
48 *
49 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE.
60 *
61 * @(#)dirent.h 8.3 (Berkeley) 8/10/94
62 */
63
64/*
65 * The dirent structure defines the format of directory entries.
66 *
67 * A directory entry has a struct dirent at the front of it, containing its
68 * inode number, the length of the entry, and the length of the name
69 * contained in the entry. These are followed by the name padded to a 4
70 * byte boundary with null bytes. All names are guaranteed null terminated.
71 * The maximum length of a name in a directory is MAXNAMLEN when 32-bit
72 * ino_t is in effect; (MAXPATHLEN - 1) when 64-bit ino_t is in effect.
73 */
74
75#ifndef _SYS_DIRENT_H
76#define _SYS_DIRENT_H
77
78#include <sys/_types.h>
79#include <sys/cdefs.h>
80
81#include <sys/_types/_ino_t.h>
82
83
84#define __DARWIN_MAXNAMLEN 255
85
86#pragma pack(4)
87
88#if !__DARWIN_64_BIT_INO_T
89struct dirent {
90 ino_t d_ino; /* file number of entry */
91 __uint16_t d_reclen; /* length of this record */
92 __uint8_t d_type; /* file type, see below */
93 __uint8_t d_namlen; /* length of string in d_name */
94 char d_name[__DARWIN_MAXNAMLEN + 1]; /* name must be no longer than this */
95};
96#endif /* !__DARWIN_64_BIT_INO_T */
97
98#pragma pack()
99
100#define __DARWIN_MAXPATHLEN 1024
101
102#define __DARWIN_STRUCT_DIRENTRY { \
103 __uint64_t d_ino; /* file number of entry */ \
104 __uint64_t d_seekoff; /* seek offset (optional, used by servers) */ \
105 __uint16_t d_reclen; /* length of this record */ \
106 __uint16_t d_namlen; /* length of string in d_name */ \
107 __uint8_t d_type; /* file type, see below */ \
108 char d_name[__DARWIN_MAXPATHLEN]; /* entry name (up to MAXPATHLEN bytes) */ \
109}
110
111#if __DARWIN_64_BIT_INO_T
112struct dirent __DARWIN_STRUCT_DIRENTRY;
113#endif /* __DARWIN_64_BIT_INO_T */
114
115
116
117#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
118#define d_fileno d_ino /* backward compatibility */
119#define MAXNAMLEN __DARWIN_MAXNAMLEN
120/*
121 * File types
122 */
123#define DT_UNKNOWN 0
124#define DT_FIFO 1
125#define DT_CHR 2
126#define DT_DIR 4
127#define DT_BLK 6
128#define DT_REG 8
129#define DT_LNK 10
130#define DT_SOCK 12
131#define DT_WHT 14
132
133/*
134 * Convert between stat structure types and directory types.
135 */
136#define IFTODT(mode) (((mode) & 0170000) >> 12)
137#define DTTOIF(dirtype) ((dirtype) << 12)
138#endif
139
140
141#endif /* _SYS_DIRENT_H */
lib/libc/include/x86_64-macos-gnu/sys/fcntl.h created+557
......@@ -0,0 +1,557 @@
1/*
2 * Copyright (c) 2000-2013 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
29/*-
30 * Copyright (c) 1983, 1990, 1993
31 * The Regents of the University of California. All rights reserved.
32 * (c) UNIX System Laboratories, Inc.
33 * All or some portions of this file are derived from material licensed
34 * to the University of California by American Telephone and Telegraph
35 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
36 * the permission of UNIX System Laboratories, Inc.
37 *
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
40 * are met:
41 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution.
46 * 3. All advertising materials mentioning features or use of this software
47 * must display the following acknowledgement:
48 * This product includes software developed by the University of
49 * California, Berkeley and its contributors.
50 * 4. Neither the name of the University nor the names of its contributors
51 * may be used to endorse or promote products derived from this software
52 * without specific prior written permission.
53 *
54 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 * SUCH DAMAGE.
65 *
66 * @(#)fcntl.h 8.3 (Berkeley) 1/21/94
67 */
68
69
70#ifndef _SYS_FCNTL_H_
71#define _SYS_FCNTL_H_
72
73/*
74 * This file includes the definitions for open and fcntl
75 * described by POSIX for <fcntl.h>; it also includes
76 * related kernel definitions.
77 */
78#include <sys/_types.h>
79#include <sys/cdefs.h>
80#include <Availability.h>
81
82/* We should not be exporting size_t here. Temporary for gcc bootstrapping. */
83#include <sys/_types/_size_t.h>
84#include <sys/_types/_mode_t.h>
85#include <sys/_types/_off_t.h>
86#include <sys/_types/_pid_t.h>
87
88/*
89 * File status flags: these are used by open(2), fcntl(2).
90 * They are also used (indirectly) in the kernel file structure f_flags,
91 * which is a superset of the open/fcntl flags. Open flags and f_flags
92 * are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags).
93 * Open/fcntl flags begin with O_; kernel-internal flags begin with F.
94 */
95/* open-only flags */
96#define O_RDONLY 0x0000 /* open for reading only */
97#define O_WRONLY 0x0001 /* open for writing only */
98#define O_RDWR 0x0002 /* open for reading and writing */
99#define O_ACCMODE 0x0003 /* mask for above modes */
100
101/*
102 * Kernel encoding of open mode; separate read and write bits that are
103 * independently testable: 1 greater than the above.
104 *
105 * XXX
106 * FREAD and FWRITE are excluded from the #ifdef KERNEL so that TIOCFLUSH,
107 * which was documented to use FREAD/FWRITE, continues to work.
108 */
109#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
110#define FREAD 0x0001
111#define FWRITE 0x0002
112#endif
113#define O_NONBLOCK 0x0004 /* no delay */
114#define O_APPEND 0x0008 /* set append mode */
115
116#include <sys/_types/_o_sync.h>
117
118#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
119#define O_SHLOCK 0x0010 /* open with shared file lock */
120#define O_EXLOCK 0x0020 /* open with exclusive file lock */
121#define O_ASYNC 0x0040 /* signal pgrp when data ready */
122#define O_FSYNC O_SYNC /* source compatibility: do not use */
123#define O_NOFOLLOW 0x0100 /* don't follow symlinks */
124#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
125#define O_CREAT 0x0200 /* create if nonexistant */
126#define O_TRUNC 0x0400 /* truncate to zero length */
127#define O_EXCL 0x0800 /* error if already exists */
128
129#if __DARWIN_C_LEVEL >= 200809L
130/*
131 * Descriptor value for the current working directory
132 */
133#define AT_FDCWD -2
134
135/*
136 * Flags for the at functions
137 */
138#define AT_EACCESS 0x0010 /* Use effective ids in access check */
139#define AT_SYMLINK_NOFOLLOW 0x0020 /* Act on the symlink itself not the target */
140#define AT_SYMLINK_FOLLOW 0x0040 /* Act on target of symlink */
141#define AT_REMOVEDIR 0x0080 /* Path refers to directory */
142#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
143#define AT_REALDEV 0x0200 /* Return real device inodes resides on for fstatat(2) */
144#define AT_FDONLY 0x0400 /* Use only the fd and Ignore the path for fstatat(2) */
145#endif
146#endif
147
148#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
149#define O_EVTONLY 0x8000 /* descriptor requested for event notifications only */
150#endif
151
152
153#define O_NOCTTY 0x20000 /* don't assign controlling terminal */
154
155
156#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
157#define O_DIRECTORY 0x100000
158#define O_SYMLINK 0x200000 /* allow open of a symlink */
159#endif
160
161#include <sys/_types/_o_dsync.h>
162
163
164#if __DARWIN_C_LEVEL >= 200809L
165#define O_CLOEXEC 0x1000000 /* implicitly set FD_CLOEXEC */
166#endif
167
168
169
170
171
172/* Data Protection Flags */
173#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
174#define O_DP_GETRAWENCRYPTED 0x0001
175#define O_DP_GETRAWUNENCRYPTED 0x0002
176#endif
177
178
179
180/*
181 * The O_* flags used to have only F* names, which were used in the kernel
182 * and by fcntl. We retain the F* names for the kernel f_flags field
183 * and for backward compatibility for fcntl.
184 */
185#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
186#define FAPPEND O_APPEND /* kernel/compat */
187#define FASYNC O_ASYNC /* kernel/compat */
188#define FFSYNC O_FSYNC /* kernel */
189#define FFDSYNC O_DSYNC /* kernel */
190#define FNONBLOCK O_NONBLOCK /* kernel */
191#define FNDELAY O_NONBLOCK /* compat */
192#define O_NDELAY O_NONBLOCK /* compat */
193#endif
194
195/*
196 * Flags used for copyfile(2)
197 */
198
199#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
200#define CPF_OVERWRITE 0x0001
201#define CPF_IGNORE_MODE 0x0002
202#define CPF_MASK (CPF_OVERWRITE|CPF_IGNORE_MODE)
203#endif
204
205/*
206 * Constants used for fcntl(2)
207 */
208
209/* command values */
210#define F_DUPFD 0 /* duplicate file descriptor */
211#define F_GETFD 1 /* get file descriptor flags */
212#define F_SETFD 2 /* set file descriptor flags */
213#define F_GETFL 3 /* get file status flags */
214#define F_SETFL 4 /* set file status flags */
215#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */
216#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */
217#define F_GETLK 7 /* get record locking information */
218#define F_SETLK 8 /* set record locking information */
219#define F_SETLKW 9 /* F_SETLK; wait if blocked */
220#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
221#define F_SETLKWTIMEOUT 10 /* F_SETLK; wait if blocked, return on timeout */
222#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
223#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
224#define F_FLUSH_DATA 40
225#define F_CHKCLEAN 41 /* Used for regression test */
226#define F_PREALLOCATE 42 /* Preallocate storage */
227#define F_SETSIZE 43 /* Truncate a file without zeroing space */
228#define F_RDADVISE 44 /* Issue an advisory read async with no copy to user */
229#define F_RDAHEAD 45 /* turn read ahead off/on for this fd */
230/*
231 * 46,47 used to be F_READBOOTSTRAP and F_WRITEBOOTSTRAP
232 */
233#define F_NOCACHE 48 /* turn data caching off/on for this fd */
234#define F_LOG2PHYS 49 /* file offset to device offset */
235#define F_GETPATH 50 /* return the full path of the fd */
236#define F_FULLFSYNC 51 /* fsync + ask the drive to flush to the media */
237#define F_PATHPKG_CHECK 52 /* find which component (if any) is a package */
238#define F_FREEZE_FS 53 /* "freeze" all fs operations */
239#define F_THAW_FS 54 /* "thaw" all fs operations */
240#define F_GLOBAL_NOCACHE 55 /* turn data caching off/on (globally) for this file */
241
242
243#define F_ADDSIGS 59 /* add detached signatures */
244
245
246#define F_ADDFILESIGS 61 /* add signature from same file (used by dyld for shared libs) */
247
248#define F_NODIRECT 62 /* used in conjunction with F_NOCACHE to indicate that DIRECT, synchonous writes */
249 /* should not be used (i.e. its ok to temporaily create cached pages) */
250
251#define F_GETPROTECTIONCLASS 63 /* Get the protection class of a file from the EA, returns int */
252#define F_SETPROTECTIONCLASS 64 /* Set the protection class of a file for the EA, requires int */
253
254#define F_LOG2PHYS_EXT 65 /* file offset to device offset, extended */
255
256#define F_GETLKPID 66 /* get record locking information, per-process */
257
258/* See F_DUPFD_CLOEXEC below for 67 */
259
260
261#define F_SETBACKINGSTORE 70 /* Mark the file as being the backing store for another filesystem */
262#define F_GETPATH_MTMINFO 71 /* return the full path of the FD, but error in specific mtmd circumstances */
263
264#define F_GETCODEDIR 72 /* Returns the code directory, with associated hashes, to the caller */
265
266#define F_SETNOSIGPIPE 73 /* No SIGPIPE generated on EPIPE */
267#define F_GETNOSIGPIPE 74 /* Status of SIGPIPE for this fd */
268
269#define F_TRANSCODEKEY 75 /* For some cases, we need to rewrap the key for AKS/MKB */
270
271#define F_SINGLE_WRITER 76 /* file being written to a by single writer... if throttling enabled, writes */
272 /* may be broken into smaller chunks with throttling in between */
273
274#define F_GETPROTECTIONLEVEL 77 /* Get the protection version number for this filesystem */
275
276#define F_FINDSIGS 78 /* Add detached code signatures (used by dyld for shared libs) */
277
278
279#define F_ADDFILESIGS_FOR_DYLD_SIM 83 /* Add signature from same file, only if it is signed by Apple (used by dyld for simulator) */
280
281
282#define F_BARRIERFSYNC 85 /* fsync + issue barrier to drive */
283
284
285#define F_ADDFILESIGS_RETURN 97 /* Add signature from same file, return end offset in structure on success */
286#define F_CHECK_LV 98 /* Check if Library Validation allows this Mach-O file to be mapped into the calling process */
287
288#define F_PUNCHHOLE 99 /* Deallocate a range of the file */
289
290#define F_TRIM_ACTIVE_FILE 100 /* Trim an active file */
291
292#define F_SPECULATIVE_READ 101 /* Synchronous advisory read fcntl for regular and compressed file */
293
294#define F_GETPATH_NOFIRMLINK 102 /* return the full path without firmlinks of the fd */
295
296// FS-specific fcntl()'s numbers begin at 0x00010000 and go up
297#define FCNTL_FS_SPECIFIC_BASE 0x00010000
298
299#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
300
301#if __DARWIN_C_LEVEL >= 200809L
302#define F_DUPFD_CLOEXEC 67 /* mark the dup with FD_CLOEXEC */
303#endif
304
305/* file descriptor flags (F_GETFD, F_SETFD) */
306#define FD_CLOEXEC 1 /* close-on-exec flag */
307
308/* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */
309#define F_RDLCK 1 /* shared or read lock */
310#define F_UNLCK 2 /* unlock */
311#define F_WRLCK 3 /* exclusive or write lock */
312
313
314/*
315 * [XSI] The values used for l_whence shall be defined as described
316 * in <unistd.h>
317 */
318#include <sys/_types/_seek_set.h>
319
320/*
321 * [XSI] The symbolic names for file modes for use as values of mode_t
322 * shall be defined as described in <sys/stat.h>
323 */
324#include <sys/_types/_s_ifmt.h>
325
326#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
327/* allocate flags (F_PREALLOCATE) */
328
329#define F_ALLOCATECONTIG 0x00000002 /* allocate contigious space */
330#define F_ALLOCATEALL 0x00000004 /* allocate all requested space or no space at all */
331
332/* Position Modes (fst_posmode) for F_PREALLOCATE */
333
334#define F_PEOFPOSMODE 3 /* Make it past all of the SEEK pos modes so that */
335 /* we can keep them in sync should we desire */
336#define F_VOLPOSMODE 4 /* specify volume starting postion */
337#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
338
339/*
340 * Advisory file segment locking data type -
341 * information passed to system by user
342 */
343struct flock {
344 off_t l_start; /* starting offset */
345 off_t l_len; /* len = 0 means until end of file */
346 pid_t l_pid; /* lock owner */
347 short l_type; /* lock type: read/write, etc. */
348 short l_whence; /* type of l_start */
349};
350
351#include <sys/_types/_timespec.h>
352
353#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
354/*
355 * Advisory file segment locking with time out -
356 * Information passed to system by user for F_SETLKWTIMEOUT
357 */
358struct flocktimeout {
359 struct flock fl; /* flock passed for file locking */
360 struct timespec timeout; /* timespec struct for timeout */
361};
362#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
363
364#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
365/*
366 * advisory file read data type -
367 * information passed by user to system
368 */
369
370
371struct radvisory {
372 off_t ra_offset;
373 int ra_count;
374};
375
376
377/** Information the user passes in to get the codeblobs out of the kernel */
378typedef struct fcodeblobs {
379 void *f_cd_hash;
380 size_t f_hash_size;
381 void *f_cd_buffer;
382 size_t f_cd_size;
383 unsigned int *f_out_size;
384 int f_arch;
385 int __padding;
386} fcodeblobs_t;
387
388
389/*
390 * detached code signatures data type -
391 * information passed by user to system used by F_ADDSIGS and F_ADDFILESIGS.
392 * F_ADDFILESIGS is a shortcut for files that contain their own signature and
393 * doesn't require mapping of the file in order to load the signature.
394 */
395typedef struct fsignatures {
396 off_t fs_file_start;
397 void *fs_blob_start;
398 size_t fs_blob_size;
399} fsignatures_t;
400
401/*
402 * DYLD needs to check if the object is allowed to be combined
403 * into the main binary. This is done between the code signature
404 * is loaded and dyld is doing all the work to process the LOAD commands.
405 *
406 * While this could be done in F_ADDFILESIGS.* family the hook into
407 * the MAC module doesn't say no when LV isn't enabled and then that
408 * is cached on the vnode, and the MAC module never gets change once
409 * a process that library validation enabled.
410 */
411typedef struct fchecklv {
412 off_t lv_file_start;
413 size_t lv_error_message_size;
414 void *lv_error_message;
415} fchecklv_t;
416
417
418
419/* lock operations for flock(2) */
420#define LOCK_SH 0x01 /* shared file lock */
421#define LOCK_EX 0x02 /* exclusive file lock */
422#define LOCK_NB 0x04 /* don't block when locking */
423#define LOCK_UN 0x08 /* unlock file */
424
425/* fstore_t type used by F_PREALLOCATE command */
426
427typedef struct fstore {
428 unsigned int fst_flags; /* IN: flags word */
429 int fst_posmode; /* IN: indicates use of offset field */
430 off_t fst_offset; /* IN: start of the region */
431 off_t fst_length; /* IN: size of the region */
432 off_t fst_bytesalloc; /* OUT: number of bytes allocated */
433} fstore_t;
434
435/* fpunchhole_t used by F_PUNCHHOLE */
436typedef struct fpunchhole {
437 unsigned int fp_flags; /* unused */
438 unsigned int reserved; /* (to maintain 8-byte alignment) */
439 off_t fp_offset; /* IN: start of the region */
440 off_t fp_length; /* IN: size of the region */
441} fpunchhole_t;
442
443/* factive_file_trim_t used by F_TRIM_ACTIVE_FILE */
444typedef struct ftrimactivefile {
445 off_t fta_offset; /* IN: start of the region */
446 off_t fta_length; /* IN: size of the region */
447} ftrimactivefile_t;
448
449/* fspecread_t used by F_SPECULATIVE_READ */
450typedef struct fspecread {
451 unsigned int fsr_flags; /* IN: flags word */
452 unsigned int reserved; /* to maintain 8-byte alignment */
453 off_t fsr_offset; /* IN: start of the region */
454 off_t fsr_length; /* IN: size of the region */
455} fspecread_t;
456
457/* fbootstraptransfer_t used by F_READBOOTSTRAP and F_WRITEBOOTSTRAP commands */
458
459typedef struct fbootstraptransfer {
460 off_t fbt_offset; /* IN: offset to start read/write */
461 size_t fbt_length; /* IN: number of bytes to transfer */
462 void *fbt_buffer; /* IN: buffer to be read/written */
463} fbootstraptransfer_t;
464
465
466/*
467 * For F_LOG2PHYS this information is passed back to user
468 * Currently only devoffset is returned - that is the VOP_BMAP
469 * result - the disk device address corresponding to the
470 * current file offset (likely set with an lseek).
471 *
472 * The flags could hold an indication of whether the # of
473 * contiguous bytes reflects the true extent length on disk,
474 * or is an advisory value that indicates there is at least that
475 * many bytes contiguous. For some filesystems it might be too
476 * inefficient to provide anything beyond the advisory value.
477 * Flags and contiguous bytes return values are not yet implemented.
478 * For them the fcntl will nedd to switch from using BMAP to CMAP
479 * and a per filesystem type flag will be needed to interpret the
480 * contiguous bytes count result from CMAP.
481 *
482 * F_LOG2PHYS_EXT is a variant of F_LOG2PHYS that uses a passed in
483 * file offset and length instead of the current file offset.
484 * F_LOG2PHYS_EXT operates on the same structure as F_LOG2PHYS, but
485 * treats it as an in/out.
486 */
487#pragma pack(4)
488
489struct log2phys {
490 unsigned int l2p_flags; /* unused so far */
491 off_t l2p_contigbytes; /* F_LOG2PHYS: unused so far */
492 /* F_LOG2PHYS_EXT: IN: number of bytes to be queried */
493 /* OUT: number of contiguous bytes at this position */
494 off_t l2p_devoffset; /* F_LOG2PHYS: OUT: bytes into device */
495 /* F_LOG2PHYS_EXT: IN: bytes into file */
496 /* OUT: bytes into device */
497};
498
499#pragma pack()
500
501#define O_POPUP 0x80000000 /* force window to popup on open */
502#define O_ALERT 0x20000000 /* small, clean popup window */
503
504
505#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
506
507
508#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
509
510#include <sys/_types/_filesec_t.h>
511
512typedef enum {
513 FILESEC_OWNER = 1,
514 FILESEC_GROUP = 2,
515 FILESEC_UUID = 3,
516 FILESEC_MODE = 4,
517 FILESEC_ACL = 5,
518 FILESEC_GRPUUID = 6,
519
520/* XXX these are private to the implementation */
521 FILESEC_ACL_RAW = 100,
522 FILESEC_ACL_ALLOCSIZE = 101
523} filesec_property_t;
524
525/* XXX backwards compatibility */
526#define FILESEC_GUID FILESEC_UUID
527#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
528
529__BEGIN_DECLS
530int open(const char *, int, ...) __DARWIN_ALIAS_C(open);
531#if __DARWIN_C_LEVEL >= 200809L
532int openat(int, const char *, int, ...) __DARWIN_NOCANCEL(openat) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
533#endif
534int creat(const char *, mode_t) __DARWIN_ALIAS_C(creat);
535int fcntl(int, int, ...) __DARWIN_ALIAS_C(fcntl);
536#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
537
538int openx_np(const char *, int, filesec_t);
539/*
540 * data-protected non-portable open(2) :
541 * int open_dprotected_np(user_addr_t path, int flags, int class, int dpflags, int mode)
542 */
543int open_dprotected_np( const char *, int, int, int, ...);
544int flock(int, int);
545filesec_t filesec_init(void);
546filesec_t filesec_dup(filesec_t);
547void filesec_free(filesec_t);
548int filesec_get_property(filesec_t, filesec_property_t, void *);
549int filesec_query_property(filesec_t, filesec_property_t, int *);
550int filesec_set_property(filesec_t, filesec_property_t, const void *);
551int filesec_unset_property(filesec_t, filesec_property_t) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
552#define _FILESEC_UNSET_PROPERTY ((void *)0)
553#define _FILESEC_REMOVE_ACL ((void *)1)
554#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
555__END_DECLS
556
557#endif /* !_SYS_FCNTL_H_ */
lib/libc/include/x86_64-macos-gnu/sys/ioccom.h created+99
......@@ -0,0 +1,99 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
29/*-
30 * Copyright (c) 1982, 1986, 1990, 1993, 1994
31 * The Regents of the University of California. All rights reserved.
32 *
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
35 * are met:
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in the
40 * documentation and/or other materials provided with the distribution.
41 * 3. All advertising materials mentioning features or use of this software
42 * must display the following acknowledgement:
43 * This product includes software developed by the University of
44 * California, Berkeley and its contributors.
45 * 4. Neither the name of the University nor the names of its contributors
46 * may be used to endorse or promote products derived from this software
47 * without specific prior written permission.
48 *
49 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE.
60 *
61 * @(#)ioccom.h 8.2 (Berkeley) 3/28/94
62 */
63
64#ifndef _SYS_IOCCOM_H_
65#define _SYS_IOCCOM_H_
66
67#include <sys/_types.h>
68
69/*
70 * Ioctl's have the command encoded in the lower word, and the size of
71 * any in or out parameters in the upper word. The high 3 bits of the
72 * upper word are used to encode the in/out status of the parameter.
73 */
74#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */
75#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK)
76#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16))
77#define IOCGROUP(x) (((x) >> 8) & 0xff)
78
79#define IOCPARM_MAX (IOCPARM_MASK + 1) /* max size of ioctl args */
80/* no parameters */
81#define IOC_VOID (__uint32_t)0x20000000
82/* copy parameters out */
83#define IOC_OUT (__uint32_t)0x40000000
84/* copy parameters in */
85#define IOC_IN (__uint32_t)0x80000000
86/* copy paramters in and out */
87#define IOC_INOUT (IOC_IN|IOC_OUT)
88/* mask for IN/OUT/VOID */
89#define IOC_DIRMASK (__uint32_t)0xe0000000
90
91#define _IOC(inout, group, num, len) \
92 (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
93#define _IO(g, n) _IOC(IOC_VOID, (g), (n), 0)
94#define _IOR(g, n, t) _IOC(IOC_OUT, (g), (n), sizeof(t))
95#define _IOW(g, n, t) _IOC(IOC_IN, (g), (n), sizeof(t))
96/* this should be _IORW, but stdio got there first */
97#define _IOWR(g, n, t) _IOC(IOC_INOUT, (g), (n), sizeof(t))
98
99#endif /* !_SYS_IOCCOM_H_ */
lib/libc/include/x86_64-macos-gnu/sys/ipc.h created+176
......@@ -0,0 +1,176 @@
1/*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * Copyright (c) 1988 University of Utah.
30 * Copyright (c) 1990, 1993
31 * The Regents of the University of California. All rights reserved.
32 * (c) UNIX System Laboratories, Inc.
33 * All or some portions of this file are derived from material licensed
34 * to the University of California by American Telephone and Telegraph
35 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
36 * the permission of UNIX System Laboratories, Inc.
37 *
38 * This code is derived from software contributed to Berkeley by
39 * the Systems Programming Group of the University of Utah Computer
40 * Science Department.
41 *
42 * Redistribution and use in source and binary forms, with or without
43 * modification, are permitted provided that the following conditions
44 * are met:
45 * 1. Redistributions of source code must retain the above copyright
46 * notice, this list of conditions and the following disclaimer.
47 * 2. Redistributions in binary form must reproduce the above copyright
48 * notice, this list of conditions and the following disclaimer in the
49 * documentation and/or other materials provided with the distribution.
50 * 3. All advertising materials mentioning features or use of this software
51 * must display the following acknowledgement:
52 * This product includes software developed by the University of
53 * California, Berkeley and its contributors.
54 * 4. Neither the name of the University nor the names of its contributors
55 * may be used to endorse or promote products derived from this software
56 * without specific prior written permission.
57 *
58 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
59 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
60 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
61 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
62 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
63 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
64 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
65 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
66 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
67 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
68 * SUCH DAMAGE.
69 *
70 * @(#)ipc.h 8.4 (Berkeley) 2/19/95
71 */
72
73/*
74 * SVID compatible ipc.h file
75 */
76#ifndef _SYS_IPC_H_
77#define _SYS_IPC_H_
78
79#include <sys/appleapiopts.h>
80#include <sys/cdefs.h>
81
82#include <sys/_types.h>
83
84/*
85 * [XSI] The uid_t, gid_t, mode_t, and key_t types SHALL be defined as
86 * described in <sys/types.h>.
87 */
88#include <sys/_types/_uid_t.h>
89#include <sys/_types/_gid_t.h>
90#include <sys/_types/_mode_t.h>
91#include <sys/_types/_key_t.h>
92
93
94#pragma pack(4)
95
96/*
97 * Technically, we should force all code references to the new structure
98 * definition, not in just the standards conformance case, and leave the
99 * legacy interface there for binary compatibility only. Currently, we
100 * are only forcing this for programs requesting standards conformance.
101 */
102#if __DARWIN_UNIX03 || defined(KERNEL)
103/*
104 * [XSI] Information used in determining permission to perform an IPC
105 * operation
106 */
107struct ipc_perm {
108 uid_t uid; /* [XSI] Owner's user ID */
109 gid_t gid; /* [XSI] Owner's group ID */
110 uid_t cuid; /* [XSI] Creator's user ID */
111 gid_t cgid; /* [XSI] Creator's group ID */
112 mode_t mode; /* [XSI] Read/write permission */
113 unsigned short _seq; /* Reserved for internal use */
114 key_t _key; /* Reserved for internal use */
115};
116#define __ipc_perm_new ipc_perm
117#else /* !__DARWIN_UNIX03 */
118#define ipc_perm __ipc_perm_old
119#endif /* !__DARWIN_UNIX03 */
120
121#if !__DARWIN_UNIX03
122/*
123 * Legacy structure; this structure is maintained for binary backward
124 * compatability with previous versions of the interface. New code
125 * should not use this interface, since ID values may be truncated.
126 */
127struct __ipc_perm_old {
128 __uint16_t cuid; /* Creator's user ID */
129 __uint16_t cgid; /* Creator's group ID */
130 __uint16_t uid; /* Owner's user ID */
131 __uint16_t gid; /* Owner's group ID */
132 mode_t mode; /* Read/Write permission */
133 __uint16_t seq; /* Reserved for internal use */
134 key_t key; /* Reserved for internal use */
135};
136#endif /* !__DARWIN_UNIX03 */
137
138#pragma pack()
139
140/*
141 * [XSI] Definitions shall be provided for the following constants:
142 */
143
144/* Mode bits */
145#define IPC_CREAT 001000 /* Create entry if key does not exist */
146#define IPC_EXCL 002000 /* Fail if key exists */
147#define IPC_NOWAIT 004000 /* Error if request must wait */
148
149/* Keys */
150#define IPC_PRIVATE ((key_t)0) /* Private key */
151
152/* Control commands */
153#define IPC_RMID 0 /* Remove identifier */
154#define IPC_SET 1 /* Set options */
155#define IPC_STAT 2 /* Get options */
156
157
158#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
159
160/* common mode bits */
161#define IPC_R 000400 /* Read permission */
162#define IPC_W 000200 /* Write/alter permission */
163#define IPC_M 010000 /* Modify control info permission */
164
165#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
166
167
168
169
170__BEGIN_DECLS
171/* [XSI] */
172key_t ftok(const char *, int);
173__END_DECLS
174
175
176#endif /* !_SYS_IPC_H_ */
lib/libc/include/x86_64-macos-gnu/sys/mman.h created+250
......@@ -0,0 +1,250 @@
1/*
2 * Copyright (c) 2000-2019 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
29/*-
30 * Copyright (c) 1982, 1986, 1993
31 * The Regents of the University of California. All rights reserved.
32 *
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
35 * are met:
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in the
40 * documentation and/or other materials provided with the distribution.
41 * 3. All advertising materials mentioning features or use of this software
42 * must display the following acknowledgement:
43 * This product includes software developed by the University of
44 * California, Berkeley and its contributors.
45 * 4. Neither the name of the University nor the names of its contributors
46 * may be used to endorse or promote products derived from this software
47 * without specific prior written permission.
48 *
49 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE.
60 *
61 * @(#)mman.h 8.1 (Berkeley) 6/2/93
62 */
63
64/*
65 * Currently unsupported:
66 *
67 * [TYM] POSIX_TYPED_MEM_ALLOCATE
68 * [TYM] POSIX_TYPED_MEM_ALLOCATE_CONTIG
69 * [TYM] POSIX_TYPED_MEM_MAP_ALLOCATABLE
70 * [TYM] struct posix_typed_mem_info
71 * [TYM] posix_mem_offset()
72 * [TYM] posix_typed_mem_get_info()
73 * [TYM] posix_typed_mem_open()
74 */
75
76#ifndef _SYS_MMAN_H_
77#define _SYS_MMAN_H_
78
79#include <sys/appleapiopts.h>
80#include <sys/cdefs.h>
81
82#include <sys/_types.h>
83
84/*
85 * [various] The mode_t, off_t, and size_t types shall be defined as
86 * described in <sys/types.h>
87 */
88#include <sys/_types/_mode_t.h>
89#include <sys/_types/_off_t.h>
90#include <sys/_types/_size_t.h>
91
92/*
93 * Protections are chosen from these bits, or-ed together
94 */
95#define PROT_NONE 0x00 /* [MC2] no permissions */
96#define PROT_READ 0x01 /* [MC2] pages can be read */
97#define PROT_WRITE 0x02 /* [MC2] pages can be written */
98#define PROT_EXEC 0x04 /* [MC2] pages can be executed */
99
100/*
101 * Flags contain sharing type and options.
102 * Sharing types; choose one.
103 */
104#define MAP_SHARED 0x0001 /* [MF|SHM] share changes */
105#define MAP_PRIVATE 0x0002 /* [MF|SHM] changes are private */
106#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
107#define MAP_COPY MAP_PRIVATE /* Obsolete */
108#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
109
110/*
111 * Other flags
112 */
113#define MAP_FIXED 0x0010 /* [MF|SHM] interpret addr exactly */
114#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
115#define MAP_RENAME 0x0020 /* Sun: rename private pages to file */
116#define MAP_NORESERVE 0x0040 /* Sun: don't reserve needed swap area */
117#define MAP_RESERVED0080 0x0080 /* previously unimplemented MAP_INHERIT */
118#define MAP_NOEXTEND 0x0100 /* for MAP_FILE, don't change file size */
119#define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */
120#define MAP_NOCACHE 0x0400 /* don't cache pages for this mapping */
121#define MAP_JIT 0x0800 /* Allocate a region that will be used for JIT purposes */
122
123/*
124 * Mapping type
125 */
126#define MAP_FILE 0x0000 /* map from file (default) */
127#define MAP_ANON 0x1000 /* allocated from memory, swap space */
128#define MAP_ANONYMOUS MAP_ANON
129
130/*
131 * The MAP_RESILIENT_* flags can be used when the caller wants to map some
132 * possibly unreliable memory and be able to access it safely, possibly
133 * getting the wrong contents rather than raising any exception.
134 * For safety reasons, such mappings have to be read-only (PROT_READ access
135 * only).
136 *
137 * MAP_RESILIENT_CODESIGN:
138 * accessing this mapping will not generate code-signing violations,
139 * even if the contents are tainted.
140 * MAP_RESILIENT_MEDIA:
141 * accessing this mapping will not generate an exception if the contents
142 * are not available (unreachable removable or remote media, access beyond
143 * end-of-file, ...). Missing contents will be replaced with zeroes.
144 */
145#define MAP_RESILIENT_CODESIGN 0x2000 /* no code-signing failures */
146#define MAP_RESILIENT_MEDIA 0x4000 /* no backing-store failures */
147
148#if !defined(CONFIG_EMBEDDED)
149#define MAP_32BIT 0x8000 /* Return virtual addresses <4G only: Requires entitlement */
150#endif /* !defined(CONFIG_EMBEDDED) */
151
152#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
153
154/*
155 * Process memory locking
156 */
157#define MCL_CURRENT 0x0001 /* [ML] Lock only current memory */
158#define MCL_FUTURE 0x0002 /* [ML] Lock all future memory as well */
159
160/*
161 * Error return from mmap()
162 */
163#define MAP_FAILED ((void *)-1) /* [MF|SHM] mmap failed */
164
165/*
166 * msync() flags
167 */
168#define MS_ASYNC 0x0001 /* [MF|SIO] return immediately */
169#define MS_INVALIDATE 0x0002 /* [MF|SIO] invalidate all cached data */
170#define MS_SYNC 0x0010 /* [MF|SIO] msync synchronously */
171
172#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
173#define MS_KILLPAGES 0x0004 /* invalidate pages, leave mapped */
174#define MS_DEACTIVATE 0x0008 /* deactivate pages, leave mapped */
175
176#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
177
178
179/*
180 * Advice to madvise
181 */
182#define POSIX_MADV_NORMAL 0 /* [MC1] no further special treatment */
183#define POSIX_MADV_RANDOM 1 /* [MC1] expect random page refs */
184#define POSIX_MADV_SEQUENTIAL 2 /* [MC1] expect sequential page refs */
185#define POSIX_MADV_WILLNEED 3 /* [MC1] will need these pages */
186#define POSIX_MADV_DONTNEED 4 /* [MC1] dont need these pages */
187
188#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
189#define MADV_NORMAL POSIX_MADV_NORMAL
190#define MADV_RANDOM POSIX_MADV_RANDOM
191#define MADV_SEQUENTIAL POSIX_MADV_SEQUENTIAL
192#define MADV_WILLNEED POSIX_MADV_WILLNEED
193#define MADV_DONTNEED POSIX_MADV_DONTNEED
194#define MADV_FREE 5 /* pages unneeded, discard contents */
195#define MADV_ZERO_WIRED_PAGES 6 /* zero the wired pages that have not been unwired before the entry is deleted */
196#define MADV_FREE_REUSABLE 7 /* pages can be reused (by anyone) */
197#define MADV_FREE_REUSE 8 /* caller wants to reuse those pages */
198#define MADV_CAN_REUSE 9
199#define MADV_PAGEOUT 10 /* page out now (internal only) */
200
201/*
202 * Return bits from mincore
203 */
204#define MINCORE_INCORE 0x1 /* Page is incore */
205#define MINCORE_REFERENCED 0x2 /* Page has been referenced by us */
206#define MINCORE_MODIFIED 0x4 /* Page has been modified by us */
207#define MINCORE_REFERENCED_OTHER 0x8 /* Page has been referenced */
208#define MINCORE_MODIFIED_OTHER 0x10 /* Page has been modified */
209#define MINCORE_PAGED_OUT 0x20 /* Page has been paged out */
210#define MINCORE_COPIED 0x40 /* Page has been copied */
211#define MINCORE_ANONYMOUS 0x80 /* Page belongs to an anonymous object */
212#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
213
214
215
216__BEGIN_DECLS
217/* [ML] */
218int mlockall(int);
219int munlockall(void);
220/* [MR] */
221int mlock(const void *, size_t);
222#ifndef _MMAP
223#define _MMAP
224/* [MC3]*/
225void * mmap(void *, size_t, int, int, int, off_t) __DARWIN_ALIAS(mmap);
226#endif
227/* [MPR] */
228int mprotect(void *, size_t, int) __DARWIN_ALIAS(mprotect);
229/* [MF|SIO] */
230int msync(void *, size_t, int) __DARWIN_ALIAS_C(msync);
231/* [MR] */
232int munlock(const void *, size_t);
233/* [MC3]*/
234int munmap(void *, size_t) __DARWIN_ALIAS(munmap);
235/* [SHM] */
236int shm_open(const char *, int, ...);
237int shm_unlink(const char *);
238/* [ADV] */
239int posix_madvise(void *, size_t, int);
240
241#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
242int madvise(void *, size_t, int);
243int mincore(const void *, size_t, char *);
244int minherit(void *, size_t, int);
245#endif
246
247
248__END_DECLS
249
250#endif /* !_SYS_MMAN_H_ */
lib/libc/include/x86_64-macos-gnu/sys/msg.h created+225
......@@ -0,0 +1,225 @@
1/*
2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* $NetBSD: msg.h,v 1.4 1994/06/29 06:44:43 cgd Exp $ */
29
30/*
31 * SVID compatible msg.h file
32 *
33 * Author: Daniel Boulet
34 *
35 * Copyright 1993 Daniel Boulet and RTMX Inc.
36 *
37 * This system call was implemented by Daniel Boulet under contract from RTMX.
38 *
39 * Redistribution and use in source forms, with and without modification,
40 * are permitted provided that this entire comment appears intact.
41 *
42 * Redistribution in binary form may occur without any restrictions.
43 * Obviously, it would be nice if you gave credit where credit is due
44 * but requiring it would be too onerous.
45 *
46 * This software is provided ``AS IS'' without any warranties of any kind.
47 */
48/*
49 * NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce
50 * support for mandatory and extensible security protections. This notice
51 * is included in support of clause 2.2 (b) of the Apple Public License,
52 * Version 2.0.
53 */
54
55#ifndef _SYS_MSG_H_
56#define _SYS_MSG_H_
57
58#include <sys/appleapiopts.h>
59
60#include <sys/_types.h>
61#include <sys/cdefs.h>
62
63/*
64 * [XSI] All of the symbols from <sys/ipc.h> SHALL be defined when this
65 * header is included
66 */
67#include <sys/ipc.h>
68
69
70/*
71 * [XSI] The pid_t, time_t, key_t, size_t, and ssize_t types shall be
72 * defined as described in <sys/types.h>.
73 *
74 * NOTE: The definition of the key_t type is implicit from the
75 * inclusion of <sys/ipc.h>
76 */
77#include <sys/_types/_pid_t.h>
78#include <sys/_types/_time_t.h>
79#include <sys/_types/_size_t.h>
80#include <sys/_types/_ssize_t.h>
81
82/* [XSI] Used for the number of messages in the message queue */
83typedef unsigned long msgqnum_t;
84
85/* [XSI] Used for the number of bytes allowed in a message queue */
86typedef unsigned long msglen_t;
87
88/*
89 * Possible values for the fifth parameter to msgrcv(), in addition to the
90 * IPC_NOWAIT flag, which is permitted.
91 */
92#define MSG_NOERROR 010000 /* [XSI] No error if big message */
93
94
95/*
96 * Technically, we should force all code references to the new structure
97 * definition, not in just the standards conformance case, and leave the
98 * legacy interface there for binary compatibility only. Currently, we
99 * are only forcing this for programs requesting standards conformance.
100 */
101#if __DARWIN_UNIX03 || defined(KERNEL)
102#pragma pack(4)
103/*
104 * Structure used internally.
105 *
106 * Structure whose address is passed as the third parameter to msgctl()
107 * when the second parameter is IPC_SET or IPC_STAT. In the case of the
108 * IPC_SET command, only the msg_perm.{uid|gid|perm} and msg_qbytes are
109 * honored. In the case of IPC_STAT, only the fields indicated as [XSI]
110 * mandated fields are guaranteed to meaningful: DO NOT depend on the
111 * contents of the other fields.
112 *
113 * NOTES: Reserved fields are not preserved across IPC_SET/IPC_STAT.
114 */
115#if (defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE))
116struct msqid_ds
117#else
118#define msqid_ds __msqid_ds_new
119struct __msqid_ds_new
120#endif
121{
122 struct __ipc_perm_new msg_perm; /* [XSI] msg queue permissions */
123 __int32_t msg_first; /* RESERVED: kernel use only */
124 __int32_t msg_last; /* RESERVED: kernel use only */
125 msglen_t msg_cbytes; /* # of bytes on the queue */
126 msgqnum_t msg_qnum; /* [XSI] number of msgs on the queue */
127 msglen_t msg_qbytes; /* [XSI] max bytes on the queue */
128 pid_t msg_lspid; /* [XSI] pid of last msgsnd() */
129 pid_t msg_lrpid; /* [XSI] pid of last msgrcv() */
130 time_t msg_stime; /* [XSI] time of last msgsnd() */
131 __int32_t msg_pad1; /* RESERVED: DO NOT USE */
132 time_t msg_rtime; /* [XSI] time of last msgrcv() */
133 __int32_t msg_pad2; /* RESERVED: DO NOT USE */
134 time_t msg_ctime; /* [XSI] time of last msgctl() */
135 __int32_t msg_pad3; /* RESERVED: DO NOT USE */
136 __int32_t msg_pad4[4]; /* RESERVED: DO NOT USE */
137};
138#pragma pack()
139#else /* !__DARWIN_UNIX03 */
140#define msqid_ds __msqid_ds_old
141#endif /* !__DARWIN_UNIX03 */
142
143#if !__DARWIN_UNIX03
144struct __msqid_ds_old {
145 struct __ipc_perm_old msg_perm; /* [XSI] msg queue permissions */
146 __int32_t msg_first; /* RESERVED: kernel use only */
147 __int32_t msg_last; /* RESERVED: kernel use only */
148 msglen_t msg_cbytes; /* # of bytes on the queue */
149 msgqnum_t msg_qnum; /* [XSI] number of msgs on the queue */
150 msglen_t msg_qbytes; /* [XSI] max bytes on the queue */
151 pid_t msg_lspid; /* [XSI] pid of last msgsnd() */
152 pid_t msg_lrpid; /* [XSI] pid of last msgrcv() */
153 time_t msg_stime; /* [XSI] time of last msgsnd() */
154 __int32_t msg_pad1; /* RESERVED: DO NOT USE */
155 time_t msg_rtime; /* [XSI] time of last msgrcv() */
156 __int32_t msg_pad2; /* RESERVED: DO NOT USE */
157 time_t msg_ctime; /* [XSI] time of last msgctl() */
158 __int32_t msg_pad3; /* RESERVED: DO NOT USE */
159 __int32_t msg_pad4[4]; /* RESERVED: DO NOT USE */
160};
161#endif /* !__DARWIN_UNIX03 */
162
163
164
165#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
166#ifdef __APPLE_API_UNSTABLE
167/* XXX kernel only; protect with macro later */
168
169struct msg {
170 struct msg *msg_next; /* next msg in the chain */
171 long msg_type; /* type of this message */
172 /* >0 -> type of this message */
173 /* 0 -> free header */
174 unsigned short msg_ts; /* size of this message */
175 short msg_spot; /* location of msg start in buffer */
176 struct label *label; /* MAC label */
177};
178
179/*
180 * Example structure describing a message whose address is to be passed as
181 * the second argument to the functions msgrcv() and msgsnd(). The only
182 * actual hard requirement is that the first field be of type long, and
183 * contain the message type. The user is encouraged to define their own
184 * application specific structure; this definition is included solely for
185 * backward compatability with existing source code.
186 */
187struct mymsg {
188 long mtype; /* message type (+ve integer) */
189 char mtext[1]; /* message body */
190};
191
192/*
193 * Based on the configuration parameters described in an SVR2 (yes, two)
194 * config(1m) man page.
195 *
196 * Each message is broken up and stored in segments that are msgssz bytes
197 * long. For efficiency reasons, this should be a power of two. Also,
198 * it doesn't make sense if it is less than 8 or greater than about 256.
199 * Consequently, msginit in kern/sysv_msg.c checks that msgssz is a power of
200 * two between 8 and 1024 inclusive (and panic's if it isn't).
201 */
202struct msginfo {
203 int msgmax, /* max chars in a message */
204 msgmni, /* max message queue identifiers */
205 msgmnb, /* max chars in a queue */
206 msgtql, /* max messages in system */
207 msgssz, /* size of a message segment (see notes above) */
208 msgseg; /* number of message segments */
209};
210#endif /* __APPLE_API_UNSTABLE */
211#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
212
213
214__BEGIN_DECLS
215#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
216int msgsys(int, ...);
217#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
218int msgctl(int, int, struct msqid_ds *) __DARWIN_ALIAS(msgctl);
219int msgget(key_t, int);
220ssize_t msgrcv(int, void *, size_t, long, int) __DARWIN_ALIAS_C(msgrcv);
221int msgsnd(int, const void *, size_t, int) __DARWIN_ALIAS_C(msgsnd);
222__END_DECLS
223
224
225#endif /* !_SYS_MSG_H_ */
lib/libc/include/x86_64-macos-gnu/sys/poll.h created+118
......@@ -0,0 +1,118 @@
1/*
2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*-
29 * Copyright (c) 1997 Peter Wemm <peter@freebsd.org>
30 * All rights reserved.
31 *
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
34 * are met:
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.
40 * 3. The name of the author may not be used to endorse or promote products
41 * derived from this software without specific prior written permission.
42 *
43 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
44 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
46 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
47 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53 * SUCH DAMAGE.
54 *
55 */
56
57#ifndef _SYS_POLL_H_
58#define _SYS_POLL_H_
59
60/*
61 * This file is intended to be compatible with the traditional poll.h.
62 */
63
64/*
65 * Requestable events. If poll(2) finds any of these set, they are
66 * copied to revents on return.
67 */
68#define POLLIN 0x0001 /* any readable data available */
69#define POLLPRI 0x0002 /* OOB/Urgent readable data */
70#define POLLOUT 0x0004 /* file descriptor is writeable */
71#define POLLRDNORM 0x0040 /* non-OOB/URG data available */
72#define POLLWRNORM POLLOUT /* no write type differentiation */
73#define POLLRDBAND 0x0080 /* OOB/Urgent readable data */
74#define POLLWRBAND 0x0100 /* OOB/Urgent data can be written */
75
76/*
77 * FreeBSD extensions: polling on a regular file might return one
78 * of these events (currently only supported on local filesystems).
79 */
80#define POLLEXTEND 0x0200 /* file may have been extended */
81#define POLLATTRIB 0x0400 /* file attributes may have changed */
82#define POLLNLINK 0x0800 /* (un)link/rename may have happened */
83#define POLLWRITE 0x1000 /* file's contents may have changed */
84
85/*
86 * These events are set if they occur regardless of whether they were
87 * requested.
88 */
89#define POLLERR 0x0008 /* some poll error occurred */
90#define POLLHUP 0x0010 /* file descriptor was "hung up" */
91#define POLLNVAL 0x0020 /* requested events "invalid" */
92
93#define POLLSTANDARD (POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|\
94 POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
95
96struct pollfd {
97 int fd;
98 short events;
99 short revents;
100};
101
102typedef unsigned int nfds_t;
103
104
105#include <sys/cdefs.h>
106
107__BEGIN_DECLS
108
109/*
110 * This is defined here (instead of <poll.h>) because this is where
111 * traditional SVR4 code will look to find it.
112 */
113extern int poll(struct pollfd *, nfds_t, int) __DARWIN_ALIAS_C(poll);
114
115__END_DECLS
116
117
118#endif /* !_SYS_POLL_H_ */
lib/libc/include/x86_64-macos-gnu/sys/qos.h created+200
......@@ -0,0 +1,200 @@
1/*
2 * Copyright (c) 2013-2014 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef _SYS_QOS_H
25#define _SYS_QOS_H
26
27#include <sys/cdefs.h>
28#include <Availability.h>
29
30/*!
31 * @typedef qos_class_t
32 *
33 * @abstract
34 * An abstract thread quality of service (QOS) classification.
35 *
36 * @discussion
37 * Thread quality of service (QOS) classes are ordered abstract representations
38 * of the nature of work that is expected to be performed by a pthread, dispatch
39 * queue, or NSOperation. Each class specifies a maximum thread scheduling
40 * priority for that band (which may be used in combination with a relative
41 * priority offset within the band), as well as quality of service
42 * characteristics for timer latency, CPU throughput, I/O throughput, network
43 * socket traffic management behavior and more.
44 *
45 * A best effort is made to allocate available system resources to every QOS
46 * class. Quality of service degredation only occurs during system resource
47 * contention, proportionally to the QOS class. That said, QOS classes
48 * representing user-initiated work attempt to achieve peak throughput while
49 * QOS classes for other work attempt to achieve peak energy and thermal
50 * efficiency, even in the absence of contention. Finally, the use of QOS
51 * classes does not allow threads to supersede any limits that may be applied
52 * to the overall process.
53 */
54
55/*!
56 * @constant QOS_CLASS_USER_INTERACTIVE
57 * @abstract A QOS class which indicates work performed by this thread
58 * is interactive with the user.
59 * @discussion Such work is requested to run at high priority relative to other
60 * work on the system. Specifying this QOS class is a request to run with
61 * nearly all available system CPU and I/O bandwidth even under contention.
62 * This is not an energy-efficient QOS class to use for large tasks. The use of
63 * this QOS class should be limited to critical interaction with the user such
64 * as handling events on the main event loop, view drawing, animation, etc.
65 *
66 * @constant QOS_CLASS_USER_INITIATED
67 * @abstract A QOS class which indicates work performed by this thread
68 * was initiated by the user and that the user is likely waiting for the
69 * results.
70 * @discussion Such work is requested to run at a priority below critical user-
71 * interactive work, but relatively higher than other work on the system. This
72 * is not an energy-efficient QOS class to use for large tasks. Its use
73 * should be limited to operations of short enough duration that the user is
74 * unlikely to switch tasks while waiting for the results. Typical
75 * user-initiated work will have progress indicated by the display of
76 * placeholder content or modal user interface.
77 *
78 * @constant QOS_CLASS_DEFAULT
79 * @abstract A default QOS class used by the system in cases where more specific
80 * QOS class information is not available.
81 * @discussion Such work is requested to run at a priority below critical user-
82 * interactive and user-initiated work, but relatively higher than utility and
83 * background tasks. Threads created by pthread_create() without an attribute
84 * specifying a QOS class will default to QOS_CLASS_DEFAULT. This QOS class
85 * value is not intended to be used as a work classification, it should only be
86 * set when propagating or restoring QOS class values provided by the system.
87 *
88 * @constant QOS_CLASS_UTILITY
89 * @abstract A QOS class which indicates work performed by this thread
90 * may or may not be initiated by the user and that the user is unlikely to be
91 * immediately waiting for the results.
92 * @discussion Such work is requested to run at a priority below critical user-
93 * interactive and user-initiated work, but relatively higher than low-level
94 * system maintenance tasks. The use of this QOS class indicates the work
95 * should be run in an energy and thermally-efficient manner. The progress of
96 * utility work may or may not be indicated to the user, but the effect of such
97 * work is user-visible.
98 *
99 * @constant QOS_CLASS_BACKGROUND
100 * @abstract A QOS class which indicates work performed by this thread was not
101 * initiated by the user and that the user may be unaware of the results.
102 * @discussion Such work is requested to run at a priority below other work.
103 * The use of this QOS class indicates the work should be run in the most energy
104 * and thermally-efficient manner.
105 *
106 * @constant QOS_CLASS_UNSPECIFIED
107 * @abstract A QOS class value which indicates the absence or removal of QOS
108 * class information.
109 * @discussion As an API return value, may indicate that threads or pthread
110 * attributes were configured with legacy API incompatible or in conflict with
111 * the QOS class system.
112 */
113
114#define __QOS_ENUM(name, type, ...) enum { __VA_ARGS__ }; typedef type name##_t
115#define __QOS_CLASS_AVAILABLE(...)
116
117#if defined(__cplusplus) || defined(__OBJC__) || __LP64__
118#if defined(__has_feature) && defined(__has_extension)
119#if __has_feature(objc_fixed_enum) || __has_extension(cxx_strong_enums)
120#undef __QOS_ENUM
121#define __QOS_ENUM(name, type, ...) typedef enum : type { __VA_ARGS__ } name##_t
122#endif
123#endif
124#if __has_feature(enumerator_attributes)
125#undef __QOS_CLASS_AVAILABLE
126#define __QOS_CLASS_AVAILABLE __API_AVAILABLE
127#endif
128#endif
129
130__QOS_ENUM(qos_class, unsigned int,
131 QOS_CLASS_USER_INTERACTIVE
132 __QOS_CLASS_AVAILABLE(macos(10.10), ios(8.0)) = 0x21,
133 QOS_CLASS_USER_INITIATED
134 __QOS_CLASS_AVAILABLE(macos(10.10), ios(8.0)) = 0x19,
135 QOS_CLASS_DEFAULT
136 __QOS_CLASS_AVAILABLE(macos(10.10), ios(8.0)) = 0x15,
137 QOS_CLASS_UTILITY
138 __QOS_CLASS_AVAILABLE(macos(10.10), ios(8.0)) = 0x11,
139 QOS_CLASS_BACKGROUND
140 __QOS_CLASS_AVAILABLE(macos(10.10), ios(8.0)) = 0x09,
141 QOS_CLASS_UNSPECIFIED
142 __QOS_CLASS_AVAILABLE(macos(10.10), ios(8.0)) = 0x00,
143);
144
145#undef __QOS_ENUM
146
147/*!
148 * @constant QOS_MIN_RELATIVE_PRIORITY
149 * @abstract The minimum relative priority that may be specified within a
150 * QOS class. These priorities are relative only within a given QOS class
151 * and meaningful only for the current process.
152 */
153#define QOS_MIN_RELATIVE_PRIORITY (-15)
154
155/* Userspace (only) definitions */
156
157#ifndef KERNEL
158
159__BEGIN_DECLS
160
161/*!
162 * @function qos_class_self
163 *
164 * @abstract
165 * Returns the requested QOS class of the current thread.
166 *
167 * @return
168 * One of the QOS class values in qos_class_t.
169 */
170__API_AVAILABLE(macos(10.10), ios(8.0))
171qos_class_t
172qos_class_self(void);
173
174/*!
175 * @function qos_class_main
176 *
177 * @abstract
178 * Returns the initial requested QOS class of the main thread.
179 *
180 * @discussion
181 * The QOS class that the main thread of a process is created with depends on
182 * the type of process (e.g. application or daemon) and on how it has been
183 * launched.
184 *
185 * This function returns that initial requested QOS class value chosen by the
186 * system to enable propagation of that classification to matching work not
187 * executing on the main thread.
188 *
189 * @return
190 * One of the QOS class values in qos_class_t.
191 */
192__API_AVAILABLE(macos(10.10), ios(8.0))
193qos_class_t
194qos_class_main(void);
195
196__END_DECLS
197
198#endif // KERNEL
199
200#endif // _SYS_QOS_H
lib/libc/include/x86_64-macos-gnu/sys/queue.h created+909
......@@ -0,0 +1,909 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*-
29 * Copyright (c) 1991, 1993
30 * The Regents of the University of California. All rights reserved.
31 *
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
34 * are met:
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.
40 * 4. Neither the name of the University nor the names of its contributors
41 * may be used to endorse or promote products derived from this software
42 * without specific prior written permission.
43 *
44 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
45 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
46 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
47 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
48 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
49 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
50 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
51 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
52 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
53 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
54 * SUCH DAMAGE.
55 *
56 * @(#)queue.h 8.5 (Berkeley) 8/20/94
57 */
58
59#ifndef _SYS_QUEUE_H_
60#define _SYS_QUEUE_H_
61
62#ifndef __improbable
63#define __improbable(x) (x) /* noop in userspace */
64#endif /* __improbable */
65
66/*
67 * This file defines five types of data structures: singly-linked lists,
68 * singly-linked tail queues, lists, tail queues, and circular queues.
69 *
70 * A singly-linked list is headed by a single forward pointer. The elements
71 * are singly linked for minimum space and pointer manipulation overhead at
72 * the expense of O(n) removal for arbitrary elements. New elements can be
73 * added to the list after an existing element or at the head of the list.
74 * Elements being removed from the head of the list should use the explicit
75 * macro for this purpose for optimum efficiency. A singly-linked list may
76 * only be traversed in the forward direction. Singly-linked lists are ideal
77 * for applications with large datasets and few or no removals or for
78 * implementing a LIFO queue.
79 *
80 * A singly-linked tail queue is headed by a pair of pointers, one to the
81 * head of the list and the other to the tail of the list. The elements are
82 * singly linked for minimum space and pointer manipulation overhead at the
83 * expense of O(n) removal for arbitrary elements. New elements can be added
84 * to the list after an existing element, at the head of the list, or at the
85 * end of the list. Elements being removed from the head of the tail queue
86 * should use the explicit macro for this purpose for optimum efficiency.
87 * A singly-linked tail queue may only be traversed in the forward direction.
88 * Singly-linked tail queues are ideal for applications with large datasets
89 * and few or no removals or for implementing a FIFO queue.
90 *
91 * A list is headed by a single forward pointer (or an array of forward
92 * pointers for a hash table header). The elements are doubly linked
93 * so that an arbitrary element can be removed without a need to
94 * traverse the list. New elements can be added to the list before
95 * or after an existing element or at the head of the list. A list
96 * may only be traversed in the forward direction.
97 *
98 * A tail queue is headed by a pair of pointers, one to the head of the
99 * list and the other to the tail of the list. The elements are doubly
100 * linked so that an arbitrary element can be removed without a need to
101 * traverse the list. New elements can be added to the list before or
102 * after an existing element, at the head of the list, or at the end of
103 * the list. A tail queue may be traversed in either direction.
104 *
105 * A circle queue is headed by a pair of pointers, one to the head of the
106 * list and the other to the tail of the list. The elements are doubly
107 * linked so that an arbitrary element can be removed without a need to
108 * traverse the list. New elements can be added to the list before or after
109 * an existing element, at the head of the list, or at the end of the list.
110 * A circle queue may be traversed in either direction, but has a more
111 * complex end of list detection.
112 * Note that circle queues are deprecated, because, as the removal log
113 * in FreeBSD states, "CIRCLEQs are a disgrace to everything Knuth taught
114 * us in Volume 1 Chapter 2. [...] Use TAILQ instead, it provides the same
115 * functionality." Code using them will continue to compile, but they
116 * are no longer documented on the man page.
117 *
118 * For details on the use of these macros, see the queue(3) manual page.
119 *
120 *
121 * SLIST LIST STAILQ TAILQ CIRCLEQ
122 * _HEAD + + + + +
123 * _HEAD_INITIALIZER + + + + -
124 * _ENTRY + + + + +
125 * _INIT + + + + +
126 * _EMPTY + + + + +
127 * _FIRST + + + + +
128 * _NEXT + + + + +
129 * _PREV - - - + +
130 * _LAST - - + + +
131 * _FOREACH + + + + +
132 * _FOREACH_SAFE + + + + -
133 * _FOREACH_REVERSE - - - + -
134 * _FOREACH_REVERSE_SAFE - - - + -
135 * _INSERT_HEAD + + + + +
136 * _INSERT_BEFORE - + - + +
137 * _INSERT_AFTER + + + + +
138 * _INSERT_TAIL - - + + +
139 * _CONCAT - - + + -
140 * _REMOVE_AFTER + - + - -
141 * _REMOVE_HEAD + - + - -
142 * _REMOVE_HEAD_UNTIL - - + - -
143 * _REMOVE + + + + +
144 * _SWAP - + + + -
145 *
146 */
147#ifdef QUEUE_MACRO_DEBUG
148/* Store the last 2 places the queue element or head was altered */
149struct qm_trace {
150 char * lastfile;
151 int lastline;
152 char * prevfile;
153 int prevline;
154};
155
156#define TRACEBUF struct qm_trace trace;
157#define TRASHIT(x) do {(x) = (void *)-1;} while (0)
158
159#define QMD_TRACE_HEAD(head) do { \
160 (head)->trace.prevline = (head)->trace.lastline; \
161 (head)->trace.prevfile = (head)->trace.lastfile; \
162 (head)->trace.lastline = __LINE__; \
163 (head)->trace.lastfile = __FILE__; \
164} while (0)
165
166#define QMD_TRACE_ELEM(elem) do { \
167 (elem)->trace.prevline = (elem)->trace.lastline; \
168 (elem)->trace.prevfile = (elem)->trace.lastfile; \
169 (elem)->trace.lastline = __LINE__; \
170 (elem)->trace.lastfile = __FILE__; \
171} while (0)
172
173#else
174#define QMD_TRACE_ELEM(elem)
175#define QMD_TRACE_HEAD(head)
176#define TRACEBUF
177#define TRASHIT(x)
178#endif /* QUEUE_MACRO_DEBUG */
179
180/*
181 * Horrible macros to enable use of code that was meant to be C-specific
182 * (and which push struct onto type) in C++; without these, C++ code
183 * that uses these macros in the context of a class will blow up
184 * due to "struct" being preprended to "type" by the macros, causing
185 * inconsistent use of tags.
186 *
187 * This approach is necessary because these are macros; we have to use
188 * these on a per-macro basis (because the queues are implemented as
189 * macros, disabling this warning in the scope of the header file is
190 * insufficient), whuch means we can't use #pragma, and have to use
191 * _Pragma. We only need to use these for the queue macros that
192 * prepend "struct" to "type" and will cause C++ to blow up.
193 */
194#if defined(__clang__) && defined(__cplusplus)
195#define __MISMATCH_TAGS_PUSH \
196 _Pragma("clang diagnostic push") \
197 _Pragma("clang diagnostic ignored \"-Wmismatched-tags\"")
198#define __MISMATCH_TAGS_POP \
199 _Pragma("clang diagnostic pop")
200#else
201#define __MISMATCH_TAGS_PUSH
202#define __MISMATCH_TAGS_POP
203#endif
204
205/*!
206 * Ensures that these macros can safely be used in structs when compiling with
207 * clang. The macros do not allow for nullability attributes to be specified due
208 * to how they are expanded. For example:
209 *
210 * SLIST_HEAD(, foo _Nullable) bar;
211 *
212 * expands to
213 *
214 * struct {
215 * struct foo _Nullable *slh_first;
216 * }
217 *
218 * which is not valid because the nullability specifier has to apply to the
219 * pointer. So just ignore nullability completeness in all the places where this
220 * is an issue.
221 */
222#if defined(__clang__)
223#define __NULLABILITY_COMPLETENESS_PUSH \
224 _Pragma("clang diagnostic push") \
225 _Pragma("clang diagnostic ignored \"-Wnullability-completeness\"")
226#define __NULLABILITY_COMPLETENESS_POP \
227 _Pragma("clang diagnostic pop")
228#else
229#define __NULLABILITY_COMPLETENESS_PUSH
230#define __NULLABILITY_COMPLETENESS_POP
231#endif
232
233/*
234 * Singly-linked List declarations.
235 */
236#define SLIST_HEAD(name, type) \
237__MISMATCH_TAGS_PUSH \
238__NULLABILITY_COMPLETENESS_PUSH \
239struct name { \
240 struct type *slh_first; /* first element */ \
241} \
242__NULLABILITY_COMPLETENESS_POP \
243__MISMATCH_TAGS_POP
244
245#define SLIST_HEAD_INITIALIZER(head) \
246 { NULL }
247
248#define SLIST_ENTRY(type) \
249__MISMATCH_TAGS_PUSH \
250__NULLABILITY_COMPLETENESS_PUSH \
251struct { \
252 struct type *sle_next; /* next element */ \
253} \
254__NULLABILITY_COMPLETENESS_POP \
255__MISMATCH_TAGS_POP
256
257/*
258 * Singly-linked List functions.
259 */
260#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
261
262#define SLIST_FIRST(head) ((head)->slh_first)
263
264#define SLIST_FOREACH(var, head, field) \
265 for ((var) = SLIST_FIRST((head)); \
266 (var); \
267 (var) = SLIST_NEXT((var), field))
268
269#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
270 for ((var) = SLIST_FIRST((head)); \
271 (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
272 (var) = (tvar))
273
274#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
275 for ((varp) = &SLIST_FIRST((head)); \
276 ((var) = *(varp)) != NULL; \
277 (varp) = &SLIST_NEXT((var), field))
278
279#define SLIST_INIT(head) do { \
280 SLIST_FIRST((head)) = NULL; \
281} while (0)
282
283#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
284 SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \
285 SLIST_NEXT((slistelm), field) = (elm); \
286} while (0)
287
288#define SLIST_INSERT_HEAD(head, elm, field) do { \
289 SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \
290 SLIST_FIRST((head)) = (elm); \
291} while (0)
292
293#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
294
295#define SLIST_REMOVE(head, elm, type, field) \
296__MISMATCH_TAGS_PUSH \
297__NULLABILITY_COMPLETENESS_PUSH \
298do { \
299 if (SLIST_FIRST((head)) == (elm)) { \
300 SLIST_REMOVE_HEAD((head), field); \
301 } \
302 else { \
303 struct type *curelm = SLIST_FIRST((head)); \
304 while (SLIST_NEXT(curelm, field) != (elm)) \
305 curelm = SLIST_NEXT(curelm, field); \
306 SLIST_REMOVE_AFTER(curelm, field); \
307 } \
308 TRASHIT((elm)->field.sle_next); \
309} while (0) \
310__NULLABILITY_COMPLETENESS_POP \
311__MISMATCH_TAGS_POP
312
313#define SLIST_REMOVE_AFTER(elm, field) do { \
314 SLIST_NEXT(elm, field) = \
315 SLIST_NEXT(SLIST_NEXT(elm, field), field); \
316} while (0)
317
318#define SLIST_REMOVE_HEAD(head, field) do { \
319 SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \
320} while (0)
321
322/*
323 * Singly-linked Tail queue declarations.
324 */
325#define STAILQ_HEAD(name, type) \
326__MISMATCH_TAGS_PUSH \
327__NULLABILITY_COMPLETENESS_PUSH \
328struct name { \
329 struct type *stqh_first;/* first element */ \
330 struct type **stqh_last;/* addr of last next element */ \
331} \
332__NULLABILITY_COMPLETENESS_POP \
333__MISMATCH_TAGS_POP
334
335#define STAILQ_HEAD_INITIALIZER(head) \
336 { NULL, &(head).stqh_first }
337
338#define STAILQ_ENTRY(type) \
339__MISMATCH_TAGS_PUSH \
340__NULLABILITY_COMPLETENESS_PUSH \
341struct { \
342 struct type *stqe_next; /* next element */ \
343} \
344__NULLABILITY_COMPLETENESS_POP \
345__MISMATCH_TAGS_POP
346
347/*
348 * Singly-linked Tail queue functions.
349 */
350#define STAILQ_CONCAT(head1, head2) do { \
351 if (!STAILQ_EMPTY((head2))) { \
352 *(head1)->stqh_last = (head2)->stqh_first; \
353 (head1)->stqh_last = (head2)->stqh_last; \
354 STAILQ_INIT((head2)); \
355 } \
356} while (0)
357
358#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
359
360#define STAILQ_FIRST(head) ((head)->stqh_first)
361
362#define STAILQ_FOREACH(var, head, field) \
363 for((var) = STAILQ_FIRST((head)); \
364 (var); \
365 (var) = STAILQ_NEXT((var), field))
366
367
368#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
369 for ((var) = STAILQ_FIRST((head)); \
370 (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
371 (var) = (tvar))
372
373#define STAILQ_INIT(head) do { \
374 STAILQ_FIRST((head)) = NULL; \
375 (head)->stqh_last = &STAILQ_FIRST((head)); \
376} while (0)
377
378#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \
379 if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
380 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
381 STAILQ_NEXT((tqelm), field) = (elm); \
382} while (0)
383
384#define STAILQ_INSERT_HEAD(head, elm, field) do { \
385 if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \
386 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
387 STAILQ_FIRST((head)) = (elm); \
388} while (0)
389
390#define STAILQ_INSERT_TAIL(head, elm, field) do { \
391 STAILQ_NEXT((elm), field) = NULL; \
392 *(head)->stqh_last = (elm); \
393 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
394} while (0)
395
396#define STAILQ_LAST(head, type, field) \
397__MISMATCH_TAGS_PUSH \
398__NULLABILITY_COMPLETENESS_PUSH \
399 (STAILQ_EMPTY((head)) ? \
400 NULL : \
401 ((struct type *)(void *) \
402 ((char *)((head)->stqh_last) - __offsetof(struct type, field))))\
403__NULLABILITY_COMPLETENESS_POP \
404__MISMATCH_TAGS_POP
405
406#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
407
408#define STAILQ_REMOVE(head, elm, type, field) \
409__MISMATCH_TAGS_PUSH \
410__NULLABILITY_COMPLETENESS_PUSH \
411do { \
412 if (STAILQ_FIRST((head)) == (elm)) { \
413 STAILQ_REMOVE_HEAD((head), field); \
414 } \
415 else { \
416 struct type *curelm = STAILQ_FIRST((head)); \
417 while (STAILQ_NEXT(curelm, field) != (elm)) \
418 curelm = STAILQ_NEXT(curelm, field); \
419 STAILQ_REMOVE_AFTER(head, curelm, field); \
420 } \
421 TRASHIT((elm)->field.stqe_next); \
422} while (0) \
423__NULLABILITY_COMPLETENESS_POP \
424__MISMATCH_TAGS_POP
425
426#define STAILQ_REMOVE_HEAD(head, field) do { \
427 if ((STAILQ_FIRST((head)) = \
428 STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \
429 (head)->stqh_last = &STAILQ_FIRST((head)); \
430} while (0)
431
432#define STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do { \
433 if ((STAILQ_FIRST((head)) = STAILQ_NEXT((elm), field)) == NULL) \
434 (head)->stqh_last = &STAILQ_FIRST((head)); \
435} while (0)
436
437#define STAILQ_REMOVE_AFTER(head, elm, field) do { \
438 if ((STAILQ_NEXT(elm, field) = \
439 STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \
440 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
441} while (0)
442
443#define STAILQ_SWAP(head1, head2, type) \
444__MISMATCH_TAGS_PUSH \
445__NULLABILITY_COMPLETENESS_PUSH \
446do { \
447 struct type *swap_first = STAILQ_FIRST(head1); \
448 struct type **swap_last = (head1)->stqh_last; \
449 STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \
450 (head1)->stqh_last = (head2)->stqh_last; \
451 STAILQ_FIRST(head2) = swap_first; \
452 (head2)->stqh_last = swap_last; \
453 if (STAILQ_EMPTY(head1)) \
454 (head1)->stqh_last = &STAILQ_FIRST(head1); \
455 if (STAILQ_EMPTY(head2)) \
456 (head2)->stqh_last = &STAILQ_FIRST(head2); \
457} while (0) \
458__NULLABILITY_COMPLETENESS_POP \
459__MISMATCH_TAGS_POP
460
461
462/*
463 * List declarations.
464 */
465#define LIST_HEAD(name, type) \
466__MISMATCH_TAGS_PUSH \
467__NULLABILITY_COMPLETENESS_PUSH \
468struct name { \
469 struct type *lh_first; /* first element */ \
470} \
471__NULLABILITY_COMPLETENESS_POP \
472__MISMATCH_TAGS_POP
473
474#define LIST_HEAD_INITIALIZER(head) \
475 { NULL }
476
477#define LIST_ENTRY(type) \
478__MISMATCH_TAGS_PUSH \
479__NULLABILITY_COMPLETENESS_PUSH \
480struct { \
481 struct type *le_next; /* next element */ \
482 struct type **le_prev; /* address of previous next element */ \
483} \
484__NULLABILITY_COMPLETENESS_POP \
485__MISMATCH_TAGS_POP
486
487/*
488 * List functions.
489 */
490
491#define LIST_CHECK_HEAD(head, field)
492#define LIST_CHECK_NEXT(elm, field)
493#define LIST_CHECK_PREV(elm, field)
494
495#define LIST_EMPTY(head) ((head)->lh_first == NULL)
496
497#define LIST_FIRST(head) ((head)->lh_first)
498
499#define LIST_FOREACH(var, head, field) \
500 for ((var) = LIST_FIRST((head)); \
501 (var); \
502 (var) = LIST_NEXT((var), field))
503
504#define LIST_FOREACH_SAFE(var, head, field, tvar) \
505 for ((var) = LIST_FIRST((head)); \
506 (var) && ((tvar) = LIST_NEXT((var), field), 1); \
507 (var) = (tvar))
508
509#define LIST_INIT(head) do { \
510 LIST_FIRST((head)) = NULL; \
511} while (0)
512
513#define LIST_INSERT_AFTER(listelm, elm, field) do { \
514 LIST_CHECK_NEXT(listelm, field); \
515 if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
516 LIST_NEXT((listelm), field)->field.le_prev = \
517 &LIST_NEXT((elm), field); \
518 LIST_NEXT((listelm), field) = (elm); \
519 (elm)->field.le_prev = &LIST_NEXT((listelm), field); \
520} while (0)
521
522#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
523 LIST_CHECK_PREV(listelm, field); \
524 (elm)->field.le_prev = (listelm)->field.le_prev; \
525 LIST_NEXT((elm), field) = (listelm); \
526 *(listelm)->field.le_prev = (elm); \
527 (listelm)->field.le_prev = &LIST_NEXT((elm), field); \
528} while (0)
529
530#define LIST_INSERT_HEAD(head, elm, field) do { \
531 LIST_CHECK_HEAD((head), field); \
532 if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \
533 LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
534 LIST_FIRST((head)) = (elm); \
535 (elm)->field.le_prev = &LIST_FIRST((head)); \
536} while (0)
537
538#define LIST_NEXT(elm, field) ((elm)->field.le_next)
539
540#define LIST_REMOVE(elm, field) do { \
541 LIST_CHECK_NEXT(elm, field); \
542 LIST_CHECK_PREV(elm, field); \
543 if (LIST_NEXT((elm), field) != NULL) \
544 LIST_NEXT((elm), field)->field.le_prev = \
545 (elm)->field.le_prev; \
546 *(elm)->field.le_prev = LIST_NEXT((elm), field); \
547 TRASHIT((elm)->field.le_next); \
548 TRASHIT((elm)->field.le_prev); \
549} while (0)
550
551#define LIST_SWAP(head1, head2, type, field) \
552__MISMATCH_TAGS_PUSH \
553__NULLABILITY_COMPLETENESS_PUSH \
554do { \
555 struct type *swap_tmp = LIST_FIRST((head1)); \
556 LIST_FIRST((head1)) = LIST_FIRST((head2)); \
557 LIST_FIRST((head2)) = swap_tmp; \
558 if ((swap_tmp = LIST_FIRST((head1))) != NULL) \
559 swap_tmp->field.le_prev = &LIST_FIRST((head1)); \
560 if ((swap_tmp = LIST_FIRST((head2))) != NULL) \
561 swap_tmp->field.le_prev = &LIST_FIRST((head2)); \
562} while (0) \
563__NULLABILITY_COMPLETENESS_POP \
564__MISMATCH_TAGS_POP
565
566/*
567 * Tail queue declarations.
568 */
569#define TAILQ_HEAD(name, type) \
570__MISMATCH_TAGS_PUSH \
571__NULLABILITY_COMPLETENESS_PUSH \
572struct name { \
573 struct type *tqh_first; /* first element */ \
574 struct type **tqh_last; /* addr of last next element */ \
575 TRACEBUF \
576} \
577__NULLABILITY_COMPLETENESS_POP \
578__MISMATCH_TAGS_POP
579
580#define TAILQ_HEAD_INITIALIZER(head) \
581 { NULL, &(head).tqh_first }
582
583#define TAILQ_ENTRY(type) \
584__MISMATCH_TAGS_PUSH \
585__NULLABILITY_COMPLETENESS_PUSH \
586struct { \
587 struct type *tqe_next; /* next element */ \
588 struct type **tqe_prev; /* address of previous next element */ \
589 TRACEBUF \
590} \
591__NULLABILITY_COMPLETENESS_POP \
592__MISMATCH_TAGS_POP
593
594/*
595 * Tail queue functions.
596 */
597#define TAILQ_CHECK_HEAD(head, field)
598#define TAILQ_CHECK_NEXT(elm, field)
599#define TAILQ_CHECK_PREV(elm, field)
600
601#define TAILQ_CONCAT(head1, head2, field) do { \
602 if (!TAILQ_EMPTY(head2)) { \
603 *(head1)->tqh_last = (head2)->tqh_first; \
604 (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
605 (head1)->tqh_last = (head2)->tqh_last; \
606 TAILQ_INIT((head2)); \
607 QMD_TRACE_HEAD(head1); \
608 QMD_TRACE_HEAD(head2); \
609 } \
610} while (0)
611
612#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
613
614#define TAILQ_FIRST(head) ((head)->tqh_first)
615
616#define TAILQ_FOREACH(var, head, field) \
617 for ((var) = TAILQ_FIRST((head)); \
618 (var); \
619 (var) = TAILQ_NEXT((var), field))
620
621#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
622 for ((var) = TAILQ_FIRST((head)); \
623 (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
624 (var) = (tvar))
625
626#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
627 for ((var) = TAILQ_LAST((head), headname); \
628 (var); \
629 (var) = TAILQ_PREV((var), headname, field))
630
631#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
632 for ((var) = TAILQ_LAST((head), headname); \
633 (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
634 (var) = (tvar))
635
636
637#define TAILQ_INIT(head) do { \
638 TAILQ_FIRST((head)) = NULL; \
639 (head)->tqh_last = &TAILQ_FIRST((head)); \
640 QMD_TRACE_HEAD(head); \
641} while (0)
642
643
644#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
645 TAILQ_CHECK_NEXT(listelm, field); \
646 if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
647 TAILQ_NEXT((elm), field)->field.tqe_prev = \
648 &TAILQ_NEXT((elm), field); \
649 else { \
650 (head)->tqh_last = &TAILQ_NEXT((elm), field); \
651 QMD_TRACE_HEAD(head); \
652 } \
653 TAILQ_NEXT((listelm), field) = (elm); \
654 (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \
655 QMD_TRACE_ELEM(&(elm)->field); \
656 QMD_TRACE_ELEM(&listelm->field); \
657} while (0)
658
659#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
660 TAILQ_CHECK_PREV(listelm, field); \
661 (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
662 TAILQ_NEXT((elm), field) = (listelm); \
663 *(listelm)->field.tqe_prev = (elm); \
664 (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \
665 QMD_TRACE_ELEM(&(elm)->field); \
666 QMD_TRACE_ELEM(&listelm->field); \
667} while (0)
668
669#define TAILQ_INSERT_HEAD(head, elm, field) do { \
670 TAILQ_CHECK_HEAD(head, field); \
671 if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \
672 TAILQ_FIRST((head))->field.tqe_prev = \
673 &TAILQ_NEXT((elm), field); \
674 else \
675 (head)->tqh_last = &TAILQ_NEXT((elm), field); \
676 TAILQ_FIRST((head)) = (elm); \
677 (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \
678 QMD_TRACE_HEAD(head); \
679 QMD_TRACE_ELEM(&(elm)->field); \
680} while (0)
681
682#define TAILQ_INSERT_TAIL(head, elm, field) do { \
683 TAILQ_NEXT((elm), field) = NULL; \
684 (elm)->field.tqe_prev = (head)->tqh_last; \
685 *(head)->tqh_last = (elm); \
686 (head)->tqh_last = &TAILQ_NEXT((elm), field); \
687 QMD_TRACE_HEAD(head); \
688 QMD_TRACE_ELEM(&(elm)->field); \
689} while (0)
690
691#define TAILQ_LAST(head, headname) \
692__MISMATCH_TAGS_PUSH \
693__NULLABILITY_COMPLETENESS_PUSH \
694 (*(((struct headname *)((head)->tqh_last))->tqh_last)) \
695__NULLABILITY_COMPLETENESS_POP \
696__MISMATCH_TAGS_POP
697
698#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
699
700#define TAILQ_PREV(elm, headname, field) \
701__MISMATCH_TAGS_PUSH \
702__NULLABILITY_COMPLETENESS_PUSH \
703 (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) \
704__NULLABILITY_COMPLETENESS_POP \
705__MISMATCH_TAGS_POP
706
707#define TAILQ_REMOVE(head, elm, field) do { \
708 TAILQ_CHECK_NEXT(elm, field); \
709 TAILQ_CHECK_PREV(elm, field); \
710 if ((TAILQ_NEXT((elm), field)) != NULL) \
711 TAILQ_NEXT((elm), field)->field.tqe_prev = \
712 (elm)->field.tqe_prev; \
713 else { \
714 (head)->tqh_last = (elm)->field.tqe_prev; \
715 QMD_TRACE_HEAD(head); \
716 } \
717 *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \
718 TRASHIT((elm)->field.tqe_next); \
719 TRASHIT((elm)->field.tqe_prev); \
720 QMD_TRACE_ELEM(&(elm)->field); \
721} while (0)
722
723/*
724 * Why did they switch to spaces for this one macro?
725 */
726#define TAILQ_SWAP(head1, head2, type, field) \
727__MISMATCH_TAGS_PUSH \
728__NULLABILITY_COMPLETENESS_PUSH \
729do { \
730 struct type *swap_first = (head1)->tqh_first; \
731 struct type **swap_last = (head1)->tqh_last; \
732 (head1)->tqh_first = (head2)->tqh_first; \
733 (head1)->tqh_last = (head2)->tqh_last; \
734 (head2)->tqh_first = swap_first; \
735 (head2)->tqh_last = swap_last; \
736 if ((swap_first = (head1)->tqh_first) != NULL) \
737 swap_first->field.tqe_prev = &(head1)->tqh_first; \
738 else \
739 (head1)->tqh_last = &(head1)->tqh_first; \
740 if ((swap_first = (head2)->tqh_first) != NULL) \
741 swap_first->field.tqe_prev = &(head2)->tqh_first; \
742 else \
743 (head2)->tqh_last = &(head2)->tqh_first; \
744} while (0) \
745__NULLABILITY_COMPLETENESS_POP \
746__MISMATCH_TAGS_POP
747
748/*
749 * Circular queue definitions.
750 */
751#define CIRCLEQ_HEAD(name, type) \
752__MISMATCH_TAGS_PUSH \
753__NULLABILITY_COMPLETENESS_PUSH \
754struct name { \
755 struct type *cqh_first; /* first element */ \
756 struct type *cqh_last; /* last element */ \
757} \
758__NULLABILITY_COMPLETENESS_POP \
759__MISMATCH_TAGS_POP
760
761#define CIRCLEQ_ENTRY(type) \
762__MISMATCH_TAGS_PUSH \
763__NULLABILITY_COMPLETENESS_PUSH \
764struct { \
765 struct type *cqe_next; /* next element */ \
766 struct type *cqe_prev; /* previous element */ \
767} \
768__NULLABILITY_COMPLETENESS_POP \
769__MISMATCH_TAGS_POP
770
771/*
772 * Circular queue functions.
773 */
774#define CIRCLEQ_CHECK_HEAD(head, field)
775#define CIRCLEQ_CHECK_NEXT(head, elm, field)
776#define CIRCLEQ_CHECK_PREV(head, elm, field)
777
778#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head))
779
780#define CIRCLEQ_FIRST(head) ((head)->cqh_first)
781
782#define CIRCLEQ_FOREACH(var, head, field) \
783 for((var) = (head)->cqh_first; \
784 (var) != (void *)(head); \
785 (var) = (var)->field.cqe_next)
786
787#define CIRCLEQ_INIT(head) do { \
788 (head)->cqh_first = (void *)(head); \
789 (head)->cqh_last = (void *)(head); \
790} while (0)
791
792#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
793 CIRCLEQ_CHECK_NEXT(head, listelm, field); \
794 (elm)->field.cqe_next = (listelm)->field.cqe_next; \
795 (elm)->field.cqe_prev = (listelm); \
796 if ((listelm)->field.cqe_next == (void *)(head)) \
797 (head)->cqh_last = (elm); \
798 else \
799 (listelm)->field.cqe_next->field.cqe_prev = (elm); \
800 (listelm)->field.cqe_next = (elm); \
801} while (0)
802
803#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
804 CIRCLEQ_CHECK_PREV(head, listelm, field); \
805 (elm)->field.cqe_next = (listelm); \
806 (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
807 if ((listelm)->field.cqe_prev == (void *)(head)) \
808 (head)->cqh_first = (elm); \
809 else \
810 (listelm)->field.cqe_prev->field.cqe_next = (elm); \
811 (listelm)->field.cqe_prev = (elm); \
812} while (0)
813
814#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
815 CIRCLEQ_CHECK_HEAD(head, field); \
816 (elm)->field.cqe_next = (head)->cqh_first; \
817 (elm)->field.cqe_prev = (void *)(head); \
818 if ((head)->cqh_last == (void *)(head)) \
819 (head)->cqh_last = (elm); \
820 else \
821 (head)->cqh_first->field.cqe_prev = (elm); \
822 (head)->cqh_first = (elm); \
823} while (0)
824
825#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
826 (elm)->field.cqe_next = (void *)(head); \
827 (elm)->field.cqe_prev = (head)->cqh_last; \
828 if ((head)->cqh_first == (void *)(head)) \
829 (head)->cqh_first = (elm); \
830 else \
831 (head)->cqh_last->field.cqe_next = (elm); \
832 (head)->cqh_last = (elm); \
833} while (0)
834
835#define CIRCLEQ_LAST(head) ((head)->cqh_last)
836
837#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
838
839#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
840
841#define CIRCLEQ_REMOVE(head, elm, field) do { \
842 CIRCLEQ_CHECK_NEXT(head, elm, field); \
843 CIRCLEQ_CHECK_PREV(head, elm, field); \
844 if ((elm)->field.cqe_next == (void *)(head)) \
845 (head)->cqh_last = (elm)->field.cqe_prev; \
846 else \
847 (elm)->field.cqe_next->field.cqe_prev = \
848 (elm)->field.cqe_prev; \
849 if ((elm)->field.cqe_prev == (void *)(head)) \
850 (head)->cqh_first = (elm)->field.cqe_next; \
851 else \
852 (elm)->field.cqe_prev->field.cqe_next = \
853 (elm)->field.cqe_next; \
854} while (0)
855
856#ifdef _KERNEL
857
858#if NOTFB31
859
860/*
861 * XXX insque() and remque() are an old way of handling certain queues.
862 * They bogusly assumes that all queue heads look alike.
863 */
864
865struct quehead {
866 struct quehead *qh_link;
867 struct quehead *qh_rlink;
868};
869
870#ifdef __GNUC__
871#define chkquenext(a)
872#define chkqueprev(a)
873
874static __inline void
875insque(void *a, void *b)
876{
877 struct quehead *element = (struct quehead *)a,
878 *head = (struct quehead *)b;
879 chkquenext(head);
880
881 element->qh_link = head->qh_link;
882 element->qh_rlink = head;
883 head->qh_link = element;
884 element->qh_link->qh_rlink = element;
885}
886
887static __inline void
888remque(void *a)
889{
890 struct quehead *element = (struct quehead *)a;
891 chkquenext(element);
892 chkqueprev(element);
893
894 element->qh_link->qh_rlink = element->qh_rlink;
895 element->qh_rlink->qh_link = element->qh_link;
896 element->qh_rlink = 0;
897}
898
899#else /* !__GNUC__ */
900
901void insque(void *a, void *b);
902void remque(void *a);
903
904#endif /* __GNUC__ */
905
906#endif /* NOTFB31 */
907#endif /* _KERNEL */
908
909#endif /* !_SYS_QUEUE_H_ */
lib/libc/include/x86_64-macos-gnu/sys/select.h created+134
......@@ -0,0 +1,134 @@
1/*
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * Copyright (c) 1992, 1993
30 * The Regents of the University of California. All rights reserved.
31 *
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
34 * are met:
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.
40 * 3. All advertising materials mentioning features or use of this software
41 * must display the following acknowledgement:
42 * This product includes software developed by the University of
43 * California, Berkeley and its contributors.
44 * 4. Neither the name of the University nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 *
60 * @(#)select.h 8.2 (Berkeley) 1/4/94
61 */
62
63#ifndef _SYS_SELECT_H_
64#define _SYS_SELECT_H_
65
66#include <sys/appleapiopts.h>
67#include <sys/cdefs.h>
68#include <sys/_types.h>
69
70/*
71 * [XSI] The <sys/select.h> header shall define the fd_set type as a structure.
72 * The timespec structure shall be defined as described in <time.h>
73 * The <sys/select.h> header shall define the timeval structure.
74 */
75#include <sys/_types/_fd_def.h>
76#include <sys/_types/_timespec.h>
77#include <sys/_types/_timeval.h>
78
79/*
80 * The time_t and suseconds_t types shall be defined as described in
81 * <sys/types.h>
82 * The sigset_t type shall be defined as described in <signal.h>
83 */
84#include <sys/_types/_time_t.h>
85#include <sys/_types/_suseconds_t.h>
86#include <sys/_types/_sigset_t.h>
87
88/*
89 * [XSI] FD_CLR, FD_ISSET, FD_SET, FD_ZERO may be declared as a function, or
90 * defined as a macro, or both
91 * [XSI] FD_SETSIZE shall be defined as a macro
92 */
93
94/*
95 * Select uses bit masks of file descriptors in longs. These macros
96 * manipulate such bit fields (the filesystem macros use chars). The
97 * extra protection here is to permit application redefinition above
98 * the default size.
99 */
100#include <sys/_types/_fd_setsize.h>
101#include <sys/_types/_fd_set.h>
102#include <sys/_types/_fd_clr.h>
103#include <sys/_types/_fd_isset.h>
104#include <sys/_types/_fd_zero.h>
105
106#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
107#include <sys/_types/_fd_copy.h>
108#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
109
110
111__BEGIN_DECLS
112
113#ifndef __MWERKS__
114int pselect(int, fd_set * __restrict, fd_set * __restrict,
115 fd_set * __restrict, const struct timespec * __restrict,
116 const sigset_t * __restrict)
117#if defined(_DARWIN_C_SOURCE) || defined(_DARWIN_UNLIMITED_SELECT)
118__DARWIN_EXTSN_C(pselect)
119#else /* !_DARWIN_C_SOURCE && !_DARWIN_UNLIMITED_SELECT */
120# if defined(__LP64__) && !__DARWIN_NON_CANCELABLE
121__DARWIN_1050(pselect)
122# else /* !__LP64__ || __DARWIN_NON_CANCELABLE */
123__DARWIN_ALIAS_C(pselect)
124# endif /* __LP64__ && !__DARWIN_NON_CANCELABLE */
125#endif /* _DARWIN_C_SOURCE || _DARWIN_UNLIMITED_SELECT */
126;
127#endif /* __MWERKS__ */
128
129#include <sys/_select.h> /* select() prototype */
130
131__END_DECLS
132
133
134#endif /* !_SYS_SELECT_H_ */
lib/libc/include/x86_64-macos-gnu/sys/sem.h created+206
......@@ -0,0 +1,206 @@
1/*
2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* $NetBSD: sem.h,v 1.5 1994/06/29 06:45:15 cgd Exp $ */
29
30/*
31 * SVID compatible sem.h file
32 *
33 * Author: Daniel Boulet
34 * John Bellardo modified the implementation for Darwin. 12/2000
35 */
36
37#ifndef _SYS_SEM_H_
38#define _SYS_SEM_H_
39
40
41#include <sys/cdefs.h>
42#include <sys/_types.h>
43#include <machine/types.h> /* __int32_t */
44
45/*
46 * [XSI] All of the symbols from <sys/ipc.h> SHALL be defined
47 * when this header is included
48 */
49#include <sys/ipc.h>
50
51
52/*
53 * [XSI] The pid_t, time_t, key_t, and size_t types shall be defined as
54 * described in <sys/types.h>.
55 *
56 * NOTE: The definition of the key_t type is implicit from the
57 * inclusion of <sys/ipc.h>
58 */
59#include <sys/_types/_pid_t.h>
60#include <sys/_types/_time_t.h>
61#include <sys/_types/_size_t.h>
62
63/*
64 * Technically, we should force all code references to the new structure
65 * definition, not in just the standards conformance case, and leave the
66 * legacy interface there for binary compatibility only. Currently, we
67 * are only forcing this for programs requesting standards conformance.
68 */
69#if __DARWIN_UNIX03 || defined(KERNEL)
70#pragma pack(4)
71/*
72 * Structure used internally.
73 *
74 * This structure is exposed because standards dictate that it is used as
75 * the semun union member 'buf' as the fourth argment to semctl() when the
76 * third argument is IPC_STAT or IPC_SET.
77 *
78 * Note: only the fields sem_perm, sem_nsems, sem_otime, and sem_ctime
79 * are meaningful in user space.
80 */
81#if (defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE))
82struct semid_ds
83#else
84#define semid_ds __semid_ds_new
85struct __semid_ds_new
86#endif
87{
88 struct __ipc_perm_new sem_perm; /* [XSI] operation permission struct */
89 __int32_t sem_base; /* 32 bit base ptr for semaphore set */
90 unsigned short sem_nsems; /* [XSI] number of sems in set */
91 time_t sem_otime; /* [XSI] last operation time */
92 __int32_t sem_pad1; /* RESERVED: DO NOT USE! */
93 time_t sem_ctime; /* [XSI] last change time */
94 /* Times measured in secs since */
95 /* 00:00:00 GMT, Jan. 1, 1970 */
96 __int32_t sem_pad2; /* RESERVED: DO NOT USE! */
97 __int32_t sem_pad3[4]; /* RESERVED: DO NOT USE! */
98};
99#pragma pack()
100#else /* !__DARWIN_UNIX03 */
101#define semid_ds __semid_ds_old
102#endif /* __DARWIN_UNIX03 */
103
104#if !__DARWIN_UNIX03
105struct __semid_ds_old {
106 struct __ipc_perm_old sem_perm; /* [XSI] operation permission struct */
107 __int32_t sem_base; /* 32 bit base ptr for semaphore set */
108 unsigned short sem_nsems; /* [XSI] number of sems in set */
109 time_t sem_otime; /* [XSI] last operation time */
110 __int32_t sem_pad1; /* RESERVED: DO NOT USE! */
111 time_t sem_ctime; /* [XSI] last change time */
112 /* Times measured in secs since */
113 /* 00:00:00 GMT, Jan. 1, 1970 */
114 __int32_t sem_pad2; /* RESERVED: DO NOT USE! */
115 __int32_t sem_pad3[4]; /* RESERVED: DO NOT USE! */
116};
117#endif /* !__DARWIN_UNIX03 */
118
119/*
120 * Possible values for the third argument to semctl()
121 */
122#define GETNCNT 3 /* [XSI] Return the value of semncnt {READ} */
123#define GETPID 4 /* [XSI] Return the value of sempid {READ} */
124#define GETVAL 5 /* [XSI] Return the value of semval {READ} */
125#define GETALL 6 /* [XSI] Return semvals into arg.array {READ} */
126#define GETZCNT 7 /* [XSI] Return the value of semzcnt {READ} */
127#define SETVAL 8 /* [XSI] Set the value of semval to arg.val {ALTER} */
128#define SETALL 9 /* [XSI] Set semvals from arg.array {ALTER} */
129
130
131/* A semaphore; this is an anonymous structure, not for external use */
132struct sem {
133 unsigned short semval; /* semaphore value */
134 pid_t sempid; /* pid of last operation */
135 unsigned short semncnt; /* # awaiting semval > cval */
136 unsigned short semzcnt; /* # awaiting semval == 0 */
137};
138
139
140/*
141 * Structure of array element for second argument to semop()
142 */
143struct sembuf {
144 unsigned short sem_num; /* [XSI] semaphore # */
145 short sem_op; /* [XSI] semaphore operation */
146 short sem_flg; /* [XSI] operation flags */
147};
148
149/*
150 * Possible flag values for sem_flg
151 */
152#define SEM_UNDO 010000 /* [XSI] Set up adjust on exit entry */
153
154
155#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
156
157/*
158 * Union used as the fourth argment to semctl() in all cases. Specific
159 * member values are used for different values of the third parameter:
160 *
161 * Command Member
162 * ------------------------------------------- ------
163 * GETALL, SETALL array
164 * SETVAL val
165 * IPC_STAT, IPC_SET buf
166 *
167 * The union definition is intended to be defined by the user application
168 * in conforming applications; it is provided here for two reasons:
169 *
170 * 1) Historical source compatability for non-conforming applications
171 * expecting this header to declare the union type on their behalf
172 *
173 * 2) Documentation; specifically, 64 bit applications that do not pass
174 * this structure for 'val', or, alternately, a 64 bit type, will
175 * not function correctly
176 */
177union semun {
178 int val; /* value for SETVAL */
179 struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
180 unsigned short *array; /* array for GETALL & SETALL */
181};
182typedef union semun semun_t;
183
184
185/*
186 * Permissions
187 */
188#define SEM_A 0200 /* alter permission */
189#define SEM_R 0400 /* read permission */
190
191#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
192
193
194
195
196__BEGIN_DECLS
197#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
198int semsys(int, ...);
199#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
200int semctl(int, int, int, ...) __DARWIN_ALIAS(semctl);
201int semget(key_t, int, int);
202int semop(int, struct sembuf *, size_t);
203__END_DECLS
204
205
206#endif /* !_SEM_H_ */
lib/libc/include/x86_64-macos-gnu/sys/semaphore.h created+64
......@@ -0,0 +1,64 @@
1/*
2 * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* @(#)semaphore.h 1.0 2/29/00 */
29
30
31
32/*
33 * semaphore.h - POSIX semaphores
34 *
35 * HISTORY
36 * 29-Feb-00 A.Ramesh at Apple
37 * Created for Mac OS X
38 */
39
40#ifndef _SYS_SEMAPHORE_H_
41#define _SYS_SEMAPHORE_H_
42
43typedef int sem_t;
44
45/* this should go in limits.h> */
46#define SEM_VALUE_MAX 32767
47#define SEM_FAILED ((sem_t *)-1)
48
49#include <sys/cdefs.h>
50
51__BEGIN_DECLS
52int sem_close(sem_t *);
53int sem_destroy(sem_t *) __deprecated;
54int sem_getvalue(sem_t * __restrict, int * __restrict) __deprecated;
55int sem_init(sem_t *, int, unsigned int) __deprecated;
56sem_t * sem_open(const char *, int, ...);
57int sem_post(sem_t *);
58int sem_trywait(sem_t *);
59int sem_unlink(const char *);
60int sem_wait(sem_t *) __DARWIN_ALIAS_C(sem_wait);
61__END_DECLS
62
63
64#endif /* _SYS_SEMAPHORE_H_ */
lib/libc/include/x86_64-macos-gnu/sys/shm.h created+186
......@@ -0,0 +1,186 @@
1/*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* $NetBSD: shm.h,v 1.15 1994/06/29 06:45:17 cgd Exp $ */
29
30/*
31 * Copyright (c) 1994 Adam Glass
32 * All rights reserved.
33 *
34 * Redistribution and use in source and binary forms, with or without
35 * modification, are permitted provided that the following conditions
36 * are met:
37 * 1. Redistributions of source code must retain the above copyright
38 * notice, this list of conditions and the following disclaimer.
39 * 2. Redistributions in binary form must reproduce the above copyright
40 * notice, this list of conditions and the following disclaimer in the
41 * documentation and/or other materials provided with the distribution.
42 * 3. All advertising materials mentioning features or use of this software
43 * must display the following acknowledgement:
44 * This product includes software developed by Adam Glass.
45 * 4. The name of the author may not be used to endorse or promote products
46 * derived from this software without specific prior written permission
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
49 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
50 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
51 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
52 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
53 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
54 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
55 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
56 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
57 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58 */
59
60/*
61 * As defined+described in "X/Open System Interfaces and Headers"
62 * Issue 4, p. XXX
63 */
64
65#ifndef _SYS_SHM_H_
66#define _SYS_SHM_H_
67
68#include <sys/cdefs.h>
69#include <sys/_types.h>
70
71/*
72 * [XSI] All of the symbols from <sys/ipc.h> SHALL be defined
73 * when this header is included
74 */
75#include <sys/ipc.h>
76
77/*
78 * [XSI] The pid_t, time_t, key_t, and size_t types shall be defined as
79 * described in <sys/types.h>.
80 *
81 * NOTE: The definition of the key_t type is implicit from the
82 * inclusion of <sys/ipc.h>
83 */
84#include <sys/_types/_pid_t.h>
85#include <sys/_types/_time_t.h>
86#include <sys/_types/_size_t.h>
87
88/*
89 * [XSI] The unsigned integer type used for the number of current attaches
90 * that MUST be able to store values at least as large as a type unsigned
91 * short.
92 */
93typedef unsigned short shmatt_t;
94
95
96/*
97 * Possible flag values which may be OR'ed into the third argument to
98 * shmat()
99 */
100#define SHM_RDONLY 010000 /* [XSI] Attach read-only (else read-write) */
101#define SHM_RND 020000 /* [XSI] Round attach address to SHMLBA */
102
103/*
104 * This value is symbolic, and generally not expected to be sed by user
105 * programs directly, although such ise is permitted by the standard. Its
106 * value in our implementation is equal to the number of bytes per page.
107 *
108 * NOTE: We DO NOT obtain this value from the appropriate system
109 * headers at this time, to avoid the resulting namespace
110 * pollution, which is why we discourages its use.
111 */
112#define SHMLBA 4096 /* [XSI] Segment low boundary address multiple*/
113
114/* "official" access mode definitions; somewhat braindead since you have
115 * to specify (SHM_* >> 3) for group and (SHM_* >> 6) for world permissions */
116#define SHM_R (IPC_R)
117#define SHM_W (IPC_W)
118
119#pragma pack(4)
120
121/*
122 * Technically, we should force all code references to the new structure
123 * definition, not in just the standards conformance case, and leave the
124 * legacy interface there for binary compatibility only. Currently, we
125 * are only forcing this for programs requesting standards conformance.
126 */
127#if __DARWIN_UNIX03 || defined(KERNEL)
128/*
129 * Structure used internally.
130 *
131 * This structure is exposed because standards dictate that it is used as
132 * the third argment to shmctl().
133 *
134 * NOTE: The field shm_internal is not meaningful in user space,
135 * and must not be used there.
136 */
137#if (defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE))
138struct shmid_ds
139#else
140#define shmid_ds __shmid_ds_new
141struct __shmid_ds_new
142#endif
143{
144 struct __ipc_perm_new shm_perm; /* [XSI] Operation permission value */
145 size_t shm_segsz; /* [XSI] Size of segment in bytes */
146 pid_t shm_lpid; /* [XSI] PID of last shared memory op */
147 pid_t shm_cpid; /* [XSI] PID of creator */
148 shmatt_t shm_nattch; /* [XSI] Number of current attaches */
149 time_t shm_atime; /* [XSI] Time of last shmat() */
150 time_t shm_dtime; /* [XSI] Time of last shmdt() */
151 time_t shm_ctime; /* [XSI] Time of last shmctl() change */
152 void *shm_internal; /* reserved for kernel use */
153};
154#else /* !__DARWIN_UNIX03 */
155#define shmid_ds __shmid_ds_old
156#endif /* !__DARWIN_UNIX03 */
157
158#if !__DARWIN_UNIX03
159struct __shmid_ds_old {
160 struct __ipc_perm_old shm_perm; /* [XSI] Operation permission value */
161 size_t shm_segsz; /* [XSI] Size of segment in bytes */
162 pid_t shm_lpid; /* [XSI] PID of last shared memory op */
163 pid_t shm_cpid; /* [XSI] PID of creator */
164 shmatt_t shm_nattch; /* [XSI] Number of current attaches */
165 time_t shm_atime; /* [XSI] Time of last shmat() */
166 time_t shm_dtime; /* [XSI] Time of last shmdt() */
167 time_t shm_ctime; /* [XSI] Time of last shmctl() change */
168 void *shm_internal; /* reserved for kernel use */
169};
170#endif /* !__DARWIN_UNIX03 */
171
172#pragma pack()
173
174
175__BEGIN_DECLS
176#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
177int shmsys(int, ...);
178#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
179void *shmat(int, const void *, int);
180int shmctl(int, int, struct shmid_ds *) __DARWIN_ALIAS(shmctl);
181int shmdt(const void *);
182int shmget(key_t, size_t, int);
183__END_DECLS
184
185
186#endif /* !_SYS_SHM_H_ */
lib/libc/include/x86_64-macos-gnu/sys/socket.h created+732
......@@ -0,0 +1,732 @@
1/*
2 * Copyright (c) 2000-2019 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* Copyright (c) 1998, 1999 Apple Computer, Inc. All Rights Reserved */
29/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
30/*
31 * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
32 * The Regents of the University of California. All rights reserved.
33 *
34 * Redistribution and use in source and binary forms, with or without
35 * modification, are permitted provided that the following conditions
36 * are met:
37 * 1. Redistributions of source code must retain the above copyright
38 * notice, this list of conditions and the following disclaimer.
39 * 2. Redistributions in binary form must reproduce the above copyright
40 * notice, this list of conditions and the following disclaimer in the
41 * documentation and/or other materials provided with the distribution.
42 * 3. All advertising materials mentioning features or use of this software
43 * must display the following acknowledgement:
44 * This product includes software developed by the University of
45 * California, Berkeley and its contributors.
46 * 4. Neither the name of the University nor the names of its contributors
47 * may be used to endorse or promote products derived from this software
48 * without specific prior written permission.
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
51 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
53 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
60 * SUCH DAMAGE.
61 *
62 * @(#)socket.h 8.4 (Berkeley) 2/21/94
63 * $FreeBSD: src/sys/sys/socket.h,v 1.39.2.7 2001/07/03 11:02:01 ume Exp $
64 */
65/*
66 * NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce
67 * support for mandatory and extensible security protections. This notice
68 * is included in support of clause 2.2 (b) of the Apple Public License,
69 * Version 2.0.
70 */
71
72#ifndef _SYS_SOCKET_H_
73#define _SYS_SOCKET_H_
74
75#include <sys/types.h>
76#include <sys/cdefs.h>
77#include <machine/_param.h>
78#include <net/net_kev.h>
79
80
81#include <Availability.h>
82
83/*
84 * Definitions related to sockets: types, address families, options.
85 */
86
87/*
88 * Data types.
89 */
90
91#include <sys/_types/_gid_t.h>
92#include <sys/_types/_off_t.h>
93#include <sys/_types/_pid_t.h>
94#include <sys/_types/_sa_family_t.h>
95#include <sys/_types/_socklen_t.h>
96
97/* XXX Not explicitly defined by POSIX, but function return types are */
98#include <sys/_types/_size_t.h>
99
100/* XXX Not explicitly defined by POSIX, but function return types are */
101#include <sys/_types/_ssize_t.h>
102
103/*
104 * [XSI] The iovec structure shall be defined as described in <sys/uio.h>.
105 */
106#include <sys/_types/_iovec_t.h>
107
108/*
109 * Types
110 */
111#define SOCK_STREAM 1 /* stream socket */
112#define SOCK_DGRAM 2 /* datagram socket */
113#define SOCK_RAW 3 /* raw-protocol interface */
114#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
115#define SOCK_RDM 4 /* reliably-delivered message */
116#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
117#define SOCK_SEQPACKET 5 /* sequenced packet stream */
118
119/*
120 * Option flags per-socket.
121 */
122#define SO_DEBUG 0x0001 /* turn on debugging info recording */
123#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */
124#define SO_REUSEADDR 0x0004 /* allow local address reuse */
125#define SO_KEEPALIVE 0x0008 /* keep connections alive */
126#define SO_DONTROUTE 0x0010 /* just use interface addresses */
127#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
128#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
129#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
130#define SO_LINGER 0x0080 /* linger on close if data present (in ticks) */
131#else
132#define SO_LINGER 0x1080 /* linger on close if data present (in seconds) */
133#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
134#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */
135#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
136#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */
137#define SO_TIMESTAMP 0x0400 /* timestamp received dgram traffic */
138#define SO_TIMESTAMP_MONOTONIC 0x0800 /* Monotonically increasing timestamp on rcvd dgram */
139#ifndef __APPLE__
140#define SO_ACCEPTFILTER 0x1000 /* there is an accept filter */
141#else
142#define SO_DONTTRUNC 0x2000 /* APPLE: Retain unread data */
143 /* (ATOMIC proto) */
144#define SO_WANTMORE 0x4000 /* APPLE: Give hint when more data ready */
145#define SO_WANTOOBFLAG 0x8000 /* APPLE: Want OOB in MSG_FLAG on receive */
146
147
148#endif /* (!__APPLE__) */
149#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
150
151/*
152 * Additional options, not kept in so_options.
153 */
154#define SO_SNDBUF 0x1001 /* send buffer size */
155#define SO_RCVBUF 0x1002 /* receive buffer size */
156#define SO_SNDLOWAT 0x1003 /* send low-water mark */
157#define SO_RCVLOWAT 0x1004 /* receive low-water mark */
158#define SO_SNDTIMEO 0x1005 /* send timeout */
159#define SO_RCVTIMEO 0x1006 /* receive timeout */
160#define SO_ERROR 0x1007 /* get error status and clear */
161#define SO_TYPE 0x1008 /* get socket type */
162#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
163#define SO_LABEL 0x1010 /* socket's MAC label */
164#define SO_PEERLABEL 0x1011 /* socket's peer MAC label */
165#ifdef __APPLE__
166#define SO_NREAD 0x1020 /* APPLE: get 1st-packet byte count */
167#define SO_NKE 0x1021 /* APPLE: Install socket-level NKE */
168#define SO_NOSIGPIPE 0x1022 /* APPLE: No SIGPIPE on EPIPE */
169#define SO_NOADDRERR 0x1023 /* APPLE: Returns EADDRNOTAVAIL when src is not available anymore */
170#define SO_NWRITE 0x1024 /* APPLE: Get number of bytes currently in send socket buffer */
171#define SO_REUSESHAREUID 0x1025 /* APPLE: Allow reuse of port/socket by different userids */
172#ifdef __APPLE_API_PRIVATE
173#define SO_NOTIFYCONFLICT 0x1026 /* APPLE: send notification if there is a bind on a port which is already in use */
174#define SO_UPCALLCLOSEWAIT 0x1027 /* APPLE: block on close until an upcall returns */
175#endif
176#define SO_LINGER_SEC 0x1080 /* linger on close if data present (in seconds) */
177#define SO_RANDOMPORT 0x1082 /* APPLE: request local port randomization */
178#define SO_NP_EXTENSIONS 0x1083 /* To turn off some POSIX behavior */
179#endif
180
181#define SO_NUMRCVPKT 0x1112 /* number of datagrams in receive socket buffer */
182#define SO_NET_SERVICE_TYPE 0x1116 /* Network service type */
183
184
185#define SO_NETSVC_MARKING_LEVEL 0x1119 /* Get QoS marking in effect for socket */
186
187/*
188 * Network Service Type for option SO_NET_SERVICE_TYPE
189 *
190 * The vast majority of sockets should use Best Effort that is the default
191 * Network Service Type. Other Network Service Types have to be used only if
192 * the traffic actually matches the description of the Network Service Type.
193 *
194 * Network Service Types do not represent priorities but rather describe
195 * different categories of delay, jitter and loss parameters.
196 * Those parameters may influence protocols from layer 4 protocols like TCP
197 * to layer 2 protocols like Wi-Fi. The Network Service Type can determine
198 * how the traffic is queued and scheduled by the host networking stack and
199 * by other entities on the network like switches and routers. For example
200 * for Wi-Fi, the Network Service Type can select the marking of the
201 * layer 2 packet with the appropriate WMM Access Category.
202 *
203 * There is no point in attempting to game the system and use
204 * a Network Service Type that does not correspond to the actual
205 * traffic characteristic but one that seems to have a higher precedence.
206 * The reason is that for service classes that have lower tolerance
207 * for delay and jitter, the queues size is lower than for service
208 * classes that are more tolerant to delay and jitter.
209 *
210 * For example using a voice service type for bulk data transfer will lead
211 * to disastrous results as soon as congestion happens because the voice
212 * queue overflows and packets get dropped. This is not only bad for the bulk
213 * data transfer but it is also bad for VoIP apps that legitimately are using
214 * the voice service type.
215 *
216 * The characteristics of the Network Service Types are based on the service
217 * classes defined in RFC 4594 "Configuration Guidelines for DiffServ Service
218 * Classes"
219 *
220 * When system detects the outgoing interface belongs to a DiffServ domain
221 * that follows the recommendation of the IETF draft "Guidelines for DiffServ to
222 * IEEE 802.11 Mapping", the packet will marked at layer 3 with a DSCP value
223 * that corresponds to Network Service Type.
224 *
225 * NET_SERVICE_TYPE_BE
226 * "Best Effort", unclassified/standard. This is the default service
227 * class and cover the majority of the traffic.
228 *
229 * NET_SERVICE_TYPE_BK
230 * "Background", high delay tolerant, loss tolerant. elastic flow,
231 * variable size & long-lived. E.g: non-interactive network bulk transfer
232 * like synching or backup.
233 *
234 * NET_SERVICE_TYPE_RD
235 * "Responsive Data", a notch higher than "Best Effort", medium delay
236 * tolerant, elastic & inelastic flow, bursty, long-lived. E.g. email,
237 * instant messaging, for which there is a sense of interactivity and
238 * urgency (user waiting for output).
239 *
240 * NET_SERVICE_TYPE_OAM
241 * "Operations, Administration, and Management", medium delay tolerant,
242 * low-medium loss tolerant, elastic & inelastic flows, variable size.
243 * E.g. VPN tunnels.
244 *
245 * NET_SERVICE_TYPE_AV
246 * "Multimedia Audio/Video Streaming", medium delay tolerant, low-medium
247 * loss tolerant, elastic flow, constant packet interval, variable rate
248 * and size. E.g. video and audio playback with buffering.
249 *
250 * NET_SERVICE_TYPE_RV
251 * "Responsive Multimedia Audio/Video", low delay tolerant, low-medium
252 * loss tolerant, elastic flow, variable packet interval, rate and size.
253 * E.g. screen sharing.
254 *
255 * NET_SERVICE_TYPE_VI
256 * "Interactive Video", low delay tolerant, low-medium loss tolerant,
257 * elastic flow, constant packet interval, variable rate & size. E.g.
258 * video telephony.
259 *
260 * NET_SERVICE_TYPE_SIG
261 * "Signaling", low delay tolerant, low loss tolerant, inelastic flow,
262 * jitter tolerant, rate is bursty but short, variable size. E.g. SIP.
263 *
264 * NET_SERVICE_TYPE_VO
265 * "Interactive Voice", very low delay tolerant, very low loss tolerant,
266 * inelastic flow, constant packet rate, somewhat fixed size.
267 * E.g. VoIP.
268 */
269
270#define NET_SERVICE_TYPE_BE 0 /* Best effort */
271#define NET_SERVICE_TYPE_BK 1 /* Background system initiated */
272#define NET_SERVICE_TYPE_SIG 2 /* Signaling */
273#define NET_SERVICE_TYPE_VI 3 /* Interactive Video */
274#define NET_SERVICE_TYPE_VO 4 /* Interactive Voice */
275#define NET_SERVICE_TYPE_RV 5 /* Responsive Multimedia Audio/Video */
276#define NET_SERVICE_TYPE_AV 6 /* Multimedia Audio/Video Streaming */
277#define NET_SERVICE_TYPE_OAM 7 /* Operations, Administration, and Management */
278#define NET_SERVICE_TYPE_RD 8 /* Responsive Data */
279
280
281/* These are supported values for SO_NETSVC_MARKING_LEVEL */
282#define NETSVC_MRKNG_UNKNOWN 0 /* The outgoing network interface is not known */
283#define NETSVC_MRKNG_LVL_L2 1 /* Default marking at layer 2 (for example Wi-Fi WMM) */
284#define NETSVC_MRKNG_LVL_L3L2_ALL 2 /* Layer 3 DSCP marking and layer 2 marking for all Network Service Types */
285#define NETSVC_MRKNG_LVL_L3L2_BK 3 /* The system policy limits layer 3 DSCP marking and layer 2 marking
286 * to background Network Service Types */
287
288
289typedef __uint32_t sae_associd_t;
290#define SAE_ASSOCID_ANY 0
291#define SAE_ASSOCID_ALL ((sae_associd_t)(-1ULL))
292
293typedef __uint32_t sae_connid_t;
294#define SAE_CONNID_ANY 0
295#define SAE_CONNID_ALL ((sae_connid_t)(-1ULL))
296
297/* connectx() flag parameters */
298#define CONNECT_RESUME_ON_READ_WRITE 0x1 /* resume connect() on read/write */
299#define CONNECT_DATA_IDEMPOTENT 0x2 /* data is idempotent */
300#define CONNECT_DATA_AUTHENTICATED 0x4 /* data includes security that replaces the TFO-cookie */
301
302/* sockaddr endpoints */
303typedef struct sa_endpoints {
304 unsigned int sae_srcif; /* optional source interface */
305 const struct sockaddr *sae_srcaddr; /* optional source address */
306 socklen_t sae_srcaddrlen; /* size of source address */
307 const struct sockaddr *sae_dstaddr; /* destination address */
308 socklen_t sae_dstaddrlen; /* size of destination address */
309} sa_endpoints_t;
310#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
311
312/*
313 * Structure used for manipulating linger option.
314 */
315struct linger {
316 int l_onoff; /* option on/off */
317 int l_linger; /* linger time */
318};
319
320#ifndef __APPLE__
321struct accept_filter_arg {
322 char af_name[16];
323 char af_arg[256 - 16];
324};
325#endif
326
327#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
328#ifdef __APPLE__
329
330/*
331 * Structure to control non-portable Sockets extension to POSIX
332 */
333struct so_np_extensions {
334 u_int32_t npx_flags;
335 u_int32_t npx_mask;
336};
337
338#define SONPX_SETOPTSHUT 0x000000001 /* flag for allowing setsockopt after shutdown */
339
340
341
342#endif
343#endif
344
345/*
346 * Level number for (get/set)sockopt() to apply to socket itself.
347 */
348#define SOL_SOCKET 0xffff /* options for socket level */
349
350
351/*
352 * Address families.
353 */
354#define AF_UNSPEC 0 /* unspecified */
355#define AF_UNIX 1 /* local to host (pipes) */
356#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
357#define AF_LOCAL AF_UNIX /* backward compatibility */
358#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
359#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
360#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
361#define AF_IMPLINK 3 /* arpanet imp addresses */
362#define AF_PUP 4 /* pup protocols: e.g. BSP */
363#define AF_CHAOS 5 /* mit CHAOS protocols */
364#define AF_NS 6 /* XEROX NS protocols */
365#define AF_ISO 7 /* ISO protocols */
366#define AF_OSI AF_ISO
367#define AF_ECMA 8 /* European computer manufacturers */
368#define AF_DATAKIT 9 /* datakit protocols */
369#define AF_CCITT 10 /* CCITT protocols, X.25 etc */
370#define AF_SNA 11 /* IBM SNA */
371#define AF_DECnet 12 /* DECnet */
372#define AF_DLI 13 /* DEC Direct data link interface */
373#define AF_LAT 14 /* LAT */
374#define AF_HYLINK 15 /* NSC Hyperchannel */
375#define AF_APPLETALK 16 /* Apple Talk */
376#define AF_ROUTE 17 /* Internal Routing Protocol */
377#define AF_LINK 18 /* Link layer interface */
378#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */
379#define AF_COIP 20 /* connection-oriented IP, aka ST II */
380#define AF_CNT 21 /* Computer Network Technology */
381#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */
382#define AF_IPX 23 /* Novell Internet Protocol */
383#define AF_SIP 24 /* Simple Internet Protocol */
384#define pseudo_AF_PIP 25 /* Help Identify PIP packets */
385#define AF_NDRV 27 /* Network Driver 'raw' access */
386#define AF_ISDN 28 /* Integrated Services Digital Network */
387#define AF_E164 AF_ISDN /* CCITT E.164 recommendation */
388#define pseudo_AF_KEY 29 /* Internal key-management function */
389#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
390#define AF_INET6 30 /* IPv6 */
391#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
392#define AF_NATM 31 /* native ATM access */
393#define AF_SYSTEM 32 /* Kernel event messages */
394#define AF_NETBIOS 33 /* NetBIOS */
395#define AF_PPP 34 /* PPP communication protocol */
396#define pseudo_AF_HDRCMPLT 35 /* Used by BPF to not rewrite headers
397 * in interface output routine */
398#define AF_RESERVED_36 36 /* Reserved for internal usage */
399#define AF_IEEE80211 37 /* IEEE 802.11 protocol */
400#define AF_UTUN 38
401#define AF_MAX 40
402#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
403
404/*
405 * [XSI] Structure used by kernel to store most addresses.
406 */
407struct sockaddr {
408 __uint8_t sa_len; /* total length */
409 sa_family_t sa_family; /* [XSI] address family */
410 char sa_data[14]; /* [XSI] addr value (actually larger) */
411};
412
413#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
414#define SOCK_MAXADDRLEN 255 /* longest possible addresses */
415
416/*
417 * Structure used by kernel to pass protocol
418 * information in raw sockets.
419 */
420struct sockproto {
421 __uint16_t sp_family; /* address family */
422 __uint16_t sp_protocol; /* protocol */
423};
424#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
425
426/*
427 * RFC 2553: protocol-independent placeholder for socket addresses
428 */
429#define _SS_MAXSIZE 128
430#define _SS_ALIGNSIZE (sizeof(__int64_t))
431#define _SS_PAD1SIZE \
432 (_SS_ALIGNSIZE - sizeof(__uint8_t) - sizeof(sa_family_t))
433#define _SS_PAD2SIZE \
434 (_SS_MAXSIZE - sizeof(__uint8_t) - sizeof(sa_family_t) - \
435 _SS_PAD1SIZE - _SS_ALIGNSIZE)
436
437/*
438 * [XSI] sockaddr_storage
439 */
440struct sockaddr_storage {
441 __uint8_t ss_len; /* address length */
442 sa_family_t ss_family; /* [XSI] address family */
443 char __ss_pad1[_SS_PAD1SIZE];
444 __int64_t __ss_align; /* force structure storage alignment */
445 char __ss_pad2[_SS_PAD2SIZE];
446};
447
448/*
449 * Protocol families, same as address families for now.
450 */
451#define PF_UNSPEC AF_UNSPEC
452#define PF_LOCAL AF_LOCAL
453#define PF_UNIX PF_LOCAL /* backward compatibility */
454#define PF_INET AF_INET
455#define PF_IMPLINK AF_IMPLINK
456#define PF_PUP AF_PUP
457#define PF_CHAOS AF_CHAOS
458#define PF_NS AF_NS
459#define PF_ISO AF_ISO
460#define PF_OSI AF_ISO
461#define PF_ECMA AF_ECMA
462#define PF_DATAKIT AF_DATAKIT
463#define PF_CCITT AF_CCITT
464#define PF_SNA AF_SNA
465#define PF_DECnet AF_DECnet
466#define PF_DLI AF_DLI
467#define PF_LAT AF_LAT
468#define PF_HYLINK AF_HYLINK
469#define PF_APPLETALK AF_APPLETALK
470#define PF_ROUTE AF_ROUTE
471#define PF_LINK AF_LINK
472#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */
473#define PF_COIP AF_COIP
474#define PF_CNT AF_CNT
475#define PF_SIP AF_SIP
476#define PF_IPX AF_IPX /* same format as AF_NS */
477#define PF_RTIP pseudo_AF_RTIP /* same format as AF_INET */
478#define PF_PIP pseudo_AF_PIP
479#define PF_NDRV AF_NDRV
480#define PF_ISDN AF_ISDN
481#define PF_KEY pseudo_AF_KEY
482#define PF_INET6 AF_INET6
483#define PF_NATM AF_NATM
484#define PF_SYSTEM AF_SYSTEM
485#define PF_NETBIOS AF_NETBIOS
486#define PF_PPP AF_PPP
487#define PF_RESERVED_36 AF_RESERVED_36
488#define PF_UTUN AF_UTUN
489#define PF_MAX AF_MAX
490
491/*
492 * These do not have socket-layer support:
493 */
494#define PF_VLAN ((uint32_t)0x766c616e) /* 'vlan' */
495#define PF_BOND ((uint32_t)0x626f6e64) /* 'bond' */
496
497/*
498 * Definitions for network related sysctl, CTL_NET.
499 *
500 * Second level is protocol family.
501 * Third level is protocol number.
502 *
503 * Further levels are defined by the individual families below.
504 */
505#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
506#define NET_MAXID AF_MAX
507#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
508
509
510#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
511/*
512 * PF_ROUTE - Routing table
513 *
514 * Three additional levels are defined:
515 * Fourth: address family, 0 is wildcard
516 * Fifth: type of info, defined below
517 * Sixth: flag(s) to mask with for NET_RT_FLAGS
518 */
519#define NET_RT_DUMP 1 /* dump; may limit to a.f. */
520#define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */
521#define NET_RT_IFLIST 3 /* survey interface list */
522#define NET_RT_STAT 4 /* routing statistics */
523#define NET_RT_TRASH 5 /* routes not in table but not freed */
524#define NET_RT_IFLIST2 6 /* interface list with addresses */
525#define NET_RT_DUMP2 7 /* dump; may limit to a.f. */
526/*
527 * Allows read access non-local host's MAC address
528 * if the process has neighbor cache entitlement.
529 */
530#define NET_RT_FLAGS_PRIV 10
531#define NET_RT_MAXID 11
532#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
533
534
535
536
537/*
538 * Maximum queue length specifiable by listen.
539 */
540#define SOMAXCONN 128
541
542/*
543 * [XSI] Message header for recvmsg and sendmsg calls.
544 * Used value-result for recvmsg, value only for sendmsg.
545 */
546struct msghdr {
547 void *msg_name; /* [XSI] optional address */
548 socklen_t msg_namelen; /* [XSI] size of address */
549 struct iovec *msg_iov; /* [XSI] scatter/gather array */
550 int msg_iovlen; /* [XSI] # elements in msg_iov */
551 void *msg_control; /* [XSI] ancillary data, see below */
552 socklen_t msg_controllen; /* [XSI] ancillary data buffer len */
553 int msg_flags; /* [XSI] flags on received message */
554};
555
556
557
558#define MSG_OOB 0x1 /* process out-of-band data */
559#define MSG_PEEK 0x2 /* peek at incoming message */
560#define MSG_DONTROUTE 0x4 /* send without using routing tables */
561#define MSG_EOR 0x8 /* data completes record */
562#define MSG_TRUNC 0x10 /* data discarded before delivery */
563#define MSG_CTRUNC 0x20 /* control data lost before delivery */
564#define MSG_WAITALL 0x40 /* wait for full request or error */
565#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
566#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */
567#define MSG_EOF 0x100 /* data completes connection */
568#ifdef __APPLE__
569#ifdef __APPLE_API_OBSOLETE
570#define MSG_WAITSTREAM 0x200 /* wait up to full request.. may return partial */
571#endif
572#define MSG_FLUSH 0x400 /* Start of 'hold' seq; dump so_temp, deprecated */
573#define MSG_HOLD 0x800 /* Hold frag in so_temp, deprecated */
574#define MSG_SEND 0x1000 /* Send the packet in so_temp, deprecated */
575#define MSG_HAVEMORE 0x2000 /* Data ready to be read */
576#define MSG_RCVMORE 0x4000 /* Data remains in current pkt */
577#endif
578#define MSG_NEEDSA 0x10000 /* Fail receive if socket address cannot be allocated */
579#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
580
581/*
582 * Header for ancillary data objects in msg_control buffer.
583 * Used for additional information with/about a datagram
584 * not expressible by flags. The format is a sequence
585 * of message elements headed by cmsghdr structures.
586 */
587struct cmsghdr {
588 socklen_t cmsg_len; /* [XSI] data byte count, including hdr */
589 int cmsg_level; /* [XSI] originating protocol */
590 int cmsg_type; /* [XSI] protocol-specific type */
591/* followed by unsigned char cmsg_data[]; */
592};
593
594#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
595#ifndef __APPLE__
596/*
597 * While we may have more groups than this, the cmsgcred struct must
598 * be able to fit in an mbuf, and NGROUPS_MAX is too large to allow
599 * this.
600 */
601#define CMGROUP_MAX 16
602
603/*
604 * Credentials structure, used to verify the identity of a peer
605 * process that has sent us a message. This is allocated by the
606 * peer process but filled in by the kernel. This prevents the
607 * peer from lying about its identity. (Note that cmcred_groups[0]
608 * is the effective GID.)
609 */
610struct cmsgcred {
611 pid_t cmcred_pid; /* PID of sending process */
612 uid_t cmcred_uid; /* real UID of sending process */
613 uid_t cmcred_euid; /* effective UID of sending process */
614 gid_t cmcred_gid; /* real GID of sending process */
615 short cmcred_ngroups; /* number or groups */
616 gid_t cmcred_groups[CMGROUP_MAX]; /* groups */
617};
618#endif
619#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
620
621/* given pointer to struct cmsghdr, return pointer to data */
622#define CMSG_DATA(cmsg) ((unsigned char *)(cmsg) + \
623 __DARWIN_ALIGN32(sizeof(struct cmsghdr)))
624
625/*
626 * RFC 2292 requires to check msg_controllen, in case that the kernel returns
627 * an empty list for some reasons.
628 */
629#define CMSG_FIRSTHDR(mhdr) \
630 ((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \
631 (struct cmsghdr *)(mhdr)->msg_control : \
632 (struct cmsghdr *)0L)
633
634
635/*
636 * Given pointer to struct cmsghdr, return pointer to next cmsghdr
637 * RFC 2292 says that CMSG_NXTHDR(mhdr, NULL) is equivalent to CMSG_FIRSTHDR(mhdr)
638 */
639#define CMSG_NXTHDR(mhdr, cmsg) \
640 ((char *)(cmsg) == (char *)0L ? CMSG_FIRSTHDR(mhdr) : \
641 ((((unsigned char *)(cmsg) + \
642 __DARWIN_ALIGN32((__uint32_t)(cmsg)->cmsg_len) + \
643 __DARWIN_ALIGN32(sizeof(struct cmsghdr))) > \
644 ((unsigned char *)(mhdr)->msg_control + \
645 (mhdr)->msg_controllen)) ? \
646 (struct cmsghdr *)0L /* NULL */ : \
647 (struct cmsghdr *)(void *)((unsigned char *)(cmsg) + \
648 __DARWIN_ALIGN32((__uint32_t)(cmsg)->cmsg_len))))
649
650#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
651/* RFC 2292 additions */
652#define CMSG_SPACE(l) (__DARWIN_ALIGN32(sizeof(struct cmsghdr)) + __DARWIN_ALIGN32(l))
653#define CMSG_LEN(l) (__DARWIN_ALIGN32(sizeof(struct cmsghdr)) + (l))
654
655#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
656
657/* "Socket"-level control message types: */
658#define SCM_RIGHTS 0x01 /* access rights (array of int) */
659#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
660#define SCM_TIMESTAMP 0x02 /* timestamp (struct timeval) */
661#define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */
662#define SCM_TIMESTAMP_MONOTONIC 0x04 /* timestamp (uint64_t) */
663
664
665#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
666
667/*
668 * howto arguments for shutdown(2), specified by Posix.1g.
669 */
670#define SHUT_RD 0 /* shut down the reading side */
671#define SHUT_WR 1 /* shut down the writing side */
672#define SHUT_RDWR 2 /* shut down both sides */
673
674#if !defined(_POSIX_C_SOURCE)
675/*
676 * sendfile(2) header/trailer struct
677 */
678struct sf_hdtr {
679 struct iovec *headers; /* pointer to an array of header struct iovec's */
680 int hdr_cnt; /* number of header iovec's */
681 struct iovec *trailers; /* pointer to an array of trailer struct iovec's */
682 int trl_cnt; /* number of trailer iovec's */
683};
684
685
686#endif /* !_POSIX_C_SOURCE */
687
688
689__BEGIN_DECLS
690
691int accept(int, struct sockaddr * __restrict, socklen_t * __restrict)
692__DARWIN_ALIAS_C(accept);
693int bind(int, const struct sockaddr *, socklen_t) __DARWIN_ALIAS(bind);
694int connect(int, const struct sockaddr *, socklen_t) __DARWIN_ALIAS_C(connect);
695int getpeername(int, struct sockaddr * __restrict, socklen_t * __restrict)
696__DARWIN_ALIAS(getpeername);
697int getsockname(int, struct sockaddr * __restrict, socklen_t * __restrict)
698__DARWIN_ALIAS(getsockname);
699int getsockopt(int, int, int, void * __restrict, socklen_t * __restrict);
700int listen(int, int) __DARWIN_ALIAS(listen);
701ssize_t recv(int, void *, size_t, int) __DARWIN_ALIAS_C(recv);
702ssize_t recvfrom(int, void *, size_t, int, struct sockaddr * __restrict,
703 socklen_t * __restrict) __DARWIN_ALIAS_C(recvfrom);
704ssize_t recvmsg(int, struct msghdr *, int) __DARWIN_ALIAS_C(recvmsg);
705ssize_t send(int, const void *, size_t, int) __DARWIN_ALIAS_C(send);
706ssize_t sendmsg(int, const struct msghdr *, int) __DARWIN_ALIAS_C(sendmsg);
707ssize_t sendto(int, const void *, size_t,
708 int, const struct sockaddr *, socklen_t) __DARWIN_ALIAS_C(sendto);
709int setsockopt(int, int, int, const void *, socklen_t);
710int shutdown(int, int);
711int sockatmark(int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
712int socket(int, int, int);
713int socketpair(int, int, int, int *) __DARWIN_ALIAS(socketpair);
714
715#if !defined(_POSIX_C_SOURCE)
716int sendfile(int, int, off_t, off_t *, struct sf_hdtr *, int);
717#endif /* !_POSIX_C_SOURCE */
718
719#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
720void pfctlinput(int, struct sockaddr *);
721
722__API_AVAILABLE(macosx(10.11), ios(9.0), tvos(9.0), watchos(2.0))
723int connectx(int, const sa_endpoints_t *, sae_associd_t, unsigned int,
724 const struct iovec *, unsigned int, size_t *, sae_connid_t *);
725
726__API_AVAILABLE(macosx(10.11), ios(9.0), tvos(9.0), watchos(2.0))
727int disconnectx(int, sae_associd_t, sae_connid_t);
728#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
729__END_DECLS
730
731
732#endif /* !_SYS_SOCKET_H_ */
lib/libc/include/x86_64-macos-gnu/sys/spawn.h created+77
......@@ -0,0 +1,77 @@
1/*
2 * Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29/*
30 * [SPN] Support for _POSIX_SPAWN
31 *
32 * This header contains information that is shared between the user space
33 * and kernel versions of the posix_spawn() code. Shared elements are all
34 * manifest constants, at the current time.
35 */
36
37#ifndef _SYS_SPAWN_H_
38#define _SYS_SPAWN_H_
39
40/*
41 * Possible bit values which may be OR'ed together and provided as the second
42 * parameter to posix_spawnattr_setflags() or implicit returned in the value of
43 * the second parameter to posix_spawnattr_getflags().
44 */
45#define POSIX_SPAWN_RESETIDS 0x0001 /* [SPN] R[UG]ID not E[UG]ID */
46#define POSIX_SPAWN_SETPGROUP 0x0002 /* [SPN] set non-parent PGID */
47#define POSIX_SPAWN_SETSIGDEF 0x0004 /* [SPN] reset sigset default */
48#define POSIX_SPAWN_SETSIGMASK 0x0008 /* [SPN] set signal mask */
49
50#if 0 /* _POSIX_PRIORITY_SCHEDULING [PS] : not supported */
51#define POSIX_SPAWN_SETSCHEDPARAM 0x0010
52#define POSIX_SPAWN_SETSCHEDULER 0x0020
53#endif /* 0 */
54
55#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
56/*
57 * Darwin-specific flags
58 */
59#define POSIX_SPAWN_SETEXEC 0x0040
60#define POSIX_SPAWN_START_SUSPENDED 0x0080
61#define POSIX_SPAWN_SETSID 0x0400
62#define POSIX_SPAWN_CLOEXEC_DEFAULT 0x4000
63
64/*
65 * Possible values to be set for the process control actions on resource starvation.
66 * POSIX_SPAWN_PCONTROL_THROTTLE indicates that the process is to be throttled on starvation.
67 * POSIX_SPAWN_PCONTROL_SUSPEND indicates that the process is to be suspended on starvation.
68 * POSIX_SPAWN_PCONTROL_KILL indicates that the process is to be terminated on starvation.
69 */
70#define POSIX_SPAWN_PCONTROL_NONE 0x0000
71#define POSIX_SPAWN_PCONTROL_THROTTLE 0x0001
72#define POSIX_SPAWN_PCONTROL_SUSPEND 0x0002
73#define POSIX_SPAWN_PCONTROL_KILL 0x0003
74
75#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
76
77#endif /* _SYS_SPAWN_H_ */
lib/libc/include/x86_64-macos-gnu/sys/stat.h created+430
......@@ -0,0 +1,430 @@
1/*
2 * Copyright (c) 2000-2014 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
29/*-
30 * Copyright (c) 1982, 1986, 1989, 1993
31 * The Regents of the University of California. All rights reserved.
32 * (c) UNIX System Laboratories, Inc.
33 * All or some portions of this file are derived from material licensed
34 * to the University of California by American Telephone and Telegraph
35 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
36 * the permission of UNIX System Laboratories, Inc.
37 *
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
40 * are met:
41 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution.
46 * 3. All advertising materials mentioning features or use of this software
47 * must display the following acknowledgement:
48 * This product includes software developed by the University of
49 * California, Berkeley and its contributors.
50 * 4. Neither the name of the University nor the names of its contributors
51 * may be used to endorse or promote products derived from this software
52 * without specific prior written permission.
53 *
54 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 * SUCH DAMAGE.
65 *
66 * @(#)stat.h 8.9 (Berkeley) 8/17/94
67 */
68
69
70#ifndef _SYS_STAT_H_
71#define _SYS_STAT_H_
72
73#include <sys/_types.h>
74#include <sys/cdefs.h>
75#include <Availability.h>
76
77/* [XSI] The timespec structure may be defined as described in <time.h> */
78#include <sys/_types/_timespec.h>
79
80/*
81 * [XSI] The blkcnt_t, blksize_t, dev_t, ino_t, mode_t, nlink_t, uid_t,
82 * gid_t, off_t, and time_t types shall be defined as described in
83 * <sys/types.h>.
84 */
85#include <sys/_types/_blkcnt_t.h>
86#include <sys/_types/_blksize_t.h>
87#include <sys/_types/_dev_t.h> /* device number */
88#include <sys/_types/_ino_t.h>
89
90#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
91#include <sys/_types/_ino64_t.h>
92#endif /* !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) */
93
94#include <sys/_types/_mode_t.h>
95#include <sys/_types/_nlink_t.h>
96#include <sys/_types/_uid_t.h>
97#include <sys/_types/_gid_t.h>
98#include <sys/_types/_off_t.h>
99#include <sys/_types/_time_t.h>
100
101#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
102/*
103 * XXX So deprecated, it would make your head spin
104 *
105 * The old stat structure. In fact, this is not used by the kernel at all,
106 * and should not be used by user space, and should be removed from this
107 * header file entirely (along with the unused cvtstat() prototype in
108 * vnode_internal.h).
109 */
110struct ostat {
111 __uint16_t st_dev; /* inode's device */
112 ino_t st_ino; /* inode's number */
113 mode_t st_mode; /* inode protection mode */
114 nlink_t st_nlink; /* number of hard links */
115 __uint16_t st_uid; /* user ID of the file's owner */
116 __uint16_t st_gid; /* group ID of the file's group */
117 __uint16_t st_rdev; /* device type */
118 __int32_t st_size; /* file size, in bytes */
119 struct timespec st_atimespec; /* time of last access */
120 struct timespec st_mtimespec; /* time of last data modification */
121 struct timespec st_ctimespec; /* time of last file status change */
122 __int32_t st_blksize; /* optimal blocksize for I/O */
123 __int32_t st_blocks; /* blocks allocated for file */
124 __uint32_t st_flags; /* user defined flags for file */
125 __uint32_t st_gen; /* file generation number */
126};
127
128#define __DARWIN_STRUCT_STAT64_TIMES \
129 struct timespec st_atimespec; /* time of last access */ \
130 struct timespec st_mtimespec; /* time of last data modification */ \
131 struct timespec st_ctimespec; /* time of last status change */ \
132 struct timespec st_birthtimespec; /* time of file creation(birth) */
133
134#else /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
135
136#define __DARWIN_STRUCT_STAT64_TIMES \
137 time_t st_atime; /* [XSI] Time of last access */ \
138 long st_atimensec; /* nsec of last access */ \
139 time_t st_mtime; /* [XSI] Last data modification time */ \
140 long st_mtimensec; /* last data modification nsec */ \
141 time_t st_ctime; /* [XSI] Time of last status change */ \
142 long st_ctimensec; /* nsec of last status change */ \
143 time_t st_birthtime; /* File creation time(birth) */ \
144 long st_birthtimensec; /* nsec of File creation time */
145
146#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
147
148/*
149 * This structure is used as the second parameter to the fstat64(),
150 * lstat64(), and stat64() functions, and for struct stat when
151 * __DARWIN_64_BIT_INO_T is set. __DARWIN_STRUCT_STAT64 is defined
152 * above, depending on whether we use struct timespec or the direct
153 * components.
154 *
155 * This is simillar to stat except for 64bit inode number
156 * number instead of 32bit ino_t and the addition of create(birth) time.
157 */
158#define __DARWIN_STRUCT_STAT64 { \
159 dev_t st_dev; /* [XSI] ID of device containing file */ \
160 mode_t st_mode; /* [XSI] Mode of file (see below) */ \
161 nlink_t st_nlink; /* [XSI] Number of hard links */ \
162 __darwin_ino64_t st_ino; /* [XSI] File serial number */ \
163 uid_t st_uid; /* [XSI] User ID of the file */ \
164 gid_t st_gid; /* [XSI] Group ID of the file */ \
165 dev_t st_rdev; /* [XSI] Device ID */ \
166 __DARWIN_STRUCT_STAT64_TIMES \
167 off_t st_size; /* [XSI] file size, in bytes */ \
168 blkcnt_t st_blocks; /* [XSI] blocks allocated for file */ \
169 blksize_t st_blksize; /* [XSI] optimal blocksize for I/O */ \
170 __uint32_t st_flags; /* user defined flags for file */ \
171 __uint32_t st_gen; /* file generation number */ \
172 __int32_t st_lspare; /* RESERVED: DO NOT USE! */ \
173 __int64_t st_qspare[2]; /* RESERVED: DO NOT USE! */ \
174}
175
176/*
177 * [XSI] This structure is used as the second parameter to the fstat(),
178 * lstat(), and stat() functions.
179 */
180#if __DARWIN_64_BIT_INO_T
181
182struct stat __DARWIN_STRUCT_STAT64;
183
184#else /* !__DARWIN_64_BIT_INO_T */
185
186struct stat {
187 dev_t st_dev; /* [XSI] ID of device containing file */
188 ino_t st_ino; /* [XSI] File serial number */
189 mode_t st_mode; /* [XSI] Mode of file (see below) */
190 nlink_t st_nlink; /* [XSI] Number of hard links */
191 uid_t st_uid; /* [XSI] User ID of the file */
192 gid_t st_gid; /* [XSI] Group ID of the file */
193 dev_t st_rdev; /* [XSI] Device ID */
194#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
195 struct timespec st_atimespec; /* time of last access */
196 struct timespec st_mtimespec; /* time of last data modification */
197 struct timespec st_ctimespec; /* time of last status change */
198#else
199 time_t st_atime; /* [XSI] Time of last access */
200 long st_atimensec; /* nsec of last access */
201 time_t st_mtime; /* [XSI] Last data modification time */
202 long st_mtimensec; /* last data modification nsec */
203 time_t st_ctime; /* [XSI] Time of last status change */
204 long st_ctimensec; /* nsec of last status change */
205#endif
206 off_t st_size; /* [XSI] file size, in bytes */
207 blkcnt_t st_blocks; /* [XSI] blocks allocated for file */
208 blksize_t st_blksize; /* [XSI] optimal blocksize for I/O */
209 __uint32_t st_flags; /* user defined flags for file */
210 __uint32_t st_gen; /* file generation number */
211 __int32_t st_lspare; /* RESERVED: DO NOT USE! */
212 __int64_t st_qspare[2]; /* RESERVED: DO NOT USE! */
213};
214
215#endif /* __DARWIN_64_BIT_INO_T */
216
217#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
218
219#if !__DARWIN_ONLY_64_BIT_INO_T
220
221struct stat64 __DARWIN_STRUCT_STAT64;
222
223#endif /* !__DARWIN_ONLY_64_BIT_INO_T */
224
225#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
226
227
228
229
230#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
231#define st_atime st_atimespec.tv_sec
232#define st_mtime st_mtimespec.tv_sec
233#define st_ctime st_ctimespec.tv_sec
234#define st_birthtime st_birthtimespec.tv_sec
235#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
236
237/*
238 * [XSI] The following are symbolic names for the values of type mode_t. They
239 * are bitmap values.
240 */
241#include <sys/_types/_s_ifmt.h>
242
243/*
244 * [XSI] The following macros shall be provided to test whether a file is
245 * of the specified type. The value m supplied to the macros is the value
246 * of st_mode from a stat structure. The macro shall evaluate to a non-zero
247 * value if the test is true; 0 if the test is false.
248 */
249#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) /* block special */
250#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) /* char special */
251#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /* directory */
252#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* fifo or socket */
253#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /* regular file */
254#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) /* symbolic link */
255#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) /* socket */
256#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
257#define S_ISWHT(m) (((m) & S_IFMT) == S_IFWHT) /* OBSOLETE: whiteout */
258#endif
259
260/*
261 * [XSI] The implementation may implement message queues, semaphores, or
262 * shared memory objects as distinct file types. The following macros
263 * shall be provided to test whether a file is of the specified type.
264 * The value of the buf argument supplied to the macros is a pointer to
265 * a stat structure. The macro shall evaluate to a non-zero value if
266 * the specified object is implemented as a distinct file type and the
267 * specified file type is contained in the stat structure referenced by
268 * buf. Otherwise, the macro shall evaluate to zero.
269 *
270 * NOTE: The current implementation does not do this, although
271 * this may change in future revisions, and co currently only
272 * provides these macros to ensure source compatability with
273 * implementations which do.
274 */
275#define S_TYPEISMQ(buf) (0) /* Test for a message queue */
276#define S_TYPEISSEM(buf) (0) /* Test for a semaphore */
277#define S_TYPEISSHM(buf) (0) /* Test for a shared memory object */
278
279/*
280 * [TYM] The implementation may implement typed memory objects as distinct
281 * file types, and the following macro shall test whether a file is of the
282 * specified type. The value of the buf argument supplied to the macros is
283 * a pointer to a stat structure. The macro shall evaluate to a non-zero
284 * value if the specified object is implemented as a distinct file type and
285 * the specified file type is contained in the stat structure referenced by
286 * buf. Otherwise, the macro shall evaluate to zero.
287 *
288 * NOTE: The current implementation does not do this, although
289 * this may change in future revisions, and co currently only
290 * provides this macro to ensure source compatability with
291 * implementations which do.
292 */
293#define S_TYPEISTMO(buf) (0) /* Test for a typed memory object */
294
295
296#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
297#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
298 /* 7777 */
299#define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)
300/* 0666 */
301#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
302
303#define S_BLKSIZE 512 /* block size used in the stat struct */
304
305/*
306 * Definitions of flags stored in file flags word.
307 *
308 * Super-user and owner changeable flags.
309 */
310#define UF_SETTABLE 0x0000ffff /* mask of owner changeable flags */
311#define UF_NODUMP 0x00000001 /* do not dump file */
312#define UF_IMMUTABLE 0x00000002 /* file may not be changed */
313#define UF_APPEND 0x00000004 /* writes to file may only append */
314#define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union */
315/*
316 * The following bit is reserved for FreeBSD. It is not implemented
317 * in Mac OS X.
318 */
319/* #define UF_NOUNLINK 0x00000010 */ /* file may not be removed or renamed */
320#define UF_COMPRESSED 0x00000020 /* file is compressed (some file-systems) */
321
322/* UF_TRACKED is used for dealing with document IDs. We no longer issue
323 * notifications for deletes or renames for files which have UF_TRACKED set. */
324#define UF_TRACKED 0x00000040
325
326#define UF_DATAVAULT 0x00000080 /* entitlement required for reading */
327 /* and writing */
328
329/* Bits 0x0100 through 0x4000 are currently undefined. */
330#define UF_HIDDEN 0x00008000 /* hint that this item should not be */
331 /* displayed in a GUI */
332/*
333 * Super-user changeable flags.
334 */
335#define SF_SUPPORTED 0x009f0000 /* mask of superuser supported flags */
336#define SF_SETTABLE 0x3fff0000 /* mask of superuser changeable flags */
337#define SF_SYNTHETIC 0xc0000000 /* mask of system read-only synthetic flags */
338#define SF_ARCHIVED 0x00010000 /* file is archived */
339#define SF_IMMUTABLE 0x00020000 /* file may not be changed */
340#define SF_APPEND 0x00040000 /* writes to file may only append */
341#define SF_RESTRICTED 0x00080000 /* entitlement required for writing */
342#define SF_NOUNLINK 0x00100000 /* Item may not be removed, renamed or mounted on */
343
344/*
345 * The following two bits are reserved for FreeBSD. They are not
346 * implemented in Mac OS X.
347 */
348/* #define SF_SNAPSHOT 0x00200000 */ /* snapshot inode */
349/* NOTE: There is no SF_HIDDEN bit. */
350
351#define SF_FIRMLINK 0x00800000 /* file is a firmlink */
352
353/*
354 * Synthetic flags.
355 *
356 * These are read-only. We keep them out of SF_SUPPORTED so that
357 * attempts to set them will fail.
358 */
359#define SF_DATALESS 0x40000000 /* file is dataless object */
360
361
362#endif
363
364/*
365 * Extended flags ("EF") returned by ATTR_CMNEXT_EXT_FLAGS from getattrlist/getattrlistbulk
366 */
367#define EF_MAY_SHARE_BLOCKS 0x00000001 /* file may share blocks with another file */
368#define EF_NO_XATTRS 0x00000002 /* file has no xattrs at all */
369#define EF_IS_SYNC_ROOT 0x00000004 /* file is a sync root for iCloud */
370#define EF_IS_PURGEABLE 0x00000008 /* file is purgeable */
371#define EF_IS_SPARSE 0x00000010 /* file has at least one sparse region */
372
373
374
375
376__BEGIN_DECLS
377/* [XSI] */
378int chmod(const char *, mode_t) __DARWIN_ALIAS(chmod);
379int fchmod(int, mode_t) __DARWIN_ALIAS(fchmod);
380int fstat(int, struct stat *) __DARWIN_INODE64(fstat);
381int lstat(const char *, struct stat *) __DARWIN_INODE64(lstat);
382int mkdir(const char *, mode_t);
383int mkfifo(const char *, mode_t);
384int stat(const char *, struct stat *) __DARWIN_INODE64(stat);
385int mknod(const char *, mode_t, dev_t);
386mode_t umask(mode_t);
387
388#if __DARWIN_C_LEVEL >= 200809L
389int fchmodat(int, const char *, mode_t, int) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
390int fstatat(int, const char *, struct stat *, int) __DARWIN_INODE64(fstatat) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
391int mkdirat(int, const char *, mode_t) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
392
393#define UTIME_NOW -1
394#define UTIME_OMIT -2
395
396int futimens(int __fd, const struct timespec __times[2]) __API_AVAILABLE(macosx(10.13), ios(11.0), tvos(11.0), watchos(4.0));
397int utimensat(int __fd, const char *__path, const struct timespec __times[2],
398 int __flag) __API_AVAILABLE(macosx(10.13), ios(11.0), tvos(11.0), watchos(4.0));
399#endif
400
401#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
402
403#include <sys/_types/_filesec_t.h>
404
405int chflags(const char *, __uint32_t);
406int chmodx_np(const char *, filesec_t);
407int fchflags(int, __uint32_t);
408int fchmodx_np(int, filesec_t);
409int fstatx_np(int, struct stat *, filesec_t) __DARWIN_INODE64(fstatx_np);
410int lchflags(const char *, __uint32_t) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
411int lchmod(const char *, mode_t) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
412int lstatx_np(const char *, struct stat *, filesec_t) __DARWIN_INODE64(lstatx_np);
413int mkdirx_np(const char *, filesec_t);
414int mkfifox_np(const char *, filesec_t);
415int statx_np(const char *, struct stat *, filesec_t) __DARWIN_INODE64(statx_np);
416int umaskx_np(filesec_t) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_6, __IPHONE_NA, __IPHONE_NA);
417
418#if !__DARWIN_ONLY_64_BIT_INO_T
419/* The following deprecated routines are simillar to stat and friends except provide struct stat64 instead of struct stat */
420int fstatx64_np(int, struct stat64 *, filesec_t) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA);
421int lstatx64_np(const char *, struct stat64 *, filesec_t) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA);
422int statx64_np(const char *, struct stat64 *, filesec_t) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA);
423int fstat64(int, struct stat64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA);
424int lstat64(const char *, struct stat64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA);
425int stat64(const char *, struct stat64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA);
426#endif /* !__DARWIN_ONLY_64_BIT_INO_T */
427#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
428
429__END_DECLS
430#endif /* !_SYS_STAT_H_ */
lib/libc/include/x86_64-macos-gnu/sys/statvfs.h created+60
......@@ -0,0 +1,60 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24/*
25 * sys/statvfs.h
26 */
27#ifndef _SYS_STATVFS_H_
28#define _SYS_STATVFS_H_
29
30#include <sys/_types.h>
31#include <sys/cdefs.h>
32
33#include <sys/_types/_fsblkcnt_t.h>
34#include <sys/_types/_fsfilcnt_t.h>
35
36/* Following structure is used as a statvfs/fstatvfs function parameter */
37struct statvfs {
38 unsigned long f_bsize; /* File system block size */
39 unsigned long f_frsize; /* Fundamental file system block size */
40 fsblkcnt_t f_blocks; /* Blocks on FS in units of f_frsize */
41 fsblkcnt_t f_bfree; /* Free blocks */
42 fsblkcnt_t f_bavail; /* Blocks available to non-root */
43 fsfilcnt_t f_files; /* Total inodes */
44 fsfilcnt_t f_ffree; /* Free inodes */
45 fsfilcnt_t f_favail; /* Free inodes for non-root */
46 unsigned long f_fsid; /* Filesystem ID */
47 unsigned long f_flag; /* Bit mask of values */
48 unsigned long f_namemax; /* Max file name length */
49};
50
51/* Defined bits for f_flag field value */
52#define ST_RDONLY 0x00000001 /* Read-only file system */
53#define ST_NOSUID 0x00000002 /* Does not honor setuid/setgid */
54
55__BEGIN_DECLS
56int fstatvfs(int, struct statvfs *);
57int statvfs(const char * __restrict, struct statvfs * __restrict);
58__END_DECLS
59
60#endif /* _SYS_STATVFS_H_ */
lib/libc/include/x86_64-macos-gnu/sys/syslog.h created+236
......@@ -0,0 +1,236 @@
1/*
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
29/*-
30 * Copyright (c) 1982, 1986, 1988, 1993
31 * The Regents of the University of California. All rights reserved.
32 *
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
35 * are met:
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in the
40 * documentation and/or other materials provided with the distribution.
41 * 4. Neither the name of the University nor the names of its contributors
42 * may be used to endorse or promote products derived from this software
43 * without specific prior written permission.
44 *
45 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
46 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
49 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55 * SUCH DAMAGE.
56 *
57 * @(#)syslog.h 8.1 (Berkeley) 6/2/93
58 * $FreeBSD: src/sys/sys/syslog.h,v 1.27.2.1.4.1 2010/06/14 02:09:06 kensmith Exp $
59 */
60
61#ifndef _SYS_SYSLOG_H_
62#define _SYS_SYSLOG_H_
63
64#include <sys/appleapiopts.h>
65#include <sys/cdefs.h>
66
67#define _PATH_LOG "/var/run/syslog"
68
69/*
70 * priorities/facilities are encoded into a single 32-bit quantity, where the
71 * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
72 * (0-big number). Both the priorities and the facilities map roughly
73 * one-to-one to strings in the syslogd(8) source code. This mapping is
74 * included in this file.
75 *
76 * priorities (these are ordered)
77 */
78#define LOG_EMERG 0 /* system is unusable */
79#define LOG_ALERT 1 /* action must be taken immediately */
80#define LOG_CRIT 2 /* critical conditions */
81#define LOG_ERR 3 /* error conditions */
82#define LOG_WARNING 4 /* warning conditions */
83#define LOG_NOTICE 5 /* normal but significant condition */
84#define LOG_INFO 6 /* informational */
85#define LOG_DEBUG 7 /* debug-level messages */
86
87#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */
88/* extract priority */
89#define LOG_PRI(p) ((p) & LOG_PRIMASK)
90#define LOG_MAKEPRI(fac, pri) ((fac) | (pri))
91
92#ifdef SYSLOG_NAMES
93#define INTERNAL_NOPRI 0x10 /* the "no priority" priority */
94/* mark "facility" */
95#define INTERNAL_MARK LOG_MAKEPRI((LOG_NFACILITIES<<3), 0)
96typedef struct _code {
97 const char *c_name;
98 int c_val;
99} CODE;
100
101CODE prioritynames[] = {
102 { "alert", LOG_ALERT, },
103 { "crit", LOG_CRIT, },
104 { "debug", LOG_DEBUG, },
105 { "emerg", LOG_EMERG, },
106 { "err", LOG_ERR, },
107 { "error", LOG_ERR, }, /* DEPRECATED */
108 { "info", LOG_INFO, },
109 { "none", INTERNAL_NOPRI, }, /* INTERNAL */
110 { "notice", LOG_NOTICE, },
111 { "panic", LOG_EMERG, }, /* DEPRECATED */
112 { "warn", LOG_WARNING, }, /* DEPRECATED */
113 { "warning", LOG_WARNING, },
114 { NULL, -1, }
115};
116#endif
117
118/* facility codes */
119#define LOG_KERN (0<<3) /* kernel messages */
120#define LOG_USER (1<<3) /* random user-level messages */
121#define LOG_MAIL (2<<3) /* mail system */
122#define LOG_DAEMON (3<<3) /* system daemons */
123#define LOG_AUTH (4<<3) /* authorization messages */
124#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */
125#define LOG_LPR (6<<3) /* line printer subsystem */
126#define LOG_NEWS (7<<3) /* network news subsystem */
127#define LOG_UUCP (8<<3) /* UUCP subsystem */
128#define LOG_CRON (9<<3) /* clock daemon */
129#define LOG_AUTHPRIV (10<<3) /* authorization messages (private) */
130/* Facility #10 clashes in DEC UNIX, where */
131/* it's defined as LOG_MEGASAFE for AdvFS */
132/* event logging. */
133#define LOG_FTP (11<<3) /* ftp daemon */
134//#define LOG_NTP (12<<3) /* NTP subsystem */
135//#define LOG_SECURITY (13<<3) /* security subsystems (firewalling, etc.) */
136//#define LOG_CONSOLE (14<<3) /* /dev/console output */
137#define LOG_NETINFO (12<<3) /* NetInfo */
138#define LOG_REMOTEAUTH (13<<3) /* remote authentication/authorization */
139#define LOG_INSTALL (14<<3) /* installer subsystem */
140#define LOG_RAS (15<<3) /* Remote Access Service (VPN / PPP) */
141
142/* other codes through 15 reserved for system use */
143#define LOG_LOCAL0 (16<<3) /* reserved for local use */
144#define LOG_LOCAL1 (17<<3) /* reserved for local use */
145#define LOG_LOCAL2 (18<<3) /* reserved for local use */
146#define LOG_LOCAL3 (19<<3) /* reserved for local use */
147#define LOG_LOCAL4 (20<<3) /* reserved for local use */
148#define LOG_LOCAL5 (21<<3) /* reserved for local use */
149#define LOG_LOCAL6 (22<<3) /* reserved for local use */
150#define LOG_LOCAL7 (23<<3) /* reserved for local use */
151
152#define LOG_LAUNCHD (24<<3) /* launchd - general bootstrap daemon */
153
154#define LOG_NFACILITIES 25 /* current number of facilities */
155#define LOG_FACMASK 0x03f8 /* mask to extract facility part */
156/* facility of pri */
157#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
158
159#ifdef SYSLOG_NAMES
160CODE facilitynames[] = {
161 { "auth", LOG_AUTH, },
162 { "authpriv", LOG_AUTHPRIV, },
163 { "cron", LOG_CRON, },
164 { "daemon", LOG_DAEMON, },
165 { "ftp", LOG_FTP, },
166 { "install", LOG_INSTALL },
167 { "kern", LOG_KERN, },
168 { "lpr", LOG_LPR, },
169 { "mail", LOG_MAIL, },
170 { "mark", INTERNAL_MARK, }, /* INTERNAL */
171 { "netinfo", LOG_NETINFO, },
172 { "ras", LOG_RAS },
173 { "remoteauth", LOG_REMOTEAUTH },
174 { "news", LOG_NEWS, },
175 { "security", LOG_AUTH }, /* DEPRECATED */
176 { "syslog", LOG_SYSLOG, },
177 { "user", LOG_USER, },
178 { "uucp", LOG_UUCP, },
179 { "local0", LOG_LOCAL0, },
180 { "local1", LOG_LOCAL1, },
181 { "local2", LOG_LOCAL2, },
182 { "local3", LOG_LOCAL3, },
183 { "local4", LOG_LOCAL4, },
184 { "local5", LOG_LOCAL5, },
185 { "local6", LOG_LOCAL6, },
186 { "local7", LOG_LOCAL7, },
187 { "launchd", LOG_LAUNCHD },
188 { NULL, -1, }
189};
190#endif
191
192
193/*
194 * arguments to setlogmask.
195 */
196#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */
197#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */
198
199/*
200 * Option flags for openlog.
201 *
202 * LOG_ODELAY no longer does anything.
203 * LOG_NDELAY is the inverse of what it used to be.
204 */
205#define LOG_PID 0x01 /* log the pid with each message */
206#define LOG_CONS 0x02 /* log on the console if errors in sending */
207#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */
208#define LOG_NDELAY 0x08 /* don't delay open */
209#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */
210#define LOG_PERROR 0x20 /* log to stderr as well */
211
212
213/*
214 * Don't use va_list in the vsyslog() prototype. Va_list is typedef'd in two
215 * places (<machine/varargs.h> and <machine/stdarg.h>), so if we include one
216 * of them here we may collide with the utility's includes. It's unreasonable
217 * for utilities to have to include one of them to include syslog.h, so we get
218 * __va_list from <sys/_types.h> and use it.
219 */
220#include <sys/_types.h>
221
222__BEGIN_DECLS
223void closelog(void);
224void openlog(const char *, int, int);
225int setlogmask(int);
226#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __DARWIN_C_LEVEL >= __DARWIN_C_FULL
227void syslog(int, const char *, ...) __DARWIN_ALIAS_STARTING(__MAC_10_13, __IPHONE_NA, __DARWIN_EXTSN(syslog)) __printflike(2, 3) __not_tail_called;
228#else
229void syslog(int, const char *, ...) __printflike(2, 3) __not_tail_called;
230#endif
231#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
232void vsyslog(int, const char *, __darwin_va_list) __printflike(2, 0) __not_tail_called;
233#endif
234__END_DECLS
235
236#endif /* !_SYS_SYSLOG_H_ */
lib/libc/include/x86_64-macos-gnu/sys/termios.h created+366
......@@ -0,0 +1,366 @@
1/*
2 * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved */
29/*
30 * Copyright (c) 1988, 1989, 1993, 1994
31 * The Regents of the University of California. All rights reserved.
32 *
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
35 * are met:
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in the
40 * documentation and/or other materials provided with the distribution.
41 * 3. All advertising materials mentioning features or use of this software
42 * must display the following acknowledgement:
43 * This product includes software developed by the University of
44 * California, Berkeley and its contributors.
45 * 4. Neither the name of the University nor the names of its contributors
46 * may be used to endorse or promote products derived from this software
47 * without specific prior written permission.
48 *
49 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE.
60 *
61 * @(#)termios.h 8.3 (Berkeley) 3/28/94
62 */
63
64#ifndef _SYS_TERMIOS_H_
65#define _SYS_TERMIOS_H_
66
67#include <sys/cdefs.h>
68
69/*
70 * Special Control Characters
71 *
72 * Index into c_cc[] character array.
73 *
74 * Name Subscript Enabled by
75 */
76#define VEOF 0 /* ICANON */
77#define VEOL 1 /* ICANON */
78#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
79#define VEOL2 2 /* ICANON together with IEXTEN */
80#endif
81#define VERASE 3 /* ICANON */
82#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
83#define VWERASE 4 /* ICANON together with IEXTEN */
84#endif
85#define VKILL 5 /* ICANON */
86#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
87#define VREPRINT 6 /* ICANON together with IEXTEN */
88#endif
89/* 7 spare 1 */
90#define VINTR 8 /* ISIG */
91#define VQUIT 9 /* ISIG */
92#define VSUSP 10 /* ISIG */
93#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
94#define VDSUSP 11 /* ISIG together with IEXTEN */
95#endif
96#define VSTART 12 /* IXON, IXOFF */
97#define VSTOP 13 /* IXON, IXOFF */
98#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
99#define VLNEXT 14 /* IEXTEN */
100#define VDISCARD 15 /* IEXTEN */
101#endif
102#define VMIN 16 /* !ICANON */
103#define VTIME 17 /* !ICANON */
104#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
105#define VSTATUS 18 /* ICANON together with IEXTEN */
106/* 19 spare 2 */
107#endif
108#define NCCS 20
109
110#include <sys/_types/_posix_vdisable.h>
111
112#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
113#define CCEQ(val, c) ((c) == (val) ? (val) != _POSIX_VDISABLE : 0)
114#endif
115
116/*
117 * Input flags - software input processing
118 */
119#define IGNBRK 0x00000001 /* ignore BREAK condition */
120#define BRKINT 0x00000002 /* map BREAK to SIGINTR */
121#define IGNPAR 0x00000004 /* ignore (discard) parity errors */
122#define PARMRK 0x00000008 /* mark parity and framing errors */
123#define INPCK 0x00000010 /* enable checking of parity errors */
124#define ISTRIP 0x00000020 /* strip 8th bit off chars */
125#define INLCR 0x00000040 /* map NL into CR */
126#define IGNCR 0x00000080 /* ignore CR */
127#define ICRNL 0x00000100 /* map CR to NL (ala CRMOD) */
128#define IXON 0x00000200 /* enable output flow control */
129#define IXOFF 0x00000400 /* enable input flow control */
130#define IXANY 0x00000800 /* any char will restart after stop */
131#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
132#define IMAXBEL 0x00002000 /* ring bell on input queue full */
133#define IUTF8 0x00004000 /* maintain state for UTF-8 VERASE */
134#endif /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
135
136/*
137 * Output flags - software output processing
138 */
139#define OPOST 0x00000001 /* enable following output processing */
140#define ONLCR 0x00000002 /* map NL to CR-NL (ala CRMOD) */
141#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
142#define OXTABS 0x00000004 /* expand tabs to spaces */
143#define ONOEOT 0x00000008 /* discard EOT's (^D) on output) */
144#endif /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
145/*
146 * The following block of features is unimplemented. Use of these flags in
147 * programs will currently result in unexpected behaviour.
148 *
149 * - Begin unimplemented features
150 */
151#define OCRNL 0x00000010 /* map CR to NL on output */
152#define ONOCR 0x00000020 /* no CR output at column 0 */
153#define ONLRET 0x00000040 /* NL performs CR function */
154#define OFILL 0x00000080 /* use fill characters for delay */
155#define NLDLY 0x00000300 /* \n delay */
156#define TABDLY 0x00000c04 /* horizontal tab delay */
157#define CRDLY 0x00003000 /* \r delay */
158#define FFDLY 0x00004000 /* form feed delay */
159#define BSDLY 0x00008000 /* \b delay */
160#define VTDLY 0x00010000 /* vertical tab delay */
161#define OFDEL 0x00020000 /* fill is DEL, else NUL */
162#if !defined(_SYS_IOCTL_COMPAT_H_) || __DARWIN_UNIX03
163/*
164 * These manifest constants have the same names as those in the header
165 * <sys/ioctl_compat.h>, so you are not permitted to have both definitions
166 * in scope simultaneously in the same compilation unit. Nevertheless,
167 * they are required to be in scope when _POSIX_C_SOURCE is requested;
168 * this means that including the <sys/ioctl_compat.h> header before this
169 * one when _POSIX_C_SOURCE is in scope will result in redefintions. We
170 * attempt to maintain these as the same values so as to avoid this being
171 * an outright error in most compilers.
172 */
173#define NL0 0x00000000
174#define NL1 0x00000100
175#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
176#define NL2 0x00000200
177#define NL3 0x00000300
178#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
179#define TAB0 0x00000000
180#define TAB1 0x00000400
181#define TAB2 0x00000800
182/* not in sys/ioctl_compat.h, use OXTABS value */
183#define TAB3 0x00000004
184#define CR0 0x00000000
185#define CR1 0x00001000
186#define CR2 0x00002000
187#define CR3 0x00003000
188#define FF0 0x00000000
189#define FF1 0x00004000
190#define BS0 0x00000000
191#define BS1 0x00008000
192#define VT0 0x00000000
193#define VT1 0x00010000
194#endif /* !_SYS_IOCTL_COMPAT_H_ */
195/*
196 * + End unimplemented features
197 */
198
199/*
200 * Control flags - hardware control of terminal
201 */
202#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
203#define CIGNORE 0x00000001 /* ignore control flags */
204#endif
205#define CSIZE 0x00000300 /* character size mask */
206#define CS5 0x00000000 /* 5 bits (pseudo) */
207#define CS6 0x00000100 /* 6 bits */
208#define CS7 0x00000200 /* 7 bits */
209#define CS8 0x00000300 /* 8 bits */
210#define CSTOPB 0x00000400 /* send 2 stop bits */
211#define CREAD 0x00000800 /* enable receiver */
212#define PARENB 0x00001000 /* parity enable */
213#define PARODD 0x00002000 /* odd parity, else even */
214#define HUPCL 0x00004000 /* hang up on last close */
215#define CLOCAL 0x00008000 /* ignore modem status lines */
216#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
217#define CCTS_OFLOW 0x00010000 /* CTS flow control of output */
218#define CRTSCTS (CCTS_OFLOW | CRTS_IFLOW)
219#define CRTS_IFLOW 0x00020000 /* RTS flow control of input */
220#define CDTR_IFLOW 0x00040000 /* DTR flow control of input */
221#define CDSR_OFLOW 0x00080000 /* DSR flow control of output */
222#define CCAR_OFLOW 0x00100000 /* DCD flow control of output */
223#define MDMBUF 0x00100000 /* old name for CCAR_OFLOW */
224#endif
225
226
227/*
228 * "Local" flags - dumping ground for other state
229 *
230 * Warning: some flags in this structure begin with
231 * the letter "I" and look like they belong in the
232 * input flag.
233 */
234
235#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
236#define ECHOKE 0x00000001 /* visual erase for line kill */
237#endif /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
238#define ECHOE 0x00000002 /* visually erase chars */
239#define ECHOK 0x00000004 /* echo NL after line kill */
240#define ECHO 0x00000008 /* enable echoing */
241#define ECHONL 0x00000010 /* echo NL even if ECHO is off */
242#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
243#define ECHOPRT 0x00000020 /* visual erase mode for hardcopy */
244#define ECHOCTL 0x00000040 /* echo control chars as ^(Char) */
245#endif /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
246#define ISIG 0x00000080 /* enable signals INTR, QUIT, [D]SUSP */
247#define ICANON 0x00000100 /* canonicalize input lines */
248#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
249#define ALTWERASE 0x00000200 /* use alternate WERASE algorithm */
250#endif /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
251#define IEXTEN 0x00000400 /* enable DISCARD and LNEXT */
252#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
253#define EXTPROC 0x00000800 /* external processing */
254#endif /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
255#define TOSTOP 0x00400000 /* stop background jobs from output */
256#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
257#define FLUSHO 0x00800000 /* output being flushed (state) */
258#define NOKERNINFO 0x02000000 /* no kernel output from VSTATUS */
259#define PENDIN 0x20000000 /* XXX retype pending input (state) */
260#endif /*(_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
261#define NOFLSH 0x80000000 /* don't flush after interrupt */
262
263typedef unsigned long tcflag_t;
264typedef unsigned char cc_t;
265typedef unsigned long speed_t;
266
267struct termios {
268 tcflag_t c_iflag; /* input flags */
269 tcflag_t c_oflag; /* output flags */
270 tcflag_t c_cflag; /* control flags */
271 tcflag_t c_lflag; /* local flags */
272 cc_t c_cc[NCCS]; /* control chars */
273 speed_t c_ispeed; /* input speed */
274 speed_t c_ospeed; /* output speed */
275};
276
277
278/*
279 * Commands passed to tcsetattr() for setting the termios structure.
280 */
281#define TCSANOW 0 /* make change immediate */
282#define TCSADRAIN 1 /* drain output, then change */
283#define TCSAFLUSH 2 /* drain output, flush input */
284#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
285#define TCSASOFT 0x10 /* flag - don't alter h.w. state */
286#endif
287
288/*
289 * Standard speeds
290 */
291#define B0 0
292#define B50 50
293#define B75 75
294#define B110 110
295#define B134 134
296#define B150 150
297#define B200 200
298#define B300 300
299#define B600 600
300#define B1200 1200
301#define B1800 1800
302#define B2400 2400
303#define B4800 4800
304#define B9600 9600
305#define B19200 19200
306#define B38400 38400
307#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
308#define B7200 7200
309#define B14400 14400
310#define B28800 28800
311#define B57600 57600
312#define B76800 76800
313#define B115200 115200
314#define B230400 230400
315#define EXTA 19200
316#define EXTB 38400
317#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
318
319
320#define TCIFLUSH 1
321#define TCOFLUSH 2
322#define TCIOFLUSH 3
323#define TCOOFF 1
324#define TCOON 2
325#define TCIOFF 3
326#define TCION 4
327
328#include <sys/cdefs.h>
329
330__BEGIN_DECLS
331speed_t cfgetispeed(const struct termios *);
332speed_t cfgetospeed(const struct termios *);
333int cfsetispeed(struct termios *, speed_t);
334int cfsetospeed(struct termios *, speed_t);
335int tcgetattr(int, struct termios *);
336int tcsetattr(int, int, const struct termios *);
337int tcdrain(int) __DARWIN_ALIAS_C(tcdrain);
338int tcflow(int, int);
339int tcflush(int, int);
340int tcsendbreak(int, int);
341
342#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
343void cfmakeraw(struct termios *);
344int cfsetspeed(struct termios *, speed_t);
345#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
346__END_DECLS
347
348
349#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
350
351/*
352 * Include tty ioctl's that aren't just for backwards compatibility
353 * with the old tty driver. These ioctl definitions were previously
354 * in <sys/ioctl.h>.
355 */
356#include <sys/ttycom.h>
357#endif
358
359/*
360 * END OF PROTECTED INCLUDE.
361 */
362#endif /* !_SYS_TERMIOS_H_ */
363
364#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
365#include <sys/ttydefaults.h>
366#endif
lib/libc/include/x86_64-macos-gnu/sys/time.h created+208
......@@ -0,0 +1,208 @@
1/*
2 * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
29/*
30 * Copyright (c) 1982, 1986, 1993
31 * The Regents of the University of California. All rights reserved.
32 *
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
35 * are met:
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in the
40 * documentation and/or other materials provided with the distribution.
41 * 3. All advertising materials mentioning features or use of this software
42 * must display the following acknowledgement:
43 * This product includes software developed by the University of
44 * California, Berkeley and its contributors.
45 * 4. Neither the name of the University nor the names of its contributors
46 * may be used to endorse or promote products derived from this software
47 * without specific prior written permission.
48 *
49 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE.
60 *
61 * @(#)time.h 8.2 (Berkeley) 7/10/94
62 */
63
64#ifndef _SYS_TIME_H_
65#define _SYS_TIME_H_
66
67#include <sys/cdefs.h>
68#include <sys/_types.h>
69#include <Availability.h>
70
71/*
72 * [XSI] The fd_set type shall be defined as described in <sys/select.h>.
73 * The timespec structure shall be defined as described in <time.h>
74 */
75#include <sys/_types/_fd_def.h>
76#include <sys/_types/_timespec.h>
77#include <sys/_types/_timeval.h>
78
79#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
80#include <sys/_types/_timeval64.h>
81#endif /* !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) */
82
83
84#include <sys/_types/_time_t.h>
85#include <sys/_types/_suseconds_t.h>
86
87/*
88 * Structure used as a parameter by getitimer(2) and setitimer(2) system
89 * calls.
90 */
91struct itimerval {
92 struct timeval it_interval; /* timer interval */
93 struct timeval it_value; /* current value */
94};
95
96/*
97 * Names of the interval timers, and structure
98 * defining a timer setting.
99 */
100#define ITIMER_REAL 0
101#define ITIMER_VIRTUAL 1
102#define ITIMER_PROF 2
103
104/*
105 * Select uses bit masks of file descriptors in longs. These macros
106 * manipulate such bit fields (the filesystem macros use chars). The
107 * extra protection here is to permit application redefinition above
108 * the default size.
109 */
110#include <sys/_types/_fd_setsize.h>
111#include <sys/_types/_fd_set.h>
112#include <sys/_types/_fd_clr.h>
113#include <sys/_types/_fd_isset.h>
114#include <sys/_types/_fd_zero.h>
115
116#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
117
118#include <sys/_types/_fd_copy.h>
119
120#define TIMEVAL_TO_TIMESPEC(tv, ts) { \
121 (ts)->tv_sec = (tv)->tv_sec; \
122 (ts)->tv_nsec = (tv)->tv_usec * 1000; \
123}
124#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
125 (tv)->tv_sec = (ts)->tv_sec; \
126 (tv)->tv_usec = (ts)->tv_nsec / 1000; \
127}
128
129struct timezone {
130 int tz_minuteswest; /* minutes west of Greenwich */
131 int tz_dsttime; /* type of dst correction */
132};
133#define DST_NONE 0 /* not on dst */
134#define DST_USA 1 /* USA style dst */
135#define DST_AUST 2 /* Australian style dst */
136#define DST_WET 3 /* Western European dst */
137#define DST_MET 4 /* Middle European dst */
138#define DST_EET 5 /* Eastern European dst */
139#define DST_CAN 6 /* Canada */
140
141/* Operations on timevals. */
142#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
143#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
144#define timercmp(tvp, uvp, cmp) \
145 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
146 ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
147 ((tvp)->tv_sec cmp (uvp)->tv_sec))
148#define timeradd(tvp, uvp, vvp) \
149 do { \
150 (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
151 (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
152 if ((vvp)->tv_usec >= 1000000) { \
153 (vvp)->tv_sec++; \
154 (vvp)->tv_usec -= 1000000; \
155 } \
156 } while (0)
157#define timersub(tvp, uvp, vvp) \
158 do { \
159 (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
160 (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
161 if ((vvp)->tv_usec < 0) { \
162 (vvp)->tv_sec--; \
163 (vvp)->tv_usec += 1000000; \
164 } \
165 } while (0)
166
167#define timevalcmp(l, r, cmp) timercmp(l, r, cmp) /* freebsd */
168
169/*
170 * Getkerninfo clock information structure
171 */
172struct clockinfo {
173 int hz; /* clock frequency */
174 int tick; /* micro-seconds per hz tick */
175 int tickadj; /* clock skew rate for adjtime() */
176 int stathz; /* statistics clock frequency */
177 int profhz; /* profiling clock frequency */
178};
179#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
180
181
182
183#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
184#include <time.h>
185#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
186
187__BEGIN_DECLS
188
189#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
190int adjtime(const struct timeval *, struct timeval *);
191int futimes(int, const struct timeval *);
192int lutimes(const char *, const struct timeval *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
193int settimeofday(const struct timeval *, const struct timezone *);
194#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
195
196int getitimer(int, struct itimerval *);
197int gettimeofday(struct timeval * __restrict, void * __restrict);
198
199#include <sys/_select.h> /* select() prototype */
200
201int setitimer(int, const struct itimerval * __restrict,
202 struct itimerval * __restrict);
203int utimes(const char *, const struct timeval *);
204
205__END_DECLS
206
207
208#endif /* !_SYS_TIME_H_ */
lib/libc/include/x86_64-macos-gnu/sys/times.h created+92
......@@ -0,0 +1,92 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
29/*-
30 * Copyright (c) 1990, 1993
31 * The Regents of the University of California. All rights reserved.
32 * (c) UNIX System Laboratories, Inc.
33 * All or some portions of this file are derived from material licensed
34 * to the University of California by American Telephone and Telegraph
35 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
36 * the permission of UNIX System Laboratories, Inc.
37 *
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
40 * are met:
41 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution.
46 * 3. All advertising materials mentioning features or use of this software
47 * must display the following acknowledgement:
48 * This product includes software developed by the University of
49 * California, Berkeley and its contributors.
50 * 4. Neither the name of the University nor the names of its contributors
51 * may be used to endorse or promote products derived from this software
52 * without specific prior written permission.
53 *
54 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 * SUCH DAMAGE.
65 *
66 * @(#)times.h 8.4 (Berkeley) 1/21/94
67 */
68
69#ifndef _SYS_TIMES_H_
70#define _SYS_TIMES_H_
71
72#include <sys/appleapiopts.h>
73#include <sys/cdefs.h>
74#include <sys/_types.h>
75
76/* [XSI] The clock_t type shall be defined as described in <sys/types.h> */
77#include <sys/_types/_clock_t.h>
78
79/*
80 * [XSI] Structure whose address is passed as the first parameter to times()
81 */
82struct tms {
83 clock_t tms_utime; /* [XSI] User CPU time */
84 clock_t tms_stime; /* [XSI] System CPU time */
85 clock_t tms_cutime; /* [XSI] Terminated children user CPU time */
86 clock_t tms_cstime; /* [XSI] Terminated children System CPU time */
87};
88
89__BEGIN_DECLS
90clock_t times(struct tms *);
91__END_DECLS
92#endif /* !_SYS_TIMES_H_ */
lib/libc/include/x86_64-macos-gnu/sys/ttycom.h created+173
......@@ -0,0 +1,173 @@
1/*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved */
29/*-
30 * Copyright (c) 1982, 1986, 1990, 1993, 1994
31 * The Regents of the University of California. All rights reserved.
32 * (c) UNIX System Laboratories, Inc.
33 * All or some portions of this file are derived from material licensed
34 * to the University of California by American Telephone and Telegraph
35 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
36 * the permission of UNIX System Laboratories, Inc.
37 *
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
40 * are met:
41 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution.
46 * 3. All advertising materials mentioning features or use of this software
47 * must display the following acknowledgement:
48 * This product includes software developed by the University of
49 * California, Berkeley and its contributors.
50 * 4. Neither the name of the University nor the names of its contributors
51 * may be used to endorse or promote products derived from this software
52 * without specific prior written permission.
53 *
54 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 * SUCH DAMAGE.
65 *
66 * @(#)ttycom.h 8.1 (Berkeley) 3/28/94
67 */
68
69#ifndef _SYS_TTYCOM_H_
70#define _SYS_TTYCOM_H_
71
72#include <sys/ioccom.h>
73/*
74 * Tty ioctl's except for those supported only for backwards compatibility
75 * with the old tty driver.
76 */
77
78/*
79 * Window/terminal size structure. This information is stored by the kernel
80 * in order to provide a consistent interface, but is not used by the kernel.
81 */
82struct winsize {
83 unsigned short ws_row; /* rows, in characters */
84 unsigned short ws_col; /* columns, in characters */
85 unsigned short ws_xpixel; /* horizontal size, pixels */
86 unsigned short ws_ypixel; /* vertical size, pixels */
87};
88
89#define TIOCMODG _IOR('t', 3, int) /* get modem control state */
90#define TIOCMODS _IOW('t', 4, int) /* set modem control state */
91#define TIOCM_LE 0001 /* line enable */
92#define TIOCM_DTR 0002 /* data terminal ready */
93#define TIOCM_RTS 0004 /* request to send */
94#define TIOCM_ST 0010 /* secondary transmit */
95#define TIOCM_SR 0020 /* secondary receive */
96#define TIOCM_CTS 0040 /* clear to send */
97#define TIOCM_CAR 0100 /* carrier detect */
98#define TIOCM_CD TIOCM_CAR
99#define TIOCM_RNG 0200 /* ring */
100#define TIOCM_RI TIOCM_RNG
101#define TIOCM_DSR 0400 /* data set ready */
102 /* 8-10 compat */
103#define TIOCEXCL _IO('t', 13) /* set exclusive use of tty */
104#define TIOCNXCL _IO('t', 14) /* reset exclusive use of tty */
105 /* 15 unused */
106#define TIOCFLUSH _IOW('t', 16, int) /* flush buffers */
107 /* 17-18 compat */
108#define TIOCGETA _IOR('t', 19, struct termios) /* get termios struct */
109#define TIOCSETA _IOW('t', 20, struct termios) /* set termios struct */
110#define TIOCSETAW _IOW('t', 21, struct termios) /* drain output, set */
111#define TIOCSETAF _IOW('t', 22, struct termios) /* drn out, fls in, set */
112#define TIOCGETD _IOR('t', 26, int) /* get line discipline */
113#define TIOCSETD _IOW('t', 27, int) /* set line discipline */
114#define TIOCIXON _IO('t', 129) /* internal input VSTART */
115#define TIOCIXOFF _IO('t', 128) /* internal input VSTOP */
116 /* 127-124 compat */
117#define TIOCSBRK _IO('t', 123) /* set break bit */
118#define TIOCCBRK _IO('t', 122) /* clear break bit */
119#define TIOCSDTR _IO('t', 121) /* set data terminal ready */
120#define TIOCCDTR _IO('t', 120) /* clear data terminal ready */
121#define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */
122#define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */
123 /* 117-116 compat */
124#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
125#define TIOCSTI _IOW('t', 114, char) /* simulate terminal input */
126#define TIOCNOTTY _IO('t', 113) /* void tty association */
127#define TIOCPKT _IOW('t', 112, int) /* pty: set/clear packet mode */
128#define TIOCPKT_DATA 0x00 /* data packet */
129#define TIOCPKT_FLUSHREAD 0x01 /* flush packet */
130#define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */
131#define TIOCPKT_STOP 0x04 /* stop output */
132#define TIOCPKT_START 0x08 /* start output */
133#define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */
134#define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */
135#define TIOCPKT_IOCTL 0x40 /* state change of pty driver */
136#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
137#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
138#define TIOCMSET _IOW('t', 109, int) /* set all modem bits */
139#define TIOCMBIS _IOW('t', 108, int) /* bis modem bits */
140#define TIOCMBIC _IOW('t', 107, int) /* bic modem bits */
141#define TIOCMGET _IOR('t', 106, int) /* get all modem bits */
142#define TIOCREMOTE _IOW('t', 105, int) /* remote input editing */
143#define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */
144#define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */
145#define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */
146#define TIOCSTAT _IO('t', 101) /* simulate ^T status message */
147#define UIOCCMD(n) _IO('u', n) /* usr cntl op "n" */
148#define TIOCSCONS _IO('t', 99) /* 4.2 compatibility */
149#define TIOCCONS _IOW('t', 98, int) /* become virtual console */
150#define TIOCSCTTY _IO('t', 97) /* become controlling tty */
151#define TIOCEXT _IOW('t', 96, int) /* pty: external processing */
152#define TIOCSIG _IO('t', 95) /* pty: generate signal */
153#define TIOCDRAIN _IO('t', 94) /* wait till output drained */
154#define TIOCMSDTRWAIT _IOW('t', 91, int) /* modem: set wait on close */
155#define TIOCMGDTRWAIT _IOR('t', 90, int) /* modem: get wait on close */
156#define TIOCTIMESTAMP _IOR('t', 89, struct timeval) /* enable/get timestamp
157 * of last input event */
158#define TIOCDCDTIMESTAMP _IOR('t', 88, struct timeval) /* enable/get timestamp
159 * of last DCd rise */
160#define TIOCSDRAINWAIT _IOW('t', 87, int) /* set ttywait timeout */
161#define TIOCGDRAINWAIT _IOR('t', 86, int) /* get ttywait timeout */
162#define TIOCDSIMICROCODE _IO('t', 85) /* download microcode to
163 * DSI Softmodem */
164#define TIOCPTYGRANT _IO('t', 84) /* grantpt(3) */
165#define TIOCPTYGNAME _IOC(IOC_OUT, 't', 83, 128) /* ptsname(3) */
166#define TIOCPTYUNLK _IO('t', 82) /* unlockpt(3) */
167
168#define TTYDISC 0 /* termios tty line discipline */
169#define TABLDISC 3 /* tablet discipline */
170#define SLIPDISC 4 /* serial IP discipline */
171#define PPPDISC 5 /* PPP discipline */
172
173#endif /* !_SYS_TTYCOM_H_ */
lib/libc/include/x86_64-macos-gnu/sys/ttydefaults.h created+124
......@@ -0,0 +1,124 @@
1/*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved */
29/*-
30 * Copyright (c) 1982, 1986, 1993
31 * The Regents of the University of California. All rights reserved.
32 * (c) UNIX System Laboratories, Inc.
33 * All or some portions of this file are derived from material licensed
34 * to the University of California by American Telephone and Telegraph
35 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
36 * the permission of UNIX System Laboratories, Inc.
37 *
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
40 * are met:
41 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution.
46 * 3. All advertising materials mentioning features or use of this software
47 * must display the following acknowledgement:
48 * This product includes software developed by the University of
49 * California, Berkeley and its contributors.
50 * 4. Neither the name of the University nor the names of its contributors
51 * may be used to endorse or promote products derived from this software
52 * without specific prior written permission.
53 *
54 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 * SUCH DAMAGE.
65 *
66 * @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94
67 */
68
69/*
70 * System wide defaults for terminal state.
71 */
72#ifndef _SYS_TTYDEFAULTS_H_
73#define _SYS_TTYDEFAULTS_H_
74
75/*
76 * Defaults on "first" open.
77 */
78#define TTYDEF_IFLAG (BRKINT | ICRNL | IMAXBEL | IXON | IXANY)
79#define TTYDEF_OFLAG (OPOST | ONLCR)
80#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
81#define TTYDEF_CFLAG (CREAD | CS8 | HUPCL)
82#define TTYDEF_SPEED (B9600)
83
84/*
85 * Control Character Defaults
86 */
87#define CTRL(x) (x&037)
88#define CEOF CTRL('d')
89#define CEOL 0xff /* XXX avoid _POSIX_VDISABLE */
90#define CERASE 0177
91#define CINTR CTRL('c')
92#define CSTATUS CTRL('t')
93#define CKILL CTRL('u')
94#define CMIN 1
95#define CQUIT 034 /* FS, ^\ */
96#define CSUSP CTRL('z')
97#define CTIME 0
98#define CDSUSP CTRL('y')
99#define CSTART CTRL('q')
100#define CSTOP CTRL('s')
101#define CLNEXT CTRL('v')
102#define CDISCARD CTRL('o')
103#define CWERASE CTRL('w')
104#define CREPRINT CTRL('r')
105#define CEOT CEOF
106/* compat */
107#define CBRK CEOL
108#define CRPRNT CREPRINT
109#define CFLUSH CDISCARD
110
111/* PROTECTED INCLUSION ENDS HERE */
112#endif /* !_SYS_TTYDEFAULTS_H_ */
113
114/*
115 * #define TTYDEFCHARS to include an array of default control characters.
116 */
117#ifdef TTYDEFCHARS
118static cc_t ttydefchars[NCCS] = {
119 CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT,
120 _POSIX_VDISABLE, CINTR, CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT,
121 CDISCARD, CMIN, CTIME, CSTATUS, _POSIX_VDISABLE
122};
123#undef TTYDEFCHARS
124#endif
lib/libc/include/x86_64-macos-gnu/sys/types.h created+235
......@@ -0,0 +1,235 @@
1/*
2 * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
29/*
30 * Copyright (c) 1982, 1986, 1991, 1993, 1994
31 * The Regents of the University of California. All rights reserved.
32 * (c) UNIX System Laboratories, Inc.
33 * All or some portions of this file are derived from material licensed
34 * to the University of California by American Telephone and Telegraph
35 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
36 * the permission of UNIX System Laboratories, Inc.
37 *
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
40 * are met:
41 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution.
46 * 3. All advertising materials mentioning features or use of this software
47 * must display the following acknowledgement:
48 * This product includes software developed by the University of
49 * California, Berkeley and its contributors.
50 * 4. Neither the name of the University nor the names of its contributors
51 * may be used to endorse or promote products derived from this software
52 * without specific prior written permission.
53 *
54 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 * SUCH DAMAGE.
65 *
66 * @(#)types.h 8.4 (Berkeley) 1/21/94
67 */
68
69#ifndef _SYS_TYPES_H_
70#define _SYS_TYPES_H_
71
72#include <sys/appleapiopts.h>
73
74#ifndef __ASSEMBLER__
75#include <sys/cdefs.h>
76
77/* Machine type dependent parameters. */
78#include <machine/types.h>
79#include <sys/_types.h>
80
81#include <machine/endian.h>
82
83#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
84#include <sys/_types/_u_char.h>
85#include <sys/_types/_u_short.h>
86#include <sys/_types/_u_int.h>
87#ifndef _U_LONG
88typedef unsigned long u_long;
89#define _U_LONG
90#endif
91typedef unsigned short ushort; /* Sys V compatibility */
92typedef unsigned int uint; /* Sys V compatibility */
93#endif
94
95typedef u_int64_t u_quad_t; /* quads */
96typedef int64_t quad_t;
97typedef quad_t * qaddr_t;
98
99#include <sys/_types/_caddr_t.h> /* core address */
100
101typedef int32_t daddr_t; /* disk address */
102
103#include <sys/_types/_dev_t.h> /* device number */
104
105typedef u_int32_t fixpt_t; /* fixed point number */
106
107#include <sys/_types/_blkcnt_t.h>
108#include <sys/_types/_blksize_t.h>
109#include <sys/_types/_gid_t.h>
110#include <sys/_types/_in_addr_t.h>
111#include <sys/_types/_in_port_t.h>
112#include <sys/_types/_ino_t.h>
113
114#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
115#include <sys/_types/_ino64_t.h> /* 64bit inode number */
116#endif /* !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) */
117
118#include <sys/_types/_key_t.h>
119#include <sys/_types/_mode_t.h>
120#include <sys/_types/_nlink_t.h>
121#include <sys/_types/_id_t.h>
122#include <sys/_types/_pid_t.h>
123#include <sys/_types/_off_t.h>
124
125typedef int32_t segsz_t; /* segment size */
126typedef int32_t swblk_t; /* swap offset */
127
128#include <sys/_types/_uid_t.h>
129
130#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
131/* Major, minor numbers, dev_t's. */
132#if defined(__cplusplus)
133/*
134 * These lowercase macros tend to match member functions in some C++ code,
135 * so for C++, we must use inline functions instead.
136 */
137
138static inline __int32_t
139major(__uint32_t _x)
140{
141 return (__int32_t)(((__uint32_t)_x >> 24) & 0xff);
142}
143
144static inline __int32_t
145minor(__uint32_t _x)
146{
147 return (__int32_t)((_x) & 0xffffff);
148}
149
150static inline dev_t
151makedev(__uint32_t _major, __uint32_t _minor)
152{
153 return (dev_t)(((_major) << 24) | (_minor));
154}
155
156#else /* !__cplusplus */
157
158#define major(x) ((int32_t)(((u_int32_t)(x) >> 24) & 0xff))
159#define minor(x) ((int32_t)((x) & 0xffffff))
160#define makedev(x, y) ((dev_t)(((x) << 24) | (y)))
161
162#endif /* !__cplusplus */
163#endif /* !_POSIX_C_SOURCE */
164
165#include <sys/_types/_clock_t.h>
166#include <sys/_types/_size_t.h>
167#include <sys/_types/_ssize_t.h>
168#include <sys/_types/_time_t.h>
169
170#include <sys/_types/_useconds_t.h>
171#include <sys/_types/_suseconds_t.h>
172
173#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
174#include <sys/_types/_rsize_t.h>
175#include <sys/_types/_errno_t.h>
176#endif
177
178#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
179/*
180 * This code is present here in order to maintain historical backward
181 * compatability, and is intended to be removed at some point in the
182 * future; please include <sys/select.h> instead.
183 */
184#include <sys/_types/_fd_def.h>
185
186#define NBBY __DARWIN_NBBY /* bits in a byte */
187#define NFDBITS __DARWIN_NFDBITS /* bits per mask */
188#define howmany(x, y) __DARWIN_howmany(x, y) /* # y's == x bits? */
189typedef __int32_t fd_mask;
190
191/*
192 * Select uses bit masks of file descriptors in longs. These macros
193 * manipulate such bit fields (the filesystem macros use chars). The
194 * extra protection here is to permit application redefinition above
195 * the default size.
196 */
197#include <sys/_types/_fd_setsize.h>
198#include <sys/_types/_fd_set.h>
199#include <sys/_types/_fd_clr.h>
200#include <sys/_types/_fd_zero.h>
201#include <sys/_types/_fd_isset.h>
202
203#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
204#include <sys/_types/_fd_copy.h>
205#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
206
207
208
209#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
210#endif /* __ASSEMBLER__ */
211
212
213#ifndef __POSIX_LIB__
214
215#include <sys/_pthread/_pthread_attr_t.h>
216#include <sys/_pthread/_pthread_cond_t.h>
217#include <sys/_pthread/_pthread_condattr_t.h>
218#include <sys/_pthread/_pthread_mutex_t.h>
219#include <sys/_pthread/_pthread_mutexattr_t.h>
220#include <sys/_pthread/_pthread_once_t.h>
221#include <sys/_pthread/_pthread_rwlock_t.h>
222#include <sys/_pthread/_pthread_rwlockattr_t.h>
223#include <sys/_pthread/_pthread_t.h>
224
225#endif /* __POSIX_LIB__ */
226
227#include <sys/_pthread/_pthread_key_t.h>
228
229
230/* statvfs and fstatvfs */
231
232#include <sys/_types/_fsblkcnt_t.h>
233#include <sys/_types/_fsfilcnt_t.h>
234
235#endif /* !_SYS_TYPES_H_ */
lib/libc/include/x86_64-macos-gnu/sys/uio.h created+100
......@@ -0,0 +1,100 @@
1/*
2 * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
29/*
30 * Copyright (c) 1982, 1986, 1993, 1994
31 * The Regents of the University of California. All rights reserved.
32 *
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
35 * are met:
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in the
40 * documentation and/or other materials provided with the distribution.
41 * 3. All advertising materials mentioning features or use of this software
42 * must display the following acknowledgement:
43 * This product includes software developed by the University of
44 * California, Berkeley and its contributors.
45 * 4. Neither the name of the University nor the names of its contributors
46 * may be used to endorse or promote products derived from this software
47 * without specific prior written permission.
48 *
49 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE.
60 *
61 * @(#)uio.h 8.5 (Berkeley) 2/22/94
62 */
63
64#ifndef _SYS_UIO_H_
65#define _SYS_UIO_H_
66
67#include <sys/cdefs.h>
68#include <sys/_types.h>
69
70/*
71 * [XSI] The ssize_t and size_t types shall be defined as described
72 * in <sys/types.h>.
73 */
74#include <sys/_types/_size_t.h>
75#include <sys/_types/_ssize_t.h>
76
77/*
78 * [XSI] Structure whose address is passed as the second parameter to the
79 * readv() and writev() functions.
80 */
81#include <sys/_types/_iovec_t.h>
82
83
84#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
85/*
86 * IO direction for uio_t.
87 * UIO_READ - data moves into iovec(s) associated with uio_t
88 * UIO_WRITE - data moves out of iovec(s) associated with uio_t
89 */
90enum uio_rw { UIO_READ, UIO_WRITE };
91#endif
92
93
94
95__BEGIN_DECLS
96ssize_t readv(int, const struct iovec *, int) __DARWIN_ALIAS_C(readv);
97ssize_t writev(int, const struct iovec *, int) __DARWIN_ALIAS_C(writev);
98__END_DECLS
99
100#endif /* !_SYS_UIO_H_ */
lib/libc/include/x86_64-macos-gnu/sys/un.h created+105
......@@ -0,0 +1,105 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * Copyright (c) 1982, 1986, 1993
30 * The Regents of the University of California. All rights reserved.
31 *
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
34 * are met:
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.
40 * 3. All advertising materials mentioning features or use of this software
41 * must display the following acknowledgement:
42 * This product includes software developed by the University of
43 * California, Berkeley and its contributors.
44 * 4. Neither the name of the University nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 *
60 * @(#)un.h 8.3 (Berkeley) 2/19/95
61 */
62
63#ifndef _SYS_UN_H_
64#define _SYS_UN_H_
65
66#include <sys/appleapiopts.h>
67#include <sys/cdefs.h>
68#include <sys/_types.h>
69
70/* [XSI] The sa_family_t type shall be defined as described in <sys/socket.h> */
71#include <sys/_types/_sa_family_t.h>
72
73/*
74 * [XSI] Definitions for UNIX IPC domain.
75 */
76struct sockaddr_un {
77 unsigned char sun_len; /* sockaddr len including null */
78 sa_family_t sun_family; /* [XSI] AF_UNIX */
79 char sun_path[104]; /* [XSI] path name (gag) */
80};
81
82#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
83
84/* Level number of get/setsockopt for local domain sockets */
85#define SOL_LOCAL 0
86
87/* Socket options. */
88#define LOCAL_PEERCRED 0x001 /* retrieve peer credentials */
89#define LOCAL_PEERPID 0x002 /* retrieve peer pid */
90#define LOCAL_PEEREPID 0x003 /* retrieve eff. peer pid */
91#define LOCAL_PEERUUID 0x004 /* retrieve peer UUID */
92#define LOCAL_PEEREUUID 0x005 /* retrieve eff. peer UUID */
93
94#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
95
96
97
98#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
99/* actual length of an initialized sockaddr_un */
100#define SUN_LEN(su) \
101 (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
102#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
103
104
105#endif /* !_SYS_UN_H_ */
lib/libc/include/x86_64-macos-gnu/sys/unistd.h created+218
......@@ -0,0 +1,218 @@
1/*
2 * Copyright (c) 2000-2013 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
29/*
30 * Copyright (c) 1989, 1993
31 * The Regents of the University of California. All rights reserved.
32 *
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
35 * are met:
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in the
40 * documentation and/or other materials provided with the distribution.
41 * 3. All advertising materials mentioning features or use of this software
42 * must display the following acknowledgement:
43 * This product includes software developed by the University of
44 * California, Berkeley and its contributors.
45 * 4. Neither the name of the University nor the names of its contributors
46 * may be used to endorse or promote products derived from this software
47 * without specific prior written permission.
48 *
49 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE.
60 *
61 * @(#)unistd.h 8.2 (Berkeley) 1/7/94
62 */
63
64#ifndef _SYS_UNISTD_H_
65#define _SYS_UNISTD_H_
66
67#include <sys/cdefs.h>
68
69/*
70 * Although we have saved user/group IDs, we do not use them in setuid
71 * as described in POSIX 1003.1, because the feature does not work for
72 * root. We use the saved IDs in seteuid/setegid, which are not currently
73 * part of the POSIX 1003.1 specification.
74 */
75#ifdef _NOT_AVAILABLE
76#define _POSIX_SAVED_IDS /* saved set-user-ID and set-group-ID */
77#endif
78
79#define _POSIX_VERSION 200112L
80#define _POSIX2_VERSION 200112L
81
82/* execution-time symbolic constants */
83/* may disable terminal special characters */
84#include <sys/_types/_posix_vdisable.h>
85
86#define _POSIX_THREAD_KEYS_MAX 128
87
88/* access function */
89#define F_OK 0 /* test for existence of file */
90#define X_OK (1<<0) /* test for execute or search permission */
91#define W_OK (1<<1) /* test for write permission */
92#define R_OK (1<<2) /* test for read permission */
93
94#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
95/*
96 * Extended access functions.
97 * Note that we depend on these matching the definitions in sys/kauth.h,
98 * but with the bits shifted left by 8.
99 */
100#define _READ_OK (1<<9) /* read file data / read directory */
101#define _WRITE_OK (1<<10) /* write file data / add file to directory */
102#define _EXECUTE_OK (1<<11) /* execute file / search in directory*/
103#define _DELETE_OK (1<<12) /* delete file / delete directory */
104#define _APPEND_OK (1<<13) /* append to file / add subdirectory to directory */
105#define _RMFILE_OK (1<<14) /* - / remove file from directory */
106#define _RATTR_OK (1<<15) /* read basic attributes */
107#define _WATTR_OK (1<<16) /* write basic attributes */
108#define _REXT_OK (1<<17) /* read extended attributes */
109#define _WEXT_OK (1<<18) /* write extended attributes */
110#define _RPERM_OK (1<<19) /* read permissions */
111#define _WPERM_OK (1<<20) /* write permissions */
112#define _CHOWN_OK (1<<21) /* change ownership */
113
114#define _ACCESS_EXTENDED_MASK (_READ_OK | _WRITE_OK | _EXECUTE_OK | \
115 _DELETE_OK | _APPEND_OK | \
116 _RMFILE_OK | _REXT_OK | \
117 _WEXT_OK | _RATTR_OK | _WATTR_OK | _RPERM_OK | \
118 _WPERM_OK | _CHOWN_OK)
119#endif
120
121/* whence values for lseek(2) */
122#include <sys/_types/_seek_set.h>
123
124#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
125/* whence values for lseek(2); renamed by POSIX 1003.1 */
126#define L_SET SEEK_SET
127#define L_INCR SEEK_CUR
128#define L_XTND SEEK_END
129#endif
130
131#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
132struct accessx_descriptor {
133 unsigned int ad_name_offset;
134 int ad_flags;
135 int ad_pad[2];
136};
137#define ACCESSX_MAX_DESCRIPTORS 100
138#define ACCESSX_MAX_TABLESIZE (16 * 1024)
139#endif
140
141/* configurable pathname variables */
142#define _PC_LINK_MAX 1
143#define _PC_MAX_CANON 2
144#define _PC_MAX_INPUT 3
145#define _PC_NAME_MAX 4
146#define _PC_PATH_MAX 5
147#define _PC_PIPE_BUF 6
148#define _PC_CHOWN_RESTRICTED 7
149#define _PC_NO_TRUNC 8
150#define _PC_VDISABLE 9
151
152#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
153#define _PC_NAME_CHARS_MAX 10
154#define _PC_CASE_SENSITIVE 11
155#define _PC_CASE_PRESERVING 12
156#define _PC_EXTENDED_SECURITY_NP 13
157#define _PC_AUTH_OPAQUE_NP 14
158#endif
159
160#define _PC_2_SYMLINKS 15 /* Symlink supported in directory */
161#define _PC_ALLOC_SIZE_MIN 16 /* Minimum storage actually allocated */
162#define _PC_ASYNC_IO 17 /* Async I/O [AIO] supported? */
163#define _PC_FILESIZEBITS 18 /* # of bits to represent file size */
164#define _PC_PRIO_IO 19 /* Priority I/O [PIO] supported? */
165#define _PC_REC_INCR_XFER_SIZE 20 /* Recommended increment for next two */
166#define _PC_REC_MAX_XFER_SIZE 21 /* Recommended max file transfer size */
167#define _PC_REC_MIN_XFER_SIZE 22 /* Recommended min file transfer size */
168#define _PC_REC_XFER_ALIGN 23 /* Recommended buffer alignment */
169#define _PC_SYMLINK_MAX 24 /* Max # of bytes in symlink name */
170#define _PC_SYNC_IO 25 /* Sync I/O [SIO] supported? */
171#define _PC_XATTR_SIZE_BITS 26 /* # of bits to represent maximum xattr size */
172#define _PC_MIN_HOLE_SIZE 27 /* Recommended minimum hole size for sparse files */
173
174/* configurable system strings */
175#define _CS_PATH 1
176
177#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
178
179#include <machine/_types.h>
180#include <sys/_types/_size_t.h>
181#include <_types/_uint64_t.h>
182#include <_types/_uint32_t.h>
183#include <Availability.h>
184
185__BEGIN_DECLS
186
187int getattrlistbulk(int, void *, void *, size_t, uint64_t) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
188int getattrlistat(int, const char *, void *, void *, size_t, unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
189int setattrlistat(int, const char *, void *, void *, size_t, uint32_t) __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
190
191__END_DECLS
192
193#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
194
195#if __DARWIN_C_LEVEL >= 200809L
196
197#include <machine/_types.h>
198#include <sys/_types/_size_t.h>
199#include <sys/_types/_ssize_t.h>
200#include <sys/_types.h>
201#include <sys/_types/_uid_t.h>
202#include <sys/_types/_gid_t.h>
203#include <Availability.h>
204
205__BEGIN_DECLS
206
207int faccessat(int, const char *, int, int) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
208int fchownat(int, const char *, uid_t, gid_t, int) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
209int linkat(int, const char *, int, const char *, int) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
210ssize_t readlinkat(int, const char *, char *, size_t) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
211int symlinkat(const char *, int, const char *) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
212int unlinkat(int, const char *, int) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
213
214__END_DECLS
215
216#endif /* __DARWIN_C_LEVEL >= 200809L */
217
218#endif /* !_SYS_UNISTD_H_ */
lib/libc/include/x86_64-macos-gnu/sys/utsname.h created+86
......@@ -0,0 +1,86 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* Copyright 1993,1995 NeXT Computer Inc. All Rights Reserved */
29/*-
30 * Copyright (c) 1994
31 * The Regents of the University of California. All rights reserved.
32 *
33 * This code is derived from software contributed to Berkeley by
34 * Chuck Karish of Mindcraft, Inc.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
44 * 3. All advertising materials mentioning features or use of this software
45 * must display the following acknowledgement:
46 * This product includes software developed by the University of
47 * California, Berkeley and its contributors.
48 * 4. Neither the name of the University nor the names of its contributors
49 * may be used to endorse or promote products derived from this software
50 * without specific prior written permission.
51 *
52 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
53 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
56 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * SUCH DAMAGE.
63 *
64 * @(#)utsname.h 8.1 (Berkeley) 1/4/94
65 */
66
67#ifndef _SYS_UTSNAME_H
68#define _SYS_UTSNAME_H
69
70#include <sys/cdefs.h>
71
72#define _SYS_NAMELEN 256
73
74struct utsname {
75 char sysname[_SYS_NAMELEN]; /* [XSI] Name of OS */
76 char nodename[_SYS_NAMELEN]; /* [XSI] Name of this network node */
77 char release[_SYS_NAMELEN]; /* [XSI] Release level */
78 char version[_SYS_NAMELEN]; /* [XSI] Version level */
79 char machine[_SYS_NAMELEN]; /* [XSI] Hardware type */
80};
81
82__BEGIN_DECLS
83int uname(struct utsname *);
84__END_DECLS
85
86#endif /* !_SYS_UTSNAME_H */
lib/libc/include/x86_64-macos-gnu/syslog.h created+24
......@@ -0,0 +1,24 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23#include <sys/syslog.h>
24
lib/libc/include/x86_64-macos-gnu/tar.h created+73
......@@ -0,0 +1,73 @@
1/*-
2 * Copyright (c) 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Chuck Karish of Mindcraft, Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)tar.h 8.2 (Berkeley) 1/4/94
37 */
38
39#ifndef _TAR_H
40#define _TAR_H
41
42#define TMAGIC "ustar" /* ustar and a null */
43#define TMAGLEN 6
44#define TVERSION "00" /* 00 and no null */
45#define TVERSLEN 2
46
47/* Values used in typeflag field */
48#define REGTYPE '0' /* Regular file */
49#define AREGTYPE '\0' /* Regular file */
50#define LNKTYPE '1' /* Link */
51#define SYMTYPE '2' /* Reserved */
52#define CHRTYPE '3' /* Character special */
53#define BLKTYPE '4' /* Block special */
54#define DIRTYPE '5' /* Directory */
55#define FIFOTYPE '6' /* FIFO special */
56#define CONTTYPE '7' /* Reserved */
57
58/* Bits used in the mode field - values in octal */
59#define TSUID 04000 /* Set UID on execution */
60#define TSGID 02000 /* Set GID on execution */
61#define TSVTX 01000 /* Reserved */
62 /* File permissions */
63#define TUREAD 00400 /* Read by owner */
64#define TUWRITE 00200 /* Write by owner */
65#define TUEXEC 00100 /* Execute/Search by owner */
66#define TGREAD 00040 /* Read by group */
67#define TGWRITE 00020 /* Write by group */
68#define TGEXEC 00010 /* Execute/Search by group */
69#define TOREAD 00004 /* Read by other */
70#define TOWRITE 00002 /* Write by other */
71#define TOEXEC 00001 /* Execute/Search by other */
72
73#endif
lib/libc/include/x86_64-macos-gnu/termios.h created+35
......@@ -0,0 +1,35 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23#ifndef __TERMIOS_H__
24#define __TERMIOS_H__
25
26#include <sys/cdefs.h>
27#include <sys/termios.h>
28#include <_types.h>
29#include <sys/_types/_pid_t.h>
30
31__BEGIN_DECLS
32pid_t tcgetsid(int);
33__END_DECLS
34
35#endif /* __TERMIOS_H__ */
lib/libc/include/x86_64-macos-gnu/ulimit.h created+41
......@@ -0,0 +1,41 @@
1/*-
2 * Copyright (c) 2002 Kyle Martin <mkm@ieee.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: src/include/ulimit.h,v 1.4 2003/01/08 01:18:13 tjr Exp $
27 */
28
29#ifndef _ULIMIT_H_
30#define _ULIMIT_H_
31
32#include <sys/cdefs.h>
33
34#define UL_GETFSIZE 1
35#define UL_SETFSIZE 2
36
37__BEGIN_DECLS
38long ulimit(int, ...);
39__END_DECLS
40
41#endif /* !_ULIMIT_H_ */
lib/libc/include/x86_64-macos-gnu/unistd.h created+787
......@@ -0,0 +1,787 @@
1/*
2 * Copyright (c) 2000, 2002-2006, 2008-2010, 2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*-
24 * Copyright (c) 1998-1999 Apple Computer, Inc. All Rights Reserved
25 * Copyright (c) 1991, 1993, 1994
26 * The Regents of the University of California. All rights reserved.
27 *
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that the following conditions
30 * are met:
31 * 1. Redistributions of source code must retain the above copyright
32 * notice, this list of conditions and the following disclaimer.
33 * 2. Redistributions in binary form must reproduce the above copyright
34 * notice, this list of conditions and the following disclaimer in the
35 * documentation and/or other materials provided with the distribution.
36 * 3. All advertising materials mentioning features or use of this software
37 * must display the following acknowledgement:
38 * This product includes software developed by the University of
39 * California, Berkeley and its contributors.
40 * 4. Neither the name of the University nor the names of its contributors
41 * may be used to endorse or promote products derived from this software
42 * without specific prior written permission.
43 *
44 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
45 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
46 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
47 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
48 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
49 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
50 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
51 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
52 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
53 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
54 * SUCH DAMAGE.
55 *
56 * @(#)unistd.h 8.12 (Berkeley) 4/27/95
57 *
58 * Copyright (c) 1998 Apple Compter, Inc.
59 * All Rights Reserved
60 */
61
62/* History:
63 7/14/99 EKN at Apple fixed getdirentriesattr from getdirentryattr
64 3/26/98 CHW at Apple added real interface to searchfs call
65 3/5/98 CHW at Apple added hfs semantic system calls headers
66*/
67
68#ifndef _UNISTD_H_
69#define _UNISTD_H_
70
71#include <_types.h>
72#include <sys/unistd.h>
73#include <Availability.h>
74#include <sys/_types/_gid_t.h>
75#include <sys/_types/_intptr_t.h>
76#include <sys/_types/_off_t.h>
77#include <sys/_types/_pid_t.h>
78/* DO NOT REMOVE THIS COMMENT: fixincludes needs to see:
79 * _GCC_SIZE_T */
80#include <sys/_types/_size_t.h>
81#include <sys/_types/_ssize_t.h>
82#include <sys/_types/_uid_t.h>
83#include <sys/_types/_useconds_t.h>
84#include <sys/_types/_null.h>
85
86#define STDIN_FILENO 0 /* standard input file descriptor */
87#define STDOUT_FILENO 1 /* standard output file descriptor */
88#define STDERR_FILENO 2 /* standard error file descriptor */
89
90
91/* Version test macros */
92/* _POSIX_VERSION and _POSIX2_VERSION from sys/unistd.h */
93#define _XOPEN_VERSION 600 /* [XSI] */
94#define _XOPEN_XCU_VERSION 4 /* Older standard */
95
96
97/* Please keep this list in the same order as the applicable standard */
98#define _POSIX_ADVISORY_INFO (-1) /* [ADV] */
99#define _POSIX_ASYNCHRONOUS_IO (-1) /* [AIO] */
100#define _POSIX_BARRIERS (-1) /* [BAR] */
101#define _POSIX_CHOWN_RESTRICTED 200112L
102#define _POSIX_CLOCK_SELECTION (-1) /* [CS] */
103#define _POSIX_CPUTIME (-1) /* [CPT] */
104#define _POSIX_FSYNC 200112L /* [FSC] */
105#define _POSIX_IPV6 200112L
106#define _POSIX_JOB_CONTROL 200112L
107#define _POSIX_MAPPED_FILES 200112L /* [MF] */
108#define _POSIX_MEMLOCK (-1) /* [ML] */
109#define _POSIX_MEMLOCK_RANGE (-1) /* [MR] */
110#define _POSIX_MEMORY_PROTECTION 200112L /* [MPR] */
111#define _POSIX_MESSAGE_PASSING (-1) /* [MSG] */
112#define _POSIX_MONOTONIC_CLOCK (-1) /* [MON] */
113#define _POSIX_NO_TRUNC 200112L
114#define _POSIX_PRIORITIZED_IO (-1) /* [PIO] */
115#define _POSIX_PRIORITY_SCHEDULING (-1) /* [PS] */
116#define _POSIX_RAW_SOCKETS (-1) /* [RS] */
117#define _POSIX_READER_WRITER_LOCKS 200112L /* [THR] */
118#define _POSIX_REALTIME_SIGNALS (-1) /* [RTS] */
119#define _POSIX_REGEXP 200112L
120#define _POSIX_SAVED_IDS 200112L /* XXX required */
121#define _POSIX_SEMAPHORES (-1) /* [SEM] */
122#define _POSIX_SHARED_MEMORY_OBJECTS (-1) /* [SHM] */
123#define _POSIX_SHELL 200112L
124#define _POSIX_SPAWN (-1) /* [SPN] */
125#define _POSIX_SPIN_LOCKS (-1) /* [SPI] */
126#define _POSIX_SPORADIC_SERVER (-1) /* [SS] */
127#define _POSIX_SYNCHRONIZED_IO (-1) /* [SIO] */
128#define _POSIX_THREAD_ATTR_STACKADDR 200112L /* [TSA] */
129#define _POSIX_THREAD_ATTR_STACKSIZE 200112L /* [TSS] */
130#define _POSIX_THREAD_CPUTIME (-1) /* [TCT] */
131#define _POSIX_THREAD_PRIO_INHERIT (-1) /* [TPI] */
132#define _POSIX_THREAD_PRIO_PROTECT (-1) /* [TPP] */
133#define _POSIX_THREAD_PRIORITY_SCHEDULING (-1) /* [TPS] */
134#define _POSIX_THREAD_PROCESS_SHARED 200112L /* [TSH] */
135#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L /* [TSF] */
136#define _POSIX_THREAD_SPORADIC_SERVER (-1) /* [TSP] */
137#define _POSIX_THREADS 200112L /* [THR] */
138#define _POSIX_TIMEOUTS (-1) /* [TMO] */
139#define _POSIX_TIMERS (-1) /* [TMR] */
140#define _POSIX_TRACE (-1) /* [TRC] */
141#define _POSIX_TRACE_EVENT_FILTER (-1) /* [TEF] */
142#define _POSIX_TRACE_INHERIT (-1) /* [TRI] */
143#define _POSIX_TRACE_LOG (-1) /* [TRL] */
144#define _POSIX_TYPED_MEMORY_OBJECTS (-1) /* [TYM] */
145#ifndef _POSIX_VDISABLE
146#define _POSIX_VDISABLE 0xff /* same as sys/termios.h */
147#endif /* _POSIX_VDISABLE */
148
149#if __DARWIN_C_LEVEL >= 199209L
150#define _POSIX2_C_BIND 200112L
151#define _POSIX2_C_DEV 200112L /* c99 command */
152#define _POSIX2_CHAR_TERM 200112L
153#define _POSIX2_FORT_DEV (-1) /* fort77 command */
154#define _POSIX2_FORT_RUN 200112L
155#define _POSIX2_LOCALEDEF 200112L /* localedef command */
156#define _POSIX2_PBS (-1)
157#define _POSIX2_PBS_ACCOUNTING (-1)
158#define _POSIX2_PBS_CHECKPOINT (-1)
159#define _POSIX2_PBS_LOCATE (-1)
160#define _POSIX2_PBS_MESSAGE (-1)
161#define _POSIX2_PBS_TRACK (-1)
162#define _POSIX2_SW_DEV 200112L
163#define _POSIX2_UPE 200112L /* XXXX no fc, newgrp, tabs */
164#endif /* __DARWIN_C_LEVEL */
165
166#define __ILP32_OFF32 (-1)
167#define __ILP32_OFFBIG (-1)
168
169#define __LP64_OFF64 (1)
170#define __LPBIG_OFFBIG (1)
171
172#if __DARWIN_C_LEVEL >= 200112L
173#define _POSIX_V6_ILP32_OFF32 __ILP32_OFF32
174#define _POSIX_V6_ILP32_OFFBIG __ILP32_OFFBIG
175#define _POSIX_V6_LP64_OFF64 __LP64_OFF64
176#define _POSIX_V6_LPBIG_OFFBIG __LPBIG_OFFBIG
177#endif /* __DARWIN_C_LEVEL >= 200112L */
178
179#if __DARWIN_C_LEVEL >= 200809L
180#define _POSIX_V7_ILP32_OFF32 __ILP32_OFF32
181#define _POSIX_V7_ILP32_OFFBIG __ILP32_OFFBIG
182#define _POSIX_V7_LP64_OFF64 __LP64_OFF64
183#define _POSIX_V7_LPBIG_OFFBIG __LPBIG_OFFBIG
184#endif /* __DARWIN_C_LEVEL >= 200809L */
185
186#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
187#define _V6_ILP32_OFF32 __ILP32_OFF32
188#define _V6_ILP32_OFFBIG __ILP32_OFFBIG
189#define _V6_LP64_OFF64 __LP64_OFF64
190#define _V6_LPBIG_OFFBIG __LPBIG_OFFBIG
191#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
192
193#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
194/* Removed in Issue 7 */
195#define _XBS5_ILP32_OFF32 __ILP32_OFF32
196#define _XBS5_ILP32_OFFBIG __ILP32_OFFBIG
197#define _XBS5_LP64_OFF64 __LP64_OFF64
198#define _XBS5_LPBIG_OFFBIG __LPBIG_OFFBIG
199#endif /* __DARWIN_C_LEVEL < 200809L */
200
201#if __DARWIN_C_LEVEL >= 199506L /* This really should be XSI */
202#define _XOPEN_CRYPT (1)
203#define _XOPEN_ENH_I18N (1) /* XXX required */
204#define _XOPEN_LEGACY (-1) /* no ftime gcvt, wcswcs */
205#define _XOPEN_REALTIME (-1) /* no q'ed signals, mq_* */
206#define _XOPEN_REALTIME_THREADS (-1) /* no posix_spawn, et. al. */
207#define _XOPEN_SHM (1)
208#define _XOPEN_STREAMS (-1) /* Issue 6 */
209#define _XOPEN_UNIX (1)
210#endif /* XSI */
211
212/* configurable system variables */
213#define _SC_ARG_MAX 1
214#define _SC_CHILD_MAX 2
215#define _SC_CLK_TCK 3
216#define _SC_NGROUPS_MAX 4
217#define _SC_OPEN_MAX 5
218#define _SC_JOB_CONTROL 6
219#define _SC_SAVED_IDS 7
220#define _SC_VERSION 8
221#define _SC_BC_BASE_MAX 9
222#define _SC_BC_DIM_MAX 10
223#define _SC_BC_SCALE_MAX 11
224#define _SC_BC_STRING_MAX 12
225#define _SC_COLL_WEIGHTS_MAX 13
226#define _SC_EXPR_NEST_MAX 14
227#define _SC_LINE_MAX 15
228#define _SC_RE_DUP_MAX 16
229#define _SC_2_VERSION 17
230#define _SC_2_C_BIND 18
231#define _SC_2_C_DEV 19
232#define _SC_2_CHAR_TERM 20
233#define _SC_2_FORT_DEV 21
234#define _SC_2_FORT_RUN 22
235#define _SC_2_LOCALEDEF 23
236#define _SC_2_SW_DEV 24
237#define _SC_2_UPE 25
238#define _SC_STREAM_MAX 26
239#define _SC_TZNAME_MAX 27
240
241#if __DARWIN_C_LEVEL >= 199309L
242#define _SC_ASYNCHRONOUS_IO 28
243#define _SC_PAGESIZE 29
244#define _SC_MEMLOCK 30
245#define _SC_MEMLOCK_RANGE 31
246#define _SC_MEMORY_PROTECTION 32
247#define _SC_MESSAGE_PASSING 33
248#define _SC_PRIORITIZED_IO 34
249#define _SC_PRIORITY_SCHEDULING 35
250#define _SC_REALTIME_SIGNALS 36
251#define _SC_SEMAPHORES 37
252#define _SC_FSYNC 38
253#define _SC_SHARED_MEMORY_OBJECTS 39
254#define _SC_SYNCHRONIZED_IO 40
255#define _SC_TIMERS 41
256#define _SC_AIO_LISTIO_MAX 42
257#define _SC_AIO_MAX 43
258#define _SC_AIO_PRIO_DELTA_MAX 44
259#define _SC_DELAYTIMER_MAX 45
260#define _SC_MQ_OPEN_MAX 46
261#define _SC_MAPPED_FILES 47 /* swap _SC_PAGESIZE vs. BSD */
262#define _SC_RTSIG_MAX 48
263#define _SC_SEM_NSEMS_MAX 49
264#define _SC_SEM_VALUE_MAX 50
265#define _SC_SIGQUEUE_MAX 51
266#define _SC_TIMER_MAX 52
267#endif /* __DARWIN_C_LEVEL >= 199309L */
268
269#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
270#define _SC_NPROCESSORS_CONF 57
271#define _SC_NPROCESSORS_ONLN 58
272#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
273
274#if __DARWIN_C_LEVEL >= 200112L
275#define _SC_2_PBS 59
276#define _SC_2_PBS_ACCOUNTING 60
277#define _SC_2_PBS_CHECKPOINT 61
278#define _SC_2_PBS_LOCATE 62
279#define _SC_2_PBS_MESSAGE 63
280#define _SC_2_PBS_TRACK 64
281#define _SC_ADVISORY_INFO 65
282#define _SC_BARRIERS 66
283#define _SC_CLOCK_SELECTION 67
284#define _SC_CPUTIME 68
285#define _SC_FILE_LOCKING 69
286#define _SC_GETGR_R_SIZE_MAX 70
287#define _SC_GETPW_R_SIZE_MAX 71
288#define _SC_HOST_NAME_MAX 72
289#define _SC_LOGIN_NAME_MAX 73
290#define _SC_MONOTONIC_CLOCK 74
291#define _SC_MQ_PRIO_MAX 75
292#define _SC_READER_WRITER_LOCKS 76
293#define _SC_REGEXP 77
294#define _SC_SHELL 78
295#define _SC_SPAWN 79
296#define _SC_SPIN_LOCKS 80
297#define _SC_SPORADIC_SERVER 81
298#define _SC_THREAD_ATTR_STACKADDR 82
299#define _SC_THREAD_ATTR_STACKSIZE 83
300#define _SC_THREAD_CPUTIME 84
301#define _SC_THREAD_DESTRUCTOR_ITERATIONS 85
302#define _SC_THREAD_KEYS_MAX 86
303#define _SC_THREAD_PRIO_INHERIT 87
304#define _SC_THREAD_PRIO_PROTECT 88
305#define _SC_THREAD_PRIORITY_SCHEDULING 89
306#define _SC_THREAD_PROCESS_SHARED 90
307#define _SC_THREAD_SAFE_FUNCTIONS 91
308#define _SC_THREAD_SPORADIC_SERVER 92
309#define _SC_THREAD_STACK_MIN 93
310#define _SC_THREAD_THREADS_MAX 94
311#define _SC_TIMEOUTS 95
312#define _SC_THREADS 96
313#define _SC_TRACE 97
314#define _SC_TRACE_EVENT_FILTER 98
315#define _SC_TRACE_INHERIT 99
316#define _SC_TRACE_LOG 100
317#define _SC_TTY_NAME_MAX 101
318#define _SC_TYPED_MEMORY_OBJECTS 102
319#define _SC_V6_ILP32_OFF32 103
320#define _SC_V6_ILP32_OFFBIG 104
321#define _SC_V6_LP64_OFF64 105
322#define _SC_V6_LPBIG_OFFBIG 106
323#define _SC_IPV6 118
324#define _SC_RAW_SOCKETS 119
325#define _SC_SYMLOOP_MAX 120
326#endif /* __DARWIN_C_LEVEL >= 200112L */
327
328#if __DARWIN_C_LEVEL >= 199506L /* Really XSI */
329#define _SC_ATEXIT_MAX 107
330#define _SC_IOV_MAX 56
331#define _SC_PAGE_SIZE _SC_PAGESIZE
332#define _SC_XOPEN_CRYPT 108
333#define _SC_XOPEN_ENH_I18N 109
334#define _SC_XOPEN_LEGACY 110 /* Issue 6 */
335#define _SC_XOPEN_REALTIME 111 /* Issue 6 */
336#define _SC_XOPEN_REALTIME_THREADS 112 /* Issue 6 */
337#define _SC_XOPEN_SHM 113
338#define _SC_XOPEN_STREAMS 114 /* Issue 6 */
339#define _SC_XOPEN_UNIX 115
340#define _SC_XOPEN_VERSION 116
341#define _SC_XOPEN_XCU_VERSION 121
342#endif /* XSI */
343
344#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
345/* Removed in Issue 7 */
346#define _SC_XBS5_ILP32_OFF32 122
347#define _SC_XBS5_ILP32_OFFBIG 123
348#define _SC_XBS5_LP64_OFF64 124
349#define _SC_XBS5_LPBIG_OFFBIG 125
350#endif /* __DARWIN_C_LEVEL <= 200809L */
351
352#if __DARWIN_C_LEVEL >= 200112L
353#define _SC_SS_REPL_MAX 126
354#define _SC_TRACE_EVENT_NAME_MAX 127
355#define _SC_TRACE_NAME_MAX 128
356#define _SC_TRACE_SYS_MAX 129
357#define _SC_TRACE_USER_EVENT_MAX 130
358#endif
359
360#if __DARWIN_C_LEVEL < 200112L || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
361/* Removed in Issue 6 */
362#define _SC_PASS_MAX 131
363#endif
364
365/* 132-199 available for future use */
366#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
367#define _SC_PHYS_PAGES 200
368#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
369
370#if __DARWIN_C_LEVEL >= 199209L
371#ifndef _CS_PATH /* Defined in <sys/unistd.h> */
372#define _CS_PATH 1
373#endif
374#endif
375
376#if __DARWIN_C_LEVEL >= 200112
377#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 2
378#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 3
379#define _CS_POSIX_V6_ILP32_OFF32_LIBS 4
380#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 5
381#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 6
382#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 7
383#define _CS_POSIX_V6_LP64_OFF64_CFLAGS 8
384#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 9
385#define _CS_POSIX_V6_LP64_OFF64_LIBS 10
386#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 11
387#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 12
388#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 13
389#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 14
390#endif
391
392#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
393/* Removed in Issue 7 */
394#define _CS_XBS5_ILP32_OFF32_CFLAGS 20
395#define _CS_XBS5_ILP32_OFF32_LDFLAGS 21
396#define _CS_XBS5_ILP32_OFF32_LIBS 22
397#define _CS_XBS5_ILP32_OFF32_LINTFLAGS 23
398#define _CS_XBS5_ILP32_OFFBIG_CFLAGS 24
399#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS 25
400#define _CS_XBS5_ILP32_OFFBIG_LIBS 26
401#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS 27
402#define _CS_XBS5_LP64_OFF64_CFLAGS 28
403#define _CS_XBS5_LP64_OFF64_LDFLAGS 29
404#define _CS_XBS5_LP64_OFF64_LIBS 30
405#define _CS_XBS5_LP64_OFF64_LINTFLAGS 31
406#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS 32
407#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS 33
408#define _CS_XBS5_LPBIG_OFFBIG_LIBS 34
409#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS 35
410#endif
411
412#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
413#define _CS_DARWIN_USER_DIR 65536
414#define _CS_DARWIN_USER_TEMP_DIR 65537
415#define _CS_DARWIN_USER_CACHE_DIR 65538
416#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
417
418
419#ifdef _DARWIN_UNLIMITED_GETGROUPS
420#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2
421#error "_DARWIN_UNLIMITED_GETGROUPS specified, but -miphoneos-version-min version does not support it."
422#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6
423#error "_DARWIN_UNLIMITED_GETGROUPS specified, but -mmacosx-version-min version does not support it."
424#endif
425#endif
426
427/* POSIX.1-1990 */
428
429__BEGIN_DECLS
430void _exit(int) __dead2;
431int access(const char *, int);
432unsigned int
433 alarm(unsigned int);
434int chdir(const char *);
435int chown(const char *, uid_t, gid_t);
436
437int close(int) __DARWIN_ALIAS_C(close);
438
439int dup(int);
440int dup2(int, int);
441int execl(const char * __path, const char * __arg0, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
442int execle(const char * __path, const char * __arg0, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
443int execlp(const char * __file, const char * __arg0, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
444int execv(const char * __path, char * const * __argv) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
445int execve(const char * __file, char * const * __argv, char * const * __envp) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
446int execvp(const char * __file, char * const * __argv) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
447pid_t fork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
448long fpathconf(int, int);
449char *getcwd(char *, size_t);
450gid_t getegid(void);
451uid_t geteuid(void);
452gid_t getgid(void);
453#if defined(_DARWIN_UNLIMITED_GETGROUPS) || defined(_DARWIN_C_SOURCE)
454int getgroups(int, gid_t []) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_3_2, __DARWIN_EXTSN(getgroups));
455#else /* !_DARWIN_UNLIMITED_GETGROUPS && !_DARWIN_C_SOURCE */
456int getgroups(int, gid_t []);
457#endif /* _DARWIN_UNLIMITED_GETGROUPS || _DARWIN_C_SOURCE */
458char *getlogin(void);
459pid_t getpgrp(void);
460pid_t getpid(void);
461pid_t getppid(void);
462uid_t getuid(void);
463int isatty(int);
464int link(const char *, const char *);
465off_t lseek(int, off_t, int);
466long pathconf(const char *, int);
467
468int pause(void) __DARWIN_ALIAS_C(pause);
469
470int pipe(int [2]);
471
472ssize_t read(int, void *, size_t) __DARWIN_ALIAS_C(read);
473
474int rmdir(const char *);
475int setgid(gid_t);
476int setpgid(pid_t, pid_t);
477pid_t setsid(void);
478int setuid(uid_t);
479
480unsigned int
481 sleep(unsigned int) __DARWIN_ALIAS_C(sleep);
482
483long sysconf(int);
484pid_t tcgetpgrp(int);
485int tcsetpgrp(int, pid_t);
486char *ttyname(int);
487
488#if __DARWIN_UNIX03
489int ttyname_r(int, char *, size_t) __DARWIN_ALIAS(ttyname_r);
490#else /* !__DARWIN_UNIX03 */
491char *ttyname_r(int, char *, size_t);
492#endif /* __DARWIN_UNIX03 */
493
494int unlink(const char *);
495
496ssize_t write(int __fd, const void * __buf, size_t __nbyte) __DARWIN_ALIAS_C(write);
497__END_DECLS
498
499
500
501/* Additional functionality provided by:
502 * POSIX.2-1992 C Language Binding Option
503 */
504
505#if __DARWIN_C_LEVEL >= 199209L
506__BEGIN_DECLS
507size_t confstr(int, char *, size_t) __DARWIN_ALIAS(confstr);
508
509int getopt(int, char * const [], const char *) __DARWIN_ALIAS(getopt);
510
511extern char *optarg; /* getopt(3) external variables */
512extern int optind, opterr, optopt;
513__END_DECLS
514#endif /* __DARWIN_C_LEVEL >= 199209L */
515
516
517
518/* Additional functionality provided by:
519 * POSIX.1c-1995,
520 * POSIX.1i-1995,
521 * and the omnibus ISO/IEC 9945-1: 1996
522 */
523
524#if __DARWIN_C_LEVEL >= 199506L
525#include <_ctermid.h>
526 /* These F_* are really XSI or Issue 6 */
527#define F_ULOCK 0 /* unlock locked section */
528#define F_LOCK 1 /* lock a section for exclusive use */
529#define F_TLOCK 2 /* test and lock a section for exclusive use */
530#define F_TEST 3 /* test a section for locks by other procs */
531
532 __BEGIN_DECLS
533
534/* Begin XSI */
535/* Removed in Issue 6 */
536#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
537#if !defined(_POSIX_C_SOURCE)
538__deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED
539#endif
540void *brk(const void *);
541int chroot(const char *) __POSIX_C_DEPRECATED(199506L);
542#endif
543
544char *crypt(const char *, const char *);
545#if __DARWIN_UNIX03
546void encrypt(char *, int) __DARWIN_ALIAS(encrypt);
547#else /* !__DARWIN_UNIX03 */
548int encrypt(char *, int);
549#endif /* __DARWIN_UNIX03 */
550int fchdir(int);
551long gethostid(void);
552pid_t getpgid(pid_t);
553pid_t getsid(pid_t);
554
555/* Removed in Issue 6 */
556#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
557int getdtablesize(void) __POSIX_C_DEPRECATED(199506L);
558int getpagesize(void) __pure2 __POSIX_C_DEPRECATED(199506L);
559char *getpass(const char *) __POSIX_C_DEPRECATED(199506L);
560#endif
561
562/* Removed in Issue 7 */
563#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200809L
564char *getwd(char *) __POSIX_C_DEPRECATED(200112L); /* obsoleted by getcwd() */
565#endif
566
567int lchown(const char *, uid_t, gid_t) __DARWIN_ALIAS(lchown);
568
569int lockf(int, int, off_t) __DARWIN_ALIAS_C(lockf);
570
571int nice(int) __DARWIN_ALIAS(nice);
572
573ssize_t pread(int __fd, void * __buf, size_t __nbyte, off_t __offset) __DARWIN_ALIAS_C(pread);
574
575ssize_t pwrite(int __fd, const void * __buf, size_t __nbyte, off_t __offset) __DARWIN_ALIAS_C(pwrite);
576
577/* Removed in Issue 6 */
578#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
579/* Note that Issue 5 changed the argument as intprt_t,
580 * but we keep it as int for binary compatability. */
581#if !defined(_POSIX_C_SOURCE)
582__deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED
583#endif
584void *sbrk(int);
585#endif
586
587#if __DARWIN_UNIX03
588pid_t setpgrp(void) __DARWIN_ALIAS(setpgrp);
589#else /* !__DARWIN_UNIX03 */
590int setpgrp(pid_t pid, pid_t pgrp); /* obsoleted by setpgid() */
591#endif /* __DARWIN_UNIX03 */
592
593int setregid(gid_t, gid_t) __DARWIN_ALIAS(setregid);
594
595int setreuid(uid_t, uid_t) __DARWIN_ALIAS(setreuid);
596
597void swab(const void * __restrict, void * __restrict, ssize_t);
598void sync(void);
599int truncate(const char *, off_t);
600useconds_t ualarm(useconds_t, useconds_t);
601int usleep(useconds_t) __DARWIN_ALIAS_C(usleep);
602pid_t vfork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
603/* End XSI */
604
605int fsync(int) __DARWIN_ALIAS_C(fsync);
606
607int ftruncate(int, off_t);
608int getlogin_r(char *, size_t);
609__END_DECLS
610#endif /* __DARWIN_C_LEVEL >= 199506L */
611
612
613
614/* Additional functionality provided by:
615 * POSIX.1-2001
616 * ISO C99
617 */
618
619#if __DARWIN_C_LEVEL >= 200112L
620__BEGIN_DECLS
621int fchown(int, uid_t, gid_t);
622int gethostname(char *, size_t);
623ssize_t readlink(const char * __restrict, char * __restrict, size_t);
624int setegid(gid_t);
625int seteuid(uid_t);
626int symlink(const char *, const char *);
627__END_DECLS
628#endif /* __DARWIN_C_LEVEL >= 200112L */
629
630
631
632/* Darwin extensions */
633
634#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
635#include <sys/select.h>
636
637#include <sys/_types/_dev_t.h>
638#include <sys/_types/_mode_t.h>
639#include <sys/_types/_uuid_t.h>
640
641__BEGIN_DECLS
642void _Exit(int) __dead2;
643int accessx_np(const struct accessx_descriptor *, size_t, int *, uid_t);
644int acct(const char *);
645int add_profil(char *, size_t, unsigned long, unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
646void endusershell(void);
647int execvP(const char * __file, const char * __searchpath, char * const * __argv) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
648char *fflagstostr(unsigned long);
649int getdomainname(char *, int);
650int getgrouplist(const char *, int, int *, int *);
651#if defined(__has_include)
652#if __has_include(<gethostuuid_private.h>)
653#include <gethostuuid_private.h>
654#else
655#include <gethostuuid.h>
656#endif
657#else
658#include <gethostuuid.h>
659#endif
660mode_t getmode(const void *, mode_t);
661int getpeereid(int, uid_t *, gid_t *);
662int getsgroups_np(int *, uuid_t);
663char *getusershell(void);
664int getwgroups_np(int *, uuid_t);
665int initgroups(const char *, int);
666int issetugid(void);
667char *mkdtemp(char *);
668int mknod(const char *, mode_t, dev_t);
669int mkpath_np(const char *path, mode_t omode) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); /* returns errno */
670int mkpathat_np(int dfd, const char *path, mode_t omode) /* returns errno */
671 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
672 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
673int mkstemp(char *);
674int mkstemps(char *, int);
675char *mktemp(char *);
676int mkostemp(char *path, int oflags)
677 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
678 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
679int mkostemps(char *path, int slen, int oflags)
680 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
681 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
682/* Non-portable mkstemp that uses open_dprotected_np */
683int mkstemp_dprotected_np(char *path, int dpclass, int dpflags)
684 __OSX_UNAVAILABLE __IOS_AVAILABLE(10.0)
685 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
686char *mkdtempat_np(int dfd, char *path)
687 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0)
688 __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
689int mkstempsat_np(int dfd, char *path, int slen)
690 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0)
691 __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
692int mkostempsat_np(int dfd, char *path, int slen, int oflags)
693 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0)
694 __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
695int nfssvc(int, void *);
696int profil(char *, size_t, unsigned long, unsigned int);
697
698__deprecated_msg("Use of per-thread security contexts is error-prone and discouraged.")
699int pthread_setugid_np(uid_t, gid_t);
700int pthread_getugid_np( uid_t *, gid_t *);
701
702int reboot(int);
703int revoke(const char *);
704
705__deprecated int rcmd(char **, int, const char *, const char *, const char *, int *);
706__deprecated int rcmd_af(char **, int, const char *, const char *, const char *, int *,
707 int);
708__deprecated int rresvport(int *);
709__deprecated int rresvport_af(int *, int);
710__deprecated int iruserok(unsigned long, int, const char *, const char *);
711__deprecated int iruserok_sa(const void *, int, int, const char *, const char *);
712__deprecated int ruserok(const char *, int, const char *, const char *);
713
714int setdomainname(const char *, int);
715int setgroups(int, const gid_t *);
716void sethostid(long);
717int sethostname(const char *, int);
718#if __DARWIN_UNIX03
719void setkey(const char *) __DARWIN_ALIAS(setkey);
720#else /* !__DARWIN_UNIX03 */
721int setkey(const char *);
722#endif /* __DARWIN_UNIX03 */
723int setlogin(const char *);
724void *setmode(const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(setmode));
725int setrgid(gid_t);
726int setruid(uid_t);
727int setsgroups_np(int, const uuid_t);
728void setusershell(void);
729int setwgroups_np(int, const uuid_t);
730int strtofflags(char **, unsigned long *, unsigned long *);
731int swapon(const char *);
732int ttyslot(void);
733int undelete(const char *);
734int unwhiteout(const char *);
735void *valloc(size_t);
736
737__WATCHOS_PROHIBITED __TVOS_PROHIBITED
738__OS_AVAILABILITY_MSG(ios,deprecated=10.0,"syscall(2) is unsupported; "
739 "please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost().")
740__OS_AVAILABILITY_MSG(macosx,deprecated=10.12,"syscall(2) is unsupported; "
741 "please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost().")
742int syscall(int, ...);
743
744extern char *suboptarg; /* getsubopt(3) external variable */
745int getsubopt(char **, char * const *, char **);
746
747/* HFS & HFS Plus semantics system calls go here */
748#ifdef __LP64__
749int fgetattrlist(int,void*,void*,size_t,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
750int fsetattrlist(int,void*,void*,size_t,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
751int getattrlist(const char*,void*,void*,size_t,unsigned int) __DARWIN_ALIAS(getattrlist);
752int setattrlist(const char*,void*,void*,size_t,unsigned int) __DARWIN_ALIAS(setattrlist);
753int exchangedata(const char*,const char*,unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
754int getdirentriesattr(int,void*,void*,size_t,unsigned int*,unsigned int*,unsigned int*,unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
755
756#else /* __LP64__ */
757int fgetattrlist(int,void*,void*,size_t,unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
758int fsetattrlist(int,void*,void*,size_t,unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
759int getattrlist(const char*,void*,void*,size_t,unsigned long) __DARWIN_ALIAS(getattrlist);
760int setattrlist(const char*,void*,void*,size_t,unsigned long) __DARWIN_ALIAS(setattrlist);
761int exchangedata(const char*,const char*,unsigned long)
762 __OSX_DEPRECATED(10.0, 10.13, "use renamex_np with the RENAME_SWAP flag")
763 __IOS_DEPRECATED(2.0, 11.0, "use renamex_np with the RENAME_SWAP flag")
764 __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
765int getdirentriesattr(int,void*,void*,size_t,unsigned long*,unsigned long*,unsigned long*,unsigned long) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
766
767#endif /* __LP64__ */
768
769struct fssearchblock;
770struct searchstate;
771
772int searchfs(const char *, struct fssearchblock *, unsigned long *, unsigned int, unsigned int, struct searchstate *) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
773int fsctl(const char *,unsigned long,void*,unsigned int);
774int ffsctl(int,unsigned long,void*,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
775
776#define SYNC_VOLUME_FULLSYNC 0x01 /* Flush data and metadata to platter, not just to disk cache */
777#define SYNC_VOLUME_WAIT 0x02 /* Wait for sync to complete */
778
779int fsync_volume_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
780int sync_volume_np(const char *, int) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
781
782extern int optreset;
783
784__END_DECLS
785#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
786
787#endif /* _UNISTD_H_ */
lib/libc/include/x86_64-macos-gnu/utime.h created+75
......@@ -0,0 +1,75 @@
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*-
24 * Copyright (c) 1990, 1993
25 * The Regents of the University of California. All rights reserved.
26 *
27 * Redistribution and use in source and binary forms, with or without
28 * modification, are permitted provided that the following conditions
29 * are met:
30 * 1. Redistributions of source code must retain the above copyright
31 * notice, this list of conditions and the following disclaimer.
32 * 2. Redistributions in binary form must reproduce the above copyright
33 * notice, this list of conditions and the following disclaimer in the
34 * documentation and/or other materials provided with the distribution.
35 * 3. All advertising materials mentioning features or use of this software
36 * must display the following acknowledgement:
37 * This product includes software developed by the University of
38 * California, Berkeley and its contributors.
39 * 4. Neither the name of the University nor the names of its contributors
40 * may be used to endorse or promote products derived from this software
41 * without specific prior written permission.
42 *
43 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
44 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
46 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
47 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53 * SUCH DAMAGE.
54 *
55 * @(#)utime.h 8.1 (Berkeley) 6/2/93
56 */
57
58#ifndef _UTIME_H_
59#define _UTIME_H_
60
61#include <_types.h>
62#include <sys/_types/_time_t.h>
63
64struct utimbuf {
65 time_t actime; /* Access time */
66 time_t modtime; /* Modification time */
67};
68
69#include <sys/cdefs.h>
70
71__BEGIN_DECLS
72int utime(const char *, const struct utimbuf *);
73__END_DECLS
74
75#endif /* !_UTIME_H_ */
lib/libc/include/x86_64-macos-gnu/utmpx.h created+176
......@@ -0,0 +1,176 @@
1/*
2 * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/* $NetBSD: utmpx.h,v 1.11 2003/08/26 16:48:32 wiz Exp $ */
24
25/*-
26 * Copyright (c) 2002 The NetBSD Foundation, Inc.
27 * All rights reserved.
28 *
29 * This code is derived from software contributed to The NetBSD Foundation
30 * by Christos Zoulas.
31 *
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
34 * are met:
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.
40 * 3. All advertising materials mentioning features or use of this software
41 * must display the following acknowledgement:
42 * This product includes software developed by the NetBSD
43 * Foundation, Inc. and its contributors.
44 * 4. Neither the name of The NetBSD Foundation nor the names of its
45 * contributors may be used to endorse or promote products derived
46 * from this software without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
49 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
50 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
51 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
52 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
53 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
54 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
55 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
56 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
57 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
58 * POSSIBILITY OF SUCH DAMAGE.
59 */
60#ifndef _UTMPX_H_
61#define _UTMPX_H_
62
63#include <_types.h>
64#include <sys/time.h>
65#include <sys/cdefs.h>
66#include <Availability.h>
67#include <sys/_types/_pid_t.h>
68
69#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
70#include <sys/_types/_uid_t.h>
71#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
72
73#define _PATH_UTMPX "/var/run/utmpx"
74
75#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
76#define UTMPX_FILE _PATH_UTMPX
77#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
78
79#define _UTX_USERSIZE 256 /* matches MAXLOGNAME */
80#define _UTX_LINESIZE 32
81#define _UTX_IDSIZE 4
82#define _UTX_HOSTSIZE 256
83
84#define EMPTY 0
85#define RUN_LVL 1
86#define BOOT_TIME 2
87#define OLD_TIME 3
88#define NEW_TIME 4
89#define INIT_PROCESS 5
90#define LOGIN_PROCESS 6
91#define USER_PROCESS 7
92#define DEAD_PROCESS 8
93
94#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
95#define ACCOUNTING 9
96#define SIGNATURE 10
97#define SHUTDOWN_TIME 11
98
99#define UTMPX_AUTOFILL_MASK 0x8000
100#define UTMPX_DEAD_IF_CORRESPONDING_MASK 0x4000
101
102/* notify(3) change notification name */
103#define UTMPX_CHANGE_NOTIFICATION "com.apple.system.utmpx"
104#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
105
106/*
107 * The following structure describes the fields of the utmpx entries
108 * stored in _PATH_UTMPX. This is not the format the
109 * entries are stored in the files, and application should only access
110 * entries using routines described in getutxent(3).
111 */
112
113#ifdef _UTMPX_COMPAT
114#define ut_user ut_name
115#define ut_xtime ut_tv.tv_sec
116#endif /* _UTMPX_COMPAT */
117
118struct utmpx {
119 char ut_user[_UTX_USERSIZE]; /* login name */
120 char ut_id[_UTX_IDSIZE]; /* id */
121 char ut_line[_UTX_LINESIZE]; /* tty name */
122 pid_t ut_pid; /* process id creating the entry */
123 short ut_type; /* type of this entry */
124 struct timeval ut_tv; /* time entry was created */
125 char ut_host[_UTX_HOSTSIZE]; /* host name */
126 __uint32_t ut_pad[16]; /* reserved for future use */
127};
128
129#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
130struct lastlogx {
131 struct timeval ll_tv; /* time entry was created */
132 char ll_line[_UTX_LINESIZE]; /* tty name */
133 char ll_host[_UTX_HOSTSIZE]; /* host name */
134};
135#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
136
137__BEGIN_DECLS
138
139void endutxent(void);
140
141#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
142void endutxent_wtmp(void) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
143struct lastlogx *
144 getlastlogx(uid_t, struct lastlogx *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
145struct lastlogx *
146 getlastlogxbyname(const char*, struct lastlogx *)__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
147struct utmp; /* forward reference */
148void getutmp(const struct utmpx *, struct utmp *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_9, __IPHONE_2_0, __IPHONE_7_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
149void getutmpx(const struct utmp *, struct utmpx *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_9, __IPHONE_2_0, __IPHONE_7_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
150#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
151
152struct utmpx *
153 getutxent(void);
154
155#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
156struct utmpx *
157 getutxent_wtmp(void) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
158#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
159
160struct utmpx *
161 getutxid(const struct utmpx *);
162struct utmpx *
163 getutxline(const struct utmpx *);
164struct utmpx *
165 pututxline(const struct utmpx *);
166void setutxent(void);
167
168#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
169void setutxent_wtmp(int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
170int utmpxname(const char *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
171int wtmpxname(const char *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
172#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
173
174__END_DECLS
175
176#endif /* !_UTMPX_H_ */
lib/libc/include/x86_64-macos-gnu/uuid/uuid.h created+79
......@@ -0,0 +1,79 @@
1/*
2 * Public include file for the UUID library
3 *
4 * Copyright (C) 1996, 1997, 1998 Theodore Ts'o.
5 *
6 * %Begin-Header%
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, and the entire permission notice in its entirety,
12 * including the disclaimer of warranties.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote
17 * products derived from this software without specific prior
18 * written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
21 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
23 * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
27 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
30 * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
31 * DAMAGE.
32 * %End-Header%
33 */
34
35#ifndef _UUID_UUID_H
36#define _UUID_UUID_H
37
38#include <sys/_types.h>
39#include <sys/_types/_uuid_t.h>
40
41#ifndef _UUID_STRING_T
42#define _UUID_STRING_T
43typedef __darwin_uuid_string_t uuid_string_t;
44#endif /* _UUID_STRING_T */
45
46#define UUID_DEFINE(name, u0, u1, u2, u3, u4, u5, u6, u7, u8, u9, u10, u11, u12, u13, u14, u15) \
47 static const uuid_t name __attribute__ ((unused)) = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}
48
49UUID_DEFINE(UUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
50
51#ifdef __cplusplus
52extern "C" {
53#endif
54
55void uuid_clear(uuid_t uu);
56
57int uuid_compare(const uuid_t uu1, const uuid_t uu2);
58
59void uuid_copy(uuid_t dst, const uuid_t src);
60
61void uuid_generate(uuid_t out);
62void uuid_generate_random(uuid_t out);
63void uuid_generate_time(uuid_t out);
64
65void uuid_generate_early_random(uuid_t out);
66
67int uuid_is_null(const uuid_t uu);
68
69int uuid_parse(const uuid_string_t in, uuid_t uu);
70
71void uuid_unparse(const uuid_t uu, uuid_string_t out);
72void uuid_unparse_lower(const uuid_t uu, uuid_string_t out);
73void uuid_unparse_upper(const uuid_t uu, uuid_string_t out);
74
75#ifdef __cplusplus
76}
77#endif
78
79#endif /* _UUID_UUID_H */
lib/libc/include/x86_64-macos-gnu/wordexp.h created+85
......@@ -0,0 +1,85 @@
1/*
2 * Copyright 1994, University Corporation for Atmospheric Research
3 * See ../COPYRIGHT file for copying and redistribution conditions.
4 */
5/*
6 * Reproduction of ../COPYRIGHT file:
7 *
8 *********************************************************************
9
10Copyright 1995-2002 University Corporation for Atmospheric Research/Unidata
11
12Portions of this software were developed by the Unidata Program at the
13University Corporation for Atmospheric Research.
14
15Access and use of this software shall impose the following obligations
16and understandings on the user. The user is granted the right, without
17any fee or cost, to use, copy, modify, alter, enhance and distribute
18this software, and any derivative works thereof, and its supporting
19documentation for any purpose whatsoever, provided that this entire
20notice appears in all copies of the software, derivative works and
21supporting documentation. Further, UCAR requests that the user credit
22UCAR/Unidata in any publications that result from the use of this
23software or in any product that includes this software. The names UCAR
24and/or Unidata, however, may not be used in any advertising or publicity
25to endorse or promote any products or commercial entity unless specific
26written permission is obtained from UCAR/Unidata. The user also
27understands that UCAR/Unidata is not obligated to provide the user with
28any support, consulting, training or assistance of any kind with regard
29to the use, operation and performance of this software nor to provide
30the user with any updates, revisions, new versions or "bug fixes."
31
32THIS SOFTWARE IS PROVIDED BY UCAR/UNIDATA "AS IS" AND ANY EXPRESS OR
33IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
35DISCLAIMED. IN NO EVENT SHALL UCAR/UNIDATA BE LIABLE FOR ANY SPECIAL,
36INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
37FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
38NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
39WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.
40
41 *********************************************************************
42 *
43 */
44
45/* $Id: wordexp.h,v 1.5 1994/05/12 20:46:40 davis Exp $ */
46#ifndef _WORDEXP_H
47#define _WORDEXP_H
48
49#include <sys/cdefs.h>
50#include <_types.h>
51#include <sys/_types/_size_t.h>
52#include <Availability.h>
53
54typedef struct {
55 size_t we_wordc;
56 char **we_wordv;
57 size_t we_offs;
58} wordexp_t;
59
60/* wordexp() flags Argument */
61#define WRDE_APPEND 0x01
62#define WRDE_DOOFFS 0x02
63#define WRDE_NOCMD 0x04
64#define WRDE_REUSE 0x08
65#define WRDE_SHOWERR 0x10
66#define WRDE_UNDEF 0x20
67
68/*
69 * wordexp() Return Values
70 */
71/* required */
72#define WRDE_BADCHAR 1
73#define WRDE_BADVAL 2
74#define WRDE_CMDSUB 3
75#define WRDE_NOSPACE 4
76#define WRDE_NOSYS 5
77#define WRDE_SYNTAX 6
78
79
80__BEGIN_DECLS
81int wordexp(const char * __restrict, wordexp_t * __restrict, int) __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA);
82void wordfree(wordexp_t *) __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA);
83__END_DECLS
84
85#endif /* _WORDEXP_H */