From e07eda1a0324f771bb1ed20ef94f3229005ee46c Mon Sep 17 00:00:00 2001 From: Apple Date: Wed, 15 Aug 2018 19:39:34 +0000 Subject: [PATCH] Libc-1244.50.9.tar.gz --- .upstream_base_commits | 1 + gen/FreeBSD/ttyname.3 | 5 +- gen/directory.3 | 4 +- include/__wctype.h | 74 ++++++ include/_ctype.h | 452 ++++++++++++++++++++++++++++++++++++ include/_regex.h | 121 ++++++++++ include/_stdio.h | 159 +++++++++++++ include/_wctype.h | 17 +- include/_xlocale.h | 3 + include/ctype.h | 379 +----------------------------- include/regex.h | 25 +- include/stdio.h | 91 +------- include/stdlib.h | 5 + include/xlocale.h | 3 - include/xlocale/__wctype.h | 3 + include/xlocale/_ctype.h | 3 + include/xlocale/_inttypes.h | 4 + include/xlocale/_langinfo.h | 4 + include/xlocale/_monetary.h | 6 + include/xlocale/_regex.h | 5 + include/xlocale/_stdio.h | 3 + include/xlocale/_stdlib.h | 5 + include/xlocale/_string.h | 4 + include/xlocale/_time.h | 5 + include/xlocale/_wchar.h | 3 + include/xlocale/_wctype.h | 4 + man/manpages.lst | 2 +- stdio/FreeBSD/vfprintf.c | 4 +- stdlib/grantpt.3 | 46 +++- stdlib/grantpt.c | 79 +++++-- tests/nxheap.c | 4 +- util/pty.c | 4 +- xcodescripts/headers.sh | 4 + xcodescripts/libc.xcconfig | 5 +- 34 files changed, 995 insertions(+), 541 deletions(-) create mode 100644 include/__wctype.h create mode 100644 include/_ctype.h create mode 100644 include/_regex.h create mode 100644 include/_stdio.h diff --git a/.upstream_base_commits b/.upstream_base_commits index efee8b9..d6b36ba 100644 --- a/.upstream_base_commits +++ b/.upstream_base_commits @@ -14,6 +14,7 @@ gen/FreeBSD/raise3 freebsd lib/libc/gen/raise.3 6b42c90c1ff5f7c35431eced41b62134 gen/FreeBSD/readpassphrase.c freebsd lib/libc/gen/readpassphrase.c 1f19a8fc755a14865a5a5b67d5fa895c4b7cf622 gen/FreeBSD/readpassphrase.3 freebsd lib/libc/gen/readpassphrase.3 e0a2d4f15ed9e93fcb62544ed65f7a98e2339c3b gen/FreeBSD/times.3 freebsd lib/libc/gen/times.3 5b882020081a138285227631c46a406c08e17bc8 +gen/FreeBSD/ttyname.3 freebsd lib/libc/gen/ttyname.3 84be924362c6e5f469564d418c928c5b1b4a2457 gen/FreeBSD/ttyslot.c freebsd lib/libc/gen/ttyslot.c 898928e8d0a0bab201c1ef232e01cafa27322dae gen/FreeBSD/unvis.c freebsd contrib/libc-vis/unvis.c 9e3e4b88576d01efe1f56469cac79e116bb62c67 gen/FreeBSD/unvis.3 freebsd contrib/libc-vis/unvis.3 9e3e4b88576d01efe1f56469cac79e116bb62c67 diff --git a/gen/FreeBSD/ttyname.3 b/gen/FreeBSD/ttyname.3 index 0d023a8..05a20b6 100644 --- a/gen/FreeBSD/ttyname.3 +++ b/gen/FreeBSD/ttyname.3 @@ -9,7 +9,7 @@ .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. -.\" 4. Neither the name of the University nor the names of its contributors +.\" 3. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" @@ -122,6 +122,9 @@ is smaller than the length of the string to be returned. .El .Sh SEE ALSO .Xr ioctl 2 , +.Xr ptsname 3 , +.Xr tcgetattr 3 , +.Xr tty 4 , .Xr ttys 5 .Sh HISTORY The diff --git a/gen/directory.3 b/gen/directory.3 index b94998b..712617d 100644 --- a/gen/directory.3 +++ b/gen/directory.3 @@ -129,7 +129,9 @@ In the event of an error, .Va errno may be set to any of the values documented for the .Xr getdirentries 2 -system call. +system call. Note that the order of the directory entries vended by +.Fn readdir +is not specified. Some filesystems may return entries in lexicographic sort order and others may not. .Pp The .Fn readdir_r diff --git a/include/__wctype.h b/include/__wctype.h new file mode 100644 index 0000000..3b4eb2c --- /dev/null +++ b/include/__wctype.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2017 Apple Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/*- + * Copyright (c)1999 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +/* + * Common header for _wctype.h and xlocale/__wctype.h + */ + +#ifndef ___WCTYPE_H_ +#define ___WCTYPE_H_ + +#include +#include <_types.h> + +#include +#include +#include <_types/_wctype_t.h> + +#ifndef WEOF +#define WEOF __DARWIN_WEOF +#endif + +#ifndef __DARWIN_WCTYPE_TOP_inline +#define __DARWIN_WCTYPE_TOP_inline __header_inline +#endif + +#include + +#endif /* ___WCTYPE_H_ */ diff --git a/include/_ctype.h b/include/_ctype.h new file mode 100644 index 0000000..ba38603 --- /dev/null +++ b/include/_ctype.h @@ -0,0 +1,452 @@ +/* + * Copyright (c) 2000, 2005, 2008 Apple Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * This code is derived from software contributed to Berkeley by + * Paul Borman at Krystal Technologies. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ctype.h 8.4 (Berkeley) 1/21/94 + */ + +//Begin-Libc +#include "xlocale_private.h" +//End-Libc +#ifndef __CTYPE_H_ +#define __CTYPE_H_ + +#include +#include + +#define _CTYPE_A 0x00000100L /* Alpha */ +#define _CTYPE_C 0x00000200L /* Control */ +#define _CTYPE_D 0x00000400L /* Digit */ +#define _CTYPE_G 0x00000800L /* Graph */ +#define _CTYPE_L 0x00001000L /* Lower */ +#define _CTYPE_P 0x00002000L /* Punct */ +#define _CTYPE_S 0x00004000L /* Space */ +#define _CTYPE_U 0x00008000L /* Upper */ +#define _CTYPE_X 0x00010000L /* X digit */ +#define _CTYPE_B 0x00020000L /* Blank */ +#define _CTYPE_R 0x00040000L /* Print */ +#define _CTYPE_I 0x00080000L /* Ideogram */ +#define _CTYPE_T 0x00100000L /* Special */ +#define _CTYPE_Q 0x00200000L /* Phonogram */ +#define _CTYPE_SW0 0x20000000L /* 0 width character */ +#define _CTYPE_SW1 0x40000000L /* 1 width character */ +#define _CTYPE_SW2 0x80000000L /* 2 width character */ +#define _CTYPE_SW3 0xc0000000L /* 3 width character */ +#define _CTYPE_SWM 0xe0000000L /* Mask for screen width data */ +#define _CTYPE_SWS 30 /* Bits to shift to get width */ + +#ifdef _NONSTD_SOURCE +/* + * Backward compatibility + */ +#define _A _CTYPE_A /* Alpha */ +#define _C _CTYPE_C /* Control */ +#define _D _CTYPE_D /* Digit */ +#define _G _CTYPE_G /* Graph */ +#define _L _CTYPE_L /* Lower */ +#define _P _CTYPE_P /* Punct */ +#define _S _CTYPE_S /* Space */ +#define _U _CTYPE_U /* Upper */ +#define _X _CTYPE_X /* X digit */ +#define _B _CTYPE_B /* Blank */ +#define _R _CTYPE_R /* Print */ +#define _I _CTYPE_I /* Ideogram */ +#define _T _CTYPE_T /* Special */ +#define _Q _CTYPE_Q /* Phonogram */ +#define _SW0 _CTYPE_SW0 /* 0 width character */ +#define _SW1 _CTYPE_SW1 /* 1 width character */ +#define _SW2 _CTYPE_SW2 /* 2 width character */ +#define _SW3 _CTYPE_SW3 /* 3 width character */ +#endif /* _NONSTD_SOURCE */ + +//Begin-Libc +/* + * _EXTERNALIZE_CTYPE_INLINES_ is defined in locale/nomacros.c to tell us + * to generate code for extern versions of all intermediate inline functions. + */ +#ifdef _EXTERNALIZE_CTYPE_INLINES_ +#define _USE_CTYPE_INLINE_ +#define __DARWIN_CTYPE_inline +#else /* !_EXTERNALIZE_CTYPE_INLINES_ */ +//End-Libc +#define __DARWIN_CTYPE_inline __header_inline +//Begin-Libc +#endif /* !_EXTERNALIZE_CTYPE_INLINES_ */ +//End-Libc + +//Begin-Libc +/* + * _EXTERNALIZE_CTYPE_INLINES_TOP_ is defined in locale/isctype.c to tell us + * to generate code for extern versions of all top-level inline functions. + */ +#ifdef _EXTERNALIZE_CTYPE_INLINES_TOP_ +#define _USE_CTYPE_INLINE_ +#define __DARWIN_CTYPE_TOP_inline +#else /* !_EXTERNALIZE_CTYPE_INLINES_TOP_ */ +//End-Libc +#define __DARWIN_CTYPE_TOP_inline __header_inline +//Begin-Libc +#endif /* _EXTERNALIZE_CTYPE_INLINES_TOP_ */ +//End-Libc + +/* + * Use inline functions if we are allowed to and the compiler supports them. + */ +#if !defined(_DONT_USE_CTYPE_INLINE_) && \ + (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus)) + +/* See comments in about __darwin_ct_rune_t. */ +__BEGIN_DECLS +unsigned long ___runetype(__darwin_ct_rune_t); +__darwin_ct_rune_t ___tolower(__darwin_ct_rune_t); +__darwin_ct_rune_t ___toupper(__darwin_ct_rune_t); +__END_DECLS + +__DARWIN_CTYPE_TOP_inline int +isascii(int _c) +{ + return ((_c & ~0x7F) == 0); +} + +#ifdef USE_ASCII +__DARWIN_CTYPE_inline int +__maskrune(__darwin_ct_rune_t _c, unsigned long _f) +{ + return (int)_DefaultRuneLocale.__runetype[_c & 0xff] & (__uint32_t)_f; +} +//Begin-Libc +#elif defined(__LIBC__) +__DARWIN_CTYPE_inline int +__maskrune(__darwin_ct_rune_t _c, unsigned long _f) +{ + /* _CurrentRuneLocale.__runetype[_c] is __uint32_t + * _f is unsigned long + * ___runetype(_c) is unsigned long + * retval is int + */ + return (int)((_c < 0 || _c >= _CACHED_RUNES) ? (__uint32_t)___runetype(_c) : + __current_locale()->__lc_ctype->_CurrentRuneLocale.__runetype[_c]) & (__uint32_t)_f; +} +//End-Libc +#else /* !USE_ASCII */ +__BEGIN_DECLS +int __maskrune(__darwin_ct_rune_t, unsigned long); +__END_DECLS +#endif /* USE_ASCII */ + +__DARWIN_CTYPE_inline int +__istype(__darwin_ct_rune_t _c, unsigned long _f) +{ +#ifdef USE_ASCII + return !!(__maskrune(_c, _f)); +#else /* USE_ASCII */ + return (isascii(_c) ? !!(_DefaultRuneLocale.__runetype[_c] & _f) + : !!__maskrune(_c, _f)); +#endif /* USE_ASCII */ +} + +__DARWIN_CTYPE_inline __darwin_ct_rune_t +__isctype(__darwin_ct_rune_t _c, unsigned long _f) +{ +#ifdef USE_ASCII + return !!(__maskrune(_c, _f)); +#else /* USE_ASCII */ + return (_c < 0 || _c >= _CACHED_RUNES) ? 0 : + !!(_DefaultRuneLocale.__runetype[_c] & _f); +#endif /* USE_ASCII */ +} + +#ifdef USE_ASCII +__DARWIN_CTYPE_inline __darwin_ct_rune_t +__toupper(__darwin_ct_rune_t _c) +{ + return _DefaultRuneLocale.__mapupper[_c & 0xff]; +} + +__DARWIN_CTYPE_inline __darwin_ct_rune_t +__tolower(__darwin_ct_rune_t _c) +{ + return _DefaultRuneLocale.__maplower[_c & 0xff]; +} +//Begin-Libc +#elif defined(__LIBC__) +/* + * We can't do what we do for __toupper_l() (check for ASCII first, then call + * ___toupper_l() otherwise) because versions of ___toupper() before Tiger + * assume c >= _CACHED_RUNES. So we are stuck making __toupper() a routine + * to hide the extended locale details, outside of Libc. + */ +__DARWIN_CTYPE_inline __darwin_ct_rune_t +__toupper(__darwin_ct_rune_t _c) +{ + return (_c < 0 || _c >= _CACHED_RUNES) ? ___toupper(_c) : + __current_locale()->__lc_ctype->_CurrentRuneLocale.__mapupper[_c]; +} + +__DARWIN_CTYPE_inline __darwin_ct_rune_t +__tolower(__darwin_ct_rune_t _c) +{ + return (_c < 0 || _c >= _CACHED_RUNES) ? ___tolower(_c) : + __current_locale()->__lc_ctype->_CurrentRuneLocale.__maplower[_c]; +} +//End-Libc +#else /* !USE_ASCII */ +__BEGIN_DECLS +__darwin_ct_rune_t __toupper(__darwin_ct_rune_t); +__darwin_ct_rune_t __tolower(__darwin_ct_rune_t); +__END_DECLS +#endif /* USE_ASCII */ + +__DARWIN_CTYPE_inline int +__wcwidth(__darwin_ct_rune_t _c) +{ + unsigned int _x; + + if (_c == 0) + return (0); + _x = (unsigned int)__maskrune(_c, _CTYPE_SWM|_CTYPE_R); + if ((_x & _CTYPE_SWM) != 0) + return ((_x & _CTYPE_SWM) >> _CTYPE_SWS); + return ((_x & _CTYPE_R) != 0 ? 1 : -1); +} + +#ifndef _EXTERNALIZE_CTYPE_INLINES_ + +#define _tolower(c) __tolower(c) +#define _toupper(c) __toupper(c) + +__DARWIN_CTYPE_TOP_inline int +isalnum(int _c) +{ + return (__istype(_c, _CTYPE_A|_CTYPE_D)); +} + +__DARWIN_CTYPE_TOP_inline int +isalpha(int _c) +{ + return (__istype(_c, _CTYPE_A)); +} + +__DARWIN_CTYPE_TOP_inline int +isblank(int _c) +{ + return (__istype(_c, _CTYPE_B)); +} + +__DARWIN_CTYPE_TOP_inline int +iscntrl(int _c) +{ + return (__istype(_c, _CTYPE_C)); +} + +/* ANSI -- locale independent */ +__DARWIN_CTYPE_TOP_inline int +isdigit(int _c) +{ + return (__isctype(_c, _CTYPE_D)); +} + +__DARWIN_CTYPE_TOP_inline int +isgraph(int _c) +{ + return (__istype(_c, _CTYPE_G)); +} + +__DARWIN_CTYPE_TOP_inline int +islower(int _c) +{ + return (__istype(_c, _CTYPE_L)); +} + +__DARWIN_CTYPE_TOP_inline int +isprint(int _c) +{ + return (__istype(_c, _CTYPE_R)); +} + +__DARWIN_CTYPE_TOP_inline int +ispunct(int _c) +{ + return (__istype(_c, _CTYPE_P)); +} + +__DARWIN_CTYPE_TOP_inline int +isspace(int _c) +{ + return (__istype(_c, _CTYPE_S)); +} + +__DARWIN_CTYPE_TOP_inline int +isupper(int _c) +{ + return (__istype(_c, _CTYPE_U)); +} + +/* ANSI -- locale independent */ +__DARWIN_CTYPE_TOP_inline int +isxdigit(int _c) +{ + return (__isctype(_c, _CTYPE_X)); +} + +__DARWIN_CTYPE_TOP_inline int +toascii(int _c) +{ + return (_c & 0x7F); +} + +__DARWIN_CTYPE_TOP_inline int +tolower(int _c) +{ + return (__tolower(_c)); +} + +__DARWIN_CTYPE_TOP_inline int +toupper(int _c) +{ + return (__toupper(_c)); +} + +#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) +__DARWIN_CTYPE_TOP_inline int +digittoint(int _c) +{ + return (__maskrune(_c, 0x0F)); +} + +__DARWIN_CTYPE_TOP_inline int +ishexnumber(int _c) +{ + return (__istype(_c, _CTYPE_X)); +} + +__DARWIN_CTYPE_TOP_inline int +isideogram(int _c) +{ + return (__istype(_c, _CTYPE_I)); +} + +__DARWIN_CTYPE_TOP_inline int +isnumber(int _c) +{ + return (__istype(_c, _CTYPE_D)); +} + +__DARWIN_CTYPE_TOP_inline int +isphonogram(int _c) +{ + return (__istype(_c, _CTYPE_Q)); +} + +__DARWIN_CTYPE_TOP_inline int +isrune(int _c) +{ + return (__istype(_c, 0xFFFFFFF0L)); +} + +__DARWIN_CTYPE_TOP_inline int +isspecial(int _c) +{ + return (__istype(_c, _CTYPE_T)); +} +#endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ +#endif /* _EXTERNALIZE_CTYPE_INLINES_ */ + +#else /* not using inlines */ + +__BEGIN_DECLS +int isalnum(int); +int isalpha(int); +int isblank(int); +int iscntrl(int); +int isdigit(int); +int isgraph(int); +int islower(int); +int isprint(int); +int ispunct(int); +int isspace(int); +int isupper(int); +int isxdigit(int); +int tolower(int); +int toupper(int); +int isascii(int); +int toascii(int); + +#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) +int _tolower(int); +int _toupper(int); +int digittoint(int); +int ishexnumber(int); +int isideogram(int); +int isnumber(int); +int isphonogram(int); +int isrune(int); +int isspecial(int); +#endif +__END_DECLS + +#endif /* using inlines */ + +#ifdef _USE_EXTENDED_LOCALES_ +#include +#endif /* _USE_EXTENDED_LOCALES_ */ + +#endif /* !_CTYPE_H_ */ diff --git a/include/_regex.h b/include/_regex.h new file mode 100644 index 0000000..1fb98e3 --- /dev/null +++ b/include/_regex.h @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2000, 2011 Apple Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * Copyright (c) 2001-2009 Ville Laurikari + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*- + * Copyright (c) 1992 Henry Spencer. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Henry Spencer of the University of Toronto. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)regex.h 8.2 (Berkeley) 1/3/94 + */ + +/* + * Common header for regex.h and xlocale/_regex.h + */ + +#ifndef __REGEX_H_ +#define __REGEX_H_ + +#include <_types.h> +#include +#include + +/*********/ +/* types */ +/*********/ +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL +#include +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ + +typedef __darwin_off_t regoff_t; + +typedef struct { + int re_magic; + size_t re_nsub; /* number of parenthesized subexpressions */ + const char *re_endp; /* end pointer for REG_PEND */ + struct re_guts *re_g; /* none of your business :-) */ +} regex_t; + +typedef struct { + regoff_t rm_so; /* start of match */ + regoff_t rm_eo; /* end of match */ +} regmatch_t; + +#endif /* !__REGEX_H_ */ diff --git a/include/_stdio.h b/include/_stdio.h new file mode 100644 index 0000000..0f3ae7a --- /dev/null +++ b/include/_stdio.h @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2000, 2005, 2007, 2009, 2010 Apple Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)stdio.h 8.5 (Berkeley) 4/29/95 + */ + +/* + * Common header for stdio.h and xlocale/_stdio.h + */ + +#ifndef __STDIO_H_ +#define __STDIO_H_ + +#include +#include + +#include <_types.h> + +/* DO NOT REMOVE THIS COMMENT: fixincludes needs to see: + * __gnuc_va_list and include */ +#include +#include +#include + +#include + +typedef __darwin_off_t fpos_t; + +#define _FSTDIO /* Define for new stdio with functions. */ + +/* + * NB: to fit things in six character monocase externals, the stdio + * code uses the prefix `__s' for stdio objects, typically followed + * by a three-character attempt at a mnemonic. + */ + +/* stdio buffers */ +struct __sbuf { + unsigned char *_base; + int _size; +}; + +/* hold a buncha junk that would grow the ABI */ +struct __sFILEX; + +/* + * stdio state variables. + * + * The following always hold: + * + * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), + * _lbfsize is -_bf._size, else _lbfsize is 0 + * if _flags&__SRD, _w is 0 + * if _flags&__SWR, _r is 0 + * + * This ensures that the getc and putc macros (or inline functions) never + * try to write or read from a file that is in `read' or `write' mode. + * (Moreover, they can, and do, automatically switch from read mode to + * write mode, and back, on "r+" and "w+" files.) + * + * _lbfsize is used only to make the inline line-buffered output stream + * code as compact as possible. + * + * _ub, _up, and _ur are used when ungetc() pushes back more characters + * than fit in the current _bf, or when ungetc() pushes back a character + * that does not match the previous one in _bf. When this happens, + * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff + * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. + * + * NB: see WARNING above before changing the layout of this structure! + */ +typedef struct __sFILE { + unsigned char *_p; /* current position in (some) buffer */ + int _r; /* read space left for getc() */ + int _w; /* write space left for putc() */ + short _flags; /* flags, below; this FILE is free if 0 */ + short _file; /* fileno, if Unix descriptor, else -1 */ + struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */ + int _lbfsize; /* 0 or -_bf._size, for inline putc */ + + /* operations */ + void *_cookie; /* cookie passed to io functions */ + int (* _Nullable _close)(void *); + int (* _Nullable _read) (void *, char *, int); + fpos_t (* _Nullable _seek) (void *, fpos_t, int); + int (* _Nullable _write)(void *, const char *, int); + + /* separate buffer for long sequences of ungetc() */ + struct __sbuf _ub; /* ungetc buffer */ + struct __sFILEX *_extra; /* additions to FILE to not break ABI */ + int _ur; /* saved _r when _r is counting ungetc data */ + + /* tricks to meet minimum requirements even when malloc() fails */ + unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */ + unsigned char _nbuf[1]; /* guarantee a getc() buffer */ + + /* separate buffer for fgetln() when line crosses buffer boundary */ + struct __sbuf _lb; /* buffer for fgetln() */ + + /* Unix stdio files get aligned to block boundaries on fseek() */ + int _blksize; /* stat.st_blksize (may be != _bf._size) */ + fpos_t _offset; /* current lseek offset (see WARNING) */ +} FILE; + +#endif /* __STDIO_H_ */ diff --git a/include/_wctype.h b/include/_wctype.h index 6348779..04da796 100644 --- a/include/_wctype.h +++ b/include/_wctype.h @@ -39,22 +39,7 @@ #ifndef __WCTYPE_H_ #define __WCTYPE_H_ -#include -#include <_types.h> - -#include -#include -#include <_types/_wctype_t.h> - -#ifndef WEOF -#define WEOF __DARWIN_WEOF -#endif - -#ifndef __DARWIN_WCTYPE_TOP_inline -#define __DARWIN_WCTYPE_TOP_inline __header_inline -#endif - -#include +#include <__wctype.h> /* * Use inline functions if we are allowed to and the compiler supports them. diff --git a/include/_xlocale.h b/include/_xlocale.h index f58b052..0ba412c 100644 --- a/include/_xlocale.h +++ b/include/_xlocale.h @@ -26,6 +26,9 @@ #include +struct _xlocale; /* forward reference */ +typedef struct _xlocale * locale_t; + __BEGIN_DECLS int ___mb_cur_max(void); int ___mb_cur_max_l(locale_t); diff --git a/include/ctype.h b/include/ctype.h index 3548bcd..b893369 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -63,387 +63,10 @@ * @(#)ctype.h 8.4 (Berkeley) 1/21/94 */ -//Begin-Libc -#include "xlocale_private.h" -//End-Libc #ifndef _CTYPE_H_ #define _CTYPE_H_ -#include -#include - -#define _CTYPE_A 0x00000100L /* Alpha */ -#define _CTYPE_C 0x00000200L /* Control */ -#define _CTYPE_D 0x00000400L /* Digit */ -#define _CTYPE_G 0x00000800L /* Graph */ -#define _CTYPE_L 0x00001000L /* Lower */ -#define _CTYPE_P 0x00002000L /* Punct */ -#define _CTYPE_S 0x00004000L /* Space */ -#define _CTYPE_U 0x00008000L /* Upper */ -#define _CTYPE_X 0x00010000L /* X digit */ -#define _CTYPE_B 0x00020000L /* Blank */ -#define _CTYPE_R 0x00040000L /* Print */ -#define _CTYPE_I 0x00080000L /* Ideogram */ -#define _CTYPE_T 0x00100000L /* Special */ -#define _CTYPE_Q 0x00200000L /* Phonogram */ -#define _CTYPE_SW0 0x20000000L /* 0 width character */ -#define _CTYPE_SW1 0x40000000L /* 1 width character */ -#define _CTYPE_SW2 0x80000000L /* 2 width character */ -#define _CTYPE_SW3 0xc0000000L /* 3 width character */ -#define _CTYPE_SWM 0xe0000000L /* Mask for screen width data */ -#define _CTYPE_SWS 30 /* Bits to shift to get width */ - -#ifdef _NONSTD_SOURCE -/* - * Backward compatibility - */ -#define _A _CTYPE_A /* Alpha */ -#define _C _CTYPE_C /* Control */ -#define _D _CTYPE_D /* Digit */ -#define _G _CTYPE_G /* Graph */ -#define _L _CTYPE_L /* Lower */ -#define _P _CTYPE_P /* Punct */ -#define _S _CTYPE_S /* Space */ -#define _U _CTYPE_U /* Upper */ -#define _X _CTYPE_X /* X digit */ -#define _B _CTYPE_B /* Blank */ -#define _R _CTYPE_R /* Print */ -#define _I _CTYPE_I /* Ideogram */ -#define _T _CTYPE_T /* Special */ -#define _Q _CTYPE_Q /* Phonogram */ -#define _SW0 _CTYPE_SW0 /* 0 width character */ -#define _SW1 _CTYPE_SW1 /* 1 width character */ -#define _SW2 _CTYPE_SW2 /* 2 width character */ -#define _SW3 _CTYPE_SW3 /* 3 width character */ -#endif /* _NONSTD_SOURCE */ - -//Begin-Libc -/* - * _EXTERNALIZE_CTYPE_INLINES_ is defined in locale/nomacros.c to tell us - * to generate code for extern versions of all intermediate inline functions. - */ -#ifdef _EXTERNALIZE_CTYPE_INLINES_ -#define _USE_CTYPE_INLINE_ -#define __DARWIN_CTYPE_inline -#else /* !_EXTERNALIZE_CTYPE_INLINES_ */ -//End-Libc -#define __DARWIN_CTYPE_inline __header_inline -//Begin-Libc -#endif /* !_EXTERNALIZE_CTYPE_INLINES_ */ -//End-Libc - -//Begin-Libc -/* - * _EXTERNALIZE_CTYPE_INLINES_TOP_ is defined in locale/isctype.c to tell us - * to generate code for extern versions of all top-level inline functions. - */ -#ifdef _EXTERNALIZE_CTYPE_INLINES_TOP_ -#define _USE_CTYPE_INLINE_ -#define __DARWIN_CTYPE_TOP_inline -#else /* !_EXTERNALIZE_CTYPE_INLINES_TOP_ */ -//End-Libc -#define __DARWIN_CTYPE_TOP_inline __header_inline -//Begin-Libc -#endif /* _EXTERNALIZE_CTYPE_INLINES_TOP_ */ -//End-Libc - -/* - * Use inline functions if we are allowed to and the compiler supports them. - */ -#if !defined(_DONT_USE_CTYPE_INLINE_) && \ - (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus)) - -/* See comments in about __darwin_ct_rune_t. */ -__BEGIN_DECLS -unsigned long ___runetype(__darwin_ct_rune_t); -__darwin_ct_rune_t ___tolower(__darwin_ct_rune_t); -__darwin_ct_rune_t ___toupper(__darwin_ct_rune_t); -__END_DECLS - -__DARWIN_CTYPE_TOP_inline int -isascii(int _c) -{ - return ((_c & ~0x7F) == 0); -} - -#ifdef USE_ASCII -__DARWIN_CTYPE_inline int -__maskrune(__darwin_ct_rune_t _c, unsigned long _f) -{ - return (int)_DefaultRuneLocale.__runetype[_c & 0xff] & (__uint32_t)_f; -} -//Begin-Libc -#elif defined(__LIBC__) -__DARWIN_CTYPE_inline int -__maskrune(__darwin_ct_rune_t _c, unsigned long _f) -{ - /* _CurrentRuneLocale.__runetype[_c] is __uint32_t - * _f is unsigned long - * ___runetype(_c) is unsigned long - * retval is int - */ - return (int)((_c < 0 || _c >= _CACHED_RUNES) ? (__uint32_t)___runetype(_c) : - __current_locale()->__lc_ctype->_CurrentRuneLocale.__runetype[_c]) & (__uint32_t)_f; -} -//End-Libc -#else /* !USE_ASCII */ -__BEGIN_DECLS -int __maskrune(__darwin_ct_rune_t, unsigned long); -__END_DECLS -#endif /* USE_ASCII */ - -__DARWIN_CTYPE_inline int -__istype(__darwin_ct_rune_t _c, unsigned long _f) -{ -#ifdef USE_ASCII - return !!(__maskrune(_c, _f)); -#else /* USE_ASCII */ - return (isascii(_c) ? !!(_DefaultRuneLocale.__runetype[_c] & _f) - : !!__maskrune(_c, _f)); -#endif /* USE_ASCII */ -} - -__DARWIN_CTYPE_inline __darwin_ct_rune_t -__isctype(__darwin_ct_rune_t _c, unsigned long _f) -{ -#ifdef USE_ASCII - return !!(__maskrune(_c, _f)); -#else /* USE_ASCII */ - return (_c < 0 || _c >= _CACHED_RUNES) ? 0 : - !!(_DefaultRuneLocale.__runetype[_c] & _f); -#endif /* USE_ASCII */ -} - -#ifdef USE_ASCII -__DARWIN_CTYPE_inline __darwin_ct_rune_t -__toupper(__darwin_ct_rune_t _c) -{ - return _DefaultRuneLocale.__mapupper[_c & 0xff]; -} - -__DARWIN_CTYPE_inline __darwin_ct_rune_t -__tolower(__darwin_ct_rune_t _c) -{ - return _DefaultRuneLocale.__maplower[_c & 0xff]; -} -//Begin-Libc -#elif defined(__LIBC__) -/* - * We can't do what we do for __toupper_l() (check for ASCII first, then call - * ___toupper_l() otherwise) because versions of ___toupper() before Tiger - * assume c >= _CACHED_RUNES. So we are stuck making __toupper() a routine - * to hide the extended locale details, outside of Libc. - */ -__DARWIN_CTYPE_inline __darwin_ct_rune_t -__toupper(__darwin_ct_rune_t _c) -{ - return (_c < 0 || _c >= _CACHED_RUNES) ? ___toupper(_c) : - __current_locale()->__lc_ctype->_CurrentRuneLocale.__mapupper[_c]; -} - -__DARWIN_CTYPE_inline __darwin_ct_rune_t -__tolower(__darwin_ct_rune_t _c) -{ - return (_c < 0 || _c >= _CACHED_RUNES) ? ___tolower(_c) : - __current_locale()->__lc_ctype->_CurrentRuneLocale.__maplower[_c]; -} -//End-Libc -#else /* !USE_ASCII */ -__BEGIN_DECLS -__darwin_ct_rune_t __toupper(__darwin_ct_rune_t); -__darwin_ct_rune_t __tolower(__darwin_ct_rune_t); -__END_DECLS -#endif /* USE_ASCII */ - -__DARWIN_CTYPE_inline int -__wcwidth(__darwin_ct_rune_t _c) -{ - unsigned int _x; - - if (_c == 0) - return (0); - _x = (unsigned int)__maskrune(_c, _CTYPE_SWM|_CTYPE_R); - if ((_x & _CTYPE_SWM) != 0) - return ((_x & _CTYPE_SWM) >> _CTYPE_SWS); - return ((_x & _CTYPE_R) != 0 ? 1 : -1); -} - -#ifndef _EXTERNALIZE_CTYPE_INLINES_ - -#define _tolower(c) __tolower(c) -#define _toupper(c) __toupper(c) - -__DARWIN_CTYPE_TOP_inline int -isalnum(int _c) -{ - return (__istype(_c, _CTYPE_A|_CTYPE_D)); -} - -__DARWIN_CTYPE_TOP_inline int -isalpha(int _c) -{ - return (__istype(_c, _CTYPE_A)); -} - -__DARWIN_CTYPE_TOP_inline int -isblank(int _c) -{ - return (__istype(_c, _CTYPE_B)); -} - -__DARWIN_CTYPE_TOP_inline int -iscntrl(int _c) -{ - return (__istype(_c, _CTYPE_C)); -} - -/* ANSI -- locale independent */ -__DARWIN_CTYPE_TOP_inline int -isdigit(int _c) -{ - return (__isctype(_c, _CTYPE_D)); -} - -__DARWIN_CTYPE_TOP_inline int -isgraph(int _c) -{ - return (__istype(_c, _CTYPE_G)); -} - -__DARWIN_CTYPE_TOP_inline int -islower(int _c) -{ - return (__istype(_c, _CTYPE_L)); -} - -__DARWIN_CTYPE_TOP_inline int -isprint(int _c) -{ - return (__istype(_c, _CTYPE_R)); -} - -__DARWIN_CTYPE_TOP_inline int -ispunct(int _c) -{ - return (__istype(_c, _CTYPE_P)); -} - -__DARWIN_CTYPE_TOP_inline int -isspace(int _c) -{ - return (__istype(_c, _CTYPE_S)); -} - -__DARWIN_CTYPE_TOP_inline int -isupper(int _c) -{ - return (__istype(_c, _CTYPE_U)); -} - -/* ANSI -- locale independent */ -__DARWIN_CTYPE_TOP_inline int -isxdigit(int _c) -{ - return (__isctype(_c, _CTYPE_X)); -} - -__DARWIN_CTYPE_TOP_inline int -toascii(int _c) -{ - return (_c & 0x7F); -} - -__DARWIN_CTYPE_TOP_inline int -tolower(int _c) -{ - return (__tolower(_c)); -} - -__DARWIN_CTYPE_TOP_inline int -toupper(int _c) -{ - return (__toupper(_c)); -} - -#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) -__DARWIN_CTYPE_TOP_inline int -digittoint(int _c) -{ - return (__maskrune(_c, 0x0F)); -} - -__DARWIN_CTYPE_TOP_inline int -ishexnumber(int _c) -{ - return (__istype(_c, _CTYPE_X)); -} - -__DARWIN_CTYPE_TOP_inline int -isideogram(int _c) -{ - return (__istype(_c, _CTYPE_I)); -} - -__DARWIN_CTYPE_TOP_inline int -isnumber(int _c) -{ - return (__istype(_c, _CTYPE_D)); -} - -__DARWIN_CTYPE_TOP_inline int -isphonogram(int _c) -{ - return (__istype(_c, _CTYPE_Q)); -} - -__DARWIN_CTYPE_TOP_inline int -isrune(int _c) -{ - return (__istype(_c, 0xFFFFFFF0L)); -} - -__DARWIN_CTYPE_TOP_inline int -isspecial(int _c) -{ - return (__istype(_c, _CTYPE_T)); -} -#endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ -#endif /* _EXTERNALIZE_CTYPE_INLINES_ */ - -#else /* not using inlines */ - -__BEGIN_DECLS -int isalnum(int); -int isalpha(int); -int isblank(int); -int iscntrl(int); -int isdigit(int); -int isgraph(int); -int islower(int); -int isprint(int); -int ispunct(int); -int isspace(int); -int isupper(int); -int isxdigit(int); -int tolower(int); -int toupper(int); -int isascii(int); -int toascii(int); - -#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) -int _tolower(int); -int _toupper(int); -int digittoint(int); -int ishexnumber(int); -int isideogram(int); -int isnumber(int); -int isphonogram(int); -int isrune(int); -int isspecial(int); -#endif -__END_DECLS - -#endif /* using inlines */ +#include <_ctype.h> #ifdef _USE_EXTENDED_LOCALES_ #include diff --git a/include/regex.h b/include/regex.h index a735132..83e801a 100644 --- a/include/regex.h +++ b/include/regex.h @@ -89,30 +89,7 @@ #ifndef _REGEX_H_ #define _REGEX_H_ -#include <_types.h> -#include -#include - -/*********/ -/* types */ -/*********/ -#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL -#include -#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ - -typedef __darwin_off_t regoff_t; - -typedef struct { - int re_magic; - size_t re_nsub; /* number of parenthesized subexpressions */ - const char *re_endp; /* end pointer for REG_PEND */ - struct re_guts *re_g; /* none of your business :-) */ -} regex_t; - -typedef struct { - regoff_t rm_so; /* start of match */ - regoff_t rm_eo; /* end of match */ -} regmatch_t; +#include <_regex.h> /*******************/ /* regcomp() flags */ diff --git a/include/stdio.h b/include/stdio.h index a9b35cd..4535751 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -61,96 +61,7 @@ #ifndef _STDIO_H_ #define _STDIO_H_ -#include -#include - -#include <_types.h> - -/* DO NOT REMOVE THIS COMMENT: fixincludes needs to see: - * __gnuc_va_list and include */ -#include -#include -#include - -#include - -typedef __darwin_off_t fpos_t; - -#define _FSTDIO /* Define for new stdio with functions. */ - -/* - * NB: to fit things in six character monocase externals, the stdio - * code uses the prefix `__s' for stdio objects, typically followed - * by a three-character attempt at a mnemonic. - */ - -/* stdio buffers */ -struct __sbuf { - unsigned char *_base; - int _size; -}; - -/* hold a buncha junk that would grow the ABI */ -struct __sFILEX; - -/* - * stdio state variables. - * - * The following always hold: - * - * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), - * _lbfsize is -_bf._size, else _lbfsize is 0 - * if _flags&__SRD, _w is 0 - * if _flags&__SWR, _r is 0 - * - * This ensures that the getc and putc macros (or inline functions) never - * try to write or read from a file that is in `read' or `write' mode. - * (Moreover, they can, and do, automatically switch from read mode to - * write mode, and back, on "r+" and "w+" files.) - * - * _lbfsize is used only to make the inline line-buffered output stream - * code as compact as possible. - * - * _ub, _up, and _ur are used when ungetc() pushes back more characters - * than fit in the current _bf, or when ungetc() pushes back a character - * that does not match the previous one in _bf. When this happens, - * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff - * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. - * - * NB: see WARNING above before changing the layout of this structure! - */ -typedef struct __sFILE { - unsigned char *_p; /* current position in (some) buffer */ - int _r; /* read space left for getc() */ - int _w; /* write space left for putc() */ - short _flags; /* flags, below; this FILE is free if 0 */ - short _file; /* fileno, if Unix descriptor, else -1 */ - struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */ - int _lbfsize; /* 0 or -_bf._size, for inline putc */ - - /* operations */ - void *_cookie; /* cookie passed to io functions */ - int (* _Nullable _close)(void *); - int (* _Nullable _read) (void *, char *, int); - fpos_t (* _Nullable _seek) (void *, fpos_t, int); - int (* _Nullable _write)(void *, const char *, int); - - /* separate buffer for long sequences of ungetc() */ - struct __sbuf _ub; /* ungetc buffer */ - struct __sFILEX *_extra; /* additions to FILE to not break ABI */ - int _ur; /* saved _r when _r is counting ungetc data */ - - /* tricks to meet minimum requirements even when malloc() fails */ - unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */ - unsigned char _nbuf[1]; /* guarantee a getc() buffer */ - - /* separate buffer for fgetln() when line crosses buffer boundary */ - struct __sbuf _lb; /* buffer for fgetln() */ - - /* Unix stdio files get aligned to block boundaries on fseek() */ - int _blksize; /* stat.st_blksize (may be != _bf._size) */ - fpos_t _offset; /* current lseek offset (see WARNING) */ -} FILE; +#include <_stdio.h> __BEGIN_DECLS extern FILE *__stdinp; diff --git a/include/stdlib.h b/include/stdlib.h index a8e5d8d..12de65f 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -237,6 +237,11 @@ long mrand48(void) __swift_unavailable("Use arc4random instead."); long nrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead."); int posix_openpt(int); char *ptsname(int); + +#if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) +int ptsname_r(int fildes, char *buffer, size_t buflen) __API_AVAILABLE(macos(10.13.4), ios(11.3), tvos(11.3), watchos(4.3)); +#endif + //Begin-Libc #ifndef LIBC_ALIAS_PUTENV //End-Libc diff --git a/include/xlocale.h b/include/xlocale.h index 7772f6c..8569540 100644 --- a/include/xlocale.h +++ b/include/xlocale.h @@ -30,9 +30,6 @@ #define _USE_EXTENDED_LOCALES_ #endif /* _USE_EXTENDED_LOCALES_ */ -struct _xlocale; /* forward reference */ -typedef struct _xlocale * locale_t; - #include <_locale.h> #include <_xlocale.h> diff --git a/include/xlocale/__wctype.h b/include/xlocale/__wctype.h index 63a7310..2246382 100644 --- a/include/xlocale/__wctype.h +++ b/include/xlocale/__wctype.h @@ -24,6 +24,9 @@ #ifndef _XLOCALE___WCTYPE_H_ #define _XLOCALE___WCTYPE_H_ +#include <__wctype.h> +#include + #if !defined(_DONT_USE_CTYPE_INLINE_) && \ (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus)) diff --git a/include/xlocale/_ctype.h b/include/xlocale/_ctype.h index 3da4cdf..4b481b2 100644 --- a/include/xlocale/_ctype.h +++ b/include/xlocale/_ctype.h @@ -24,6 +24,9 @@ #ifndef _XLOCALE__CTYPE_H_ #define _XLOCALE__CTYPE_H_ +#include <_ctype.h> +#include <_xlocale.h> + /* * Use inline functions if we are allowed to and the compiler supports them. */ diff --git a/include/xlocale/_inttypes.h b/include/xlocale/_inttypes.h index cb8a99e..db72853 100644 --- a/include/xlocale/_inttypes.h +++ b/include/xlocale/_inttypes.h @@ -24,6 +24,10 @@ #ifndef _XLOCALE__INTTYPES_H_ #define _XLOCALE__INTTYPES_H_ +#include +#include +#include <_xlocale.h> + __BEGIN_DECLS intmax_t strtoimax_l(const char * __restrict nptr, char ** __restrict endptr, int base, locale_t); diff --git a/include/xlocale/_langinfo.h b/include/xlocale/_langinfo.h index dfba512..0190cf6 100644 --- a/include/xlocale/_langinfo.h +++ b/include/xlocale/_langinfo.h @@ -24,6 +24,10 @@ #ifndef _XLOCALE__LANGINFO_H_ #define _XLOCALE__LANGINFO_H_ +#include +#include <_types/_nl_item.h> +#include <_xlocale.h> + __BEGIN_DECLS char *nl_langinfo_l(nl_item, locale_t); __END_DECLS diff --git a/include/xlocale/_monetary.h b/include/xlocale/_monetary.h index a60aa1f..cf10468 100644 --- a/include/xlocale/_monetary.h +++ b/include/xlocale/_monetary.h @@ -24,6 +24,12 @@ #ifndef _XLOCALE__MONETARY_H_ #define _XLOCALE__MONETARY_H_ +#include +#include <_types.h> +#include +#include +#include <_xlocale.h> + __BEGIN_DECLS ssize_t strfmon_l(char *, size_t, locale_t, const char *, ...) __strfmonlike(4, 5); diff --git a/include/xlocale/_regex.h b/include/xlocale/_regex.h index 8321764..8f4fcf3 100644 --- a/include/xlocale/_regex.h +++ b/include/xlocale/_regex.h @@ -24,6 +24,11 @@ #ifndef _XLOCALE__REGEX_H_ #define _XLOCALE__REGEX_H_ +#ifndef _REGEX_H_ +#include <_regex.h> +#endif // _REGEX_H_ +#include <_xlocale.h> + __BEGIN_DECLS int regcomp_l(regex_t * __restrict, const char * __restrict, int, diff --git a/include/xlocale/_stdio.h b/include/xlocale/_stdio.h index c48f763..f9272ff 100644 --- a/include/xlocale/_stdio.h +++ b/include/xlocale/_stdio.h @@ -24,6 +24,9 @@ #ifndef _XLOCALE__STDIO_H_ #define _XLOCALE__STDIO_H_ +#include <_stdio.h> +#include <_xlocale.h> + __BEGIN_DECLS int fprintf_l(FILE * __restrict, locale_t __restrict, const char * __restrict, ...) diff --git a/include/xlocale/_stdlib.h b/include/xlocale/_stdlib.h index e5076d6..add77d6 100644 --- a/include/xlocale/_stdlib.h +++ b/include/xlocale/_stdlib.h @@ -24,6 +24,11 @@ #ifndef _XLOCALE__STDLIB_H_ #define _XLOCALE__STDLIB_H_ +#include +#include +#include +#include <_xlocale.h> + __BEGIN_DECLS double atof_l(const char *, locale_t); int atoi_l(const char *, locale_t); diff --git a/include/xlocale/_string.h b/include/xlocale/_string.h index a6d5c80..8aa73fa 100644 --- a/include/xlocale/_string.h +++ b/include/xlocale/_string.h @@ -24,6 +24,10 @@ #ifndef _XLOCALE__STRING_H_ #define _XLOCALE__STRING_H_ +#include +#include +#include <_xlocale.h> + __BEGIN_DECLS int strcoll_l(const char *, const char *, locale_t); size_t strxfrm_l(char *, const char *, size_t, locale_t); diff --git a/include/xlocale/_time.h b/include/xlocale/_time.h index db94b2f..0809bee 100644 --- a/include/xlocale/_time.h +++ b/include/xlocale/_time.h @@ -24,6 +24,11 @@ #ifndef _XLOCALE__TIME_H_ #define _XLOCALE__TIME_H_ +#include +#include +#include <_types.h> +#include <_xlocale.h> + __BEGIN_DECLS //Begin-Libc #ifndef LIBC_ALIAS_STRFTIME_L diff --git a/include/xlocale/_wchar.h b/include/xlocale/_wchar.h index fbfb2f7..2bd7da8 100644 --- a/include/xlocale/_wchar.h +++ b/include/xlocale/_wchar.h @@ -24,6 +24,9 @@ #ifndef _XLOCALE__WCHAR_H_ #define _XLOCALE__WCHAR_H_ +#include <_stdio.h> +#include <_xlocale.h> + /* Initially added in Issue 4 */ __BEGIN_DECLS wint_t btowc_l(int, locale_t); diff --git a/include/xlocale/_wctype.h b/include/xlocale/_wctype.h index 43cbeae..2b0c684 100644 --- a/include/xlocale/_wctype.h +++ b/include/xlocale/_wctype.h @@ -24,6 +24,10 @@ #ifndef _XLOCALE__WCTYPE_H_ #define _XLOCALE__WCTYPE_H_ +#include <__wctype.h> +#include <_types/_wctrans_t.h> +#include + #if !defined(_DONT_USE_CTYPE_INLINE_) && \ (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus)) diff --git a/man/manpages.lst b/man/manpages.lst index 4621bef..c4244a9 100644 --- a/man/manpages.lst +++ b/man/manpages.lst @@ -310,7 +310,7 @@ toupper.3 toupper.3 toupper_l.3 towlower.3 towlower.3 towlower_l.3 towupper.3 towupper.3 towupper_l.3 tsearch.3 tsearch.3 tdelete.3 tfind.3 twalk.3 -ttyname.3 ttyname.3 isatty.3 ttyslot.3 +ttyname.3 ttyname.3 ttyname_r.3 isatty.3 ttyslot.3 tzset.3 tzset.3 tzsetwall.3 ualarm.3 ualarm.3 ulimit.3 ulimit.3 diff --git a/stdio/FreeBSD/vfprintf.c b/stdio/FreeBSD/vfprintf.c index 2e707ef..ff6162c 100644 --- a/stdio/FreeBSD/vfprintf.c +++ b/stdio/FreeBSD/vfprintf.c @@ -30,6 +30,8 @@ * SUCH DAMAGE. */ +#define OS_CRASH_ENABLE_EXPERIMENTAL_LIBTRACE 1 + #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ @@ -868,7 +870,7 @@ fp_common: static_format_checked = __printf_is_memory_read_only((void*)fmt0, strlen(fmt0)); } if (!static_format_checked) { - os_crash("%n used in a non-immutable format string"); + os_crash("%%n used in a non-immutable format string: %s", fmt0); } #endif // ALLOW_DYNAMIC_PERCENT_N diff --git a/stdlib/grantpt.3 b/stdlib/grantpt.3 index eb70e74..2f8c189 100644 --- a/stdlib/grantpt.3 +++ b/stdlib/grantpt.3 @@ -38,6 +38,7 @@ .Nm grantpt , .Nm posix_openpt , .Nm ptsname , +.Nm ptsname_r , .Nm unlockpt .Nd pseudo-terminal access functions .Sh SYNOPSIS @@ -50,6 +51,12 @@ .Fo ptsname .Fa "int fildes" .Fc +.Ft "int" +.Fo ptsname_r +.Fa "int fildes" +.Fa "char *buffer" +.Fa "size_t buflen" +.Fc .Ft int .Fo unlockpt .Fa "int fildes" @@ -64,11 +71,12 @@ The .Fn grantpt , .Fn ptsname , +.Fn ptsname_r , .Fn unlockpt , and .Fn posix_openpt functions allow access to pseudo-terminal devices. -The first three functions accept a file descriptor +The first four functions accept a file descriptor that references the master half of a pseudo-terminal pair. This file descriptor is created with .Fn posix_openpt . @@ -89,7 +97,9 @@ is left untouched. .Pp The .Fn ptsname -function returns the full pathname of the slave device +and +.Fn ptsname_r +functions return the full pathname of the slave device counterpart to the master device specified with .Fa fildes . This value can be used @@ -97,7 +107,11 @@ to subsequently open the appropriate slave after .Fn posix_openpt and .Fn grantpt -have been called. +have been called. The +.Fn ptsname +function is not guaranteed to be reentrant or thread safe. The +.Fn ptsname_r +function takes a buffer and length as arguments to avoid this problem. .Pp The .Fn unlockpt @@ -134,6 +148,12 @@ pointer is returned and the global variable is set to indicate the error. .Pp The +.Fn ptsname_r +function returns 0 if successful. On failure, it returns -1 and the global variable +.Va errno +is set to indicate the error. +.Pp +The .Fn posix_openpt function returns a file descriptor to the first available master pseudo-terminal device on success; @@ -144,6 +164,7 @@ is set to indicate the error. The .Fn grantpt , .Fn ptsname , +.Fn ptsname_r , and .Fn unlockpt functions may fail and set @@ -156,6 +177,24 @@ is not a master pseudo-terminal device. .El .Pp In addition, the +.Fn ptsname_r +function may set +.Va errno +to: +.Bl -tag -width Er +.It Bq Er EINVAL +The +.Va buffer +argument is NULL. +.El +.Bl -tag -width Er +.It Bq Er ERANGE +The +.Va bufsize +argument is smaller than the length of the string to be returned. +.El +.Pp +In addition, the .Fn grantpt function may set .Va errno @@ -181,6 +220,7 @@ The system has no available pseudo-terminal devices. The .Fn grantpt , .Fn ptsname , +.Fn ptsname_r , and .Fn unlockpt functions may also fail and set diff --git a/stdlib/grantpt.c b/stdlib/grantpt.c index c8653ec..bbc52cb 100644 --- a/stdlib/grantpt.c +++ b/stdlib/grantpt.c @@ -21,7 +21,11 @@ * @APPLE_LICENSE_HEADER_END@ */ +#include +#include +#include #include +#include #include #include #include @@ -53,6 +57,19 @@ grantpt(int fd) return ioctl(fd, TIOCPTYGRANT); } +// defined by TIOCPTYGNAME +#define PTSNAME_MAX_SIZE 128 + +static pthread_key_t ptsname_buffer_specific_key; +static os_once_t ptsname_once; + +static void +ptsname_once_init(void *ctx __unused) +{ + int ret = pthread_key_create(&ptsname_buffer_specific_key, free); + os_assert_zero(ret); +} + /* * ptsname call for cloning pty implementation. * @@ -62,29 +79,59 @@ grantpt(int fd) char * ptsname(int fd) { - static char *ptsnamebuf = NULL; + os_once(&ptsname_once, NULL, ptsname_once_init); + char *ptsnamebuf = pthread_getspecific(ptsname_buffer_specific_key); + + if (ptsnamebuf == NULL) { + ptsnamebuf = malloc(PTSNAME_MAX_SIZE); + os_assert(ptsnamebuf); + + int error = pthread_setspecific(ptsname_buffer_specific_key, ptsnamebuf); + os_assert_zero(error); + } + + int error = ptsname_r(fd, ptsnamebuf, PTSNAME_MAX_SIZE); + + return error ? NULL : ptsnamebuf; +} + +int +ptsname_r(int fd, char *buffer, size_t buflen) +{ int error; - char *retval = NULL; struct stat sbuf; + char ptsnamebuf[PTSNAME_MAX_SIZE]; - if (ptsnamebuf == NULL) { - ptsnamebuf = malloc(128); // defined by TIOCPTYGNAME + if (!buffer) { + errno = EINVAL; + return -1; } - + error = ioctl(fd, TIOCPTYGNAME, ptsnamebuf); - if (!error) { - /* - * XXX TSD - * - * POSIX: Handle device rename test case, which is expected - * to fail if the pty has been renamed. - */ - if (stat(ptsnamebuf, &sbuf) == 0) { - retval = ptsnamebuf; - } + if (error) { + return -1; } - return (retval); + /* + * XXX TSD + * + * POSIX: Handle device rename test case, which is expected + * to fail if the pty has been renamed. + */ + error = stat(ptsnamebuf, &sbuf); + if (error) { + return -1; + } + + size_t len = strlen(ptsnamebuf) + 1; + if (buflen < len) { + errno = ERANGE; + return -1; + } + + memcpy(buffer, ptsnamebuf, len); + + return 0; } /* diff --git a/tests/nxheap.c b/tests/nxheap.c index d75dc48..14c10cb 100644 --- a/tests/nxheap.c +++ b/tests/nxheap.c @@ -18,7 +18,7 @@ action(int signo, struct __siginfo *info, void *uap __attribute__((unused))) siglongjmp(jbuf, 0); } -T_DECL(nxheap, "Non-executable heap", T_META_CHECK_LEAKS(NO)) +T_DECL(nxheap, "Non-executable heap", T_META_CHECK_LEAKS(false), T_META_ASROOT(true)) { struct sigaction sa = { .__sigaction_u.__sa_sigaction = action, @@ -26,7 +26,7 @@ T_DECL(nxheap, "Non-executable heap", T_META_CHECK_LEAKS(NO)) }; T_ASSERT_POSIX_ZERO(sigaction(SIGBUS, &sa, NULL), NULL); - + if (sigsetjmp(jbuf, 0)) { T_PASS("SIGBUS"); T_END; diff --git a/util/pty.c b/util/pty.c index f6a72e1..1b7a3bd 100644 --- a/util/pty.c +++ b/util/pty.c @@ -76,12 +76,12 @@ int openpty(amaster, aslave, name, termp, winp) struct winsize *winp; { int master, slave; - char *sname; + char sname[128]; if ((master = posix_openpt(O_RDWR|O_NOCTTY)) < 0) return -1; if (grantpt(master) < 0 || unlockpt(master) < 0 - || (sname = ptsname(master)) == NULL + || ptsname_r(master, sname, sizeof(sname)) == -1 || (slave = open(sname, O_RDWR|O_NOCTTY, 0)) < 0) { (void) close(master); return -1; diff --git a/xcodescripts/headers.sh b/xcodescripts/headers.sh index 64d1da8..d87641e 100755 --- a/xcodescripts/headers.sh +++ b/xcodescripts/headers.sh @@ -38,7 +38,11 @@ INSTHDRS=( ) INC_INSTHDRS=( + __wctype.h + _ctype.h _locale.h + _regex.h + _stdio.h _types.h _wctype.h _xlocale.h diff --git a/xcodescripts/libc.xcconfig b/xcodescripts/libc.xcconfig index a7a1081..e70e387 100644 --- a/xcodescripts/libc.xcconfig +++ b/xcodescripts/libc.xcconfig @@ -67,14 +67,13 @@ LIBXPC_LDFLAGS = -lxpc LIBPLATFORM_LDFLAGS = -lsystem$(SIM_SUFFIX)_platform LIBPTHREAD_LDFLAGS = -lsystem$(SIM_SUFFIX)_pthread LIBSYSCALL_LDFLAGS = -lsystem$(SIM_SUFFIX)_kernel -LIBM_LDFLAGS = -lsystem$(SIM_SUFFIX)_m +LIBM_LDFLAGS = -lsystem_m LIBDYLD_LDFLAGS = -ldyld LIBSYSTEM_C_LDFLAGS = -all_load -nostdlib -L/usr/lib/system -umbrella System $(CR_LDFLAGS) $(LIBCOMPILER_RT_LDFLAGS) $(LIBDYLD_LDFLAGS) $(LIBSYSCALL_LDFLAGS) $(LIBM_LDFLAGS) $(LIBMALLOC_LDFLAGS) $(LIBPLATFORM_LDFLAGS) $(LIBPTHREAD_LDFLAGS) $(UPWARD_LDFLAGS) $(LIBSYSTEM_C_EXTRA_LDFLAGS_$(CURRENT_ARCH)) -Wl,-interposable_list,$(DERIVED_FILES_DIR)/interposable.list -Wl,-unexported_symbols_list,$(DERIVED_FILES_DIR)/unexport.list -Wl,-alias_list,$(SRCROOT)/xcodescripts/alias.list -Wl,-order_file,$(SRCROOT)/xcodescripts/Libc.order -Wl,-sectalign,__DATA,__data,1000 @$(BUILT_PRODUCTS_DIR)/$(CURRENT_VARIANT).linklist LIBSYSTEM_C_EXTRA_LDFLAGS_i386 = -Wl,-alias_list,$(SRCROOT)/xcodescripts/legacy_alias.list // TODO: Remove upward links - mostly , macho is for assumes.c -UPWARD_LDFLAGS = -Wl,-upward-ldispatch -Wl,-upward-llaunch -Wl,-upward-lmacho -Wl,-upward-lsystem_asl -Wl,-upward-lsystem_blocks -Wl,-upward-lsystem_info -Wl,-upward-lsystem_notify -Wl,-upward-lxpc -Wl,-upward-lcorecrypto -UPWARD_LDFLAGS[sdk=*simulator*] = -Wl,-upward-ldispatch -Wl,-upward-lmacho_sim -Wl,-upward-lsystem_asl -Wl,-upward-lsystem_sim_blocks -Wl,-upward-lsystem_sim_info -Wl,-upward-lsystem_notify -Wl,-upward-lxpc -Wl,-upward-lcorecrypto +UPWARD_LDFLAGS = -Wl,-upward-ldispatch -Wl,-upward-lmacho -Wl,-upward-lsystem_asl -Wl,-upward-lsystem_blocks -Wl,-upward-lsystem_info -Wl,-upward-lsystem_notify -Wl,-upward-lxpc -Wl,-upward-lcorecrypto -Wl,-upward-lsystem_trace LIBSYSTEM_DARWIN_LDFLAGS = -all_load -nostdlib -L/usr/lib/system -umbrella System $(LIBCOMPILER_RT_LDFLAGS) $(LIBDYLD_LDFLAGS) $(LIBSYSCALL_LDFLAGS) $(LIBM_LDFLAGS) $(LIBMALLOC_LDFLAGS) $(LIBPLATFORM_LDFLAGS) $(LIBPTHREAD_LDFLAGS) $(LIBPLATFORM_LDFLAGS) $(LIBC_LDFLAGS) $(LIBDISPATCH_LDFLAGS) $(LIBXPC_LDFLAGS) -- 2.45.2