From 23e20b0053d7317ce3facd3fd38db8c73c2c380a Mon Sep 17 00:00:00 2001 From: Apple Date: Fri, 24 Oct 2014 17:53:05 +0000 Subject: [PATCH] Libc-1044.1.2.tar.gz --- Libc.xcodeproj/project.pbxproj | 187 ++--- Platforms/iphoneos/Makefile.inc | 4 +- Platforms/macosx/Makefile.inc | 4 +- darwin/_dirhelper.c | 449 ------------ include/_structs.h => darwin/atexit_receipt.c | 10 +- darwin/dirhelper.defs | 35 - darwin/{dirhelper_priv.h => libc_private.h} | 65 +- emulated/lchmod.c | 9 +- fbsdcompat/_fbsd_compat_.h | 11 + fbsdcompat/libc_private.h | 135 ---- fbsdcompat/sys/cdefs.h | 2 - gen/FreeBSD/assert.c | 2 +- gen/FreeBSD/opendir.c | 69 +- gen/FreeBSD/sysctl.3 | 648 +++++++----------- gen/FreeBSD/sysctlbyname.c | 19 +- gen/FreeBSD/sysctlnametomib.c | 5 +- gen/{ => FreeBSD}/wordexp.3 | 83 ++- gen/FreeBSD/wordexp.c | 600 ++++++++++++++++ gen/NSSystemDirectories.c | 386 ----------- gen/confstr.c | 48 +- gen/directory.3 | 120 ++-- gen/nanosleep.c | 2 +- gen/strtofflags.c | 1 + gen/utmpx-darwin.c | 182 ++++- gen/utmpx-darwin.h | 4 +- gen/wordexp.c | 388 ----------- include/CrashReporterClient.h | 44 -- include/NSSystemDirectories.h | 110 --- include/assert.h | 2 +- include/bitstring.h | 93 +-- include/ctype.h | 17 +- include/dirent.h | 11 + include/libkern/OSMemoryNotification.h | 121 ---- include/libkern/OSThermalNotification.h | 51 +- include/protocols/timed.h | 4 +- include/signal.h | 4 +- include/stddef.h | 55 +- include/stdint.h | 4 - include/stdio.h | 2 + include/stdlib.h | 4 +- include/sys/acl.h | 2 + include/time.h | 6 +- include/xlocale/_ctype.h | 11 +- locale/FreeBSD/ascii.c | 2 +- locale/FreeBSD/big5.c | 2 +- locale/FreeBSD/euc.c | 2 +- locale/FreeBSD/gb18030.c | 2 +- locale/FreeBSD/gb2312.c | 2 +- locale/FreeBSD/gbk.c | 2 +- locale/FreeBSD/mblocal.h | 30 +- locale/FreeBSD/mskanji.c | 2 +- locale/FreeBSD/none.c | 12 +- locale/FreeBSD/table.c | 2 +- locale/FreeBSD/utf2.c | 2 +- locale/FreeBSD/utf8.c | 2 +- locale/xlocale.c | 6 +- locale/xlocale_private.h | 21 +- man/manpages.lst | 2 +- os/assumes.c | 16 +- os/assumes.h | 21 +- os/base.h | 51 -- os/{trace.c => debug_private.c} | 98 +-- os/{trace.h => debug_private.h} | 34 +- posix1e/acl_perm.c | 3 + posix1e/acl_translate.c | 1 + posix1e/aclvar.h | 3 +- stdio/FreeBSD/_flock_stub.c | 56 +- stdio/FreeBSD/fclose.c | 5 +- stdio/FreeBSD/findfp.c | 78 +-- stdio/FreeBSD/freopen.c | 9 +- stdio/FreeBSD/fseek.c | 6 +- stdio/FreeBSD/local.h | 12 +- stdio/FreeBSD/printfcommon.h | 6 +- stdio/FreeBSD/refill.c | 3 +- stdio/FreeBSD/rewind.c | 3 +- stdio/FreeBSD/ungetc.c | 4 +- stdio/FreeBSD/vfscanf.c | 4 +- stdio/FreeBSD/vfwscanf.c | 4 +- stdio/FreeBSD/vsnprintf.c | 7 + stdio/FreeBSD/wsetup.c | 3 +- stdlib/FreeBSD/abort.c | 2 +- stdlib/FreeBSD/atexit.c | 174 +++-- stdlib/FreeBSD/atexit.h | 8 + stdlib/FreeBSD/exit.c | 8 - stdlib/FreeBSD/psort.c | 26 +- sys/OSMemoryNotification.c | 110 +-- sys/OSThermalNotification.c | 10 +- sys/OpenBSD/stack_protector.c | 2 +- sys/_libc_fork_child.c | 8 +- sys/{__libc_init.c => _libc_init.c} | 48 +- sys/crt_externs.c | 5 +- sys/fork.c | 21 +- xcodescripts/Libc.order | 100 +++ xcodescripts/clean_simulator.sh | 7 - xcodescripts/eos.xcconfig | 2 +- xcodescripts/generate_features.pl | 2 +- xcodescripts/headers.sh | 137 +++- xcodescripts/libc.xcconfig | 54 +- xcodescripts/manpages.sh | 3 +- xcodescripts/variants.xcconfig | 4 +- 100 files changed, 2164 insertions(+), 3094 deletions(-) delete mode 100644 darwin/_dirhelper.c rename include/_structs.h => darwin/atexit_receipt.c (89%) delete mode 100644 darwin/dirhelper.defs rename darwin/{dirhelper_priv.h => libc_private.h} (50%) delete mode 100644 fbsdcompat/libc_private.h rename gen/{ => FreeBSD}/wordexp.3 (74%) create mode 100644 gen/FreeBSD/wordexp.c delete mode 100644 gen/NSSystemDirectories.c delete mode 100644 gen/wordexp.c delete mode 100644 include/CrashReporterClient.h delete mode 100644 include/NSSystemDirectories.h delete mode 100644 include/libkern/OSMemoryNotification.h delete mode 100644 os/base.h rename os/{trace.c => debug_private.c} (70%) rename os/{trace.h => debug_private.h} (73%) rename sys/{__libc_init.c => _libc_init.c} (63%) create mode 100644 xcodescripts/Libc.order delete mode 100644 xcodescripts/clean_simulator.sh diff --git a/Libc.xcodeproj/project.pbxproj b/Libc.xcodeproj/project.pbxproj index 249534a..8eb23f4 100644 --- a/Libc.xcodeproj/project.pbxproj +++ b/Libc.xcodeproj/project.pbxproj @@ -7,15 +7,15 @@ objects = { /* Begin PBXBuildFile section */ - 2B9D61B8157D667600AF25B8 /* trace.c in Sources */ = {isa = PBXBuildFile; fileRef = 2B9D61B5157D667000AF25B8 /* trace.c */; }; - 2B9D61B9157D667600AF25B8 /* trace.c in Sources */ = {isa = PBXBuildFile; fileRef = 2B9D61B5157D667000AF25B8 /* trace.c */; }; - 2B9D61BA157D667800AF25B8 /* trace.c in Sources */ = {isa = PBXBuildFile; fileRef = 2B9D61B5157D667000AF25B8 /* trace.c */; }; - 2B9D61BB157D667900AF25B8 /* trace.c in Sources */ = {isa = PBXBuildFile; fileRef = 2B9D61B5157D667000AF25B8 /* trace.c */; }; - 2B9D61BC157D667A00AF25B8 /* trace.c in Sources */ = {isa = PBXBuildFile; fileRef = 2B9D61B5157D667000AF25B8 /* trace.c */; }; - 2B9D61BD157D667A00AF25B8 /* trace.c in Sources */ = {isa = PBXBuildFile; fileRef = 2B9D61B5157D667000AF25B8 /* trace.c */; }; - 2B9D61BE157D667B00AF25B8 /* trace.c in Sources */ = {isa = PBXBuildFile; fileRef = 2B9D61B5157D667000AF25B8 /* trace.c */; }; - 2B9D61BF157D667B00AF25B8 /* trace.c in Sources */ = {isa = PBXBuildFile; fileRef = 2B9D61B5157D667000AF25B8 /* trace.c */; }; - 2B9D61C0157D667C00AF25B8 /* trace.c in Sources */ = {isa = PBXBuildFile; fileRef = 2B9D61B5157D667000AF25B8 /* trace.c */; }; + 2DF67CDE184F9CBE00B83A3D /* debug_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DF67CDD184F9CBE00B83A3D /* debug_private.c */; }; + 2DF67CDF184F9CBE00B83A3D /* debug_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DF67CDD184F9CBE00B83A3D /* debug_private.c */; }; + 2DF67CE0184F9CBE00B83A3D /* debug_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DF67CDD184F9CBE00B83A3D /* debug_private.c */; }; + 2DF67CE1184F9CBE00B83A3D /* debug_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DF67CDD184F9CBE00B83A3D /* debug_private.c */; }; + 2DF67CE2184F9CBE00B83A3D /* debug_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DF67CDD184F9CBE00B83A3D /* debug_private.c */; }; + 2DF67CE3184F9CBE00B83A3D /* debug_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DF67CDD184F9CBE00B83A3D /* debug_private.c */; }; + 2DF67CE4184F9CBE00B83A3D /* debug_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DF67CDD184F9CBE00B83A3D /* debug_private.c */; }; + 2DF67CE5184F9CBE00B83A3D /* debug_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DF67CDD184F9CBE00B83A3D /* debug_private.c */; }; + 2DF67CE6184F9CBE00B83A3D /* debug_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DF67CDD184F9CBE00B83A3D /* debug_private.c */; }; 3F169A3E1643B7BA0029E851 /* memccpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F169A3C1643B7BA0029E851 /* memccpy_chk.c */; }; 3F18DE21162A732C008B15AC /* memset_s.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F18DE20162A732C008B15AC /* memset_s.c */; }; 3F267F38163FC8880089A0A6 /* rb.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F267F36163FC8880089A0A6 /* rb.c */; }; @@ -108,6 +108,7 @@ B1261400158818EC0077E3CC /* xprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = B12613F7158818EC0077E3CC /* xprintf.c */; settings = {COMPILER_FLAGS = "-I$(SRCROOT)/stdio"; }; }; B126140515881A000077E3CC /* xprintf_comp.c in Sources */ = {isa = PBXBuildFile; fileRef = B126140215881A000077E3CC /* xprintf_comp.c */; settings = {COMPILER_FLAGS = "-I$(SRCROOT)/stdio/FreeBSD"; }; }; B126140615881A000077E3CC /* xprintf_domain.c in Sources */ = {isa = PBXBuildFile; fileRef = B126140315881A000077E3CC /* xprintf_domain.c */; settings = {COMPILER_FLAGS = "-I$(SRCROOT)/stdio/FreeBSD"; }; }; + B17726CD185A9AD600668DCA /* wordexp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53808138D9E990028D27C /* wordexp.c */; }; B1795373158B0E35008990E8 /* xprintf_all_in_one.c in Sources */ = {isa = PBXBuildFile; fileRef = B1795371158B0E35008990E8 /* xprintf_all_in_one.c */; settings = {COMPILER_FLAGS = "-I$(SRCROOT)/stdio/FreeBSD"; }; }; B1795374158B0E35008990E8 /* xprintf_exec.c in Sources */ = {isa = PBXBuildFile; fileRef = B1795372158B0E35008990E8 /* xprintf_exec.c */; settings = {COMPILER_FLAGS = "-I$(SRCROOT)/stdio/FreeBSD"; }; }; B19C645C1450F90200032373 /* sync_volume_np.c in Sources */ = {isa = PBXBuildFile; fileRef = B19C645B1450F90200032373 /* sync_volume_np.c */; }; @@ -511,7 +512,6 @@ C942104213900C8A004BA536 /* setreuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360B138D9E980028D27C /* setreuid.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SETREUID"; }; }; C942104313900C8A004BA536 /* sigaltstk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360C138D9E980028D27C /* sigaltstk.c */; }; C942104413900C8A004BA536 /* sigcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360E138D9E980028D27C /* sigcompat.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SIGPAUSE"; }; }; - C942104513900C8A004BA536 /* _dirhelper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53613138D9E980028D27C /* _dirhelper.c */; }; C942104613900C8A004BA536 /* kvm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53616138D9E980028D27C /* kvm.c */; }; C942104A13900C8A004BA536 /* forceLibcToBuild.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */; }; C942104B13900C8A004BA536 /* bt_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53620138D9E980028D27C /* bt_close.c */; }; @@ -672,7 +672,6 @@ C94210F413900C8A004BA536 /* utmpx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E4138D9E990028D27C /* utmpx.c */; }; C94210F513900C8A004BA536 /* nftw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E6138D9E990028D27C /* nftw.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_FTW -DLIBC_ALIAS_NFTW"; }; }; C94210F613900C8A004BA536 /* nlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E8138D9E990028D27C /* nlist.c */; }; - C94210F713900C8A004BA536 /* NSSystemDirectories.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E9138D9E990028D27C /* NSSystemDirectories.c */; }; C94210F813900C8A004BA536 /* oldsyslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EA138D9E990028D27C /* oldsyslog.c */; }; C94210FB13900C8A004BA536 /* setlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F2138D9E990028D27C /* setlogin.c */; }; C94210FC13900C8A004BA536 /* sigsetops.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F4138D9E990028D27C /* sigsetops.c */; }; @@ -989,7 +988,7 @@ C942128D13900C8A004BA536 /* wmemcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8D138D9E9A0028D27C /* wmemcpy.c */; }; C942128E13900C8A004BA536 /* wmemmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8E138D9E9A0028D27C /* wmemmove.c */; }; C942128F13900C8A004BA536 /* wmemset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8F138D9E9A0028D27C /* wmemset.c */; }; - C942129013900C8A004BA536 /* __libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* __libc_init.c */; }; + C942129013900C8A004BA536 /* _libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* _libc_init.c */; }; C942129113900C8A004BA536 /* _libc_fork_child.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */; }; C942129213900C8A004BA536 /* chmodx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D99138D9E9A0028D27C /* chmodx_np.c */; }; C942129413900C8A004BA536 /* crt_externs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9C138D9E9A0028D27C /* crt_externs.c */; }; @@ -1025,7 +1024,6 @@ C94212BA13900C8A004BA536 /* unpack.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE2138D9E9A0028D27C /* unpack.c */; }; C94212BB13900C8A004BA536 /* unparse.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE3138D9E9A0028D27C /* unparse.c */; }; C94212C613900C8A004BA536 /* scandir_b.c in Sources */ = {isa = PBXBuildFile; fileRef = C9EB350E138F769B0075BB52 /* scandir_b.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -include gen/__dirent.h"; }; }; - C94212D113900ED1004BA536 /* dirhelper.defs in Sources */ = {isa = PBXBuildFile; fileRef = C9B53614138D9E980028D27C /* dirhelper.defs */; }; C94212E413901595004BA536 /* mcount.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF9138D9E9A0028D27C /* mcount.s */; }; C94212FA13901595004BA536 /* strcpy.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E17138D9E9A0028D27C /* strcpy.s */; }; C94212FD13901595004BA536 /* strlen.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E1A138D9E9A0028D27C /* strlen.s */; }; @@ -1053,7 +1051,6 @@ C95B7EED138F3C55004311DA /* setreuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360B138D9E980028D27C /* setreuid.c */; }; C95B7EEE138F3C55004311DA /* sigaltstk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360C138D9E980028D27C /* sigaltstk.c */; }; C95B7EEF138F3C55004311DA /* sigcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360E138D9E980028D27C /* sigcompat.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SIGPAUSE"; }; }; - C95B7EF0138F3C55004311DA /* _dirhelper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53613138D9E980028D27C /* _dirhelper.c */; }; C95B7EF1138F3C55004311DA /* kvm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53616138D9E980028D27C /* kvm.c */; }; C95B7EF5138F3C55004311DA /* forceLibcToBuild.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */; }; C95B7EF6138F3C55004311DA /* bt_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53620138D9E980028D27C /* bt_close.c */; }; @@ -1214,7 +1211,6 @@ C95B7F9F138F3C55004311DA /* utmpx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E4138D9E990028D27C /* utmpx.c */; }; C95B7FA0138F3C55004311DA /* nftw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E6138D9E990028D27C /* nftw.c */; }; C95B7FA1138F3C55004311DA /* nlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E8138D9E990028D27C /* nlist.c */; }; - C95B7FA2138F3C55004311DA /* NSSystemDirectories.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E9138D9E990028D27C /* NSSystemDirectories.c */; }; C95B7FA3138F3C55004311DA /* oldsyslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EA138D9E990028D27C /* oldsyslog.c */; }; C95B7FA6138F3C55004311DA /* setlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F2138D9E990028D27C /* setlogin.c */; }; C95B7FA7138F3C55004311DA /* sigsetops.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F4138D9E990028D27C /* sigsetops.c */; }; @@ -1531,7 +1527,7 @@ C95B8138138F3C55004311DA /* wmemcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8D138D9E9A0028D27C /* wmemcpy.c */; }; C95B8139138F3C55004311DA /* wmemmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8E138D9E9A0028D27C /* wmemmove.c */; }; C95B813A138F3C55004311DA /* wmemset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8F138D9E9A0028D27C /* wmemset.c */; }; - C95B813B138F3C55004311DA /* __libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* __libc_init.c */; }; + C95B813B138F3C55004311DA /* _libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* _libc_init.c */; }; C95B813C138F3C55004311DA /* _libc_fork_child.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */; }; C95B813D138F3C55004311DA /* chmodx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D99138D9E9A0028D27C /* chmodx_np.c */; }; C95B813F138F3C55004311DA /* crt_externs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9C138D9E9A0028D27C /* crt_externs.c */; }; @@ -1579,7 +1575,6 @@ C95B8198138F52B0004311DA /* setreuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360B138D9E980028D27C /* setreuid.c */; }; C95B8199138F52B0004311DA /* sigaltstk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360C138D9E980028D27C /* sigaltstk.c */; }; C95B819A138F52B0004311DA /* sigcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360E138D9E980028D27C /* sigcompat.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SIGPAUSE"; }; }; - C95B819B138F52B0004311DA /* _dirhelper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53613138D9E980028D27C /* _dirhelper.c */; }; C95B819C138F52B0004311DA /* kvm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53616138D9E980028D27C /* kvm.c */; }; C95B81A0138F52B0004311DA /* forceLibcToBuild.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */; }; C95B81A1138F52B0004311DA /* bt_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53620138D9E980028D27C /* bt_close.c */; }; @@ -1740,7 +1735,6 @@ C95B824A138F52B0004311DA /* utmpx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E4138D9E990028D27C /* utmpx.c */; }; C95B824B138F52B0004311DA /* nftw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E6138D9E990028D27C /* nftw.c */; }; C95B824C138F52B0004311DA /* nlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E8138D9E990028D27C /* nlist.c */; }; - C95B824D138F52B0004311DA /* NSSystemDirectories.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E9138D9E990028D27C /* NSSystemDirectories.c */; }; C95B824E138F52B0004311DA /* oldsyslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EA138D9E990028D27C /* oldsyslog.c */; }; C95B8251138F52B0004311DA /* setlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F2138D9E990028D27C /* setlogin.c */; }; C95B8252138F52B0004311DA /* sigsetops.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F4138D9E990028D27C /* sigsetops.c */; }; @@ -2057,7 +2051,7 @@ C95B83E3138F52B0004311DA /* wmemcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8D138D9E9A0028D27C /* wmemcpy.c */; }; C95B83E4138F52B0004311DA /* wmemmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8E138D9E9A0028D27C /* wmemmove.c */; }; C95B83E5138F52B0004311DA /* wmemset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8F138D9E9A0028D27C /* wmemset.c */; }; - C95B83E6138F52B0004311DA /* __libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* __libc_init.c */; }; + C95B83E6138F52B0004311DA /* _libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* _libc_init.c */; }; C95B83E7138F52B0004311DA /* _libc_fork_child.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */; }; C95B83E8138F52B0004311DA /* chmodx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D99138D9E9A0028D27C /* chmodx_np.c */; }; C95B83EA138F52B0004311DA /* crt_externs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9C138D9E9A0028D27C /* crt_externs.c */; }; @@ -2105,7 +2099,6 @@ C95B843E138F53DB004311DA /* setreuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360B138D9E980028D27C /* setreuid.c */; }; C95B843F138F53DB004311DA /* sigaltstk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360C138D9E980028D27C /* sigaltstk.c */; }; C95B8440138F53DB004311DA /* sigcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360E138D9E980028D27C /* sigcompat.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SIGPAUSE"; }; }; - C95B8441138F53DB004311DA /* _dirhelper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53613138D9E980028D27C /* _dirhelper.c */; }; C95B8442138F53DB004311DA /* kvm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53616138D9E980028D27C /* kvm.c */; }; C95B8446138F53DB004311DA /* forceLibcToBuild.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */; }; C95B8447138F53DB004311DA /* bt_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53620138D9E980028D27C /* bt_close.c */; }; @@ -2266,7 +2259,6 @@ C95B84F0138F53DB004311DA /* utmpx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E4138D9E990028D27C /* utmpx.c */; }; C95B84F1138F53DB004311DA /* nftw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E6138D9E990028D27C /* nftw.c */; }; C95B84F2138F53DB004311DA /* nlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E8138D9E990028D27C /* nlist.c */; }; - C95B84F3138F53DB004311DA /* NSSystemDirectories.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E9138D9E990028D27C /* NSSystemDirectories.c */; }; C95B84F4138F53DB004311DA /* oldsyslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EA138D9E990028D27C /* oldsyslog.c */; }; C95B84F7138F53DB004311DA /* setlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F2138D9E990028D27C /* setlogin.c */; }; C95B84F8138F53DB004311DA /* sigsetops.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F4138D9E990028D27C /* sigsetops.c */; }; @@ -2583,7 +2575,7 @@ C95B8689138F53DB004311DA /* wmemcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8D138D9E9A0028D27C /* wmemcpy.c */; }; C95B868A138F53DB004311DA /* wmemmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8E138D9E9A0028D27C /* wmemmove.c */; }; C95B868B138F53DB004311DA /* wmemset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8F138D9E9A0028D27C /* wmemset.c */; }; - C95B868C138F53DB004311DA /* __libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* __libc_init.c */; }; + C95B868C138F53DB004311DA /* _libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* _libc_init.c */; }; C95B868D138F53DB004311DA /* _libc_fork_child.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */; }; C95B868E138F53DB004311DA /* chmodx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D99138D9E9A0028D27C /* chmodx_np.c */; }; C95B8690138F53DB004311DA /* crt_externs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9C138D9E9A0028D27C /* crt_externs.c */; }; @@ -2632,7 +2624,6 @@ C9765EC2138EC61900741512 /* setreuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360B138D9E980028D27C /* setreuid.c */; }; C9765EC3138EC61900741512 /* sigaltstk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360C138D9E980028D27C /* sigaltstk.c */; }; C9765EC4138EC61900741512 /* sigcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360E138D9E980028D27C /* sigcompat.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SIGPAUSE"; }; }; - C9765EC5138EC61900741512 /* _dirhelper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53613138D9E980028D27C /* _dirhelper.c */; }; C9765EC6138EC61900741512 /* kvm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53616138D9E980028D27C /* kvm.c */; }; C9765ECA138EC61900741512 /* forceLibcToBuild.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */; }; C9765ECB138EC61900741512 /* bt_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53620138D9E980028D27C /* bt_close.c */; }; @@ -2793,7 +2784,6 @@ C9765F74138EC61900741512 /* utmpx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E4138D9E990028D27C /* utmpx.c */; }; C9765F75138EC61900741512 /* nftw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E6138D9E990028D27C /* nftw.c */; }; C9765F76138EC61900741512 /* nlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E8138D9E990028D27C /* nlist.c */; }; - C9765F77138EC61900741512 /* NSSystemDirectories.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E9138D9E990028D27C /* NSSystemDirectories.c */; }; C9765F78138EC61900741512 /* oldsyslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EA138D9E990028D27C /* oldsyslog.c */; }; C9765F7B138EC61900741512 /* setlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F2138D9E990028D27C /* setlogin.c */; }; C9765F7C138EC61900741512 /* sigsetops.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F4138D9E990028D27C /* sigsetops.c */; }; @@ -3110,7 +3100,7 @@ C976610D138EC61A00741512 /* wmemcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8D138D9E9A0028D27C /* wmemcpy.c */; }; C976610E138EC61A00741512 /* wmemmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8E138D9E9A0028D27C /* wmemmove.c */; }; C976610F138EC61A00741512 /* wmemset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8F138D9E9A0028D27C /* wmemset.c */; }; - C9766110138EC61A00741512 /* __libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* __libc_init.c */; }; + C9766110138EC61A00741512 /* _libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* _libc_init.c */; }; C9766111138EC61A00741512 /* _libc_fork_child.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */; }; C9766112138EC61A00741512 /* chmodx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D99138D9E9A0028D27C /* chmodx_np.c */; }; C9766114138EC61A00741512 /* crt_externs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9C138D9E9A0028D27C /* crt_externs.c */; }; @@ -3159,7 +3149,6 @@ C97A6F791517AF53005E1998 /* (null) in Sources */ = {isa = PBXBuildFile; }; C97A6F7A1517AF53005E1998 /* (null) in Sources */ = {isa = PBXBuildFile; }; C97A6F7E1517AF53005E1998 /* (null) in Sources */ = {isa = PBXBuildFile; }; - C97A6F8D1517AF53005E1998 /* dirhelper.defs in Sources */ = {isa = PBXBuildFile; fileRef = C9B53614138D9E980028D27C /* dirhelper.defs */; }; C97A6F8F1517AF53005E1998 /* init_cpu_capabilities.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535B6138D9E980028D27C /* init_cpu_capabilities.c */; }; C97A6F961517AF53005E1998 /* creat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535F8138D9E980028D27C /* creat.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_CREAT"; }; }; C97A6F971517AF53005E1998 /* gethostid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535FC138D9E980028D27C /* gethostid.c */; }; @@ -3173,7 +3162,6 @@ C97A6F9F1517AF53005E1998 /* setreuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360B138D9E980028D27C /* setreuid.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SETREUID"; }; }; C97A6FA01517AF53005E1998 /* sigaltstk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360C138D9E980028D27C /* sigaltstk.c */; }; C97A6FA11517AF53005E1998 /* sigcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360E138D9E980028D27C /* sigcompat.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SIGPAUSE"; }; }; - C97A6FA21517AF53005E1998 /* _dirhelper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53613138D9E980028D27C /* _dirhelper.c */; }; C97A6FA31517AF53005E1998 /* kvm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53616138D9E980028D27C /* kvm.c */; }; C97A6FA71517AF53005E1998 /* forceLibcToBuild.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */; }; C97A6FA81517AF53005E1998 /* bt_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53620138D9E980028D27C /* bt_close.c */; }; @@ -3334,7 +3322,6 @@ C97A70511517AF53005E1998 /* utmpx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E4138D9E990028D27C /* utmpx.c */; }; C97A70521517AF53005E1998 /* nftw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E6138D9E990028D27C /* nftw.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_FTW -DLIBC_ALIAS_NFTW"; }; }; C97A70531517AF53005E1998 /* nlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E8138D9E990028D27C /* nlist.c */; }; - C97A70541517AF53005E1998 /* NSSystemDirectories.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E9138D9E990028D27C /* NSSystemDirectories.c */; }; C97A70551517AF53005E1998 /* oldsyslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EA138D9E990028D27C /* oldsyslog.c */; }; C97A70581517AF53005E1998 /* setlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F2138D9E990028D27C /* setlogin.c */; }; C97A70591517AF53005E1998 /* sigsetops.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F4138D9E990028D27C /* sigsetops.c */; }; @@ -3665,7 +3652,7 @@ C97A71C31517AF53005E1998 /* wmemcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8D138D9E9A0028D27C /* wmemcpy.c */; }; C97A71C41517AF53005E1998 /* wmemmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8E138D9E9A0028D27C /* wmemmove.c */; }; C97A71C51517AF53005E1998 /* wmemset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8F138D9E9A0028D27C /* wmemset.c */; }; - C97A71C61517AF53005E1998 /* __libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* __libc_init.c */; }; + C97A71C61517AF53005E1998 /* _libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* _libc_init.c */; }; C97A71C71517AF53005E1998 /* _libc_fork_child.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */; }; C97A71C81517AF53005E1998 /* chmodx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D99138D9E9A0028D27C /* chmodx_np.c */; }; C97A71CA1517AF53005E1998 /* crt_externs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9C138D9E9A0028D27C /* crt_externs.c */; }; @@ -3767,8 +3754,6 @@ C9B53E7C138DA59F0028D27C /* strncpy.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E1C138D9E9A0028D27C /* strncpy.s */; }; C9C2A959138E025700287F00 /* sigaltstk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360C138D9E980028D27C /* sigaltstk.c */; }; C9C2A95A138E025700287F00 /* sigcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360E138D9E980028D27C /* sigcompat.c */; }; - C9C2A95B138E03C700287F00 /* _dirhelper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53613138D9E980028D27C /* _dirhelper.c */; }; - C9C2A95C138E03C700287F00 /* dirhelper.defs in Sources */ = {isa = PBXBuildFile; fileRef = C9B53614138D9E980028D27C /* dirhelper.defs */; }; C9C2A97D138E058200287F00 /* brk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5366E138D9E980028D27C /* brk.c */; }; C9C2A97E138E058200287F00 /* bsd_signal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53670138D9E980028D27C /* bsd_signal.c */; }; C9C2A97F138E058200287F00 /* lchflags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53672138D9E980028D27C /* lchflags.c */; }; @@ -3797,7 +3782,6 @@ C9C2A9BE138E072600287F00 /* thread_stack_pcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53800138D9E990028D27C /* thread_stack_pcs.c */; }; C9C2A9BF138E072600287F00 /* uname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53803138D9E990028D27C /* uname.c */; }; C9C2A9C0138E072600287F00 /* utmpx-darwin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53804138D9E990028D27C /* utmpx-darwin.c */; }; - C9C2A9C1138E072600287F00 /* wordexp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53808138D9E990028D27C /* wordexp.c */; }; C9D94333138DB75B00FB7ACC /* forceLibcToBuild.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */; }; C9D94359138EC0C600FB7ACC /* heapsort_b.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D94357138EC0C600FB7ACC /* heapsort_b.c */; }; C9D9435A138EC0C600FB7ACC /* heapsort_r.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D94358138EC0C600FB7ACC /* heapsort_r.c */; }; @@ -3811,7 +3795,6 @@ C9EB2F99138F68CB0075BB52 /* strlen.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535CF138D9E980028D27C /* strlen.s */; }; C9EB2F9C138F68CB0075BB52 /* strnlen.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D2138D9E980028D27C /* strnlen.s */; }; C9EB2F9D138F68CB0075BB52 /* strstr.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D3138D9E980028D27C /* strstr.s */; }; - C9EB2FBB138F6A920075BB52 /* NSSystemDirectories.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E9138D9E990028D27C /* NSSystemDirectories.c */; }; C9EB2FC1138F6BB00075BB52 /* merge_b.c in Sources */ = {isa = PBXBuildFile; fileRef = C9EB2FC0138F6BB00075BB52 /* merge_b.c */; }; C9EB2FC4138F6C5C0075BB52 /* psort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9EB2FC3138F6C5C0075BB52 /* psort.c */; }; C9EB2FC7138F6CE10075BB52 /* psort_b.c in Sources */ = {isa = PBXBuildFile; fileRef = C9EB2FC5138F6CE10075BB52 /* psort_b.c */; settings = {COMPILER_FLAGS = "-DI_AM_PSORT_B"; }; }; @@ -3829,7 +3812,6 @@ C9EB2FDD138F6D880075BB52 /* setreuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360B138D9E980028D27C /* setreuid.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SETREUID"; }; }; C9EB2FDE138F6D880075BB52 /* sigaltstk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360C138D9E980028D27C /* sigaltstk.c */; }; C9EB2FDF138F6D880075BB52 /* sigcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360E138D9E980028D27C /* sigcompat.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SIGPAUSE"; }; }; - C9EB2FE0138F6D880075BB52 /* _dirhelper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53613138D9E980028D27C /* _dirhelper.c */; }; C9EB2FE1138F6D880075BB52 /* kvm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53616138D9E980028D27C /* kvm.c */; }; C9EB2FE5138F6D880075BB52 /* forceLibcToBuild.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */; }; C9EB2FE6138F6D880075BB52 /* bt_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53620138D9E980028D27C /* bt_close.c */; }; @@ -3990,7 +3972,6 @@ C9EB308F138F6D880075BB52 /* utmpx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E4138D9E990028D27C /* utmpx.c */; }; C9EB3090138F6D880075BB52 /* nftw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E6138D9E990028D27C /* nftw.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_FTW -DLIBC_ALIAS_NFTW"; }; }; C9EB3091138F6D880075BB52 /* nlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E8138D9E990028D27C /* nlist.c */; }; - C9EB3092138F6D880075BB52 /* NSSystemDirectories.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E9138D9E990028D27C /* NSSystemDirectories.c */; }; C9EB3093138F6D880075BB52 /* oldsyslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EA138D9E990028D27C /* oldsyslog.c */; }; C9EB3096138F6D880075BB52 /* setlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F2138D9E990028D27C /* setlogin.c */; }; C9EB3097138F6D880075BB52 /* sigsetops.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F4138D9E990028D27C /* sigsetops.c */; }; @@ -4307,7 +4288,7 @@ C9EB3228138F6D880075BB52 /* wmemcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8D138D9E9A0028D27C /* wmemcpy.c */; }; C9EB3229138F6D880075BB52 /* wmemmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8E138D9E9A0028D27C /* wmemmove.c */; }; C9EB322A138F6D880075BB52 /* wmemset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8F138D9E9A0028D27C /* wmemset.c */; }; - C9EB322B138F6D880075BB52 /* __libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* __libc_init.c */; }; + C9EB322B138F6D880075BB52 /* _libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* _libc_init.c */; }; C9EB322C138F6D880075BB52 /* _libc_fork_child.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */; }; C9EB322D138F6D880075BB52 /* chmodx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D99138D9E9A0028D27C /* chmodx_np.c */; }; C9EB322F138F6D880075BB52 /* crt_externs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9C138D9E9A0028D27C /* crt_externs.c */; }; @@ -4355,7 +4336,6 @@ C9EB3284138F75580075BB52 /* setreuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360B138D9E980028D27C /* setreuid.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SETREUID"; }; }; C9EB3285138F75580075BB52 /* sigaltstk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360C138D9E980028D27C /* sigaltstk.c */; }; C9EB3286138F75580075BB52 /* sigcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360E138D9E980028D27C /* sigcompat.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SIGPAUSE"; }; }; - C9EB3287138F75580075BB52 /* _dirhelper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53613138D9E980028D27C /* _dirhelper.c */; }; C9EB3288138F75580075BB52 /* kvm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53616138D9E980028D27C /* kvm.c */; }; C9EB328C138F75580075BB52 /* forceLibcToBuild.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */; }; C9EB328D138F75580075BB52 /* bt_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53620138D9E980028D27C /* bt_close.c */; }; @@ -4516,7 +4496,6 @@ C9EB3336138F75580075BB52 /* utmpx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E4138D9E990028D27C /* utmpx.c */; }; C9EB3337138F75580075BB52 /* nftw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E6138D9E990028D27C /* nftw.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_FTW -DLIBC_ALIAS_NFTW"; }; }; C9EB3338138F75580075BB52 /* nlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E8138D9E990028D27C /* nlist.c */; }; - C9EB3339138F75580075BB52 /* NSSystemDirectories.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E9138D9E990028D27C /* NSSystemDirectories.c */; }; C9EB333A138F75580075BB52 /* oldsyslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EA138D9E990028D27C /* oldsyslog.c */; }; C9EB333D138F75580075BB52 /* setlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F2138D9E990028D27C /* setlogin.c */; }; C9EB333E138F75580075BB52 /* sigsetops.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F4138D9E990028D27C /* sigsetops.c */; }; @@ -4833,7 +4812,7 @@ C9EB34CF138F75580075BB52 /* wmemcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8D138D9E9A0028D27C /* wmemcpy.c */; }; C9EB34D0138F75580075BB52 /* wmemmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8E138D9E9A0028D27C /* wmemmove.c */; }; C9EB34D1138F75580075BB52 /* wmemset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8F138D9E9A0028D27C /* wmemset.c */; }; - C9EB34D2138F75580075BB52 /* __libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* __libc_init.c */; }; + C9EB34D2138F75580075BB52 /* _libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* _libc_init.c */; }; C9EB34D3138F75580075BB52 /* _libc_fork_child.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */; }; C9EB34D4138F75580075BB52 /* chmodx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D99138D9E9A0028D27C /* chmodx_np.c */; }; C9EB34D6138F75580075BB52 /* crt_externs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9C138D9E9A0028D27C /* crt_externs.c */; }; @@ -4875,9 +4854,10 @@ C9EB3550138F7EA50075BB52 /* getmntinfo64.c in Sources */ = {isa = PBXBuildFile; fileRef = C9EB354F138F7EA50075BB52 /* getmntinfo64.c */; }; C9EB3558138F7FF40075BB52 /* nlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E8138D9E990028D27C /* nlist.c */; }; C9EB355C138F81A40075BB52 /* kvm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53616138D9E980028D27C /* kvm.c */; }; + C9ECE2771950E384008E8672 /* atexit_receipt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9ECE2761950E384008E8672 /* atexit_receipt.c */; }; C9FA32F4138E49550089A94B /* abort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C1D138D9E9A0028D27C /* abort.c */; }; C9FA32F9138E4A5C0089A94B /* utf2.c in Sources */ = {isa = PBXBuildFile; fileRef = C9FA32F8138E4A5C0089A94B /* utf2.c */; }; - C9FA32FB138E4BD00089A94B /* __libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* __libc_init.c */; }; + C9FA32FB138E4BD00089A94B /* _libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* _libc_init.c */; }; C9FA32FC138E4BD00089A94B /* _libc_fork_child.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */; }; C9FA32FD138E4BD00089A94B /* chmodx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D99138D9E9A0028D27C /* chmodx_np.c */; }; C9FA32FF138E4BD00089A94B /* crt_externs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9C138D9E9A0028D27C /* crt_externs.c */; }; @@ -5103,9 +5083,9 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 2B350EC1158FDC7600A58CD2 /* base.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = base.h; path = os/base.h; sourceTree = ""; }; - 2B9D61B5157D667000AF25B8 /* trace.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = trace.c; path = os/trace.c; sourceTree = ""; }; 2B9D61B6157D667000AF25B8 /* trace.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = trace.h; path = os/trace.h; sourceTree = ""; }; + 2DF67CDD184F9CBE00B83A3D /* debug_private.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = debug_private.c; path = os/debug_private.c; sourceTree = ""; }; + 2DF67CE7184F9CD000B83A3D /* debug_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = debug_private.h; path = os/debug_private.h; sourceTree = ""; }; 3F169A3C1643B7BA0029E851 /* memccpy_chk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = memccpy_chk.c; sourceTree = ""; }; 3F18DE1F162A732C008B15AC /* memset_s.3 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = memset_s.3; sourceTree = ""; }; 3F18DE20162A732C008B15AC /* memset_s.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = memset_s.c; sourceTree = ""; }; @@ -5182,7 +5162,6 @@ C9257ED0138E1B5000B3107C /* libFreeBSD.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libFreeBSD.a; sourceTree = BUILT_PRODUCTS_DIR; }; C9258105138E2D3100B3107C /* libNetBSD.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libNetBSD.a; sourceTree = BUILT_PRODUCTS_DIR; }; C925D1FB151805C6003D315B /* eos_stubs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = eos_stubs.c; sourceTree = ""; }; - C9265D1113B1CF970090BA1C /* clean_simulator.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = clean_simulator.sh; sourceTree = ""; }; C93D6150143D31E300EB9023 /* sanitise_headers.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = sanitise_headers.sh; sourceTree = ""; }; C94212CC13900C8A004BA536 /* libc.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libc.a; sourceTree = BUILT_PRODUCTS_DIR; }; C942135913904CBC004BA536 /* manpages.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = manpages.sh; sourceTree = ""; }; @@ -5224,9 +5203,6 @@ C9B5360F138D9E980028D27C /* sigpause.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sigpause.2; sourceTree = ""; }; C9B53610138D9E980028D27C /* sigsetmask.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sigsetmask.2; sourceTree = ""; }; C9B53611138D9E980028D27C /* sigvec.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sigvec.2; sourceTree = ""; }; - C9B53613138D9E980028D27C /* _dirhelper.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _dirhelper.c; sourceTree = ""; }; - C9B53614138D9E980028D27C /* dirhelper.defs */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.mig; path = dirhelper.defs; sourceTree = ""; }; - C9B53615138D9E980028D27C /* dirhelper_priv.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dirhelper_priv.h; sourceTree = ""; }; C9B53616138D9E980028D27C /* kvm.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = kvm.c; sourceTree = ""; }; C9B53620138D9E980028D27C /* bt_close.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_close.c; sourceTree = ""; }; C9B53621138D9E980028D27C /* bt_conv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_conv.c; sourceTree = ""; }; @@ -5288,7 +5264,6 @@ C9B5367D138D9E980028D27C /* _fbsd_compat_.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _fbsd_compat_.h; sourceTree = ""; }; C9B5367E138D9E980028D27C /* _fpmath.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _fpmath.h; sourceTree = ""; }; C9B5367F138D9E980028D27C /* fpmath.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fpmath.h; sourceTree = ""; }; - C9B53680138D9E980028D27C /* libc_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libc_private.h; sourceTree = ""; }; C9B53682138D9E980028D27C /* atomic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = atomic.h; sourceTree = ""; }; C9B53683138D9E980028D27C /* namespace.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = namespace.h; sourceTree = ""; }; C9B53684138D9E980028D27C /* port_after.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = port_after.h; sourceTree = ""; }; @@ -5500,7 +5475,6 @@ C9B537E6138D9E990028D27C /* nftw.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nftw.c; sourceTree = ""; }; C9B537E7138D9E990028D27C /* nlist.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = nlist.3; sourceTree = ""; }; C9B537E8138D9E990028D27C /* nlist.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nlist.c; sourceTree = ""; }; - C9B537E9138D9E990028D27C /* NSSystemDirectories.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = NSSystemDirectories.c; sourceTree = ""; }; C9B537EA138D9E990028D27C /* oldsyslog.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = oldsyslog.c; sourceTree = ""; }; C9B537ED138D9E990028D27C /* posix_memalign.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = posix_memalign.3; sourceTree = ""; }; C9B537EE138D9E990028D27C /* pwcache.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pwcache.3; sourceTree = ""; }; @@ -5531,7 +5505,6 @@ C9B53840138D9E990028D27C /* strlen.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strlen.s; sourceTree = ""; }; C9B53842138D9E990028D27C /* strncpy.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strncpy.s; sourceTree = ""; }; C9B53850138D9E990028D27C /* _locale.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _locale.h; sourceTree = ""; }; - C9B53851138D9E990028D27C /* _structs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _structs.h; sourceTree = ""; }; C9B53852138D9E990028D27C /* _types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _types.h; sourceTree = ""; }; C9B53853138D9E990028D27C /* _wctype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _wctype.h; sourceTree = ""; }; C9B53854138D9E990028D27C /* _xlocale.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _xlocale.h; sourceTree = ""; }; @@ -5547,7 +5520,6 @@ C9B53861138D9E990028D27C /* authentication.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = authentication.h; sourceTree = ""; }; C9B53862138D9E990028D27C /* bitstring.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bitstring.h; sourceTree = ""; }; C9B53863138D9E990028D27C /* cpio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cpio.h; sourceTree = ""; }; - C9B53864138D9E990028D27C /* CrashReporterClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CrashReporterClient.h; sourceTree = ""; }; C9B53865138D9E990028D27C /* crt_externs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = crt_externs.h; sourceTree = ""; }; C9B53866138D9E990028D27C /* ctype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ctype.h; sourceTree = ""; }; C9B53867138D9E990028D27C /* db.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = db.h; sourceTree = ""; }; @@ -5571,7 +5543,6 @@ C9B5387C138D9E990028D27C /* langinfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = langinfo.h; sourceTree = ""; }; C9B5387D138D9E990028D27C /* libc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libc.h; sourceTree = ""; }; C9B5387E138D9E990028D27C /* libgen.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libgen.h; sourceTree = ""; }; - C9B53883138D9E990028D27C /* OSMemoryNotification.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSMemoryNotification.h; sourceTree = ""; }; C9B53884138D9E990028D27C /* OSThermalNotification.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSThermalNotification.h; sourceTree = ""; }; C9B53885138D9E990028D27C /* limits.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = limits.h; sourceTree = ""; }; C9B53886138D9E990028D27C /* locale.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = locale.h; sourceTree = ""; }; @@ -5582,7 +5553,6 @@ C9B5388F138D9E990028D27C /* ndbm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ndbm.h; sourceTree = ""; }; C9B53891138D9E990028D27C /* utmpx.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = utmpx.h; sourceTree = ""; }; C9B53893138D9E990028D27C /* nlist.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = nlist.h; sourceTree = ""; }; - C9B53894138D9E990028D27C /* NSSystemDirectories.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSSystemDirectories.h; sourceTree = ""; }; C9B53899138D9E990028D27C /* paths.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = paths.h; sourceTree = ""; }; C9B5389A138D9E990028D27C /* poll.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = poll.h; sourceTree = ""; }; C9B5389D138D9E990028D27C /* routed.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = routed.h; sourceTree = ""; }; @@ -6238,7 +6208,7 @@ C9B53D8F138D9E9A0028D27C /* wmemset.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wmemset.c; sourceTree = ""; }; C9B53D91138D9E9A0028D27C /* memset_pattern.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = memset_pattern.3; sourceTree = ""; }; C9B53D92138D9E9A0028D27C /* strip-header.ed */ = {isa = PBXFileReference; lastKnownFileType = text; path = "strip-header.ed"; sourceTree = ""; }; - C9B53D94138D9E9A0028D27C /* __libc_init.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = __libc_init.c; sourceTree = ""; }; + C9B53D94138D9E9A0028D27C /* _libc_init.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _libc_init.c; sourceTree = ""; }; C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _libc_fork_child.c; sourceTree = ""; }; C9B53D99138D9E9A0028D27C /* chmodx_np.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = chmodx_np.c; sourceTree = ""; }; C9B53D9C138D9E9A0028D27C /* crt_externs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = crt_externs.c; sourceTree = ""; }; @@ -6311,7 +6281,9 @@ C9EB350D138F75580075BB52 /* libvInode32.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libvInode32.a; sourceTree = BUILT_PRODUCTS_DIR; }; C9EB350E138F769B0075BB52 /* scandir_b.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = scandir_b.c; sourceTree = ""; }; C9EB354F138F7EA50075BB52 /* getmntinfo64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = getmntinfo64.c; sourceTree = ""; }; + C9ECE2761950E384008E8672 /* atexit_receipt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = atexit_receipt.c; sourceTree = ""; }; C9FA32F8138E4A5C0089A94B /* utf2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = utf2.c; sourceTree = ""; }; + E41BEA97178E72E100E348BB /* Libc.order */ = {isa = PBXFileReference; lastKnownFileType = text; path = Libc.order; sourceTree = ""; }; E4A877A6174D82FB000DBB55 /* alias.list */ = {isa = PBXFileReference; lastKnownFileType = text; path = alias.list; sourceTree = ""; }; FC2ED60E157D4BE70098EC69 /* inet_ntop.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = inet_ntop.c; sourceTree = ""; }; FC2ED60F157D4BE70098EC69 /* inet_pton.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = inet_pton.c; sourceTree = ""; }; @@ -6325,6 +6297,7 @@ FC60BAD716555A4A00033196 /* _uintmax_t.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _uintmax_t.h; sourceTree = ""; }; FC60BAD816555A4A00033196 /* _wctrans_t.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _wctrans_t.h; sourceTree = ""; }; FC60BAD916555A4A00033196 /* _wctype_t.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _wctype_t.h; sourceTree = ""; }; + FC960EF21850F33A005B9A9A /* libc_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libc_private.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -6452,9 +6425,9 @@ 4B2C64A015519B0500342BFA /* os */ = { isa = PBXGroup; children = ( - 2B9D61B5157D667000AF25B8 /* trace.c */, + 2DF67CE7184F9CD000B83A3D /* debug_private.h */, + 2DF67CDD184F9CBE00B83A3D /* debug_private.c */, 2B9D61B6157D667000AF25B8 /* trace.h */, - 2B350EC1158FDC7600A58CD2 /* base.h */, 4B2C64AB15519C3400342BFA /* assumes.h */, 4B2C64A215519BAF00342BFA /* assumes.c */, ); @@ -6644,12 +6617,11 @@ C9B53612138D9E980028D27C /* darwin */ = { isa = PBXGroup; children = ( - C9B53613138D9E980028D27C /* _dirhelper.c */, - C9B53614138D9E980028D27C /* dirhelper.defs */, - C9B53615138D9E980028D27C /* dirhelper_priv.h */, + C9ECE2761950E384008E8672 /* atexit_receipt.c */, C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */, C9B535B6138D9E980028D27C /* init_cpu_capabilities.c */, C9B53616138D9E980028D27C /* kvm.c */, + FC960EF21850F33A005B9A9A /* libc_private.h */, ); path = darwin; sourceTree = ""; @@ -6827,7 +6799,6 @@ C9B5367D138D9E980028D27C /* _fbsd_compat_.h */, C9B5367E138D9E980028D27C /* _fpmath.h */, C9B5367F138D9E980028D27C /* fpmath.h */, - C9B53680138D9E980028D27C /* libc_private.h */, C9B53681138D9E980028D27C /* machine */, C9B53683138D9E980028D27C /* namespace.h */, C9B53684138D9E980028D27C /* port_after.h */, @@ -6946,7 +6917,6 @@ C9B537E6138D9E990028D27C /* nftw.c */, C9B537E7138D9E990028D27C /* nlist.3 */, C9B537E8138D9E990028D27C /* nlist.c */, - C9B537E9138D9E990028D27C /* NSSystemDirectories.c */, C9B537EA138D9E990028D27C /* oldsyslog.c */, C9B537ED138D9E990028D27C /* posix_memalign.3 */, C9B537EE138D9E990028D27C /* pwcache.3 */, @@ -6968,8 +6938,6 @@ C9B53804138D9E990028D27C /* utmpx-darwin.c */, C9B53805138D9E990028D27C /* utmpx-darwin.h */, C9B53806138D9E990028D27C /* utmpx_thread.h */, - C9B53807138D9E990028D27C /* wordexp.3 */, - C9B53808138D9E990028D27C /* wordexp.c */, ); path = gen; sourceTree = ""; @@ -7109,6 +7077,8 @@ C9B537BE138D9E990028D27C /* wait.c */, C9B537C0138D9E990028D27C /* wait3.c */, C9B537C1138D9E990028D27C /* waitpid.c */, + C9B53807138D9E990028D27C /* wordexp.3 */, + C9B53808138D9E990028D27C /* wordexp.c */, ); path = FreeBSD; sourceTree = ""; @@ -7168,7 +7138,6 @@ isa = PBXGroup; children = ( C9B53850138D9E990028D27C /* _locale.h */, - C9B53851138D9E990028D27C /* _structs.h */, FC60BAD016555A4A00033196 /* _types */, C9B53852138D9E990028D27C /* _types.h */, C9B53853138D9E990028D27C /* _wctype.h */, @@ -7182,7 +7151,6 @@ C9B53861138D9E990028D27C /* authentication.h */, C9B53862138D9E990028D27C /* bitstring.h */, C9B53863138D9E990028D27C /* cpio.h */, - C9B53864138D9E990028D27C /* CrashReporterClient.h */, C9B53865138D9E990028D27C /* crt_externs.h */, C9B53866138D9E990028D27C /* ctype.h */, C9B53867138D9E990028D27C /* db.h */, @@ -7216,7 +7184,6 @@ C9B5388F138D9E990028D27C /* ndbm.h */, C9B53890138D9E990028D27C /* NetBSD */, C9B53893138D9E990028D27C /* nlist.h */, - C9B53894138D9E990028D27C /* NSSystemDirectories.h */, C9B53899138D9E990028D27C /* paths.h */, C9B5389A138D9E990028D27C /* poll.h */, B126140715881A420077E3CC /* printf.h */, @@ -7290,7 +7257,6 @@ C9B5387F138D9E990028D27C /* libkern */ = { isa = PBXGroup; children = ( - C9B53883138D9E990028D27C /* OSMemoryNotification.h */, C9B53884138D9E990028D27C /* OSThermalNotification.h */, ); path = libkern; @@ -8185,7 +8151,7 @@ C9B53D93138D9E9A0028D27C /* sys */ = { isa = PBXGroup; children = ( - C9B53D94138D9E9A0028D27C /* __libc_init.c */, + C9B53D94138D9E9A0028D27C /* _libc_init.c */, C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */, C9B53D99138D9E9A0028D27C /* chmodx_np.c */, C9B53D9C138D9E9A0028D27C /* crt_externs.c */, @@ -8308,13 +8274,13 @@ C9C2A948138DF7DD00287F00 /* libc.xcconfig */, C9766153138ECF0000741512 /* variants.xcconfig */, C9AE91AE1517CDAC00A2626C /* eos.xcconfig */, + E41BEA97178E72E100E348BB /* Libc.order */, C9194B4C140E3BC700BE0C3A /* build_linklists.sh */, C9766150138EC9D400741512 /* patch_headers_variants.pl */, C976616B138EF14100741512 /* generate_features.pl */, C942135913904CBC004BA536 /* manpages.sh */, C9950E6A1390D2CA009863B6 /* headers.sh */, C9B53D92138D9E9A0028D27C /* strip-header.ed */, - C9265D1113B1CF970090BA1C /* clean_simulator.sh */, C965CBF4143BC1BF003912CE /* force_libc_to_build.sh */, C93D6150143D31E300EB9023 /* sanitise_headers.sh */, ); @@ -8547,7 +8513,6 @@ C9D9432B138DB73300FB7ACC /* Sources */, C9D9432C138DB73300FB7ACC /* Frameworks */, C942135B13905EB9004BA536 /* Install Manpages */, - C9265D1313B1CFD10090BA1C /* Clean Simulator Binaries */, C965CBF3143BBFF7003912CE /* Remove deps.c */, C93D6152143D321000EB9023 /* Sanitise Headers (rdar://problem/10241868) */, ); @@ -8713,22 +8678,6 @@ shellPath = /bin/bash; shellScript = ". \"${SCRIPT_INPUT_FILE_0}\""; }; - C9265D1313B1CFD10090BA1C /* Clean Simulator Binaries */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 8; - files = ( - ); - inputPaths = ( - "$(SRCROOT)/xcodescripts/clean_simulator.sh", - ); - name = "Clean Simulator Binaries"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 1; - shellPath = /bin/sh; - shellScript = ". \"${SCRIPT_INPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; C93D6152143D321000EB9023 /* Sanitise Headers (rdar://problem/10241868) */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 8; @@ -9494,6 +9443,7 @@ C925803D138E1CD200B3107C /* wcscmp.c in Sources */, C925803E138E1CD200B3107C /* wcscoll.c in Sources */, C925803F138E1CD200B3107C /* wcscpy.c in Sources */, + B17726CD185A9AD600668DCA /* wordexp.c in Sources */, C9258040138E1CD200B3107C /* wcscspn.c in Sources */, C9258041138E1CD200B3107C /* wcsdup.c in Sources */, C9258042138E1CD200B3107C /* wcslcat.c in Sources */, @@ -9631,7 +9581,6 @@ C94212FA13901595004BA536 /* strcpy.s in Sources */, C94212FD13901595004BA536 /* strlen.s in Sources */, C94212FF13901595004BA536 /* strncpy.s in Sources */, - C94212D113900ED1004BA536 /* dirhelper.defs in Sources */, C942103213900C8A004BA536 /* init_cpu_capabilities.c in Sources */, C942103913900C8A004BA536 /* creat.c in Sources */, C942103A13900C8A004BA536 /* gethostid.c in Sources */, @@ -9645,7 +9594,6 @@ C942104213900C8A004BA536 /* setreuid.c in Sources */, C942104313900C8A004BA536 /* sigaltstk.c in Sources */, C942104413900C8A004BA536 /* sigcompat.c in Sources */, - C942104513900C8A004BA536 /* _dirhelper.c in Sources */, C942104613900C8A004BA536 /* kvm.c in Sources */, C942104A13900C8A004BA536 /* forceLibcToBuild.c in Sources */, C942104B13900C8A004BA536 /* bt_close.c in Sources */, @@ -9807,7 +9755,6 @@ C94210F413900C8A004BA536 /* utmpx.c in Sources */, C94210F513900C8A004BA536 /* nftw.c in Sources */, C94210F613900C8A004BA536 /* nlist.c in Sources */, - C94210F713900C8A004BA536 /* NSSystemDirectories.c in Sources */, C94210F813900C8A004BA536 /* oldsyslog.c in Sources */, C94210FB13900C8A004BA536 /* setlogin.c in Sources */, C94210FC13900C8A004BA536 /* sigsetops.c in Sources */, @@ -9885,6 +9832,7 @@ C942116713900C8A004BA536 /* ascii2addr.c in Sources */, C942116813900C8A004BA536 /* inet_addr.c in Sources */, C942116913900C8A004BA536 /* inet_lnaof.c in Sources */, + 2DF67CDE184F9CBE00B83A3D /* debug_private.c in Sources */, C942116A13900C8A004BA536 /* inet_makeaddr.c in Sources */, C942116B13900C8A004BA536 /* inet_net_ntop.c in Sources */, C942116C13900C8A004BA536 /* inet_net_pton.c in Sources */, @@ -10124,7 +10072,7 @@ C942128D13900C8A004BA536 /* wmemcpy.c in Sources */, C942128E13900C8A004BA536 /* wmemmove.c in Sources */, C942128F13900C8A004BA536 /* wmemset.c in Sources */, - C942129013900C8A004BA536 /* __libc_init.c in Sources */, + C942129013900C8A004BA536 /* _libc_init.c in Sources */, C942129113900C8A004BA536 /* _libc_fork_child.c in Sources */, C942129213900C8A004BA536 /* chmodx_np.c in Sources */, C942129413900C8A004BA536 /* crt_externs.c in Sources */, @@ -10182,7 +10130,6 @@ FC2ED610157D4BE80098EC69 /* inet_ntop.c in Sources */, FC2ED619157D4BE80098EC69 /* inet_pton.c in Sources */, 639D126A15595DDE00D0403A /* strnlen.s in Sources */, - 2B9D61B8157D667600AF25B8 /* trace.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -10203,7 +10150,6 @@ C95B7EED138F3C55004311DA /* setreuid.c in Sources */, C95B7EEE138F3C55004311DA /* sigaltstk.c in Sources */, C95B7EEF138F3C55004311DA /* sigcompat.c in Sources */, - C95B7EF0138F3C55004311DA /* _dirhelper.c in Sources */, C95B7EF1138F3C55004311DA /* kvm.c in Sources */, C95B7EF5138F3C55004311DA /* forceLibcToBuild.c in Sources */, C95B7EF6138F3C55004311DA /* bt_close.c in Sources */, @@ -10364,7 +10310,6 @@ C95B7F9F138F3C55004311DA /* utmpx.c in Sources */, C95B7FA0138F3C55004311DA /* nftw.c in Sources */, C95B7FA1138F3C55004311DA /* nlist.c in Sources */, - C95B7FA2138F3C55004311DA /* NSSystemDirectories.c in Sources */, C95B7FA3138F3C55004311DA /* oldsyslog.c in Sources */, C95B7FA6138F3C55004311DA /* setlogin.c in Sources */, C95B7FA7138F3C55004311DA /* sigsetops.c in Sources */, @@ -10679,9 +10624,10 @@ C95B8136138F3C55004311DA /* wmemchr.c in Sources */, C95B8137138F3C55004311DA /* wmemcmp.c in Sources */, C95B8138138F3C55004311DA /* wmemcpy.c in Sources */, + 2DF67CE2184F9CBE00B83A3D /* debug_private.c in Sources */, C95B8139138F3C55004311DA /* wmemmove.c in Sources */, C95B813A138F3C55004311DA /* wmemset.c in Sources */, - C95B813B138F3C55004311DA /* __libc_init.c in Sources */, + C95B813B138F3C55004311DA /* _libc_init.c in Sources */, C95B813C138F3C55004311DA /* _libc_fork_child.c in Sources */, C95B813D138F3C55004311DA /* chmodx_np.c in Sources */, C95B813F138F3C55004311DA /* crt_externs.c in Sources */, @@ -10722,7 +10668,6 @@ 4B2C64A615519BC600342BFA /* assumes.c in Sources */, FC2ED614157D4BE80098EC69 /* inet_ntop.c in Sources */, FC2ED61D157D4BE80098EC69 /* inet_pton.c in Sources */, - 2B9D61BB157D667900AF25B8 /* trace.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -10743,7 +10688,6 @@ C95B8198138F52B0004311DA /* setreuid.c in Sources */, C95B8199138F52B0004311DA /* sigaltstk.c in Sources */, C95B819A138F52B0004311DA /* sigcompat.c in Sources */, - C95B819B138F52B0004311DA /* _dirhelper.c in Sources */, C95B819C138F52B0004311DA /* kvm.c in Sources */, C95B81A0138F52B0004311DA /* forceLibcToBuild.c in Sources */, C95B81A1138F52B0004311DA /* bt_close.c in Sources */, @@ -10904,7 +10848,6 @@ C95B824A138F52B0004311DA /* utmpx.c in Sources */, C95B824B138F52B0004311DA /* nftw.c in Sources */, C95B824C138F52B0004311DA /* nlist.c in Sources */, - C95B824D138F52B0004311DA /* NSSystemDirectories.c in Sources */, C95B824E138F52B0004311DA /* oldsyslog.c in Sources */, C95B8251138F52B0004311DA /* setlogin.c in Sources */, C95B8252138F52B0004311DA /* sigsetops.c in Sources */, @@ -11219,9 +11162,10 @@ C95B83E1138F52B0004311DA /* wmemchr.c in Sources */, C95B83E2138F52B0004311DA /* wmemcmp.c in Sources */, C95B83E3138F52B0004311DA /* wmemcpy.c in Sources */, + 2DF67CE3184F9CBE00B83A3D /* debug_private.c in Sources */, C95B83E4138F52B0004311DA /* wmemmove.c in Sources */, C95B83E5138F52B0004311DA /* wmemset.c in Sources */, - C95B83E6138F52B0004311DA /* __libc_init.c in Sources */, + C95B83E6138F52B0004311DA /* _libc_init.c in Sources */, C95B83E7138F52B0004311DA /* _libc_fork_child.c in Sources */, C95B83E8138F52B0004311DA /* chmodx_np.c in Sources */, C95B83EA138F52B0004311DA /* crt_externs.c in Sources */, @@ -11262,7 +11206,6 @@ 4B2C64A715519BC700342BFA /* assumes.c in Sources */, FC2ED615157D4BE80098EC69 /* inet_ntop.c in Sources */, FC2ED61E157D4BE80098EC69 /* inet_pton.c in Sources */, - 2B9D61BC157D667A00AF25B8 /* trace.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -11283,7 +11226,6 @@ C95B843E138F53DB004311DA /* setreuid.c in Sources */, C95B843F138F53DB004311DA /* sigaltstk.c in Sources */, C95B8440138F53DB004311DA /* sigcompat.c in Sources */, - C95B8441138F53DB004311DA /* _dirhelper.c in Sources */, C95B8442138F53DB004311DA /* kvm.c in Sources */, C95B8446138F53DB004311DA /* forceLibcToBuild.c in Sources */, C95B8447138F53DB004311DA /* bt_close.c in Sources */, @@ -11444,7 +11386,6 @@ C95B84F0138F53DB004311DA /* utmpx.c in Sources */, C95B84F1138F53DB004311DA /* nftw.c in Sources */, C95B84F2138F53DB004311DA /* nlist.c in Sources */, - C95B84F3138F53DB004311DA /* NSSystemDirectories.c in Sources */, C95B84F4138F53DB004311DA /* oldsyslog.c in Sources */, C95B84F7138F53DB004311DA /* setlogin.c in Sources */, C95B84F8138F53DB004311DA /* sigsetops.c in Sources */, @@ -11759,9 +11700,10 @@ C95B8687138F53DB004311DA /* wmemchr.c in Sources */, C95B8688138F53DB004311DA /* wmemcmp.c in Sources */, C95B8689138F53DB004311DA /* wmemcpy.c in Sources */, + 2DF67CE4184F9CBE00B83A3D /* debug_private.c in Sources */, C95B868A138F53DB004311DA /* wmemmove.c in Sources */, C95B868B138F53DB004311DA /* wmemset.c in Sources */, - C95B868C138F53DB004311DA /* __libc_init.c in Sources */, + C95B868C138F53DB004311DA /* _libc_init.c in Sources */, C95B868D138F53DB004311DA /* _libc_fork_child.c in Sources */, C95B868E138F53DB004311DA /* chmodx_np.c in Sources */, C95B8690138F53DB004311DA /* crt_externs.c in Sources */, @@ -11802,7 +11744,6 @@ 4B2C64A815519BC700342BFA /* assumes.c in Sources */, FC2ED616157D4BE80098EC69 /* inet_ntop.c in Sources */, FC2ED61F157D4BE80098EC69 /* inet_pton.c in Sources */, - 2B9D61BD157D667A00AF25B8 /* trace.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -11824,7 +11765,6 @@ C97A6F791517AF53005E1998 /* (null) in Sources */, C97A6F7A1517AF53005E1998 /* (null) in Sources */, C97A6F7E1517AF53005E1998 /* (null) in Sources */, - C97A6F8D1517AF53005E1998 /* dirhelper.defs in Sources */, C97A6F8F1517AF53005E1998 /* init_cpu_capabilities.c in Sources */, C97A6F961517AF53005E1998 /* creat.c in Sources */, C97A6F971517AF53005E1998 /* gethostid.c in Sources */, @@ -11838,7 +11778,6 @@ C97A6F9F1517AF53005E1998 /* setreuid.c in Sources */, C97A6FA01517AF53005E1998 /* sigaltstk.c in Sources */, C97A6FA11517AF53005E1998 /* sigcompat.c in Sources */, - C97A6FA21517AF53005E1998 /* _dirhelper.c in Sources */, C97A6FA31517AF53005E1998 /* kvm.c in Sources */, C97A6FA71517AF53005E1998 /* forceLibcToBuild.c in Sources */, C97A6FA81517AF53005E1998 /* bt_close.c in Sources */, @@ -11999,7 +11938,6 @@ C97A70511517AF53005E1998 /* utmpx.c in Sources */, C97A70521517AF53005E1998 /* nftw.c in Sources */, C97A70531517AF53005E1998 /* nlist.c in Sources */, - C97A70541517AF53005E1998 /* NSSystemDirectories.c in Sources */, C97A70551517AF53005E1998 /* oldsyslog.c in Sources */, C97A70581517AF53005E1998 /* setlogin.c in Sources */, C97A70591517AF53005E1998 /* sigsetops.c in Sources */, @@ -12040,6 +11978,7 @@ C97A708C1517AF53005E1998 /* rune.c in Sources */, C97A708D1517AF53005E1998 /* runetype.c in Sources */, C97A708E1517AF53005E1998 /* setlocale.c in Sources */, + 2DF67CDF184F9CBE00B83A3D /* debug_private.c in Sources */, C97A708F1517AF53005E1998 /* setrunelocale.c in Sources */, C97A70901517AF53005E1998 /* table.c in Sources */, C97A70911517AF53005E1998 /* tolower.c in Sources */, @@ -12333,7 +12272,7 @@ C97A71C31517AF53005E1998 /* wmemcpy.c in Sources */, C97A71C41517AF53005E1998 /* wmemmove.c in Sources */, C97A71C51517AF53005E1998 /* wmemset.c in Sources */, - C97A71C61517AF53005E1998 /* __libc_init.c in Sources */, + C97A71C61517AF53005E1998 /* _libc_init.c in Sources */, C97A71C71517AF53005E1998 /* _libc_fork_child.c in Sources */, C97A71C81517AF53005E1998 /* chmodx_np.c in Sources */, C97A71CA1517AF53005E1998 /* crt_externs.c in Sources */, @@ -12396,7 +12335,6 @@ 4B2C64A415519BC400342BFA /* assumes.c in Sources */, FC2ED611157D4BE80098EC69 /* inet_ntop.c in Sources */, FC2ED61A157D4BE80098EC69 /* inet_pton.c in Sources */, - 2B9D61B9157D667600AF25B8 /* trace.c in Sources */, 3F169A3E1643B7BA0029E851 /* memccpy_chk.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -12434,7 +12372,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - C9C2A95C138E03C700287F00 /* dirhelper.defs in Sources */, C9C2A959138E025700287F00 /* sigaltstk.c in Sources */, C9C2A95A138E025700287F00 /* sigcompat.c in Sources */, C9C2A97D138E058200287F00 /* brk.c in Sources */, @@ -12456,6 +12393,7 @@ C9C2A9AD138E072500287F00 /* getttyent.c in Sources */, C9C2A9AE138E072500287F00 /* getusershell.c in Sources */, C9C2A9AF138E072500287F00 /* getvfsbyname.c in Sources */, + C9ECE2771950E384008E8672 /* atexit_receipt.c in Sources */, C9C2A9B5138E072500287F00 /* nanosleep.c in Sources */, C9C2A9B6138E072500287F00 /* nftw.c in Sources */, C9C2A9B8138E072500287F00 /* setlogin.c in Sources */, @@ -12464,7 +12402,7 @@ C9C2A9BE138E072600287F00 /* thread_stack_pcs.c in Sources */, C9C2A9BF138E072600287F00 /* uname.c in Sources */, C9C2A9C0138E072600287F00 /* utmpx-darwin.c in Sources */, - C9C2A9C1138E072600287F00 /* wordexp.c in Sources */, + 2DF67CE0184F9CBE00B83A3D /* debug_private.c in Sources */, C9A12853138E0BE00003880A /* gmon.c in Sources */, C9A12854138E0C1C0003880A /* isctype.c in Sources */, 3FD14576171D42B300B7BAF5 /* bcopy.c in Sources */, @@ -12497,9 +12435,8 @@ C9A12982138E10FB0003880A /* parse.c in Sources */, C9A12983138E10FB0003880A /* unpack.c in Sources */, C9A12984138E10FB0003880A /* unparse.c in Sources */, - C9C2A95B138E03C700287F00 /* _dirhelper.c in Sources */, C9C2A983138E058200287F00 /* tcgetsid.c in Sources */, - C9FA32FB138E4BD00089A94B /* __libc_init.c in Sources */, + C9FA32FB138E4BD00089A94B /* _libc_init.c in Sources */, C9FA32FC138E4BD00089A94B /* _libc_fork_child.c in Sources */, C9FA32FD138E4BD00089A94B /* chmodx_np.c in Sources */, C9FA32FF138E4BD00089A94B /* crt_externs.c in Sources */, @@ -12515,7 +12452,6 @@ C9421015138F23CA004BA536 /* mbrune.c in Sources */, C9421016138F23CA004BA536 /* runedepreciated.c in Sources */, C9421017138F23CA004BA536 /* setinvalidrune.c in Sources */, - C9EB2FBB138F6A920075BB52 /* NSSystemDirectories.c in Sources */, C9EB3542138F7D0A0075BB52 /* login.c in Sources */, C9EB3543138F7D0A0075BB52 /* logout.c in Sources */, C9EB3558138F7FF40075BB52 /* nlist.c in Sources */, @@ -12533,7 +12469,6 @@ B19C645D1450F90200032373 /* sync_volume_np.c in Sources */, 3FB7E1B5146EF2E000843438 /* dirfd.c in Sources */, 4B2C64BA1551B03700342BFA /* assumes.c in Sources */, - 2B9D61C0157D667C00AF25B8 /* trace.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -12563,7 +12498,6 @@ C9765EC2138EC61900741512 /* setreuid.c in Sources */, C9765EC3138EC61900741512 /* sigaltstk.c in Sources */, C9765EC4138EC61900741512 /* sigcompat.c in Sources */, - C9765EC5138EC61900741512 /* _dirhelper.c in Sources */, C9765EC6138EC61900741512 /* kvm.c in Sources */, C9765ECA138EC61900741512 /* forceLibcToBuild.c in Sources */, C9765ECB138EC61900741512 /* bt_close.c in Sources */, @@ -12724,7 +12658,6 @@ C9765F74138EC61900741512 /* utmpx.c in Sources */, C9765F75138EC61900741512 /* nftw.c in Sources */, C9765F76138EC61900741512 /* nlist.c in Sources */, - C9765F77138EC61900741512 /* NSSystemDirectories.c in Sources */, C9765F78138EC61900741512 /* oldsyslog.c in Sources */, C9765F7B138EC61900741512 /* setlogin.c in Sources */, C9765F7C138EC61900741512 /* sigsetops.c in Sources */, @@ -13039,9 +12972,10 @@ C976610B138EC61A00741512 /* wmemchr.c in Sources */, C976610C138EC61A00741512 /* wmemcmp.c in Sources */, C976610D138EC61A00741512 /* wmemcpy.c in Sources */, + 2DF67CE1184F9CBE00B83A3D /* debug_private.c in Sources */, C976610E138EC61A00741512 /* wmemmove.c in Sources */, C976610F138EC61A00741512 /* wmemset.c in Sources */, - C9766110138EC61A00741512 /* __libc_init.c in Sources */, + C9766110138EC61A00741512 /* _libc_init.c in Sources */, C9766111138EC61A00741512 /* _libc_fork_child.c in Sources */, C9766112138EC61A00741512 /* chmodx_np.c in Sources */, C9766114138EC61A00741512 /* crt_externs.c in Sources */, @@ -13082,7 +13016,6 @@ 4B2C64A515519BC600342BFA /* assumes.c in Sources */, FC2ED613157D4BE80098EC69 /* inet_ntop.c in Sources */, FC2ED61C157D4BE80098EC69 /* inet_pton.c in Sources */, - 2B9D61BA157D667800AF25B8 /* trace.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -13103,7 +13036,6 @@ C9EB2FDD138F6D880075BB52 /* setreuid.c in Sources */, C9EB2FDE138F6D880075BB52 /* sigaltstk.c in Sources */, C9EB2FDF138F6D880075BB52 /* sigcompat.c in Sources */, - C9EB2FE0138F6D880075BB52 /* _dirhelper.c in Sources */, C9EB2FE1138F6D880075BB52 /* kvm.c in Sources */, C9EB2FE5138F6D880075BB52 /* forceLibcToBuild.c in Sources */, C9EB2FE6138F6D880075BB52 /* bt_close.c in Sources */, @@ -13264,7 +13196,6 @@ C9EB308F138F6D880075BB52 /* utmpx.c in Sources */, C9EB3090138F6D880075BB52 /* nftw.c in Sources */, C9EB3091138F6D880075BB52 /* nlist.c in Sources */, - C9EB3092138F6D880075BB52 /* NSSystemDirectories.c in Sources */, C9EB3093138F6D880075BB52 /* oldsyslog.c in Sources */, C9EB3096138F6D880075BB52 /* setlogin.c in Sources */, C9EB3097138F6D880075BB52 /* sigsetops.c in Sources */, @@ -13570,6 +13501,7 @@ C9EB321D138F6D880075BB52 /* wcsncpy.c in Sources */, C9EB321E138F6D880075BB52 /* wcsnlen.c in Sources */, C9EB321F138F6D880075BB52 /* wcspbrk.c in Sources */, + 2DF67CE5184F9CBE00B83A3D /* debug_private.c in Sources */, C9EB3220138F6D880075BB52 /* wcsrchr.c in Sources */, C9EB3221138F6D880075BB52 /* wcsspn.c in Sources */, C9EB3222138F6D880075BB52 /* wcsstr.c in Sources */, @@ -13581,7 +13513,7 @@ C9EB3228138F6D880075BB52 /* wmemcpy.c in Sources */, C9EB3229138F6D880075BB52 /* wmemmove.c in Sources */, C9EB322A138F6D880075BB52 /* wmemset.c in Sources */, - C9EB322B138F6D880075BB52 /* __libc_init.c in Sources */, + C9EB322B138F6D880075BB52 /* _libc_init.c in Sources */, C9EB322C138F6D880075BB52 /* _libc_fork_child.c in Sources */, C9EB322D138F6D880075BB52 /* chmodx_np.c in Sources */, C9EB322F138F6D880075BB52 /* crt_externs.c in Sources */, @@ -13623,7 +13555,6 @@ 4B2C64A915519BC800342BFA /* assumes.c in Sources */, FC2ED617157D4BE80098EC69 /* inet_ntop.c in Sources */, FC2ED620157D4BE80098EC69 /* inet_pton.c in Sources */, - 2B9D61BE157D667B00AF25B8 /* trace.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -13644,7 +13575,6 @@ C9EB3284138F75580075BB52 /* setreuid.c in Sources */, C9EB3285138F75580075BB52 /* sigaltstk.c in Sources */, C9EB3286138F75580075BB52 /* sigcompat.c in Sources */, - C9EB3287138F75580075BB52 /* _dirhelper.c in Sources */, C9EB3288138F75580075BB52 /* kvm.c in Sources */, C9EB328C138F75580075BB52 /* forceLibcToBuild.c in Sources */, C9EB328D138F75580075BB52 /* bt_close.c in Sources */, @@ -13805,7 +13735,6 @@ C9EB3336138F75580075BB52 /* utmpx.c in Sources */, C9EB3337138F75580075BB52 /* nftw.c in Sources */, C9EB3338138F75580075BB52 /* nlist.c in Sources */, - C9EB3339138F75580075BB52 /* NSSystemDirectories.c in Sources */, C9EB333A138F75580075BB52 /* oldsyslog.c in Sources */, C9EB333D138F75580075BB52 /* setlogin.c in Sources */, C9EB333E138F75580075BB52 /* sigsetops.c in Sources */, @@ -14111,6 +14040,7 @@ C9EB34C4138F75580075BB52 /* wcsncpy.c in Sources */, C9EB34C5138F75580075BB52 /* wcsnlen.c in Sources */, C9EB34C6138F75580075BB52 /* wcspbrk.c in Sources */, + 2DF67CE6184F9CBE00B83A3D /* debug_private.c in Sources */, C9EB34C7138F75580075BB52 /* wcsrchr.c in Sources */, C9EB34C8138F75580075BB52 /* wcsspn.c in Sources */, C9EB34C9138F75580075BB52 /* wcsstr.c in Sources */, @@ -14122,7 +14052,7 @@ C9EB34CF138F75580075BB52 /* wmemcpy.c in Sources */, C9EB34D0138F75580075BB52 /* wmemmove.c in Sources */, C9EB34D1138F75580075BB52 /* wmemset.c in Sources */, - C9EB34D2138F75580075BB52 /* __libc_init.c in Sources */, + C9EB34D2138F75580075BB52 /* _libc_init.c in Sources */, C9EB34D3138F75580075BB52 /* _libc_fork_child.c in Sources */, C9EB34D4138F75580075BB52 /* chmodx_np.c in Sources */, C9EB34D6138F75580075BB52 /* crt_externs.c in Sources */, @@ -14164,7 +14094,6 @@ 4B2C64AA15519BCB00342BFA /* assumes.c in Sources */, FC2ED618157D4BE80098EC69 /* inet_ntop.c in Sources */, FC2ED621157D4BE80098EC69 /* inet_pton.c in Sources */, - 2B9D61BF157D667B00AF25B8 /* trace.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -14390,11 +14319,13 @@ isa = XCBuildConfiguration; baseConfigurationReference = C9766153138ECF0000741512 /* variants.xcconfig */; buildSettings = { + BUILD_VARIANTS = normal; COMBINE_HIDPI_IMAGES = YES; EXCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_EXCLUDED_SOURCE_FILE_NAMES)"; EXECUTABLE_PREFIX = lib; INCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_INCLUDED_SOURCE_FILE_NAMES)"; - INSTALL_PATH = /usr/local/lib/dyld; + "INSTALL_PATH[sdk=macos*]" = "$(INSTALL_PATH_ACTUAL)"; + INSTALL_PATH_ACTUAL = /usr/local/lib/dyld; PRODUCT_NAME = c; SKIP_INSTALL = NO; STRIP_INSTALLED_PRODUCT = NO; @@ -14406,11 +14337,13 @@ isa = XCBuildConfiguration; baseConfigurationReference = C9766153138ECF0000741512 /* variants.xcconfig */; buildSettings = { + BUILD_VARIANTS = normal; COMBINE_HIDPI_IMAGES = YES; EXCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_EXCLUDED_SOURCE_FILE_NAMES)"; EXECUTABLE_PREFIX = lib; INCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_INCLUDED_SOURCE_FILE_NAMES)"; - INSTALL_PATH = /usr/local/lib/dyld; + "INSTALL_PATH[sdk=macos*]" = "$(INSTALL_PATH_ACTUAL)"; + INSTALL_PATH_ACTUAL = /usr/local/lib/dyld; PRODUCT_NAME = c; SKIP_INSTALL = NO; STRIP_INSTALLED_PRODUCT = NO; diff --git a/Platforms/iphoneos/Makefile.inc b/Platforms/iphoneos/Makefile.inc index a7152b9..aaa1c87 100644 --- a/Platforms/iphoneos/Makefile.inc +++ b/Platforms/iphoneos/Makefile.inc @@ -14,8 +14,8 @@ # Legacy utmp APIs #FEATURE_LEGACY_UTMP_APIS = 1 -# New OSMemoryNotification and OSThermalNotification APIs -FEATURE_MEM_THERM_NOTIFICATION_APIS = 1 +# OSThermalNotification APIs +FEATURE_THERM_NOTIFICATION_APIS = 1 # Move localtime to /var/db/timezone FEATURE_MOVE_LOCALTIME = 1 diff --git a/Platforms/macosx/Makefile.inc b/Platforms/macosx/Makefile.inc index 1b311e2..c51ed0a 100644 --- a/Platforms/macosx/Makefile.inc +++ b/Platforms/macosx/Makefile.inc @@ -14,8 +14,8 @@ FEATURE_LEGACY_RUNE_APIS = 1 # Legacy utmp APIs FEATURE_LEGACY_UTMP_APIS = 1 -# New OSMemoryNotification and OSThermalNotification APIs -#FEATURE_MEM_THERM_NOTIFICATION_APIS = 1 +# OSThermalNotification APIs +FEATURE_THERM_NOTIFICATION_APIS = 1 # Move localtime to /var/db/timezone #FEATURE_MOVE_LOCALTIME = 1 diff --git a/darwin/_dirhelper.c b/darwin/_dirhelper.c deleted file mode 100644 index bec1e1d..0000000 --- a/darwin/_dirhelper.c +++ /dev/null @@ -1,449 +0,0 @@ -/* - * Copyright (c) 2006, 2007, 2009-2013 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@ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if !TARGET_OS_IPHONE -#include -#endif /* !TARGET_OS_IPHONE */ - -#include "dirhelper.h" -#include "dirhelper_priv.h" - -#define BUCKETLEN 2 - -#define MUTEX_LOCK(x) pthread_mutex_lock(x) -#define MUTEX_UNLOCK(x) pthread_mutex_unlock(x) - -// Use 5 bits per character, to avoid uppercase and shell magic characters -#define ENCODEBITS 5 -#define ENCODEDSIZE ((8 * UUID_UID_SIZE + ENCODEBITS - 1) / ENCODEBITS) -#define MASK(x) ((1 << (x)) - 1) -#define UUID_UID_SIZE (sizeof(uuid_t) + sizeof(uid_t)) - -static const mode_t modes[] = { - 0755, /* user */ - 0700, /* temp */ - 0700, /* cache */ -}; - -static const char *subdirs[] = { - DIRHELPER_TOP_STR, - DIRHELPER_TEMP_STR, - DIRHELPER_CACHE_STR, -}; - -static pthread_once_t userdir_control = PTHREAD_ONCE_INIT; -static char *userdir = NULL; - -// lower case letter (minus vowels), plus numbers and _, making -// 32 characters. -static const char encode[] = "0123456789_bcdfghjklmnpqrstvwxyz"; - -#if TARGET_OS_IPHONE - -#define setcrashlogmessage(fmt, ...) /* nothing */ - -#else /* !TARGET_OS_IPHONE */ - -static void -encode_uuid_uid(const uuid_t uuid, uid_t uid, char *str) -{ - unsigned char buf[UUID_UID_SIZE + 1]; - unsigned char *bp = buf; - int i; - unsigned int n; - - memcpy(bp, uuid, sizeof(uuid_t)); - uid = OSSwapHostToBigInt32(uid); - memcpy(bp + sizeof(uuid_t), &uid, sizeof(uid_t)); - bp[UUID_UID_SIZE] = 0; // this ensures the last encoded byte will have trailing zeros - for(i = 0; i < ENCODEDSIZE; i++) { - // 5 bits has 8 states - switch(i % 8) { - case 0: - n = *bp++; - *str++ = encode[n >> 3]; - break; - case 1: - n = ((n & MASK(3)) << 8) | *bp++; - *str++ = encode[n >> 6]; - break; - case 2: - n &= MASK(6); - *str++ = encode[n >> 1]; - break; - case 3: - n = ((n & MASK(1)) << 8) | *bp++; - *str++ = encode[n >> 4]; - break; - case 4: - n = ((n & MASK(4)) << 8) | *bp++; - *str++ = encode[n >> 7]; - break; - case 5: - n &= MASK(7); - *str++ = encode[n >> 2]; - break; - case 6: - n = ((n & MASK(2)) << 8) | *bp++; - *str++ = encode[n >> 5]; - break; - case 7: - *str++ = encode[n & MASK(5)]; - break; - } - } - *str = 0; -} - -static void -_setcrashlogmessage(const char *fmt, ...) __attribute__((__format__(__printf__,1,2))) -{ - char *mess = NULL; - int res; - va_list ap; - - va_start(ap, fmt); - res = vasprintf(&mess, fmt, ap); - va_end(ap); - if (res < 0) - mess = (char *)fmt; /* the format string is better than nothing */ - CRSetCrashLogMessage(mess); -} - -#define setcrashlogmessage(fmt, ...) _setcrashlogmessage("%s: %u: " fmt, __func__, __LINE__, ##__VA_ARGS__) - -#endif /* !TARGET_OS_IPHONE */ - -char * -__user_local_dirname(uid_t uid, dirhelper_which_t which, char *path, size_t pathlen) -{ -#if TARGET_OS_IPHONE - char *tmpdir; -#else - uuid_t uuid; - char str[ENCODEDSIZE + 1]; -#endif - int res; - - if((int)which < 0 || which > DIRHELPER_USER_LOCAL_LAST) { - setcrashlogmessage("Out of range: which=%d", (int)which); - errno = EINVAL; - return NULL; - } - -#if TARGET_OS_IPHONE - /* We only support DIRHELPER_USER_LOCAL_TEMP on embedded. - * This interface really doesn't map from OSX to embedded, - * and clients of this interface will need to adapt when - * porting their applications to embedded. - * See: - */ - if(which == DIRHELPER_USER_LOCAL_TEMP) { - tmpdir = getenv("TMPDIR"); - if(!tmpdir) { - setcrashlogmessage("TMPDIR not set"); - errno = EINVAL; - return NULL; - } - res = snprintf(path, pathlen, "%s", tmpdir); - } else { - setcrashlogmessage("Only DIRHELPER_USER_LOCAL_TEMP is supported: which=%d", (int)which); - errno = EINVAL; - return NULL; - } -#else - res = mbr_uid_to_uuid(uid, uuid); - if(res != 0) { - setcrashlogmessage("mbr_uid_to_uuid returned %d, uid=%d", res, (int)uid); - errno = res; - return NULL; - } - - // - // We partition the namespace so that we don't end up with too - // many users in a single directory. With 1024 buckets, we - // could scale to 1,000,000 users while keeping the average - // number of files in a single directory around 1000 - // - encode_uuid_uid(uuid, uid, str); - res = snprintf(path, pathlen, - "%s%.*s/%s/%s", - VAR_FOLDERS_PATH, BUCKETLEN, str, str + BUCKETLEN, subdirs[which]); -#endif - if(res >= pathlen) { - setcrashlogmessage("snprintf: buffer too small: res=%d >= pathlen=%zu", res, pathlen); - errno = EINVAL; - return NULL; /* buffer too small */ - } - return path; -} - -char * -__user_local_mkdir_p(char *path) -{ - char *next; - int res; - - next = path + strlen(VAR_FOLDERS_PATH); - while ((next = strchr(next, '/')) != NULL) { - *next = 0; // temporarily truncate - res = mkdir(path, 0755); - if (res != 0 && errno != EEXIST) { - setcrashlogmessage("mkdir: path=%s mode=0755: %s", path, strerror(errno)); - return NULL; - } - *next++ = '/'; // restore the slash and increment - } - return path; -} - -static void userdir_allocate(void) -{ - userdir = calloc(PATH_MAX, sizeof(char)); -} - -/* - * 9407258: Invalidate the dirhelper cache (userdir) of the child after fork. - * There is a rare case when launchd will have userdir set, and child process - * will sometimes inherit this cached value. - */ -__private_extern__ void _dirhelper_fork_child(void); -__private_extern__ void -_dirhelper_fork_child(void) -{ - if(userdir) *userdir = 0; -} - -__private_extern__ char *_dirhelper(dirhelper_which_t which, char *path, size_t pathlen); -__private_extern__ char * -_dirhelper(dirhelper_which_t which, char *path, size_t pathlen) -{ - static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; - struct stat sb; - - if((int)which < 0 || which > DIRHELPER_USER_LOCAL_LAST) { - setcrashlogmessage("Out of range: which=%d", (int)which); - errno = EINVAL; - return NULL; - } - - if (pthread_once(&userdir_control, userdir_allocate) - || !userdir) { - setcrashlogmessage("Out of memory in userdir_allocate"); - errno = ENOMEM; - return NULL; - } - - if(!*userdir) { - MUTEX_LOCK(&lock); - if (!*userdir) { - - if(__user_local_dirname(geteuid(), DIRHELPER_USER_LOCAL, userdir, PATH_MAX) == NULL) { - MUTEX_UNLOCK(&lock); - return NULL; - } - /* - * All dirhelper directories are now at the same level, so - * we need to remove the DIRHELPER_TOP_STR suffix to get the - * parent directory. - */ - userdir[strlen(userdir) - (sizeof(DIRHELPER_TOP_STR) - 1)] = 0; - /* - * check if userdir exists, and if not, either do the work - * ourself if we are root, or call - * __dirhelper_create_user_local to create it (we have to - * check again afterwards). - */ - if(stat(userdir, &sb) < 0) { - mach_port_t mp; - - if(errno != ENOENT) { /* some unknown error */ - setcrashlogmessage("stat: %s: %s", userdir, strerror(errno)); - *userdir = 0; - MUTEX_UNLOCK(&lock); - return NULL; - } - /* - * If we are root, lets do what dirhelper does for us. - */ - if (geteuid() == 0) { - if (__user_local_mkdir_p(userdir) == NULL) { - *userdir = 0; - MUTEX_UNLOCK(&lock); - return NULL; - } - } else { - kern_return_t res; -#if TARGET_IPHONE_SIMULATOR - res = bootstrap_look_up(bootstrap_port, DIRHELPER_BOOTSTRAP_NAME, &mp); -#else - res = bootstrap_look_up2(bootstrap_port, DIRHELPER_BOOTSTRAP_NAME, &mp, 0, BOOTSTRAP_PRIVILEGED_SERVER); -#endif - - if(res != KERN_SUCCESS) { - setcrashlogmessage("bootstrap_look_up returned %d", res); - errno = EPERM; - server_error: - mach_port_deallocate(mach_task_self(), mp); - MUTEX_UNLOCK(&lock); - return NULL; - } - if((res = __dirhelper_create_user_local(mp)) != KERN_SUCCESS) { - setcrashlogmessage("__dirhelper_create_user_local returned %d", res); - errno = EPERM; - goto server_error; - } - /* double check that the directory really got created */ - if(stat(userdir, &sb) < 0) { - setcrashlogmessage("stat: %s: %s", userdir, strerror(errno)); - goto server_error; - } - mach_port_deallocate(mach_task_self(), mp); - } - } - } - MUTEX_UNLOCK(&lock); - } - - if(pathlen < strlen(userdir) + strlen(subdirs[which]) + 1) { - setcrashlogmessage("buffer too small: pathlen=%zu userdir=%s subdirs[%d]=%s", pathlen, userdir, which, subdirs[which]); - errno = EINVAL; - return NULL; /* buffer too small */ - } - strcpy(path, userdir); - strcat(path, subdirs[which]); - - /* - * create the subdir with the appropriate permissions if it doesn't already - * exist. On OS X, if we're under App Sandbox, we rely on the subdir having - * been already created for us. - */ -#if !TARGET_OS_IPHONE - if (!_xpc_runtime_is_app_sandboxed()) -#endif - if(mkdir(path, modes[which]) != 0 && errno != EEXIST) { - setcrashlogmessage("mkdir: path=%s modes[%d]=0%o: %s", path, which, modes[which], strerror(errno)); - return NULL; - } - -#if !TARGET_OS_IPHONE - char *userdir_suffix = NULL; - - if (_xpc_runtime_is_app_sandboxed()) { - /* - * if the subdir wasn't made for us, bail since we probably don't have - * permission to create it ourselves. - */ - if(stat(path, &sb) < 0) { - setcrashlogmessage("stat: %s: %s", path, strerror(errno)); - errno = EPERM; - return NULL; - } - - /* - * sandboxed applications get per-application directories named - * after the container - */ - userdir_suffix = getenv(XPC_ENV_SANDBOX_CONTAINER_ID); - if (!userdir_suffix) { - setcrashlogmessage("XPC_ENV_SANDBOX_CONTAINER_ID not set"); - errno = EINVAL; - return NULL; - } - } else if (!dyld_process_is_restricted()) { - userdir_suffix = getenv(DIRHELPER_ENV_USER_DIR_SUFFIX); - } - - if (userdir_suffix) { - /* - * do not allow paths that contain path traversal dots. - */ - const char *pos = userdir_suffix; - while ((pos = strnstr(pos, "..", strlen(pos)))) { - if ((pos == userdir_suffix && strlen(userdir_suffix) == 2) || // string is ".." only - (pos == userdir_suffix && strlen(userdir_suffix) > 2 && userdir_suffix[2] == '/') || // prefixed with "../" - ((pos - userdir_suffix == strlen(userdir_suffix) - 2) && pos[-1] == '/') || // suffixed with "/.." - (pos[-1] == '/' && pos[2] == '/')) // middle of string with '/../' - { - setcrashlogmessage("illegal path traversal (..) pattern found in DIRHELPER_USER_DIR_SUFFIX"); - errno = EINVAL; - return NULL; - } - pos += 2; - } - - /* - * suffix (usually container ID) doesn't end in a slash, so +2 is for slash and \0 - */ - if (pathlen < strlen(path) + strlen(userdir_suffix) + 2) { - setcrashlogmessage("buffer too small: pathlen=%zu path=%s userdir_suffix=%s", pathlen, path, userdir_suffix); - errno = EINVAL; - return NULL; /* buffer too small */ - } - - strcat(path, userdir_suffix); - strcat(path, "/"); - - /* - * create suffix subdirectory with the appropriate permissions - * if it doesn't already exist. - */ - if (mkdir(path, modes[which]) != 0 && errno != EEXIST) { - setcrashlogmessage("mkdir: path=%s modes[%d]=0%o: %s", path, which, modes[which], strerror(errno)); - return NULL; - } - - /* - * update TMPDIR if necessary - */ - if (which == DIRHELPER_USER_LOCAL_TEMP) { - char *tmpdir = getenv("TMPDIR"); - if (!tmpdir || strncmp(tmpdir, path, strlen(path))) - setenv("TMPDIR", path, 1); - } - } -#endif - - return path; -} diff --git a/include/_structs.h b/darwin/atexit_receipt.c similarity index 89% rename from include/_structs.h rename to darwin/atexit_receipt.c index 44443b2..62bde8b 100644 --- a/include/_structs.h +++ b/darwin/atexit_receipt.c @@ -1,15 +1,15 @@ /* - * Copyright (c) 2004 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2014 Apple Computer, 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, @@ -17,9 +17,7 @@ * 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@ */ -#include - diff --git a/darwin/dirhelper.defs b/darwin/dirhelper.defs deleted file mode 100644 index ff428ed..0000000 --- a/darwin/dirhelper.defs +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2006 Apple Computer, 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@ - */ -#include -#include - -subsystem dirhelper 47213; -serverprefix do_; - -routine __dirhelper_create_user_local( - server_port : mach_port_t; - ServerAuditToken remote_creds : audit_token_t); - -routine __dirhelper_idle_exit( - server_port : mach_port_t; - ServerAuditToken remote_creds : audit_token_t); diff --git a/darwin/dirhelper_priv.h b/darwin/libc_private.h similarity index 50% rename from darwin/dirhelper_priv.h rename to darwin/libc_private.h index bbb7aec..baae033 100644 --- a/darwin/dirhelper_priv.h +++ b/darwin/libc_private.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2007, 2010 Apple Inc. All rights reserved. + * Copyright (c) 2013 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -21,31 +21,42 @@ * @APPLE_LICENSE_HEADER_END@ */ -#ifndef _DIRHELPER_PRIV_H_ -#define _DIRHELPER_PRIV_H_ +#ifndef __LIBC_PRIVATE_H__ +#define __LIBC_PRIVATE_H__ #include -#include - -#define VAR_FOLDERS_PATH "/var/folders/" - -#define DIRHELPER_BOOTSTRAP_NAME "com.apple.bsd.dirhelper" -#define DIRHELPER_CACHE_STR "C/" -#define DIRHELPER_TEMP_STR "T/" -#define DIRHELPER_TOP_STR "0/" -#define DIRHELPER_ENV_USER_DIR_SUFFIX "DIRHELPER_USER_DIR_SUFFIX" - -typedef enum { - DIRHELPER_USER_LOCAL = 0, - DIRHELPER_USER_LOCAL_TEMP, - DIRHELPER_USER_LOCAL_CACHE, - DIRHELPER_USER_LOCAL_LAST = DIRHELPER_USER_LOCAL_CACHE -} dirhelper_which_t; - -__BEGIN_DECLS -char *__user_local_dirname(uid_t uid, dirhelper_which_t which, char *path, - size_t pathlen); -char *__user_local_mkdir_p(char *path); -__END_DECLS - -#endif /* _DIRHELPER_PRIV_H_ */ +#include +#include + +struct _libc_functions { + unsigned long version; + void (*atfork_prepare)(void); // version 1 + void (*atfork_parent)(void); // version 1 + void (*atfork_child)(void); // version 1 + char *(*dirhelper)(int, char *, size_t); // version 1 +}; + +struct ProgramVars; // forward reference + +__deprecated_msg("use _libc_initializer()") +extern void +__libc_init(const struct ProgramVars *vars, + void (*atfork_prepare)(void), + void (*atfork_parent)(void), + void (*atfork_child)(void), + const char *apple[]); + +__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) +extern void +_libc_initializer(const struct _libc_functions *funcs, + const char *envp[], + const char *apple[], + const struct ProgramVars *vars); + +extern void +_libc_fork_child(void); + +extern int +_atexit_receipt(void); + +#endif // __LIBC_PRIVATE_H__ diff --git a/emulated/lchmod.c b/emulated/lchmod.c index 50fda99..836f65e 100644 --- a/emulated/lchmod.c +++ b/emulated/lchmod.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2005, 2014 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -21,6 +21,8 @@ * @APPLE_LICENSE_HEADER_END@ */ +// NOTE: This system call emulation should move to libsystem_kernel.dylib + #include #include #include @@ -30,14 +32,9 @@ int lchmod(const char *path, mode_t mode) { - struct stat s; struct attrlist a; int m; - if(lstat(path, &s) < 0) - return -1; - if((s.st_mode & S_IFMT) != S_IFLNK) - return chmod(path, mode); bzero(&a, sizeof(a)); a.bitmapcount = ATTR_BIT_MAP_COUNT; a.commonattr = ATTR_CMN_ACCESSMASK; diff --git a/fbsdcompat/_fbsd_compat_.h b/fbsdcompat/_fbsd_compat_.h index cd2875e..a5f79c6 100644 --- a/fbsdcompat/_fbsd_compat_.h +++ b/fbsdcompat/_fbsd_compat_.h @@ -35,6 +35,17 @@ #define __ct_rune_t ct_rune_t #define __va_list __darwin_va_list +#define __isthreaded 1 + +#ifdef _FLOCK_DEBUG +#define _FLOCKFILE(x) _flockfile_debug(x, __FILE__, __LINE__) +#else +#define _FLOCKFILE(x) _flockfile(x) +#endif + +#define FLOCKFILE(fp) _FLOCKFILE(fp) +#define FUNLOCKFILE(fp) _funlockfile(fp) + /* * Do the opposite of FreeBSD namespace.h; that is, map the "hidden" names * back to the real names. diff --git a/fbsdcompat/libc_private.h b/fbsdcompat/libc_private.h deleted file mode 100644 index a9e3958..0000000 --- a/fbsdcompat/libc_private.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2003 Apple Computer, 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) 1998 John Birrell . - * 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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. - * - * $FreeBSD: src/lib/libc/include/libc_private.h,v 1.8 2002/11/13 21:55:22 deischen Exp $ - * - * Private definitions for libc, libc_r and libpthread. - * - */ - -#ifndef _LIBC_PRIVATE_H_ -#define _LIBC_PRIVATE_H_ - -#ifdef __APPLE__ -#define __isthreaded 1 -#else -/* - * This global flag is non-zero when a process has created one - * or more threads. It is used to avoid calling locking functions - * when they are not required. - */ -extern int __isthreaded; -#endif // __APPLE__ - -/* - * File lock contention is difficult to diagnose without knowing - * where locks were set. Allow a debug library to be built which - * records the source file and line number of each lock call. - */ -#ifdef _FLOCK_DEBUG -#define _FLOCKFILE(x) _flockfile_debug(x, __FILE__, __LINE__) -#else -#define _FLOCKFILE(x) _flockfile(x) -#endif - -/* - * Macros for locking and unlocking FILEs. These test if the - * process is threaded to avoid locking when not required. - */ -#define FLOCKFILE(fp) if (__isthreaded) _FLOCKFILE(fp) -#define FUNLOCKFILE(fp) if (__isthreaded) _funlockfile(fp) - -/* - * Indexes into the pthread jump table. - * - * Warning! If you change this type, you must also change the threads - * libraries that reference it (libc_r, libpthread). - */ -typedef enum { - PJT_COND_BROADCAST, - PJT_COND_DESTROY, - PJT_COND_INIT, - PJT_COND_SIGNAL, - PJT_COND_WAIT, - PJT_GETSPECIFIC, - PJT_KEY_CREATE, - PJT_KEY_DELETE, - PJT_MAIN_NP, - PJT_MUTEX_DESTROY, - PJT_MUTEX_INIT, - PJT_MUTEX_LOCK, - PJT_MUTEX_TRYLOCK, - PJT_MUTEX_UNLOCK, - PJT_MUTEXATTR_DESTROY, - PJT_MUTEXATTR_INIT, - PJT_MUTEXATTR_SETTYPE, - PJT_ONCE, - PJT_RWLOCK_DESTROY, - PJT_RWLOCK_INIT, - PJT_RWLOCK_RDLOCK, - PJT_RWLOCK_TRYRDLOCK, - PJT_RWLOCK_TRYWRLOCK, - PJT_RWLOCK_UNLOCK, - PJT_RWLOCK_WRLOCK, - PJT_SELF, - PJT_SETSPECIFIC, - PJT_SIGMASK, - PJT_MAX -} pjt_index_t; - -typedef int (*pthread_func_t)(void); -typedef pthread_func_t pthread_func_entry_t[2]; - -extern pthread_func_entry_t __thr_jtable[]; - -#endif /* _LIBC_PRIVATE_H_ */ diff --git a/fbsdcompat/sys/cdefs.h b/fbsdcompat/sys/cdefs.h index a56be2c..aea0606 100644 --- a/fbsdcompat/sys/cdefs.h +++ b/fbsdcompat/sys/cdefs.h @@ -66,8 +66,6 @@ * We define this here since , , and * require it. */ -#define __offsetof(type, field) ((size_t)(&((type *)0)->field)) - #define __strong_reference(sym,aliassym) \ extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))); #define __weak_reference(sym,alias) diff --git a/gen/FreeBSD/assert.c b/gen/FreeBSD/assert.c index 2e1c0b1..bf0de53 100644 --- a/gen/FreeBSD/assert.c +++ b/gen/FreeBSD/assert.c @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/assert.c,v 1.8 2007/01/09 00:27:53 imp Exp #include #include #include -#include "CrashReporterClient.h" +#include #include "_simple.h" void diff --git a/gen/FreeBSD/opendir.c b/gen/FreeBSD/opendir.c index 392e3ed..05f7f92 100644 --- a/gen/FreeBSD/opendir.c +++ b/gen/FreeBSD/opendir.c @@ -31,7 +31,7 @@ static char sccsid[] = "@(#)opendir.c 8.8 (Berkeley) 5/1/95"; #endif /* LIBC_SCCS and not lint */ #include -__FBSDID("$FreeBSD: src/lib/libc/gen/opendir.c,v 1.24 2008/04/16 18:40:52 delphij Exp $"); +__FBSDID("$FreeBSD$"); #include "namespace.h" #include @@ -48,6 +48,9 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/opendir.c,v 1.24 2008/04/16 18:40:52 delphi #include "un-namespace.h" #include "telldir.h" + +static DIR * __opendir_common(int, const char *, int); + /* * Open a directory. */ @@ -58,25 +61,59 @@ opendir(const char *name) return (__opendir2(name, DTF_HIDEW|DTF_NODUP)); } +/* + * Open a directory with existing file descriptor. + */ +DIR * +fdopendir(int fd) +{ + struct stat statb; + + /* Check that fd is associated with a directory. */ + if (_fstat(fd, &statb) != 0) + return (NULL); + if (!S_ISDIR(statb.st_mode)) { + errno = ENOTDIR; + return (NULL); + } + if (_fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) + return (NULL); + return (__opendir_common(fd, NULL, DTF_HIDEW|DTF_NODUP)); +} + DIR * __opendir2(const char *name, int flags) { - DIR *dirp; int fd; + + if ((fd = _open(name, + O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC)) == -1) + return (NULL); + + return __opendir_common(fd, name, flags); +} + +static int +opendir_compar(const void *p1, const void *p2) +{ + + return (strcmp((*(const struct dirent **)p1)->d_name, + (*(const struct dirent **)p2)->d_name)); +} + +/* + * Common routine for opendir(3), __opendir2(3) and fdopendir(3). + */ +static DIR * +__opendir_common(int fd, const char *name, int flags) +{ + DIR *dirp; int incr; int saved_errno; int unionstack; - /* - * Use O_DIRECTORY to only open directories (because opening of - * special files may be harmful). errno is set to ENOTDIR if - * not a directory. - */ - if ((fd = _open(name, O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC)) == -1) + if ((dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL) return (NULL); - dirp = malloc(sizeof(DIR) + sizeof(struct _telldir)); - if (dirp == NULL) - goto fail; dirp->dd_td = (struct _telldir *)((char *)dirp + sizeof(DIR)); LIST_INIT(&dirp->dd_td->td_locq); @@ -99,7 +136,8 @@ __opendir2(const char *name, int flags) if (_fstatfs(fd, &sfb) < 0) goto fail; - unionstack = (sfb.f_flags & MNT_UNION); + unionstack = !strcmp(sfb.f_fstypename, "unionfs") + || (sfb.f_flags & MNT_UNION); } else { unionstack = 0; } @@ -135,7 +173,7 @@ __opendir2(const char *name, int flags) } #if __DARWIN_64_BIT_INO_T - n = __getdirentries64(fd, ddptr, space, &dirp->dd_td->seekoff); + n = (int)__getdirentries64(fd, ddptr, space, &dirp->dd_td->seekoff); #else /* !__DARWIN_64_BIT_INO_T */ n = _getdirentries(fd, ddptr, space, &dirp->dd_seek); #endif /* __DARWIN_64_BIT_INO_T */ @@ -157,7 +195,7 @@ __opendir2(const char *name, int flags) */ if (flags & DTF_REWIND) { (void)_close(fd); - if ((fd = _open(name, O_RDONLY)) == -1) { + if ((fd = _open(name, O_RDONLY | O_DIRECTORY)) == -1) { saved_errno = errno; free(buf); free(dirp); @@ -205,7 +243,8 @@ __opendir2(const char *name, int flags) /* * This sort must be stable. */ - mergesort(dpv, n, sizeof(*dpv), (int (*)(const void *, const void *))alphasort); + mergesort(dpv, n, sizeof(*dpv), + opendir_compar); dpv[n] = NULL; xp = NULL; diff --git a/gen/FreeBSD/sysctl.3 b/gen/FreeBSD/sysctl.3 index 1f61289..90c1990 100644 --- a/gen/FreeBSD/sysctl.3 +++ b/gen/FreeBSD/sysctl.3 @@ -9,10 +9,6 @@ .\" 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. @@ -30,9 +26,9 @@ .\" SUCH DAMAGE. .\" .\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95 -.\" $FreeBSD: src/lib/libc/gen/sysctl.3,v 1.63 2004/07/02 23:52:10 ru Exp $ +.\" $FreeBSD$ .\" -.Dd October 21, 2008 +.Dd May 17, 2013 .Dt SYSCTL 3 .Os .Sh NAME @@ -88,8 +84,6 @@ Apart from that, it behaves the same as the standard .Fn sysctl function. -For a list of ASCII representations of commonly used sysctl names, please see -.Xr sysctl 1 . .Pp The information is copied into the buffer specified by .Fa oldp . @@ -157,48 +151,13 @@ repeatedly request the same variable (the function runs in about a third the time as the same request made via the .Fn sysctlbyname function). -The -.Fn sysctlnametomib -function is also useful for fetching mib prefixes and then adding -a final component. -For example, to fetch process information -for processes with pid's less than 100: -.Pp -.Bd -literal -offset indent -compact -int i, mib[4]; -size_t len; -struct kinfo_proc kp; - -/* Fill out the first three components of the mib */ -len = 4; -sysctlnametomib("kern.proc.pid", mib, &len); - -/* Fetch and print entries for pid's < 100 */ -for (i = 0; i < 100; i++) { - mib[3] = i; - len = sizeof(kp); - if (sysctl(mib, 4, &kp, &len, NULL, 0) == -1) - perror("sysctl"); - else if (len > 0) - printkproc(&kp); -} -.Ed -.Pp -Note: Implementation of -.Fn printkproc --- to print whatever data deemed necessary from the large -.Vt kinfo_proc -structure ( -.In sys/sysctl.h -) -- is left as an exercise for the reader. .Pp The top level names are defined with a CTL_ prefix in .In sys/sysctl.h , and are as follows. The next and subsequent levels down are found in the include files listed here, and described in separate sections below. -.Pp -.Bl -column CTLXMACHDEP "Next level names" -offset indent +.Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent .It Sy "Name Next level names Description" .It "CTL_DEBUG sys/sysctl.h Debugging" .It "CTL_VFS sys/mount.h File system" @@ -208,61 +167,25 @@ listed here, and described in separate sections below. .It "CTL_NET sys/socket.h Networking" .It "CTL_USER sys/sysctl.h User-level" .It "CTL_VM sys/resources.h Virtual memory (struct loadavg)" -.It "CTL_VM sys/vmmeter.h Virtual memory (struct vmtotal)" .El .Pp For example, the following retrieves the maximum number of processes allowed in the system: .Pp .Bd -literal -offset indent -compact -int mib[2], maxproc; -size_t len; - -mib[0] = CTL_KERN; -mib[1] = KERN_MAXPROC; -len = sizeof(maxproc); -sysctl(mib, 2, &maxproc, &len, NULL, 0); +int maxproc; +size_t len = sizeof(maxproc); +sysctlbyname("kern.maxproc", &maxproc, &len, NULL, 0); .Ed .Pp To retrieve the standard search path for the system utilities: .Pp .Bd -literal -offset indent -compact -int mib[2]; -size_t len; char *p; - -mib[0] = CTL_USER; -mib[1] = USER_CS_PATH; -sysctl(mib, 2, NULL, &len, NULL, 0); +size_t len; +sysctlbyname("user.cs_path", NULL, &len, NULL, 0); p = malloc(len); -sysctl(mib, 2, p, &len, NULL, 0); -.Ed -.Ss CTL_DEBUG -The debugging variables vary from system to system. -A debugging variable may be added or deleted without need to recompile -.Fn sysctl -to know about it. -Each time it runs, -.Fn sysctl -gets the list of debugging variables from the kernel and -displays their current values. -The system defines twenty -.Pq Vt "struct ctldebug" -variables named -.Va debug0 -through -.Va debug19 . -They are declared as separate variables so that they can be -individually initialized at the location of their associated variable. -The loader prevents multiple use of the same variable by issuing errors -if a variable is initialized in more than one place. -For example, to export the variable -.Va dospecialcheck -as a debugging variable, the following declaration would be used: -.Pp -.Bd -literal -offset indent -compact -int dospecialcheck = 1; -struct ctldebug debug5 = { "dospecialcheck", &dospecialcheck }; +sysctlbyname("user.cs_path", p, &len, NULL, 0); .Ed .Ss CTL_VFS A distinguished second level name, VFS_GENERIC, @@ -286,53 +209,60 @@ The string and integer information available for the CTL_HW level is detailed below. The changeable column shows whether a process with appropriate privilege may change the value. -.Bl -column "Second level nameXXXXXX" integerXXX -offset indent -.It Sy "Second level name Type Changeable" -.It "HW_MACHINE string no" -.It "HW_MODEL string no" -.It "HW_NCPU integer no (DEPRECATED)" -.It "HW_BYTEORDER integer no" -.It "HW_PHYSMEM integer no" -.It "HW_MEMSIZE integer no" -.It "HW_USERMEM integer no" -.It "HW_PAGESIZE integer no" -.It "HW_FLOATINGPOINT integer no" -.It "HW_MACHINE_ARCH string no" -.\".It "HW_DISKNAMES integer no" -.\".It "HW_DISKSTATS integer no" +.Bl -column "xxxxxxxxxxxxxxxxxxxxxxxxx" "xxxxxxxxxx" -offset indent +.It Sy "Name Type Changeable" +.It "hw.activecpu int32_t no" +.It "hw.byteorder int32_t no" +.It "hw.cacheconfig uint64_t[] no" +.It "hw.cachelinesize int64_t no" +.It "hw.cachesize uint64_t[] no" +.It "hw.cpu64bit_capable int32_t no" +.It "hw.cpufamily int32_t no" +.It "hw.cpufrequency int64_t no" +.It "hw.cpufrequency_max int64_t no" +.It "hw.cpufrequency_min int64_t no" +.It "hw.cpusubtype int32_t no" +.It "hw.cputhreadtype int32_t no" +.It "hw.cputype int32_t no" +.It "hw.l1dcachesize int64_t no" +.It "hw.l1icachesize int64_t no" +.It "hw.l2cachesize int64_t no" +.It "hw.l3cachesize int64_t no" +.It "hw.logicalcpu int32_t no" +.It "hw.logicalcpu_max int32_t no" +.It "hw.machine char[] no" +.It "hw.memsize int64_t no" +.It "hw.model char[] no" +.It "hw.ncpu int32_t no" +.It "hw.packages int32_t no" +.It "hw.pagesize int64_t no" +.It "hw.physicalcpu int32_t no" +.It "hw.physicalcpu_max int32_t no" +.It "hw.tbfrequency int64_t no" .El -.Pp .Bl -tag -width 6n -.It Li HW_MACHINE -The machine class. -.It Li HW_MODEL -The machine model -.It Li HW_NCPU (DEPRECATED) -The number of cpus. It is recommended that you use "hw.physicalcpu" "hw.physicalcpu_max" "hw.logicalcpu" or "hw.logicalcpu_max" instead. -.It Li "hw.physicalcpu" -The number of physical processors available in the current power management mode. -.It Li "hw.physicalcpu_max" -The maximum number of physical processors that could be available this boot. +.It Li "hw.byteorder" +The byte order (4321 or 1234). +.It Li "hw.model" +The machine model. +.It Li "hw.ncpu" +The number of cpus. This attribute is deprecated and it is recommended that +.Va "hw.logicalcpu" , +.Va "hw.logicalcpu_max" , +.Va "hw.physicalcpu" , +or +.Va "hw.physicalcpu_max" +be used instead. .It Li "hw.logicalcpu" The number of logical processors available in the current power management mode. .It Li "hw.logicalcpu_max" The maximum number of logical processors that could be available this boot. -.It Li HW_BYTEORDER -The byteorder (4,321, or 1,234). -.It Li HW_PHYSMEM -The bytes of physical memory represented by a 32-bit integer (for backward compatibility). Use HW_MEMSIZE instead. -.It Li HW_MEMSIZE -The bytes of physical memory represented by a 64-bit integer. -.It Li HW_USERMEM -The bytes of non-kernel memory. -.It Li HW_PAGESIZE -The software page size. -.It Li HW_FLOATINGPOINT -Nonzero if the floating point support is in hardware. -.It Li HW_MACHINE_ARCH -The machine dependent architecture type. -.\".It Fa HW_DISKNAMES -.\".It Fa HW_DISKSTATS +.It Li "hw.physicalcpu" +The number of physical processors available in the current power management mode. +.It Li "hw.physicalcpu_max" +The maximum number of physical processors that could be available this boot. +.It Li "hw.pagesize" +The software page size in bytes. .El .Ss CTL_KERN The string and integer information available for the CTL_KERN level @@ -343,203 +273,170 @@ The types of data currently available are process information, system vnodes, the open file entries, routing table entries, virtual memory statistics, load average history, and clock rate information. -.Bl -column "KERNXMAXFILESPERPROCXXX" "struct clockrateXXX" -offset indent -.It Sy "Second level name Type Changeable" -.It "KERN_ARGMAX integer no" -.It "KERN_BOOTFILE string yes" -.It "KERN_BOOTTIME struct timeval no" -.It "KERN_CLOCKRATE struct clockinfo no" -.It "KERN_FILE struct file no" -.It "KERN_HOSTID integer yes" -.It "KERN_HOSTNAME string yes" -.It "KERN_JOB_CONTROL integer no" -.It "KERN_MAXFILES integer yes" -.It "KERN_MAXFILESPERPROC integer yes" -.It "KERN_MAXPROC integer no" -.It "KERN_MAXPROCPERUID integer yes" -.It "KERN_MAXVNODES integer yes" -.It "KERN_NGROUPS integer no" -.It "KERN_NISDOMAINNAME string yes" -.It "KERN_OSRELDATE integer no" -.It "KERN_OSRELEASE string no" -.It "KERN_OSREV integer no" -.It "KERN_OSTYPE string no" -.It "KERN_POSIX1 integer no" -.It "KERN_PROC struct kinfo_proc no" -.It "KERN_PROF node not applicable" -.It "KERN_QUANTUM integer yes" -.It "KERN_SAVED_IDS integer no" -.It "KERN_SECURELVL integer raise only" -.It "KERN_UPDATEINTERVAL integer no" -.It "KERN_VERSION string no" -.It "KERN_VNODE struct vnode no" +.Bl -column "xxxxxxxxxxxxxxxxxxxxxxxxx" "xxxxxxxxxxxxxxxxxxxx" -offset indent +.It Sy "Name Type Changeable" +.It "kern.argmax int32_t no" +.It "kern.bootargs char[] no" +.It "kern.boottime struct timeval no" +.It "kern.check_openevt int32_t yes" +.It "kern.clockrate struct clockinfo no" +.It "kern.coredump int32_t yes" +.It "kern.corefile char[] yes" +.It "kern.flush_cache_on_write int32_t yes" +.It "kern.hostid int32_t yes" +.It "kern.hostname char[] yes" +.It "kern.job_control int32_t no" +.It "kern.maxfiles int32_t yes" +.It "kern.maxfilesperproc int32_t yes" +.It "kern.maxnbuf int32_t yes" +.It "kern.maxproc int32_t yes" +.It "kern.maxprocperuid int32_t yes" +.It "kern.maxvnodes int32_t yes" +.It "kern.msgbuf int32_t yes" +.It "kern.nbuf int32_t no" +.It "kern.netboot int32_t no" +.It "kern.ngroups int32_t no" +.It "kern.nisdomainname char[] yes" +.It "kern.num_files int32_t no" +.It "kern.num_tasks int32_t no" +.It "kern.num_taskthreads int32_t no" +.It "kern.num_threads int32_t no" +.It "kern.num_vnodes int32_t no" +.It "kern.nx int32_t yes" +.It "kern.osrelease char[] no" +.It "kern.osrevision int32_t no" +.It "kern.ostype char[] no" +.It "kern.osversion char[] yes" +.It "kern.posix1version int32_t no" +.It "kern.procname char[] yes" +.It "kern.safeboot int32_t no" +.It "kern.saved_ids int32_t no" +.It "kern.secure_kernel int32_t no" +.It "kern.securelevel int32_t yes" +.It "kern.singleuser int32_t no" +.It "kern.sleeptime struct timeval no" +.It "kern.slide int32_t no" +.It "kern.stack_depth_max int32_t no" +.It "kern.stack_size int32_t no" +.It "kern.sugid_coredump int32_t yes" +.It "kern.sugid_scripts int32_t yes" +.It "kern.symfile char[] no" +.It "kern.usrstack int32_t no" +.It "kern.usrstack64 int64_t no" +.It "kern.uuid char[] no" +.It "kern.version char[] no" +.It "kern.waketime struct timeval no" .El -.Pp .Bl -tag -width 6n -.It Li KERN_ARGMAX +.It Li "kern.argmax" The maximum bytes of argument to .Xr execve 2 . -.It Li KERN_BOOTFILE -The full pathname of the file from which the kernel was loaded. -.It Li KERN_BOOTTIME +.It Li "kern.boottime" A .Va struct timeval structure is returned. This structure contains the time that the system was booted. -.It Li KERN_CLOCKRATE +.It Li "kern.clockrate" A .Va struct clockinfo structure is returned. This structure contains the clock, statistics clock and profiling clock frequencies, the number of micro-seconds per hz tick and the skew rate. -.It Li KERN_FILE -Return the entire file table. -The returned data consists of a single -.Va struct filehead -followed by an array of -.Va struct file , -whose size depends on the current number of such objects in the system. -.It Li KERN_HOSTID +.It Li "kern.hostid" Get or set the host id. -.It Li KERN_HOSTNAME +.It Li "kern.hostname" Get or set the hostname. -.It Li KERN_JOB_CONTROL +.It Li "kern.job_control" Return 1 if job control is available on this system, otherwise 0. -.It Li KERN_MAXFILES +.It Li "kern.maxfiles" The maximum number of files that may be open in the system. -.It Li KERN_MAXFILESPERPROC +.It Li "kern.maxfilesperproc" The maximum number of files that may be open for a single process. This limit only applies to processes with an effective uid of nonzero at the time of the open request. Files that have already been opened are not affected if the limit or the effective uid is changed. -.It Li KERN_MAXPROC +.It Li "kern.maxproc" The maximum number of concurrent processes the system will allow. -.It Li KERN_MAXPROCPERUID +.It Li "kern.maxprocperuid" The maximum number of concurrent processes the system will allow for a single effective uid. This limit only applies to processes with an effective uid of nonzero at the time of a fork request. Processes that have already been started are not affected if the limit is changed. -.It Li KERN_MAXVNODES +.It Li "kern.maxvnodes" The maximum number of vnodes available on the system. -.It Li KERN_NGROUPS +.It Li "kern.ngroups" The maximum number of supplemental groups. -.It Li KERN_NISDOMAINNAME +.It Li "kern.nisdomainname" The name of the current YP/NIS domain. -.It Li KERN_OSRELDATE -The kernel release version in the format -.Ar M Ns Ar mm Ns Ar R Ns Ar xx , -where -.Ar M -is the major version, -.Ar mm -is the two digit minor version, -.Ar R -is 0 if release branch, otherwise 1, -and -.Ar xx -is updated when the available APIs change. -.Pp -The userland release version is available from -.In osreldate.h ; -parse this file if you need to get the release version of -the currently installed userland. -.It Li KERN_OSRELEASE +.It Li "kern.osrelease" The system release string. -.It Li KERN_OSREV -The system revision string. -.It Li KERN_OSTYPE +.It Li "kern.osrevision" +The system revision number. +.It Li "kern.ostype" The system type string. -.It Li KERN_POSIX1 +.It Li "kern.posix1version" The version of .St -p1003.1 with which the system attempts to comply. -.It Li KERN_PROC -Return the entire process table, or a subset of it. -An array of -.Va struct kinfo_proc -structures is returned, -whose size depends on the current number of such objects in the system. -The third and fourth level names are as follows: -.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent -.It "Third level name Fourth level is:" -.It "KERN_PROC_ALL None" -.It "KERN_PROC_PID A process ID" -.It "KERN_PROC_PGRP A process group" -.It "KERN_PROC_TTY A tty device" -.It "KERN_PROC_UID A user ID" -.It "KERN_PROC_RUID A real user ID" -.El -.It Li KERN_PROF -Return profiling information about the kernel. -If the kernel is not compiled for profiling, -attempts to retrieve any of the KERN_PROF values will -fail with -.Er ENOENT . -The third level names for the string and integer profiling information -is detailed below. -The changeable column shows whether a process with appropriate -privilege may change the value. -.Bl -column "GPROFXGMONPARAMXXX" "struct gmonparamXXX" -offset indent -.It Sy "Third level name Type Changeable" -.It "GPROF_STATE integer yes" -.It "GPROF_COUNT u_short[\|] yes" -.It "GPROF_FROMS u_short[\|] yes" -.It "GPROF_TOS struct tostruct yes" -.It "GPROF_GMONPARAM struct gmonparam no" -.El -.Pp -The variables are as follows: -.Bl -tag -width 6n -.It Li GPROF_STATE -Returns GMON_PROF_ON or GMON_PROF_OFF to show that profiling -is running or stopped. -.It Li GPROF_COUNT -Array of statistical program counter counts. -.It Li GPROF_FROMS -Array indexed by program counter of call-from points. -.It Li GPROF_TOS -Array of -.Va struct tostruct -describing destination of calls and their counts. -.It Li GPROF_GMONPARAM -Structure giving the sizes of the above arrays. -.El -.It Li KERN_QUANTUM -The maximum period of time, in microseconds, for which a process is allowed -to run without being preempted if other processes are in the run queue. -.It Li KERN_SAVED_IDS +.It Li "kern.saved_ids" Returns 1 if saved set-group and saved set-user ID is available. -.It Li KERN_SECURELVL +.It Li "kern.securelevel" The system security level. This level may be raised by processes with appropriate privilege. It may not be lowered. -.It Li KERN_VERSION +.It Li "kern.version" The system version string. -.It Li KERN_VNODE -Return the entire vnode table. -Note, the vnode table is not necessarily a consistent snapshot of -the system. -The returned data consists of an array whose size depends on the -current number of such objects in the system. -Each element of the array contains the kernel address of a vnode -.Va struct vnode * -followed by the vnode itself -.Va struct vnode . .El .Ss CTL_MACHDEP The set of variables defined is architecture dependent. The following variables are defined for the i386 architecture. -.Bl -column "CONSOLE_DEVICEXXX" "struct bootinfoXXX" -offset indent -.It Sy "Second level name Type Changeable" -.It Li "CPU_CONSDEV dev_t no" -.It Li "CPU_ADJKERNTZ int yes" -.It Li "CPU_DISRTCSET int yes" -.It Li "CPU_BOOTINFO struct bootinfo no" -.It Li "CPU_WALLCLOCK int yes" +.Bl -column "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "xxxxxxxxxx" -offset indent +.It Sy "Name Type Changeable" +.It "machdep.cpu.address_bits.physical int32_t no" +.It "machdep.cpu.address_bits.virtual int32_t no" +.It "machdep.cpu.brand int32_t no" +.It "machdep.cpu.brand_string char[] no" +.It "machdep.cpu.cache.L2_associativity int32_t no" +.It "machdep.cpu.cache.linesize int32_t no" +.It "machdep.cpu.cache.size int32_t no" +.It "machdep.cpu.core_count int32_t no" +.It "machdep.cpu.cores_per_package int32_t no" +.It "machdep.cpu.extfamily int32_t no" +.It "machdep.cpu.extfeature_bits int64_t no" +.It "machdep.cpu.extfeatures char[] no" +.It "machdep.cpu.extmodel int32_t no" +.It "machdep.cpu.family int32_t no" +.It "machdep.cpu.feature_bits int64_t no" +.It "machdep.cpu.features char[] no" +.It "machdep.cpu.leaf7_feature_bits uint32_t no" +.It "machdep.cpu.leaf7_features char[] no" +.It "machdep.cpu.logical_per_package int32_t no" +.It "machdep.cpu.max_basic uint32_t no" +.It "machdep.cpu.max_ext uint32_t no" +.It "machdep.cpu.microcode_version int32_t no" +.It "machdep.cpu.model int32_t no" +.It "machdep.cpu.processor_flag int32_t no" +.It "machdep.cpu.signature int32_t no" +.It "machdep.cpu.stepping int32_t no" +.It "machdep.cpu.thread_count int32_t no" +.It "machdep.cpu.tlb.data.large int32_t no" +.It "machdep.cpu.tlb.data.large_level1 int32_t no" +.It "machdep.cpu.tlb.data.small int32_t no" +.It "machdep.cpu.tlb.data.small_level1 int32_t no" +.It "machdep.cpu.tlb.inst.large int32_t no" +.It "machdep.cpu.tlb.inst.small int32_t no" +.It "machdep.cpu.tlb.shared int32_t no" +.It "machdep.cpu.ucupdate int32_t yes" +.It "machdep.cpu.vendor char[] no" +.It "machdep.cpu.xsave.extended_state uint32_t no" +.It "machdep.tsc.deep_idle_rebase uint32_t yes" +.It "machdep.tsc.frequency int64_t no" +.It "machdep.tsc.nanotime.generation uint32_t no" +.It "machdep.tsc.nanotime.shift uint32_t no" .El .Ss CTL_NET The string and integer information available for the CTL_NET level @@ -552,7 +449,6 @@ privilege may change the value. .It "PF_INET IPv4 values yes" .It "PF_INET6 IPv6 values yes" .El -.Pp .Bl -tag -width 6n .It Li PF_ROUTE Return the entire routing table or a subset of it. @@ -564,13 +460,14 @@ The length of each message is contained in the message header. The third level name is a protocol number, which is currently always 0. The fourth level name is an address family, which may be set to 0 to select all address families. -The fifth and sixth level names are as follows: -.Bl -column "Fifth level nameXXXXXX" "Sixth level is:XXX" -offset indent -.It Sy "Fifth level name Sixth level is:" -.It "NET_RT_FLAGS rtflags" -.It "NET_RT_DUMP None" -.It "NET_RT_IFLIST 0 or if_index" -.It "NET_RT_IFMALIST 0 or if_index" +The fifth, sixth, and seventh level names are as follows: +.Bl -column -offset indent "Fifth level Sixth level" "Seventh level" +.It Sy "Fifth level Sixth level" Ta Sy "Seventh level" +.It "NET_RT_FLAGS rtflags" Ta "None" +.It "NET_RT_DUMP None" Ta "None or fib number" +.It "NET_RT_IFLIST 0 or if_index" Ta None +.It "NET_RT_IFMALIST 0 or if_index" Ta None +.It "NET_RT_IFLISTL 0 or if_index" Ta None .El .Pp The @@ -635,98 +532,98 @@ The string and integer information available for the CTL_USER level is detailed below. The changeable column shows whether a process with appropriate privilege may change the value. -.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" -offset indent -.It Sy "Second level name Type Changeable" -.It "USER_BC_BASE_MAX integer no" -.It "USER_BC_DIM_MAX integer no" -.It "USER_BC_SCALE_MAX integer no" -.It "USER_BC_STRING_MAX integer no" -.It "USER_COLL_WEIGHTS_MAX integer no" -.It "USER_CS_PATH string no" -.It "USER_EXPR_NEST_MAX integer no" -.It "USER_LINE_MAX integer no" -.It "USER_POSIX2_CHAR_TERM integer no" -.It "USER_POSIX2_C_BIND integer no" -.It "USER_POSIX2_C_DEV integer no" -.It "USER_POSIX2_FORT_DEV integer no" -.It "USER_POSIX2_FORT_RUN integer no" -.It "USER_POSIX2_LOCALEDEF integer no" -.It "USER_POSIX2_SW_DEV integer no" -.It "USER_POSIX2_UPE integer no" -.It "USER_POSIX2_VERSION integer no" -.It "USER_RE_DUP_MAX integer no" -.It "USER_STREAM_MAX integer no" -.It "USER_TZNAME_MAX integer no" +.Bl -column "xxxxxxxxxxxxxxxxxxxxxxxxx" "xxxxxxxxxx" -offset indent +.It Sy "Name Type Changeable" +.It "user.bc_base_max int32_t no" +.It "user.bc_dim_max int32_t no" +.It "user.bc_scale_max int32_t no" +.It "user.bc_string_max int32_t no" +.It "user.coll_weights_max int32_t no" +.It "user.cs_path char[] no" +.It "user.expr_nest_max int32_t no" +.It "user.line_max int32_t no" +.It "user.posix2_c_bind int32_t no" +.It "user.posix2_c_dev int32_t no" +.It "user.posix2_char_term int32_t no" +.It "user.posix2_fort_dev int32_t no" +.It "user.posix2_fort_run int32_t no" +.It "user.posix2_localedef int32_t no" +.It "user.posix2_sw_dev int32_t no" +.It "user.posix2_upe int32_t no" +.It "user.posix2_version int32_t no" +.It "user.re_dup_max int32_t no" +.It "user.stream_max int32_t no" +.It "user.tzname_max int32_t no" .El .Bl -tag -width 6n .Pp -.It Li USER_BC_BASE_MAX +.It Li "user.bc_base_max" The maximum ibase/obase values in the .Xr bc 1 utility. -.It Li USER_BC_DIM_MAX +.It Li "user.bc_dim_max" The maximum array size in the .Xr bc 1 utility. -.It Li USER_BC_SCALE_MAX +.It Li "user.bc_scale_max" The maximum scale value in the .Xr bc 1 utility. -.It Li USER_BC_STRING_MAX +.It Li "user.bc_string_max" The maximum string length in the .Xr bc 1 utility. -.It Li USER_COLL_WEIGHTS_MAX +.It Li "user.coll_weights_max" The maximum number of weights that can be assigned to any entry of the LC_COLLATE order keyword in the locale definition file. -.It Li USER_CS_PATH +.It Li "user.cs_path" Return a value for the .Ev PATH environment variable that finds all the standard utilities. -.It Li USER_EXPR_NEST_MAX +.It Li "user.expr_nest_max" The maximum number of expressions that can be nested within parenthesis by the .Xr expr 1 utility. -.It Li USER_LINE_MAX +.It Li "user.line_max" The maximum length in bytes of a text-processing utility's input line. -.It Li USER_POSIX2_CHAR_TERM -Return 1 if the system supports at least one terminal type capable of -all operations described in -.St -p1003.2 , -otherwise 0. -.It Li USER_POSIX2_C_BIND +.It Li "user.posix2_c_bind" Return 1 if the system's C-language development facilities support the C-Language Bindings Option, otherwise 0. -.It Li USER_POSIX2_C_DEV +.It Li "user.posix2_c_dev" Return 1 if the system supports the C-Language Development Utilities Option, otherwise 0. -.It Li USER_POSIX2_FORT_DEV +.It Li "user.posix2_char_term" +Return 1 if the system supports at least one terminal type capable of +all operations described in +.St -p1003.2 , +otherwise 0. +.It Li "user.posix2_fort_dev" Return 1 if the system supports the FORTRAN Development Utilities Option, otherwise 0. -.It Li USER_POSIX2_FORT_RUN +.It Li "user.posix2_fort_run" Return 1 if the system supports the FORTRAN Runtime Utilities Option, otherwise 0. -.It Li USER_POSIX2_LOCALEDEF +.It Li "user.posix2_localedef" Return 1 if the system supports the creation of locales, otherwise 0. -.It Li USER_POSIX2_SW_DEV +.It Li "user.posix2_sw_dev" Return 1 if the system supports the Software Development Utilities Option, otherwise 0. -.It Li USER_POSIX2_UPE +.It Li "user.posix2_upe" Return 1 if the system supports the User Portability Utilities Option, otherwise 0. -.It Li USER_POSIX2_VERSION +.It Li "user.posix2_version" The version of .St -p1003.2 with which the system attempts to comply. -.It Li USER_RE_DUP_MAX +.It Li "user.re_dup_max" The maximum number of repeated occurrences of a regular expression permitted when using interval notation. -.It Li USER_STREAM_MAX +.It Li "user.stream_max" The minimum maximum number of streams that a process may have open at any one time. -.It Li USER_TZNAME_MAX +.It Li "user.tzname_max" The minimum maximum number of types supported for the name of a timezone. .El @@ -735,59 +632,37 @@ The string and integer information available for the CTL_VM level is detailed below. The changeable column shows whether a process with appropriate privilege may change the value. -.Bl -column "Second level nameXXXXXX" "struct loadavgXXX" -offset indent -.It Sy "Second level name Type Changeable" -.It "VM_LOADAVG struct loadavg no" -.It "VM_PAGEOUT_ALGORITHM integer yes" -.It "VM_SWAPPING_ENABLED integer maybe" -.It "VM_V_CACHE_MAX integer yes" -.It "VM_V_CACHE_MIN integer yes" -.It "VM_V_FREE_MIN integer yes" -.It "VM_V_FREE_RESERVED integer yes" -.It "VM_V_FREE_TARGET integer yes" -.It "VM_V_INACTIVE_TARGET integer yes" -.It "VM_V_PAGEOUT_FREE_MIN integer yes" +.Bl -column "xxxxxxxxxxxxxxxxxxxxxxxxx" "xxxxxxxxxx" -offset indent +.It Sy "Name Type Changeable" +.It "vm.loadavg struct loadavg no" +.It "vm.swapusage struct xsw_usage no" .El .Pp .Bl -tag -width 6n -.It Li VM_LOADAVG +.It Li "vm.loadavg" Return the load average history. The returned data consists of a .Va struct loadavg . -.It Li VM_PAGEOUT_ALGORITHM -0 if the statistics-based page management algorithm is in use -or 1 if the near-LRU algorithm is in use. -.It Li VM_SWAPPING_ENABLED -1 if process swapping is enabled or 0 if disabled. -This variable is -permanently set to 0 if the kernel was built with swapping disabled. -.It Li VM_V_CACHE_MAX -Maximum desired size of the cache queue. -.It Li VM_V_CACHE_MIN -Minimum desired size of the cache queue. -If the cache queue size -falls very far below this value, the pageout daemon is awakened. -.It Li VM_V_FREE_MIN -Minimum amount of memory (cache memory plus free memory) -required to be available before a process waiting on memory will be -awakened. -.It Li VM_V_FREE_RESERVED -Processes will awaken the pageout daemon and wait for memory if the -number of free and cached pages drops below this value. -.It Li VM_V_FREE_TARGET -The total amount of free memory (including cache memory) that the -pageout daemon tries to maintain. -.It Li VM_V_INACTIVE_TARGET -The desired number of inactive pages that the pageout daemon should -achieve when it runs. -Inactive pages can be quickly inserted into -process address space when needed. -.It Li VM_V_PAGEOUT_FREE_MIN -If the amount of free and cache memory falls below this value, the -pageout daemon will enter "memory conserving mode" to avoid deadlock. .El .Sh RETURN VALUES .Rv -std +.Sh FILES +.Bl -tag -width -compact +.It In sys/sysctl.h +definitions for top level identifiers, second level kernel and hardware +identifiers, and user level identifiers +.It In sys/socket.h +definitions for second level network identifiers +.It In netinet/in.h +definitions for third level IPv4/IPv6 identifiers and +fourth level IPv4/v6 identifiers +.It In netinet/icmp_var.h +definitions for fourth level ICMP identifiers +.It In netinet/icmp6.h +definitions for fourth level ICMPv6 identifiers +.It In netinet/udp_var.h +definitions for fourth level UDP identifiers +.El .Sh ERRORS The following errors may be reported: .Bl -tag -width Er @@ -841,29 +716,8 @@ An attempt is made to set a read-only value. .It Bq Er EPERM A process without appropriate privilege attempts to set a value. .El -.Sh FILES -.Bl -tag -width -compact -.It In sys/sysctl.h -definitions for top level identifiers, second level kernel and hardware -identifiers, and user level identifiers -.It In sys/socket.h -definitions for second level network identifiers -.It In sys/gmon.h -definitions for third level profiling identifiers -.It In mach/vm_param.h -definitions for second level virtual memory identifiers -.It In netinet/in.h -definitions for third level IPv4/IPv6 identifiers and -fourth level IPv4/v6 identifiers -.It In netinet/icmp_var.h -definitions for fourth level ICMP identifiers -.It In netinet/icmp6.h -definitions for fourth level ICMPv6 identifiers -.It In netinet/udp_var.h -definitions for fourth level UDP identifiers -.El .Sh SEE ALSO -.Xr sysctl 1 , +.Xr confstr 3 , .Xr sysconf 3 , .Xr sysctl 8 .Sh HISTORY diff --git a/gen/FreeBSD/sysctlbyname.c b/gen/FreeBSD/sysctlbyname.c index e949a5c..c79d132 100644 --- a/gen/FreeBSD/sysctlbyname.c +++ b/gen/FreeBSD/sysctlbyname.c @@ -14,6 +14,14 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/sysctlbyname.c,v 1.5 2002/02/01 00:57:29 ob #include #include #include +#include +#include + +extern int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, + void *newp, size_t newlen); +extern int +__sysctlbyname(const char *name, size_t namelen, void *oldp, size_t *oldlenp, void *newp, + size_t newlen); int sysctlbyname(const char *name, void *oldp, size_t *oldlenp, void *newp, @@ -24,16 +32,23 @@ sysctlbyname(const char *name, void *oldp, size_t *oldlenp, void *newp, int error; size_t oidlen; +#if !TARGET_IPHONE_SIMULATOR + /* Try primary system call first, fall back if not supported */ + error = __sysctlbyname(name, strlen(name), oldp, oldlenp, newp, newlen); + if ((error == 0) || (errno != ENOSYS)) + return error; +#endif /* !TARGET_IPHONE_SIMULATOR */ + name2oid_oid[0] = 0; /* This is magic & undocumented! */ name2oid_oid[1] = 3; oidlen = sizeof(real_oid); - error = sysctl(name2oid_oid, 2, real_oid, &oidlen, (void *)name, + error = __sysctl(name2oid_oid, 2, real_oid, &oidlen, (void *)name, strlen(name)); if (error < 0) return error; oidlen /= sizeof (int); - error = sysctl(real_oid, oidlen, oldp, oldlenp, newp, newlen); + error = __sysctl(real_oid, oidlen, oldp, oldlenp, newp, newlen); return (error); } diff --git a/gen/FreeBSD/sysctlnametomib.c b/gen/FreeBSD/sysctlnametomib.c index 1a932ec..3b19413 100644 --- a/gen/FreeBSD/sysctlnametomib.c +++ b/gen/FreeBSD/sysctlnametomib.c @@ -31,6 +31,9 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/sysctlnametomib.c,v 1.4 2003/01/04 00:11:11 #include #include +extern int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, + void *newp, size_t newlen); + /* * This function uses a presently undocumented interface to the kernel * to walk the tree and get the type so it can print the value. @@ -49,7 +52,7 @@ sysctlnametomib(const char *name, int *mibp, size_t *sizep) oid[1] = 3; *sizep *= sizeof (int); - error = sysctl(oid, 2, mibp, sizep, (void *)name, strlen(name)); + error = __sysctl(oid, 2, mibp, sizep, (void *)name, strlen(name)); *sizep /= sizeof (int); return (error); } diff --git a/gen/wordexp.3 b/gen/FreeBSD/wordexp.3 similarity index 74% rename from gen/wordexp.3 rename to gen/FreeBSD/wordexp.3 index d2a40c5..498ef1b 100644 --- a/gen/wordexp.3 +++ b/gen/FreeBSD/wordexp.3 @@ -23,54 +23,48 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc/gen/wordexp.3,v 1.6 2003/09/08 19:57:14 ru Exp $ +.\" $FreeBSD$ .\" -.Dd December 27, 2002 +.Dd July 29, 2004 .Dt WORDEXP 3 .Os .Sh NAME .Nm wordexp .Nd "perform shell-style word expansions" +.\" .Sh LIBRARY +.\" .Lb libc .Sh SYNOPSIS .In wordexp.h .Ft int -.Fo wordexp -.Fa "const char *restrict words" -.Fa "wordexp_t *restrict pwordexp" -.Fa "int flags" -.Fc +.Fn wordexp "const char * restrict words" "wordexp_t * restrict we" "int flags" .Ft void -.Fo wordfree -.Fa "wordexp_t *pwordexp" -.Fc +.Fn wordfree "wordexp_t *we" .Sh DESCRIPTION The .Fn wordexp function performs shell-style word expansion on -.Fa words . -It places the list of words into the +.Fa words +and places the list of words into the .Va we_wordv member of -.Fa pwordexp +.Fa we , and the number of words into .Va we_wordc . .Pp The .Fa flags -argument (see -.Sx BUGS ) -is the bitwise inclusive OR of any of the following constants: +argument is the bitwise inclusive OR of any of the following constants: .Bl -tag -width ".Dv WRDE_SHOWERR" .It Dv WRDE_APPEND Append the words to those generated by a previous call to .Fn wordexp . -.It Dv WRDE_DOOFS +.It Dv WRDE_DOOFFS As many .Dv NULL pointers as are specified by the .Va we_offs member of -.Fa pwordexp +.Fa we are added to the front of .Va we_wordv . .It Dv WRDE_NOCMD @@ -81,7 +75,7 @@ See the note in before using this. .It Dv WRDE_REUSE The -.Fa pwordexp +.Fa we argument was passed to a previous successful call to .Fn wordexp but has not been passed to @@ -111,6 +105,12 @@ The .Fn wordfree function frees the memory allocated by .Fn wordexp . +.Sh IMPLEMENTATION NOTES +The +.Fn wordexp +function is implemented as a wrapper around the undocumented +.Ic wordexp +shell built-in command. .Sh RETURN VALUES The .Fn wordexp @@ -151,6 +151,11 @@ Shell syntax error in The .Fn wordfree function returns no value. +.Sh ENVIRONMENT +.Bl -tag -width ".Ev IFS" +.It Ev IFS +Field separator. +.El .Sh EXAMPLES Invoke the editor on all .Pa .c @@ -159,25 +164,43 @@ and .Pa /etc/motd (error checking omitted): .Bd -literal -offset indent -wordexp_t pwordexp; +wordexp_t we; -wordexp("${EDITOR:-vi} *.c /etc/motd", &pwordexp, 0); -execvp(pwordexp->we_wordv[0], pwordexp->we_wordv); +wordexp("${EDITOR:-vi} *.c /etc/motd", &we, 0); +execvp(we.we_wordv[0], we.we_wordv); .Ed +.Sh DIAGNOSTICS +Diagnostic messages from the shell are written to the standard error output +if +.Dv WRDE_SHOWERR +is set in +.Fa flags . .Sh SEE ALSO .Xr sh 1 , .Xr fnmatch 3 , .Xr glob 3 , .Xr popen 3 , .Xr system 3 +.Sh STANDARDS +The +.Fn wordexp +and +.Fn wordfree +functions conform to +.St -p1003.1-2001 . .Sh BUGS -This version of +Do not pass untrusted user data to +.Fn wordexp , +regardless of whether the +.Dv WRDE_NOCMD +flag is set. +The .Fn wordexp -ignores the value of the -.Fa flags -argument. -.Sh COPYRIGHT -Copyright 1995-2002 University Corporation for Atmospheric Research/Unidata +function attempts to detect input that would cause commands to be +executed before passing it to the shell +but it does not use the same parser so it may be fooled. .Pp -Portions of this software were developed by the Unidata Program at the -University Corporation for Atmospheric Research. +The current +.Fn wordexp +implementation does not recognize multibyte characters, since the +shell (which it invokes to perform expansions) does not. diff --git a/gen/FreeBSD/wordexp.c b/gen/FreeBSD/wordexp.c new file mode 100644 index 0000000..4a6316b --- /dev/null +++ b/gen/FreeBSD/wordexp.c @@ -0,0 +1,600 @@ +/*- + * Copyright (c) 2002 Tim J. Robbins. + * 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. + */ + +#include + +#if TARGET_OS_IPHONE +/* */ + +#include +int wordexp(const char *restrict words __unused, wordexp_t *restrict pwordexp __unused, int flags __unused) { + return WRDE_NOSPACE; +} + +void wordfree(wordexp_t *pwordexp __unused) { +} + +#else + +#include "namespace.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "un-namespace.h" +#ifdef __APPLE__ +// For _NSGetEnviron() -- which gives us a pointer to environ +#include +#include +#endif /* __APPLE__ */ + +__FBSDID("$FreeBSD$"); + +#ifdef __APPLE__ +/* + * To maintain backwards compatibility with wordexp_t, we can't put + * we_strings and we_nbytes in wordexp_t. So we create a new structure, + * we_int_t, that has wi_strings and wi_nbytes, as well as the we_wordv + * storage. + */ +typedef struct { + char *wi_strings; + size_t wi_nbytes; + char *wi_wordv[0]; +} we_int_t; +/* + * Normally, we_wordv will point to wi_wordv, so we need macros to convert + * back and forth between wi_wordv and the we_int_t structure. + */ +#define WE_INT_T(x) ((we_int_t *)((char *)(x) - sizeof(we_int_t))) +#define WE_STRINGS(we) (WE_INT_T((we)->we_wordv)->wi_strings) +#define WE_WORDV(x) ((x)->wi_wordv) + +/* + * bash will return success, yet print a command substitution/syntax error + * to stderr. So we need to capture stderr, and see if it contains this error. + */ +static const char command_substitution_str[] = "command substitution"; +static const char syntax_error_str[] = "syntax error"; +static const char unbound_variable_str[] = " unbound variable"; +#endif /* __APPLE__ */ + +static int we_askshell(const char *, wordexp_t *, int); +static int we_check(const char *, int); + +/* + * wordexp -- + * Perform shell word expansion on `words' and place the resulting list + * of words in `we'. See wordexp(3). + * + * Specified by IEEE Std. 1003.1-2001. + */ +int +#ifdef __APPLE__ +wordexp(const char * __restrict words, wordexp_t * __restrict we0, int flags) +#else /* !__APPLE__ */ +wordexp(const char * __restrict words, wordexp_t * __restrict we, int flags) +#endif /* !__APPLE__ */ +{ + int error; +#ifdef __APPLE__ + wordexp_t temp; + wordexp_t *we = &temp; + + if ((error = we_check(words, flags)) != 0) return (error); + we->we_offs = we0->we_offs; + if (flags & WRDE_APPEND) { + size_t i; + size_t vofs = we0->we_wordc + (flags & WRDE_DOOFFS ? we0->we_offs : 0); + we_int_t *wi0 = WE_INT_T(we0->we_wordv); + we_int_t *wi = malloc((vofs + 1) * sizeof(char *) + sizeof(we_int_t)); + + if (!wi) return (WRDE_NOSPACE); + memcpy(wi, wi0, (vofs + 1) * sizeof(char *) + sizeof(we_int_t)); + wi->wi_strings = malloc(wi->wi_nbytes); + if (!wi->wi_strings) { + free(wi); + return (WRDE_NOSPACE); + } + memcpy(wi->wi_strings, wi0->wi_strings, wi->wi_nbytes); + for (i = 0; i < vofs; i++) + if (wi->wi_wordv[i] != NULL) + wi->wi_wordv[i] += wi->wi_strings - wi0->wi_strings; + we->we_wordc = we0->we_wordc; + we->we_wordv = WE_WORDV(wi); + } else { + we->we_wordc = 0; + we->we_wordv = NULL; + } +#else /* !__APPLE__ */ + if (flags & WRDE_REUSE) + wordfree(we); + if ((flags & WRDE_APPEND) == 0) { + we->we_wordc = 0; + we->we_wordv = NULL; + we->we_strings = NULL; + we->we_nbytes = 0; + } + if ((error = we_check(words, flags)) != 0) { + wordfree(we); + return (error); + } +#endif /* !__APPLE__ */ + if ((error = we_askshell(words, we, flags)) != 0) { +#ifdef __APPLE__ + if (error == WRDE_NOSPACE) { + if (flags & WRDE_REUSE) + wordfree(we0); + *we0 = *we; + } else { + wordfree(we); + } +#else /* !__APPLE__ */ + wordfree(we); +#endif /* !__APPLE__ */ + return (error); + } +#ifdef __APPLE__ + if (flags & WRDE_REUSE) + wordfree(we0); + *we0 = *we; +#endif /* __APPLE__ */ + return (0); +} + +static size_t +we_read_fully(int fd, char *buffer, size_t len) +{ + size_t done; + ssize_t nread; + + done = 0; + do { + nread = _read(fd, buffer + done, len - done); + if (nread == -1 && errno == EINTR) + continue; + if (nread <= 0) + break; + done += nread; + } while (done != len); + return done; +} + +/* + * we_askshell -- + * Use the `wordexp' /bin/sh builtin function to do most of the work + * in expanding the word string. This function is complicated by + * memory management. + */ +static int +we_askshell(const char *words, wordexp_t *we, int flags) +{ + int pdes[2]; /* Pipe to child */ + char bbuf[9]; /* Buffer for byte count */ + char wbuf[9]; /* Buffer for word count */ + long nwords, nbytes; /* Number of words, bytes from child */ + long i; /* Handy integer */ + size_t sofs; /* Offset into we->we_strings */ + size_t vofs; /* Offset into we->we_wordv */ + pid_t pid; /* Process ID of child */ + pid_t wpid; /* waitpid return value */ + int status; /* Child exit status */ + int error; /* Our return value */ + int serrno; /* errno to return */ + char *np, *p; /* Handy pointers */ + char *nstrings; /* Temporary for realloc() */ +#ifdef __APPLE__ + int perr[2]; /* Pipe to child error */ + we_int_t *nwv; /* Temporary for realloc() */ + int spawnerr = 0; + posix_spawn_file_actions_t file_actions; + posix_spawnattr_t attr; +#else /* !__APPLE__ */ + char **nwv; /* Temporary for realloc() */ +#endif /* !__APPLE__ */ + sigset_t newsigblock, oldsigblock; + + serrno = errno; + +#ifdef __APPLE__ + if (pipe(pdes) < 0) +#else /* !__APPLE__ */ + if (pipe2(pdes, O_CLOEXEC) < 0) +#endif /* !__APPLE__ */ + return (WRDE_NOSPACE); /* XXX */ +#ifdef __APPLE__ + if (pipe(perr) < 0) { + close(pdes[0]); + close(pdes[1]); + return (WRDE_NOSPACE); /* XXX */ + } +#endif /* __APPLE__ */ + (void)sigemptyset(&newsigblock); + (void)sigaddset(&newsigblock, SIGCHLD); + (void)_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock); +#ifdef __APPLE__ + if ((spawnerr = posix_spawnattr_init(&attr)) != 0) goto spawnerrexit; + do { + sigset_t spawnsig; + if ((spawnerr = posix_spawnattr_setflags(&attr, POSIX_SPAWN_CLOEXEC_DEFAULT)) != 0) break; + (void)sigfillset(&spawnsig); + if ((spawnerr = posix_spawnattr_setsigdefault(&attr, &spawnsig)) != 0) break; + (void)sigemptyset(&spawnsig); + if ((spawnerr = posix_spawnattr_setsigmask(&attr, &spawnsig)) != 0) break; + if ((spawnerr = posix_spawn_file_actions_init(&file_actions)) != 0) break; + do { + char *argv[7] = {"sh"}; + const char cmd[] = "[ $# -gt 0 ] && export IFS=\"$1\";/usr/lib/system/wordexp-helper "; + int a = 1; + char *buf; + int buflen; + char *IFS; + if (pdes[1] == STDOUT_FILENO) { + if ((spawnerr = posix_spawn_file_actions_addinherit_np(&file_actions, STDOUT_FILENO)) != 0) break; + } else { + if ((spawnerr = posix_spawn_file_actions_adddup2(&file_actions, pdes[1], STDOUT_FILENO)) != 0) break; + } + if (perr[1] == STDERR_FILENO) { + if ((spawnerr = posix_spawn_file_actions_addinherit_np(&file_actions, STDERR_FILENO)) != 0) break; + } else { + if ((spawnerr = posix_spawn_file_actions_adddup2(&file_actions, perr[1], STDERR_FILENO)) != 0) break; + } + if (flags & WRDE_UNDEF) argv[a++] = "-u"; + argv[a++] = "-c"; + buflen = (sizeof(cmd) - 1) + strlen(words) + 1; + if ((buf = malloc(buflen)) == NULL) { + spawnerr = errno; + break; + } + strcpy(buf, cmd); + strcat(buf, words); + argv[a++] = buf; + if ((IFS = getenv("IFS")) != NULL) { + argv[a++] = "--"; + argv[a++] = IFS; + } + argv[a] = NULL; + spawnerr = posix_spawn(&pid, _PATH_BSHELL, &file_actions, &attr, argv, *_NSGetEnviron()); + free(buf); + } while(0); + posix_spawn_file_actions_destroy(&file_actions); + } while(0); + posix_spawnattr_destroy(&attr); + if (spawnerr) { +spawnerrexit: + close(pdes[0]); + close(pdes[1]); + close(perr[0]); + close(perr[1]); + errno = spawnerr; + return (WRDE_NOSPACE); /* XXX */ + } +#else /* !__APPLE__ */ + if ((pid = fork()) < 0) { + serrno = errno; + _close(pdes[0]); + _close(pdes[1]); + (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL); + errno = serrno; + return (WRDE_NOSPACE); /* XXX */ + } + else if (pid == 0) { + /* + * We are the child; just get /bin/sh to run the wordexp + * builtin on `words'. + */ + (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL); + if ((pdes[1] != STDOUT_FILENO ? + _dup2(pdes[1], STDOUT_FILENO) : + _fcntl(pdes[1], F_SETFD, 0)) < 0) + _exit(1); + execl(_PATH_BSHELL, "sh", flags & WRDE_UNDEF ? "-u" : "+u", + "-c", "eval \"$1\";eval \"wordexp $2\"", "", + flags & WRDE_SHOWERR ? "" : "exec 2>/dev/null", words, + (char *)NULL); + _exit(1); + } +#endif /* !__APPLE__ */ + + /* + * We are the parent; read the output of the shell wordexp function, + * which is a 32-bit hexadecimal word count, a 32-bit hexadecimal + * byte count (not including terminating null bytes), followed by + * the expanded words separated by nulls. + */ + _close(pdes[1]); +#ifdef __APPLE__ + close(perr[1]); +#endif /* __APPLE__ */ + if (we_read_fully(pdes[0], wbuf, 8) != 8 || + we_read_fully(pdes[0], bbuf, 8) != 8) { + error = flags & WRDE_UNDEF ? WRDE_BADVAL : WRDE_SYNTAX; + serrno = errno; + goto cleanup; + } + wbuf[8] = bbuf[8] = '\0'; + nwords = strtol(wbuf, NULL, 16); + nbytes = strtol(bbuf, NULL, 16) + nwords; + + /* + * Allocate or reallocate (when flags & WRDE_APPEND) the word vector + * and string storage buffers for the expanded words we're about to + * read from the child. + */ +#ifndef __APPLE__ + sofs = we->we_nbytes; +#endif /* !__APPLE__ */ + vofs = we->we_wordc; + if ((flags & (WRDE_DOOFFS|WRDE_APPEND)) == (WRDE_DOOFFS|WRDE_APPEND)) + vofs += we->we_offs; + we->we_wordc += nwords; +#ifndef __APPLE__ + we->we_nbytes += nbytes; +#endif /* !__APPLE__ */ +#ifdef __APPLE__ + if ((nwv = realloc(we->we_wordv ? WE_INT_T(we->we_wordv) : NULL, (we->we_wordc + 1 + + (flags & WRDE_DOOFFS ? we->we_offs : 0)) * + sizeof(char *) + sizeof(we_int_t))) == NULL) +#else /* !__APPLE__ */ + if ((nwv = realloc(we->we_wordv, (we->we_wordc + 1 + + (flags & WRDE_DOOFFS ? we->we_offs : 0)) * + sizeof(char *))) == NULL) +#endif /* !__APPLE__ */ + { + error = WRDE_NOSPACE; + goto cleanup; + } +#ifdef __APPLE__ + if (!we->we_wordv) { + nwv->wi_strings = NULL; + nwv->wi_nbytes = 0; + } + sofs = nwv->wi_nbytes; + nwv->wi_nbytes += nbytes; + we->we_wordv = WE_WORDV(nwv); +#else /* !__APPLE__ */ + we->we_wordv = nwv; +#endif /* !__APPLE__ */ +#ifdef __APPLE__ + if ((nstrings = realloc(nwv->wi_strings, nwv->wi_nbytes)) == NULL) +#else /* !__APPLE__ */ + if ((nstrings = realloc(we->we_strings, we->we_nbytes)) == NULL) +#endif /* !__APPLE__ */ + { + error = WRDE_NOSPACE; + goto cleanup; + } + for (i = 0; i < vofs; i++) + if (we->we_wordv[i] != NULL) +#ifdef __APPLE__ + we->we_wordv[i] += nstrings - nwv->wi_strings; +#else /* !__APPLE__ */ + we->we_wordv[i] += nstrings - we->we_strings; +#endif /* !__APPLE__ */ +#ifdef __APPLE__ + nwv->wi_strings = nstrings; +#else /* !__APPLE__ */ + we->we_strings = nstrings; +#endif /* !__APPLE__ */ + +#ifdef __APPLE__ + if (we_read_fully(pdes[0], nwv->wi_strings + sofs, nbytes) != nbytes) +#else /* !__APPLE__ */ + if (we_read_fully(pdes[0], we->we_strings + sofs, nbytes) != nbytes) +#endif /* !__APPLE__ */ + { + error = flags & WRDE_UNDEF ? WRDE_BADVAL : WRDE_SYNTAX; + serrno = errno; + goto cleanup; + } +#ifdef __APPLE__ + char err_buf[1024]; + ssize_t err_sz = read(perr[0], err_buf, sizeof(err_buf) - 1); + if (err_sz > 0) { + err_buf[err_sz] = '\0'; + if (flags & WRDE_SHOWERR) { + fputs(err_buf, stderr); + } + } else if (err_sz < 0) { + serrno = errno; + error = WRDE_NOSPACE; + goto cleanup; + } +#endif /* __APPLE__ */ + + error = 0; +cleanup: + _close(pdes[0]); +#ifdef __APPLE__ + close(perr[0]); +#endif /* __APPLE__ */ + do + wpid = _waitpid(pid, &status, 0); + while (wpid < 0 && errno == EINTR); + (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL); + if (error != 0) { + errno = serrno; + return (error); + } + if (wpid < 0 || !WIFEXITED(status) || WEXITSTATUS(status) != 0) + return (flags & WRDE_UNDEF ? WRDE_BADVAL : WRDE_SYNTAX); +#ifdef __APPLE__ + const char *cs = strstr(err_buf, command_substitution_str); + if (cs && strstr(cs + (sizeof(command_substitution_str) - 1), syntax_error_str)) { + return (strstr(err_buf, unbound_variable_str) ? WRDE_BADVAL : WRDE_SYNTAX); + } +#endif /* __APPLE__ */ + + /* + * Break the null-terminated expanded word strings out into + * the vector. + */ + if (vofs == 0 && flags & WRDE_DOOFFS) + while (vofs < we->we_offs) + we->we_wordv[vofs++] = NULL; +#ifdef __APPLE__ + p = nwv->wi_strings + sofs; +#else /* !__APPLE__ */ + p = we->we_strings + sofs; +#endif /* !__APPLE__ */ + while (nwords-- != 0) { + we->we_wordv[vofs++] = p; + if ((np = memchr(p, '\0', nbytes)) == NULL) + return (WRDE_NOSPACE); /* XXX */ + nbytes -= np - p + 1; + p = np + 1; + } + we->we_wordv[vofs] = NULL; + + return (0); +} + +/* + * we_check -- + * Check that the string contains none of the following unquoted + * special characters: |&;<>(){} + * or command substitutions when WRDE_NOCMD is set in flags. + */ +static int +we_check(const char *words, int flags) +{ + char c; + int dquote, level, quote, squote; + + quote = squote = dquote = 0; + while ((c = *words++) != '\0') { + switch (c) { + case '\\': + if (squote == 0) + quote ^= 1; + continue; + case '\'': + if (quote + dquote == 0) + squote ^= 1; + break; + case '"': + if (quote + squote == 0) + dquote ^= 1; + break; + case '`': + if (quote + squote == 0 && flags & WRDE_NOCMD) + return (WRDE_CMDSUB); + while ((c = *words++) != '\0' && c != '`') + if (c == '\\' && (c = *words++) == '\0') + break; + if (c == '\0') + return (WRDE_SYNTAX); + break; + case '|': case '&': case ';': case '<': case '>': + case '{': case '}': case '(': case ')': case '\n': + if (quote + squote + dquote == 0) + return (WRDE_BADCHAR); + break; + case '$': + if ((c = *words++) == '\0') + break; + else if (quote + squote == 0 && c == '(') { + if (flags & WRDE_NOCMD && *words != '(') + return (WRDE_CMDSUB); + level = 1; + while ((c = *words++) != '\0') { + if (c == '\\') { + if ((c = *words++) == '\0') + break; + } else if (c == '(') + level++; + else if (c == ')' && --level == 0) + break; + } + if (c == '\0' || level != 0) + return (WRDE_SYNTAX); + } else if (quote + squote == 0 && c == '{') { + level = 1; + while ((c = *words++) != '\0') { + if (c == '\\') { + if ((c = *words++) == '\0') + break; + } else if (c == '{') + level++; + else if (c == '}' && --level == 0) + break; + } + if (c == '\0' || level != 0) + return (WRDE_SYNTAX); + } else + --words; + break; + default: + break; + } + quote = 0; + } + if (quote + squote + dquote != 0) + return (WRDE_SYNTAX); + + return (0); +} + +/* + * wordfree -- + * Free the result of wordexp(). See wordexp(3). + * + * Specified by IEEE Std. 1003.1-2001. + */ +void +wordfree(wordexp_t *we) +{ + + if (we == NULL) + return; +#ifdef __APPLE__ + if (we->we_wordv) { + free(WE_STRINGS(we)); + free(WE_INT_T(we->we_wordv)); + } +#else /* !__APPLE__ */ + free(we->we_wordv); +#endif /* !__APPLE__ */ +#ifndef __APPLE__ + free(we->we_strings); +#endif /* !__APPLE__ */ + we->we_wordv = NULL; +#ifndef __APPLE__ + we->we_strings = NULL; + we->we_nbytes = 0; +#endif /* !__APPLE__ */ + we->we_wordc = 0; +} + +#endif /* TARGET_OS_IPHONE */ diff --git a/gen/NSSystemDirectories.c b/gen/NSSystemDirectories.c deleted file mode 100644 index 574b1a1..0000000 --- a/gen/NSSystemDirectories.c +++ /dev/null @@ -1,386 +0,0 @@ -/* - * Copyright (c) 1999, 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@ - */ -#include -#include -#include -#include -#include -#include - -#define NSUserDomainIndex 0 -#define NSLocalDomainIndex 1 -#define NSNetworkDomainIndex 2 -#define NSSystemDomainIndex 3 - -#define numDomains (NSSystemDomainIndex + 1) -#define DomainMask ((1 << numDomains) - 1) - -#define addNextRoot(x) (*(x) == '/' || *(x) == 0) - -#define Network "/Network" -#define System "/System" -#define Tilde "~" - -#define NSApplicationDirectoryBase "/Applications" -#define NSDemoApplicationDirectoryBase "/Applications/Demos" -#define NSDeveloperApplicationDirectoryBase "/Developer/Applications" -#define NSAdminApplicationDirectoryBase "/Applications/Utilities" -#define NSLibraryDirectoryBase "/Library" -#define NSDeveloperDirectoryBase "/Developer" -#define NSUserDirectoryBase "/Users" -#define NSDocumentationDirectoryBase "/Library/Documentation" -#define NSDocumentDirectoryBase "/Documents" -#define NSCoreServiceDirectoryBase "/Library/CoreServices" -#define NSAutosavedDocumentsDirectoryBase "/Library/Autosave Information" -#define NSDesktopDirectoryBase "/Desktop" -#define NSCachesDirectoryBase "/Library/Caches" -#define NSInputMethodsDirectoryBase "/Library/Input Methods" -#define NSMoviesDirectoryBase "/Movies" -#define NSMusicDirectoryBase "/Music" -#define NSPicturesDirectoryBase "/Pictures" -#define NSPrinterDescriptionDirectoryBase "/Library/Printers/PPDs" -#define NSSharedPublicDirectoryBase "/Public" -#define NSPreferencePanesDirectoryBase "/Library/PreferencePanes" -#define NSApplicationSupportDirectoryBase "/Library/Application Support" -#define NSDownloadsDirectoryBase "/Downloads" - -static const char * const prefixAll[] = { - Tilde, - "", - Network, - "" -}; -static const char * const prefixAllSystem[] = { - Tilde, - "", - Network, - System -}; -static const char * const prefixNoUserSystem[] = { - NULL, - "", - Network, - NULL -}; -static const char * const prefixNoNetwork[] = { - Tilde, - "", - NULL, - System -}; -static const char * const prefixSystemOnly[] = { - NULL, - NULL, - NULL, - System -}; -static const char * const prefixUserOnly[] = { - Tilde, - NULL, - NULL, - NULL -}; - -static const char * const _prefixNetwork4[] = { - Network, - Network, - Network, - Network -}; -static const char * const _prefixNone4[] = { - "", - "", - "", - "" -}; -static const char * const _prefixTilde4[] = { - Tilde, - Tilde, - Tilde, - Tilde -}; -static const char * const * const prefixAllApplicationsDirectory[] = { - _prefixTilde4, - _prefixNone4, - _prefixNetwork4, - _prefixNone4 -}; -static const char * const baseAllApplicationsDirectory[] = { - NSApplicationDirectoryBase, - NSAdminApplicationDirectoryBase, - NSDeveloperApplicationDirectoryBase, - NSDemoApplicationDirectoryBase -}; - -static const char * const _prefixNetwork2[] = { - Network, - Network -}; -static const char * const _prefixNone2[] = { - "", - "" -}; -static const char * const _prefixSystemNone2[] = { - System, - "" -}; -static const char * const _prefixTilde2[] = { - Tilde, - Tilde -}; -static const char * const * const prefixAllLibrariesDirectory[] = { - _prefixTilde2, - _prefixNone2, - _prefixNetwork2, - _prefixSystemNone2 -}; -static const char * const baseAllLibrariesDirectory[] = { - NSLibraryDirectoryBase, - NSDeveloperDirectoryBase -}; - -// The dirInfo table drives path creation -static struct { - int pathsPerDomain; - const void * const * const prefix; - const void * const base; -} dirInfo[] = { - { // NSApplicationDirectory - 1, - (const void * const * const)prefixAll, - (const void * const)NSApplicationDirectoryBase - }, - { // NSDemoApplicationDirectory - 1, - (const void * const * const)prefixAll, - (const void * const)NSDemoApplicationDirectoryBase - }, - { // NSDeveloperApplicationDirectory - 1, - (const void * const * const)prefixAll, - (const void * const)NSDeveloperApplicationDirectoryBase - }, - { // NSAdminApplicationDirectory - 1, - (const void * const * const)prefixAll, - (const void * const)NSAdminApplicationDirectoryBase - }, - { // NSLibraryDirectory - 1, - (const void * const * const)prefixAllSystem, - (const void * const)NSLibraryDirectoryBase - }, - { // NSDeveloperDirectory - 1, - (const void * const * const)prefixAll, - (const void * const)NSDeveloperDirectoryBase - }, - { // NSUserDirectory - 1, - (const void * const * const)prefixNoUserSystem, - (const void * const)NSUserDirectoryBase - }, - { // NSDocumentationDirectory - 1, - (const void * const * const)prefixAllSystem, - (const void * const)NSDocumentationDirectoryBase - }, - { // NSDocumentDirectory - 1, - (const void * const * const)prefixUserOnly, - (const void * const)NSDocumentDirectoryBase - }, - { // NSCoreServiceDirectory - 1, - (const void * const * const)prefixSystemOnly, - (const void * const)NSCoreServiceDirectoryBase - }, - { // NSAutosavedInformationDirectory - 1, - (const void * const * const)prefixUserOnly, - (const void * const)NSAutosavedDocumentsDirectoryBase - }, - { // NSDesktopDirectory - 1, - (const void * const * const)prefixUserOnly, - (const void * const)NSDesktopDirectoryBase - }, - { // NSCachesDirectory - 1, - (const void * const * const)prefixNoNetwork, - (const void * const)NSCachesDirectoryBase - }, - { // NSApplicationSupportDirectory - 1, - (const void * const * const)prefixAll, - (const void * const)NSApplicationSupportDirectoryBase - }, - { // NSDownloadsDirectory - 1, - (const void * const * const)prefixUserOnly, - (const void * const)NSDownloadsDirectoryBase - }, - { // NSInputMethodsDirectory - 1, - (const void * const * const)prefixAllSystem, - (const void * const)NSInputMethodsDirectoryBase - }, - { // NSMoviesDirectory - 1, - (const void * const * const)prefixUserOnly, - (const void * const)NSMoviesDirectoryBase - }, - { // NSMusicDirectory - 1, - (const void * const * const)prefixUserOnly, - (const void * const)NSMusicDirectoryBase - }, - { // NSPicturesDirectory - 1, - (const void * const * const)prefixUserOnly, - (const void * const)NSPicturesDirectoryBase - }, - { // NSPrinterDescriptionDirectory - 1, - (const void * const * const)prefixSystemOnly, - (const void * const)NSPrinterDescriptionDirectoryBase - }, - { // NSSharedPublicDirectory - 1, - (const void * const * const)prefixUserOnly, - (const void * const)NSSharedPublicDirectoryBase - }, - { // NSPreferencePanesDirectory - 1, - (const void * const * const)prefixNoNetwork, - (const void * const)NSPreferencePanesDirectoryBase - }, - { // NSAllApplicationsDirectory - 4, - (const void * const * const)prefixAllApplicationsDirectory, - (const void * const)baseAllApplicationsDirectory - }, - { // NSAllLibrariesDirectory - 2, - (const void * const * const)prefixAllLibrariesDirectory, - (const void * const)baseAllLibrariesDirectory - } -}; - -#define Index(dir) (((dir) >= NSApplicationDirectory && (dir) <= NSPreferencePanesDirectory) ? ((dir) - 1) : (((dir) >= NSAllApplicationsDirectory && (dir) <= NSAllLibrariesDirectory) ? ((dir) - NSAllApplicationsDirectory + NSPreferencePanesDirectory) : -1)) - -#define invalidDomains 0x00 // some domains may be invalid on non-Mach systems -#define ByteMask 0xff -#define DirShift 24 -#define IndexShift 16 - -NSSearchPathEnumerationState NSStartSearchPathEnumeration(NSSearchPathDirectory dir, NSSearchPathDomainMask domainMask) { - // The state is AABBCCCC, where - // AA is the dir(s) requested - // BB is the current state of dirs (if AA < 100, then this is always 0; otherwise it goes up to number of dirs) - // CCCC is the domains requested - // the state always contains the next item; if CCCC is 0, then we're done - int i; - - if((i = Index(dir)) < 0) { - return 0; - } - domainMask = domainMask & DomainMask & ~invalidDomains; // Just leave useful bits in there - - // Trim Duplicates - This assumes the compiler generates a single address - // for multiple occurrences of the same literal strings. - if ((domainMask & (NSLocalDomainMask | NSSystemDomainMask)) == (NSLocalDomainMask | NSSystemDomainMask) && dirInfo[i].prefix[NSLocalDomainIndex] == dirInfo[i].prefix[NSSystemDomainIndex]) { - domainMask &= ~NSSystemDomainMask; - } - - return (dir << DirShift) + domainMask; -} - -static const char *nextRoot = NULL; -static pthread_once_t nextRoot_init_once = PTHREAD_ONCE_INIT; - -static void -nextRoot_init(void) -{ - if (!issetugid() && (nextRoot = getenv("NEXT_ROOT")) != NULL) { - nextRoot = strdup(nextRoot); - } - if (nextRoot == NULL) { - nextRoot = ""; - } -} - -NSSearchPathEnumerationState NSGetNextSearchPathEnumeration(NSSearchPathEnumerationState state, char *path) { - int dir = (state >> DirShift) & ByteMask; - int domainMask = state & DomainMask; - int domain, i, n; - const char *prefix, *base; - - if ((i = Index(dir)) < 0 || (domain = ffs(domainMask)) == 0) - return 0; - domain--; // adjust to zero-based index - - if ((n = dirInfo[i].pathsPerDomain) == 1) { - const char * const *p = (const char * const *)dirInfo[i].prefix; - for (;;) { // loop, skipping over invalid domains (prefix is NULL) - domainMask &= ~(1 << domain); - if ((prefix = p[domain]) != NULL) { - break; - } - if ((domain = ffs(domainMask)) == 0) { - return 0; - } - domain--; // adjust to zero-based index - } - base = (const char *)dirInfo[i].base; - state = (dir << DirShift) + domainMask; - } else { // multiple paths per domain - const char * const **p = (const char * const **)dirInfo[i].prefix; - const char * const *b = (const char * const *)dirInfo[i].base; - int dirIndex = (state >> IndexShift) & ByteMask; - - if (dirIndex >= n) { // done with the current domain, go to the next - domainMask &= ~(1 << domain); - if ((domain = ffs(domainMask)) == 0) { - return 0; - } - domain--; // adjust to zero-based index - dirIndex = 0; - } - prefix = p[domain][dirIndex]; - base = b[dirIndex]; - state = (dir << DirShift) + (++dirIndex << IndexShift) + domainMask; - } - - if (addNextRoot(prefix)) { - if (pthread_once(&nextRoot_init_once, nextRoot_init) != 0 || nextRoot == NULL)// Error - return 0; - strlcpy(path, nextRoot, PATH_MAX); - } else { - *path = 0; - } - strlcat(path, prefix, PATH_MAX); - strlcat(path, base, PATH_MAX); - - return state; -} diff --git a/gen/confstr.c b/gen/confstr.c index 196d195..a7f9613 100644 --- a/gen/confstr.c +++ b/gen/confstr.c @@ -64,9 +64,47 @@ #include #include /* for P_tmpdir */ +#ifndef __has_include #include +#else +#if __has_include() +#include +#else +typedef enum { + DIRHELPER_USER_LOCAL = 0, + DIRHELPER_USER_LOCAL_TEMP, + DIRHELPER_USER_LOCAL_CACHE, + DIRHELPER_USER_LOCAL_LAST = DIRHELPER_USER_LOCAL_CACHE +} dirhelper_which_t; +#endif +#endif + +#include "libc_private.h" + +#if __DARWIN_UNIX03 +static char *(*__dirhelper_func)(int, char *, size_t); + +__attribute__((__visibility__("hidden"))) +void +__confstr_init(const struct _libc_functions *funcs) +{ + __dirhelper_func = funcs->dirhelper; +} -extern char *_dirhelper(dirhelper_which_t which, char *path, size_t pathlen); +__attribute__((__visibility__("hidden"))) +char * +__dirhelper(dirhelper_which_t which, char *path, size_t pathlen) +{ + if (__dirhelper_func) { + return __dirhelper_func(which, path, pathlen); + } else { + return NULL; + } +} +#else // !__DARWIN_UNIX03 +__attribute__((__visibility__("hidden"))) +char *__dirhelper(dirhelper_which_t which, char *path, size_t pathlen); +#endif // !__DARWIN_UNIX03 #if __DARWIN_UNIX03 #define CONFSTR_ERR_RET 0 @@ -176,7 +214,7 @@ docopy: errno = ENOMEM; return (CONFSTR_ERR_RET); } - if (_dirhelper(DIRHELPER_USER_LOCAL, p, PATH_MAX) == NULL) { + if (__dirhelper(DIRHELPER_USER_LOCAL, p, PATH_MAX) == NULL) { if (errno != ENOMEM) errno = EIO; return (CONFSTR_ERR_RET); @@ -188,10 +226,10 @@ docopy: errno = ENOMEM; return (CONFSTR_ERR_RET); } - if (_dirhelper(DIRHELPER_USER_LOCAL_TEMP, p, PATH_MAX) == NULL) { + if (__dirhelper(DIRHELPER_USER_LOCAL_TEMP, p, PATH_MAX) == NULL) { int dh_errno = errno; /* - * If _dirhelper() fails, try TMPDIR and P_tmpdir, + * If __dirhelper() fails, try TMPDIR and P_tmpdir, * finally failing otherwise. */ if ((p = getenv("TMPDIR")) && access(p, W_OK) == 0) @@ -211,7 +249,7 @@ docopy: errno = ENOMEM; return (CONFSTR_ERR_RET); } - if (_dirhelper(DIRHELPER_USER_LOCAL_CACHE, p, PATH_MAX) == NULL) { + if (__dirhelper(DIRHELPER_USER_LOCAL_CACHE, p, PATH_MAX) == NULL) { if (errno != ENOMEM) errno = EIO; return (CONFSTR_ERR_RET); diff --git a/gen/directory.3 b/gen/directory.3 index 3b21d9a..b94998b 100644 --- a/gen/directory.3 +++ b/gen/directory.3 @@ -26,62 +26,97 @@ .\" SUCH DAMAGE. .\" .\" @(#)directory.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD: src/lib/libc/gen/directory.3,v 1.12 2001/10/01 16:08:50 ru Exp $ +.\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd April 16, 2008 .Dt DIRECTORY 3 .Os .Sh NAME -.Nm closedir , -.Nm dirfd , .Nm opendir , +.Nm fdopendir , .Nm readdir , .Nm readdir_r , -.Nm rewinddir , +.Nm telldir , .Nm seekdir , -.Nm telldir +.Nm rewinddir , +.Nm closedir , +.Nm dirfd .Nd directory operations .Sh LIBRARY .Lb libc .Sh SYNOPSIS .In dirent.h -.Ft int -.Fn closedir "DIR *dirp" -.Ft int -.Fn dirfd "DIR *dirp" .Ft DIR * -.Fn opendir "const char *dirname" +.Fn opendir "const char *filename" +.Ft DIR * +.Fn fdopendir "int fd" .Ft struct dirent * .Fn readdir "DIR *dirp" .Ft int -.Fn readdir_r "DIR *restrict dirp" "struct dirent *restrict entry" \ - "struct dirent **restrict result" -.Ft void -.Fn rewinddir "DIR *dirp" -.Ft void -.Fn seekdir "DIR *dirp" "long loc" +.Fn readdir_r "DIR *dirp" "struct dirent *entry" "struct dirent **result" .Ft long .Fn telldir "DIR *dirp" +.Ft void +.Fn seekdir "DIR *dirp" "long loc" +.Ft void +.Fn rewinddir "DIR *dirp" +.Ft int +.Fn closedir "DIR *dirp" +.Ft int +.Fn dirfd "DIR *dirp" .Sh DESCRIPTION The .Fn opendir function opens the directory named by -.Fa dirname , +.Fa filename , associates a .Em directory stream -with it, -and returns a pointer to be used to identify the +with it +and +returns a pointer to be used to identify the .Em directory stream in subsequent operations. -In the event of an error, NULL -is returned and -.Va errno -will be set to reflect if -.Fa dirname -cannot be accessed or if it cannot +The pointer +.Dv NULL +is returned if +.Fa filename +cannot be accessed, or if it cannot .Xr malloc 3 -enough memory to hold the whole thing. +enough memory to hold the whole thing, +and sets the global variable +.Va errno +to indicate the error. +.Pp +The +.Fn fdopendir +function is equivalent to the +.Fn opendir +function except that the directory is specified by a file descriptor +.Fa fd +rather than by a name. +./"The file offset associated with the file descriptor at the time of the call +./"determines which entries are returned. +.Pp +Upon successful return from +.Fn fdopendir , +the file descriptor is under the control of the system, +and if any attempt is made to close the file descriptor, +or to modify the state of the associated description other than by means +of +.Fn closedir , +.Fn readdir , +.Fn readdir_r , +or +.Fn rewinddir , +the behavior is undefined. +Upon calling +.Fn closedir +the file descriptor is closed. +The +.Dv FD_CLOEXEC +flag is set on the file descriptor by a successful call to +.Fn fdopendir . .Pp The .Fn readdir @@ -92,7 +127,7 @@ It returns upon reaching the end of the directory or on error. In the event of an error, .Va errno -will be set to any of the values documented for the +may be set to any of the values documented for the .Xr getdirentries 2 system call. .Pp @@ -108,7 +143,7 @@ If the read succeeds, .Fa result is pointed at the .Fa entry ; -upon reaching the end of the directory, +upon reaching the end of the directory .Fa result is set to .Dv NULL . @@ -126,8 +161,8 @@ Values returned by .Fn telldir are good only for the lifetime of the .Dv DIR -pointer (e.g., -.Fa dirp ) +pointer, +.Fa dirp , from which they are derived. If the directory is closed and then reopened, prior values returned by @@ -171,8 +206,8 @@ The .Fn dirfd function returns the integer file descriptor associated with the named -.Em directory stream -on success, see +.Em directory stream , +see .Xr open 2 . On failure, \-1 is returned and the global variable .Va errno @@ -193,28 +228,25 @@ while ((dp = readdir(dirp)) != NULL) { (void)closedir(dirp); return (NOT_FOUND); .Ed -.Sh LEGACY SYNOPSIS -.Fd #include -.Fd #include -.Pp -.In sys/types.h -is necessary for these functions. .Sh SEE ALSO .Xr close 2 , .Xr lseek 2 , .Xr open 2 , .Xr read 2 , -.Xr compat 5 , .Xr dir 5 .Sh HISTORY The -.Fn closedir , -.Fn dirfd , .Fn opendir , .Fn readdir , -.Fn rewinddir , +.Fn telldir , .Fn seekdir , +.Fn rewinddir , +.Fn closedir , and -.Fn telldir +.Fn dirfd functions appeared in .Bx 4.2 . +The +.Fn fdopendir +function appeared in +.Fx 8.0 . diff --git a/gen/nanosleep.c b/gen/nanosleep.c index 6cad277..71ad76c 100644 --- a/gen/nanosleep.c +++ b/gen/nanosleep.c @@ -36,7 +36,7 @@ #include #include -#if !defined(BUILDING_VARIANT) && !TARGET_IPHONE_SIMULATOR +#if !defined(BUILDING_VARIANT) semaphore_t clock_sem = MACH_PORT_NULL; mach_port_t clock_port = MACH_PORT_NULL; diff --git a/gen/strtofflags.c b/gen/strtofflags.c index d112983..b7a04d6 100644 --- a/gen/strtofflags.c +++ b/gen/strtofflags.c @@ -83,6 +83,7 @@ static struct { { "noschg", SF_IMMUTABLE, 0 }, { "noschange", SF_IMMUTABLE, 0 }, { "nosimmutable", SF_IMMUTABLE, 0 }, + { "norestricted", SF_RESTRICTED, 0 }, { "nouappnd", UF_APPEND, 0 }, { "nouappend", UF_APPEND, 0 }, { "nouchg", UF_IMMUTABLE, 0 }, diff --git a/gen/utmpx-darwin.c b/gen/utmpx-darwin.c index ac8b96d..485fa5d 100644 --- a/gen/utmpx-darwin.c +++ b/gen/utmpx-darwin.c @@ -41,8 +41,6 @@ #include #include #include -#include -#include #include #include @@ -57,13 +55,24 @@ #include #endif /* UTMP_COMPAT */ +#if ASL_API_VERSION < 20131108 +#include +#include +#endif + __private_extern__ const char __utx_magic__[UTMPX_MAGIC] = __UTX_MAGIC__; extern const char _utmpx_vers[]; /* in utmpx.c */ +#if ASL_API_VERSION < 20131108 static void msg2lastlogx(const aslmsg, struct lastlogx *); static void msg2utmpx(const aslmsg, struct utmpx *); static void utmpx2msg(const struct utmpx *, aslmsg); +#else +static void msg2lastlogx(asl_object_t, struct lastlogx *); +static void msg2utmpx(asl_object_t, struct utmpx *); +static void utmpx2msg(const struct utmpx *, asl_object_t); +#endif static size_t pw_size = 0; @@ -140,51 +149,86 @@ getlastlogx(uid_t uid, struct lastlogx *lx) struct lastlogx * getlastlogxbyname(const char *user, struct lastlogx *lx) { +#if ASL_API_VERSION < 20131108 aslmsg m; asl_msg_t *qm[1]; asl_search_result_t query, *res; uint32_t status; + asl_store_t *store = NULL; uint64_t cmax; +#else + asl_object_t m, query, res; + size_t cmax; +#endif struct lastlogx *result = NULL; - asl_store_t *store; if (!user || !*user) return NULL; - store = NULL; +#if ASL_API_VERSION < 20131108 status = asl_store_open_read(NULL, &store); if (status != 0) return NULL; if (store == NULL) return NULL; +#endif /* * We search for the last LASTLOG_FACILITY entry that has the * ut_user entry matching the user's name. */ - if ((m = asl_new(ASL_TYPE_QUERY)) == NULL) + m = asl_new(ASL_TYPE_QUERY); + if (m == NULL) { +#if ASL_API_VERSION < 20131108 asl_store_close(store); +#endif return NULL; } asl_set_query(m, FACILITY, LASTLOG_FACILITY, ASL_QUERY_OP_EQUAL); asl_set_query(m, "ut_user", user, ASL_QUERY_OP_EQUAL); + +#if ASL_API_VERSION < 20131108 qm[0] = (asl_msg_t *)m; query.count = 1; query.msg = qm; +#else + query = asl_new(ASL_TYPE_LIST); + if (query == NULL) + { + asl_release(m); + return NULL; + } + + asl_append(query, m); + asl_release(m); +#endif res = NULL; cmax = 0; +#if ASL_API_VERSION < 20131108 asl_store_match_timeout(store, &query, &res, &cmax, -1, 1, -1, ASL_QUERY_TIMEOUT); asl_store_close(store); asl_free(m); +#else + res = asl_match(NULL, query, &cmax, -1, 1, ASL_QUERY_TIMEOUT, ASL_MATCH_DIRECTION_REVERSE); + asl_release(query); +#endif - if (status != 0) return NULL; if (res == NULL) return NULL; +#if ASL_API_VERSION < 20131108 m = aslresponse_next(res); +#else + m = asl_next(res); +#endif + if (m == NULL) { +#if ASL_API_VERSION < 20131108 aslresponse_free(res); +#else + asl_release(res); +#endif return NULL; } @@ -192,13 +236,21 @@ getlastlogxbyname(const char *user, struct lastlogx *lx) { if ((lx = (struct lastlogx *)malloc(sizeof(*lx))) == NULL) { +#if ASL_API_VERSION < 20131108 aslresponse_free(res); +#else + asl_release(res); +#endif return NULL; } } msg2lastlogx(m, lx); +#if ASL_API_VERSION < 20131108 aslresponse_free(res); +#else + asl_release(res); +#endif result = lx; return result; @@ -210,9 +262,13 @@ getlastlogxbyname(const char *user, struct lastlogx *lx) #define SGET(e,p) if ((cp = asl_get(m, __STRING(ut_##e))) != NULL) \ strncpy(u->p##_##e, cp, sizeof(u->p##_##e)) -/* fill in a struct lastlogx from a aslmsg */ +/* fill in a struct lastlogx from an ASL message */ static void +#if ASL_API_VERSION < 20131108 msg2lastlogx(const aslmsg m, struct lastlogx *u) +#else +msg2lastlogx(asl_object_t m, struct lastlogx *u) +#endif { const char *cp; @@ -223,9 +279,13 @@ msg2lastlogx(const aslmsg m, struct lastlogx *u) SGET(host, ll); } -/* fill in a struct utmpx from a aslmsg */ +/* fill in a struct utmpx from an ASL message */ static void -msg2utmpx(const aslmsg m, struct utmpx *u) +#if ASL_API_VERSION < 20131108 +msg2utmpx(aslmsg m, struct utmpx *u) +#else +msg2utmpx(asl_object_t m, struct utmpx *u) +#endif { const char *cp; @@ -240,9 +300,13 @@ msg2utmpx(const aslmsg m, struct utmpx *u) SGET(host, ut); } -/* fill in a aslmsg from a struct utmpx */ +/* fill in an ASL message from a struct utmpx */ static void +#if ASL_API_VERSION < 20131108 utmpx2msg(const struct utmpx *u, aslmsg m) +#else +utmpx2msg(const struct utmpx *u, asl_object_t m) +#endif { char buf[_UTX_HOSTSIZE + 1]; /* the largest string in struct utmpx */ const char *cp; @@ -291,18 +355,27 @@ static const char *utmpx_types[] = { "SHUTDOWN_TIME", /* 11 */ }; -/* send a struct utmpx record using asl */ +/* send a struct utmpx record using ASL */ __private_extern__ void _utmpx_asl(const struct utmpx *u) { +#if ASL_API_VERSION < 20131108 aslclient asl = asl_open(NULL, NULL, ASL_OPT_NO_REMOTE); /* could be NULL, but still works */ aslmsg m; +#else + asl_object_t asl = asl_open(NULL, NULL, ASL_OPT_NO_REMOTE); + asl_object_t m; +#endif char msg[64]; if (u->ut_type == EMPTY) return; if ((m = asl_new(ASL_TYPE_MSG)) == NULL) { +#if ASL_API_VERSION < 20131108 asl_close(asl); +#else + asl_release(asl); +#endif return; } /* @@ -343,9 +416,13 @@ _utmpx_asl(const struct utmpx *u) } asl_set(m, ASL_KEY_MSG, msg); asl_send(asl, m); +#if ASL_API_VERSION < 20131108 asl_free(m); - if (asl) - asl_close(asl); + asl_close(asl); +#else + asl_release(m); + asl_release(asl); +#endif } #define UT_USER (1 << 0) @@ -479,10 +556,15 @@ static struct { get_asl, set_asl }; + static struct { uint64_t start; int dir; +#if ASL_API_VERSION < 20131108 asl_search_result_t *res; +#else + asl_object_t res; +#endif char *str; uint32_t len; char inited; @@ -575,7 +657,11 @@ end_asl(void) { if (wtmp_asl.res != NULL) { +#if ASL_API_VERSION < 20131108 aslresponse_free(wtmp_asl.res); +#else + asl_release(wtmp_asl.res); +#endif wtmp_asl.res = NULL; } @@ -599,16 +685,28 @@ end_file(void) static struct utmpx * get_asl(void) { +#if ASL_API_VERSION < 20131108 aslmsg m; +#else + asl_object_t m; +#endif static struct utmpx utx; if (wtmp_asl.inited == 0) set_asl(-1); if (wtmp_asl.done != 0) return NULL; +#if ASL_API_VERSION < 20131108 m = aslresponse_next(wtmp_asl.res); +#else + m = asl_next(wtmp_asl.res); +#endif if (m == NULL) { +#if ASL_API_VERSION < 20131108 aslresponse_free(wtmp_asl.res); +#else + asl_release(wtmp_asl.res); +#endif wtmp_asl.res = NULL; wtmp_asl.done = 1; return NULL; @@ -713,12 +811,17 @@ _set_dir(int forward) static void set_asl(int forward) { +#if ASL_API_VERSION < 20131108 aslmsg q0, q1; asl_msg_t *m[2]; asl_search_result_t query; - uint64_t cmax; - asl_store_t *store; + asl_store_t *store = NULL; uint32_t status; + uint64_t cmax; +#else + asl_object_t q0, q1, query; + size_t cmax; +#endif _set_dir(forward); @@ -727,46 +830,75 @@ set_asl(int forward) if (wtmp_asl.res != NULL) { +#if ASL_API_VERSION < 20131108 aslresponse_free(wtmp_asl.res); +#else + asl_release(wtmp_asl.res); +#endif wtmp_asl.res = NULL; } - store = NULL; +#if ASL_API_VERSION < 20131108 status = asl_store_open_read(NULL, &store); if (status != 0) return; if (store == NULL) return; +#endif /* * Create a search query that matches either UTMPX_FACILITY * or LASTLOG_FACILITY. */ q0 = asl_new(ASL_TYPE_QUERY); - q1 = asl_new(ASL_TYPE_QUERY); + if (q0 == NULL) return; - if ((q0 == NULL) || (q1 == NULL)) + asl_set_query(q0, FACILITY, UTMPX_FACILITY, ASL_QUERY_OP_EQUAL); + + q1 = asl_new(ASL_TYPE_QUERY); + if (q1 == NULL) { - asl_store_close(store); - if (q0 != NULL) free(q0); - if (q1 != NULL) free(q1); +#if ASL_API_VERSION < 20131108 + asl_free(q0); +#else + asl_release(q0); +#endif return; } - asl_set_query(q0, FACILITY, UTMPX_FACILITY, ASL_QUERY_OP_EQUAL); asl_set_query(q1, FACILITY, LASTLOG_FACILITY, ASL_QUERY_OP_EQUAL); +#if ASL_API_VERSION < 20131108 m[0] = (asl_msg_t *)q0; m[1] = (asl_msg_t *)q1; query.count = 2; query.msg = m; +#else + query = asl_new(ASL_TYPE_LIST); + if (query == NULL) + { + asl_release(q0); + asl_release(q1); + return; + } + + asl_append(query, q0); + asl_append(query, q1); + + asl_release(q0); + asl_release(q1); +#endif cmax = 0; +#if ASL_API_VERSION < 20131108 asl_store_match_timeout(store, &query, &(wtmp_asl.res), &cmax, wtmp_asl.start, 0, wtmp_asl.dir, ASL_QUERY_TIMEOUT); asl_store_close(store); - - asl_free(q1); asl_free(q0); - + asl_free(q1); +#else + wtmp_asl.res = asl_match(NULL, query, &cmax, wtmp_asl.start, 0, ASL_QUERY_TIMEOUT, wtmp_asl.dir); + asl_release(query); +#endif + if (wtmp_asl.res == NULL) return; wtmp_asl.inited = 1; diff --git a/gen/utmpx-darwin.h b/gen/utmpx-darwin.h index 03f228b..ae4733c 100644 --- a/gen/utmpx-darwin.h +++ b/gen/utmpx-darwin.h @@ -61,8 +61,8 @@ struct _utmpx { extern const char __utx_magic__[]; /* size of UTMPX_MAGIC */ #ifdef __LP64__ -#define __need_struct_timeval32 -#include <_structs.h> +#include +#include /* * these structures assume natural alignment so they are the same size diff --git a/gen/wordexp.c b/gen/wordexp.c deleted file mode 100644 index 7de775c..0000000 --- a/gen/wordexp.c +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Copyright (c) 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@ - */ - -#include - -#if TARGET_OS_IPHONE -/* */ - -#include -int wordexp(const char *restrict words __unused, wordexp_t *restrict pwordexp __unused, int flags __unused) { - return WRDE_NOSPACE; -} - -void wordfree(wordexp_t *pwordexp __unused) { -} - -#else - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// For _NSGetEnviron() -- which gives us a pointer to environ -#include - -extern size_t malloc_good_size(size_t size); - -static pthread_once_t re_init_c = PTHREAD_ONCE_INIT; -static regex_t re_cmd, re_goodchars, re_subcmd_syntax_err_kludge, re_quoted_string; - -/* Similar to popen, but captures stderr for you. Doesn't interoperate - with pclose. Call wait4 on your own */ -static pid_t popen_oe(char *cmd, FILE **out, FILE **err) { - int out_pipe[2], err_pipe[2]; - char *argv[4]; - pid_t pid; - posix_spawn_file_actions_t file_actions; - int errrtn; - - if ((errrtn = posix_spawn_file_actions_init(&file_actions)) != 0) { - errno = errrtn; - return 0; - } - if (pipe(out_pipe) < 0) { - posix_spawn_file_actions_destroy(&file_actions); - return 0; - } - if (pipe(err_pipe) < 0) { - posix_spawn_file_actions_destroy(&file_actions); - close(out_pipe[0]); - close(out_pipe[1]); - return 0; - } - - if (out_pipe[1] != STDOUT_FILENO) { - posix_spawn_file_actions_adddup2(&file_actions, out_pipe[1], STDOUT_FILENO); - posix_spawn_file_actions_addclose(&file_actions, out_pipe[1]); - } - posix_spawn_file_actions_addclose(&file_actions, out_pipe[0]); - if (err_pipe[1] != STDERR_FILENO) { - posix_spawn_file_actions_adddup2(&file_actions, err_pipe[1], STDERR_FILENO); - posix_spawn_file_actions_addclose(&file_actions, err_pipe[1]); - } - posix_spawn_file_actions_addclose(&file_actions, err_pipe[0]); - - argv[0] = "sh"; - argv[1] = "-c"; - argv[2] = cmd; - argv[3] = NULL; - - errrtn = posix_spawn(&pid, _PATH_BSHELL, &file_actions, NULL, argv, *_NSGetEnviron()); - posix_spawn_file_actions_destroy(&file_actions); - - if (errrtn != 0) { - close(out_pipe[0]); - close(out_pipe[1]); - close(err_pipe[0]); - close(err_pipe[1]); - errno = errrtn; - return 0; - } - - *out = fdopen(out_pipe[0], "r"); - assert(*out); - close(out_pipe[1]); - *err = fdopen(err_pipe[0], "r"); - assert(*err); - close(err_pipe[1]); - - return pid; -} - -static void re_init(void) { - int rc = regcomp(&re_cmd, "(^|[^\\])(`|\\$\\([^(])", REG_EXTENDED|REG_NOSUB); - /* XXX I'm not sure the { } stuff is correct, - it may be overly restrictave */ - char *rx = "^([^\\\"'|&;<>(){}\n]" - "|\\\\." - "|'(\\\\\\\\|\\\\'|[^'])*'" - "|\"(\\\\\\\\|\\\\\"|[^\"])*\"" - "|`(\\\\\\\\|\\\\`|[^`])*`" - "|\\$\\(\\(([^)]|\\\\)*\\)\\)" /* can't do nesting in a regex */ - "|\\$\\(([^)]|\\\\)*\\)" /* can't do nesting in a regex */ - "|\\$\\{[^}]*\\}" - /* XXX: { } ? */ - ")*$"; - rc = regcomp(&re_goodchars, rx, - REG_EXTENDED|REG_NOSUB); - - rc = regcomp(&re_subcmd_syntax_err_kludge, - "command substitution.*syntax error", REG_EXTENDED|REG_NOSUB); - - rc = regcomp(&re_quoted_string, - "(^|[^\\])'(\\\\\\\\|\\\\'|[^'])*'", REG_EXTENDED|REG_NOSUB); -} - -/* Returns zero if it can't realloc */ -static int word_alloc(size_t want, wordexp_t *__restrict__ pwe, size_t *have) { - if (want < *have) { - return 1; - } - size_t bytes = malloc_good_size(sizeof(char *) * want * 2); - pwe->we_wordv = reallocf(pwe->we_wordv, bytes); - if (pwe->we_wordv) { - *have = bytes / sizeof(char *); - return 1; - } - return 0; -} - -static int -cmd_search(const char *str) { - regoff_t first = 0; - regoff_t last = strlen(str); - regmatch_t m = {first, last}; - int flags; - - if (last == 0) return REG_NOMATCH; /* empty string */ - - flags = REG_STARTEND; - while(regexec(&re_quoted_string, str, 1, &m, flags) == 0) { - /* - * We have matched a single quoted string, from m.rm_so to m.rm_eo. - * So the (non-quote string) from first to m.rm_so needs to be - * checked for command substitution. Then we use REG_STARTEND to - * look for any other single quote strings after this one. - */ - regmatch_t head = {first, m.rm_so}; - if (regexec(&re_cmd, str, 1, &head, flags) == 0) { - return 0; /* found a command substitution */ - } - flags = REG_NOTBOL | REG_STARTEND; - m.rm_so = first = m.rm_eo; - m.rm_eo = last; - } - /* Check the remaining string */ - flags = REG_STARTEND; - if (m.rm_so > 0) flags |= REG_NOTBOL; - return regexec(&re_cmd, str, 1, &m, flags); -} - -/* XXX this is _not_ designed to be fast */ -/* wordexp is also rife with security "challenges", unless you pass it - WRDE_NOCMD it *must* support subshell expansion, and even if you - don't beause it has to support so much of the standard shell (all - the odd little variable expansion options for example) it is hard - to do without a subshell). It is probbably just plan a Bad Idea - to call in anything setuid, or executing remotely. */ - -int wordexp(const char *__restrict__ words, - wordexp_t *__restrict__ pwe, int flags) { - /* cbuf_l's inital value needs to be big enough for 'cmd' plus - about 20 chars */ - size_t cbuf_l = 1024; - char *cbuf = NULL; - /* Put a NUL byte between each word, and at the end */ - char *cmd = "/usr/bin/perl -e 'print join(chr(0), @ARGV), chr(0)' -- "; - size_t wordv_l = 0, wordv_i = 0; - int rc; - wordexp_t save; - - /* Some errors require us to leave pwe unchanged, so we save it here */ - save = *pwe; - pthread_once(&re_init_c, re_init); - - if (flags & WRDE_NOCMD) { - /* This attempts to match any backticks or $(...)'s, but there may be - other ways to do subshell expansion that the standard doesn't - cover, but I don't know of any -- failures here are a potential - security risk */ - rc = cmd_search(words); - if (rc != REG_NOMATCH) { - /* Technically ==0 is WRDE_CMDSUB, and != REG_NOMATCH is - "some internal error", but failing to catch those here - could allow a subshell */ - return WRDE_CMDSUB; - } - } - rc = regexec(&re_goodchars, words, 0, NULL, 0); - if (rc != 0) { - /* Technically ==REG_NOMATCH is WRDE_BADCHAR, and != is - some internal error", but again failure to notice the - internal error could allow unexpected shell commands - (allowing an unexcaped ;), or file clobbering (unescaped - >) */ - return WRDE_BADCHAR; - } - - if (flags & WRDE_APPEND) { - wordv_i = wordv_l = pwe->we_wordc; - if (flags & WRDE_DOOFFS) { - wordv_l = wordv_i += pwe->we_offs; - } - } else { - if (flags & WRDE_REUSE) { - wordfree(pwe); - } - pwe->we_wordc = 0; - pwe->we_wordv = NULL; - - if (flags & WRDE_DOOFFS) { - size_t wend = wordv_i + pwe->we_offs; - word_alloc(wend, pwe, &wordv_l); - if (!pwe->we_wordv) { - return WRDE_NOSPACE; - } - bzero(pwe->we_wordv + wordv_i, pwe->we_offs * sizeof(char *)); - wordv_i = wend; - } else { - pwe->we_offs = 0; - } - } - - size_t need = 0; - while(!cbuf || need > cbuf_l) { - if (need > cbuf_l) { - cbuf_l = malloc_good_size(need +1); - } - cbuf = reallocf(cbuf, cbuf_l); - if (cbuf == NULL) { - wordfree(pwe); - return WRDE_NOSPACE; - } - cbuf[0] = '\0'; - if (flags & WRDE_UNDEF) { - strlcat(cbuf, "set -u; ", cbuf_l); - } - /* This kludge is needed because /bin/sh seems to set IFS to the - defualt even if you have set it; We also can't just ignore it - because it is hard/unplesent to code around or even a potential - security problem because the test suiete explicitly checks - to make sure setting IFS "works" */ - if (getenv("IFS")) { - setenv("_IFS", getenv("IFS"), 1); - strlcat(cbuf, "export IFS=${_IFS}; ", cbuf_l); - } - strlcat(cbuf, cmd, cbuf_l); - need = strlcat(cbuf, words, cbuf_l); - } - - FILE *out, *err; - pid_t pid = popen_oe(cbuf, &out, &err); - if (pid == 0) { - wordfree(pwe); - return WRDE_NOSPACE; - } - - char *word = NULL; - size_t word_l = 0; - size_t word_i = 0; - int ch; - - while(EOF != (ch = fgetc(out))) { - if (word_l <= word_i) { - word_l = malloc_good_size(word_l * 2 + 1); - word = reallocf(word, word_l); - if (!word) { - fclose(err); - fclose(out); - wordfree(pwe); - return WRDE_NOSPACE; - } - } - word[word_i++] = ch; - - if (ch == '\0') { - word_alloc(wordv_i + 1, pwe, &wordv_l); - char *tmp = strdup(word); - if (pwe->we_wordv == NULL || tmp == NULL) { - fclose(err); - fclose(out); - wordfree(pwe); - free(word); - free(tmp); - int status; - wait4(pid, &status, 0, NULL); - return WRDE_NOSPACE; - } - pwe->we_wordv[wordv_i++] = tmp; - pwe->we_wordc++; - word_i = 0; - } - } - - assert(word_i == 0); - free(word); - - char err_buf[1024]; - size_t err_sz = fread(err_buf, 1, sizeof(err_buf) -1, err); - err_buf[err_sz] = '\0'; - if (flags & WRDE_SHOWERR) { - fputs(err_buf, stderr); - } - - pid_t got_pid = 0; - int status; - do { - got_pid = wait4(pid, &status, 0, NULL); - } while(got_pid == -1 && errno == EINTR); - - fclose(out); - fclose(err); - - /* the exit status isn't set for some command syntax errors */ - if (regexec(&re_subcmd_syntax_err_kludge, err_buf, 0, NULL, 0) == 0 - || got_pid == -1 || (WIFEXITED(status) && WEXITSTATUS(status))) { - if (!(flags & (WRDE_APPEND|WRDE_REUSE))) { - /* Restore pwe if possiable, can't really do it in the append - case, and isn't easy in the reuse case */ - *pwe = save; - } - if (strstr(err_buf, " unbound variable")) { - return WRDE_BADVAL; - } - return WRDE_SYNTAX; - } - - if (!word_alloc(wordv_i + 1, pwe, &wordv_l)) { - return WRDE_NOSPACE; - } - pwe->we_wordv[wordv_i] = NULL; - - return 0; -} - -void wordfree(wordexp_t *pwe) { - if (pwe == NULL || pwe->we_wordv == NULL) { - return; - } - - int i = 0, e = pwe->we_wordc + pwe->we_offs; - for(i = pwe->we_offs; i < e; i++) { - free(pwe->we_wordv[i]); - } - free(pwe->we_wordv); - pwe->we_wordv = NULL; -} - -#endif /* TARGET_OS_IPHONE */ diff --git a/include/CrashReporterClient.h b/include/CrashReporterClient.h deleted file mode 100644 index 68593ae..0000000 --- a/include/CrashReporterClient.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 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@ - */ - -/*********************************************************************** - * Not to be installed in /usr/local/include - ***********************************************************************/ - -#ifndef _LIBC_CRASHREPORTERCLIENT_H -#define _LIBC_CRASHREPORTERCLIENT_H - -#ifdef LIBC_NO_LIBCRASHREPORTERCLIENT - -/* Fake the CrashReporterClient API */ -#define CRGetCrashLogMessage() 0 -#define CRSetCrashLogMessage(x) /* nothing */ - -#else /* !LIBC_NO_LIBCRASHREPORTERCLIENT */ - -/* Include the real CrashReporterClient.h */ -#include_next - -#endif /* !LIBC_NO_LIBCRASHREPORTERCLIENT */ - -#endif /* _LIBC_CRASHREPORTERCLIENT_H */ diff --git a/include/NSSystemDirectories.h b/include/NSSystemDirectories.h deleted file mode 100644 index b678106..0000000 --- a/include/NSSystemDirectories.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 1999-2000, 2009 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@ - */ - -/* - This API returns the various standard system directories where apps, resources, etc get installed. - Because queries can return multiple directories, the API is in the form of an enumeration. - The directories are returned in search path order; that is, the first place to look is returned first. - This API may return directories that do not exist yet. - If NSUserDomain is included in a query, then the results will contain "~" to refer to the user's directory. - NEXT_ROOT is prepended as necessary to the returned values. - Some calls might return no directories! - The buffer that is passed in will be filled with a null-terminated string, possibly containing as many as PATH_MAX-1 characters. - - Typical usage: - - #include - #include - - char path[PATH_MAX]; - NSSearchPathEnumerationState state = NSStartSearchPathEnumeration(dir, domainMask); - while (state = NSGetNextSearchPathEnumeration(state, path)) { - // Handle path - } - - -*/ - -#ifndef __NS_SYSTEM_DIRECTORIES_H__ -#define __NS_SYSTEM_DIRECTORIES_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -// Directories - -typedef enum { - NSApplicationDirectory = 1, // supported applications (Applications) - NSDemoApplicationDirectory = 2, // unsupported applications, demonstration versions (Applications/GrabBag) - NSDeveloperApplicationDirectory = 3, // developer applications (Developer/Applications) - NSAdminApplicationDirectory = 4, // system and network administration applications (Applications/Utilities) - NSLibraryDirectory = 5, // various user-visible documentation, support, and configuration files, resources (Library) - NSDeveloperDirectory = 6, // developer resources (Developer) - NSUserDirectory = 7, // user home directories (Users) - NSDocumentationDirectory = 8, // documentation (Library/Documentation) - NSDocumentDirectory = 9, // documents (Documents) - NSCoreServiceDirectory = 10, // location of core services (System/Library/CoreServices) - NSAutosavedInformationDirectory = 11, // location of user's directory for use with autosaving (Library/Autosave Information) - NSDesktopDirectory = 12, // location of user's Desktop (Desktop) - NSCachesDirectory = 13, // location of discardable cache files (Library/Caches) - NSApplicationSupportDirectory = 14, // location of application support files (plug-ins, etc) (Library/Application Support) - NSDownloadsDirectory = 15, // location of user's Downloads directory (Downloads) - NSInputMethodsDirectory = 16, // input methods (Library/Input Methods) - NSMoviesDirectory = 17, // location of user's Movies directory (~/Movies) - NSMusicDirectory = 18, // location of user's Music directory (~/Music) - NSPicturesDirectory = 19, // location of user's Pictures directory (~/Pictures) - NSPrinterDescriptionDirectory = 20, // location of system's PPDs directory (Library/Printers/PPDs) - NSSharedPublicDirectory = 21, // location of user's Public sharing directory (~/Public) - NSPreferencePanesDirectory = 22, // location of the PreferencePanes directory for use with System Preferences (Library/PreferencePanes) - NSAllApplicationsDirectory = 100, // all directories where applications can occur (Applications, Applications/Utilities, Developer/Applications, ...) - NSAllLibrariesDirectory = 101 // all directories where resources can occur (Library, Developer) -} NSSearchPathDirectory; - -// Domains - -typedef enum { - NSUserDomainMask = 1, // user's home directory --- place to install user's personal items (~) - NSLocalDomainMask = 2, // local to the current machine --- place to install items available to everyone on this machine - NSNetworkDomainMask = 4, // publically available location in the local area network --- place to install items available on the network (/Network) - NSSystemDomainMask = 8, // provided by Apple - NSAllDomainsMask = 0x0ffff // all domains: all of the above and more, future items -} NSSearchPathDomainMask; - -typedef unsigned int NSSearchPathEnumerationState; - -/* Enumeration - Call NSStartSearchPathEnumeration() once, then call NSGetNextSearchPathEnumeration() one or more times with the returned state. - The return value of NSGetNextSearchPathEnumeration() should be used as the state next time around. - When NSGetNextSearchPathEnumeration() returns 0, you're done. -*/ - -extern NSSearchPathEnumerationState NSStartSearchPathEnumeration(NSSearchPathDirectory dir, NSSearchPathDomainMask domainMask); - -extern NSSearchPathEnumerationState NSGetNextSearchPathEnumeration(NSSearchPathEnumerationState state, char *path); - -#ifdef __cplusplus -} -#endif - -#endif /* __NS_SYSTEM_DIRECTORIES_H__ */ diff --git a/include/assert.h b/include/assert.h index a585ff1..84787ad 100644 --- a/include/assert.h +++ b/include/assert.h @@ -66,7 +66,7 @@ int printf(const char * __restrict, ...); __END_DECLS #define assert(e) \ - ((void) ((e) ? 0 : __assert (#e, __FILE__, __LINE__))) + ((void) ((e) ? ((void)0) : __assert (#e, __FILE__, __LINE__))) #define __assert(e, file, line) \ ((void)printf ("%s:%u: failed assertion `%s'\n", file, line, e), abort()) diff --git a/include/bitstring.h b/include/bitstring.h index 1e08cb5..660ccdf 100644 --- a/include/bitstring.h +++ b/include/bitstring.h @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)bitstring.h 8.1 (Berkeley) 7/19/93 + * $FreeBSD$ */ #ifndef _BITSTRING_H_ @@ -53,16 +53,15 @@ typedef unsigned char bitstr_t; /* external macros */ /* bytes in a bitstring of nbits bits */ #define bitstr_size(nbits) \ - ((((nbits) - 1) >> 3) + 1) + (((nbits) + 7) >> 3) /* allocate a bitstring */ #define bit_alloc(nbits) \ - (bitstr_t *)calloc(1, \ - (unsigned int)bitstr_size(nbits) * sizeof(bitstr_t)) + (bitstr_t *)calloc((size_t)bitstr_size(nbits), sizeof(bitstr_t)) /* allocate a bitstring on the stack */ #define bit_decl(name, nbits) \ - (name)[bitstr_size(nbits)] + ((name)[bitstr_size(nbits)]) /* is bit N of bitstring name set? */ #define bit_test(name, bit) \ @@ -70,18 +69,18 @@ typedef unsigned char bitstr_t; /* set bit N of bitstring name */ #define bit_set(name, bit) \ - (name)[_bit_byte(bit)] |= _bit_mask(bit) + ((name)[_bit_byte(bit)] |= _bit_mask(bit)) /* clear bit N of bitstring name */ #define bit_clear(name, bit) \ - (name)[_bit_byte(bit)] &= ~_bit_mask(bit) + ((name)[_bit_byte(bit)] &= ~_bit_mask(bit)) /* clear bits start ... stop in bitstring */ -#define bit_nclear(name, start, stop) { \ - register bitstr_t *_name = name; \ - register int _start = start, _stop = stop; \ - register int _startbyte = _bit_byte(_start); \ - register int _stopbyte = _bit_byte(_stop); \ +#define bit_nclear(name, start, stop) do { \ + bitstr_t *_name = (name); \ + int _start = (start), _stop = (stop); \ + int _startbyte = _bit_byte(_start); \ + int _stopbyte = _bit_byte(_stop); \ if (_startbyte == _stopbyte) { \ _name[_startbyte] &= ((0xff >> (8 - (_start&0x7))) | \ (0xff << ((_stop&0x7) + 1))); \ @@ -91,14 +90,14 @@ typedef unsigned char bitstr_t; _name[_startbyte] = 0; \ _name[_stopbyte] &= 0xff << ((_stop&0x7) + 1); \ } \ -} +} while (0) /* set bits start ... stop in bitstring */ -#define bit_nset(name, start, stop) { \ - register bitstr_t *_name = name; \ - register int _start = start, _stop = stop; \ - register int _startbyte = _bit_byte(_start); \ - register int _stopbyte = _bit_byte(_stop); \ +#define bit_nset(name, start, stop) do { \ + bitstr_t *_name = (name); \ + int _start = (start), _stop = (stop); \ + int _startbyte = _bit_byte(_start); \ + int _stopbyte = _bit_byte(_stop); \ if (_startbyte == _stopbyte) { \ _name[_startbyte] |= ((0xff << (_start&0x7)) & \ (0xff >> (7 - (_stop&0x7)))); \ @@ -108,36 +107,44 @@ typedef unsigned char bitstr_t; _name[_startbyte] = 0xff; \ _name[_stopbyte] |= 0xff >> (7 - (_stop&0x7)); \ } \ -} +} while (0) /* find first bit clear in name */ -#define bit_ffc(name, nbits, value) { \ - register bitstr_t *_name = name; \ - register int _byte, _nbits = nbits; \ - register int _stopbyte = _bit_byte(_nbits), _value = -1; \ - for (_byte = 0; _byte < _stopbyte; ++_byte) \ - if (_name[_byte] != 0xff) { \ - _value = _byte << 3; \ - for (_stopbyte = _name[_byte]; (_stopbyte&0x1); \ - ++_value, _stopbyte >>= 1); \ - break; \ - } \ +#define bit_ffc(name, nbits, value) do { \ + bitstr_t *_name = (name); \ + int _byte, _nbits = (nbits); \ + int _stopbyte = _bit_byte(_nbits - 1), _value = -1; \ + if (_nbits > 0) \ + for (_byte = 0; _byte <= _stopbyte; ++_byte) \ + if (_name[_byte] != 0xff) { \ + bitstr_t _lb; \ + _value = _byte << 3; \ + for (_lb = _name[_byte]; (_lb&0x1); \ + ++_value, _lb >>= 1); \ + break; \ + } \ + if (_value >= nbits) \ + _value = -1; \ *(value) = _value; \ -} +} while (0) /* find first bit set in name */ -#define bit_ffs(name, nbits, value) { \ - register bitstr_t *_name = name; \ - register int _byte, _nbits = nbits; \ - register int _stopbyte = _bit_byte(_nbits), _value = -1; \ - for (_byte = 0; _byte < _stopbyte; ++_byte) \ - if (_name[_byte]) { \ - _value = _byte << 3; \ - for (_stopbyte = _name[_byte]; !(_stopbyte&0x1); \ - ++_value, _stopbyte >>= 1); \ - break; \ - } \ +#define bit_ffs(name, nbits, value) do { \ + bitstr_t *_name = (name); \ + int _byte, _nbits = (nbits); \ + int _stopbyte = _bit_byte(_nbits - 1), _value = -1; \ + if (_nbits > 0) \ + for (_byte = 0; _byte <= _stopbyte; ++_byte) \ + if (_name[_byte]) { \ + bitstr_t _lb; \ + _value = _byte << 3; \ + for (_lb = _name[_byte]; !(_lb&0x1); \ + ++_value, _lb >>= 1); \ + break; \ + } \ + if (_value >= nbits) \ + _value = -1; \ *(value) = _value; \ -} +} while (0) #endif /* !_BITSTRING_H_ */ diff --git a/include/ctype.h b/include/ctype.h index bc20478..3548bcd 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -167,23 +167,28 @@ isascii(int _c) } #ifdef USE_ASCII -__DARWIN_CTYPE_inline int +__DARWIN_CTYPE_inline int __maskrune(__darwin_ct_rune_t _c, unsigned long _f) { - return _DefaultRuneLocale.__runetype[_c & 0xff] & _f; + return (int)_DefaultRuneLocale.__runetype[_c & 0xff] & (__uint32_t)_f; } //Begin-Libc #elif defined(__LIBC__) -__DARWIN_CTYPE_inline int +__DARWIN_CTYPE_inline int __maskrune(__darwin_ct_rune_t _c, unsigned long _f) { - return ((_c < 0 || _c >= _CACHED_RUNES) ? ___runetype(_c) : - __current_locale()->__lc_ctype->_CurrentRuneLocale.__runetype[_c]) & _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); +int __maskrune(__darwin_ct_rune_t, unsigned long); __END_DECLS #endif /* USE_ASCII */ diff --git a/include/dirent.h b/include/dirent.h index b52baae..bd84e6d 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -162,6 +162,17 @@ __END_DECLS #if __DARWIN_C_LEVEL >= 200809L __BEGIN_DECLS +//Begin-Libc +#ifndef LIBC_ALIAS_OPENDIR +//End-Libc +__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) +DIR *fdopendir(int) __DARWIN_ALIAS_I(fdopendir); +//Begin-Libc +#else /* LIBC_ALIAS_OPENDIR */ +DIR *fdopendir(int) LIBC_ALIAS_I(fdopendir); +#endif /* !LIBC_ALIAS_OPENDIR */ +//End-Libc + int alphasort(const struct dirent **, const struct dirent **) __DARWIN_INODE64(alphasort); #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) diff --git a/include/libkern/OSMemoryNotification.h b/include/libkern/OSMemoryNotification.h deleted file mode 100644 index d4e450b..0000000 --- a/include/libkern/OSMemoryNotification.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2006 Apple Computer, 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@ - */ - -#ifndef _OSMEMORYNOTIFICATION_H_ -#define _OSMEMORYNOTIFICATION_H_ - -#include -#include - -/* -** OSMemoryNotification.h -** -** Kernel-generated notification mechanism to alert registered tasks when physical memory -** pressure reaches certain thresholds. Notifications are triggered in both directions -** so clients can manage their memory usage more and less aggressively. -** -** All of these functions and data types are iOS-only and deprecated in iOS 5.0. Applications -** should listen to UIKit memory warnings (didReceiveMemoryWarning or -** UIApplicationDidReceiveMemoryWarningNotification) instead. -*/ - -__BEGIN_DECLS - -struct timeval; - -/* -** Opaque type for notification object -** -** DEPRECATED. Use UIKit memory notification system. -*/ - -typedef struct _OSMemoryNotification * OSMemoryNotificationRef; - -/* -** Threshold values for notifications -** -** DEPRECATED. Use UIKit memory notification system. -*/ - -typedef enum { - OSMemoryNotificationLevelAny = -1, - OSMemoryNotificationLevelNormal = 0, - OSMemoryNotificationLevelWarning = 1, - OSMemoryNotificationLevelUrgent = 2, - OSMemoryNotificationLevelCritical = 3 -} OSMemoryNotificationLevel; - -/* -** Creation routines. Returns the created OSMemoryNotificationRef in the note param. -** returns: 0 on success -** ENOMEM if insufficient memory or resources exists to create the notification object -** EINVAL if the threshold is not a valid notification level -** -** DEPRECATED. Use UIKit memory notification system. -*/ - -int OSMemoryNotificationCreate(OSMemoryNotificationRef *note) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0); - -/* -** returns: 0 on success -** EINVAL if the notification is not an initialized notification object - ** - ** DEPRECATED. Use UIKit memory notification system. -*/ - -int OSMemoryNotificationDestroy(OSMemoryNotificationRef note) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0); - -/* -** Block waiting for notification -** returns: 0 on success, with the level that triggered the notification in the level param -** EINVAL if the notification object is invalid -** ETIMEDOUT if abstime passes before notification occurs -** -** 'note' is now ignored. -** -** DEPRECATED. Use UIKit memory notification system. -*/ -int OSMemoryNotificationWait(OSMemoryNotificationRef note, OSMemoryNotificationLevel *level) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0); -int OSMemoryNotificationTimedWait(OSMemoryNotificationRef note, OSMemoryNotificationLevel *level, const struct timeval *abstime) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0); - -/* -** Simple polling interface to detect current memory pressure level -** -** DEPRECATED. This is not a reliable way to discover the system's memory condition and -** the level is not meaningful in iOS 5.0 and later. Use UIKit memory notification -** system instead, with no need to check the level. -*/ - -OSMemoryNotificationLevel OSMemoryNotificationCurrentLevel(void) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0); - -/* -** External notify(3) string for manual notification setup -** -** DEPRECATED. Use UIKit memory notification system. -*/ - -extern const char *kOSMemoryNotificationName __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0); - -__END_DECLS - -#endif /* _OSMEMORYNOTIFICATION_H_ */ diff --git a/include/libkern/OSThermalNotification.h b/include/libkern/OSThermalNotification.h index cc81223..02bf1f7 100644 --- a/include/libkern/OSThermalNotification.h +++ b/include/libkern/OSThermalNotification.h @@ -38,6 +38,25 @@ __BEGIN_DECLS +/* Define pressure levels usable by OSThermalPressureLevel */ +typedef enum { + kOSThermalPressureLevelNominal = 0, + kOSThermalPressureLevelModerate, + kOSThermalPressureLevelHeavy, + kOSThermalPressureLevelTrapping, + kOSThermalPressureLevelSleeping +} OSThermalPressureLevel; + +/* + ** External notify(3) string for thermal pressure level notification + */ +__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_0) +extern const char * const kOSThermalNotificationPressureLevelName; + + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && \ + __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_2_0 + typedef enum { OSThermalNotificationLevelAny = -1, OSThermalNotificationLevelNormal = 0, @@ -76,45 +95,31 @@ enum { #define OSThermalNotificationLevelUrgent OSThermalNotificationLevelAppTerminate #define OSThermalNotificationLevelCritical OSThermalNotificationLevelDeviceRestart -/* Define pressure levels usable by OSThermalPressureLevel */ -typedef enum { - kOSThermalPressureLevelNominal = 0, - kOSThermalPressureLevelModerate, - kOSThermalPressureLevelHeavy, - kOSThermalPressureLevelTrapping, - kOSThermalPressureLevelSleeping -} OSThermalPressureLevel; - /* ** Simple polling interface to detect current thermal level */ - -extern OSThermalNotificationLevel OSThermalNotificationCurrentLevel(void) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_2_0); +__OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_2_0) +extern OSThermalNotificationLevel OSThermalNotificationCurrentLevel(void); /* ** External notify(3) string for manual notification setup */ - -extern const char * const kOSThermalNotificationName __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_2_0); +__OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_2_0) +extern const char * const kOSThermalNotificationName; /* ** External notify(3) string for alerting user of a thermal condition */ - -extern const char * const kOSThermalNotificationAlert __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_6_0); +__OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_6_0) +extern const char * const kOSThermalNotificationAlert; /* ** External notify(3) string for notifying system the options taken to resolve thermal condition */ +__OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_6_0) +extern const char * const kOSThermalNotificationDecision; -extern const char * const kOSThermalNotificationDecision __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_6_0); - -/* -** External notify(3) string for thermal pressure level notification -*/ - -extern const char * const kOSThermalNotificationPressureLevelName __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_7_0); - +#endif // __IPHONE_OS_VERSION_MIN_REQUIRED __END_DECLS diff --git a/include/protocols/timed.h b/include/protocols/timed.h index b628fc7..6999dff 100644 --- a/include/protocols/timed.h +++ b/include/protocols/timed.h @@ -66,8 +66,8 @@ #define ANYADDR NULL #ifdef __LP64__ -#define __need_struct_timeval32 -#include +#include +#include #endif /* __LP64__ */ struct tsp { diff --git a/include/signal.h b/include/signal.h index 981cfc1..2316310 100644 --- a/include/signal.h +++ b/include/signal.h @@ -61,7 +61,9 @@ #include #include <_types.h> #include -#include + +#include +#include #if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) extern __const char *__const sys_signame[NSIG]; diff --git a/include/stddef.h b/include/stddef.h index e6d9b42..40c736a 100644 --- a/include/stddef.h +++ b/include/stddef.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2013 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -58,61 +58,28 @@ * @(#)stddef.h 5.5 (Berkeley) 4/3/91 */ -#if !defined(__STDDEF_H__) - -#if !defined(__need_wchar_t) && !defined(__need_size_t) \ - && !defined(__need_ptrdiff_t) && !defined(__need_NULL) \ - && !defined(__need_wint_t) && !defined(__need_rsize_t) +#ifndef __STDDEF_H__ #define __STDDEF_H__ -#endif /* none of __need_* defined */ #include <_types.h> -#if defined(__STDDEF_H__) || defined(__need_ptrdiff_t) +#include +#include +#include #include -#endif /* __STDDEF_H__ || __need_ptrdiff_t */ -#if defined(__STDDEF_H__) || defined(__need_size_t) +#if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 +#include +#endif /* __STDC_WANT_LIB_EXT1__ >= 1 */ + /* DO NOT REMOVE THIS COMMENT: fixincludes needs to see: * _GCC_SIZE_T */ #include -#endif /* __STDDEF_H__ || __need_size_t */ - -#if (defined(__STDDEF_H__) && defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1) || defined(__need_rsize_t) -#include -#endif /* (__STDDEF_H__ && __STDC_WANT_LIB_EXT1__ >= 1) || __need_rsize_t */ -#if defined(__STDDEF_H__) || defined(__need_wchar_t) #include -#endif /* __STDDEF_H__ || __need_wchar_t */ -#if (defined(__STDDEF_H__) && !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))) \ - || defined(__need_wint_t) +#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) #include -#endif /* __STDDEF_H__ && !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) || __need_wchar_t */ +#endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ -#if defined(__STDDEF_H__) || defined(__need_NULL) -#include -#endif /* __STDDEF_H__ || __need_NULL */ - -#ifdef __STDDEF_H__ -#if defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 5 || __GNUC__ > 3) -#ifndef __offsetof /* Deprecated: for source compatibility only */ -#define __offsetof(type, field) __builtin_offsetof(type, field) -#endif -#define offsetof(type, field) __builtin_offsetof(type, field) -#else /* ! (gcc >= 3.5) */ -#ifndef __offsetof /* Deprecated: for source compatibility only */ -#define __offsetof(type, field) ((size_t)(&((type *)0)->field)) -#endif -#define offsetof(type, field) ((size_t)(&((type *)0)->field)) -#endif /* (gcc >= 3.5) */ #endif /* __STDDEF_H__ */ - -#endif /* __STDDEF_H__ */ - -#undef __need_ptrdiff_t -#undef __need_size_t -#undef __need_wchar_t -#undef __need_wint_t -#undef __need_NULL diff --git a/include/stdint.h b/include/stdint.h index 22156b6..c0e570a 100644 --- a/include/stdint.h +++ b/include/stdint.h @@ -149,10 +149,6 @@ typedef uint64_t uint_fast64_t; #define PTRDIFF_MAX INT32_MAX #endif -/* We have no sig_atomic_t yet, so no SIG_ATOMIC_{MIN,MAX}. - Should end up being {-127,127} or {0,255} ... or bigger. - My bet would be on one of {U}INT32_{MIN,MAX}. */ - #if __WORDSIZE == 64 #define SIZE_MAX UINT64_MAX #else diff --git a/include/stdio.h b/include/stdio.h index 063f3c7..adc59ed 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -72,6 +72,8 @@ #include #include +#include + typedef __darwin_off_t fpos_t; #define _FSTDIO /* Define for new stdio with functions. */ diff --git a/include/stdlib.h b/include/stdlib.h index 77be667..8530607 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -131,7 +131,7 @@ extern int __mb_cur_max; __BEGIN_DECLS void abort(void) __dead2; //Begin-Libc -__private_extern__ +__attribute__((visibility("hidden"))) void abort_report_np(const char *, ...) __dead2 __printflike(1, 2); //End-Libc int abs(int) __pure2; @@ -185,7 +185,7 @@ unsigned long long //Begin-Libc #ifndef LIBC_ALIAS_SYSTEM //End-Libc -int system(const char *) __DARWIN_ALIAS_C(system); +int system(const char *) __DARWIN_ALIAS_C(system) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0,__MAC_NA,__IPHONE_2_0,__IPHONE_8_0, "Use posix_spawn APIs instead."); //Begin-Libc #else /* LIBC_ALIAS_SYSTEM */ int system(const char *) LIBC_ALIAS_C(system); diff --git a/include/sys/acl.h b/include/sys/acl.h index f3b26f6..62240bf 100644 --- a/include/sys/acl.h +++ b/include/sys/acl.h @@ -43,6 +43,7 @@ #define __DARWIN_ACL_READ_SECURITY (1<<11) #define __DARWIN_ACL_WRITE_SECURITY (1<<12) #define __DARWIN_ACL_CHANGE_OWNER (1<<13) +#define __DARWIN_ACL_SYNCHRONIZE (1<<20) #define __DARWIN_ACL_EXTENDED_ALLOW 1 #define __DARWIN_ACL_EXTENDED_DENY 2 @@ -82,6 +83,7 @@ typedef enum { ACL_READ_SECURITY = __DARWIN_ACL_READ_SECURITY, ACL_WRITE_SECURITY = __DARWIN_ACL_WRITE_SECURITY, ACL_CHANGE_OWNER = __DARWIN_ACL_CHANGE_OWNER, + ACL_SYNCHRONIZE = __DARWIN_ACL_SYNCHRONIZE, } acl_perm_t; /* 23.2.5 ACL entry tag type bits - nonstandard */ diff --git a/include/time.h b/include/time.h index d233d21..a97ae7a 100644 --- a/include/time.h +++ b/include/time.h @@ -64,13 +64,11 @@ #define _TIME_H_ #include <_types.h> - -#define __need_struct_timespec -#include <_structs.h> -#include #include +#include #include #include +#include struct tm { int tm_sec; /* seconds after the minute [0-60] */ diff --git a/include/xlocale/_ctype.h b/include/xlocale/_ctype.h index d429300..3da4cdf 100644 --- a/include/xlocale/_ctype.h +++ b/include/xlocale/_ctype.h @@ -39,11 +39,16 @@ __END_DECLS //Begin-Libc #ifdef __LIBC__ -__DARWIN_CTYPE_inline int +__DARWIN_CTYPE_inline int __maskrune_l(__darwin_ct_rune_t _c, unsigned long _f, locale_t _l) { - return ((_c < 0 || _c >= _CACHED_RUNES) ? ___runetype_l(_c, _l) : - __locale_ptr(_l)->__lc_ctype->_CurrentRuneLocale.__runetype[_c]) & _f; + /* _CurrentRuneLocale.__runetype is __uint32_t + * _f is unsigned long + * ___runetype_l(_c, _l) is unsigned long + * retval is int + */ + return (int)((_c < 0 || _c >= _CACHED_RUNES) ? (__uint32_t)___runetype_l(_c, _l) : + __locale_ptr(_l)->__lc_ctype->_CurrentRuneLocale.__runetype[_c]) & (__uint32_t)_f; } #else /* !__LIBC__ */ //End-Libc diff --git a/locale/FreeBSD/ascii.c b/locale/FreeBSD/ascii.c index e2b2b83..e4f1489 100644 --- a/locale/FreeBSD/ascii.c +++ b/locale/FreeBSD/ascii.c @@ -55,7 +55,7 @@ static size_t _ascii_wcrtomb(char * __restrict, wchar_t, static size_t _ascii_wcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t, size_t, mbstate_t * __restrict, locale_t); -__private_extern__ int +int _ascii_init(struct __xlocale_st_runelocale *xrl) { diff --git a/locale/FreeBSD/big5.c b/locale/FreeBSD/big5.c index 12c88ba..bb3daf0 100644 --- a/locale/FreeBSD/big5.c +++ b/locale/FreeBSD/big5.c @@ -61,7 +61,7 @@ typedef struct { wchar_t ch; } _BIG5State; -__private_extern__ int +int _BIG5_init(struct __xlocale_st_runelocale *xrl) { diff --git a/locale/FreeBSD/euc.c b/locale/FreeBSD/euc.c index 1b60aa3..5504b7b 100644 --- a/locale/FreeBSD/euc.c +++ b/locale/FreeBSD/euc.c @@ -76,7 +76,7 @@ _EUC_free_extra(struct __xlocale_st_runelocale *xrl) free(xrl->_CurrentRuneLocale.__variable); } -__private_extern__ int +int _EUC_init(struct __xlocale_st_runelocale *xrl) { _EucInfo *ei; diff --git a/locale/FreeBSD/gb18030.c b/locale/FreeBSD/gb18030.c index c63d050..7a5fc78 100644 --- a/locale/FreeBSD/gb18030.c +++ b/locale/FreeBSD/gb18030.c @@ -54,7 +54,7 @@ typedef struct { u_char bytes[4]; } _GB18030State; -__private_extern__ int +int _GB18030_init(struct __xlocale_st_runelocale *xrl) { diff --git a/locale/FreeBSD/gb2312.c b/locale/FreeBSD/gb2312.c index a84b1cf..2803421 100644 --- a/locale/FreeBSD/gb2312.c +++ b/locale/FreeBSD/gb2312.c @@ -49,7 +49,7 @@ typedef struct { u_char bytes[2]; } _GB2312State; -__private_extern__ int +int _GB2312_init(struct __xlocale_st_runelocale *xrl) { diff --git a/locale/FreeBSD/gbk.c b/locale/FreeBSD/gbk.c index c38338b..fb68b6b 100644 --- a/locale/FreeBSD/gbk.c +++ b/locale/FreeBSD/gbk.c @@ -54,7 +54,7 @@ typedef struct { wchar_t ch; } _GBKState; -__private_extern__ int +int _GBK_init(struct __xlocale_st_runelocale *xrl) { diff --git a/locale/FreeBSD/mblocal.h b/locale/FreeBSD/mblocal.h index f5d3fc1..8029a70 100644 --- a/locale/FreeBSD/mblocal.h +++ b/locale/FreeBSD/mblocal.h @@ -34,26 +34,26 @@ /* * Rune initialization function prototypes. */ -__private_extern__ int _none_init(struct __xlocale_st_runelocale *); -__private_extern__ int _ascii_init(struct __xlocale_st_runelocale *); -__private_extern__ int _UTF2_init(struct __xlocale_st_runelocale *); -__private_extern__ int _UTF8_init(struct __xlocale_st_runelocale *); -__private_extern__ int _EUC_init(struct __xlocale_st_runelocale *); -__private_extern__ int _GB18030_init(struct __xlocale_st_runelocale *); -__private_extern__ int _GB2312_init(struct __xlocale_st_runelocale *); -__private_extern__ int _GBK_init(struct __xlocale_st_runelocale *); -__private_extern__ int _BIG5_init(struct __xlocale_st_runelocale *); -__private_extern__ int _MSKanji_init(struct __xlocale_st_runelocale *); +__attribute__((visibility("hidden"))) int _none_init(struct __xlocale_st_runelocale *); +__attribute__((visibility("hidden"))) int _ascii_init(struct __xlocale_st_runelocale *); +__attribute__((visibility("hidden"))) int _UTF2_init(struct __xlocale_st_runelocale *); +__attribute__((visibility("hidden"))) int _UTF8_init(struct __xlocale_st_runelocale *); +__attribute__((visibility("hidden"))) int _EUC_init(struct __xlocale_st_runelocale *); +__attribute__((visibility("hidden"))) int _GB18030_init(struct __xlocale_st_runelocale *); +__attribute__((visibility("hidden"))) int _GB2312_init(struct __xlocale_st_runelocale *); +__attribute__((visibility("hidden"))) int _GBK_init(struct __xlocale_st_runelocale *); +__attribute__((visibility("hidden"))) int _BIG5_init(struct __xlocale_st_runelocale *); +__attribute__((visibility("hidden"))) int _MSKanji_init(struct __xlocale_st_runelocale *); -__private_extern__ size_t _none_mbrtowc(wchar_t * __restrict, const char * __restrict, +__attribute__((visibility("hidden"))) size_t _none_mbrtowc(wchar_t * __restrict, const char * __restrict, size_t, mbstate_t * __restrict, locale_t); -__private_extern__ int _none_mbsinit(const mbstate_t *, locale_t); -__private_extern__ size_t _none_mbsnrtowcs(wchar_t * __restrict dst, +__attribute__((visibility("hidden"))) int _none_mbsinit(const mbstate_t *, locale_t); +__attribute__((visibility("hidden"))) size_t _none_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src, size_t nms, size_t len, mbstate_t * __restrict ps __unused, locale_t); -__private_extern__ size_t _none_wcrtomb(char * __restrict, wchar_t, +__attribute__((visibility("hidden"))) size_t _none_wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict, locale_t); -__private_extern__ size_t _none_wcsnrtombs(char * __restrict, const wchar_t ** __restrict, +__attribute__((visibility("hidden"))) size_t _none_wcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t, size_t, mbstate_t * __restrict, locale_t); extern size_t __mbsnrtowcs_std(wchar_t * __restrict, const char ** __restrict, diff --git a/locale/FreeBSD/mskanji.c b/locale/FreeBSD/mskanji.c index 3bf9a4d..0b854f3 100644 --- a/locale/FreeBSD/mskanji.c +++ b/locale/FreeBSD/mskanji.c @@ -59,7 +59,7 @@ typedef struct { wchar_t ch; } _MSKanjiState; -__private_extern__ int +int _MSKanji_init(struct __xlocale_st_runelocale *xrl) { diff --git a/locale/FreeBSD/none.c b/locale/FreeBSD/none.c index c3c75cf..11c2cb0 100644 --- a/locale/FreeBSD/none.c +++ b/locale/FreeBSD/none.c @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/none.c,v 1.15 2007/10/13 16:28:22 ache E int __mb_cur_max = 1; int __mb_sb_limit = 256; /* Expected to be <= _CACHED_RUNES */ -__private_extern__ int +int _none_init(struct __xlocale_st_runelocale *xrl) { @@ -68,7 +68,7 @@ _none_init(struct __xlocale_st_runelocale *xrl) return(0); } -__private_extern__ int +int _none_mbsinit(const mbstate_t *ps __unused, locale_t loc __unused) { @@ -79,7 +79,7 @@ _none_mbsinit(const mbstate_t *ps __unused, locale_t loc __unused) return (1); } -__private_extern__ size_t +size_t _none_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n, mbstate_t * __restrict ps __unused, locale_t loc __unused) { @@ -95,7 +95,7 @@ _none_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n, return (*s == '\0' ? 0 : 1); } -__private_extern__ size_t +size_t _none_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps __unused, locale_t loc __unused) { @@ -111,7 +111,7 @@ _none_wcrtomb(char * __restrict s, wchar_t wc, return (1); } -__private_extern__ size_t +size_t _none_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src, size_t nms, size_t len, mbstate_t * __restrict ps __unused, locale_t loc __unused) { @@ -136,7 +136,7 @@ _none_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src, return (nchr); } -__private_extern__ size_t +size_t _none_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src, size_t nwc, size_t len, mbstate_t * __restrict ps __unused, locale_t loc __unused) { diff --git a/locale/FreeBSD/table.c b/locale/FreeBSD/table.c index 667b846..747b604 100644 --- a/locale/FreeBSD/table.c +++ b/locale/FreeBSD/table.c @@ -248,7 +248,7 @@ _RuneLocale _DefaultRuneLocale __attribute__((section("__DATA,__constrw"))) = { }, }; -__private_extern__ struct __xlocale_st_runelocale _DefaultRuneXLocale __attribute__((section("__DATA,__constrw"))) = { +struct __xlocale_st_runelocale _DefaultRuneXLocale __attribute__((section("__DATA,__constrw"))) = { 0, XPERMANENT, "C", diff --git a/locale/FreeBSD/utf2.c b/locale/FreeBSD/utf2.c index d611aa8..006b32f 100644 --- a/locale/FreeBSD/utf2.c +++ b/locale/FreeBSD/utf2.c @@ -58,7 +58,7 @@ typedef struct { wchar_t lbound; } _UTF2State; -__private_extern__ int +int _UTF2_init(struct __xlocale_st_runelocale *xrl) { diff --git a/locale/FreeBSD/utf8.c b/locale/FreeBSD/utf8.c index 8090844..100573e 100644 --- a/locale/FreeBSD/utf8.c +++ b/locale/FreeBSD/utf8.c @@ -93,7 +93,7 @@ typedef struct { SecondByte sb; } _UTF8State; -__private_extern__ int +int _UTF8_init(struct __xlocale_st_runelocale *xrl) { diff --git a/locale/xlocale.c b/locale/xlocale.c index 899380e..337fa4a 100644 --- a/locale/xlocale.c +++ b/locale/xlocale.c @@ -40,10 +40,10 @@ } static char C[] = "C"; -static const struct _xlocale __c_locale = C_LOCALE_INITIALIZER; +static struct _xlocale __c_locale = C_LOCALE_INITIALIZER; const locale_t _c_locale = (const locale_t)&__c_locale; -__private_extern__ struct _xlocale __global_locale = C_LOCALE_INITIALIZER; -__private_extern__ pthread_key_t __locale_key = (pthread_key_t)-1; +struct _xlocale __global_locale = C_LOCALE_INITIALIZER; +pthread_key_t __locale_key = (pthread_key_t)-1; extern int __collate_load_tables(const char *, locale_t); extern int __detect_path_locale(void); diff --git a/locale/xlocale_private.h b/locale/xlocale_private.h index b433536..52a4fb8 100644 --- a/locale/xlocale_private.h +++ b/locale/xlocale_private.h @@ -41,6 +41,7 @@ #include "lmonetary.h" #include "lnumeric.h" #include "timelocal.h" +#include #undef MB_CUR_MAX #define MB_CUR_MAX (__current_locale()->__lc_ctype->__mb_cur_max) @@ -183,9 +184,14 @@ struct _xlocale { #define XL_RETAIN(x) if ((x) && (x)->__free_extra != XPERMANENT) { OSAtomicIncrement32Barrier(&(x)->__refcount); } #define XL_UNLOCK(x) UNLOCK((x)->__lock); -__private_extern__ struct __xlocale_st_runelocale _DefaultRuneXLocale; -__private_extern__ struct _xlocale __global_locale; -__private_extern__ pthread_key_t __locale_key; +__attribute__((visibility("hidden"))) +extern struct __xlocale_st_runelocale _DefaultRuneXLocale; + +__attribute__((visibility("hidden"))) +extern struct _xlocale __global_locale; + +__attribute__((visibility("hidden"))) +extern pthread_key_t __locale_key; __BEGIN_DECLS @@ -196,6 +202,15 @@ void __xlocale_init(void); static inline __attribute__((always_inline)) locale_t __current_locale(void) { +#if TARGET_IPHONE_SIMULATOR + /* Crash in _objc_inform for duplicate class name during simulator launch + * TODO: Remove after the simulator's libSystem is initialized properly. + */ + if (__locale_key == (pthread_key_t)-1) { + return &__global_locale; + } +#endif + locale_t __locale = (locale_t)pthread_getspecific(__locale_key); return (__locale ? __locale : &__global_locale); } diff --git a/man/manpages.lst b/man/manpages.lst index 1ad47a2..1a5c2d2 100644 --- a/man/manpages.lst +++ b/man/manpages.lst @@ -83,7 +83,7 @@ dbm.3 dbm.3 dbm_clearerr.3 dbm_close.3 dbm_delete.3 dbm_dirfno.3 dbm_error.3 dbm dbopen.3 dbopen.3 db.3 devname.3 devname.3 devname_r.3 digittoint.3 digittoint.3 digittoint_l.3 -directory.3 directory.3 closedir.3 dirfd.3 opendir.3 readdir.3 readdir_r.3 rewinddir.3 seekdir.3 telldir.3 +directory.3 directory.3 closedir.3 dirfd.3 fdopendir.3 opendir.3 readdir.3 readdir_r.3 rewinddir.3 seekdir.3 telldir.3 dirname.3 dirname.3 div.3 div.3 duplocale.3 duplocale.3 diff --git a/os/assumes.c b/os/assumes.c index 9950166..b11a48c 100644 --- a/os/assumes.c +++ b/os/assumes.c @@ -21,6 +21,7 @@ * @APPLE_LICENSE_HEADER_END@ */ +#include #include #include #include @@ -40,7 +41,7 @@ #include #include "os/assumes.h" #include "gen/assumes.h" -#include +#include #define OSX_ASSUMES_LOG_REDIRECT_SECT_NAME "__osx_log_func" #define os_atomic_cmpxchg(p, o, n) __sync_bool_compare_and_swap((p), (o), (n)) @@ -68,6 +69,13 @@ _os_get_build(char *build, size_t sz) if (r == 0 && sz == 1) { (void)strlcpy(build, "99Z999", oldsz); } +#if TARGET_IPHONE_SIMULATOR + char *simVersion = getenv("SIMULATOR_RUNTIME_BUILD_VERSION"); + if (simVersion) { + strlcat(build, " ", oldsz); + strlcat(build, simVersion, oldsz); + } +#endif } static void @@ -203,7 +211,7 @@ _os_construct_message(uint64_t code, _SIMPLE_STRING asl_message, Dl_info *info, char result[24]; (void)snprintf(result, sizeof(result), "0x%llx", code); - char build[16]; + char build[32]; size_t bsz = sizeof(build); _os_get_build(build, bsz); @@ -227,7 +235,7 @@ _os_assumes_log_impl(uint64_t code) char message[256]; _os_construct_message(code, asl_message, &info, message, sizeof(message)); if (!_os_log_redirect(info.dli_fbase, message)) { - _os_trace_error_str(message); + _os_debug_log_error_str(message); _simple_asl_msg_set(asl_message, "Level", "Error"); _simple_asl_msg_set(asl_message, "Message", ""); _simple_asl_send(asl_message); @@ -253,7 +261,7 @@ _os_assert_log_impl(uint64_t code) char message[256]; _os_construct_message(code, asl_message, &info, message, sizeof(message)); if (!_os_log_redirect(info.dli_fbase, message)) { - _os_trace_error_str(message); + _os_debug_log_error_str(message); _simple_asl_msg_set(asl_message, "Level", "Error"); _simple_asl_msg_set(asl_message, "Message", ""); _simple_asl_send(asl_message); diff --git a/os/assumes.h b/os/assumes.h index 028b828..3808395 100644 --- a/os/assumes.h +++ b/os/assumes.h @@ -34,8 +34,21 @@ __BEGIN_DECLS #include #include #include <_simple.h> -#include #include +#include + +#if __GNUC__ +#define os_constant(x) __builtin_constant_p((x)) +#define os_hardware_trap() __asm__ __volatile__ (""); __builtin_trap() +#define __OS_COMPILETIME_ASSERT__(e) __extension__({ \ + char __compile_time_assert__[(e) ? 1 : -1]; \ + (void)__compile_time_assert__; \ +}) +#else /* __GNUC__ */ +#define os_constant(x) ((long)0) +#define os_hardware_trap() abort() +#define __OS_COMPILETIME_ASSERT__(e) (e) +#endif /* __GNUC__ */ /* This is useful for clients who wish for the messages generated by assumes() * failures to go somewhere other than (or in addition to) the system log. If @@ -64,12 +77,8 @@ struct _os_redirect_assumes_s { */ typedef bool (*os_log_callout_t)(_SIMPLE_STRING asl_message, void *ctx, const char *); -#if TARGET_OS_IPHONE -#define os_set_crash_message(arg) /* no-op */ -#else #include -#define os_set_crash_message(arg) _crc_make_setter(message, (arg)) -#endif +#define os_set_crash_message(arg) CRSetCrashLogMessage(arg) #define os_assumes(e) __extension__({ \ __typeof__(e) _e = os_fastpath(e); \ diff --git a/os/base.h b/os/base.h deleted file mode 100644 index 6f7cd14..0000000 --- a/os/base.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (c) 2012 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@ - */ - -#ifndef __OS_BASE_H__ -#define __OS_BASE_H__ - -#if __GNUC__ -#define os_fastpath(x) ((__typeof__(x))(uintptr_t)__builtin_expect((uintptr_t)(x), ~0l)) -#define os_slowpath(x) ((__typeof__(x))(uintptr_t)__builtin_expect((uintptr_t)(x), 0l)) -#define os_constant(x) __builtin_constant_p((x)) -#define os_hardware_trap() __asm__ __volatile__ (""); __builtin_trap() - -#define __OS_COMPILETIME_ASSERT__(e) __extension__({ \ - char __compile_time_assert__[(e) ? 1 : -1]; \ - (void)__compile_time_assert__; \ -}) - -#define __OS_CONST __attribute__((__const__)) -#define __OS_PRINTFLIKE(x,y) __attribute__((__format__(printf,x,y))) -#else /* __GNUC__ */ -#define os_fastpath(x) (x) -#define os_slowpath(x) (x) -#define os_constant(x) ((long)0) -#define os_hardware_trap() abort() - -#define __OS_COMPILETIME_ASSERT__(e) (e) - -#define __OS_CONST -#define __OS_PRINTFLIKE(x,y) -#endif /* __GNUC__ */ - -#endif /* __OS_BASE_H__ */ diff --git a/os/trace.c b/os/debug_private.c similarity index 70% rename from os/trace.c rename to os/debug_private.c index 75a4d32..2a826b2 100644 --- a/os/trace.c +++ b/os/debug_private.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012 Apple Inc. All rights reserved. +/* Copyright (c) 2012-2013 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -26,7 +26,8 @@ #include #include #include -#include +#include +#include #include <_simple.h> #include #include @@ -37,10 +38,7 @@ #include #include -// Move this to trace.h when it's removed from assumes.h -typedef bool (*os_redirect_t)(const char *); - -struct os_trace_globals_s { +struct os_debug_log_globals_s { uint64_t start; os_redirect_t redirect; int logfd; @@ -52,7 +50,7 @@ struct os_trace_globals_s { // Otherwise, first try /var/tmp, then $TMPDIR, then give up. static inline int -_os_trace_open_file(const char *suggestion) +_os_debug_log_open_file(const char *suggestion) { if (suggestion) { return open(suggestion, O_WRONLY | O_APPEND | O_CREAT | O_NOFOLLOW | @@ -63,7 +61,7 @@ _os_trace_open_file(const char *suggestion) char filename[PATH_MAX]; char path[PATH_MAX]; - snprintf(filename, sizeof(filename), "os_trace.%s.%d.log", getprogname(), + snprintf(filename, sizeof(filename), "os_debug_log.%s.%d.log", getprogname(), getpid()); strlcpy(path, "/var/tmp/", sizeof(path)); @@ -94,21 +92,21 @@ _os_trace_open_file(const char *suggestion) static void -_os_trace_init(void *globals) +_os_debug_log_init(void *globals) { - struct os_trace_globals_s *g = globals; + struct os_debug_log_globals_s *g = globals; g->errors_only = false; - g->redirect = dlsym(RTLD_MAIN_ONLY, "_os_trace_redirect_func"); + g->redirect = dlsym(RTLD_MAIN_ONLY, "_os_debug_log_redirect_func"); // This is a bit of a hack. LIBDISPATCH_LOG is part of dispatch's API. - // But now all dispatch logging goes through os_trace. So we have to + // But now all dispatch logging goes through os_debug_log. So we have to // recognize this env var here in Libc. // rdar://problem/11685359 tracks deprecating LIBDISPATCH_LOG from dispatch. char *e = getenv("LIBDISPATCH_LOG"); if (!e) { - e = getenv("OS_TRACE"); + e = getenv("OS_DEBUG_LOG"); } // Default log destination @@ -130,12 +128,12 @@ _os_trace_init(void *globals) } else if (strcmp(e, "stdout") == 0) { g->logfd = STDOUT_FILENO; } else if (strcmp(e, "file") == 0) { - g->logfd = _os_trace_open_file(NULL); + g->logfd = _os_debug_log_open_file(NULL); if (g->logfd == -1) { g->errors_only = true; } } else { - g->logfd = _os_trace_open_file(e); + g->logfd = _os_debug_log_open_file(e); if (g->logfd == -1) { g->errors_only = true; } @@ -156,7 +154,7 @@ _os_trace_init(void *globals) g->start = mach_absolute_time(); dprintf(g->logfd, - "=== os_trace log file opened for %s[%u] at %ld.%06u", + "=== os_debug_log log file opened for %s[%u] at %ld.%06u", getprogname(), getpid(), tv.tv_sec, tv.tv_usec); if (g->prepend_timestamp) { @@ -170,27 +168,31 @@ _os_trace_init(void *globals) } } -static inline __OS_CONST -struct os_trace_globals_s * -os_trace_globals(void) +#ifndef OS_ALLOC_ONCE_KEY_OS_DEBUG_LOG +#define OS_ALLOC_ONCE_KEY_OS_DEBUG_LOG OS_ALLOC_ONCE_KEY_OS_TRACE +#endif + +static inline OS_CONST +struct os_debug_log_globals_s * +os_debug_log_globals(void) { - return (struct os_trace_globals_s *) - os_alloc_once(OS_ALLOC_ONCE_KEY_OS_TRACE, - sizeof(struct os_trace_globals_s), - _os_trace_init); + return (struct os_debug_log_globals_s *) + os_alloc_once(OS_ALLOC_ONCE_KEY_OS_DEBUG_LOG, + sizeof(struct os_debug_log_globals_s), + _os_debug_log_init); } static __attribute__((always_inline)) uint64_t -_os_trace_ticks_since_start(void) +_os_debug_log_ticks_since_start(void) { - return mach_absolute_time() - os_trace_globals()->start; + return mach_absolute_time() - os_debug_log_globals()->start; } // False on error writing to file static inline bool -_os_trace_write_fd(int level __attribute__((__unused__)), +_os_debug_log_write_fd(int level __attribute__((__unused__)), char *str, int fd) { size_t len = strlen(str); @@ -215,44 +217,44 @@ _os_trace_write_fd(int level __attribute__((__unused__)), static __attribute__((__noinline__)) void -_os_trace_write_error(void) +_os_debug_log_write_error(void) { char err_str[256]; - const char *pfx = "os_trace() :"; + const char *pfx = "os_debug_log() :"; size_t pfxlen = strlen(pfx); strlcpy(err_str, pfx, sizeof(err_str)); strerror_r(errno, err_str+pfxlen, sizeof(err_str)-pfxlen); - _simple_asl_log(LOG_ERR, "com.apple.os_trace", err_str); + _simple_asl_log(LOG_ERR, "com.apple.os_debug_log", err_str); } static inline void -_os_trace_write(int level, char *str) +_os_debug_log_write(int level, char *str) { - int fd = os_trace_globals()->logfd; - os_redirect_t rdr = os_trace_globals()->redirect; + int fd = os_debug_log_globals()->logfd; + os_redirect_t rdr = os_debug_log_globals()->redirect; // true = redirect has fully handled, don't log if (os_slowpath(rdr) && os_fastpath(rdr(str))) { return; } if (os_slowpath(fd >= 0)) { - if (os_fastpath(_os_trace_write_fd(level, str, fd))) { + if (os_fastpath(_os_debug_log_write_fd(level, str, fd))) { return; } else { - _os_trace_write_error(); - os_trace_globals()->logfd = -1; + _os_debug_log_write_error(); + os_debug_log_globals()->logfd = -1; // Don't return, fall out to syslog(). } } - _simple_asl_log(level, "com.apple.os_trace", str); + _simple_asl_log(level, "com.apple.os_debug_log", str); } static __attribute__((always_inline)) void -_os_tracev(int level, const char *msg, va_list ap) +_os_debug_logv(int level, const char *msg, va_list ap) { - if (os_slowpath(os_trace_globals()->errors_only) && level > LOG_ERR) { + if (os_slowpath(os_debug_log_globals()->errors_only) && level > LOG_ERR) { // more important = lower integer return; } @@ -265,38 +267,38 @@ _os_tracev(int level, const char *msg, va_list ap) } freebuf = buf; - // The os_trace macros prepend many spaces to the format string. + // The os_debug_log macros prepend many spaces to the format string. // Overwrite them with a timestamp, *or* skip them. - const size_t pfxlen = strlen(_OS_TRACE_PREFIX); + const size_t pfxlen = strlen(_OS_DEBUG_LOG_PREFIX); const size_t timelen = 16; __OS_COMPILETIME_ASSERT__(pfxlen >= timelen); if (os_fastpath(len > pfxlen)) { - if (os_slowpath(os_trace_globals()->prepend_timestamp)) { + if (os_slowpath(os_debug_log_globals()->prepend_timestamp)) { char tmp = buf[timelen]; - snprintf(buf, timelen + 1, "%16llu", _os_trace_ticks_since_start()); + snprintf(buf, timelen + 1, "%16llu", _os_debug_log_ticks_since_start()); buf[timelen] = tmp; // snprintf's null } else { buf += pfxlen; } } - _os_trace_write(level, buf); + _os_debug_log_write(level, buf); free(freebuf); } void -_os_trace_error_str(char *msg) +_os_debug_log_error_str(char *msg) { - _os_trace_write(LOG_ERR, msg); + _os_debug_log_write(LOG_ERR, msg); } -__OS_PRINTFLIKE(1, 2) +OS_FORMAT_PRINTF(1, 2) void -_os_trace(const char *msg, ...) +_os_debug_log(const char *msg, ...) { va_list ap; va_start(ap, msg); - _os_tracev(LOG_DEBUG, msg, ap); + _os_debug_logv(LOG_DEBUG, msg, ap); va_end(ap); } diff --git a/os/trace.h b/os/debug_private.h similarity index 73% rename from os/trace.h rename to os/debug_private.h index 2074d6e..daedf82 100644 --- a/os/trace.h +++ b/os/debug_private.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012 Apple Inc. All rights reserved. +/* Copyright (c) 2012-2013 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -20,38 +20,38 @@ * @APPLE_LICENSE_HEADER_END@ */ -#ifndef __OS_TRACE_H__ -#define __OS_TRACE_H__ +#ifndef __OS_DEBUG_LOG_H__ +#define __OS_DEBUG_LOG_H__ #include #include -#include +#include #include __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_6_0) -__OS_PRINTFLIKE(1, 2) +OS_FORMAT_PRINTF(1, 2) extern void -_os_trace(const char *msg, ...); +_os_debug_log(const char *msg, ...); -/* The os_trace macros insert spaces before the message. If logging to a file, +/* The os_debug_log macros insert spaces before the message. If logging to a file, * the spaces will be replaced by a timestamp. If logging to syslog, they will * be skipped (syslog knows what time it is). There are 20 spaces because the * timestamp is printed as %16llu + 4 spaces before the next column. * 10^16 ns = 3.8 months. Don't run your process in _debug for that long. This * isn't syslog. */ -#define _OS_TRACE_PREFIX " " +#define _OS_DEBUG_LOG_PREFIX " " -#define os_trace(tag, fmt, ...) __extension__({\ - _os_trace(_OS_TRACE_PREFIX "%s: " fmt, tag, ## __VA_ARGS__); \ +#define os_debug_log(tag, fmt, ...) __extension__({\ + _os_debug_log(_OS_DEBUG_LOG_PREFIX "%s: " fmt, tag, ## __VA_ARGS__); \ }) -#define os_trace_ctx(tag, ctx, fmt, ...) __extension__({\ - _os_trace(_OS_TRACE_PREFIX "[%p] %s: " fmt, ctx, tag, ## __VA_ARGS__); \ +#define os_debug_log_ctx(tag, ctx, fmt, ...) __extension__({\ + _os_debug_log(_OS_DEBUG_LOG_PREFIX "[%p] %s: " fmt, ctx, tag, ## __VA_ARGS__); \ }) -/* This is useful for clients who wish for the messages generated by os_trace() +/* This is useful for clients who wish for the messages generated by os_debug_log() * or os_assumes() failures to go somewhere other than (or in addition to) the * system log, for example launchd or syslogd itself. If you don't wish for the * message to be logged to the system log, then return true (to indicate that @@ -59,10 +59,10 @@ _os_trace(const char *msg, ...); * false. Please use this macro, rather than directly declaring a function, * since the declaration magic may change in the future. */ -#define os_trace_redirect(func) \ +#define os_debug_log_redirect(func) \ __attribute__((__used__)) \ __attribute__((__visibility__("default"))) \ - bool _os_trace_redirect_func(const char *msg) { \ + bool _os_debug_log_redirect_func(const char *msg) { \ return func(msg); \ } @@ -72,6 +72,6 @@ _os_trace(const char *msg, ...); // str must be modifiable (non-const)! __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_6_0) extern void -_os_trace_error_str(char *str); +_os_debug_log_error_str(char *str); -#endif /* __OS_TRACE_H__ */ +#endif /* __OS_DEBUG_LOG_H__ */ diff --git a/posix1e/acl_perm.c b/posix1e/acl_perm.c index 579915d..d19e056 100644 --- a/posix1e/acl_perm.c +++ b/posix1e/acl_perm.c @@ -81,6 +81,9 @@ #if __DARWIN_ACL_CHANGE_OWNER != KAUTH_VNODE_CHANGE_OWNER # error __DARWIN_ACL_CHANGE_OWNER != KAUTH_VNODE_CHANGE_OWNER #endif +#if __DARWIN_ACL_SYNCHRONIZE != KAUTH_VNODE_SYNCHRONIZE +# error __DARWIN_ACL_SYNCHRONIZE != KAUTH_VNODE_SYNCHRONIZE +#endif int acl_add_perm(acl_permset_t permset, acl_perm_t perm) diff --git a/posix1e/acl_translate.c b/posix1e/acl_translate.c index 527f686..3a06fff 100644 --- a/posix1e/acl_translate.c +++ b/posix1e/acl_translate.c @@ -227,6 +227,7 @@ static struct { {ACL_READ_SECURITY, "readsecurity", ACL_TYPE_FILE | ACL_TYPE_DIR}, {ACL_WRITE_SECURITY, "writesecurity", ACL_TYPE_FILE | ACL_TYPE_DIR}, {ACL_CHANGE_OWNER, "chown", ACL_TYPE_FILE | ACL_TYPE_DIR}, + {ACL_SYNCHRONIZE, "synchronize", ACL_TYPE_FILE | ACL_TYPE_DIR}, {0, NULL, 0} }; diff --git a/posix1e/aclvar.h b/posix1e/aclvar.h index 33c432b..4480037 100644 --- a/posix1e/aclvar.h +++ b/posix1e/aclvar.h @@ -105,7 +105,8 @@ struct _acl_permset { ACL_WRITE_EXTATTRIBUTES | \ ACL_READ_SECURITY | \ ACL_WRITE_SECURITY | \ - ACL_CHANGE_OWNER) + ACL_CHANGE_OWNER | \ + ACL_SYNCHRONIZE) #define _ACL_VALID_PERM(_f) (((_f) & ~_ACL_PERMS_MASK) == 0) diff --git a/stdio/FreeBSD/_flock_stub.c b/stdio/FreeBSD/_flock_stub.c index 07e02fd..a556da3 100644 --- a/stdio/FreeBSD/_flock_stub.c +++ b/stdio/FreeBSD/_flock_stub.c @@ -58,19 +58,7 @@ __weak_reference(_funlockfile, funlockfile); void _flockfile(FILE *fp) { - pthread_t curthread = _pthread_self(); - - if (fp->_fl_owner == curthread) - fp->_fl_count++; - else { - /* - * Make sure this mutex is treated as a private - * internal mutex: - */ - _pthread_mutex_lock(&fp->_fl_mutex); - fp->_fl_owner = curthread; - fp->_fl_count = 1; - } + _pthread_mutex_lock(&fp->_fl_mutex); } /* @@ -85,52 +73,16 @@ _flockfile_debug_stub(FILE *fp, char *fname, int lineno) int _ftrylockfile(FILE *fp) { - pthread_t curthread = _pthread_self(); int ret = 0; - if (fp->_fl_owner == curthread) - fp->_fl_count++; - /* - * Make sure this mutex is treated as a private - * internal mutex: - */ - else if (_pthread_mutex_trylock(&fp->_fl_mutex) == 0) { - fp->_fl_owner = curthread; - fp->_fl_count = 1; - } - else + if (_pthread_mutex_trylock(&fp->_fl_mutex) != 0) ret = -1; + return (ret); } void _funlockfile(FILE *fp) { - pthread_t curthread = _pthread_self(); - - /* - * Check if this file is owned by the current thread: - */ - if (fp->_fl_owner == curthread) { - /* - * Check if this thread has locked the FILE - * more than once: - */ - if (fp->_fl_count > 1) - /* - * Decrement the count of the number of - * times the running thread has locked this - * file: - */ - fp->_fl_count--; - else { - /* - * The running thread will release the - * lock now: - */ - fp->_fl_count = 0; - fp->_fl_owner = NULL; - _pthread_mutex_unlock(&fp->_fl_mutex); - } - } + _pthread_mutex_unlock(&fp->_fl_mutex); } diff --git a/stdio/FreeBSD/fclose.c b/stdio/FreeBSD/fclose.c index 91df68a..e38bbbf 100644 --- a/stdio/FreeBSD/fclose.c +++ b/stdio/FreeBSD/fclose.c @@ -49,8 +49,7 @@ fclose(FILE *fp) { int r; - if (!__sdidinit) - __sinit(); + pthread_once(&__sdidinit, __sinit); if (fp == NULL) { errno = EFAULT; @@ -72,7 +71,7 @@ fclose(FILE *fp) FREELB(fp); fp->_file = -1; fp->_r = fp->_w = 0; /* Mess up if reaccessed. */ - __sfprelease(fp); /* Release this FILE for reuse. */ FUNLOCKFILE(fp); + __sfprelease(fp); /* Release this FILE for reuse. */ return (r); } diff --git a/stdio/FreeBSD/findfp.c b/stdio/FreeBSD/findfp.c index a384327..2d87d66 100644 --- a/stdio/FreeBSD/findfp.c +++ b/stdio/FreeBSD/findfp.c @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/findfp.c,v 1.34 2009/12/05 19:31:38 ed Ex #include "local.h" #include "glue.h" -int __sdidinit; +pthread_once_t __sdidinit; #if !TARGET_OS_EMBEDDED #define NDYNAMIC 10 /* add ten more whenever necessary */ @@ -72,9 +72,8 @@ int __sdidinit; ._write = __swrite, \ ._extra = __sFX + file, \ } -#define __sFXInit {.fl_mutex = PTHREAD_MUTEX_INITIALIZER} /* set counted */ -#define __sFXInit3 {.fl_mutex = PTHREAD_MUTEX_INITIALIZER, .counted = 1} +#define __sFXInit3 {.fl_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER, .counted = 1} static int __scounted; /* streams counted against STREAM_MAX */ static int __stream_max; @@ -115,24 +114,16 @@ static struct glue *lastglue = &__sglue; static struct glue * moreglue(int); -static spinlock_t thread_lock = _SPINLOCK_INITIALIZER; -#define THREAD_LOCK() if (__isthreaded) _SPINLOCK(&thread_lock) -#define THREAD_UNLOCK() if (__isthreaded) _SPINUNLOCK(&thread_lock) - -#if NOT_YET -#define SET_GLUE_PTR(ptr, val) atomic_set_rel_ptr(&(ptr), (uintptr_t)(val)) -#else -#define SET_GLUE_PTR(ptr, val) ptr = val -#endif +static pthread_mutex_t filelist_lock = PTHREAD_MUTEX_INITIALIZER; +#define FILELIST_LOCK() do { pthread_mutex_lock(&filelist_lock); } while(0) +#define FILELIST_UNLOCK() do { pthread_mutex_unlock(&filelist_lock); } while(0) static struct glue * moreglue(n) int n; { struct glue *g; - static const FILE empty; FILE *p; - static const struct __sFILEX emptyx = __sFXInit; struct __sFILEX *fx; g = (struct glue *)malloc(sizeof(*g) + ALIGNBYTES + n * sizeof(FILE) + @@ -146,9 +137,9 @@ moreglue(n) g->iobs = p; while (--n >= 0) { - *p = empty; + bzero(p, sizeof(*p)); p->_extra = fx; - *p->_extra = emptyx; + INITEXTRA(p); p++, fx++; } return (g); @@ -164,12 +155,10 @@ __sfp(int count) int n; struct glue *g; - if (!__sdidinit) - __sinit(); + pthread_once(&__sdidinit, __sinit); if (count) { if (__scounted >= __stream_max) { - THREAD_UNLOCK(); errno = EMFILE; return NULL; } @@ -178,22 +167,24 @@ __sfp(int count) /* * The list must be locked because a FILE may be updated. */ - THREAD_LOCK(); + FILELIST_LOCK(); for (g = &__sglue; g != NULL; g = g->next) { for (fp = g->iobs, n = g->niobs; --n >= 0; fp++) if (fp->_flags == 0) goto found; } - THREAD_UNLOCK(); /* don't hold lock while malloc()ing. */ + FILELIST_UNLOCK(); /* don't hold lock while malloc()ing. */ if ((g = moreglue(NDYNAMIC)) == NULL) return (NULL); - THREAD_LOCK(); /* reacquire the lock */ - SET_GLUE_PTR(lastglue->next, g); /* atomically append glue to list */ + FILELIST_LOCK(); /* reacquire the lock */ + lastglue->next = g; /* atomically append glue to list */ lastglue = g; /* not atomic; only accessed when locked */ fp = g->iobs; found: fp->_flags = 1; /* reserve this slot; caller sets real flags */ - THREAD_UNLOCK(); + FILELIST_UNLOCK(); + + /* _flags = 1 means the FILE* is in use, and this thread owns the object while it is being initialized */ fp->_p = NULL; /* no current pointer */ fp->_w = 0; /* nothing to read or write */ fp->_r = 0; @@ -222,7 +213,13 @@ __sfprelease(FILE *fp) OSAtomicDecrement32(&__scounted); fp->_counted = 0; } + + pthread_mutex_destroy(&fp->_extra->fl_mutex); + + /* Make sure nobody else is enumerating the list while we clear the "in use" _flags field. */ + FILELIST_LOCK(); fp->_flags = 0; + FILELIST_UNLOCK(); } /* @@ -247,10 +244,10 @@ f_prealloc(void) for (g = &__sglue; (n -= g->niobs) > 0 && g->next; g = g->next) /* void */; if ((n > 0) && ((g = moreglue(n)) != NULL)) { - THREAD_LOCK(); - SET_GLUE_PTR(lastglue->next, g); + FILELIST_LOCK(); + lastglue->next = g; lastglue = g; - THREAD_UNLOCK(); + FILELIST_UNLOCK(); } } @@ -274,25 +271,20 @@ _cleanup() void __sinit() { - THREAD_LOCK(); - if (__sdidinit == 0) { #if !TARGET_OS_EMBEDDED - int i; + int i; #endif - /* Make sure we clean up on exit. */ - __cleanup = _cleanup; /* conservative */ - __stream_max = sysconf(_SC_STREAM_MAX); - __scounted = 3; /* std{in,out,err} already exists */ -#if !TARGET_OS_EMBEDDED - /* Set _extra for the usual suspects. */ - for (i = 0; i < FOPEN_MAX - 3; i++) { - usual[i]._extra = &usual_extra[i]; - INITEXTRA(&usual[i]); - } -#endif + /* Make sure we clean up on exit. */ + __cleanup = _cleanup; /* conservative */ + __stream_max = sysconf(_SC_STREAM_MAX); + __scounted = 3; /* std{in,out,err} already exists */ - __sdidinit = 1; +#if !TARGET_OS_EMBEDDED + /* Set _extra for the usual suspects. */ + for (i = 0; i < FOPEN_MAX - 3; i++) { + usual[i]._extra = &usual_extra[i]; + INITEXTRA(&usual[i]); } - THREAD_UNLOCK(); +#endif } diff --git a/stdio/FreeBSD/freopen.c b/stdio/FreeBSD/freopen.c index 3451106..b401304 100644 --- a/stdio/FreeBSD/freopen.c +++ b/stdio/FreeBSD/freopen.c @@ -70,11 +70,10 @@ freopen(file, mode, fp) return (NULL); } + pthread_once(&__sdidinit, __sinit); + FLOCKFILE(fp); - if (!__sdidinit) - __sinit(); - /* * If the filename is a NULL pointer, the caller is asking us to * re-open the same file with a different mode. We allow this only @@ -195,8 +194,8 @@ finish: memset(&fp->_mbstate, 0, sizeof(mbstate_t)); if (f < 0) { /* did not get it after all */ - __sfprelease(fp); /* set it free */ FUNLOCKFILE(fp); + __sfprelease(fp); /* set it free */ errno = sverrno; /* restore in case _close clobbered */ return (NULL); } @@ -221,8 +220,8 @@ finish: * open. */ if (f > SHRT_MAX) { - __sfprelease(fp); /* set it free */ FUNLOCKFILE(fp); + __sfprelease(fp); /* set it free */ errno = EMFILE; return (NULL); } diff --git a/stdio/FreeBSD/fseek.c b/stdio/FreeBSD/fseek.c index 24c424e..9f45c9b 100644 --- a/stdio/FreeBSD/fseek.c +++ b/stdio/FreeBSD/fseek.c @@ -60,8 +60,7 @@ fseek(fp, offset, whence) int serrno = errno; /* make sure stdio is set up */ - if (!__sdidinit) - __sinit(); + pthread_once(&__sdidinit, __sinit); FLOCKFILE(fp); ret = _fseeko(fp, (off_t)offset, whence, 1); @@ -81,8 +80,7 @@ fseeko(fp, offset, whence) int serrno = errno; /* make sure stdio is set up */ - if (!__sdidinit) - __sinit(); + pthread_once(&__sdidinit, __sinit); FLOCKFILE(fp); ret = _fseeko(fp, offset, whence, 0); diff --git a/stdio/FreeBSD/local.h b/stdio/FreeBSD/local.h index e5ee708..51262bc 100644 --- a/stdio/FreeBSD/local.h +++ b/stdio/FreeBSD/local.h @@ -94,15 +94,13 @@ extern int __vfwscanf(FILE * __restrict, locale_t, const wchar_t * __restrict, __va_list); extern size_t __fread(void * __restrict buf, size_t size, size_t count, FILE * __restrict fp); -extern int __sdidinit; +extern pthread_once_t __sdidinit; /* hold a buncha junk that would grow the ABI */ struct __sFILEX { unsigned char *up; /* saved _p when _p is doing ungetc data */ pthread_mutex_t fl_mutex; /* used for MT-safety */ - pthread_t fl_owner; /* current owner */ - int fl_count; /* recursive lock count */ int orientation:2; /* orientation for fwide() */ int counted:1; /* stream counted against STREAM_MAX */ mbstate_t mbstate; /* multibyte conversion state */ @@ -110,17 +108,15 @@ struct __sFILEX { #define _up _extra->up #define _fl_mutex _extra->fl_mutex -#define _fl_owner _extra->fl_owner -#define _fl_count _extra->fl_count #define _orientation _extra->orientation #define _mbstate _extra->mbstate #define _counted _extra->counted + + #define INITEXTRA(fp) do { \ (fp)->_extra->up = NULL; \ - (fp)->_extra->fl_mutex = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER; \ - (fp)->_extra->fl_owner = NULL; \ - (fp)->_extra->fl_count = 0; \ + (fp)->_extra->fl_mutex = (pthread_mutex_t)PTHREAD_RECURSIVE_MUTEX_INITIALIZER; \ (fp)->_extra->orientation = 0; \ memset(&(fp)->_extra->mbstate, 0, sizeof(mbstate_t)); \ (fp)->_extra->counted = 0; \ diff --git a/stdio/FreeBSD/printfcommon.h b/stdio/FreeBSD/printfcommon.h index 27141e6..889b12e 100644 --- a/stdio/FreeBSD/printfcommon.h +++ b/stdio/FreeBSD/printfcommon.h @@ -130,7 +130,7 @@ io_printandpad(struct io_state *iop, const CHAR *p, const CHAR *ep, { int p_len; - p_len = ep - p; + p_len = (int)(ep - p); if (p_len > len) p_len = len; if (p_len > 0) { @@ -168,7 +168,7 @@ __ultoa(u_long val, CHAR *endp, int base, int octzero, const char *xdigs) switch (base) { case 10: if (val < 10) { /* many numbers are 1 digit */ - *--cp = to_char(val); + *--cp = (CHAR)to_char(val); return (cp); } /* @@ -295,7 +295,7 @@ exponent(CHAR *p0, int exp, CHAR fmtch) *p++ = '0'; *p++ = to_char(exp); } - return (p - p0); + return (int)(p - p0); } #endif /* !NO_FLOATING_POINT */ diff --git a/stdio/FreeBSD/refill.c b/stdio/FreeBSD/refill.c index 8d42bbb..7daa062 100644 --- a/stdio/FreeBSD/refill.c +++ b/stdio/FreeBSD/refill.c @@ -69,8 +69,7 @@ __srefill0(FILE *fp) { /* make sure stdio is set up */ - if (!__sdidinit) - __sinit(); + pthread_once(&__sdidinit, __sinit); ORIENT(fp, -1); diff --git a/stdio/FreeBSD/rewind.c b/stdio/FreeBSD/rewind.c index 3dc282d..33aea2f 100644 --- a/stdio/FreeBSD/rewind.c +++ b/stdio/FreeBSD/rewind.c @@ -49,8 +49,7 @@ rewind(FILE *fp) int serrno = errno; /* make sure stdio is set up */ - if (!__sdidinit) - __sinit(); + pthread_once(&__sdidinit, __sinit); FLOCKFILE(fp); if (_fseeko(fp, (off_t)0, SEEK_SET, 1) == 0) { diff --git a/stdio/FreeBSD/ungetc.c b/stdio/FreeBSD/ungetc.c index fc8ddb1..287fa02 100644 --- a/stdio/FreeBSD/ungetc.c +++ b/stdio/FreeBSD/ungetc.c @@ -92,8 +92,8 @@ ungetc(int c, FILE *fp) { int ret; - if (!__sdidinit) - __sinit(); + pthread_once(&__sdidinit, __sinit); + FLOCKFILE(fp); ORIENT(fp, -1); ret = __ungetc(c, fp); diff --git a/stdio/FreeBSD/vfscanf.c b/stdio/FreeBSD/vfscanf.c index 4f1c3c7..618961e 100644 --- a/stdio/FreeBSD/vfscanf.c +++ b/stdio/FreeBSD/vfscanf.c @@ -326,8 +326,10 @@ literal: case 'n': { + if (flags & SUPPRESS) /* ??? */ + continue; void *ptr = va_arg(ap, void *); - if ((ptr == NULL) || (flags & SUPPRESS)) /* ??? */ + if (ptr == NULL) continue; else if (flags & SHORTSHORT) *(char *)ptr = nread; diff --git a/stdio/FreeBSD/vfwscanf.c b/stdio/FreeBSD/vfwscanf.c index 771dcfc..61b868a 100644 --- a/stdio/FreeBSD/vfwscanf.c +++ b/stdio/FreeBSD/vfwscanf.c @@ -346,8 +346,10 @@ literal: case 'n': { + if (flags & SUPPRESS) /* ??? */ + continue; void *ptr = va_arg(ap, void *); - if ((ptr == NULL) || (flags & SUPPRESS)) /* ??? */ + if (ptr == NULL) continue; else if (flags & SHORTSHORT) *(char *)ptr = nread; diff --git a/stdio/FreeBSD/vsnprintf.c b/stdio/FreeBSD/vsnprintf.c index d367275..4b29144 100644 --- a/stdio/FreeBSD/vsnprintf.c +++ b/stdio/FreeBSD/vsnprintf.c @@ -56,8 +56,15 @@ _vsnprintf(printf_comp_t __restrict pc, printf_domain_t __restrict domain, char on = n; if (n != 0) n--; +#if defined(__i386__) + /* don't corrupt the output buffer at all if the size underflowed */ + if (n > INT_MAX) + on = n = 0; +#else if (n > INT_MAX) n = INT_MAX; +#endif + /* Stdio internals do not deal correctly with zero length buffer */ if (n == 0) { if (on > 0) diff --git a/stdio/FreeBSD/wsetup.c b/stdio/FreeBSD/wsetup.c index ea1b9e8..b0bdfb4 100644 --- a/stdio/FreeBSD/wsetup.c +++ b/stdio/FreeBSD/wsetup.c @@ -51,8 +51,7 @@ __swsetup(fp) FILE *fp; { /* make sure stdio is set up */ - if (!__sdidinit) - __sinit(); + pthread_once(&__sdidinit, __sinit); /* * If we are not writing, we had better be reading and writing. diff --git a/stdlib/FreeBSD/abort.c b/stdlib/FreeBSD/abort.c index e88755d..37e576e 100644 --- a/stdlib/FreeBSD/abort.c +++ b/stdlib/FreeBSD/abort.c @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/abort.c,v 1.11 2007/01/09 00:28:09 imp E #include "libc_private.h" -#include "CrashReporterClient.h" +#include #include "_simple.h" extern void (*__cleanup)(); diff --git a/stdlib/FreeBSD/atexit.c b/stdlib/FreeBSD/atexit.c index 8a67977..99f311f 100644 --- a/stdlib/FreeBSD/atexit.c +++ b/stdlib/FreeBSD/atexit.c @@ -37,9 +37,11 @@ static char sccsid[] = "@(#)atexit.c 8.2 (Berkeley) 7/3/94"; __FBSDID("$FreeBSD: src/lib/libc/stdlib/atexit.c,v 1.8 2007/01/09 00:28:09 imp Exp $"); #include "namespace.h" +#include #include #include #include +#include #include #if defined(__DYNAMIC__) || defined (__BLOCKS__) #include @@ -49,8 +51,10 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/atexit.c,v 1.8 2007/01/09 00:28:09 imp E #ifdef __BLOCKS__ #include +#include #endif /* __BLOCKS__ */ #include "libc_private.h" +#include #include @@ -84,7 +88,15 @@ struct atexit { }; static struct atexit *__atexit; /* points to head of LIFO stack */ -static int new_registration; +static int __atexit_new_registration; + +__attribute__ ((visibility ("hidden"))) +void +__atexit_init(void) +{ + __atexit = os_alloc_once(OS_ALLOC_ONCE_KEY_LIBSYSTEM_C, + sizeof(struct atexit), NULL); +} /* * Register the function described by 'fptr' to be called at application @@ -94,13 +106,10 @@ static int new_registration; static int atexit_register(struct atexit_fn *fptr) { - static struct atexit __atexit0; /* one guaranteed table */ - struct atexit *p; - + struct atexit *p = __atexit; + assert(p); _MUTEX_LOCK(&atexit_mutex); - if ((p = __atexit) == NULL) - __atexit = p = &__atexit0; - else while (p->ind >= ATEXIT_SIZE) { + while (p->ind >= ATEXIT_SIZE) { struct atexit *old__atexit; old__atexit = __atexit; _MUTEX_UNLOCK(&atexit_mutex); @@ -120,7 +129,7 @@ atexit_register(struct atexit_fn *fptr) __atexit = p; } p->fns[p->ind++] = *fptr; - new_registration = 1; + __atexit_new_registration = 1; _MUTEX_UNLOCK(&atexit_mutex); return 0; } @@ -132,20 +141,20 @@ int atexit(void (*func)(void)) { struct atexit_fn fn; - struct dl_info info; int error; fn.fn_type = ATEXIT_FN_STD; fn.fn_ptr.std_func = func; fn.fn_arg = NULL; -#if defined(__DYNAMIC__) - if ( dladdr(func, &info) ) - fn.fn_dso = info.dli_fbase; - else - fn.fn_dso = NULL; -#else /* ! defined(__DYNAMIC__) */ fn.fn_dso = NULL; -#endif /* defined(__DYNAMIC__) */ + +#if defined(__DYNAMIC__) && !TARGET_OS_IPHONE + // + struct dl_info info; + if (dladdr(func, &info)) { + fn.fn_dso = info.dli_fbase; + } +#endif error = atexit_register(&fn); return (error); @@ -156,20 +165,12 @@ int atexit_b(void (^block)(void)) { struct atexit_fn fn; - struct dl_info info; int error; fn.fn_type = ATEXIT_FN_BLK; fn.fn_ptr.block = Block_copy(block); fn.fn_arg = NULL; -#if defined(__DYNAMIC__) - if ( dladdr(block, &info) ) - fn.fn_dso = info.dli_fbase; - else - fn.fn_dso = NULL; -#else /* ! defined(__DYNAMIC__) */ fn.fn_dso = NULL; -#endif /* defined(__DYNAMIC__) */ error = atexit_register(&fn); return (error); @@ -195,52 +196,121 @@ __cxa_atexit(void (*func)(void *), void *arg, void *dso) return (error); } +static bool +__cxa_in_range(const struct __cxa_range_t ranges[], + unsigned int count, + const void* fn) +{ + uintptr_t addr = (uintptr_t)fn; + + unsigned int i; + for (i = 0; i < count; ++i) { + const struct __cxa_range_t *r = &ranges[i]; + if (addr < (uintptr_t)r->addr) { + continue; + } + if (addr < ((uintptr_t)r->addr + r->length)) { + return true; + } + } + return false; +} + /* - * Call all handlers registered with __cxa_atexit for the shared - * object owning 'dso'. Note: if 'dso' is NULL, then all remaining - * handlers are called. + * Call handlers registered via __cxa_atexit/atexit that are in a + * a range specified. + * Note: rangeCount==0, means call all handlers. */ void -__cxa_finalize(const void *dso) +__cxa_finalize_ranges(const struct __cxa_range_t ranges[], unsigned int count) { struct atexit *p; - struct atexit_fn fn; + struct atexit_fn *fn; int n; - _MUTEX_LOCK(&atexit_mutex); + restart: for (p = __atexit; p; p = p->next) { for (n = p->ind; --n >= 0;) { - if (p->fns[n].fn_type == ATEXIT_FN_EMPTY) - continue; /* already been called */ - if (dso != NULL && dso != p->fns[n].fn_dso) - continue; /* wrong DSO */ - fn = p->fns[n]; - /* - Mark entry to indicate that this particular handler - has already been called. - */ - p->fns[n].fn_type = ATEXIT_FN_EMPTY; - new_registration = 0; - _MUTEX_UNLOCK(&atexit_mutex); - - /* Call the function of correct type. */ - if (fn.fn_type == ATEXIT_FN_CXA) - fn.fn_ptr.cxa_func(fn.fn_arg); - else if (fn.fn_type == ATEXIT_FN_STD) - fn.fn_ptr.std_func(); + fn = &p->fns[n]; + + if (fn->fn_type == ATEXIT_FN_EMPTY) { + continue; // already been called + } + + // Verify that the entry is within the range being unloaded. + if (count > 0) { + if (fn->fn_type == ATEXIT_FN_CXA) { + // for __cxa_atexit(), call if *dso* is in range be unloaded + if (!__cxa_in_range(ranges, count, fn->fn_dso)) { + continue; // not being unloaded yet + } + } else if (fn->fn_type == ATEXIT_FN_STD) { + // for atexit, call if *function* is in range be unloaded + if (!__cxa_in_range(ranges, count, fn->fn_ptr.std_func)) { + continue; // not being unloaded yet + } #ifdef __BLOCKS__ - else if (fn.fn_type == ATEXIT_FN_BLK) - fn.fn_ptr.block(); -#endif /* __BLOCKS__ */ + } else if (fn->fn_type == ATEXIT_FN_BLK) { + // for atexit_b, call if block code is in range be unloaded + void *a = ((struct Block_layout *)fn->fn_ptr.block)->invoke; + if (!__cxa_in_range(ranges, count, a)) { + continue; // not being unloaded yet + } +#endif // __BLOCKS__ + } + } + + // Clear the entry to indicate that this handler has been called. + int fn_type = fn->fn_type; + fn->fn_type = ATEXIT_FN_EMPTY; + + // Detect recursive registrations. + __atexit_new_registration = 0; + _MUTEX_UNLOCK(&atexit_mutex); + + // Call the handler. + if (fn_type == ATEXIT_FN_CXA) { + fn->fn_ptr.cxa_func(fn->fn_arg); + } else if (fn_type == ATEXIT_FN_STD) { + fn->fn_ptr.std_func(); +#ifdef __BLOCKS__ + } else if (fn_type == ATEXIT_FN_BLK) { + fn->fn_ptr.block(); +#endif // __BLOCKS__ + } + + // Call any recursively registered handlers. _MUTEX_LOCK(&atexit_mutex); - if (new_registration) + if (__atexit_new_registration) { goto restart; + } } } _MUTEX_UNLOCK(&atexit_mutex); } + +/* + * Call all handlers registered with __cxa_atexit for the shared + * object owning 'dso'. Note: if 'dso' is NULL, then all remaining + * handlers are called. + */ +void +__cxa_finalize(const void *dso) +{ + if (dso != NULL) { + // Note: this should not happen as only dyld should be calling + // this and dyld has switched to call __cxa_finalize_ranges directly. + struct __cxa_range_t range; + range.addr = dso; + range.length = 1; + __cxa_finalize_ranges(&range, 1); + } else { + __cxa_finalize_ranges(NULL, 0); + } +} + #if !TARGET_IPHONE_SIMULATOR && (__i386__ || __x86_64__) /* * Support for thread_local in C++, using existing _tlv_atexit() in libdyld diff --git a/stdlib/FreeBSD/atexit.h b/stdlib/FreeBSD/atexit.h index 56220ef..608104f 100644 --- a/stdlib/FreeBSD/atexit.h +++ b/stdlib/FreeBSD/atexit.h @@ -33,4 +33,12 @@ /* must be at least 32 to guarantee ANSI conformance */ #define ATEXIT_SIZE 32 +struct __cxa_range_t { + const void* addr; + size_t length; +}; + void __cxa_finalize(const void *dso); + +void __cxa_finalize_ranges(const struct __cxa_range_t ranges[], + unsigned int count); diff --git a/stdlib/FreeBSD/exit.c b/stdlib/FreeBSD/exit.c index ba66bc6..e61834e 100644 --- a/stdlib/FreeBSD/exit.c +++ b/stdlib/FreeBSD/exit.c @@ -55,11 +55,3 @@ extern void _tlv_exit(); void exit(int status) { -#if !TARGET_IPHONE_SIMULATOR && (__i386__ || __x86_64__) - _tlv_exit(); // C++11 requires thread_local objects to be destroyed before global objects -#endif - __cxa_finalize(NULL); - if (__cleanup) - (*__cleanup)(); - __exit(status); -} diff --git a/stdlib/FreeBSD/psort.c b/stdlib/FreeBSD/psort.c index a95ce60..cb6f707 100644 --- a/stdlib/FreeBSD/psort.c +++ b/stdlib/FreeBSD/psort.c @@ -94,10 +94,8 @@ struct shared { size_t es; size_t turnoff; dispatch_queue_t queue; - pthread_cond_t cond; - pthread_mutex_t mutex; + dispatch_group_t group; OSSpinLock sharedlock; - int count; }; static union args * @@ -321,8 +319,8 @@ nevermind: args->a = a; args->n = r; args->depth_limit = depth_limit; - OSAtomicIncrement32(&shared->count); - dispatch_async_f(shared->queue, args, _psort_parallel); + dispatch_group_async_f(shared->group, shared->queue, args, + _psort_parallel); } else { #ifdef I_AM_PSORT_R _psort(a, r, es, thunk, cmp, depth_limit, NULL); @@ -352,11 +350,6 @@ _psort_parallel(void *x) #endif shared->cmp, args->depth_limit, shared); returnargs(shared, args); - if(OSAtomicDecrement32(&shared->count) <= 0) { - pthread_mutex_lock(&shared->mutex); - pthread_cond_signal(&shared->cond); - pthread_mutex_unlock(&shared->mutex); - } } /* fast, approximate integer square root */ @@ -395,8 +388,7 @@ psort(void *a, size_t n, size_t es, cmp_t *cmp) shared.cmp = cmp; shared.es = es; shared.queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); - shared.cond = (pthread_cond_t)PTHREAD_COND_INITIALIZER; - shared.mutex = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER; + shared.group = dispatch_group_create(); args->a = a; args->n = n; args->depth_limit = DEPTH(n); @@ -415,17 +407,11 @@ psort(void *a, size_t n, size_t es, cmp_t *cmp) * this purpose. */ shared.turnoff = isqrt(n); - OSAtomicIncrement32(&shared.count); _psort_parallel(args); /* wait for queue to drain */ - pthread_mutex_lock(&shared.mutex); - while(shared.count > 0) - pthread_cond_wait(&shared.cond, &shared.mutex); - - pthread_mutex_unlock(&shared.mutex); - pthread_mutex_destroy(&shared.mutex); - pthread_cond_destroy(&shared.cond); + dispatch_group_wait(shared.group, DISPATCH_TIME_FOREVER); + dispatch_release(shared.group); for(p = shared.pagelist; p; p = pp) { pp = p->next; munmap(p, PAGESIZE); diff --git a/sys/OSMemoryNotification.c b/sys/OSMemoryNotification.c index 897b9ac..9e94e4e 100644 --- a/sys/OSMemoryNotification.c +++ b/sys/OSMemoryNotification.c @@ -21,115 +21,11 @@ * @APPLE_LICENSE_HEADER_END@ */ -#include -#include -#include -#include -#include -#include -#include -#include +// Legacy symbols preserved for binary compatibility. const char *kOSMemoryNotificationName = "com.apple.system.memorystatus"; -struct _OSMemoryNotification { - int token; - mach_port_t port; -}; - -int -OSMemoryNotificationCreate(OSMemoryNotificationRef *note) -{ - OSMemoryNotificationRef ref = malloc(sizeof(struct _OSMemoryNotification)); - - if (NULL == ref) { - return ENOMEM; - } - - if (NOTIFY_STATUS_OK != notify_register_mach_port(kOSMemoryNotificationName, &ref->port, 0, &ref->token)) - return ENOMEM; - - *note = ref; - - return 0; -} - -int -OSMemoryNotificationDestroy(OSMemoryNotificationRef note) -{ - if (NOTIFY_STATUS_OK != notify_cancel(note->token)) - return EINVAL; - - if (KERN_SUCCESS != mach_port_deallocate(mach_task_self(), note->port)) - return EINVAL; - - free(note); - - return 0; -} - -int -OSMemoryNotificationWait(OSMemoryNotificationRef note, OSMemoryNotificationLevel *level) -{ - return OSMemoryNotificationTimedWait(note, level, NULL); -} - -static mach_msg_timeout_t -abs_to_timeout(const struct timeval *abstime) -{ - struct timeval rel, now; - - gettimeofday(&now, NULL); - - rel.tv_usec = abstime->tv_usec - now.tv_usec; - rel.tv_sec = abstime->tv_sec - now.tv_sec; - if (rel.tv_usec < 0) { - rel.tv_usec += 1000000; - rel.tv_sec--; - } - if (((int)rel.tv_sec < 0) || ((rel.tv_sec == 0) && (rel.tv_usec == 0))) { - return 0; - } - return rel.tv_sec * 1000 + rel.tv_usec / 1000; -} - -int -OSMemoryNotificationTimedWait(OSMemoryNotificationRef note, OSMemoryNotificationLevel *level, const struct timeval *abstime) -{ - dispatch_semaphore_t sema = dispatch_semaphore_create(0); - dispatch_retain(sema); - - dispatch_source_t memoryNotificationSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_VM, 0, DISPATCH_VM_PRESSURE, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)); - dispatch_source_set_event_handler(memoryNotificationSource, ^{ - dispatch_semaphore_signal(sema); - dispatch_release(sema); - }); - - dispatch_resume(memoryNotificationSource); - - dispatch_time_t waitTime = DISPATCH_TIME_FOREVER; - if (abstime) { - mach_msg_timeout_t timeout = abs_to_timeout(abstime); - waitTime = dispatch_time(DISPATCH_TIME_NOW, timeout * 1e6); - } - - long ret = dispatch_semaphore_wait(sema, waitTime); - - dispatch_release(sema); - dispatch_release(memoryNotificationSource); - - if (ret != 0) { - return ETIMEDOUT; - } - - if (level) { - *level = OSMemoryNotificationLevelUrgent; - } - - return 0; -} - -OSMemoryNotificationLevel OSMemoryNotificationCurrentLevel(void) +int OSMemoryNotificationCurrentLevel(void) { - return OSMemoryNotificationLevelNormal; + return 0; // OSMemoryNotificationLevelNormal } diff --git a/sys/OSThermalNotification.c b/sys/OSThermalNotification.c index d9afebf..ef884f6 100644 --- a/sys/OSThermalNotification.c +++ b/sys/OSThermalNotification.c @@ -25,15 +25,19 @@ #include #include +#include + +#define OSThermalPressureLevelName "com.apple.system.thermalpressurelevel" +const char * const kOSThermalNotificationPressureLevelName = OSThermalPressureLevelName; + +#if TARGET_OS_IPHONE #define OSThermalAlert "com.apple.system.thermalalert" #define OSThermalDecision "com.apple.system.thermaldecision" #define OSThermalStatusName "com.apple.system.thermalstatus" -#define OSThermalPressureLevelName "com.apple.system.thermalpressurelevel" const char * const kOSThermalNotificationAlert = OSThermalAlert; const char * const kOSThermalNotificationDecision = OSThermalDecision; const char * const kOSThermalNotificationName = OSThermalStatusName; -const char * const kOSThermalNotificationPressureLevelName = OSThermalPressureLevelName; static const char * const kOSThermalMitigationNames[kOSThermalMitigationCount] = { OSThermalStatusName, @@ -114,3 +118,5 @@ OSThermalNotificationLevel OSThermalNotificationCurrentLevel(void) // Not ready returns -1, which should not be equal or greater than any other thermal state. return OSThermalNotificationLevelAny; } + +#endif // TARGET_OS_IPHONE diff --git a/sys/OpenBSD/stack_protector.c b/sys/OpenBSD/stack_protector.c index 450fd1f..988d8ed 100644 --- a/sys/OpenBSD/stack_protector.c +++ b/sys/OpenBSD/stack_protector.c @@ -35,7 +35,7 @@ #include #include #include -#include "CrashReporterClient.h" +#include #include "libproc.h" #include "_simple.h" diff --git a/sys/_libc_fork_child.c b/sys/_libc_fork_child.c index 7925da8..73da105 100644 --- a/sys/_libc_fork_child.c +++ b/sys/_libc_fork_child.c @@ -24,13 +24,10 @@ * _libc_fork_child() is called from Libsystem's libSystem_atfork_child() */ #include -#include "CrashReporterClient.h" +#include extern void _arc4_fork_child(); -#if !TARGET_IPHONE_SIMULATOR extern void _init_clock_port(void); -#endif -extern void _dirhelper_fork_child(void); void _libc_fork_child(void); // todo: private_extern? void @@ -39,8 +36,5 @@ _libc_fork_child(void) CRSetCrashLogMessage("crashed on child side of fork pre-exec"); _arc4_fork_child(); -#if !TARGET_IPHONE_SIMULATOR _init_clock_port(); -#endif - _dirhelper_fork_child(); } diff --git a/sys/__libc_init.c b/sys/_libc_init.c similarity index 63% rename from sys/__libc_init.c rename to sys/_libc_init.c index 6bce8db..faf185a 100644 --- a/sys/__libc_init.c +++ b/sys/_libc_init.c @@ -21,7 +21,7 @@ * @APPLE_LICENSE_HEADER_END@ */ /* - * __libc_init() is called from libSystem_initializer() + * _libc_initializer() is called from libSystem_initializer() */ #include @@ -30,34 +30,48 @@ #include #include -#if TARGET_IPHONE_SIMULATOR -extern void __chk_init(void); -extern void __xlocale_init(void); - -void -_libc_sim_init(void) { - __chk_init(); - __xlocale_init(); -} - -#else /* TARGET_IPHONE_SIMULATOR */ -struct ProgramVars; /* forward reference */ +#include "libc_private.h" extern void _program_vars_init(const struct ProgramVars *vars); -extern void _libc_fork_init(void (*prepare)(void), void (*parent)(void), void (*child)(void)); +extern void _libc_fork_init(const struct _libc_functions *funcs); +extern void __atexit_init(void); +extern void __confstr_init(const struct _libc_functions *funcs); extern void _init_clock_port(void); extern void __chk_init(void); extern void __xlocale_init(void); extern void __guard_setup(const char *apple[]); void -__libc_init(const struct ProgramVars *vars, void (*atfork_prepare)(void), void (*atfork_parent)(void), void (*atfork_child)(void), const char *apple[]) +_libc_initializer(const struct _libc_functions *funcs, + const char *envp[], + const char *apple[], + const struct ProgramVars *vars) { _program_vars_init(vars); - _libc_fork_init(atfork_prepare, atfork_parent, atfork_child); + _libc_fork_init(funcs); + __confstr_init(funcs); + __atexit_init(); _init_clock_port(); __chk_init(); __xlocale_init(); __guard_setup(apple); } -#endif /* TARGET_IPHONE_SIMULATOR */ + + +void +__libc_init(const struct ProgramVars *vars, + void (*atfork_prepare)(void), + void (*atfork_parent)(void), + void (*atfork_child)(void), + const char *apple[]) +{ + const struct _libc_functions funcs = { + .version = 1, + .atfork_prepare = atfork_prepare, + .atfork_parent = atfork_parent, + .atfork_child = atfork_child, + .dirhelper = NULL, + }; + + return _libc_initializer(&funcs, NULL, apple, vars); +} diff --git a/sys/crt_externs.c b/sys/crt_externs.c index b739e40..a78524f 100644 --- a/sys/crt_externs.c +++ b/sys/crt_externs.c @@ -82,8 +82,9 @@ struct ProgramVars /* - * dyld calls libSystem_initializer() and passes it a ProgramVars struct containing pointers to the - * main executable's NXArg* global variables. libSystem_initializer() calls __libc_init() which calls + * dyld calls libSystem_initializer() and passes it a ProgramVars struct + * containing pointers to the main executable's NXArg* global variables. + * libSystem_initializer() calls _libc_initializer() which calls * _program_vars_init() passing the ProgramVars parameter. */ void __attribute__((visibility("hidden"))) diff --git a/sys/fork.c b/sys/fork.c index 732c014..6a83b53 100644 --- a/sys/fork.c +++ b/sys/fork.c @@ -25,24 +25,20 @@ #include #include -#if TARGET_IPHONE_SIMULATOR -extern pid_t (*_host_fork)(void); -#else +#include "libc_private.h" + extern pid_t __fork(void); -#endif static void (*_libSystem_atfork_prepare)(void) = 0; static void (*_libSystem_atfork_parent)(void) = 0; static void (*_libSystem_atfork_child)(void) = 0; -#if !TARGET_IPHONE_SIMULATOR __private_extern__ -#endif -void _libc_fork_init(void (*prepare)(void), void (*parent)(void), void (*child)(void)) +void _libc_fork_init(const struct _libc_functions *funcs) { - _libSystem_atfork_prepare = prepare; - _libSystem_atfork_parent = parent; - _libSystem_atfork_child = child; + _libSystem_atfork_prepare = funcs->atfork_prepare; + _libSystem_atfork_parent = funcs->atfork_parent; + _libSystem_atfork_child = funcs->atfork_child; } /* @@ -57,12 +53,7 @@ fork(void) // Reader beware: this __fork() call is yet another wrapper around the actual syscall // and lives inside libsyscall. The fork syscall needs some cuddling by asm before it's // allowed to see the big wide C world. -#if TARGET_IPHONE_SIMULATOR - // _host_fork is yet another layer of wrapping that lives in the simulator's libSystem - ret = _host_fork(); -#else ret = __fork(); -#endif if (-1 == ret) { // __fork already set errno for us diff --git a/xcodescripts/Libc.order b/xcodescripts/Libc.order new file mode 100644 index 0000000..ec19af8 --- /dev/null +++ b/xcodescripts/Libc.order @@ -0,0 +1,100 @@ +libBase.a(nanosleep.o):_clock_sem +libBase.a(nanosleep.o):_clock_port +libFortifySource.a(chk_fail.o):___chk_assert_no_overlap +libBase.a(xlocale.o):___locale_key +libBase.a(fork.o):__MergedGlobals +libFreeBSD.a(atexit.o):___atexit_new_registration +libBase.a(fork.o):__libSystem_atfork_prepare +libBase.a(fork.o):__libSystem_atfork_parent +libBase.a(fork.o):__libSystem_atfork_child +libFreeBSD.a(atexit.o):__MergedGlobals +libFreeBSD.a(atexit.o):___atexit +libBase.a(confstr):__dirhelper_func +libBase.a(crt_externs.o):__MergedGlobals +libBase.a(crt_externs.o):_NXArgv_pointer +libBase.a(crt_externs.o):_NXArgc_pointer +libBase.a(crt_externs.o):_environ_pointer +libBase.a(crt_externs.o):___progname_pointer +libBase.a(crt_externs.o):__mh_execute_header_pointer +libFreeBSD.a(stack_protector.o):___stack_chk_guard +libFreeBSD.a(atexit.o):_atexit_mutex +libBase.a(xlocale.o):__MergedGlobals +libBase.a(xlocale.o):___c_locale +libBase.a(xlocale.o):___global_locale +libFreeBSD.a(findfp.o):__MergedGlobals +libFreeBSD.a(exit.o):___cleanup +libFreeBSD.a(findfp.o):___sdidinit +libFreeBSD.a(findfp.o):___sglue +libFreeBSD.a(findfp.o):__MergedGlobals1 +libFreeBSD.a(findfp.o):___stream_max +libFreeBSD.a(findfp.o):___scounted +libFreeBSD.a(findfp.o):_thread_lock +libFreeBSD.a(findfp.o):_lastglue +libBase.a(timezone_unix03.o):_timezone +libFreeBSD.a(localtime.o):_daylight +libFreeBSD.a(localtime.o):___darwin_altzone +libFreeBSD.a(localtime.o):_lclptr +libFreeBSD.a(localtime.o):_tzname +libFreeBSD.a(localtime.o):_lcl_notify +libFreeBSD.a(localtime.o):_lcl_rwlock +libFreeBSD.a(localtime.o):__MergedGlobals +libFreeBSD.a(localtime.o):__MergedGlobals8 +libFreeBSD.a(getpagesize.o):_getpagesize.value +libFreeBSD.a(setenv.o):___env_owned +libFreeBSD.a(arc4random.o):_rs_stired +libFreeBSD.a(arc4random.o):_rs.0 +libFreeBSD.a(arc4random.o):_rs.1 +libFreeBSD.a(arc4random.o):__MergedGlobals +libFreeBSD.a(arc4random.o):_rs_data_available +libFreeBSD.a(arc4random.o):_lock +libFreeBSD.a(arc4random.o):_arc4_count +libFreeBSD.a(arc4random.o):_rdat +libFreeBSD.a(arc4random.o):_rs.2 +libFreeBSD.a(gdtoa-misc.o):_gdtoa_tsd_key +libFreeBSD.a(gdtoa-misc.o):_gdtoa_tsd_lock +libvDarwinExtsn.a(realpath.o):_realpath$DARWIN_EXTSN.rootdev_inited +libvDarwinExtsn.a(realpath.o):_realpath$DARWIN_EXTSN.rootdev +libFreeBSD.a(gdtoa-misc.o):_p5s +libFreeBSD.a(glue.o):___gdtoa_locks +libFreeBSD.a(findfp.o):___sFX +libFreeBSD.a(getopt.o):_optreset +libFreeBSD.a(strerror.o):___strerror_ebuf +libBase.a(NSSystemDirectories.o):_nextRoot +libFreeBSD.a(getopt.o):_optarg +libBase.a(NSSystemDirectories.o):_nextRoot_init_once +libFreeBSD.a(findfp.o):___sF +libFreeBSD.a(localtime.o):_localtime.localtime_key +libFreeBSD.a(getopt.o):_getopt.place +libFreeBSD.a(getopt_long.o):__MergedGlobals +libFreeBSD.a(random.o):__MergedGlobals +libFreeBSD.a(random.o):_fptr +libFreeBSD.a(random.o):_rptr +libFreeBSD.a(localtime.o):_localtime.localtime_mutex +libFreeBSD.a(random.o):_randtbl +libFreeBSD.a(getopt_long.o):_nonopt_end +libFreeBSD.a(getopt_long.o):_nonopt_start +libFreeBSD.a(getopt_long.o):_place +libFreeBSD.a(rand.o):_next +libBase.a(OSThermalNotification.o):_predicates +libBase.a(OSThermalNotification.o):_tokens +libFreeBSD.a(getopt.o):_optind +libBase.a(OSThermalNotification.o):__MergedGlobals +libBase.a(OSThermalNotification.o):_thermalLevelsReady +libFreeBSD.a(asctime.o):_buf_asctime +libFreeBSD.a(getopt.o):_opterr +libFreeBSD.a(basename.o):_basename.bname +libFreeBSD.a(getopt.o):_optopt +libFreeBSD.a(localtime.o):_gmtptr +libFreeBSD.a(localtime.o):_gmt_notify +libFreeBSD.a(localtime.o):_gmt_mutex +libFreeBSD.a(vfscanf.o):___parsefloat_buf.parsefloat_tsd_key +libFreeBSD.a(vfscanf.o):___parsefloat_buf.bsiz +libFreeBSD.a(vfscanf.o):___parsefloat_buf.parsefloat_tsd_lock +libNetBSD.a(utmpx.o):___utx__ +libFreeBSD.a(strtok.o):_strtok.last +libNetBSD.a(utmpx.o):___default_utx.once +libBase.a(assumes.o):__os_abort_on_assumes.once +libFreeBSD.a(inet_ntoa.o):_inet_ntoa.ret +libFreeBSD.a(strsignal.o):_sig_init_once +libFreeBSD.a(strsignal.o):__MergedGlobals +libFreeBSD.a(localtime.o):_lcl_TZname diff --git a/xcodescripts/clean_simulator.sh b/xcodescripts/clean_simulator.sh deleted file mode 100644 index 39c4f38..0000000 --- a/xcodescripts/clean_simulator.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# clean_simulator.sh -if [ "$ACTION" = installhdrs ]; then exit 0; fi - -if [ "$PLATFORM_NAME" = iphonesimulator ]; then - rm -rf "${DSTROOT}"/usr/local/lib/dyld -fi diff --git a/xcodescripts/eos.xcconfig b/xcodescripts/eos.xcconfig index 4ceb325..4cb19c9 100644 --- a/xcodescripts/eos.xcconfig +++ b/xcodescripts/eos.xcconfig @@ -4,7 +4,7 @@ BUILD_ARCHIVES = Base FreeBSD TRE vCancelable vDarwinExtsn BUILD_VARIANTS = normal EXECUTABLE_PREFIX = lib INSTALL_PATH = /usr/local/lib/eOS -OTHER_LDFLAGS = -filelist $(BUILT_PRODUCTS_DIR)/$(CURRENT_VARIANT).linklist +OTHER_LIBTOOLFLAGS = -filelist $(BUILT_PRODUCTS_DIR)/$(CURRENT_VARIANT).linklist PRODUCT_NAME = c_eOS SKIP_INSTALL = YES SKIP_INSTALL[sdk=iphoneos*] = NO diff --git a/xcodescripts/generate_features.pl b/xcodescripts/generate_features.pl index b450231..2d1ee9e 100755 --- a/xcodescripts/generate_features.pl +++ b/xcodescripts/generate_features.pl @@ -25,7 +25,7 @@ for my $arch (split(/ /, $ENV{"ARCHS"})) $ENV{"CURRENT_ARCH"} = $arch; my $platformName = $ENV{"PLATFORM_NAME"}; - $platformName = "iphoneos" if ($platformName eq "iphonesimulator"); + $platformName =~ s/simulator/os/; my $platformPath = $ENV{"SRCROOT"} . "/Platforms/" . $platformName . "/Makefile.inc"; my $featuresHeaderDir = $ENV{"DERIVED_FILES_DIR"}."/".$arch; diff --git a/xcodescripts/headers.sh b/xcodescripts/headers.sh index 1f01ea9..9b02baa 100755 --- a/xcodescripts/headers.sh +++ b/xcodescripts/headers.sh @@ -25,13 +25,8 @@ UNIFDEFARGS=$(${SRCROOT}/xcodescripts/generate_features.pl --unifdef) INCDIR=${DSTROOT}/${PUBLIC_HEADERS_FOLDER_PATH} LOCINCDIR=${DSTROOT}/${PRIVATE_HEADERS_FOLDER_PATH} -SYSTEMFRAMEWORK=${DSTROOT}/System/Library/Frameworks/System.framework -KERNELFRAMEWORK=${DSTROOT}/System/Library/Frameworks/Kernel.framework - -if [ "$PLATFORM_NAME" = iphonesimulator ]; then - SYSTEMFRAMEWORK=${DSTROOT}/${SDKROOT}/System/Library/Frameworks/System.framework - KERNELFRAMEWORK=${DSTROOT}/${SDKROOT}/System/Library/Frameworks/Kernel.framework -fi +SYSTEMFRAMEWORK=${DSTROOT}/${INSTALL_PATH_PREFIX}/System/Library/Frameworks/System.framework +KERNELFRAMEWORK=${DSTROOT}/${INSTALL_PATH_PREFIX}/System/Library/Frameworks/Kernel.framework PRIVHDRS=${SYSTEMFRAMEWORK}/Versions/B/PrivateHeaders PRIVKERNELHDRS=${KERNELFRAMEWORK}/Versions/A/PrivateHeaders @@ -43,15 +38,85 @@ INSTHDRS=( ) INC_INSTHDRS=( - NSSystemDirectories.h _locale.h _structs.h _types.h _wctype.h _xlocale.h aio.h alloca.h \ - ar.h assert.h asm.h bitstring.h cpio.h crt_externs.h ctype.h db.h dirent.h disktab.h err.h \ - errno.h fcntl.h fmtmsg.h fnmatch.h fsproperties.h fstab.h fts.h ftw.h getopt.h glob.h inttypes.h \ - iso646.h langinfo.h libc.h libgen.h limits.h locale.h memory.h monetary.h monitor.h mpool.h ndbm.h \ - nlist.h paths.h printf.h poll.h ranlib.h readpassphrase.h regex.h runetype.h search.h \ - semaphore.h sgtty.h signal.h stab.h standards.h stdbool.h stddef.h stdio.h stdint.h \ - stdlib.h strhash.h string.h stringlist.h strings.h struct.h sysexits.h syslog.h tar.h termios.h time.h \ - timeconv.h ttyent.h ulimit.h unistd.h util.h utime.h vis.h wchar.h wctype.h \ - wordexp.h xlocale.h + _locale.h + _types.h + _wctype.h + _xlocale.h + aio.h + alloca.h + ar.h + assert.h + asm.h + bitstring.h + cpio.h + crt_externs.h + ctype.h + db.h + dirent.h + disktab.h + err.h + errno.h + fcntl.h + fmtmsg.h + fnmatch.h + fsproperties.h + fstab.h + fts.h + ftw.h + getopt.h + glob.h + inttypes.h + iso646.h + langinfo.h + libc.h + libgen.h + limits.h + locale.h + memory.h + monetary.h + monitor.h + mpool.h + ndbm.h + nlist.h + paths.h + printf.h + poll.h + ranlib.h + readpassphrase.h + regex.h + runetype.h + search.h + semaphore.h + sgtty.h + signal.h + stab.h + standards.h + stdbool.h + stddef.h + stdio.h + stdint.h + stdlib.h + strhash.h + string.h + stringlist.h + strings.h + struct.h + sysexits.h + syslog.h + tar.h + termios.h + time.h + timeconv.h + ttyent.h + ulimit.h + unistd.h + util.h + utime.h + vis.h + wchar.h + wctype.h + wordexp.h + xlocale.h ) if [ "x${FEATURE_LEGACY_RUNE_APIS}" == "x1" ]; then INC_INSTHDRS=( "${INC_INSTHDRS[@]}" rune.h ) @@ -71,12 +136,12 @@ INSTHDRS=( "${INSTHDRS[@]}" "${INC_INSTHDRS[@]}" ) INC_ARPA_INSTHDRS=( ftp.h inet.h nameser_compat.h telnet.h tftp.h ) ARPA_INSTHDRS=( "${INC_ARPA_INSTHDRS[@]/#/${SRCROOT}/include/arpa/}" ) -if [ "x${FEATURE_MEM_THERM_NOTIFICATION_APIS}" == "x1" ]; then - INC_LIBKERN_INSTHDRS=( OSMemoryNotification.h OSThermalNotification.h ) - LIBKERN_INSTHDRS=( "${INC_LIBKERN_INSTHDRS[@]/#/${SRCROOT}/include/libkern/}" ) +if [ "x${FEATURE_THERM_NOTIFICATION_APIS}" == "x1" ]; then + INC_THERM_INSTHDRS=( OSThermalNotification.h ) + THERM_INSTHDRS=( "${INC_THERM_INSTHDRS[@]/#/${SRCROOT}/include/libkern/}" ) fi -INC_PROTO_INSTHDRS=(routed.h rwhod.h talkd.h timed.h ) +INC_PROTO_INSTHDRS=( routed.h rwhod.h talkd.h timed.h ) PROTO_INSTHDRS=( "${INC_PROTO_INSTHDRS[@]/#/${SRCROOT}/include/protocols/}" ) INC_SECURE_INSTHDRS=( _common.h _string.h _stdio.h ) @@ -85,8 +150,18 @@ SECURE_INSTHDRS=( "${INC_SECURE_INSTHDRS[@]/#/${SRCROOT}/include/secure/}" ) SYS_INSTHDRS=( ${SRCROOT}/include/sys/acl.h ${SRCROOT}/include/sys/statvfs.h ) INC_XLOCALE_INSTHDRS=( - __wctype.h _ctype.h _inttypes.h _langinfo.h _monetary.h _regex.h - _stdio.h _stdlib.h _string.h _time.h _wchar.h _wctype.h + __wctype.h + _ctype.h + _inttypes.h + _langinfo.h + _monetary.h + _regex.h + _stdio.h + _stdlib.h + _string.h + _time.h + _wchar.h + _wctype.h ) XLOCALE_INSTHDRS=( "${INC_XLOCALE_INSTHDRS[@]/#/${SRCROOT}/include/xlocale/}" ) @@ -103,14 +178,13 @@ TYPES_INSTHDRS=( ) LOCALHDRS=( - ${SRCROOT}/darwin/dirhelper.defs - ${SRCROOT}/darwin/dirhelper_priv.h + ${SRCROOT}/darwin/libc_private.h ${SRCROOT}/gen/assumes.h ${SRCROOT}/gen/utmpx_thread.h ${SRCROOT}/nls/FreeBSD/msgcat.h ) -OS_LOCALHDRS=( ${SRCROOT}/os/assumes.h ${SRCROOT}/os/base.h ${SRCROOT}/os/trace.h ) +OS_LOCALHDRS=( ${SRCROOT}/os/assumes.h ${SRCROOT}/os/debug_private.h ) PRIV_INSTHDRS=( ${SRCROOT}/stdlib/FreeBSD/atexit.h @@ -121,7 +195,11 @@ PRIV_BTREEHDRS=( ${SRCROOT}/db/btree/FreeBSD/bt_extern.h ) -SYS_INSTHDRS=( ${SRCROOT}/include/sys/acl.h ${SRCROOT}/include/sys/rbtree.h ${SRCROOT}/include/sys/statvfs.h ) +SYS_INSTHDRS=( + ${SRCROOT}/include/sys/acl.h + ${SRCROOT}/include/sys/rbtree.h + ${SRCROOT}/include/sys/statvfs.h +) PRIVUUID_INSTHDRS=( ${SRCROOT}/uuid/namespace.h ) ${MKDIR} ${INCDIR}/arpa @@ -134,8 +212,11 @@ ${MKDIR} ${INCDIR}/xlocale ${MKDIR} ${INCDIR}/_types ${INSTALL} -m ${INSTALLMODE} ${INSTHDRS[@]} ${INCDIR} ${INSTALL} -m ${INSTALLMODE} ${ARPA_INSTHDRS[@]} ${INCDIR}/arpa -if [ "x${FEATURE_MEM_THERM_NOTIFICATION_APIS}" == "x1" ]; then -${INSTALL} -m ${INSTALLMODE} ${LIBKERN_INSTHDRS[@]} ${INCDIR}/libkern +if [ "x${FEATURE_MEM_NOTIFICATION_APIS}" == "x1" ]; then +${INSTALL} -m ${INSTALLMODE} ${MEM_INSTHDRS[@]} ${INCDIR}/libkern +fi +if [ "x${FEATURE_THERM_NOTIFICATION_APIS}" == "x1" ]; then +${INSTALL} -m ${INSTALLMODE} ${THERM_INSTHDRS[@]} ${INCDIR}/libkern fi ${INSTALL} -m ${INSTALLMODE} ${PROTO_INSTHDRS[@]} ${INCDIR}/protocols ${INSTALL} -m ${INSTALLMODE} ${SECURE_INSTHDRS[@]} ${INCDIR}/secure diff --git a/xcodescripts/libc.xcconfig b/xcodescripts/libc.xcconfig index efc221f..803d013 100644 --- a/xcodescripts/libc.xcconfig +++ b/xcodescripts/libc.xcconfig @@ -1,8 +1,9 @@ #include "/Makefiles/CoreOS/Xcode/BSD.xcconfig" +#include "/AppleInternal/XcodeConfig/SimulatorSupport.xcconfig" // Standard settings -SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator -SRCROOT_SEARCH_PATHS = $(SRCROOT) $(SRCROOT)/include $(SRCROOT)/gen $(SRCROOT)/locale $(SRCROOT)/locale/FreeBSD $(SRCROOT)/stdtime/FreeBSD +SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator iphoneosnano iphonesimulatornano +SRCROOT_SEARCH_PATHS = $(SRCROOT) $(SRCROOT)/include $(SRCROOT)/gen $(SRCROOT)/locale $(SRCROOT)/locale/FreeBSD $(SRCROOT)/stdtime/FreeBSD $(SRCROOT)/darwin SYSTEM_FRAMEWORK_HEADERS = $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders HEADER_SEARCH_PATHS = $($(TARGET_NAME)_SEARCH_PATHS) $(DERIVED_FILES_DIR)/dtrace $(SRCROOT_SEARCH_PATHS) $(SYSTEM_FRAMEWORK_HEADERS) $(SDKROOT)/usr/local/include $(inherited) ALWAYS_SEARCH_USER_PATHS = YES @@ -36,15 +37,13 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0 GCC_VERSION[arch=armv6] = com.apple.compilers.llvmgcc42 EXECUTABLE_PREFIX = libsystem_ -INSTALL_PATH = /usr/lib/system -PUBLIC_HEADERS_FOLDER_PATH = /usr/include -PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include +INSTALL_PATH_ACTUAL = /usr/lib/system +INSTALL_PATH[sdk=macos*]=$(INSTALL_PATH_ACTUAL) +PUBLIC_HEADERS_FOLDER_PATH = $(INSTALL_PATH_PREFIX)/usr/include +PRIVATE_HEADERS_FOLDER_PATH = $(INSTALL_PATH_PREFIX)/usr/local/include // Simulator -EXECUTABLE_PREFIX[sdk=iphonesimulator*] = libsystem_sim_ -PUBLIC_HEADERS_FOLDER_PATH[sdk=iphonesimulator*] = $(SDKROOT)/usr/include -PRIVATE_HEADERS_FOLDER_PATH[sdk=iphonesimulator*] = $(SDKROOT)/usr/local/include -INSTALL_PATH[sdk=iphonesimulator*] = $(SDKROOT)/usr/lib/system +EXECUTABLE_PREFIX[sdk=*simulator*] = libsystem_sim_ BASE_PREPROCESSOR_MACROS = __LIBC__ __DARWIN_UNIX03=1 __DARWIN_64_BIT_INO_T=1 __DARWIN_NON_CANCELABLE=1 __DARWIN_VERS_1050=1 _FORTIFY_SOURCE=0 OTHER_CFLAGS = -fdollars-in-identifiers -fno-common -fverbose-asm $($(TARGET_NAME)_CFLAGS) $(VARIANT_PREPROCESSOR_MACROS) @@ -54,26 +53,23 @@ GCC_PREPROCESSOR_DEFINITIONS = $(BASE_PREPROCESSOR_MACROS) GCC_PREPROCESSOR_DEFINITIONS[sdk=iphone*] = $(BASE_PREPROCESSOR_MACROS) LIBC_NO_LIBCRASHREPORTERCLIENT=1 // libsystem_c.dylib linking -CR_LDFLAGS[sdk=macosx*] = -lCrashReporterClient +CR_LDFLAGS = -lCrashReporterClient LIBCOMPILER_RT_LDFLAGS = -lcompiler_rt -LIBCOMPILER_RT_LDFLAGS[sdk=iphonesimulator*] = -lcompiler_rt_sim LIBMALLOC_LDFLAGS = -lsystem_malloc -LIBMALLOC_LDFLAGS[sdk=iphonesimulator*] = LIBPLATFORM_LDFLAGS = -lsystem_platform -LIBPLATFORM_LDFLAGS[sdk=iphonesimulator*] = +LIBPLATFORM_LDFLAGS[sdk=*simulator*] = -lsystem_sim_platform LIBPTHREAD_LDFLAGS = -lsystem_pthread -LIBPTHREAD_LDFLAGS[sdk=iphonesimulator*] = +LIBPTHREAD_LDFLAGS[sdk=*simulator*] = -lsystem_sim_pthread LIBSYSCALL_LDFLAGS = -lsystem_kernel -LIBSYSCALL_LDFLAGS[sdk=iphonesimulator*] = +LIBSYSCALL_LDFLAGS[sdk=*simulator*] = -lsystem_sim_kernel LIBM_LDFLAGS = -lsystem_m -LIBM_LDFLAGS[sdk=iphonesimulator*] = -lsystem_sim_m +LIBM_LDFLAGS[sdk=*simulator*] = -lsystem_sim_m LIBDYLD_LDFLAGS = -ldyld -LIBDYLD_LDFLAGS[sdk=iphonesimulator*] = -ldyld_sim -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) -Wl,-interposable_list,$(DERIVED_FILES_DIR)/interposable.list -Wl,-unexported_symbols_list,$(DERIVED_FILES_DIR)/unexport.list -Wl,-alias_list,$(SRCROOT)/string/alias.list @$(BUILT_PRODUCTS_DIR)/$(CURRENT_VARIANT).linklist +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) -Wl,-interposable_list,$(DERIVED_FILES_DIR)/interposable.list -Wl,-unexported_symbols_list,$(DERIVED_FILES_DIR)/unexport.list -Wl,-alias_list,$(SRCROOT)/string/alias.list -Wl,-order_file,$(SRCROOT)/xcodescripts/Libc.order -Wl,-sectalign,__DATA,__data,1000 @$(BUILT_PRODUCTS_DIR)/$(CURRENT_VARIANT).linklist // 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 -UPWARD_LDFLAGS[sdk=iphonesimulator*] = -Wl,-upward-ldispatch -Wl,-upward-lmacho_sim -Wl,-upward-lsystem_sim_blocks -Wl,-upward-lsystem_sim_info -Wl,-upward-lnotify_sim -Wl,-upward-lxpc -Wl,-upward-lSystem +UPWARD_LDFLAGS[sdk=*simulator*] = -Wl,-upward-ldispatch -Wl,-upward-lmacho_sim -Wl,-upward-lsystem_sim_asl -Wl,-upward-lsystem_sim_blocks -Wl,-upward-lsystem_sim_info -Wl,-upward-lnotify_sim -Wl,-upward-lxpc // libPlatform.a architectures ARCH_FAMILY = $(ARCH_FAMILY_$(CURRENT_ARCH)) @@ -90,6 +86,8 @@ Platform_INCLUDED_SOURCE_FILE_NAMES = $(Platform_INCLUDED_SOURCE_FILE_NAMES_$(PL Platform_INCLUDED_SOURCE_FILE_NAMES_macosx = $(Platform_INCLUDED_SOURCE_FILE_NAMES_gen) $(Platform_INCLUDED_SOURCE_FILE_NAMES_stdlib) $(Platform_INCLUDED_SOURCE_FILE_NAMES_string) $(Platform_INCLUDED_SOURCE_FILE_NAMES_sys) Platform_INCLUDED_SOURCE_FILE_NAMES_iphoneos = $(Platform_INCLUDED_SOURCE_FILE_NAMES_gen) $(Platform_INCLUDED_SOURCE_FILE_NAMES_stdlib) $(Platform_INCLUDED_SOURCE_FILE_NAMES_string) $(Platform_INCLUDED_SOURCE_FILE_NAMES_sys) Platform_INCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(Platform_INCLUDED_SOURCE_FILE_NAMES_gen) $(Platform_INCLUDED_SOURCE_FILE_NAMES_stdlib) $(Platform_INCLUDED_SOURCE_FILE_NAMES_string) +Platform_INCLUDED_SOURCE_FILE_NAMES_iphoneosnano = $(Platform_INCLUDED_SOURCE_FILE_NAMES_iphoneos) +Platform_INCLUDED_SOURCE_FILE_NAMES_iphonesimulatornano = $(Platform_INCLUDED_SOURCE_FILE_NAMES_iphonesimulatornano) Platform_INCLUDED_SOURCE_FILE_NAMES_gen = $(ARCH_FAMILY)/gen/*.c $(ARCH_FAMILY)/gen/*.s $(ARCH_FAMILY)/gen/*.S Platform_INCLUDED_SOURCE_FILE_NAMES_stdlib = $(ARCH_FAMILY)/stdlib/*.c $(ARCH_FAMILY)/stdlib/*.s $(ARCH_FAMILY)/stdlib/*.S @@ -127,22 +125,12 @@ BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7k = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7 BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7f = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7) BASE_EXCLUDED_SOURCE_FILE_NAMES_armv6 = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7) -// utmp/utmpx doesn't really fit in iOS, and this has some dependence on -// libasl, so ignore it for now. -BASE_EXCLUDED_SOURCE_FILE_NAMES_sim_utmpx = utmpx-darwin.c utmpx.c logwtmp.c - -// Others which at one point in time were tied too closely to the host. -// It's probably a good idea to have only one set of functions accessing the -// environment at a given time, but the rest may not need to be excluded -// any more. This should be investigated. -BASE_EXCLUDED_SOURCE_FILE_NAMES_sim_misc = thread_stack_pcs.c backtrace.c getenv.c putenv.c setenv.c stack_protector.c crt_externs.c gettimeofday.c - -BASE_EXCLUDED_SOURCE_FILE_NAMES_sim = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_sim_utmpx) $(BASE_EXCLUDED_SOURCE_FILE_NAMES_sim_misc) - // Rune support isn't included on iOS but there's no better way to exclude their complication -BASE_EXCLUDED_SOURCE_FILE_NAMES_macosx = OSMemoryNotification.c OSThermalNotification.c +BASE_EXCLUDED_SOURCE_FILE_NAMES_macosx = OSMemoryNotification.c BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneos = frune.c login.c logout.c mbrune.c runedepreciated.c setinvalidrune.c getmntinfo64.c -BASE_EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_sim) $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneos) +BASE_EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneos) +BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneosnano = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneos) +BASE_EXCLUDED_SOURCE_FILE_NAMES_iphonesimulatornano = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator) // - collate.c crashes llvm-gcc on armv6 with -Os + -gdwarf-2 COLLATE_C_CFLAGS_macosx_armv6 = -O1 diff --git a/xcodescripts/manpages.sh b/xcodescripts/manpages.sh index 4e95226..a27c10a 100644 --- a/xcodescripts/manpages.sh +++ b/xcodescripts/manpages.sh @@ -1,8 +1,7 @@ #!/bin/bash -e if [ "$ACTION" = installhdrs ]; then exit 0; fi -if [ "$PLATFORM_NAME" = iphoneos ]; then exit 0; fi -if [ "$PLATFORM_NAME" = iphonesimulator ]; then exit 0; fi +if [ "${PLATFORM_NAME/iphone/}" != "${PLATFORM_NAME}" ]; then exit 0; fi UNIFDEF_FLAGS=`${SRCROOT}/xcodescripts/generate_features.pl --unifdef` MANPAGES_LIST="${SRCROOT}/man/manpages.lst" diff --git a/xcodescripts/variants.xcconfig b/xcodescripts/variants.xcconfig index cbfdbfa..a2ce9a9 100644 --- a/xcodescripts/variants.xcconfig +++ b/xcodescripts/variants.xcconfig @@ -14,6 +14,8 @@ VARIANT_CANCELABLE_INCLUDE = $(VARIANT_CANCELABLE_INCLUDE_$(PLATFORM_NAME)) VARIANT_CANCELABLE_INCLUDE_macosx = $(VARIANT_CANCELABLE_INCLUDE_compat) $(VARIANT_CANCELABLE_INCLUDE_gen) $(VARIANT_CANCELABLE_INCLUDE_net) $(VARIANT_CANCELABLE_INCLUDE_sys) VARIANT_CANCELABLE_INCLUDE_iphoneos = $(VARIANT_CANCELABLE_INCLUDE_compat) $(VARIANT_CANCELABLE_INCLUDE_gen) $(VARIANT_CANCELABLE_INCLUDE_net) $(VARIANT_CANCELABLE_INCLUDE_sys) VARIANT_CANCELABLE_INCLUDE_iphonesimulator = $(VARIANT_CANCELABLE_INCLUDE_compat) $(VARIANT_CANCELABLE_INCLUDE_gen) $(VARIANT_CANCELABLE_INCLUDE_net) $(VARIANT_CANCELABLE_INCLUDE_sys) +VARIANT_CANCELABLE_INCLUDE_iphoneosnano = $(VARIANT_CANCELABLE_INCLUDE_iphoneos) +VARIANT_CANCELABLE_INCLUDE_iphonesimulatornano = $(VARIANT_CANCELABLE_INCLUDE_iphonesimulator) VARIANT_CANCELABLE_INCLUDE_compat = creat.c sigcompat.c VARIANT_CANCELABLE_INCLUDE_gen = lockf.c nanosleep.c pause.c pselect.c sleep.c termios.c usleep.c wait.c waitpid.c @@ -85,7 +87,7 @@ VARIANT_DYLD_INCLUDE_generic = $(VARIANT_DYLD_INCLUDE_gen) $(VARIANT_DYLD_INCLUD VARIANT_DYLD_INCLUDE_gen = arc4random.c closedir.c dirfd.c getcwd.c getpagesize.c nanosleep.c opendir.c readdir.c scandir.c sysctl.c sysctlbyname.c telldir.c usleep.c VARIANT_DYLD_INCLUDE_stdlib = atexit.c exit.c gettimeofday.c heapsort.c merge.c qsort.c reallocf.c realpath.c VARIANT_DYLD_INCLUDE_string = bcopy.c libplatform.s strcat.c strchr.c strcpy.c strdup.c strlcat.c strlcpy.c strncmp.c strnlen.c strrchr.c strstr.c -VARIANT_DYLD_INCLUDE_sys = __libc_init.c +VARIANT_DYLD_INCLUDE_sys = _libc_init.c VARIANT_DYLD_INCLUDE_x86_64 = x86_64/string/strcpy.s x86_64/string/strlen.s x86_64/string/strncpy.s x86_64/string/strnlen.s strstr.c VARIANT_DYLD_INCLUDE_i386 = i386/string/strcpy.s i386/string/strlen.s i386/string/strncpy.s strnlen.c strstr.c -- 2.45.2