From 8f001857de911fda494151655298706b3003cd44 Mon Sep 17 00:00:00 2001 From: Joshua Wierenga Date: Wed, 5 Oct 2022 02:15:50 +0000 Subject: [PATCH] Fix build breaks Revert the changes that 827f25f made to libc/calls/readv-metal.c regarding internal functions having underlines due to 6f7d0cb being missing at the time. Use the versions of libc/intrin/lockfileex.c and libc/intrin/unlockfileex.c from 3f49889 to account for strace changes. Revert d86916e and use the versions of libc/calls/getgroups.c, libc/calls/setgroups.c, libc/runtime/getlogin.c and libc/runtime/getlogin_r.c from 4c40c50 to again account for strace changes. Fix include statements and internal underlined function calls in libc/stdio/cocmd.c, libc/testlib/extract.c and test/libc/stdio/system_test.c. Fix missing closing paren in nsync memory size macro in memtrack.internal.h. --- libc/calls/getgroups.c | 2 +- libc/calls/readv-metal.c | 4 ++-- libc/calls/setgroups.c | 2 +- libc/intrin/lockfileex.c | 2 +- libc/intrin/unlockfileex.c | 11 ++++++++--- libc/runtime/getlogin.c | 2 +- libc/runtime/getlogin_r.c | 2 +- libc/runtime/memtrack.internal.h | 2 +- libc/stdio/cocmd.c | 3 +-- libc/testlib/extract.c | 2 +- test/libc/stdio/system_test.c | 4 ++-- 11 files changed, 20 insertions(+), 16 deletions(-) diff --git a/libc/calls/getgroups.c b/libc/calls/getgroups.c index dd6ba8c73..e69f5f642 100644 --- a/libc/calls/getgroups.c +++ b/libc/calls/getgroups.c @@ -17,11 +17,11 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" -#include "libc/calls/strace.internal.h" #include "libc/calls/groups.internal.h" #include "libc/dce.h" #include "libc/intrin/asan.internal.h" #include "libc/intrin/describeflags.internal.h" +#include "libc/intrin/strace.internal.h" #include "libc/sysv/errfuns.h" /** diff --git a/libc/calls/readv-metal.c b/libc/calls/readv-metal.c index 3e283a1f3..d7476f9bb 100644 --- a/libc/calls/readv-metal.c +++ b/libc/calls/readv-metal.c @@ -37,8 +37,8 @@ ssize_t sys_readv_metal(struct Fd *fd, const struct iovec *iov, int iovlen) { * escape sequences, in response to requests sent to it via write(). * Read & return these if they are available. */ - if (weaken(sys_readv_vga)) { - ssize_t res = weaken(sys_readv_vga)(fd, iov, iovlen); + if (_weaken(sys_readv_vga)) { + ssize_t res = _weaken(sys_readv_vga)(fd, iov, iovlen); if (res > 0) return res; } /* fall through */ diff --git a/libc/calls/setgroups.c b/libc/calls/setgroups.c index fce93912d..ace1f08d1 100644 --- a/libc/calls/setgroups.c +++ b/libc/calls/setgroups.c @@ -18,10 +18,10 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" #include "libc/calls/groups.internal.h" -#include "libc/calls/strace.internal.h" #include "libc/dce.h" #include "libc/intrin/asan.internal.h" #include "libc/intrin/describeflags.internal.h" +#include "libc/intrin/strace.internal.h" #include "libc/sysv/errfuns.h" /** diff --git a/libc/intrin/lockfileex.c b/libc/intrin/lockfileex.c index b9d97587c..2a8d1b671 100644 --- a/libc/intrin/lockfileex.c +++ b/libc/intrin/lockfileex.c @@ -16,10 +16,10 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/calls/strace.internal.h" #include "libc/calls/syscall_support-nt.internal.h" #include "libc/intrin/describeflags.internal.h" #include "libc/intrin/describentoverlapped.internal.h" +#include "libc/intrin/strace.internal.h" #include "libc/nt/files.h" __msabi extern typeof(LockFileEx) *const __imp_LockFileEx; diff --git a/libc/intrin/unlockfileex.c b/libc/intrin/unlockfileex.c index 8d2908463..4e5debda2 100644 --- a/libc/intrin/unlockfileex.c +++ b/libc/intrin/unlockfileex.c @@ -16,11 +16,13 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/calls/strace.internal.h" #include "libc/calls/syscall_support-nt.internal.h" +#include "libc/errno.h" +#include "libc/intrin/describeflags.internal.h" #include "libc/intrin/describentoverlapped.internal.h" +#include "libc/intrin/strace.internal.h" #include "libc/nt/files.h" -#include "libc/nt/struct/overlapped.h" +#include "libc/str/str.h" __msabi extern typeof(UnlockFileEx) *const __imp_UnlockFileEx; @@ -35,10 +37,13 @@ bool32 UnlockFileEx(int64_t hFile, uint32_t dwReserved, uint32_t nNumberOfBytesToUnlockHigh, struct NtOverlapped *lpOverlapped) { bool32 ok; + STRACE("UnlockFileEx(%ld, %#x, %'zu, %s) → ...", hFile, dwReserved, + (uint64_t)nNumberOfBytesToUnlockHigh << 32 | nNumberOfBytesToUnlockLow, + DescribeNtOverlapped(lpOverlapped)); ok = __imp_UnlockFileEx(hFile, dwReserved, nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh, lpOverlapped); if (!ok) __winerr(); - STRACE("UnlockFileEx(%ld, %#x, %'zu, %s) → %hhhd% m", hFile, dwReserved, + STRACE("UnlockFileEx(%ld, %#x, %'zu, [%s]) → %hhhd% m", hFile, dwReserved, (uint64_t)nNumberOfBytesToUnlockHigh << 32 | nNumberOfBytesToUnlockLow, DescribeNtOverlapped(lpOverlapped), ok); return ok; diff --git a/libc/runtime/getlogin.c b/libc/runtime/getlogin.c index 40a71341d..b6a1b8038 100644 --- a/libc/runtime/getlogin.c +++ b/libc/runtime/getlogin.c @@ -16,9 +16,9 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/calls/strace.internal.h" #include "libc/calls/syscall_support-nt.internal.h" #include "libc/dce.h" +#include "libc/intrin/strace.internal.h" #include "libc/macros.internal.h" #include "libc/nt/accounting.h" #include "libc/runtime/runtime.h" diff --git a/libc/runtime/getlogin_r.c b/libc/runtime/getlogin_r.c index 38126b8e6..373e87f79 100644 --- a/libc/runtime/getlogin_r.c +++ b/libc/runtime/getlogin_r.c @@ -16,10 +16,10 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/calls/strace.internal.h" #include "libc/calls/syscall_support-nt.internal.h" #include "libc/dce.h" #include "libc/intrin/kprintf.h" +#include "libc/intrin/strace.internal.h" #include "libc/macros.internal.h" #include "libc/nt/accounting.h" #include "libc/runtime/runtime.h" diff --git a/libc/runtime/memtrack.internal.h b/libc/runtime/memtrack.internal.h index 42567ea91..6a5b9a1b2 100644 --- a/libc/runtime/memtrack.internal.h +++ b/libc/runtime/memtrack.internal.h @@ -26,7 +26,7 @@ COSMOPOLITAN_C_START_ (_kMemVista(0x6fdffffc0000, 0x5dffffc0000) - kMemtrackZiposStart) #define kMemtrackNsyncStart _kMemVista(0x6fc000040000, 0x5c000040000) #define kMemtrackNsyncSize \ - (_kMemVista(0x6fcffffc0000, 0x5cffffc0000 - kMemtrackNsyncStart) + (_kMemVista(0x6fcffffc0000, 0x5cffffc0000) - kMemtrackNsyncStart) #define kMemtrackGran (!IsAsan() ? FRAMESIZE : FRAMESIZE * 8) #define _kMemVista(NORMAL, WINVISTA) \ (!IsWindows() || IsAtleastWindows8p1() ? NORMAL : WINVISTA) diff --git a/libc/stdio/cocmd.c b/libc/stdio/cocmd.c index 7b504d3d3..aa0f0cb44 100644 --- a/libc/stdio/cocmd.c +++ b/libc/stdio/cocmd.c @@ -23,7 +23,6 @@ #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" -#include "libc/str/errfun.h" #include "libc/str/str.h" #include "libc/sysv/consts/o.h" @@ -73,7 +72,7 @@ static wontreturn void SysExit(int rc, const char *call, const char *thing) { const char *estr; err = errno; FormatInt32(ibuf, err); - estr = strerdoc(err); + estr = _strerdoc(err); if (!estr) estr = "EUNKNOWN"; Wexit(rc, thing, ": ", call, "() failed: ", estr, " (", ibuf, ")\n", 0); } diff --git a/libc/testlib/extract.c b/libc/testlib/extract.c index 24bca4b32..29943f590 100644 --- a/libc/testlib/extract.c +++ b/libc/testlib/extract.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" -#include "libc/mem/io.h" +#include "libc/calls/copyfd.internal.h" #include "libc/sysv/consts/o.h" #include "libc/testlib/testlib.h" diff --git a/test/libc/stdio/system_test.c b/test/libc/stdio/system_test.c index 015feb032..73cf429af 100644 --- a/test/libc/stdio/system_test.c +++ b/test/libc/stdio/system_test.c @@ -17,9 +17,9 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" -#include "libc/mem/io.h" +#include "libc/calls/copyfd.internal.h" +#include "libc/mem/gc.h" #include "libc/paths.h" -#include "libc/runtime/gc.h" #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" #include "libc/sysv/consts/o.h"