From 6942d7b820e76a8373bb75e171c7c6fb60151dd6 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sun, 13 Aug 2023 07:10:14 -0700 Subject: [PATCH] Fix bug with temporary files on Windows --- bin/fatcosmocc | 2 +- libc/calls/createfileflags.c | 1 - libc/calls/mkstemp.c | 4 +--- libc/stdio/mkostempsm.c | 3 +-- libc/sysv/consts.sh | 2 +- libc/sysv/consts/AF_ALG.S | 2 +- libc/sysv/consts/AF_ASH.S | 2 +- libc/sysv/consts/AF_ATMPVC.S | 2 +- libc/sysv/consts/AF_ATMSVC.S | 2 +- libc/sysv/consts/AF_AX25.S | 2 +- libc/sysv/consts/AF_BLUETOOTH.S | 2 +- libc/sysv/consts/AF_BRIDGE.S | 2 +- libc/sysv/consts/AF_CAIF.S | 2 +- libc/sysv/consts/AF_CAN.S | 2 +- libc/sysv/consts/AF_ECONET.S | 2 +- libc/sysv/consts/AF_FILE.S | 2 +- libc/sysv/consts/AF_IB.S | 2 +- libc/sysv/consts/AF_IEEE802154.S | 2 +- libc/sysv/consts/AF_IRDA.S | 2 +- libc/sysv/consts/AF_ISDN.S | 2 +- libc/sysv/consts/AF_IUCV.S | 2 +- libc/sysv/consts/AF_KCM.S | 2 +- libc/sysv/consts/AF_KEY.S | 2 +- libc/sysv/consts/AF_LINK.S | 2 +- libc/sysv/consts/AF_LLC.S | 2 +- libc/sysv/consts/AF_MPLS.S | 2 +- libc/sysv/consts/AF_NETBEUI.S | 2 +- libc/sysv/consts/AF_NETLINK.S | 2 +- libc/sysv/consts/AF_NETROM.S | 2 +- libc/sysv/consts/AF_NFC.S | 2 +- libc/sysv/consts/AF_PACKET.S | 2 +- libc/sysv/consts/AF_PHONET.S | 2 +- libc/sysv/consts/AF_PPPOX.S | 2 +- libc/sysv/consts/AF_RDS.S | 2 +- libc/sysv/consts/AF_ROSE.S | 2 +- libc/sysv/consts/AF_ROUTE.S | 2 +- libc/sysv/consts/AF_RXRPC.S | 2 +- libc/sysv/consts/AF_SECURITY.S | 2 +- libc/sysv/consts/AF_TIPC.S | 2 +- libc/sysv/consts/AF_VSOCK.S | 2 +- libc/sysv/consts/AF_WANPIPE.S | 2 +- libc/sysv/consts/AF_X25.S | 2 +- libc/sysv/consts/O_TMPFILE.S | 2 +- libc/sysv/consts/sig.h | 19 +++++++++++-------- tool/build/mktemper.c | 6 ++---- 45 files changed, 55 insertions(+), 58 deletions(-) diff --git a/bin/fatcosmocc b/bin/fatcosmocc index b99eb7c3b..266851456 100755 --- a/bin/fatcosmocc +++ b/bin/fatcosmocc @@ -76,7 +76,7 @@ # some notes on this compiler # # - the underlying compiler itself is gcc -# - we use cosmopoiltan libc rather than glibc +# - we use cosmopolitan libc rather than glibc # - we use llvm's compiler-rt and libcxx runtimes # - we patched gcc so switch case can have symbols # - our scanf() implementation is somewhat troubled diff --git a/libc/calls/createfileflags.c b/libc/calls/createfileflags.c index d90d3cc94..1be048fd8 100644 --- a/libc/calls/createfileflags.c +++ b/libc/calls/createfileflags.c @@ -100,7 +100,6 @@ textwindows int GetNtOpenFlags(int flags, int mode, uint32_t *out_perm, if (flags & _O_SEQUENTIAL) attr |= kNtFileFlagSequentialScan; if (flags & _O_RANDOM) attr |= kNtFileFlagRandomAccess; if (flags & _O_DIRECT) attr |= kNtFileFlagNoBuffering; - if (flags & _O_NDELAY) attr |= kNtFileFlagWriteThrough; if (out_perm) *out_perm = perm; if (out_share) *out_share = share; diff --git a/libc/calls/mkstemp.c b/libc/calls/mkstemp.c index c46c4c89b..a24747f3a 100644 --- a/libc/calls/mkstemp.c +++ b/libc/calls/mkstemp.c @@ -66,9 +66,7 @@ int mkstemp(char *template) { w /= 36; } e = errno; - if ((fd = open(template, - O_RDWR | O_CREAT | O_EXCL | (IsWindows() ? 0x00410000 : 0), - 0600)) != -1) { + if ((fd = open(template, O_RDWR | O_CREAT | O_EXCL, 0600)) != -1) { return fd; } else if (errno == EEXIST) { errno = e; diff --git a/libc/stdio/mkostempsm.c b/libc/stdio/mkostempsm.c index 21c615a58..df6c2628b 100644 --- a/libc/stdio/mkostempsm.c +++ b/libc/stdio/mkostempsm.c @@ -40,8 +40,7 @@ int mkostempsmi(char *tpl, int slen, unsigned flags, uint64_t *rando, int mode, if (len < wildlen || slen > len - wildlen) return einval(); char *ss = tpl + len - wildlen - slen; npassert(memcmp(ss, WILDCARD, wildlen) == 0); - flags = (flags & ~(flags & O_ACCMODE)) | O_RDWR | O_CREAT | O_EXCL | - (IsWindows() ? 0x00410000 : 0); + flags = (flags & ~(flags & O_ACCMODE)) | O_RDWR | O_CREAT | O_EXCL; unsigned attempts = ATTEMPTS; do { char *p = ss; diff --git a/libc/sysv/consts.sh b/libc/sysv/consts.sh index 6b7df79cd..bfbff020f 100755 --- a/libc/sysv/consts.sh +++ b/libc/sysv/consts.sh @@ -193,7 +193,7 @@ syscon open O_SEQUENTIAL 0 0 0 0 0 0 0 0x40000000 # kNtFileFl syscon open O_COMPRESSED 0 0 0 0 0 0 0 0x20000000 # kNtFileAttributeCompressed [SYNC libc/calls/open-nt.c] syscon open O_INDEXED 0 0 0 0 0 0 0 0x10000000 # !kNtFileAttributeNotContentIndexed [SYNC libc/calls/open-nt.c] syscon open O_CLOEXEC 0x00080000 0x00080000 0x01000000 0x01000000 0x00100000 0x00010000 0x00400000 0x00080000 # NT faked as Linux [SYNC libc/calls/open-nt.c] -syscon open O_TMPFILE 0x00410000 0x00404000 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff # please use tmpfd(); Linux 3.11+ (c. 2013) __O_TMPFILE | O_DIRECTORY; kNtFileAttributeTemporary|kNtFileFlagDeleteOnClose [SYNC libc/calls/open-nt.c] +syscon open O_TMPFILE 0x00410000 0x00404000 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0x00410000 # please use tmpfd(); Linux 3.11+ (c. 2013) __O_TMPFILE | O_DIRECTORY; kNtFileAttributeTemporary|kNtFileFlagDeleteOnClose [SYNC libc/calls/open-nt.c] syscon open O_SPARSE 0 0 0 0 0 0 0 0 # wut syscon open O_NONBLOCK 0x00000800 0x00000800 0x00000004 0x00000004 0x00000004 0x00000004 0x00000004 0x00000800 # bsd consensus syscon open O_ASYNC 0x00002000 0x00002000 0x00000040 0x00000040 0x00000040 0x00000040 0x00000040 0 # bsd consensus diff --git a/libc/sysv/consts/AF_ALG.S b/libc/sysv/consts/AF_ALG.S index 3b81da931..ee11ea00f 100644 --- a/libc/sysv/consts/AF_ALG.S +++ b/libc/sysv/consts/AF_ALG.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_ALG,38,38,0,0,0,0,0,0 +.syscon af,AF_ALG,38,38,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_ASH.S b/libc/sysv/consts/AF_ASH.S index a8308cbb5..6d07f356c 100644 --- a/libc/sysv/consts/AF_ASH.S +++ b/libc/sysv/consts/AF_ASH.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_ASH,18,18,0,0,0,0,0,0 +.syscon af,AF_ASH,18,18,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_ATMPVC.S b/libc/sysv/consts/AF_ATMPVC.S index 05e185f29..56e104dda 100644 --- a/libc/sysv/consts/AF_ATMPVC.S +++ b/libc/sysv/consts/AF_ATMPVC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_ATMPVC,8,8,0,0,0,0,0,0 +.syscon af,AF_ATMPVC,8,8,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_ATMSVC.S b/libc/sysv/consts/AF_ATMSVC.S index aabc618e7..47d79577a 100644 --- a/libc/sysv/consts/AF_ATMSVC.S +++ b/libc/sysv/consts/AF_ATMSVC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_ATMSVC,20,20,0,0,0,0,0,0 +.syscon af,AF_ATMSVC,20,20,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_AX25.S b/libc/sysv/consts/AF_AX25.S index eb39d4d98..88c580050 100644 --- a/libc/sysv/consts/AF_AX25.S +++ b/libc/sysv/consts/AF_AX25.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_AX25,3,3,0,0,0,0,0,0 +.syscon af,AF_AX25,3,3,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_BLUETOOTH.S b/libc/sysv/consts/AF_BLUETOOTH.S index 9b12af259..3122062cb 100644 --- a/libc/sysv/consts/AF_BLUETOOTH.S +++ b/libc/sysv/consts/AF_BLUETOOTH.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_BLUETOOTH,31,31,0,0,36,0x20,31,0 +.syscon af,AF_BLUETOOTH,31,31,-1,-1,36,0x20,31,-1 diff --git a/libc/sysv/consts/AF_BRIDGE.S b/libc/sysv/consts/AF_BRIDGE.S index eab867117..d4bd30c96 100644 --- a/libc/sysv/consts/AF_BRIDGE.S +++ b/libc/sysv/consts/AF_BRIDGE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_BRIDGE,7,7,0,0,0,0,0,0 +.syscon af,AF_BRIDGE,7,7,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_CAIF.S b/libc/sysv/consts/AF_CAIF.S index a1ebd74a9..5585ccf78 100644 --- a/libc/sysv/consts/AF_CAIF.S +++ b/libc/sysv/consts/AF_CAIF.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_CAIF,37,37,0,0,0,0,0,0 +.syscon af,AF_CAIF,37,37,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_CAN.S b/libc/sysv/consts/AF_CAN.S index 4366e83f6..ecc8d476e 100644 --- a/libc/sysv/consts/AF_CAN.S +++ b/libc/sysv/consts/AF_CAN.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_CAN,29,29,0,0,0,0,35,0 +.syscon af,AF_CAN,29,29,-1,-1,-1,-1,35,-1 diff --git a/libc/sysv/consts/AF_ECONET.S b/libc/sysv/consts/AF_ECONET.S index 60cd807a2..2a25d4bd7 100644 --- a/libc/sysv/consts/AF_ECONET.S +++ b/libc/sysv/consts/AF_ECONET.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_ECONET,19,19,0,0,0,0,0,0 +.syscon af,AF_ECONET,19,19,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_FILE.S b/libc/sysv/consts/AF_FILE.S index fe5c1975e..5d759f237 100644 --- a/libc/sysv/consts/AF_FILE.S +++ b/libc/sysv/consts/AF_FILE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_FILE,1,1,0,0,0,0,0,0 +.syscon af,AF_FILE,1,1,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_IB.S b/libc/sysv/consts/AF_IB.S index 9b9403d66..a940bbf36 100644 --- a/libc/sysv/consts/AF_IB.S +++ b/libc/sysv/consts/AF_IB.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_IB,27,27,0,0,0,0,0,0 +.syscon af,AF_IB,27,27,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_IEEE802154.S b/libc/sysv/consts/AF_IEEE802154.S index 909e1125e..369f413c1 100644 --- a/libc/sysv/consts/AF_IEEE802154.S +++ b/libc/sysv/consts/AF_IEEE802154.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_IEEE802154,36,36,0,0,0,0,0,0 +.syscon af,AF_IEEE802154,36,36,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_IRDA.S b/libc/sysv/consts/AF_IRDA.S index b99d878b7..3deb7d471 100644 --- a/libc/sysv/consts/AF_IRDA.S +++ b/libc/sysv/consts/AF_IRDA.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_IRDA,23,23,0,0,0,0,0,0 +.syscon af,AF_IRDA,23,23,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_ISDN.S b/libc/sysv/consts/AF_ISDN.S index 6ff699b1b..5961716cc 100644 --- a/libc/sysv/consts/AF_ISDN.S +++ b/libc/sysv/consts/AF_ISDN.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_ISDN,34,34,28,28,26,26,26,0 +.syscon af,AF_ISDN,34,34,28,28,26,26,26,-1 diff --git a/libc/sysv/consts/AF_IUCV.S b/libc/sysv/consts/AF_IUCV.S index 213b64759..3422614a4 100644 --- a/libc/sysv/consts/AF_IUCV.S +++ b/libc/sysv/consts/AF_IUCV.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_IUCV,0x20,0x20,0,0,0,0,0,0 +.syscon af,AF_IUCV,0x20,0x20,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_KCM.S b/libc/sysv/consts/AF_KCM.S index 1b591ac0f..971b68e47 100644 --- a/libc/sysv/consts/AF_KCM.S +++ b/libc/sysv/consts/AF_KCM.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_KCM,41,41,0,0,0,0,0,0 +.syscon af,AF_KCM,41,41,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_KEY.S b/libc/sysv/consts/AF_KEY.S index 2481a599b..59a965b98 100644 --- a/libc/sysv/consts/AF_KEY.S +++ b/libc/sysv/consts/AF_KEY.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_KEY,15,15,0,0,0,30,0,0 +.syscon af,AF_KEY,15,15,-1,-1,-1,30,-1,-1 diff --git a/libc/sysv/consts/AF_LINK.S b/libc/sysv/consts/AF_LINK.S index c51b92b84..9fdef97c8 100644 --- a/libc/sysv/consts/AF_LINK.S +++ b/libc/sysv/consts/AF_LINK.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_LINK,0,0,18,18,18,18,18,0 +.syscon af,AF_LINK,-1,-1,18,18,18,18,18,-1 diff --git a/libc/sysv/consts/AF_LLC.S b/libc/sysv/consts/AF_LLC.S index 98adca0a2..1c36776a5 100644 --- a/libc/sysv/consts/AF_LLC.S +++ b/libc/sysv/consts/AF_LLC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_LLC,26,26,0,0,0,0,0,0 +.syscon af,AF_LLC,26,26,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_MPLS.S b/libc/sysv/consts/AF_MPLS.S index bc1ceb438..42ab61751 100644 --- a/libc/sysv/consts/AF_MPLS.S +++ b/libc/sysv/consts/AF_MPLS.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_MPLS,28,28,0,0,0,33,33,0 +.syscon af,AF_MPLS,28,28,-1,-1,-1,33,33,-1 diff --git a/libc/sysv/consts/AF_NETBEUI.S b/libc/sysv/consts/AF_NETBEUI.S index b2a04d879..2dd5a3434 100644 --- a/libc/sysv/consts/AF_NETBEUI.S +++ b/libc/sysv/consts/AF_NETBEUI.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_NETBEUI,13,13,0,0,0,0,0,0 +.syscon af,AF_NETBEUI,13,13,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_NETLINK.S b/libc/sysv/consts/AF_NETLINK.S index a8ba2e031..1c8de2c78 100644 --- a/libc/sysv/consts/AF_NETLINK.S +++ b/libc/sysv/consts/AF_NETLINK.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_NETLINK,16,16,0,0,0,0,0,0 +.syscon af,AF_NETLINK,16,16,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_NETROM.S b/libc/sysv/consts/AF_NETROM.S index c196a5512..91012486d 100644 --- a/libc/sysv/consts/AF_NETROM.S +++ b/libc/sysv/consts/AF_NETROM.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_NETROM,6,6,0,0,0,0,0,0 +.syscon af,AF_NETROM,6,6,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_NFC.S b/libc/sysv/consts/AF_NFC.S index f8031c66d..7b7db454f 100644 --- a/libc/sysv/consts/AF_NFC.S +++ b/libc/sysv/consts/AF_NFC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_NFC,39,39,0,0,0,0,0,0 +.syscon af,AF_NFC,39,39,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_PACKET.S b/libc/sysv/consts/AF_PACKET.S index 813abd140..0cb17ff8a 100644 --- a/libc/sysv/consts/AF_PACKET.S +++ b/libc/sysv/consts/AF_PACKET.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_PACKET,17,17,0,0,0,0,0,0 +.syscon af,AF_PACKET,17,17,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_PHONET.S b/libc/sysv/consts/AF_PHONET.S index d878615d5..d353d25ac 100644 --- a/libc/sysv/consts/AF_PHONET.S +++ b/libc/sysv/consts/AF_PHONET.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_PHONET,35,35,0,0,0,0,0,0 +.syscon af,AF_PHONET,35,35,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_PPPOX.S b/libc/sysv/consts/AF_PPPOX.S index 5e95b7ce3..533d95202 100644 --- a/libc/sysv/consts/AF_PPPOX.S +++ b/libc/sysv/consts/AF_PPPOX.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_PPPOX,24,24,0,0,0,0,0,0 +.syscon af,AF_PPPOX,24,24,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_RDS.S b/libc/sysv/consts/AF_RDS.S index acd2af658..694bdee8d 100644 --- a/libc/sysv/consts/AF_RDS.S +++ b/libc/sysv/consts/AF_RDS.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_RDS,21,21,0,0,0,0,0,0 +.syscon af,AF_RDS,21,21,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_ROSE.S b/libc/sysv/consts/AF_ROSE.S index 4df8a3567..180f4a252 100644 --- a/libc/sysv/consts/AF_ROSE.S +++ b/libc/sysv/consts/AF_ROSE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_ROSE,11,11,0,0,0,0,0,0 +.syscon af,AF_ROSE,11,11,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_ROUTE.S b/libc/sysv/consts/AF_ROUTE.S index 4e1a0aea3..2ba377126 100644 --- a/libc/sysv/consts/AF_ROUTE.S +++ b/libc/sysv/consts/AF_ROUTE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_ROUTE,16,16,17,17,17,17,34,0 +.syscon af,AF_ROUTE,16,16,17,17,17,17,34,-1 diff --git a/libc/sysv/consts/AF_RXRPC.S b/libc/sysv/consts/AF_RXRPC.S index 61456e39b..096724101 100644 --- a/libc/sysv/consts/AF_RXRPC.S +++ b/libc/sysv/consts/AF_RXRPC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_RXRPC,33,33,0,0,0,0,0,0 +.syscon af,AF_RXRPC,33,33,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_SECURITY.S b/libc/sysv/consts/AF_SECURITY.S index a692fec55..960dc869e 100644 --- a/libc/sysv/consts/AF_SECURITY.S +++ b/libc/sysv/consts/AF_SECURITY.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_SECURITY,14,14,0,0,0,0,0,0 +.syscon af,AF_SECURITY,14,14,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_TIPC.S b/libc/sysv/consts/AF_TIPC.S index 86e2b4349..a37239817 100644 --- a/libc/sysv/consts/AF_TIPC.S +++ b/libc/sysv/consts/AF_TIPC.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_TIPC,30,30,0,0,0,0,0,0 +.syscon af,AF_TIPC,30,30,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_VSOCK.S b/libc/sysv/consts/AF_VSOCK.S index c3156fa23..dcb421fa2 100644 --- a/libc/sysv/consts/AF_VSOCK.S +++ b/libc/sysv/consts/AF_VSOCK.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_VSOCK,40,40,0,0,0,0,0,0 +.syscon af,AF_VSOCK,40,40,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_WANPIPE.S b/libc/sysv/consts/AF_WANPIPE.S index e8e940c75..f750f1751 100644 --- a/libc/sysv/consts/AF_WANPIPE.S +++ b/libc/sysv/consts/AF_WANPIPE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_WANPIPE,25,25,0,0,0,0,0,0 +.syscon af,AF_WANPIPE,25,25,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/AF_X25.S b/libc/sysv/consts/AF_X25.S index 51c7258b4..8ae27193f 100644 --- a/libc/sysv/consts/AF_X25.S +++ b/libc/sysv/consts/AF_X25.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon af,AF_X25,9,9,0,0,0,0,0,0 +.syscon af,AF_X25,9,9,-1,-1,-1,-1,-1,-1 diff --git a/libc/sysv/consts/O_TMPFILE.S b/libc/sysv/consts/O_TMPFILE.S index 84899b72c..95671cf79 100644 --- a/libc/sysv/consts/O_TMPFILE.S +++ b/libc/sysv/consts/O_TMPFILE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon open,O_TMPFILE,0x00410000,0x00404000,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff +.syscon open,O_TMPFILE,0x00410000,0x00404000,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0x00410000 diff --git a/libc/sysv/consts/sig.h b/libc/sysv/consts/sig.h index 4ee3146b5..ecd768248 100644 --- a/libc/sysv/consts/sig.h +++ b/libc/sysv/consts/sig.h @@ -71,22 +71,27 @@ COSMOPOLITAN_C_END_ #define SIGXCPU 24 #define SIGXFSZ 25 +/* + * - No macro is define for SIGIO and SIGPOLL in order to persuade + * ./configure scripts to favor using poll() or select() instead of + * interrupt-based i/o. + * + * - No macros are defined for SIGRTMIN and SIGRTMAX because the project + * hasn't fleshed them out yet. + * + * - SIGTHR doesn't have a macro since it's internal to posix threads. + */ + #define SIGBUS SIGBUS -#define SIGTHR SIGTHR #define SIGCHLD SIGCHLD #define SIGCONT SIGCONT #define SIGEMT SIGEMT #define SIGINFO SIGINFO -#define SIGIO SIGIO -#define SIGPOLL SIGPOLL #define SIGPWR SIGPWR -#define SIGRTMAX SIGRTMAX -#define SIGRTMIN SIGRTMIN #define SIGSTKFLT SIGSTKFLT #define SIGSTOP SIGSTOP #define SIGSYS SIGSYS #define SIGTSTP SIGTSTP -#define SIGUNUSED SIGUNUSED #define SIGURG SIGURG #define SIGUSR1 SIGUSR1 #define SIGUSR2 SIGUSR2 @@ -95,6 +100,4 @@ COSMOPOLITAN_C_END_ #define SIG_SETMASK SIG_SETMASK #define SIG_UNBLOCK SIG_UNBLOCK - - #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SIG_H_ */ diff --git a/tool/build/mktemper.c b/tool/build/mktemper.c index 866fcb75c..e3c088f35 100644 --- a/tool/build/mktemper.c +++ b/tool/build/mktemper.c @@ -18,11 +18,11 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" #include "libc/dce.h" +#include "libc/errno.h" #include "libc/runtime/runtime.h" #include "libc/stdio/rand.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/errno.h" #include "libc/sysv/consts/o.h" /** @@ -57,9 +57,7 @@ int main(int argc, char *argv[]) { w /= 36; } int fd; - if ((fd = open(template, - O_RDWR | O_CREAT | O_EXCL | (IsWindows() ? 0x00410000 : 0), - 0600)) == -1) { + if ((fd = open(template, O_RDWR | O_CREAT | O_EXCL, 0600)) == -1) { DieSys(template); } close(fd);