summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorlntue <lntue@google.com>2025-06-11 16:25:27 -0400
committerGitHub <noreply@github.com>2025-06-11 16:25:27 -0400
commitd87eea35fac5a34a841c637db8908128409a184e (patch)
tree1e2e4906008e51b5b518d0592cb1bc7924e7c832 /libc
parentfb761aa38b0bc01ab911f5dbbfb474b70aaafbb4 (diff)
[libc] Move libc_errno.h to libc/src/__support and make LIBC_ERRNO_MODE_SYSTEM to be header-only. (#143187)
This is the first step in preparation for: https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
Diffstat (limited to 'libc')
-rw-r--r--libc/cmake/modules/LLVMLibCCompileOptionRules.cmake4
-rw-r--r--libc/config/config.json2
-rw-r--r--libc/docs/dev/code_style.rst4
-rw-r--r--libc/shared/fp_bits.h1
-rw-r--r--libc/shared/libc_common.h26
-rw-r--r--libc/shared/rpc_server.h1
-rw-r--r--libc/shared/str_to_float.h1
-rw-r--r--libc/shared/str_to_integer.h1
-rw-r--r--libc/src/__support/CMakeLists.txt9
-rw-r--r--libc/src/__support/FPUtil/FEnvImpl.h2
-rw-r--r--libc/src/__support/File/dir.cpp2
-rw-r--r--libc/src/__support/File/file.cpp2
-rw-r--r--libc/src/__support/File/linux/file.cpp2
-rw-r--r--libc/src/__support/File/linux/lseekImpl.h2
-rw-r--r--libc/src/__support/HashTable/randomness.h2
-rw-r--r--libc/src/__support/OSUtil/linux/fcntl.cpp2
-rw-r--r--libc/src/__support/OSUtil/linux/vdso.cpp2
-rw-r--r--libc/src/__support/StringUtil/tables/linux_extension_errors.h2
-rw-r--r--libc/src/__support/libc_errno.h108
-rw-r--r--libc/src/__support/threads/linux/thread.cpp2
-rw-r--r--libc/src/dirent/closedir.cpp2
-rw-r--r--libc/src/dirent/opendir.cpp2
-rw-r--r--libc/src/dirent/readdir.cpp2
-rw-r--r--libc/src/errno/CMakeLists.txt20
-rw-r--r--libc/src/errno/libc_errno.cpp47
-rw-r--r--libc/src/errno/libc_errno.h47
-rw-r--r--libc/src/fcntl/linux/creat.cpp2
-rw-r--r--libc/src/fcntl/linux/open.cpp2
-rw-r--r--libc/src/fcntl/linux/openat.cpp2
-rw-r--r--libc/src/inttypes/strtoimax.cpp2
-rw-r--r--libc/src/inttypes/strtoumax.cpp2
-rw-r--r--libc/src/math/generic/exp10m1f.cpp2
-rw-r--r--libc/src/math/generic/exp2m1f.cpp2
-rw-r--r--libc/src/math/generic/nan.cpp2
-rw-r--r--libc/src/math/generic/nanf.cpp2
-rw-r--r--libc/src/math/generic/nanf128.cpp2
-rw-r--r--libc/src/math/generic/nanf16.cpp2
-rw-r--r--libc/src/math/generic/nanl.cpp2
-rw-r--r--libc/src/poll/linux/poll.cpp2
-rw-r--r--libc/src/pthread/pthread_atfork.cpp2
-rw-r--r--libc/src/pthread/pthread_attr_setdetachstate.cpp2
-rw-r--r--libc/src/pthread/pthread_attr_setguardsize.cpp2
-rw-r--r--libc/src/pthread/pthread_attr_setstack.cpp2
-rw-r--r--libc/src/pthread/pthread_attr_setstacksize.cpp2
-rw-r--r--libc/src/pthread/pthread_condattr_setclock.cpp2
-rw-r--r--libc/src/pthread/pthread_condattr_setpshared.cpp2
-rw-r--r--libc/src/pthread/pthread_create.cpp2
-rw-r--r--libc/src/pthread/pthread_key_create.cpp2
-rw-r--r--libc/src/pthread/pthread_key_delete.cpp2
-rw-r--r--libc/src/pthread/pthread_mutexattr_setpshared.cpp2
-rw-r--r--libc/src/pthread/pthread_mutexattr_setrobust.cpp2
-rw-r--r--libc/src/pthread/pthread_mutexattr_settype.cpp2
-rw-r--r--libc/src/pthread/pthread_rwlock_timedrdlock.cpp2
-rw-r--r--libc/src/pthread/pthread_rwlock_trywrlock.cpp2
-rw-r--r--libc/src/pthread/pthread_rwlock_unlock.cpp2
-rw-r--r--libc/src/pthread/pthread_rwlockattr_setkind_np.cpp2
-rw-r--r--libc/src/pthread/pthread_rwlockattr_setpshared.cpp2
-rw-r--r--libc/src/pthread/pthread_setspecific.cpp2
-rw-r--r--libc/src/sched/linux/sched_get_priority_max.cpp2
-rw-r--r--libc/src/sched/linux/sched_get_priority_min.cpp2
-rw-r--r--libc/src/sched/linux/sched_getaffinity.cpp2
-rw-r--r--libc/src/sched/linux/sched_getparam.cpp2
-rw-r--r--libc/src/sched/linux/sched_getscheduler.cpp2
-rw-r--r--libc/src/sched/linux/sched_rr_get_interval.cpp2
-rw-r--r--libc/src/sched/linux/sched_setaffinity.cpp2
-rw-r--r--libc/src/sched/linux/sched_setparam.cpp2
-rw-r--r--libc/src/sched/linux/sched_setscheduler.cpp2
-rw-r--r--libc/src/sched/linux/sched_yield.cpp2
-rw-r--r--libc/src/search/hcreate.cpp2
-rw-r--r--libc/src/search/hcreate_r.cpp2
-rw-r--r--libc/src/search/hdestroy_r.cpp2
-rw-r--r--libc/src/search/hsearch.cpp2
-rw-r--r--libc/src/search/hsearch_r.cpp2
-rw-r--r--libc/src/signal/linux/kill.cpp2
-rw-r--r--libc/src/signal/linux/sigaction.cpp2
-rw-r--r--libc/src/signal/linux/sigaddset.cpp2
-rw-r--r--libc/src/signal/linux/sigaltstack.cpp2
-rw-r--r--libc/src/signal/linux/sigdelset.cpp2
-rw-r--r--libc/src/signal/linux/sigemptyset.cpp2
-rw-r--r--libc/src/signal/linux/sigfillset.cpp2
-rw-r--r--libc/src/signal/linux/sigprocmask.cpp2
-rw-r--r--libc/src/spawn/posix_spawn_file_actions_addclose.cpp2
-rw-r--r--libc/src/spawn/posix_spawn_file_actions_adddup2.cpp2
-rw-r--r--libc/src/spawn/posix_spawn_file_actions_addopen.cpp2
-rw-r--r--libc/src/spawn/posix_spawn_file_actions_destroy.cpp2
-rw-r--r--libc/src/stdio/fopencookie.cpp2
-rw-r--r--libc/src/stdio/generic/fclose.cpp2
-rw-r--r--libc/src/stdio/generic/fflush.cpp2
-rw-r--r--libc/src/stdio/generic/fgetc.cpp2
-rw-r--r--libc/src/stdio/generic/fgetc_unlocked.cpp2
-rw-r--r--libc/src/stdio/generic/fgets.cpp2
-rw-r--r--libc/src/stdio/generic/fopen.cpp2
-rw-r--r--libc/src/stdio/generic/fputc.cpp2
-rw-r--r--libc/src/stdio/generic/fputs.cpp2
-rw-r--r--libc/src/stdio/generic/fread.cpp2
-rw-r--r--libc/src/stdio/generic/fread_unlocked.cpp2
-rw-r--r--libc/src/stdio/generic/fseek.cpp2
-rw-r--r--libc/src/stdio/generic/fseeko.cpp2
-rw-r--r--libc/src/stdio/generic/ftell.cpp2
-rw-r--r--libc/src/stdio/generic/ftello.cpp2
-rw-r--r--libc/src/stdio/generic/fwrite.cpp2
-rw-r--r--libc/src/stdio/generic/fwrite_unlocked.cpp2
-rw-r--r--libc/src/stdio/generic/getc.cpp2
-rw-r--r--libc/src/stdio/generic/getc_unlocked.cpp2
-rw-r--r--libc/src/stdio/generic/getchar.cpp2
-rw-r--r--libc/src/stdio/generic/getchar_unlocked.cpp2
-rw-r--r--libc/src/stdio/generic/putc.cpp2
-rw-r--r--libc/src/stdio/generic/putchar.cpp2
-rw-r--r--libc/src/stdio/generic/puts.cpp2
-rw-r--r--libc/src/stdio/gpu/fprintf.cpp2
-rw-r--r--libc/src/stdio/gpu/printf.cpp2
-rw-r--r--libc/src/stdio/linux/fdopen.cpp2
-rw-r--r--libc/src/stdio/linux/remove.cpp2
-rw-r--r--libc/src/stdio/linux/rename.cpp2
-rw-r--r--libc/src/stdio/printf_core/parser.h2
-rw-r--r--libc/src/stdio/setbuf.cpp2
-rw-r--r--libc/src/stdio/setvbuf.cpp2
-rw-r--r--libc/src/stdlib/atof.cpp2
-rw-r--r--libc/src/stdlib/atoi.cpp2
-rw-r--r--libc/src/stdlib/atol.cpp2
-rw-r--r--libc/src/stdlib/atoll.cpp2
-rw-r--r--libc/src/stdlib/strtod.cpp2
-rw-r--r--libc/src/stdlib/strtod_l.cpp2
-rw-r--r--libc/src/stdlib/strtof.cpp2
-rw-r--r--libc/src/stdlib/strtof_l.cpp2
-rw-r--r--libc/src/stdlib/strtol.cpp2
-rw-r--r--libc/src/stdlib/strtol_l.cpp2
-rw-r--r--libc/src/stdlib/strtold.cpp2
-rw-r--r--libc/src/stdlib/strtold_l.cpp2
-rw-r--r--libc/src/stdlib/strtoll.cpp2
-rw-r--r--libc/src/stdlib/strtoll_l.cpp2
-rw-r--r--libc/src/stdlib/strtoul.cpp2
-rw-r--r--libc/src/stdlib/strtoul_l.cpp2
-rw-r--r--libc/src/stdlib/strtoull.cpp2
-rw-r--r--libc/src/stdlib/strtoull_l.cpp2
-rw-r--r--libc/src/string/strdup.cpp2
-rw-r--r--libc/src/sys/auxv/linux/getauxval.cpp2
-rw-r--r--libc/src/sys/epoll/linux/epoll_create.cpp2
-rw-r--r--libc/src/sys/epoll/linux/epoll_create1.cpp2
-rw-r--r--libc/src/sys/epoll/linux/epoll_ctl.cpp2
-rw-r--r--libc/src/sys/epoll/linux/epoll_pwait.cpp2
-rw-r--r--libc/src/sys/epoll/linux/epoll_pwait2.cpp2
-rw-r--r--libc/src/sys/epoll/linux/epoll_wait.cpp2
-rw-r--r--libc/src/sys/mman/linux/madvise.cpp2
-rw-r--r--libc/src/sys/mman/linux/mincore.cpp2
-rw-r--r--libc/src/sys/mman/linux/mlock.cpp2
-rw-r--r--libc/src/sys/mman/linux/mlock2.cpp2
-rw-r--r--libc/src/sys/mman/linux/mlockall.cpp2
-rw-r--r--libc/src/sys/mman/linux/mmap.cpp2
-rw-r--r--libc/src/sys/mman/linux/mprotect.cpp2
-rw-r--r--libc/src/sys/mman/linux/mremap.cpp2
-rw-r--r--libc/src/sys/mman/linux/msync.cpp2
-rw-r--r--libc/src/sys/mman/linux/munlock.cpp2
-rw-r--r--libc/src/sys/mman/linux/munlockall.cpp2
-rw-r--r--libc/src/sys/mman/linux/munmap.cpp4
-rw-r--r--libc/src/sys/mman/linux/remap_file_pages.cpp2
-rw-r--r--libc/src/sys/mman/linux/shm_common.h2
-rw-r--r--libc/src/sys/prctl/linux/prctl.cpp2
-rw-r--r--libc/src/sys/random/linux/getrandom.cpp2
-rw-r--r--libc/src/sys/resource/linux/getrlimit.cpp2
-rw-r--r--libc/src/sys/resource/linux/setrlimit.cpp2
-rw-r--r--libc/src/sys/select/linux/select.cpp2
-rw-r--r--libc/src/sys/sendfile/linux/sendfile.cpp2
-rw-r--r--libc/src/sys/socket/linux/bind.cpp2
-rw-r--r--libc/src/sys/socket/linux/recv.cpp2
-rw-r--r--libc/src/sys/socket/linux/recvfrom.cpp2
-rw-r--r--libc/src/sys/socket/linux/recvmsg.cpp2
-rw-r--r--libc/src/sys/socket/linux/send.cpp2
-rw-r--r--libc/src/sys/socket/linux/sendmsg.cpp2
-rw-r--r--libc/src/sys/socket/linux/sendto.cpp2
-rw-r--r--libc/src/sys/socket/linux/socket.cpp2
-rw-r--r--libc/src/sys/socket/linux/socketpair.cpp2
-rw-r--r--libc/src/sys/stat/linux/chmod.cpp2
-rw-r--r--libc/src/sys/stat/linux/fchmod.cpp2
-rw-r--r--libc/src/sys/stat/linux/fchmodat.cpp2
-rw-r--r--libc/src/sys/stat/linux/fstat.cpp2
-rw-r--r--libc/src/sys/stat/linux/lstat.cpp2
-rw-r--r--libc/src/sys/stat/linux/mkdir.cpp2
-rw-r--r--libc/src/sys/stat/linux/mkdirat.cpp2
-rw-r--r--libc/src/sys/stat/linux/stat.cpp2
-rw-r--r--libc/src/sys/statvfs/linux/statfs_utils.h2
-rw-r--r--libc/src/sys/time/linux/getitimer.cpp2
-rw-r--r--libc/src/sys/time/linux/setitimer.cpp2
-rw-r--r--libc/src/sys/time/linux/utimes.cpp2
-rw-r--r--libc/src/sys/uio/linux/readv.cpp2
-rw-r--r--libc/src/sys/uio/linux/writev.cpp2
-rw-r--r--libc/src/sys/utsname/linux/uname.cpp2
-rw-r--r--libc/src/sys/wait/wait4Impl.h2
-rw-r--r--libc/src/termios/linux/cfsetispeed.cpp2
-rw-r--r--libc/src/termios/linux/cfsetospeed.cpp2
-rw-r--r--libc/src/termios/linux/tcdrain.cpp2
-rw-r--r--libc/src/termios/linux/tcflow.cpp2
-rw-r--r--libc/src/termios/linux/tcflush.cpp2
-rw-r--r--libc/src/termios/linux/tcgetattr.cpp2
-rw-r--r--libc/src/termios/linux/tcgetsid.cpp2
-rw-r--r--libc/src/termios/linux/tcsendbreak.cpp2
-rw-r--r--libc/src/termios/linux/tcsetattr.cpp2
-rw-r--r--libc/src/threads/thrd_create.cpp2
-rw-r--r--libc/src/time/linux/clock.cpp2
-rw-r--r--libc/src/time/linux/clock_gettime.cpp2
-rw-r--r--libc/src/time/linux/gettimeofday.cpp2
-rw-r--r--libc/src/time/linux/nanosleep.cpp2
-rw-r--r--libc/src/time/linux/timespec_get.cpp2
-rw-r--r--libc/src/time/time.cpp2
-rw-r--r--libc/src/time/time_utils.h2
-rw-r--r--libc/src/time/windows/clock_getres.cpp2
-rw-r--r--libc/src/unistd/linux/access.cpp2
-rw-r--r--libc/src/unistd/linux/chdir.cpp2
-rw-r--r--libc/src/unistd/linux/close.cpp2
-rw-r--r--libc/src/unistd/linux/dup.cpp2
-rw-r--r--libc/src/unistd/linux/dup2.cpp2
-rw-r--r--libc/src/unistd/linux/dup3.cpp2
-rw-r--r--libc/src/unistd/linux/execv.cpp2
-rw-r--r--libc/src/unistd/linux/execve.cpp2
-rw-r--r--libc/src/unistd/linux/fchdir.cpp2
-rw-r--r--libc/src/unistd/linux/fork.cpp2
-rw-r--r--libc/src/unistd/linux/fsync.cpp2
-rw-r--r--libc/src/unistd/linux/ftruncate.cpp2
-rw-r--r--libc/src/unistd/linux/getcwd.cpp2
-rw-r--r--libc/src/unistd/linux/getentropy.cpp2
-rw-r--r--libc/src/unistd/linux/getsid.cpp2
-rw-r--r--libc/src/unistd/linux/isatty.cpp2
-rw-r--r--libc/src/unistd/linux/link.cpp2
-rw-r--r--libc/src/unistd/linux/linkat.cpp2
-rw-r--r--libc/src/unistd/linux/lseek.cpp2
-rw-r--r--libc/src/unistd/linux/pathconf.cpp2
-rw-r--r--libc/src/unistd/linux/pathconf_utils.cpp2
-rw-r--r--libc/src/unistd/linux/pipe.cpp4
-rw-r--r--libc/src/unistd/linux/pipe2.cpp2
-rw-r--r--libc/src/unistd/linux/pread.cpp6
-rw-r--r--libc/src/unistd/linux/pwrite.cpp2
-rw-r--r--libc/src/unistd/linux/read.cpp4
-rw-r--r--libc/src/unistd/linux/readlink.cpp2
-rw-r--r--libc/src/unistd/linux/readlinkat.cpp2
-rw-r--r--libc/src/unistd/linux/rmdir.cpp2
-rw-r--r--libc/src/unistd/linux/symlink.cpp2
-rw-r--r--libc/src/unistd/linux/symlinkat.cpp2
-rw-r--r--libc/src/unistd/linux/syscall.cpp2
-rw-r--r--libc/src/unistd/linux/sysconf.cpp2
-rw-r--r--libc/src/unistd/linux/truncate.cpp2
-rw-r--r--libc/src/unistd/linux/unlink.cpp2
-rw-r--r--libc/src/unistd/linux/unlinkat.cpp2
-rw-r--r--libc/src/unistd/linux/write.cpp2
-rw-r--r--libc/src/unistd/windows/getentropy.cpp2
-rw-r--r--libc/test/IntegrationTest/test.h9
-rw-r--r--libc/test/UnitTest/ErrnoCheckingTest.h4
-rw-r--r--libc/test/UnitTest/ErrnoSetterMatcher.h6
-rw-r--r--libc/test/UnitTest/FPMatcher.h8
-rw-r--r--libc/test/UnitTest/Test.h11
-rw-r--r--libc/test/integration/src/pthread/pthread_create_test.cpp4
-rw-r--r--libc/test/integration/src/pthread/pthread_join_test.cpp4
-rw-r--r--libc/test/integration/src/pthread/pthread_name_test.cpp2
-rw-r--r--libc/test/integration/src/unistd/getcwd_test.cpp6
-rw-r--r--libc/test/integration/startup/linux/tls_test.cpp2
-rw-r--r--libc/test/src/__support/str_to_fp_test.h1
-rw-r--r--libc/test/src/__support/str_to_integer_test.cpp1
-rw-r--r--libc/test/src/dirent/dirent_test.cpp10
-rw-r--r--libc/test/src/errno/errno_test.cpp4
-rw-r--r--libc/test/src/fcntl/creat_test.cpp2
-rw-r--r--libc/test/src/fcntl/fcntl_test.cpp4
-rw-r--r--libc/test/src/fcntl/openat_test.cpp2
-rw-r--r--libc/test/src/math/RoundToIntegerTest.h2
-rw-r--r--libc/test/src/math/acosf_test.cpp4
-rw-r--r--libc/test/src/math/acoshf16_test.cpp2
-rw-r--r--libc/test/src/math/acoshf_test.cpp4
-rw-r--r--libc/test/src/math/asin_test.cpp2
-rw-r--r--libc/test/src/math/asinf_test.cpp4
-rw-r--r--libc/test/src/math/asinhf_test.cpp4
-rw-r--r--libc/test/src/math/atan2f_test.cpp2
-rw-r--r--libc/test/src/math/atan_test.cpp2
-rw-r--r--libc/test/src/math/atanf_test.cpp4
-rw-r--r--libc/test/src/math/atanhf_test.cpp4
-rw-r--r--libc/test/src/math/cosf_test.cpp4
-rw-r--r--libc/test/src/math/coshf_test.cpp6
-rw-r--r--libc/test/src/math/cospif_test.cpp4
-rw-r--r--libc/test/src/math/exp10_test.cpp4
-rw-r--r--libc/test/src/math/exp10f_test.cpp15
-rw-r--r--libc/test/src/math/exp10m1f_test.cpp8
-rw-r--r--libc/test/src/math/exp2_test.cpp4
-rw-r--r--libc/test/src/math/exp2f_test.cpp15
-rw-r--r--libc/test/src/math/exp2m1f_test.cpp9
-rw-r--r--libc/test/src/math/exp_test.cpp4
-rw-r--r--libc/test/src/math/expf_test.cpp15
-rw-r--r--libc/test/src/math/expm1_test.cpp4
-rw-r--r--libc/test/src/math/expm1f_test.cpp15
-rw-r--r--libc/test/src/math/log10_test.cpp4
-rw-r--r--libc/test/src/math/log1p_test.cpp4
-rw-r--r--libc/test/src/math/log1pf_test.cpp4
-rw-r--r--libc/test/src/math/log2_test.cpp4
-rw-r--r--libc/test/src/math/log2f_test.cpp7
-rw-r--r--libc/test/src/math/log_test.cpp4
-rw-r--r--libc/test/src/math/powf_test.cpp2
-rw-r--r--libc/test/src/math/sin_test.cpp2
-rw-r--r--libc/test/src/math/sincosf_test.cpp4
-rw-r--r--libc/test/src/math/sinf_test.cpp4
-rw-r--r--libc/test/src/math/sinhf_test.cpp6
-rw-r--r--libc/test/src/math/sinpif_test.cpp4
-rw-r--r--libc/test/src/math/smoke/FModTest.h2
-rw-r--r--libc/test/src/math/smoke/RoundToIntegerTest.h2
-rw-r--r--libc/test/src/math/smoke/acos_test.cpp4
-rw-r--r--libc/test/src/math/smoke/acosf16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/acosf_test.cpp4
-rw-r--r--libc/test/src/math/smoke/acoshf16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/acoshf_test.cpp4
-rw-r--r--libc/test/src/math/smoke/acospif16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/asinf16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/asinf_test.cpp4
-rw-r--r--libc/test/src/math/smoke/asinhf16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/asinhf_test.cpp4
-rw-r--r--libc/test/src/math/smoke/atan2f_test.cpp4
-rw-r--r--libc/test/src/math/smoke/atanf16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/atanf_test.cpp4
-rw-r--r--libc/test/src/math/smoke/atanhf16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/atanhf_test.cpp4
-rw-r--r--libc/test/src/math/smoke/cosf16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/cosf_test.cpp4
-rw-r--r--libc/test/src/math/smoke/coshf16_test.cpp6
-rw-r--r--libc/test/src/math/smoke/coshf_test.cpp6
-rw-r--r--libc/test/src/math/smoke/cospif16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/cospif_test.cpp4
-rw-r--r--libc/test/src/math/smoke/exp10_test.cpp2
-rw-r--r--libc/test/src/math/smoke/exp10f16_test.cpp8
-rw-r--r--libc/test/src/math/smoke/exp10f_test.cpp6
-rw-r--r--libc/test/src/math/smoke/exp10m1f16_test.cpp8
-rw-r--r--libc/test/src/math/smoke/exp10m1f_test.cpp8
-rw-r--r--libc/test/src/math/smoke/exp2_test.cpp2
-rw-r--r--libc/test/src/math/smoke/exp2f16_test.cpp8
-rw-r--r--libc/test/src/math/smoke/exp2f_test.cpp6
-rw-r--r--libc/test/src/math/smoke/exp2m1f16_test.cpp8
-rw-r--r--libc/test/src/math/smoke/exp2m1f_test.cpp8
-rw-r--r--libc/test/src/math/smoke/exp_test.cpp2
-rw-r--r--libc/test/src/math/smoke/expf16_test.cpp8
-rw-r--r--libc/test/src/math/smoke/expf_test.cpp6
-rw-r--r--libc/test/src/math/smoke/expm1_test.cpp2
-rw-r--r--libc/test/src/math/smoke/expm1f16_test.cpp8
-rw-r--r--libc/test/src/math/smoke/expm1f_test.cpp6
-rw-r--r--libc/test/src/math/smoke/log10_test.cpp2
-rw-r--r--libc/test/src/math/smoke/log10f16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/log1p_test.cpp2
-rw-r--r--libc/test/src/math/smoke/log1pf_test.cpp2
-rw-r--r--libc/test/src/math/smoke/log2_test.cpp2
-rw-r--r--libc/test/src/math/smoke/log2f16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/log2f_test.cpp2
-rw-r--r--libc/test/src/math/smoke/log_test.cpp2
-rw-r--r--libc/test/src/math/smoke/logf16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/sincosf_test.cpp4
-rw-r--r--libc/test/src/math/smoke/sinf16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/sinf_test.cpp4
-rw-r--r--libc/test/src/math/smoke/sinhf16_test.cpp6
-rw-r--r--libc/test/src/math/smoke/sinhf_test.cpp6
-rw-r--r--libc/test/src/math/smoke/sinpif16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/sinpif_test.cpp4
-rw-r--r--libc/test/src/math/smoke/tanf16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/tanf_test.cpp4
-rw-r--r--libc/test/src/math/smoke/tanhf16_test.cpp6
-rw-r--r--libc/test/src/math/smoke/tanhf_test.cpp4
-rw-r--r--libc/test/src/math/smoke/tanpif16_test.cpp4
-rw-r--r--libc/test/src/math/tanf_test.cpp4
-rw-r--r--libc/test/src/math/tanhf_test.cpp4
-rw-r--r--libc/test/src/poll/poll_test.cpp6
-rw-r--r--libc/test/src/sched/affinity_test.cpp10
-rw-r--r--libc/test/src/sched/cpu_count_test.cpp4
-rw-r--r--libc/test/src/sched/get_priority_test.cpp4
-rw-r--r--libc/test/src/sched/param_and_scheduler_test.cpp49
-rw-r--r--libc/test/src/sched/sched_rr_get_interval_test.cpp10
-rw-r--r--libc/test/src/sched/yield_test.cpp4
-rw-r--r--libc/test/src/signal/sigaltstack_test.cpp4
-rw-r--r--libc/test/src/signal/signal_test.cpp4
-rw-r--r--libc/test/src/signal/sigprocmask_test.cpp4
-rw-r--r--libc/test/src/spawn/posix_spawn_file_actions_test.cpp2
-rw-r--r--libc/test/src/stdio/fdopen_test.cpp10
-rw-r--r--libc/test/src/stdio/fgetc_test.cpp4
-rw-r--r--libc/test/src/stdio/fgetc_unlocked_test.cpp4
-rw-r--r--libc/test/src/stdio/fgets_test.cpp4
-rw-r--r--libc/test/src/stdio/fileop_test.cpp24
-rw-r--r--libc/test/src/stdio/fopencookie_test.cpp10
-rw-r--r--libc/test/src/stdio/remove_test.cpp6
-rw-r--r--libc/test/src/stdio/rename_test.cpp4
-rw-r--r--libc/test/src/stdio/setvbuf_test.cpp4
-rw-r--r--libc/test/src/stdio/sprintf_test.cpp76
-rw-r--r--libc/test/src/stdio/unlocked_fileop_test.cpp6
-rw-r--r--libc/test/src/stdlib/StrtolTest.h1
-rw-r--r--libc/test/src/stdlib/strtoint32_test.cpp6
-rw-r--r--libc/test/src/stdlib/strtoint64_test.cpp6
-rw-r--r--libc/test/src/stdlib/strtold_test.cpp1
-rw-r--r--libc/test/src/sys/mman/linux/mlock_test.cpp17
-rw-r--r--libc/test/src/sys/statvfs/linux/fstatvfs_test.cpp4
-rw-r--r--libc/test/src/sys/statvfs/linux/statvfs_test.cpp4
-rw-r--r--libc/test/src/sys/time/setitimer_test.cpp2
-rw-r--r--libc/test/src/termios/termios_test.cpp12
-rw-r--r--libc/test/src/time/asctime_r_test.cpp2
-rw-r--r--libc/test/src/time/asctime_test.cpp2
-rw-r--r--libc/test/src/time/ctime_r_test.cpp2
-rw-r--r--libc/test/src/time/ctime_test.cpp2
-rw-r--r--libc/test/src/time/gmtime_test.cpp4
-rw-r--r--libc/test/src/time/nanosleep_test.cpp4
396 files changed, 827 insertions, 782 deletions
diff --git a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
index 0facb0b9be0c..a98e7276bef8 100644
--- a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
+++ b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
@@ -106,6 +106,10 @@ function(_get_compile_options_from_config output_var)
list(APPEND config_options "-DLIBC_MATH=${LIBC_CONF_MATH_OPTIMIZATIONS}")
endif()
+ if(LIBC_CONF_ERRNO_MODE)
+ set(APPEND config_options "-DLIBC_ERRNO_MODE=${LIBC_CONF_ERRNO_MODE}")
+ endif()
+
set(${output_var} ${config_options} PARENT_SCOPE)
endfunction(_get_compile_options_from_config)
diff --git a/libc/config/config.json b/libc/config/config.json
index bfe956855cb5..d53b2936edb0 100644
--- a/libc/config/config.json
+++ b/libc/config/config.json
@@ -2,7 +2,7 @@
"errno": {
"LIBC_CONF_ERRNO_MODE": {
"value": "LIBC_ERRNO_MODE_DEFAULT",
- "doc": "The implementation used for errno, acceptable values are LIBC_ERRNO_MODE_DEFAULT, LIBC_ERRNO_MODE_UNDEFINED, LIBC_ERRNO_MODE_THREAD_LOCAL, LIBC_ERRNO_MODE_SHARED, LIBC_ERRNO_MODE_EXTERNAL, and LIBC_ERRNO_MODE_SYSTEM."
+ "doc": "The implementation used for errno, acceptable values are LIBC_ERRNO_MODE_DEFAULT, LIBC_ERRNO_MODE_UNDEFINED, LIBC_ERRNO_MODE_THREAD_LOCAL, LIBC_ERRNO_MODE_SHARED, LIBC_ERRNO_MODE_EXTERNAL, LIBC_ERRNO_MODE_SYSTEM, and LIBC_ERRNO_MODE_SYSTEM_INLINE."
}
},
"printf": {
diff --git a/libc/docs/dev/code_style.rst b/libc/docs/dev/code_style.rst
index 0bd3a69ae3ff..86247966552f 100644
--- a/libc/docs/dev/code_style.rst
+++ b/libc/docs/dev/code_style.rst
@@ -101,7 +101,7 @@ test infrastructure itself can be affected. To avoid perturbing the unit test
infrastructure around the setting of ``errno``, the following rules are to be
followed:
-#. A special macro named ``libc_errno`` defined in ``src/errno/libc_errno.h``
+#. A special macro named ``libc_errno`` defined in ``src/__support/libc_errno.h``
should be used when setting ``errno`` from libc runtime code. For example,
code to set ``errno`` to ``EINVAL`` should be:
@@ -117,7 +117,7 @@ followed:
`ErrorOr <https://github.com/llvm/llvm-project/blob/main/libc/src/__support/error_or.h>`_
to return error values.
-#. The header file ``src/errno/libc_errno.h`` is shipped as part of the target
+#. The header file ``src/__support/libc_errno.h`` is shipped as part of the target
corresponding to the ``errno`` entrypoint ``libc.src.errno.errno``. We do
not in general allow dependencies between entrypoints. However, the ``errno``
entrypoint is the only exceptional entrypoint on which other entrypoints
diff --git a/libc/shared/fp_bits.h b/libc/shared/fp_bits.h
index 2898c508b777..e6bb1e17b80c 100644
--- a/libc/shared/fp_bits.h
+++ b/libc/shared/fp_bits.h
@@ -9,6 +9,7 @@
#ifndef LLVM_LIBC_SHARED_FP_BITS_H
#define LLVM_LIBC_SHARED_FP_BITS_H
+#include "libc_common.h"
#include "src/__support/FPUtil/FPBits.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/shared/libc_common.h b/libc/shared/libc_common.h
new file mode 100644
index 000000000000..c4560bbb0276
--- /dev/null
+++ b/libc/shared/libc_common.h
@@ -0,0 +1,26 @@
+//===-- Common defines for sharing LLVM libc with LLVM projects -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_LIBC_COMMON_H
+#define LLVM_LIBC_SHARED_LIBC_COMMON_H
+
+// Use system errno.
+#ifdef LIBC_ERRNO_MODE
+#if LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_SYSTEM_INLINE
+#error \
+ "LIBC_ERRNO_MODE was set to something different from LIBC_ERRNO_MODE_SYSTEM_INLINE."
+#endif // LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_SYSTEM_INLINE
+#else
+#define LIBC_ERRNO_MODE LIBC_ERRNO_MODE_SYSTEM_INLINE
+#endif // LIBC_ERRNO_MODE
+
+#ifndef LIBC_NAMESPACE
+#define LIBC_NAMESPACE __llvm_libc
+#endif // LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SHARED_LIBC_COMMON_H
diff --git a/libc/shared/rpc_server.h b/libc/shared/rpc_server.h
index 5509094b944a..46e35f13f0ea 100644
--- a/libc/shared/rpc_server.h
+++ b/libc/shared/rpc_server.h
@@ -9,6 +9,7 @@
#ifndef LLVM_LIBC_SHARED_RPC_SERVER_H
#define LLVM_LIBC_SHARED_RPC_SERVER_H
+#include "libc_common.h"
#include "src/__support/RPC/rpc_server.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/shared/str_to_float.h b/libc/shared/str_to_float.h
index b133a28e26ef..dcc6027d6c77 100644
--- a/libc/shared/str_to_float.h
+++ b/libc/shared/str_to_float.h
@@ -9,6 +9,7 @@
#ifndef LLVM_LIBC_SHARED_STR_TO_FLOAT_H
#define LLVM_LIBC_SHARED_STR_TO_FLOAT_H
+#include "libc_common.h"
#include "src/__support/str_to_float.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/shared/str_to_integer.h b/libc/shared/str_to_integer.h
index 15bee698d5a6..6ed38c932662 100644
--- a/libc/shared/str_to_integer.h
+++ b/libc/shared/str_to_integer.h
@@ -9,6 +9,7 @@
#ifndef LLVM_LIBC_SHARED_STR_TO_INTEGER_H
#define LLVM_LIBC_SHARED_STR_TO_INTEGER_H
+#include "libc_common.h"
#include "src/__support/str_to_integer.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/__support/CMakeLists.txt b/libc/src/__support/CMakeLists.txt
index f92499fdbf45..327ff5e0c6a3 100644
--- a/libc/src/__support/CMakeLists.txt
+++ b/libc/src/__support/CMakeLists.txt
@@ -2,6 +2,15 @@ add_subdirectory(CPP)
add_subdirectory(macros)
add_header_library(
+ libc_errno
+ HDRS
+ libc_errno.h
+ DEPENDS
+ libc.hdr.errno_macros
+ libc.src.__support.macros.config
+)
+
+add_header_library(
block
HDRS
block.h
diff --git a/libc/src/__support/FPUtil/FEnvImpl.h b/libc/src/__support/FPUtil/FEnvImpl.h
index 4c8f34a435bd..50a101f833c5 100644
--- a/libc/src/__support/FPUtil/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/FEnvImpl.h
@@ -12,10 +12,10 @@
#include "hdr/fenv_macros.h"
#include "hdr/math_macros.h"
#include "hdr/types/fenv_t.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h"
-#include "src/errno/libc_errno.h"
#if defined(LIBC_TARGET_ARCH_IS_AARCH64) && defined(__ARM_FP)
#if defined(__APPLE__)
diff --git a/libc/src/__support/File/dir.cpp b/libc/src/__support/File/dir.cpp
index 21b0106f7010..aea8862c15f7 100644
--- a/libc/src/__support/File/dir.cpp
+++ b/libc/src/__support/File/dir.cpp
@@ -11,8 +11,8 @@
#include "src/__support/CPP/mutex.h" // lock_guard
#include "src/__support/CPP/new.h"
#include "src/__support/error_or.h"
+#include "src/__support/libc_errno.h" // For error macros
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h" // For error macros
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/__support/File/file.cpp b/libc/src/__support/File/file.cpp
index 528542cccf32..303852dbbb71 100644
--- a/libc/src/__support/File/file.cpp
+++ b/libc/src/__support/File/file.cpp
@@ -13,8 +13,8 @@
#include "hdr/types/off_t.h"
#include "src/__support/CPP/new.h"
#include "src/__support/CPP/span.h"
+#include "src/__support/libc_errno.h" // For error macros
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h" // For error macros
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/__support/File/linux/file.cpp b/libc/src/__support/File/linux/file.cpp
index 824c1f200e8c..761e352f74ea 100644
--- a/libc/src/__support/File/linux/file.cpp
+++ b/libc/src/__support/File/linux/file.cpp
@@ -15,8 +15,8 @@
#include "src/__support/File/linux/lseekImpl.h"
#include "src/__support/OSUtil/fcntl.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
+#include "src/__support/libc_errno.h" // For error macros
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h" // For error macros
#include "hdr/fcntl_macros.h" // For mode_t and other flags to the open syscall
#include <sys/stat.h> // For S_IS*, S_IF*, and S_IR* flags.
diff --git a/libc/src/__support/File/linux/lseekImpl.h b/libc/src/__support/File/linux/lseekImpl.h
index a034913d9f6e..300e5c5dd55b 100644
--- a/libc/src/__support/File/linux/lseekImpl.h
+++ b/libc/src/__support/File/linux/lseekImpl.h
@@ -13,8 +13,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
#include "src/__support/error_or.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stdint.h> // For uint64_t.
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/__support/HashTable/randomness.h b/libc/src/__support/HashTable/randomness.h
index 244dd41be3ee..6b58a4125f78 100644
--- a/libc/src/__support/HashTable/randomness.h
+++ b/libc/src/__support/HashTable/randomness.h
@@ -14,7 +14,7 @@
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
#if defined(LIBC_HASHTABLE_USE_GETRANDOM)
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/sys/random/getrandom.h"
#endif
diff --git a/libc/src/__support/OSUtil/linux/fcntl.cpp b/libc/src/__support/OSUtil/linux/fcntl.cpp
index 4742b2a00220..99e16ad58c91 100644
--- a/libc/src/__support/OSUtil/linux/fcntl.cpp
+++ b/libc/src/__support/OSUtil/linux/fcntl.cpp
@@ -15,8 +15,8 @@
#include "hdr/types/struct_flock64.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stdarg.h>
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/__support/OSUtil/linux/vdso.cpp b/libc/src/__support/OSUtil/linux/vdso.cpp
index 8c9bd3e1bcc7..e4e53c3c2a0f 100644
--- a/libc/src/__support/OSUtil/linux/vdso.cpp
+++ b/libc/src/__support/OSUtil/linux/vdso.cpp
@@ -11,9 +11,9 @@
#include "src/__support/CPP/array.h"
#include "src/__support/CPP/optional.h"
#include "src/__support/CPP/string_view.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/threads/callonce.h"
#include "src/__support/threads/linux/futex_word.h"
-#include "src/errno/libc_errno.h"
#include "src/sys/auxv/getauxval.h"
#include <linux/auxvec.h>
diff --git a/libc/src/__support/StringUtil/tables/linux_extension_errors.h b/libc/src/__support/StringUtil/tables/linux_extension_errors.h
index 425590f6e91c..de637d60bea9 100644
--- a/libc/src/__support/StringUtil/tables/linux_extension_errors.h
+++ b/libc/src/__support/StringUtil/tables/linux_extension_errors.h
@@ -10,8 +10,8 @@
#define LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_TABLES_LINUX_EXTENSION_ERRORS_H
#include "src/__support/StringUtil/message_mapper.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/__support/libc_errno.h b/libc/src/__support/libc_errno.h
new file mode 100644
index 000000000000..ab5f6a9c4b9d
--- /dev/null
+++ b/libc/src/__support/libc_errno.h
@@ -0,0 +1,108 @@
+//===-- Implementation header for libc_errno --------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_LIBC_ERRNO_H
+#define LLVM_LIBC_SRC___SUPPORT_LIBC_ERRNO_H
+
+// This header is to be consumed by internal implementations, in which all of
+// them should refer to `libc_errno` instead of using `errno` directly from
+// <errno.h> header.
+
+// Unit and hermetic tests should:
+// - #include "src/__support/libc_errno.h"
+// - NOT #include <errno.h>
+// - Only use `libc_errno` in the code
+// - Depend on libc.src.errno.errno
+
+// Integration tests should:
+// - NOT #include "src/__support/libc_errno.h"
+// - #include <errno.h>
+// - Use regular `errno` in the code
+// - Still depend on libc.src.errno.errno
+
+// libc uses a fallback default value, either system or thread local.
+#define LIBC_ERRNO_MODE_DEFAULT 0
+// libc never stores a value; `errno` macro uses get link-time failure.
+#define LIBC_ERRNO_MODE_UNDEFINED 1
+// libc maintains per-thread state (requires C++ `thread_local` support).
+#define LIBC_ERRNO_MODE_THREAD_LOCAL 2
+// libc maintains shared state used by all threads, contrary to standard C
+// semantics unless always single-threaded; nothing prevents data races.
+#define LIBC_ERRNO_MODE_SHARED 3
+// libc doesn't maintain any internal state, instead the embedder must define
+// `int *__llvm_libc_errno(void);` C function.
+#define LIBC_ERRNO_MODE_EXTERNAL 4
+// libc uses system `<errno.h>` `errno` macro directly in the overlay mode; in
+// fullbuild mode, effectively the same as `LIBC_ERRNO_MODE_EXTERNAL`.
+// In this mode, the public C++ symbol `LIBC_NAMESPACE::libc_errno ` is still
+// exported and get redirected to the system `errno` inside its implementation.
+
+// TODO: Investigate deprecating LIBC_ERRNO_MODE_SYSTEM in favor of
+// LIBC_ERRNO_MODE_SYSTEM_INLINE.
+// https://github.com/llvm/llvm-project/issues/143454
+#define LIBC_ERRNO_MODE_SYSTEM 5
+// In this mode, the libc_errno is simply a macro resolved to `errno` from the
+// system header <errno.h>. There is no need to link against the
+// `libc.src.errno.errno` object.
+#define LIBC_ERRNO_MODE_SYSTEM_INLINE 6
+
+#if !defined(LIBC_ERRNO_MODE) || LIBC_ERRNO_MODE == LIBC_ERRNO_MODE_DEFAULT
+#undef LIBC_ERRNO_MODE
+#if defined(LIBC_FULL_BUILD) || !defined(LIBC_COPT_PUBLIC_PACKAGING)
+#define LIBC_ERRNO_MODE LIBC_ERRNO_MODE_THREAD_LOCAL
+#else
+#define LIBC_ERRNO_MODE LIBC_ERRNO_MODE_SYSTEM
+#endif
+#endif // LIBC_ERRNO_MODE
+
+#if LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_DEFAULT && \
+ LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_UNDEFINED && \
+ LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_THREAD_LOCAL && \
+ LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_SHARED && \
+ LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_EXTERNAL && \
+ LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_SYSTEM && \
+ LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_SYSTEM_INLINE
+#error LIBC_ERRNO_MODE must be one of the following values: \
+LIBC_ERRNO_MODE_DEFAULT, \
+LIBC_ERRNO_MODE_UNDEFINED, \
+LIBC_ERRNO_MODE_THREAD_LOCAL, \
+LIBC_ERRNO_MODE_SHARED, \
+LIBC_ERRNO_MODE_EXTERNAL, \
+LIBC_ERRNO_MODE_SYSTEM, \
+LIBC_ERRNO_MODE_SYSTEM_INLINE.
+#endif
+
+#if LIBC_ERRNO_MODE == LIBC_ERRNO_MODE_SYSTEM_INLINE
+
+#include <errno.h>
+
+#define libc_errno errno
+
+#else // !LIBC_ERRNO_MODE_SYSTEM_INLINE
+
+#include "hdr/errno_macros.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+extern "C" int *__llvm_libc_errno() noexcept;
+
+struct Errno {
+ void operator=(int);
+ operator int();
+};
+
+extern Errno libc_errno;
+
+} // namespace LIBC_NAMESPACE_DECL
+
+using LIBC_NAMESPACE::libc_errno;
+
+#endif // LIBC_ERRNO_MODE_SYSTEM_INLINE
+
+#endif // LLVM_LIBC_SRC___SUPPORT_LIBC_ERRNO_H
diff --git a/libc/src/__support/threads/linux/thread.cpp b/libc/src/__support/threads/linux/thread.cpp
index c531d74c5335..baad26aed685 100644
--- a/libc/src/__support/threads/linux/thread.cpp
+++ b/libc/src/__support/threads/linux/thread.cpp
@@ -14,9 +14,9 @@
#include "src/__support/OSUtil/syscall.h" // For syscall functions.
#include "src/__support/common.h"
#include "src/__support/error_or.h"
+#include "src/__support/libc_errno.h" // For error macros
#include "src/__support/macros/config.h"
#include "src/__support/threads/linux/futex_utils.h" // For FutexWordType
-#include "src/errno/libc_errno.h" // For error macros
#ifdef LIBC_TARGET_ARCH_IS_AARCH64
#include <arm_acle.h>
diff --git a/libc/src/dirent/closedir.cpp b/libc/src/dirent/closedir.cpp
index 1249ef94cf41..2f8f6f0c044d 100644
--- a/libc/src/dirent/closedir.cpp
+++ b/libc/src/dirent/closedir.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/dir.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <dirent.h>
diff --git a/libc/src/dirent/opendir.cpp b/libc/src/dirent/opendir.cpp
index fee14ef0f558..bf47d0edac18 100644
--- a/libc/src/dirent/opendir.cpp
+++ b/libc/src/dirent/opendir.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/dir.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <dirent.h>
diff --git a/libc/src/dirent/readdir.cpp b/libc/src/dirent/readdir.cpp
index ad460b5e80b8..f95f7c1ae864 100644
--- a/libc/src/dirent/readdir.cpp
+++ b/libc/src/dirent/readdir.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/dir.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <dirent.h>
diff --git a/libc/src/errno/CMakeLists.txt b/libc/src/errno/CMakeLists.txt
index 1d78a5eedff9..2852044e9416 100644
--- a/libc/src/errno/CMakeLists.txt
+++ b/libc/src/errno/CMakeLists.txt
@@ -1,28 +1,16 @@
# If we are in full build mode, we will provide the errno definition ourselves,
# and if we are in overlay mode, we will just re-use the system's errno.
-# We are passing LIBC_FULL_BUILD flag in full build mode so that the
-# implementation of libc_errno will know if we are in full build mode or not.
-
-# TODO: Move LIBC_FULL_BUILD flag to _get_common_compile_options.
-set(full_build_flag "")
-if(LLVM_LIBC_FULL_BUILD)
- set(full_build_flag "-DLIBC_FULL_BUILD")
-endif()
-
-if(LIBC_CONF_ERRNO_MODE)
- set(errno_config_copts "-DLIBC_ERRNO_MODE=${LIBC_CONF_ERRNO_MODE}")
-endif()
add_entrypoint_object(
errno
SRCS
libc_errno.cpp
HDRS
- libc_errno.h # Include this
- COMPILE_OPTIONS
- ${full_build_flag}
- ${errno_config_copts}
+ ../__support/libc_errno.h
DEPENDS
libc.hdr.errno_macros
libc.src.__support.common
+ libc.src.__support.libc_errno
+ libc.src.__support.macros.attributes
+ libc.src.__support.macros.config
)
diff --git a/libc/src/errno/libc_errno.cpp b/libc/src/errno/libc_errno.cpp
index d1600d1b050e..8ff1eec1b103 100644
--- a/libc/src/errno/libc_errno.cpp
+++ b/libc/src/errno/libc_errno.cpp
@@ -6,51 +6,14 @@
//
//===----------------------------------------------------------------------===//
-#include "libc_errno.h"
+#include "src/__support/libc_errno.h"
+#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
-// libc uses a fallback default value, either system or thread local.
-#define LIBC_ERRNO_MODE_DEFAULT 0
-// libc never stores a value; `errno` macro uses get link-time failure.
-#define LIBC_ERRNO_MODE_UNDEFINED 1
-// libc maintains per-thread state (requires C++ `thread_local` support).
-#define LIBC_ERRNO_MODE_THREAD_LOCAL 2
-// libc maintains shared state used by all threads, contrary to standard C
-// semantics unless always single-threaded; nothing prevents data races.
-#define LIBC_ERRNO_MODE_SHARED 3
-// libc doesn't maintain any internal state, instead the embedder must define
-// `int *__llvm_libc_errno(void);` C function.
-#define LIBC_ERRNO_MODE_EXTERNAL 4
-// libc uses system `<errno.h>` `errno` macro directly in the overlay mode; in
-// fullbuild mode, effectively the same as `LIBC_ERRNO_MODE_EXTERNAL`.
-#define LIBC_ERRNO_MODE_SYSTEM 5
-
-#if !defined(LIBC_ERRNO_MODE) || LIBC_ERRNO_MODE == LIBC_ERRNO_MODE_DEFAULT
-#undef LIBC_ERRNO_MODE
-#if defined(LIBC_FULL_BUILD) || !defined(LIBC_COPT_PUBLIC_PACKAGING)
-#define LIBC_ERRNO_MODE LIBC_ERRNO_MODE_THREAD_LOCAL
-#else
-#define LIBC_ERRNO_MODE LIBC_ERRNO_MODE_SYSTEM
-#endif
-#endif // LIBC_ERRNO_MODE
-
-#if LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_DEFAULT && \
- LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_UNDEFINED && \
- LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_THREAD_LOCAL && \
- LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_SHARED && \
- LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_EXTERNAL && \
- LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_SYSTEM
-#error LIBC_ERRNO_MODE must be one of the following values: \
-LIBC_ERRNO_MODE_DEFAULT, \
-LIBC_ERRNO_MODE_UNDEFINED, \
-LIBC_ERRNO_MODE_THREAD_LOCAL, \
-LIBC_ERRNO_MODE_SHARED, \
-LIBC_ERRNO_MODE_EXTERNAL, \
-LIBC_ERRNO_MODE_SYSTEM
-#endif
-
namespace LIBC_NAMESPACE_DECL {
+#if LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_SYSTEM_INLINE
+
#if LIBC_ERRNO_MODE == LIBC_ERRNO_MODE_UNDEFINED
void Errno::operator=(int) {}
@@ -93,4 +56,6 @@ Errno::operator int() { return errno; }
// Define the global `libc_errno` instance.
Errno libc_errno;
+#endif // LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_SYSTEM_INLINE
+
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/errno/libc_errno.h b/libc/src/errno/libc_errno.h
deleted file mode 100644
index 44ee2714843b..000000000000
--- a/libc/src/errno/libc_errno.h
+++ /dev/null
@@ -1,47 +0,0 @@
-//===-- Implementation header for libc_errno --------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_SRC_ERRNO_LIBC_ERRNO_H
-#define LLVM_LIBC_SRC_ERRNO_LIBC_ERRNO_H
-
-#include "src/__support/macros/attributes.h"
-#include "src/__support/macros/config.h"
-#include "src/__support/macros/properties/architectures.h"
-
-#include "hdr/errno_macros.h"
-
-// This header is to be consumed by internal implementations, in which all of
-// them should refer to `libc_errno` instead of using `errno` directly from
-// <errno.h> header.
-
-// Unit and hermetic tests should:
-// - #include "src/errno/libc_errno.h"
-// - NOT #include <errno.h>
-// - Only use `libc_errno` in the code
-// - Depend on libc.src.errno.errno
-
-// Integration tests should:
-// - NOT #include "src/errno/libc_errno.h"
-// - #include <errno.h>
-// - Use regular `errno` in the code
-// - Still depend on libc.src.errno.errno
-
-namespace LIBC_NAMESPACE_DECL {
-
-extern "C" int *__llvm_libc_errno() noexcept;
-
-struct Errno {
- void operator=(int);
- operator int();
-};
-
-extern Errno libc_errno;
-
-} // namespace LIBC_NAMESPACE_DECL
-
-#endif // LLVM_LIBC_SRC_ERRNO_LIBC_ERRNO_H
diff --git a/libc/src/fcntl/linux/creat.cpp b/libc/src/fcntl/linux/creat.cpp
index 23abae243aed..71412a8e68c5 100644
--- a/libc/src/fcntl/linux/creat.cpp
+++ b/libc/src/fcntl/linux/creat.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "hdr/fcntl_macros.h"
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/fcntl/linux/open.cpp b/libc/src/fcntl/linux/open.cpp
index 8b699ecdd204..a21a03788dea 100644
--- a/libc/src/fcntl/linux/open.cpp
+++ b/libc/src/fcntl/linux/open.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "hdr/fcntl_macros.h"
#include "hdr/types/mode_t.h"
diff --git a/libc/src/fcntl/linux/openat.cpp b/libc/src/fcntl/linux/openat.cpp
index 6063d9c00ad6..b47ad1fb3bb0 100644
--- a/libc/src/fcntl/linux/openat.cpp
+++ b/libc/src/fcntl/linux/openat.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "hdr/types/mode_t.h"
#include <stdarg.h>
diff --git a/libc/src/inttypes/strtoimax.cpp b/libc/src/inttypes/strtoimax.cpp
index 85f197c75d90..6e55a4b56aac 100644
--- a/libc/src/inttypes/strtoimax.cpp
+++ b/libc/src/inttypes/strtoimax.cpp
@@ -8,9 +8,9 @@
#include "src/inttypes/strtoimax.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_integer.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/inttypes/strtoumax.cpp b/libc/src/inttypes/strtoumax.cpp
index 2e9cbc9acba7..ce5a0a782d97 100644
--- a/libc/src/inttypes/strtoumax.cpp
+++ b/libc/src/inttypes/strtoumax.cpp
@@ -8,9 +8,9 @@
#include "src/inttypes/strtoumax.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_integer.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/math/generic/exp10m1f.cpp b/libc/src/math/generic/exp10m1f.cpp
index e973b2921c2e..27729104e038 100644
--- a/libc/src/math/generic/exp10m1f.cpp
+++ b/libc/src/math/generic/exp10m1f.cpp
@@ -14,9 +14,9 @@
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/FPUtil/rounding_mode.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h"
-#include "src/errno/libc_errno.h"
#include "explogxf.h"
diff --git a/libc/src/math/generic/exp2m1f.cpp b/libc/src/math/generic/exp2m1f.cpp
index 4913a5e4277e..127c6eaa494d 100644
--- a/libc/src/math/generic/exp2m1f.cpp
+++ b/libc/src/math/generic/exp2m1f.cpp
@@ -14,10 +14,10 @@
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/FPUtil/rounding_mode.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h"
#include "src/__support/macros/properties/cpu_features.h"
-#include "src/errno/libc_errno.h"
#include "explogxf.h"
diff --git a/libc/src/math/generic/nan.cpp b/libc/src/math/generic/nan.cpp
index f92cd3ff5eb5..829a2ea435ac 100644
--- a/libc/src/math/generic/nan.cpp
+++ b/libc/src/math/generic/nan.cpp
@@ -8,9 +8,9 @@
#include "src/math/nan.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_float.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/math/generic/nanf.cpp b/libc/src/math/generic/nanf.cpp
index 7287182406ac..1cb66160e736 100644
--- a/libc/src/math/generic/nanf.cpp
+++ b/libc/src/math/generic/nanf.cpp
@@ -8,9 +8,9 @@
#include "src/math/nanf.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_float.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/math/generic/nanf128.cpp b/libc/src/math/generic/nanf128.cpp
index 3d8581afa037..4155c5333a9c 100644
--- a/libc/src/math/generic/nanf128.cpp
+++ b/libc/src/math/generic/nanf128.cpp
@@ -8,9 +8,9 @@
#include "src/math/nanf128.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_float.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/math/generic/nanf16.cpp b/libc/src/math/generic/nanf16.cpp
index 27d9d165f4a8..7b166400601b 100644
--- a/libc/src/math/generic/nanf16.cpp
+++ b/libc/src/math/generic/nanf16.cpp
@@ -8,9 +8,9 @@
#include "src/math/nanf16.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_float.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/math/generic/nanl.cpp b/libc/src/math/generic/nanl.cpp
index 4f698cb3c88d..58d638c4b531 100644
--- a/libc/src/math/generic/nanl.cpp
+++ b/libc/src/math/generic/nanl.cpp
@@ -8,9 +8,9 @@
#include "src/math/nanl.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_float.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/poll/linux/poll.cpp b/libc/src/poll/linux/poll.cpp
index f82fcbcc6577..4cac75b9687c 100644
--- a/libc/src/poll/linux/poll.cpp
+++ b/libc/src/poll/linux/poll.cpp
@@ -13,8 +13,8 @@
#include "hdr/types/struct_timespec.h"
#include "src/__support/OSUtil/syscall.h" // syscall_impl
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // SYS_poll, SYS_ppoll
diff --git a/libc/src/pthread/pthread_atfork.cpp b/libc/src/pthread/pthread_atfork.cpp
index b2c67c78e5d9..4cad16a02de7 100644
--- a/libc/src/pthread/pthread_atfork.cpp
+++ b/libc/src/pthread/pthread_atfork.cpp
@@ -9,9 +9,9 @@
#include "pthread_atfork.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/threads/fork_callbacks.h"
-#include "src/errno/libc_errno.h"
#include <pthread.h> // For pthread_* type definitions.
diff --git a/libc/src/pthread/pthread_attr_setdetachstate.cpp b/libc/src/pthread/pthread_attr_setdetachstate.cpp
index 872f694e01f3..c482d25610c2 100644
--- a/libc/src/pthread/pthread_attr_setdetachstate.cpp
+++ b/libc/src/pthread/pthread_attr_setdetachstate.cpp
@@ -9,8 +9,8 @@
#include "pthread_attr_setdetachstate.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <pthread.h>
diff --git a/libc/src/pthread/pthread_attr_setguardsize.cpp b/libc/src/pthread/pthread_attr_setguardsize.cpp
index fa4375e915ab..c996210a61d8 100644
--- a/libc/src/pthread/pthread_attr_setguardsize.cpp
+++ b/libc/src/pthread/pthread_attr_setguardsize.cpp
@@ -9,8 +9,8 @@
#include "pthread_attr_setguardsize.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <linux/param.h> // For EXEC_PAGESIZE.
#include <pthread.h>
diff --git a/libc/src/pthread/pthread_attr_setstack.cpp b/libc/src/pthread/pthread_attr_setstack.cpp
index 1154055a63a7..767f959b1400 100644
--- a/libc/src/pthread/pthread_attr_setstack.cpp
+++ b/libc/src/pthread/pthread_attr_setstack.cpp
@@ -10,9 +10,9 @@
#include "pthread_attr_setstacksize.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/threads/thread.h" // For STACK_ALIGNMENT
-#include "src/errno/libc_errno.h"
#include <pthread.h>
#include <stdint.h>
diff --git a/libc/src/pthread/pthread_attr_setstacksize.cpp b/libc/src/pthread/pthread_attr_setstacksize.cpp
index 0a5d1af661ab..38c77ca761d6 100644
--- a/libc/src/pthread/pthread_attr_setstacksize.cpp
+++ b/libc/src/pthread/pthread_attr_setstacksize.cpp
@@ -9,8 +9,8 @@
#include "pthread_attr_setstacksize.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <pthread.h>
diff --git a/libc/src/pthread/pthread_condattr_setclock.cpp b/libc/src/pthread/pthread_condattr_setclock.cpp
index 5e825d5ecea6..2f63d5e9d194 100644
--- a/libc/src/pthread/pthread_condattr_setclock.cpp
+++ b/libc/src/pthread/pthread_condattr_setclock.cpp
@@ -9,8 +9,8 @@
#include "pthread_condattr_setclock.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "hdr/time_macros.h" // CLOCK_MONOTONIC, CLOCK_REALTIME
#include <pthread.h> // pthread_condattr_t
diff --git a/libc/src/pthread/pthread_condattr_setpshared.cpp b/libc/src/pthread/pthread_condattr_setpshared.cpp
index 433b2dc1d2d9..9c117499a559 100644
--- a/libc/src/pthread/pthread_condattr_setpshared.cpp
+++ b/libc/src/pthread/pthread_condattr_setpshared.cpp
@@ -9,8 +9,8 @@
#include "pthread_condattr_setpshared.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <pthread.h> // pthread_condattr_t, PTHREAD_PROCESS_SHARED, PTHREAD_PROCESS_PRIVATE
diff --git a/libc/src/pthread/pthread_create.cpp b/libc/src/pthread/pthread_create.cpp
index e1b1f3b325d1..45be2807fa83 100644
--- a/libc/src/pthread/pthread_create.cpp
+++ b/libc/src/pthread/pthread_create.cpp
@@ -16,10 +16,10 @@
#include "pthread_attr_getstack.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h"
#include "src/__support/threads/thread.h"
-#include "src/errno/libc_errno.h"
#include <pthread.h> // For pthread_* type definitions.
diff --git a/libc/src/pthread/pthread_key_create.cpp b/libc/src/pthread/pthread_key_create.cpp
index 383762f273e7..7253de14cc0d 100644
--- a/libc/src/pthread/pthread_key_create.cpp
+++ b/libc/src/pthread/pthread_key_create.cpp
@@ -9,9 +9,9 @@
#include "pthread_key_create.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/threads/thread.h"
-#include "src/errno/libc_errno.h"
#include <pthread.h>
diff --git a/libc/src/pthread/pthread_key_delete.cpp b/libc/src/pthread/pthread_key_delete.cpp
index b54db821ab05..2b14d874fe31 100644
--- a/libc/src/pthread/pthread_key_delete.cpp
+++ b/libc/src/pthread/pthread_key_delete.cpp
@@ -9,9 +9,9 @@
#include "pthread_key_delete.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/threads/thread.h"
-#include "src/errno/libc_errno.h"
#include <pthread.h>
diff --git a/libc/src/pthread/pthread_mutexattr_setpshared.cpp b/libc/src/pthread/pthread_mutexattr_setpshared.cpp
index deeae15be230..a87a08259c4b 100644
--- a/libc/src/pthread/pthread_mutexattr_setpshared.cpp
+++ b/libc/src/pthread/pthread_mutexattr_setpshared.cpp
@@ -10,8 +10,8 @@
#include "pthread_mutexattr.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <pthread.h>
diff --git a/libc/src/pthread/pthread_mutexattr_setrobust.cpp b/libc/src/pthread/pthread_mutexattr_setrobust.cpp
index 9fd46f4c928d..fd7a8d7ce1d1 100644
--- a/libc/src/pthread/pthread_mutexattr_setrobust.cpp
+++ b/libc/src/pthread/pthread_mutexattr_setrobust.cpp
@@ -10,8 +10,8 @@
#include "pthread_mutexattr.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <pthread.h>
diff --git a/libc/src/pthread/pthread_mutexattr_settype.cpp b/libc/src/pthread/pthread_mutexattr_settype.cpp
index c7e78271f9c3..5a65f031045d 100644
--- a/libc/src/pthread/pthread_mutexattr_settype.cpp
+++ b/libc/src/pthread/pthread_mutexattr_settype.cpp
@@ -10,8 +10,8 @@
#include "pthread_mutexattr.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <pthread.h>
diff --git a/libc/src/pthread/pthread_rwlock_timedrdlock.cpp b/libc/src/pthread/pthread_rwlock_timedrdlock.cpp
index 112ff5c9cdad..fcddfed22490 100644
--- a/libc/src/pthread/pthread_rwlock_timedrdlock.cpp
+++ b/libc/src/pthread/pthread_rwlock_timedrdlock.cpp
@@ -9,11 +9,11 @@
#include "src/pthread/pthread_rwlock_timedrdlock.h"
#include "src/__support/common.h"
#include "src/__support/libc_assert.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h"
#include "src/__support/threads/linux/rwlock.h"
#include "src/__support/time/linux/abs_timeout.h"
-#include "src/errno/libc_errno.h"
#include <pthread.h>
diff --git a/libc/src/pthread/pthread_rwlock_trywrlock.cpp b/libc/src/pthread/pthread_rwlock_trywrlock.cpp
index a63dc893e716..660c15a87b36 100644
--- a/libc/src/pthread/pthread_rwlock_trywrlock.cpp
+++ b/libc/src/pthread/pthread_rwlock_trywrlock.cpp
@@ -9,9 +9,9 @@
#include "src/pthread/pthread_rwlock_trywrlock.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/threads/linux/rwlock.h"
-#include "src/errno/libc_errno.h"
#include <pthread.h>
diff --git a/libc/src/pthread/pthread_rwlock_unlock.cpp b/libc/src/pthread/pthread_rwlock_unlock.cpp
index e61290179bd6..5496bea929c5 100644
--- a/libc/src/pthread/pthread_rwlock_unlock.cpp
+++ b/libc/src/pthread/pthread_rwlock_unlock.cpp
@@ -9,9 +9,9 @@
#include "src/pthread/pthread_rwlock_unlock.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/threads/linux/rwlock.h"
-#include "src/errno/libc_errno.h"
#include <pthread.h>
diff --git a/libc/src/pthread/pthread_rwlockattr_setkind_np.cpp b/libc/src/pthread/pthread_rwlockattr_setkind_np.cpp
index 80d34a35c717..e6800311b858 100644
--- a/libc/src/pthread/pthread_rwlockattr_setkind_np.cpp
+++ b/libc/src/pthread/pthread_rwlockattr_setkind_np.cpp
@@ -9,8 +9,8 @@
#include "pthread_rwlockattr_setkind_np.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <pthread.h> // pthread_rwlockattr_t
diff --git a/libc/src/pthread/pthread_rwlockattr_setpshared.cpp b/libc/src/pthread/pthread_rwlockattr_setpshared.cpp
index 5a7191aefd3d..4fbd095ac2b4 100644
--- a/libc/src/pthread/pthread_rwlockattr_setpshared.cpp
+++ b/libc/src/pthread/pthread_rwlockattr_setpshared.cpp
@@ -9,8 +9,8 @@
#include "pthread_rwlockattr_setpshared.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <pthread.h> // pthread_rwlockattr_t, PTHREAD_PROCESS_SHARED, PTHREAD_PROCESS_PRIVATE
diff --git a/libc/src/pthread/pthread_setspecific.cpp b/libc/src/pthread/pthread_setspecific.cpp
index 70c29c167084..b147a66d2fad 100644
--- a/libc/src/pthread/pthread_setspecific.cpp
+++ b/libc/src/pthread/pthread_setspecific.cpp
@@ -9,9 +9,9 @@
#include "pthread_setspecific.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/threads/thread.h"
-#include "src/errno/libc_errno.h"
#include <pthread.h>
diff --git a/libc/src/sched/linux/sched_get_priority_max.cpp b/libc/src/sched/linux/sched_get_priority_max.cpp
index 77a82c77405f..fb30b1e319e7 100644
--- a/libc/src/sched/linux/sched_get_priority_max.cpp
+++ b/libc/src/sched/linux/sched_get_priority_max.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sched/linux/sched_get_priority_min.cpp b/libc/src/sched/linux/sched_get_priority_min.cpp
index fca66a15edb5..54f67e915fc1 100644
--- a/libc/src/sched/linux/sched_get_priority_min.cpp
+++ b/libc/src/sched/linux/sched_get_priority_min.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sched/linux/sched_getaffinity.cpp b/libc/src/sched/linux/sched_getaffinity.cpp
index 7b1fd8c5aa2a..e005819e2a97 100644
--- a/libc/src/sched/linux/sched_getaffinity.cpp
+++ b/libc/src/sched/linux/sched_getaffinity.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sched.h>
#include <stdint.h>
diff --git a/libc/src/sched/linux/sched_getparam.cpp b/libc/src/sched/linux/sched_getparam.cpp
index 75756a65f0ed..b0576c3ac65b 100644
--- a/libc/src/sched/linux/sched_getparam.cpp
+++ b/libc/src/sched/linux/sched_getparam.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sched/linux/sched_getscheduler.cpp b/libc/src/sched/linux/sched_getscheduler.cpp
index 545cda8e7484..d8e02967a633 100644
--- a/libc/src/sched/linux/sched_getscheduler.cpp
+++ b/libc/src/sched/linux/sched_getscheduler.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sched/linux/sched_rr_get_interval.cpp b/libc/src/sched/linux/sched_rr_get_interval.cpp
index 1f0ef69dfc89..5668d596bce1 100644
--- a/libc/src/sched/linux/sched_rr_get_interval.cpp
+++ b/libc/src/sched/linux/sched_rr_get_interval.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sched/linux/sched_setaffinity.cpp b/libc/src/sched/linux/sched_setaffinity.cpp
index cad48c26bf93..93e930dcf2e3 100644
--- a/libc/src/sched/linux/sched_setaffinity.cpp
+++ b/libc/src/sched/linux/sched_setaffinity.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sched.h>
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sched/linux/sched_setparam.cpp b/libc/src/sched/linux/sched_setparam.cpp
index e78e78a707e0..7875d9e2f19b 100644
--- a/libc/src/sched/linux/sched_setparam.cpp
+++ b/libc/src/sched/linux/sched_setparam.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sched/linux/sched_setscheduler.cpp b/libc/src/sched/linux/sched_setscheduler.cpp
index b6b6f667b3f9..232e5a59b185 100644
--- a/libc/src/sched/linux/sched_setscheduler.cpp
+++ b/libc/src/sched/linux/sched_setscheduler.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sched/linux/sched_yield.cpp b/libc/src/sched/linux/sched_yield.cpp
index 3de9d0ba3571..c1e9168f34d0 100644
--- a/libc/src/sched/linux/sched_yield.cpp
+++ b/libc/src/sched/linux/sched_yield.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/search/hcreate.cpp b/libc/src/search/hcreate.cpp
index ac816a902e22..68bdb29e51df 100644
--- a/libc/src/search/hcreate.cpp
+++ b/libc/src/search/hcreate.cpp
@@ -9,8 +9,8 @@
#include "src/search/hcreate.h"
#include "src/__support/HashTable/randomness.h"
#include "src/__support/HashTable/table.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/search/hsearch/global.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/search/hcreate_r.cpp b/libc/src/search/hcreate_r.cpp
index 17acd808c19a..c89be803b4e1 100644
--- a/libc/src/search/hcreate_r.cpp
+++ b/libc/src/search/hcreate_r.cpp
@@ -9,8 +9,8 @@
#include "src/search/hcreate_r.h"
#include "src/__support/HashTable/randomness.h"
#include "src/__support/HashTable/table.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(int, hcreate_r,
diff --git a/libc/src/search/hdestroy_r.cpp b/libc/src/search/hdestroy_r.cpp
index 7eff5bb6fff9..ba5476098be2 100644
--- a/libc/src/search/hdestroy_r.cpp
+++ b/libc/src/search/hdestroy_r.cpp
@@ -8,8 +8,8 @@
#include "src/search/hdestroy_r.h"
#include "src/__support/HashTable/table.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(void, hdestroy_r, (struct hsearch_data * htab)) {
diff --git a/libc/src/search/hsearch.cpp b/libc/src/search/hsearch.cpp
index c18b5d3d7f54..034333d17057 100644
--- a/libc/src/search/hsearch.cpp
+++ b/libc/src/search/hsearch.cpp
@@ -9,8 +9,8 @@
#include "src/search/hsearch.h"
#include "src/__support/HashTable/randomness.h"
#include "src/__support/HashTable/table.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/search/hsearch/global.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/search/hsearch_r.cpp b/libc/src/search/hsearch_r.cpp
index f93e608a190b..323001e1b103 100644
--- a/libc/src/search/hsearch_r.cpp
+++ b/libc/src/search/hsearch_r.cpp
@@ -8,8 +8,8 @@
#include "src/search/hsearch_r.h"
#include "src/__support/HashTable/table.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(int, hsearch_r,
diff --git a/libc/src/signal/linux/kill.cpp b/libc/src/signal/linux/kill.cpp
index ed117858f51e..0f5e88757acb 100644
--- a/libc/src/signal/linux/kill.cpp
+++ b/libc/src/signal/linux/kill.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/signal/linux/signal_utils.h"
#include <signal.h>
diff --git a/libc/src/signal/linux/sigaction.cpp b/libc/src/signal/linux/sigaction.cpp
index 65ec36741683..43a3e195474e 100644
--- a/libc/src/signal/linux/sigaction.cpp
+++ b/libc/src/signal/linux/sigaction.cpp
@@ -10,8 +10,8 @@
#include "hdr/types/sigset_t.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/signal/linux/signal_utils.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/signal/linux/sigaddset.cpp b/libc/src/signal/linux/sigaddset.cpp
index 628883e13b88..2091e8b51453 100644
--- a/libc/src/signal/linux/sigaddset.cpp
+++ b/libc/src/signal/linux/sigaddset.cpp
@@ -10,8 +10,8 @@
#include "hdr/types/sigset_t.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/signal/linux/signal_utils.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/signal/linux/sigaltstack.cpp b/libc/src/signal/linux/sigaltstack.cpp
index c19394cd1791..990b841c6d90 100644
--- a/libc/src/signal/linux/sigaltstack.cpp
+++ b/libc/src/signal/linux/sigaltstack.cpp
@@ -8,8 +8,8 @@
#include "src/signal/sigaltstack.h"
#include "hdr/types/stack_t.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/signal/linux/signal_utils.h"
#include "src/__support/common.h"
diff --git a/libc/src/signal/linux/sigdelset.cpp b/libc/src/signal/linux/sigdelset.cpp
index 2e964051ebde..6fce0d7a6e14 100644
--- a/libc/src/signal/linux/sigdelset.cpp
+++ b/libc/src/signal/linux/sigdelset.cpp
@@ -10,8 +10,8 @@
#include "hdr/types/sigset_t.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/signal/linux/signal_utils.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/signal/linux/sigemptyset.cpp b/libc/src/signal/linux/sigemptyset.cpp
index d347477695e6..034a9e2cbe15 100644
--- a/libc/src/signal/linux/sigemptyset.cpp
+++ b/libc/src/signal/linux/sigemptyset.cpp
@@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//
#include "src/signal/sigemptyset.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/signal/linux/signal_utils.h"
#include "src/__support/common.h"
diff --git a/libc/src/signal/linux/sigfillset.cpp b/libc/src/signal/linux/sigfillset.cpp
index 3e9897a03bb7..f0b499093b31 100644
--- a/libc/src/signal/linux/sigfillset.cpp
+++ b/libc/src/signal/linux/sigfillset.cpp
@@ -10,8 +10,8 @@
#include "hdr/types/sigset_t.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/signal/linux/signal_utils.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/signal/linux/sigprocmask.cpp b/libc/src/signal/linux/sigprocmask.cpp
index 8838379ae5d3..af3c424c5f34 100644
--- a/libc/src/signal/linux/sigprocmask.cpp
+++ b/libc/src/signal/linux/sigprocmask.cpp
@@ -11,8 +11,8 @@
#include "hdr/types/sigset_t.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/signal/linux/signal_utils.h"
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/spawn/posix_spawn_file_actions_addclose.cpp b/libc/src/spawn/posix_spawn_file_actions_addclose.cpp
index bb8504f655c4..9a575bd59163 100644
--- a/libc/src/spawn/posix_spawn_file_actions_addclose.cpp
+++ b/libc/src/spawn/posix_spawn_file_actions_addclose.cpp
@@ -11,8 +11,8 @@
#include "file_actions.h"
#include "src/__support/CPP/new.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <spawn.h>
diff --git a/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp b/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp
index 710063d52e74..1ad45ed942bb 100644
--- a/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp
+++ b/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp
@@ -11,8 +11,8 @@
#include "file_actions.h"
#include "src/__support/CPP/new.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <spawn.h>
diff --git a/libc/src/spawn/posix_spawn_file_actions_addopen.cpp b/libc/src/spawn/posix_spawn_file_actions_addopen.cpp
index 028d6e895f3c..9977fc2d0a21 100644
--- a/libc/src/spawn/posix_spawn_file_actions_addopen.cpp
+++ b/libc/src/spawn/posix_spawn_file_actions_addopen.cpp
@@ -11,8 +11,8 @@
#include "file_actions.h"
#include "src/__support/CPP/new.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <spawn.h>
diff --git a/libc/src/spawn/posix_spawn_file_actions_destroy.cpp b/libc/src/spawn/posix_spawn_file_actions_destroy.cpp
index 168118da249d..affd338005cf 100644
--- a/libc/src/spawn/posix_spawn_file_actions_destroy.cpp
+++ b/libc/src/spawn/posix_spawn_file_actions_destroy.cpp
@@ -12,8 +12,8 @@
#include "src/__support/CPP/new.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <spawn.h>
diff --git a/libc/src/stdio/fopencookie.cpp b/libc/src/stdio/fopencookie.cpp
index 9f5694e8e058..da8a132a4db6 100644
--- a/libc/src/stdio/fopencookie.cpp
+++ b/libc/src/stdio/fopencookie.cpp
@@ -14,8 +14,8 @@
#include "src/__support/CPP/new.h"
#include "src/__support/File/file.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/fclose.cpp b/libc/src/stdio/generic/fclose.cpp
index 388407a58d41..902b4cf97237 100644
--- a/libc/src/stdio/generic/fclose.cpp
+++ b/libc/src/stdio/generic/fclose.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/fflush.cpp b/libc/src/stdio/generic/fflush.cpp
index 5bdf71ad3594..d0271d9154c8 100644
--- a/libc/src/stdio/generic/fflush.cpp
+++ b/libc/src/stdio/generic/fflush.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/fgetc.cpp b/libc/src/stdio/generic/fgetc.cpp
index aa6660ca180c..e65ce2fda49b 100644
--- a/libc/src/stdio/generic/fgetc.cpp
+++ b/libc/src/stdio/generic/fgetc.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stddef.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/fgetc_unlocked.cpp b/libc/src/stdio/generic/fgetc_unlocked.cpp
index 34a27f1d1c42..5c07d4feb513 100644
--- a/libc/src/stdio/generic/fgetc_unlocked.cpp
+++ b/libc/src/stdio/generic/fgetc_unlocked.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stddef.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/fgets.cpp b/libc/src/stdio/generic/fgets.cpp
index de6474087a14..e0ad9b6e2f56 100644
--- a/libc/src/stdio/generic/fgets.cpp
+++ b/libc/src/stdio/generic/fgets.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stddef.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/fopen.cpp b/libc/src/stdio/generic/fopen.cpp
index d6e418bacf37..57c85c2e54e1 100644
--- a/libc/src/stdio/generic/fopen.cpp
+++ b/libc/src/stdio/generic/fopen.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/fputc.cpp b/libc/src/stdio/generic/fputc.cpp
index 54a38aeb2f1e..6639f0687c87 100644
--- a/libc/src/stdio/generic/fputc.cpp
+++ b/libc/src/stdio/generic/fputc.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stddef.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/fputs.cpp b/libc/src/stdio/generic/fputs.cpp
index 8aef7683b3ce..621b40f63c91 100644
--- a/libc/src/stdio/generic/fputs.cpp
+++ b/libc/src/stdio/generic/fputs.cpp
@@ -11,8 +11,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stddef.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/fread.cpp b/libc/src/stdio/generic/fread.cpp
index 3a04094ea8b4..1b576ec34688 100644
--- a/libc/src/stdio/generic/fread.cpp
+++ b/libc/src/stdio/generic/fread.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stddef.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/fread_unlocked.cpp b/libc/src/stdio/generic/fread_unlocked.cpp
index 151f43c6bbeb..257f1a212add 100644
--- a/libc/src/stdio/generic/fread_unlocked.cpp
+++ b/libc/src/stdio/generic/fread_unlocked.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stddef.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/fseek.cpp b/libc/src/stdio/generic/fseek.cpp
index 21820da18542..99191e7c4194 100644
--- a/libc/src/stdio/generic/fseek.cpp
+++ b/libc/src/stdio/generic/fseek.cpp
@@ -9,8 +9,8 @@
#include "src/stdio/fseek.h"
#include "src/__support/File/file.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/fseeko.cpp b/libc/src/stdio/generic/fseeko.cpp
index 7456b4a21907..afcfc71c7c09 100644
--- a/libc/src/stdio/generic/fseeko.cpp
+++ b/libc/src/stdio/generic/fseeko.cpp
@@ -9,8 +9,8 @@
#include "src/stdio/fseeko.h"
#include "src/__support/File/file.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/ftell.cpp b/libc/src/stdio/generic/ftell.cpp
index ec15ca4e96ca..b55a806007af 100644
--- a/libc/src/stdio/generic/ftell.cpp
+++ b/libc/src/stdio/generic/ftell.cpp
@@ -9,8 +9,8 @@
#include "src/stdio/ftell.h"
#include "src/__support/File/file.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/ftello.cpp b/libc/src/stdio/generic/ftello.cpp
index e3d0726ec484..91031cb7fad7 100644
--- a/libc/src/stdio/generic/ftello.cpp
+++ b/libc/src/stdio/generic/ftello.cpp
@@ -9,8 +9,8 @@
#include "src/stdio/ftello.h"
#include "src/__support/File/file.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/fwrite.cpp b/libc/src/stdio/generic/fwrite.cpp
index 66eb9a3c7185..b44ecb283811 100644
--- a/libc/src/stdio/generic/fwrite.cpp
+++ b/libc/src/stdio/generic/fwrite.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stddef.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/fwrite_unlocked.cpp b/libc/src/stdio/generic/fwrite_unlocked.cpp
index a0d9014cd68d..2f9ec26f2f80 100644
--- a/libc/src/stdio/generic/fwrite_unlocked.cpp
+++ b/libc/src/stdio/generic/fwrite_unlocked.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stddef.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/getc.cpp b/libc/src/stdio/generic/getc.cpp
index e988468898c5..0ac010ebc599 100644
--- a/libc/src/stdio/generic/getc.cpp
+++ b/libc/src/stdio/generic/getc.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stddef.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/getc_unlocked.cpp b/libc/src/stdio/generic/getc_unlocked.cpp
index 92d5092623ac..eee23a18d05d 100644
--- a/libc/src/stdio/generic/getc_unlocked.cpp
+++ b/libc/src/stdio/generic/getc_unlocked.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stddef.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/getchar.cpp b/libc/src/stdio/generic/getchar.cpp
index 371fc70eb214..87d24a2b1f09 100644
--- a/libc/src/stdio/generic/getchar.cpp
+++ b/libc/src/stdio/generic/getchar.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/getchar_unlocked.cpp b/libc/src/stdio/generic/getchar_unlocked.cpp
index b898f5cb2596..f321969483e3 100644
--- a/libc/src/stdio/generic/getchar_unlocked.cpp
+++ b/libc/src/stdio/generic/getchar_unlocked.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/putc.cpp b/libc/src/stdio/generic/putc.cpp
index b5f008fdce44..83bc3d4131e7 100644
--- a/libc/src/stdio/generic/putc.cpp
+++ b/libc/src/stdio/generic/putc.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stddef.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/putchar.cpp b/libc/src/stdio/generic/putchar.cpp
index e86df23d6716..2b3509e5e414 100644
--- a/libc/src/stdio/generic/putchar.cpp
+++ b/libc/src/stdio/generic/putchar.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stddef.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/generic/puts.cpp b/libc/src/stdio/generic/puts.cpp
index 7dbe2c79f920..4267dd546c4d 100644
--- a/libc/src/stdio/generic/puts.cpp
+++ b/libc/src/stdio/generic/puts.cpp
@@ -11,8 +11,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stddef.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/gpu/fprintf.cpp b/libc/src/stdio/gpu/fprintf.cpp
index 5b8f01d7d534..9877817d9209 100644
--- a/libc/src/stdio/gpu/fprintf.cpp
+++ b/libc/src/stdio/gpu/fprintf.cpp
@@ -12,7 +12,7 @@
#include "src/__support/CPP/string_view.h"
#include "src/__support/arg_list.h"
#include "src/__support/common.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/stdio/gpu/vfprintf_utils.h"
#include <stdarg.h>
diff --git a/libc/src/stdio/gpu/printf.cpp b/libc/src/stdio/gpu/printf.cpp
index 53fe69d5e2eb..8a9174d7397a 100644
--- a/libc/src/stdio/gpu/printf.cpp
+++ b/libc/src/stdio/gpu/printf.cpp
@@ -11,7 +11,7 @@
#include "src/__support/CPP/string_view.h"
#include "src/__support/arg_list.h"
#include "src/__support/common.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/stdio/gpu/vfprintf_utils.h"
#include <stdarg.h>
diff --git a/libc/src/stdio/linux/fdopen.cpp b/libc/src/stdio/linux/fdopen.cpp
index 7d72fdc88e9f..5623f06b7cff 100644
--- a/libc/src/stdio/linux/fdopen.cpp
+++ b/libc/src/stdio/linux/fdopen.cpp
@@ -9,8 +9,8 @@
#include "src/stdio/fdopen.h"
#include "src/__support/File/linux/file.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/linux/remove.cpp b/libc/src/stdio/linux/remove.cpp
index dbb4491d0e6c..ac755db0bc78 100644
--- a/libc/src/stdio/linux/remove.cpp
+++ b/libc/src/stdio/linux/remove.cpp
@@ -12,8 +12,8 @@
#include "src/__support/common.h"
#include "hdr/fcntl_macros.h" // For AT_* macros.
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/linux/rename.cpp b/libc/src/stdio/linux/rename.cpp
index fbcb29be48f4..426c8698e557 100644
--- a/libc/src/stdio/linux/rename.cpp
+++ b/libc/src/stdio/linux/rename.cpp
@@ -10,8 +10,8 @@
#include "hdr/fcntl_macros.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/printf_core/parser.h b/libc/src/stdio/printf_core/parser.h
index 89556f1a9e5f..cef9b1ae58fa 100644
--- a/libc/src/stdio/printf_core/parser.h
+++ b/libc/src/stdio/printf_core/parser.h
@@ -25,7 +25,7 @@
#include "src/__support/fixed_point/fx_rep.h"
#endif // LIBC_INTERNAL_PRINTF_HAS_FIXED_POINT
#ifndef LIBC_COPT_PRINTF_DISABLE_STRERROR
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#endif // LIBC_COPT_PRINTF_DISABLE_STRERROR
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/setbuf.cpp b/libc/src/stdio/setbuf.cpp
index f3db97de5837..fcc6df12ddb0 100644
--- a/libc/src/stdio/setbuf.cpp
+++ b/libc/src/stdio/setbuf.cpp
@@ -9,8 +9,8 @@
#include "src/stdio/setbuf.h"
#include "hdr/stdio_macros.h"
#include "src/__support/File/file.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdio/setvbuf.cpp b/libc/src/stdio/setvbuf.cpp
index 0a6b8cacb59c..9fc6cb040233 100644
--- a/libc/src/stdio/setvbuf.cpp
+++ b/libc/src/stdio/setvbuf.cpp
@@ -10,8 +10,8 @@
#include "src/__support/File/file.h"
#include "hdr/types/FILE.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stddef.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdlib/atof.cpp b/libc/src/stdlib/atof.cpp
index 18a65c67705d..d0d8d211dea8 100644
--- a/libc/src/stdlib/atof.cpp
+++ b/libc/src/stdlib/atof.cpp
@@ -8,9 +8,9 @@
#include "src/stdlib/atof.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_float.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdlib/atoi.cpp b/libc/src/stdlib/atoi.cpp
index 9e46b53b1aa0..420bbc8143d5 100644
--- a/libc/src/stdlib/atoi.cpp
+++ b/libc/src/stdlib/atoi.cpp
@@ -8,9 +8,9 @@
#include "src/stdlib/atoi.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_integer.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdlib/atol.cpp b/libc/src/stdlib/atol.cpp
index 7f3414a4afdd..e1110ffa449b 100644
--- a/libc/src/stdlib/atol.cpp
+++ b/libc/src/stdlib/atol.cpp
@@ -8,9 +8,9 @@
#include "src/stdlib/atol.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_integer.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdlib/atoll.cpp b/libc/src/stdlib/atoll.cpp
index 4f1a02ad8315..063e817f9b79 100644
--- a/libc/src/stdlib/atoll.cpp
+++ b/libc/src/stdlib/atoll.cpp
@@ -8,9 +8,9 @@
#include "src/stdlib/atoll.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_integer.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdlib/strtod.cpp b/libc/src/stdlib/strtod.cpp
index 2c6819163aa4..deb2390c7fcd 100644
--- a/libc/src/stdlib/strtod.cpp
+++ b/libc/src/stdlib/strtod.cpp
@@ -8,9 +8,9 @@
#include "src/stdlib/strtod.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_float.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdlib/strtod_l.cpp b/libc/src/stdlib/strtod_l.cpp
index 247314398315..ad333b32d240 100644
--- a/libc/src/stdlib/strtod_l.cpp
+++ b/libc/src/stdlib/strtod_l.cpp
@@ -8,9 +8,9 @@
#include "src/stdlib/strtod_l.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_float.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdlib/strtof.cpp b/libc/src/stdlib/strtof.cpp
index 351bf64ad4f7..fc52dc85ffc5 100644
--- a/libc/src/stdlib/strtof.cpp
+++ b/libc/src/stdlib/strtof.cpp
@@ -8,9 +8,9 @@
#include "src/stdlib/strtof.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_float.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdlib/strtof_l.cpp b/libc/src/stdlib/strtof_l.cpp
index d54efa66e084..c6e03ff51fa2 100644
--- a/libc/src/stdlib/strtof_l.cpp
+++ b/libc/src/stdlib/strtof_l.cpp
@@ -8,9 +8,9 @@
#include "src/stdlib/strtof_l.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_float.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdlib/strtol.cpp b/libc/src/stdlib/strtol.cpp
index 77f8712d7c13..42db36b2052b 100644
--- a/libc/src/stdlib/strtol.cpp
+++ b/libc/src/stdlib/strtol.cpp
@@ -8,9 +8,9 @@
#include "src/stdlib/strtol.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_integer.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdlib/strtol_l.cpp b/libc/src/stdlib/strtol_l.cpp
index f94aff1a0d7b..497a4403eff4 100644
--- a/libc/src/stdlib/strtol_l.cpp
+++ b/libc/src/stdlib/strtol_l.cpp
@@ -8,9 +8,9 @@
#include "src/stdlib/strtol_l.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_integer.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdlib/strtold.cpp b/libc/src/stdlib/strtold.cpp
index 88d29c9f3627..44046c2c6f61 100644
--- a/libc/src/stdlib/strtold.cpp
+++ b/libc/src/stdlib/strtold.cpp
@@ -8,9 +8,9 @@
#include "src/stdlib/strtold.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_float.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdlib/strtold_l.cpp b/libc/src/stdlib/strtold_l.cpp
index d0c57f50246b..c3af30a1b9ec 100644
--- a/libc/src/stdlib/strtold_l.cpp
+++ b/libc/src/stdlib/strtold_l.cpp
@@ -8,9 +8,9 @@
#include "src/stdlib/strtold_l.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_float.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdlib/strtoll.cpp b/libc/src/stdlib/strtoll.cpp
index 8d1b3efdcf87..c1dca13112e0 100644
--- a/libc/src/stdlib/strtoll.cpp
+++ b/libc/src/stdlib/strtoll.cpp
@@ -8,9 +8,9 @@
#include "src/stdlib/strtoll.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_integer.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdlib/strtoll_l.cpp b/libc/src/stdlib/strtoll_l.cpp
index e82971d59c48..6f30d7794c5c 100644
--- a/libc/src/stdlib/strtoll_l.cpp
+++ b/libc/src/stdlib/strtoll_l.cpp
@@ -8,9 +8,9 @@
#include "src/stdlib/strtoll_l.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_integer.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdlib/strtoul.cpp b/libc/src/stdlib/strtoul.cpp
index 1d832318c448..d26ca5e5a10a 100644
--- a/libc/src/stdlib/strtoul.cpp
+++ b/libc/src/stdlib/strtoul.cpp
@@ -8,9 +8,9 @@
#include "src/stdlib/strtoul.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_integer.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdlib/strtoul_l.cpp b/libc/src/stdlib/strtoul_l.cpp
index 74fce00a0ac3..9a875ddee902 100644
--- a/libc/src/stdlib/strtoul_l.cpp
+++ b/libc/src/stdlib/strtoul_l.cpp
@@ -8,9 +8,9 @@
#include "src/stdlib/strtoul_l.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_integer.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdlib/strtoull.cpp b/libc/src/stdlib/strtoull.cpp
index dba22611cfb0..8f929f577311 100644
--- a/libc/src/stdlib/strtoull.cpp
+++ b/libc/src/stdlib/strtoull.cpp
@@ -8,9 +8,9 @@
#include "src/stdlib/strtoull.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_integer.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/stdlib/strtoull_l.cpp b/libc/src/stdlib/strtoull_l.cpp
index 2ea8a43a40ef..9eb056b0e59b 100644
--- a/libc/src/stdlib/strtoull_l.cpp
+++ b/libc/src/stdlib/strtoull_l.cpp
@@ -8,9 +8,9 @@
#include "src/stdlib/strtoull_l.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_integer.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/string/strdup.cpp b/libc/src/string/strdup.cpp
index 4cf4173a27bf..dab0ab4288c9 100644
--- a/libc/src/string/strdup.cpp
+++ b/libc/src/string/strdup.cpp
@@ -8,8 +8,8 @@
#include "src/string/strdup.h"
#include "hdr/stdlib_macros.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/string/allocating_string_utils.h"
#include "src/string/memory_utils/inline_memcpy.h"
diff --git a/libc/src/sys/auxv/linux/getauxval.cpp b/libc/src/sys/auxv/linux/getauxval.cpp
index 236fd25698f6..f3ae7c5c4e07 100644
--- a/libc/src/sys/auxv/linux/getauxval.cpp
+++ b/libc/src/sys/auxv/linux/getauxval.cpp
@@ -9,8 +9,8 @@
#include "src/sys/auxv/getauxval.h"
#include "config/app.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <linux/auxvec.h>
// for guarded initialization
diff --git a/libc/src/sys/epoll/linux/epoll_create.cpp b/libc/src/sys/epoll/linux/epoll_create.cpp
index 7196ac7410c3..2e44e883ddf0 100644
--- a/libc/src/sys/epoll/linux/epoll_create.cpp
+++ b/libc/src/sys/epoll/linux/epoll_create.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/epoll/linux/epoll_create1.cpp b/libc/src/sys/epoll/linux/epoll_create1.cpp
index efff282e2714..3c60090fb7b4 100644
--- a/libc/src/sys/epoll/linux/epoll_create1.cpp
+++ b/libc/src/sys/epoll/linux/epoll_create1.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/epoll/linux/epoll_ctl.cpp b/libc/src/sys/epoll/linux/epoll_ctl.cpp
index 5f7dbb77b1e5..079bd60403b0 100644
--- a/libc/src/sys/epoll/linux/epoll_ctl.cpp
+++ b/libc/src/sys/epoll/linux/epoll_ctl.cpp
@@ -11,8 +11,8 @@
#include "hdr/types/struct_epoll_event.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/epoll/linux/epoll_pwait.cpp b/libc/src/sys/epoll/linux/epoll_pwait.cpp
index d7836549928c..24fd1dbdc467 100644
--- a/libc/src/sys/epoll/linux/epoll_pwait.cpp
+++ b/libc/src/sys/epoll/linux/epoll_pwait.cpp
@@ -13,9 +13,9 @@
#include "hdr/types/struct_epoll_event.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/sanitizer.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sys/epoll/linux/epoll_pwait2.cpp b/libc/src/sys/epoll/linux/epoll_pwait2.cpp
index 14b419399fe9..219984528efd 100644
--- a/libc/src/sys/epoll/linux/epoll_pwait2.cpp
+++ b/libc/src/sys/epoll/linux/epoll_pwait2.cpp
@@ -14,9 +14,9 @@
#include "hdr/types/struct_timespec.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/sanitizer.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sys/epoll/linux/epoll_wait.cpp b/libc/src/sys/epoll/linux/epoll_wait.cpp
index 1a63be5e260f..7fae7b55992f 100644
--- a/libc/src/sys/epoll/linux/epoll_wait.cpp
+++ b/libc/src/sys/epoll/linux/epoll_wait.cpp
@@ -13,9 +13,9 @@
#include "hdr/types/struct_epoll_event.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/sanitizer.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sys/mman/linux/madvise.cpp b/libc/src/sys/mman/linux/madvise.cpp
index 332d6c2db4ac..1bb284f62b89 100644
--- a/libc/src/sys/mman/linux/madvise.cpp
+++ b/libc/src/sys/mman/linux/madvise.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/mman/linux/mincore.cpp b/libc/src/sys/mman/linux/mincore.cpp
index b5436fda3853..d583f1ef85f3 100644
--- a/libc/src/sys/mman/linux/mincore.cpp
+++ b/libc/src/sys/mman/linux/mincore.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/mman/linux/mlock.cpp b/libc/src/sys/mman/linux/mlock.cpp
index be7eb28e29c4..8582eb7c0063 100644
--- a/libc/src/sys/mman/linux/mlock.cpp
+++ b/libc/src/sys/mman/linux/mlock.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/mman/linux/mlock2.cpp b/libc/src/sys/mman/linux/mlock2.cpp
index 7bc557f9bf58..955cfe128de7 100644
--- a/libc/src/sys/mman/linux/mlock2.cpp
+++ b/libc/src/sys/mman/linux/mlock2.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/mman/linux/mlockall.cpp b/libc/src/sys/mman/linux/mlockall.cpp
index eae3a9ea0a18..c3502fbb3af3 100644
--- a/libc/src/sys/mman/linux/mlockall.cpp
+++ b/libc/src/sys/mman/linux/mlockall.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/mman/linux/mmap.cpp b/libc/src/sys/mman/linux/mmap.cpp
index ee9a0a32e8f5..33f9fe8ff370 100644
--- a/libc/src/sys/mman/linux/mmap.cpp
+++ b/libc/src/sys/mman/linux/mmap.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <linux/param.h> // For EXEC_PAGESIZE.
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sys/mman/linux/mprotect.cpp b/libc/src/sys/mman/linux/mprotect.cpp
index e2351028e2c7..6b14915b60c9 100644
--- a/libc/src/sys/mman/linux/mprotect.cpp
+++ b/libc/src/sys/mman/linux/mprotect.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/mman/linux/mremap.cpp b/libc/src/sys/mman/linux/mremap.cpp
index 38bcfce833d3..6cdda9435bb6 100644
--- a/libc/src/sys/mman/linux/mremap.cpp
+++ b/libc/src/sys/mman/linux/mremap.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <linux/param.h> // For EXEC_PAGESIZE.
#include <stdarg.h>
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sys/mman/linux/msync.cpp b/libc/src/sys/mman/linux/msync.cpp
index e2b4f81d616a..650678bcb36e 100644
--- a/libc/src/sys/mman/linux/msync.cpp
+++ b/libc/src/sys/mman/linux/msync.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/mman/linux/munlock.cpp b/libc/src/sys/mman/linux/munlock.cpp
index 93c25f844c6e..9638949f5fcb 100644
--- a/libc/src/sys/mman/linux/munlock.cpp
+++ b/libc/src/sys/mman/linux/munlock.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/mman/linux/munlockall.cpp b/libc/src/sys/mman/linux/munlockall.cpp
index f5911cb01bc2..f47eaece178e 100644
--- a/libc/src/sys/mman/linux/munlockall.cpp
+++ b/libc/src/sys/mman/linux/munlockall.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/mman/linux/munmap.cpp b/libc/src/sys/mman/linux/munmap.cpp
index 9c01b15ac8dc..61b1f1549dd1 100644
--- a/libc/src/sys/mman/linux/munmap.cpp
+++ b/libc/src/sys/mman/linux/munmap.cpp
@@ -11,9 +11,9 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
-#include <sys/syscall.h> // For syscall numbers.
+#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/mman/linux/remap_file_pages.cpp b/libc/src/sys/mman/linux/remap_file_pages.cpp
index f616e1915ecc..58ae4017f628 100644
--- a/libc/src/sys/mman/linux/remap_file_pages.cpp
+++ b/libc/src/sys/mman/linux/remap_file_pages.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/mman/linux/shm_common.h b/libc/src/sys/mman/linux/shm_common.h
index ce75c2b5b699..69911012ff7e 100644
--- a/libc/src/sys/mman/linux/shm_common.h
+++ b/libc/src/sys/mman/linux/shm_common.h
@@ -9,8 +9,8 @@
#include "src/__support/CPP/array.h"
#include "src/__support/CPP/optional.h"
#include "src/__support/CPP/string_view.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/string/memory_utils/inline_memcpy.h"
// TODO: Get PATH_MAX via https://github.com/llvm/llvm-project/issues/85121
diff --git a/libc/src/sys/prctl/linux/prctl.cpp b/libc/src/sys/prctl/linux/prctl.cpp
index 5d4e9046b877..c726b0a53959 100644
--- a/libc/src/sys/prctl/linux/prctl.cpp
+++ b/libc/src/sys/prctl/linux/prctl.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/random/linux/getrandom.cpp b/libc/src/sys/random/linux/getrandom.cpp
index 9a8869a2d6d3..0b8471ed8b37 100644
--- a/libc/src/sys/random/linux/getrandom.cpp
+++ b/libc/src/sys/random/linux/getrandom.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/resource/linux/getrlimit.cpp b/libc/src/sys/resource/linux/getrlimit.cpp
index 30c2e91b036d..d27213419494 100644
--- a/libc/src/sys/resource/linux/getrlimit.cpp
+++ b/libc/src/sys/resource/linux/getrlimit.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/resource.h> // For struct rlimit
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sys/resource/linux/setrlimit.cpp b/libc/src/sys/resource/linux/setrlimit.cpp
index 85f07900aaef..300bad75baa6 100644
--- a/libc/src/sys/resource/linux/setrlimit.cpp
+++ b/libc/src/sys/resource/linux/setrlimit.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/resource.h> // For struct rlimit
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sys/select/linux/select.cpp b/libc/src/sys/select/linux/select.cpp
index 9ccb1e95f275..6c434eb58459 100644
--- a/libc/src/sys/select/linux/select.cpp
+++ b/libc/src/sys/select/linux/select.cpp
@@ -13,8 +13,8 @@
#include "src/__support/CPP/limits.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stddef.h> // For size_t
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sys/sendfile/linux/sendfile.cpp b/libc/src/sys/sendfile/linux/sendfile.cpp
index 9d4174cb8c91..ec892323def5 100644
--- a/libc/src/sys/sendfile/linux/sendfile.cpp
+++ b/libc/src/sys/sendfile/linux/sendfile.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/sendfile.h>
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sys/socket/linux/bind.cpp b/libc/src/sys/socket/linux/bind.cpp
index 72a3307a91dd..83a3d06f5380 100644
--- a/libc/src/sys/socket/linux/bind.cpp
+++ b/libc/src/sys/socket/linux/bind.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <linux/net.h> // For SYS_SOCKET socketcall number.
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sys/socket/linux/recv.cpp b/libc/src/sys/socket/linux/recv.cpp
index 5e9f2d3233fc..baf4de1b5eb5 100644
--- a/libc/src/sys/socket/linux/recv.cpp
+++ b/libc/src/sys/socket/linux/recv.cpp
@@ -16,8 +16,8 @@
#include "hdr/types/struct_sockaddr.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/sanitizer.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/socket/linux/recvfrom.cpp b/libc/src/sys/socket/linux/recvfrom.cpp
index 574e65f64a54..3d8397b478cc 100644
--- a/libc/src/sys/socket/linux/recvfrom.cpp
+++ b/libc/src/sys/socket/linux/recvfrom.cpp
@@ -16,8 +16,8 @@
#include "hdr/types/struct_sockaddr.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/sanitizer.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/socket/linux/recvmsg.cpp b/libc/src/sys/socket/linux/recvmsg.cpp
index e42b6346f330..bc6d072dbf9a 100644
--- a/libc/src/sys/socket/linux/recvmsg.cpp
+++ b/libc/src/sys/socket/linux/recvmsg.cpp
@@ -15,8 +15,8 @@
#include "hdr/types/struct_msghdr.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/sanitizer.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/socket/linux/send.cpp b/libc/src/sys/socket/linux/send.cpp
index cb3b4d5a9ece..43b01e7e6e0f 100644
--- a/libc/src/sys/socket/linux/send.cpp
+++ b/libc/src/sys/socket/linux/send.cpp
@@ -16,7 +16,7 @@
#include "hdr/types/struct_sockaddr.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/socket/linux/sendmsg.cpp b/libc/src/sys/socket/linux/sendmsg.cpp
index b4d9c9deda02..b04783ebfe7e 100644
--- a/libc/src/sys/socket/linux/sendmsg.cpp
+++ b/libc/src/sys/socket/linux/sendmsg.cpp
@@ -15,7 +15,7 @@
#include "hdr/types/struct_msghdr.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/socket/linux/sendto.cpp b/libc/src/sys/socket/linux/sendto.cpp
index 2fada192b086..9dda127f872d 100644
--- a/libc/src/sys/socket/linux/sendto.cpp
+++ b/libc/src/sys/socket/linux/sendto.cpp
@@ -16,7 +16,7 @@
#include "hdr/types/struct_sockaddr.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/socket/linux/socket.cpp b/libc/src/sys/socket/linux/socket.cpp
index 3e6df4d487a5..69eb6cfa01ce 100644
--- a/libc/src/sys/socket/linux/socket.cpp
+++ b/libc/src/sys/socket/linux/socket.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <linux/net.h> // For SYS_SOCKET socketcall number.
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sys/socket/linux/socketpair.cpp b/libc/src/sys/socket/linux/socketpair.cpp
index 60612ac04d61..7ea8ca46cee5 100644
--- a/libc/src/sys/socket/linux/socketpair.cpp
+++ b/libc/src/sys/socket/linux/socketpair.cpp
@@ -10,9 +10,9 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/sanitizer.h"
-#include "src/errno/libc_errno.h"
#include <linux/net.h> // For SYS_SOCKET socketcall number.
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sys/stat/linux/chmod.cpp b/libc/src/sys/stat/linux/chmod.cpp
index 1b787e47e7c6..2bd0788ec1df 100644
--- a/libc/src/sys/stat/linux/chmod.cpp
+++ b/libc/src/sys/stat/linux/chmod.cpp
@@ -13,8 +13,8 @@
#include "hdr/fcntl_macros.h"
#include "hdr/types/mode_t.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/stat.h>
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sys/stat/linux/fchmod.cpp b/libc/src/sys/stat/linux/fchmod.cpp
index 0d6fd359169a..3dadfdd1d943 100644
--- a/libc/src/sys/stat/linux/fchmod.cpp
+++ b/libc/src/sys/stat/linux/fchmod.cpp
@@ -12,8 +12,8 @@
#include "src/__support/common.h"
#include "hdr/types/mode_t.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/stat.h>
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sys/stat/linux/fchmodat.cpp b/libc/src/sys/stat/linux/fchmodat.cpp
index e76db4d160fb..add2192a558a 100644
--- a/libc/src/sys/stat/linux/fchmodat.cpp
+++ b/libc/src/sys/stat/linux/fchmodat.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/stat.h>
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sys/stat/linux/fstat.cpp b/libc/src/sys/stat/linux/fstat.cpp
index 35cf8f08f782..dea002c5e12a 100644
--- a/libc/src/sys/stat/linux/fstat.cpp
+++ b/libc/src/sys/stat/linux/fstat.cpp
@@ -8,8 +8,8 @@
#include "src/sys/stat/fstat.h"
#include "kernel_statx.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/__support/common.h"
diff --git a/libc/src/sys/stat/linux/lstat.cpp b/libc/src/sys/stat/linux/lstat.cpp
index 354c5b6e029a..5601dd5d78a9 100644
--- a/libc/src/sys/stat/linux/lstat.cpp
+++ b/libc/src/sys/stat/linux/lstat.cpp
@@ -8,8 +8,8 @@
#include "src/sys/stat/lstat.h"
#include "kernel_statx.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
diff --git a/libc/src/sys/stat/linux/mkdir.cpp b/libc/src/sys/stat/linux/mkdir.cpp
index b319b5c8393d..0829ff4f9432 100644
--- a/libc/src/sys/stat/linux/mkdir.cpp
+++ b/libc/src/sys/stat/linux/mkdir.cpp
@@ -13,8 +13,8 @@
#include "hdr/fcntl_macros.h"
#include "hdr/types/mode_t.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/stat.h>
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sys/stat/linux/mkdirat.cpp b/libc/src/sys/stat/linux/mkdirat.cpp
index 097fc158010d..8f4194dc3275 100644
--- a/libc/src/sys/stat/linux/mkdirat.cpp
+++ b/libc/src/sys/stat/linux/mkdirat.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/stat.h>
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/sys/stat/linux/stat.cpp b/libc/src/sys/stat/linux/stat.cpp
index de9cdb197d68..5553eaf00be2 100644
--- a/libc/src/sys/stat/linux/stat.cpp
+++ b/libc/src/sys/stat/linux/stat.cpp
@@ -8,8 +8,8 @@
#include "src/sys/stat/stat.h"
#include "kernel_statx.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/__support/common.h"
diff --git a/libc/src/sys/statvfs/linux/statfs_utils.h b/libc/src/sys/statvfs/linux/statfs_utils.h
index 1e5be5153101..8ee4de288ef6 100644
--- a/libc/src/sys/statvfs/linux/statfs_utils.h
+++ b/libc/src/sys/statvfs/linux/statfs_utils.h
@@ -12,9 +12,9 @@
#include "include/llvm-libc-types/struct_statvfs.h"
#include "src/__support/CPP/optional.h"
#include "src/__support/OSUtil/syscall.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <asm/statfs.h>
#include <sys/syscall.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/time/linux/getitimer.cpp b/libc/src/sys/time/linux/getitimer.cpp
index fec06aa4086e..b87406679694 100644
--- a/libc/src/sys/time/linux/getitimer.cpp
+++ b/libc/src/sys/time/linux/getitimer.cpp
@@ -10,7 +10,7 @@
#include "hdr/types/struct_itimerval.h"
#include "src/__support/OSUtil/syscall.h"
#include "src/__support/common.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include <sys/syscall.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/time/linux/setitimer.cpp b/libc/src/sys/time/linux/setitimer.cpp
index def04a474011..1de0d4329776 100644
--- a/libc/src/sys/time/linux/setitimer.cpp
+++ b/libc/src/sys/time/linux/setitimer.cpp
@@ -9,7 +9,7 @@
#include "hdr/types/struct_itimerval.h"
#include "src/__support/OSUtil/syscall.h"
#include "src/__support/common.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include <sys/syscall.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/time/linux/utimes.cpp b/libc/src/sys/time/linux/utimes.cpp
index 76b69937a5f4..ed37b42aedf6 100644
--- a/libc/src/sys/time/linux/utimes.cpp
+++ b/libc/src/sys/time/linux/utimes.cpp
@@ -15,7 +15,7 @@
#include "src/__support/OSUtil/syscall.h"
#include "src/__support/common.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include <sys/syscall.h>
diff --git a/libc/src/sys/uio/linux/readv.cpp b/libc/src/sys/uio/linux/readv.cpp
index f1393a9749be..c9d8d87ddc72 100644
--- a/libc/src/sys/uio/linux/readv.cpp
+++ b/libc/src/sys/uio/linux/readv.cpp
@@ -10,7 +10,7 @@
#include "hdr/types/struct_iovec.h"
#include "src/__support/OSUtil/syscall.h"
#include "src/__support/common.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include <sys/syscall.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/uio/linux/writev.cpp b/libc/src/sys/uio/linux/writev.cpp
index 8992bed95c98..b0b9e1520792 100644
--- a/libc/src/sys/uio/linux/writev.cpp
+++ b/libc/src/sys/uio/linux/writev.cpp
@@ -10,7 +10,7 @@
#include "hdr/types/struct_iovec.h"
#include "src/__support/OSUtil/syscall.h"
#include "src/__support/common.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include <sys/syscall.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/sys/utsname/linux/uname.cpp b/libc/src/sys/utsname/linux/uname.cpp
index 7bb227e801e3..b47ba964faf0 100644
--- a/libc/src/sys/utsname/linux/uname.cpp
+++ b/libc/src/sys/utsname/linux/uname.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
#include <sys/utsname.h>
diff --git a/libc/src/sys/wait/wait4Impl.h b/libc/src/sys/wait/wait4Impl.h
index f2bdeb02f866..77ed3ad22f14 100644
--- a/libc/src/sys/wait/wait4Impl.h
+++ b/libc/src/sys/wait/wait4Impl.h
@@ -12,8 +12,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
#include "src/__support/error_or.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <signal.h>
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/termios/linux/cfsetispeed.cpp b/libc/src/termios/linux/cfsetispeed.cpp
index 9656b714a8ed..47b19974d21b 100644
--- a/libc/src/termios/linux/cfsetispeed.cpp
+++ b/libc/src/termios/linux/cfsetispeed.cpp
@@ -9,8 +9,8 @@
#include "src/termios/cfsetispeed.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <termios.h>
diff --git a/libc/src/termios/linux/cfsetospeed.cpp b/libc/src/termios/linux/cfsetospeed.cpp
index 6130d266dbff..d2f138257a47 100644
--- a/libc/src/termios/linux/cfsetospeed.cpp
+++ b/libc/src/termios/linux/cfsetospeed.cpp
@@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//
#include "src/termios/cfsetospeed.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/__support/common.h"
diff --git a/libc/src/termios/linux/tcdrain.cpp b/libc/src/termios/linux/tcdrain.cpp
index 116e3f0e0cbc..570b15c24fe7 100644
--- a/libc/src/termios/linux/tcdrain.cpp
+++ b/libc/src/termios/linux/tcdrain.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <asm/ioctls.h> // Safe to include without the risk of name pollution.
#include <sys/syscall.h> // For syscall numbers
diff --git a/libc/src/termios/linux/tcflow.cpp b/libc/src/termios/linux/tcflow.cpp
index d229230b5d13..714ef6aa7129 100644
--- a/libc/src/termios/linux/tcflow.cpp
+++ b/libc/src/termios/linux/tcflow.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <asm/ioctls.h> // Safe to include without the risk of name pollution.
#include <sys/syscall.h> // For syscall numbers
diff --git a/libc/src/termios/linux/tcflush.cpp b/libc/src/termios/linux/tcflush.cpp
index 028a5414b196..4c7b9fadc446 100644
--- a/libc/src/termios/linux/tcflush.cpp
+++ b/libc/src/termios/linux/tcflush.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <asm/ioctls.h> // Safe to include without the risk of name pollution.
#include <sys/syscall.h> // For syscall numbers
diff --git a/libc/src/termios/linux/tcgetattr.cpp b/libc/src/termios/linux/tcgetattr.cpp
index 63c096ff88eb..2e768269c874 100644
--- a/libc/src/termios/linux/tcgetattr.cpp
+++ b/libc/src/termios/linux/tcgetattr.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <asm/ioctls.h> // Safe to include without the risk of name pollution.
#include <sys/syscall.h> // For syscall numbers
diff --git a/libc/src/termios/linux/tcgetsid.cpp b/libc/src/termios/linux/tcgetsid.cpp
index c283d0e4fda9..7487816cf274 100644
--- a/libc/src/termios/linux/tcgetsid.cpp
+++ b/libc/src/termios/linux/tcgetsid.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <asm/ioctls.h> // Safe to include without the risk of name pollution.
#include <sys/syscall.h> // For syscall numbers
diff --git a/libc/src/termios/linux/tcsendbreak.cpp b/libc/src/termios/linux/tcsendbreak.cpp
index 30bc91cf3de0..1d546c1d5953 100644
--- a/libc/src/termios/linux/tcsendbreak.cpp
+++ b/libc/src/termios/linux/tcsendbreak.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <asm/ioctls.h> // Safe to include without the risk of name pollution.
#include <sys/syscall.h> // For syscall numbers
diff --git a/libc/src/termios/linux/tcsetattr.cpp b/libc/src/termios/linux/tcsetattr.cpp
index 8aa1e5c57b34..8a2c7290217b 100644
--- a/libc/src/termios/linux/tcsetattr.cpp
+++ b/libc/src/termios/linux/tcsetattr.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <asm/ioctls.h> // Safe to include without the risk of name pollution.
#include <sys/syscall.h> // For syscall numbers
diff --git a/libc/src/threads/thrd_create.cpp b/libc/src/threads/thrd_create.cpp
index 4680944c2eee..67e22e72fd0e 100644
--- a/libc/src/threads/thrd_create.cpp
+++ b/libc/src/threads/thrd_create.cpp
@@ -8,9 +8,9 @@
#include "src/threads/thrd_create.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/threads/thread.h"
-#include "src/errno/libc_errno.h"
#include <threads.h> // For thrd_* type definitions.
diff --git a/libc/src/time/linux/clock.cpp b/libc/src/time/linux/clock.cpp
index ee4fa82b4f89..c38697cd0668 100644
--- a/libc/src/time/linux/clock.cpp
+++ b/libc/src/time/linux/clock.cpp
@@ -10,10 +10,10 @@
#include "hdr/time_macros.h"
#include "src/__support/CPP/limits.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/time/clock_gettime.h"
#include "src/__support/time/units.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/time/linux/clock_gettime.cpp b/libc/src/time/linux/clock_gettime.cpp
index 743c644d65d0..b3fcd2b22f9d 100644
--- a/libc/src/time/linux/clock_gettime.cpp
+++ b/libc/src/time/linux/clock_gettime.cpp
@@ -8,9 +8,9 @@
#include "src/time/clock_gettime.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/time/clock_gettime.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/time/linux/gettimeofday.cpp b/libc/src/time/linux/gettimeofday.cpp
index e8ddf482fc98..237b05903c70 100644
--- a/libc/src/time/linux/gettimeofday.cpp
+++ b/libc/src/time/linux/gettimeofday.cpp
@@ -10,10 +10,10 @@
#include "hdr/time_macros.h"
#include "hdr/types/suseconds_t.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/time/clock_gettime.h"
#include "src/__support/time/units.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/time/linux/nanosleep.cpp b/libc/src/time/linux/nanosleep.cpp
index 7a856376ffb2..6b9704126a0a 100644
--- a/libc/src/time/linux/nanosleep.cpp
+++ b/libc/src/time/linux/nanosleep.cpp
@@ -10,8 +10,8 @@
#include "hdr/time_macros.h"
#include "src/__support/OSUtil/syscall.h" // For syscall functions.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stdint.h> // For int64_t.
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/time/linux/timespec_get.cpp b/libc/src/time/linux/timespec_get.cpp
index cf5174523aa4..a4d437233273 100644
--- a/libc/src/time/linux/timespec_get.cpp
+++ b/libc/src/time/linux/timespec_get.cpp
@@ -9,9 +9,9 @@
#include "src/time/timespec_get.h"
#include "hdr/time_macros.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/time/clock_gettime.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/time/time.cpp b/libc/src/time/time.cpp
index 860909af7488..2a81f0182c31 100644
--- a/libc/src/time/time.cpp
+++ b/libc/src/time/time.cpp
@@ -10,9 +10,9 @@
#include "hdr/time_macros.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/time/clock_gettime.h"
-#include "src/errno/libc_errno.h"
namespace LIBC_NAMESPACE_DECL {
// avoid inconsitent clang-format behavior
diff --git a/libc/src/time/time_utils.h b/libc/src/time/time_utils.h
index bbbb1c08a475..0541c24ece82 100644
--- a/libc/src/time/time_utils.h
+++ b/libc/src/time/time_utils.h
@@ -15,8 +15,8 @@
#include "src/__support/CPP/optional.h"
#include "src/__support/CPP/string_view.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "time_constants.h"
#include <stdint.h>
diff --git a/libc/src/time/windows/clock_getres.cpp b/libc/src/time/windows/clock_getres.cpp
index b8c0c82aa641..969bb66be2d2 100644
--- a/libc/src/time/windows/clock_getres.cpp
+++ b/libc/src/time/windows/clock_getres.cpp
@@ -13,10 +13,10 @@
#include "src/__support/CPP/limits.h"
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/optimization.h"
#include "src/__support/time/units.h"
#include "src/__support/time/windows/performance_counter.h"
-#include "src/errno/libc_errno.h"
#include "src/time/clock_getres.h"
#define WIN32_LEAN_AND_MEAN
diff --git a/libc/src/unistd/linux/access.cpp b/libc/src/unistd/linux/access.cpp
index 2f7ebbcdf9e8..55cd6adca779 100644
--- a/libc/src/unistd/linux/access.cpp
+++ b/libc/src/unistd/linux/access.cpp
@@ -12,8 +12,8 @@
#include "src/__support/common.h"
#include "hdr/fcntl_macros.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/chdir.cpp b/libc/src/unistd/linux/chdir.cpp
index a30d1dc883be..04ba509b49a5 100644
--- a/libc/src/unistd/linux/chdir.cpp
+++ b/libc/src/unistd/linux/chdir.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/close.cpp b/libc/src/unistd/linux/close.cpp
index 58d42a9673fb..b5842f2b64d2 100644
--- a/libc/src/unistd/linux/close.cpp
+++ b/libc/src/unistd/linux/close.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/dup.cpp b/libc/src/unistd/linux/dup.cpp
index c1710a37f611..81d30c6cdbc4 100644
--- a/libc/src/unistd/linux/dup.cpp
+++ b/libc/src/unistd/linux/dup.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/dup2.cpp b/libc/src/unistd/linux/dup2.cpp
index 7ffc151a053c..0a0e86573b34 100644
--- a/libc/src/unistd/linux/dup2.cpp
+++ b/libc/src/unistd/linux/dup2.cpp
@@ -12,8 +12,8 @@
#include "src/__support/common.h"
#include "hdr/fcntl_macros.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/dup3.cpp b/libc/src/unistd/linux/dup3.cpp
index c096ba73c96b..770fb73515b2 100644
--- a/libc/src/unistd/linux/dup3.cpp
+++ b/libc/src/unistd/linux/dup3.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/execv.cpp b/libc/src/unistd/linux/execv.cpp
index a3f2525ed7ca..d4f2bd9a5165 100644
--- a/libc/src/unistd/linux/execv.cpp
+++ b/libc/src/unistd/linux/execv.cpp
@@ -13,7 +13,7 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/execve.cpp b/libc/src/unistd/linux/execve.cpp
index 37162c412178..2214b6df493b 100644
--- a/libc/src/unistd/linux/execve.cpp
+++ b/libc/src/unistd/linux/execve.cpp
@@ -13,7 +13,7 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/fchdir.cpp b/libc/src/unistd/linux/fchdir.cpp
index 8196dc63ab1e..f7a7422363e6 100644
--- a/libc/src/unistd/linux/fchdir.cpp
+++ b/libc/src/unistd/linux/fchdir.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/fork.cpp b/libc/src/unistd/linux/fork.cpp
index 8aa0477a15d5..75a76fdea50b 100644
--- a/libc/src/unistd/linux/fork.cpp
+++ b/libc/src/unistd/linux/fork.cpp
@@ -15,7 +15,7 @@
#include "src/__support/threads/identifier.h"
#include "src/__support/threads/thread.h" // For thread self object
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include <signal.h> // For SIGCHLD
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/unistd/linux/fsync.cpp b/libc/src/unistd/linux/fsync.cpp
index ae3895bab15f..fe08aed61e25 100644
--- a/libc/src/unistd/linux/fsync.cpp
+++ b/libc/src/unistd/linux/fsync.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/ftruncate.cpp b/libc/src/unistd/linux/ftruncate.cpp
index ccbb0634664a..f6aa6f8b48cc 100644
--- a/libc/src/unistd/linux/ftruncate.cpp
+++ b/libc/src/unistd/linux/ftruncate.cpp
@@ -12,8 +12,8 @@
#include "src/__support/common.h"
#include "hdr/unistd_macros.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stdint.h> // For uint64_t.
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/unistd/linux/getcwd.cpp b/libc/src/unistd/linux/getcwd.cpp
index 1bb11a7c8e7b..c0e475dd3e8f 100644
--- a/libc/src/unistd/linux/getcwd.cpp
+++ b/libc/src/unistd/linux/getcwd.cpp
@@ -13,7 +13,7 @@
#include "src/__support/macros/config.h"
#include "src/string/allocating_string_utils.h" // For strdup.
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include <linux/limits.h> // This is safe to include without any name pollution.
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/unistd/linux/getentropy.cpp b/libc/src/unistd/linux/getentropy.cpp
index 168a1197734e..65bcbf27601d 100644
--- a/libc/src/unistd/linux/getentropy.cpp
+++ b/libc/src/unistd/linux/getentropy.cpp
@@ -10,7 +10,7 @@
#include "hdr/errno_macros.h"
#include "src/__support/OSUtil/syscall.h"
#include "src/__support/common.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/unistd/linux/getsid.cpp b/libc/src/unistd/linux/getsid.cpp
index 5977c5bf10e9..025b8d1691ac 100644
--- a/libc/src/unistd/linux/getsid.cpp
+++ b/libc/src/unistd/linux/getsid.cpp
@@ -11,8 +11,8 @@
#include "hdr/types/pid_t.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/isatty.cpp b/libc/src/unistd/linux/isatty.cpp
index e6ea22a714c7..a4d17912b57b 100644
--- a/libc/src/unistd/linux/isatty.cpp
+++ b/libc/src/unistd/linux/isatty.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/ioctl.h> // For ioctl numbers.
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/unistd/linux/link.cpp b/libc/src/unistd/linux/link.cpp
index 477806a70df7..205cf8a84a5c 100644
--- a/libc/src/unistd/linux/link.cpp
+++ b/libc/src/unistd/linux/link.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "hdr/fcntl_macros.h"
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/unistd/linux/linkat.cpp b/libc/src/unistd/linux/linkat.cpp
index 40f68cc90c48..ea5bc48cbedc 100644
--- a/libc/src/unistd/linux/linkat.cpp
+++ b/libc/src/unistd/linux/linkat.cpp
@@ -12,8 +12,8 @@
#include "src/__support/common.h"
#include "hdr/fcntl_macros.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/lseek.cpp b/libc/src/unistd/linux/lseek.cpp
index 0e957498da74..26a08269fd8d 100644
--- a/libc/src/unistd/linux/lseek.cpp
+++ b/libc/src/unistd/linux/lseek.cpp
@@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//
#include "src/unistd/lseek.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/__support/File/linux/lseekImpl.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
diff --git a/libc/src/unistd/linux/pathconf.cpp b/libc/src/unistd/linux/pathconf.cpp
index ca1c10bb9f7f..7dde857c1cfd 100644
--- a/libc/src/unistd/linux/pathconf.cpp
+++ b/libc/src/unistd/linux/pathconf.cpp
@@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//
#include "src/unistd/pathconf.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/sys/statvfs/linux/statfs_utils.h"
#include "src/unistd/linux/pathconf_utils.h"
diff --git a/libc/src/unistd/linux/pathconf_utils.cpp b/libc/src/unistd/linux/pathconf_utils.cpp
index 035e628dff25..9a62e31fd188 100644
--- a/libc/src/unistd/linux/pathconf_utils.cpp
+++ b/libc/src/unistd/linux/pathconf_utils.cpp
@@ -14,8 +14,8 @@
#include "hdr/unistd_macros.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/sys/statvfs/linux/statfs_utils.h"
// other linux specific includes
diff --git a/libc/src/unistd/linux/pipe.cpp b/libc/src/unistd/linux/pipe.cpp
index dfcd5bfdaf53..b9943c833805 100644
--- a/libc/src/unistd/linux/pipe.cpp
+++ b/libc/src/unistd/linux/pipe.cpp
@@ -10,10 +10,10 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/sanitizer.h" // for MSAN_UNPOISON
-#include "src/errno/libc_errno.h"
-#include <sys/syscall.h> // For syscall numbers.
+#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/pipe2.cpp b/libc/src/unistd/linux/pipe2.cpp
index ebe7e0114ae9..d30f3b37a1ad 100644
--- a/libc/src/unistd/linux/pipe2.cpp
+++ b/libc/src/unistd/linux/pipe2.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/pread.cpp b/libc/src/unistd/linux/pread.cpp
index 3e27857f9a2b..2f86e397feef 100644
--- a/libc/src/unistd/linux/pread.cpp
+++ b/libc/src/unistd/linux/pread.cpp
@@ -10,11 +10,11 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/sanitizer.h" // for MSAN_UNPOISON
-#include "src/errno/libc_errno.h"
-#include <stdint.h> // For uint64_t.
-#include <sys/syscall.h> // For syscall numbers.
+#include <stdint.h> // For uint64_t.
+#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/pwrite.cpp b/libc/src/unistd/linux/pwrite.cpp
index 1b81b2a05949..f4cf8e16d766 100644
--- a/libc/src/unistd/linux/pwrite.cpp
+++ b/libc/src/unistd/linux/pwrite.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stdint.h> // For uint64_t.
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/unistd/linux/read.cpp b/libc/src/unistd/linux/read.cpp
index 4419900f2330..55676f3f7010 100644
--- a/libc/src/unistd/linux/read.cpp
+++ b/libc/src/unistd/linux/read.cpp
@@ -10,10 +10,10 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/sanitizer.h" // for MSAN_UNPOISON
-#include "src/errno/libc_errno.h"
-#include <sys/syscall.h> // For syscall numbers.
+#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/readlink.cpp b/libc/src/unistd/linux/readlink.cpp
index 2055e6b3400f..b297a41ca37b 100644
--- a/libc/src/unistd/linux/readlink.cpp
+++ b/libc/src/unistd/linux/readlink.cpp
@@ -12,8 +12,8 @@
#include "src/__support/common.h"
#include "hdr/fcntl_macros.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/readlinkat.cpp b/libc/src/unistd/linux/readlinkat.cpp
index e5e4d0d39bc9..cd0dcb8e0ff0 100644
--- a/libc/src/unistd/linux/readlinkat.cpp
+++ b/libc/src/unistd/linux/readlinkat.cpp
@@ -12,8 +12,8 @@
#include "src/__support/common.h"
#include "hdr/fcntl_macros.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/rmdir.cpp b/libc/src/unistd/linux/rmdir.cpp
index 075af12af64c..eca6e954ef89 100644
--- a/libc/src/unistd/linux/rmdir.cpp
+++ b/libc/src/unistd/linux/rmdir.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "hdr/fcntl_macros.h"
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/unistd/linux/symlink.cpp b/libc/src/unistd/linux/symlink.cpp
index 9e1b2886ea0f..3f43de19d2f4 100644
--- a/libc/src/unistd/linux/symlink.cpp
+++ b/libc/src/unistd/linux/symlink.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "hdr/fcntl_macros.h"
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/unistd/linux/symlinkat.cpp b/libc/src/unistd/linux/symlinkat.cpp
index bcf2d0f8cc05..8cee172f39df 100644
--- a/libc/src/unistd/linux/symlinkat.cpp
+++ b/libc/src/unistd/linux/symlinkat.cpp
@@ -12,8 +12,8 @@
#include "src/__support/common.h"
#include "hdr/fcntl_macros.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/syscall.cpp b/libc/src/unistd/linux/syscall.cpp
index 5394bff46adf..0f7b3da88d62 100644
--- a/libc/src/unistd/linux/syscall.cpp
+++ b/libc/src/unistd/linux/syscall.cpp
@@ -11,8 +11,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <stdarg.h>
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/sysconf.cpp b/libc/src/unistd/linux/sysconf.cpp
index f785ff321c7d..03f224b15027 100644
--- a/libc/src/unistd/linux/sysconf.cpp
+++ b/libc/src/unistd/linux/sysconf.cpp
@@ -11,8 +11,8 @@
#include "src/__support/common.h"
#include "hdr/unistd_macros.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/sys/auxv/getauxval.h"
#include <sys/auxv.h>
diff --git a/libc/src/unistd/linux/truncate.cpp b/libc/src/unistd/linux/truncate.cpp
index 8236edb480d1..6103d4b51350 100644
--- a/libc/src/unistd/linux/truncate.cpp
+++ b/libc/src/unistd/linux/truncate.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "hdr/unistd_macros.h"
#include <stdint.h> // For uint64_t.
diff --git a/libc/src/unistd/linux/unlink.cpp b/libc/src/unistd/linux/unlink.cpp
index 72d8e2398e3d..5fde2600937b 100644
--- a/libc/src/unistd/linux/unlink.cpp
+++ b/libc/src/unistd/linux/unlink.cpp
@@ -12,8 +12,8 @@
#include "src/__support/common.h"
#include "hdr/fcntl_macros.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/unistd/linux/unlinkat.cpp b/libc/src/unistd/linux/unlinkat.cpp
index 4ed20f542f17..b2012c52b885 100644
--- a/libc/src/unistd/linux/unlinkat.cpp
+++ b/libc/src/unistd/linux/unlinkat.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "hdr/fcntl_macros.h"
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/unistd/linux/write.cpp b/libc/src/unistd/linux/write.cpp
index 99d5ab7e480b..eecb74429182 100644
--- a/libc/src/unistd/linux/write.cpp
+++ b/libc/src/unistd/linux/write.cpp
@@ -10,8 +10,8 @@
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
diff --git a/libc/src/unistd/windows/getentropy.cpp b/libc/src/unistd/windows/getentropy.cpp
index bfaec723ac63..e25a7a8fed40 100644
--- a/libc/src/unistd/windows/getentropy.cpp
+++ b/libc/src/unistd/windows/getentropy.cpp
@@ -9,7 +9,7 @@
#include "src/unistd/getentropy.h"
#include "hdr/errno_macros.h"
#include "src/__support/common.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
diff --git a/libc/test/IntegrationTest/test.h b/libc/test/IntegrationTest/test.h
index 5be66d9edff0..24c007d2e12e 100644
--- a/libc/test/IntegrationTest/test.h
+++ b/libc/test/IntegrationTest/test.h
@@ -68,12 +68,9 @@
////////////////////////////////////////////////////////////////////////////////
// Errno checks.
-#define ASSERT_ERRNO_EQ(VAL) \
- ASSERT_EQ(VAL, static_cast<int>(LIBC_NAMESPACE::libc_errno))
-#define ASSERT_ERRNO_SUCCESS() \
- ASSERT_EQ(0, static_cast<int>(LIBC_NAMESPACE::libc_errno))
-#define ASSERT_ERRNO_FAILURE() \
- ASSERT_NE(0, static_cast<int>(LIBC_NAMESPACE::libc_errno))
+#define ASSERT_ERRNO_EQ(VAL) ASSERT_EQ(VAL, static_cast<int>(libc_errno))
+#define ASSERT_ERRNO_SUCCESS() ASSERT_EQ(0, static_cast<int>(libc_errno))
+#define ASSERT_ERRNO_FAILURE() ASSERT_NE(0, static_cast<int>(libc_errno))
// Integration tests are compiled with -ffreestanding which stops treating
// the main function as a non-overloadable special function. Hence, we use a
diff --git a/libc/test/UnitTest/ErrnoCheckingTest.h b/libc/test/UnitTest/ErrnoCheckingTest.h
index 3d3b72f80544..4b7ff452f409 100644
--- a/libc/test/UnitTest/ErrnoCheckingTest.h
+++ b/libc/test/UnitTest/ErrnoCheckingTest.h
@@ -9,8 +9,8 @@
#ifndef LLVM_LIBC_TEST_UNITTEST_ERRNOCHECKINGTEST_H
#define LLVM_LIBC_TEST_UNITTEST_ERRNOCHECKINGTEST_H
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "test/UnitTest/Test.h"
namespace LIBC_NAMESPACE_DECL {
@@ -25,7 +25,7 @@ class ErrnoCheckingTest : public Test {
public:
void SetUp() override {
Test::SetUp();
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
}
void TearDown() override {
diff --git a/libc/test/UnitTest/ErrnoSetterMatcher.h b/libc/test/UnitTest/ErrnoSetterMatcher.h
index c6eadd25858e..212b7a8f83e7 100644
--- a/libc/test/UnitTest/ErrnoSetterMatcher.h
+++ b/libc/test/UnitTest/ErrnoSetterMatcher.h
@@ -12,9 +12,9 @@
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/fpbits_str.h"
#include "src/__support/StringUtil/error_to_string.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h"
-#include "src/errno/libc_errno.h"
#include "test/UnitTest/Test.h"
namespace LIBC_NAMESPACE_DECL {
@@ -114,8 +114,8 @@ public:
bool match(T got) {
actual_return = got;
- actual_errno = LIBC_NAMESPACE::libc_errno;
- LIBC_NAMESPACE::libc_errno = 0;
+ actual_errno = libc_errno;
+ libc_errno = 0;
if constexpr (ignore_errno())
return return_cmp.compare(actual_return);
else
diff --git a/libc/test/UnitTest/FPMatcher.h b/libc/test/UnitTest/FPMatcher.h
index 21b8a45b0726..da15cf2907f7 100644
--- a/libc/test/UnitTest/FPMatcher.h
+++ b/libc/test/UnitTest/FPMatcher.h
@@ -279,8 +279,8 @@ private:
#define EXPECT_MATH_ERRNO(expected) \
do { \
if (math_errhandling & MATH_ERRNO) { \
- int actual = LIBC_NAMESPACE::libc_errno; \
- LIBC_NAMESPACE::libc_errno = 0; \
+ int actual = libc_errno; \
+ libc_errno = 0; \
EXPECT_EQ(actual, expected); \
} \
} while (0)
@@ -288,8 +288,8 @@ private:
#define ASSERT_MATH_ERRNO(expected) \
do { \
if (math_errhandling & MATH_ERRNO) { \
- int actual = LIBC_NAMESPACE::libc_errno; \
- LIBC_NAMESPACE::libc_errno = 0; \
+ int actual = libc_errno; \
+ libc_errno = 0; \
ASSERT_EQ(actual, expected); \
} \
} while (0)
diff --git a/libc/test/UnitTest/Test.h b/libc/test/UnitTest/Test.h
index 95d48f40914e..a5a2a3c7cf58 100644
--- a/libc/test/UnitTest/Test.h
+++ b/libc/test/UnitTest/Test.h
@@ -42,15 +42,14 @@
#define ASSERT_ERRNO_EQ(VAL) \
do { \
- ASSERT_EQ(VAL, static_cast<int>(LIBC_NAMESPACE::libc_errno)); \
- LIBC_NAMESPACE::libc_errno = 0; \
+ ASSERT_EQ(VAL, static_cast<int>(libc_errno)); \
+ libc_errno = 0; \
} while (0)
-#define ASSERT_ERRNO_SUCCESS() \
- ASSERT_EQ(0, static_cast<int>(LIBC_NAMESPACE::libc_errno))
+#define ASSERT_ERRNO_SUCCESS() ASSERT_EQ(0, static_cast<int>(libc_errno))
#define ASSERT_ERRNO_FAILURE() \
do { \
- ASSERT_NE(0, static_cast<int>(LIBC_NAMESPACE::libc_errno)); \
- LIBC_NAMESPACE::libc_errno = 0; \
+ ASSERT_NE(0, static_cast<int>(libc_errno)); \
+ libc_errno = 0; \
} while (0)
#endif // LLVM_LIBC_TEST_UNITTEST_TEST_H
diff --git a/libc/test/integration/src/pthread/pthread_create_test.cpp b/libc/test/integration/src/pthread/pthread_create_test.cpp
index 29da4d5c3c8d..aecbad6514aa 100644
--- a/libc/test/integration/src/pthread/pthread_create_test.cpp
+++ b/libc/test/integration/src/pthread/pthread_create_test.cpp
@@ -29,7 +29,7 @@
#include "src/__support/CPP/new.h"
#include "src/__support/threads/thread.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "test/IntegrationTest/test.h"
@@ -332,7 +332,7 @@ static void run_failure_tests() {
}
TEST_MAIN() {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
run_success_tests();
run_failure_tests();
return 0;
diff --git a/libc/test/integration/src/pthread/pthread_join_test.cpp b/libc/test/integration/src/pthread/pthread_join_test.cpp
index 994fa57a6b33..5d0bcd8e2365 100644
--- a/libc/test/integration/src/pthread/pthread_join_test.cpp
+++ b/libc/test/integration/src/pthread/pthread_join_test.cpp
@@ -9,7 +9,7 @@
#include "src/pthread/pthread_create.h"
#include "src/pthread/pthread_join.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "test/IntegrationTest/test.h"
#include <pthread.h>
@@ -25,7 +25,7 @@ static void nullJoinTest() {
}
TEST_MAIN() {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
nullJoinTest();
return 0;
}
diff --git a/libc/test/integration/src/pthread/pthread_name_test.cpp b/libc/test/integration/src/pthread/pthread_name_test.cpp
index 37ceceee880d..35dd3b165e0e 100644
--- a/libc/test/integration/src/pthread/pthread_name_test.cpp
+++ b/libc/test/integration/src/pthread/pthread_name_test.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "src/__support/CPP/string_view.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/pthread/pthread_create.h"
#include "src/pthread/pthread_getname_np.h"
#include "src/pthread/pthread_join.h"
diff --git a/libc/test/integration/src/unistd/getcwd_test.cpp b/libc/test/integration/src/unistd/getcwd_test.cpp
index 551768187bf0..1b321b01e931 100644
--- a/libc/test/integration/src/unistd/getcwd_test.cpp
+++ b/libc/test/integration/src/unistd/getcwd_test.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "src/__support/CPP/string_view.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/stdlib/getenv.h"
#include "src/unistd/getcwd.h"
@@ -31,12 +31,12 @@ TEST_MAIN(int argc, char **argv, char **envp) {
cwd = LIBC_NAMESPACE::getcwd(buffer, 0);
ASSERT_TRUE(cwd == nullptr);
ASSERT_ERRNO_EQ(EINVAL);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
// Insufficient size
cwd = LIBC_NAMESPACE::getcwd(buffer, 2);
ASSERT_TRUE(cwd == nullptr);
- int err = LIBC_NAMESPACE::libc_errno;
+ int err = libc_errno;
ASSERT_EQ(err, ERANGE);
return 0;
diff --git a/libc/test/integration/startup/linux/tls_test.cpp b/libc/test/integration/startup/linux/tls_test.cpp
index ef9fd9fcb7ff..de3bd06c39cf 100644
--- a/libc/test/integration/startup/linux/tls_test.cpp
+++ b/libc/test/integration/startup/linux/tls_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/sys/mman/mmap.h"
#include "test/IntegrationTest/test.h"
diff --git a/libc/test/src/__support/str_to_fp_test.h b/libc/test/src/__support/str_to_fp_test.h
index d349192f107c..9b4844d410db 100644
--- a/libc/test/src/__support/str_to_fp_test.h
+++ b/libc/test/src/__support/str_to_fp_test.h
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_float.h"
#include "src/__support/uint128.h"
diff --git a/libc/test/src/__support/str_to_integer_test.cpp b/libc/test/src/__support/str_to_integer_test.cpp
index 1ec882b212b8..40cb76a8bd6a 100644
--- a/libc/test/src/__support/str_to_integer_test.cpp
+++ b/libc/test/src/__support/str_to_integer_test.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "src/__support/libc_errno.h"
#include "src/__support/str_to_integer.h"
#include <stddef.h>
diff --git a/libc/test/src/dirent/dirent_test.cpp b/libc/test/src/dirent/dirent_test.cpp
index 41f522a6a75f..3f0095ca5ebe 100644
--- a/libc/test/src/dirent/dirent_test.cpp
+++ b/libc/test/src/dirent/dirent_test.cpp
@@ -7,11 +7,11 @@
//===----------------------------------------------------------------------===//
#include "src/__support/CPP/string_view.h"
+#include "src/__support/libc_errno.h"
#include "src/dirent/closedir.h"
#include "src/dirent/dirfd.h"
#include "src/dirent/opendir.h"
#include "src/dirent/readdir.h"
-#include "src/errno/libc_errno.h"
#include "test/UnitTest/Test.h"
@@ -55,17 +55,17 @@ TEST(LlvmLibcDirentTest, SimpleOpenAndRead) {
}
TEST(LlvmLibcDirentTest, OpenNonExistentDir) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
::DIR *dir = LIBC_NAMESPACE::opendir("___xyz123__.non_existent__");
ASSERT_TRUE(dir == nullptr);
ASSERT_ERRNO_EQ(ENOENT);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
}
TEST(LlvmLibcDirentTest, OpenFile) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
::DIR *dir = LIBC_NAMESPACE::opendir("testdata/file1.txt");
ASSERT_TRUE(dir == nullptr);
ASSERT_ERRNO_EQ(ENOTDIR);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
}
diff --git a/libc/test/src/errno/errno_test.cpp b/libc/test/src/errno/errno_test.cpp
index b0db22a85f3b..de82b0077f17 100644
--- a/libc/test/src/errno/errno_test.cpp
+++ b/libc/test/src/errno/errno_test.cpp
@@ -6,11 +6,11 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "test/UnitTest/Test.h"
TEST(LlvmLibcErrnoTest, Basic) {
int test_val = 123;
- LIBC_NAMESPACE::libc_errno = test_val;
+ libc_errno = test_val;
ASSERT_ERRNO_EQ(test_val);
}
diff --git a/libc/test/src/fcntl/creat_test.cpp b/libc/test/src/fcntl/creat_test.cpp
index 4c9d2cbc33f4..d60c98493470 100644
--- a/libc/test/src/fcntl/creat_test.cpp
+++ b/libc/test/src/fcntl/creat_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/fcntl/creat.h"
#include "src/fcntl/open.h"
#include "src/unistd/close.h"
diff --git a/libc/test/src/fcntl/fcntl_test.cpp b/libc/test/src/fcntl/fcntl_test.cpp
index 1a21afe51085..082c42481777 100644
--- a/libc/test/src/fcntl/fcntl_test.cpp
+++ b/libc/test/src/fcntl/fcntl_test.cpp
@@ -9,7 +9,7 @@
#include "hdr/fcntl_macros.h"
#include "hdr/stdio_macros.h"
#include "hdr/types/struct_flock.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/fcntl/fcntl.h"
#include "src/fcntl/open.h"
#include "src/unistd/close.h"
@@ -166,7 +166,7 @@ TEST(LlvmLibcFcntlTest, UseAfterClose) {
}
TEST(LlvmLibcFcntlTest, SetGetOwnerTest) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
pid_t pid = LIBC_NAMESPACE::getpid();
ASSERT_GT(pid, -1);
diff --git a/libc/test/src/fcntl/openat_test.cpp b/libc/test/src/fcntl/openat_test.cpp
index 213b074799c8..1997476f16a6 100644
--- a/libc/test/src/fcntl/openat_test.cpp
+++ b/libc/test/src/fcntl/openat_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/fcntl/open.h"
#include "src/fcntl/openat.h"
#include "src/unistd/close.h"
diff --git a/libc/test/src/math/RoundToIntegerTest.h b/libc/test/src/math/RoundToIntegerTest.h
index 77b465a3a0e6..6af9cfea0e0a 100644
--- a/libc/test/src/math/RoundToIntegerTest.h
+++ b/libc/test/src/math/RoundToIntegerTest.h
@@ -55,7 +55,7 @@ private:
void test_one_input(RoundToIntegerFunc func, FloatType input,
IntType expected, bool expectError) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
ASSERT_EQ(func(input), expected);
diff --git a/libc/test/src/math/acosf_test.cpp b/libc/test/src/math/acosf_test.cpp
index 2e4c8eb2ab96..aa0128fee999 100644
--- a/libc/test/src/math/acosf_test.cpp
+++ b/libc/test/src/math/acosf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/acosf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -21,7 +21,7 @@ namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcAcosfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcAcosfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/acoshf16_test.cpp b/libc/test/src/math/acoshf16_test.cpp
index 7348018396bd..2eb95215e4e8 100644
--- a/libc/test/src/math/acoshf16_test.cpp
+++ b/libc/test/src/math/acoshf16_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/acoshf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
diff --git a/libc/test/src/math/acoshf_test.cpp b/libc/test/src/math/acoshf_test.cpp
index 18ed5a11d50a..3d3b827411a4 100644
--- a/libc/test/src/math/acoshf_test.cpp
+++ b/libc/test/src/math/acoshf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/acoshf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -21,7 +21,7 @@ using LlvmLibcAcoshfTest = LIBC_NAMESPACE::testing::FPTest<float>;
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcAcoshfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/asin_test.cpp b/libc/test/src/math/asin_test.cpp
index 385e341318ae..03ae963e9f92 100644
--- a/libc/test/src/math/asin_test.cpp
+++ b/libc/test/src/math/asin_test.cpp
@@ -38,7 +38,7 @@ TEST_F(LlvmLibcAsinTest, InDoubleRange) {
double x = FPBits(v).get_val();
if (FPBits(v).is_nan() || FPBits(v).is_inf())
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
double result = LIBC_NAMESPACE::asin(x);
++cc;
if (FPBits(result).is_nan() || FPBits(result).is_inf())
diff --git a/libc/test/src/math/asinf_test.cpp b/libc/test/src/math/asinf_test.cpp
index 5197810d8bd5..1eaa6b8a5135 100644
--- a/libc/test/src/math/asinf_test.cpp
+++ b/libc/test/src/math/asinf_test.cpp
@@ -9,7 +9,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/asinf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -22,7 +22,7 @@ using LlvmLibcAsinfTest = LIBC_NAMESPACE::testing::FPTest<float>;
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcAsinfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/asinhf_test.cpp b/libc/test/src/math/asinhf_test.cpp
index ac125c3520c4..8c78f939cabf 100644
--- a/libc/test/src/math/asinhf_test.cpp
+++ b/libc/test/src/math/asinhf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/asinhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -21,7 +21,7 @@ using LlvmLibcAsinhfTest = LIBC_NAMESPACE::testing::FPTest<float>;
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcAsinhfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinhf(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/atan2f_test.cpp b/libc/test/src/math/atan2f_test.cpp
index 331f4281af83..50ab38208089 100644
--- a/libc/test/src/math/atan2f_test.cpp
+++ b/libc/test/src/math/atan2f_test.cpp
@@ -81,7 +81,7 @@ TEST_F(LlvmLibcAtan2fTest, InFloatRange) {
if (FPBits(w).is_nan() || FPBits(w).is_inf())
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
float result = LIBC_NAMESPACE::atan2f(x, y);
++total_count;
if (FPBits(result).is_nan() || FPBits(result).is_inf())
diff --git a/libc/test/src/math/atan_test.cpp b/libc/test/src/math/atan_test.cpp
index 7f52578b9efe..7fa0dffd607e 100644
--- a/libc/test/src/math/atan_test.cpp
+++ b/libc/test/src/math/atan_test.cpp
@@ -39,7 +39,7 @@ TEST_F(LlvmLibcAtanTest, InDoubleRange) {
double x = FPBits(v).get_val();
if (FPBits(v).is_nan() || FPBits(v).is_inf())
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
double result = LIBC_NAMESPACE::atan(x);
++cc;
if (FPBits(result).is_nan() || FPBits(result).is_inf())
diff --git a/libc/test/src/math/atanf_test.cpp b/libc/test/src/math/atanf_test.cpp
index 575ec89bd493..a4bdf1867c39 100644
--- a/libc/test/src/math/atanf_test.cpp
+++ b/libc/test/src/math/atanf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/atanf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -23,7 +23,7 @@ namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
// TODO: This test needs to have its checks for exceptions, errno
// tightened
TEST_F(LlvmLibcAtanfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanf(aNaN));
// TODO: Uncomment these checks later, RoundingMode affects running
diff --git a/libc/test/src/math/atanhf_test.cpp b/libc/test/src/math/atanhf_test.cpp
index 8b9db1dfdd97..32272ef482ab 100644
--- a/libc/test/src/math/atanhf_test.cpp
+++ b/libc/test/src/math/atanhf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/atanhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -25,7 +25,7 @@ namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
// tightened https://github.com/llvm/llvm-project/issues/88819.
TEST_F(LlvmLibcAtanhfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(aNaN));
// TODO: Uncomment these checks later, RoundingMode affects running
diff --git a/libc/test/src/math/cosf_test.cpp b/libc/test/src/math/cosf_test.cpp
index 2143c36f3d30..90dc8ff6a0ea 100644
--- a/libc/test/src/math/cosf_test.cpp
+++ b/libc/test/src/math/cosf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/cosf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -23,7 +23,7 @@ using LlvmLibcCosfTest = LIBC_NAMESPACE::testing::FPTest<float>;
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcCosfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cosf(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/coshf_test.cpp b/libc/test/src/math/coshf_test.cpp
index 0d1c322b8e62..bdaba50f1f14 100644
--- a/libc/test/src/math/coshf_test.cpp
+++ b/libc/test/src/math/coshf_test.cpp
@@ -9,7 +9,7 @@
#include "hdr/math_macros.h"
#include "src/__support/CPP/array.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/coshf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -22,7 +22,7 @@ using LlvmLibcCoshfTest = LIBC_NAMESPACE::testing::FPTest<float>;
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcCoshfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::coshf(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -41,7 +41,7 @@ TEST_F(LlvmLibcCoshfTest, SpecialNumbers) {
}
TEST_F(LlvmLibcCoshfTest, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, LIBC_NAMESPACE::coshf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/cospif_test.cpp b/libc/test/src/math/cospif_test.cpp
index 37ec2516f6a3..cb88bfcade0d 100644
--- a/libc/test/src/math/cospif_test.cpp
+++ b/libc/test/src/math/cospif_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/cospif.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/src/math/sdcomp26094.h"
@@ -19,7 +19,7 @@ using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES;
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcCospifTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cospif(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/exp10_test.cpp b/libc/test/src/math/exp10_test.cpp
index 6fb1d2d9d925..6126e5f211ff 100644
--- a/libc/test/src/math/exp10_test.cpp
+++ b/libc/test/src/math/exp10_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/exp10.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -105,7 +105,7 @@ TEST_F(LlvmLibcExp10Test, InDoubleRange) {
double x = FPBits(v).get_val();
if (FPBits(v).is_nan() || FPBits(v).is_inf() || x < 0.0)
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
double result = LIBC_NAMESPACE::exp10(x);
++cc;
if (FPBits(result).is_nan() || FPBits(result).is_inf())
diff --git a/libc/test/src/math/exp10f_test.cpp b/libc/test/src/math/exp10f_test.cpp
index 001b37809d93..89915961c9b9 100644
--- a/libc/test/src/math/exp10f_test.cpp
+++ b/libc/test/src/math/exp10f_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/exp10f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -21,7 +21,7 @@ using LlvmLibcExp10fTest = LIBC_NAMESPACE::testing::FPTest<float>;
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcExp10fTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp10f(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExp10fTest, SpecialNumbers) {
}
TEST_F(LlvmLibcExp10fTest, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, LIBC_NAMESPACE::exp10f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
@@ -55,7 +55,7 @@ TEST_F(LlvmLibcExp10fTest, Overflow) {
}
TEST_F(LlvmLibcExp10fTest, Underflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
0.0f, LIBC_NAMESPACE::exp10f(FPBits(0xff7fffffU).get_val()),
FE_UNDERFLOW);
@@ -97,7 +97,7 @@ TEST_F(LlvmLibcExp10fTest, TrickyInputs) {
0x41200000, // x = 10.0f
};
for (int i = 0; i < N; ++i) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
float x = FPBits(INPUTS[i]).get_val();
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x,
LIBC_NAMESPACE::exp10f(x), 0.5);
@@ -113,15 +113,14 @@ TEST_F(LlvmLibcExp10fTest, InFloatRange) {
float x = FPBits(v).get_val();
if (FPBits(v).is_nan() || FPBits(v).is_inf())
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
float result = LIBC_NAMESPACE::exp10f(x);
// If the computation resulted in an error or did not produce valid result
// in the single-precision floating point range, then ignore comparing with
// MPFR result as MPFR can still produce valid results because of its
// wider precision.
- if (FPBits(result).is_nan() || FPBits(result).is_inf() ||
- LIBC_NAMESPACE::libc_errno != 0)
+ if (FPBits(result).is_nan() || FPBits(result).is_inf() || libc_errno != 0)
continue;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x,
LIBC_NAMESPACE::exp10f(x), 0.5);
diff --git a/libc/test/src/math/exp10m1f_test.cpp b/libc/test/src/math/exp10m1f_test.cpp
index aee273384f1a..01802bd68f7e 100644
--- a/libc/test/src/math/exp10m1f_test.cpp
+++ b/libc/test/src/math/exp10m1f_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/CPP/array.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/exp10m1f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -69,7 +69,7 @@ TEST_F(LlvmLibcExp10m1fTest, TrickyInputs) {
};
for (float x : INPUTS) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10m1, x,
LIBC_NAMESPACE::exp10m1f(x), 0.5);
}
@@ -82,14 +82,14 @@ TEST_F(LlvmLibcExp10m1fTest, InFloatRange) {
float x = FPBits(v).get_val();
if (FPBits(v).is_inf_or_nan())
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
float result = LIBC_NAMESPACE::exp10m1f(x);
// If the computation resulted in an error or did not produce valid result
// in the single-precision floating point range, then ignore comparing with
// MPFR result as MPFR can still produce valid results because of its
// wider precision.
- if (FPBits(result).is_inf_or_nan() || LIBC_NAMESPACE::libc_errno != 0)
+ if (FPBits(result).is_inf_or_nan() || libc_errno != 0)
continue;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10m1, x,
LIBC_NAMESPACE::exp10m1f(x), 0.5);
diff --git a/libc/test/src/math/exp2_test.cpp b/libc/test/src/math/exp2_test.cpp
index adfceceeef4b..4cd95dd5486e 100644
--- a/libc/test/src/math/exp2_test.cpp
+++ b/libc/test/src/math/exp2_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/exp2.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -80,7 +80,7 @@ TEST_F(LlvmLibcExp2Test, InDoubleRange) {
double x = FPBits(v).get_val();
if (FPBits(v).is_nan() || FPBits(v).is_inf() || x < 0.0)
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
double result = LIBC_NAMESPACE::exp2(x);
++cc;
if (FPBits(result).is_nan() || FPBits(result).is_inf())
diff --git a/libc/test/src/math/exp2f_test.cpp b/libc/test/src/math/exp2f_test.cpp
index 0c4c82153439..aeecb3e74b07 100644
--- a/libc/test/src/math/exp2f_test.cpp
+++ b/libc/test/src/math/exp2f_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/exp2f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -21,7 +21,7 @@ using LlvmLibcExp2fTest = LIBC_NAMESPACE::testing::FPTest<float>;
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcExp2fTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp2f(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExp2fTest, SpecialNumbers) {
}
TEST_F(LlvmLibcExp2fTest, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, LIBC_NAMESPACE::exp2f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
@@ -71,7 +71,7 @@ TEST_F(LlvmLibcExp2fTest, TrickyInputs) {
0xc3150000U, /*-0x1.2ap+7f*/
};
for (int i = 0; i < N; ++i) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
float x = FPBits(INPUTS[i]).get_val();
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x,
LIBC_NAMESPACE::exp2f(x), 0.5);
@@ -80,7 +80,7 @@ TEST_F(LlvmLibcExp2fTest, TrickyInputs) {
}
TEST_F(LlvmLibcExp2fTest, Underflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
0.0f, LIBC_NAMESPACE::exp2f(FPBits(0xff7fffffU).get_val()), FE_UNDERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
@@ -108,15 +108,14 @@ TEST_F(LlvmLibcExp2fTest, InFloatRange) {
float x = FPBits(v).get_val();
if (FPBits(v).is_nan() || FPBits(v).is_inf())
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
float result = LIBC_NAMESPACE::exp2f(x);
// If the computation resulted in an error or did not produce valid result
// in the single-precision floating point range, then ignore comparing with
// MPFR result as MPFR can still produce valid results because of its
// wider precision.
- if (FPBits(result).is_nan() || FPBits(result).is_inf() ||
- LIBC_NAMESPACE::libc_errno != 0)
+ if (FPBits(result).is_nan() || FPBits(result).is_inf() || libc_errno != 0)
continue;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x,
LIBC_NAMESPACE::exp2f(x), 0.5);
diff --git a/libc/test/src/math/exp2m1f_test.cpp b/libc/test/src/math/exp2m1f_test.cpp
index 793cf0cc2cbb..0c87657abc08 100644
--- a/libc/test/src/math/exp2m1f_test.cpp
+++ b/libc/test/src/math/exp2m1f_test.cpp
@@ -9,7 +9,7 @@
#include "hdr/math_macros.h"
#include "src/__support/CPP/array.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/exp2m1f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -38,7 +38,7 @@ TEST_F(LlvmLibcExp2m1fTest, TrickyInputs) {
};
for (float x : INPUTS) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2m1, x,
LIBC_NAMESPACE::exp2m1f(x), 0.5);
}
@@ -51,15 +51,14 @@ TEST_F(LlvmLibcExp2m1fTest, InFloatRange) {
float x = FPBits(v).get_val();
if (FPBits(v).is_nan() || FPBits(v).is_inf())
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
float result = LIBC_NAMESPACE::exp2m1f(x);
// If the computation resulted in an error or did not produce valid result
// in the single-precision floating point range, then ignore comparing with
// MPFR result as MPFR can still produce valid results because of its
// wider precision.
- if (FPBits(result).is_nan() || FPBits(result).is_inf() ||
- LIBC_NAMESPACE::libc_errno != 0)
+ if (FPBits(result).is_nan() || FPBits(result).is_inf() || libc_errno != 0)
continue;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2m1, x,
LIBC_NAMESPACE::exp2m1f(x), 0.5);
diff --git a/libc/test/src/math/exp_test.cpp b/libc/test/src/math/exp_test.cpp
index 0ab3a4e54346..83addaeb943d 100644
--- a/libc/test/src/math/exp_test.cpp
+++ b/libc/test/src/math/exp_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/exp.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -78,7 +78,7 @@ TEST_F(LlvmLibcExpTest, InDoubleRange) {
double x = FPBits(v).get_val();
if (FPBits(v).is_nan() || FPBits(v).is_inf() || x < 0.0)
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
double result = LIBC_NAMESPACE::exp(x);
++cc;
if (FPBits(result).is_nan() || FPBits(result).is_inf())
diff --git a/libc/test/src/math/expf_test.cpp b/libc/test/src/math/expf_test.cpp
index 26a0bca4ce25..3c10812ff5bc 100644
--- a/libc/test/src/math/expf_test.cpp
+++ b/libc/test/src/math/expf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/expf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -21,7 +21,7 @@ using LlvmLibcExpfTest = LIBC_NAMESPACE::testing::FPTest<float>;
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcExpfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::expf(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExpfTest, SpecialNumbers) {
}
TEST_F(LlvmLibcExpfTest, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, LIBC_NAMESPACE::expf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
@@ -55,7 +55,7 @@ TEST_F(LlvmLibcExpfTest, Overflow) {
}
TEST_F(LlvmLibcExpfTest, Underflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
0.0f, LIBC_NAMESPACE::expf(FPBits(0xff7fffffU).get_val()), FE_UNDERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
@@ -76,7 +76,7 @@ TEST_F(LlvmLibcExpfTest, Underflow) {
TEST_F(LlvmLibcExpfTest, Borderline) {
float x;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
x = FPBits(0x42affff8U).get_val();
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x,
LIBC_NAMESPACE::expf(x), 0.5);
@@ -110,15 +110,14 @@ TEST_F(LlvmLibcExpfTest, InFloatRange) {
float x = FPBits(v).get_val();
if (FPBits(v).is_nan() || FPBits(v).is_inf())
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
float result = LIBC_NAMESPACE::expf(x);
// If the computation resulted in an error or did not produce valid result
// in the single-precision floating point range, then ignore comparing with
// MPFR result as MPFR can still produce valid results because of its
// wider precision.
- if (FPBits(result).is_nan() || FPBits(result).is_inf() ||
- LIBC_NAMESPACE::libc_errno != 0)
+ if (FPBits(result).is_nan() || FPBits(result).is_inf() || libc_errno != 0)
continue;
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x,
LIBC_NAMESPACE::expf(x), 0.5);
diff --git a/libc/test/src/math/expm1_test.cpp b/libc/test/src/math/expm1_test.cpp
index 9720773d9f96..0cf07e2e4973 100644
--- a/libc/test/src/math/expm1_test.cpp
+++ b/libc/test/src/math/expm1_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/expm1.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -64,7 +64,7 @@ TEST_F(LlvmLibcExpm1Test, InDoubleRange) {
double x = FPBits(v).get_val();
if (FPBits(v).is_nan() || FPBits(v).is_inf() || x < 0.0)
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
double result = LIBC_NAMESPACE::expm1(x);
++cc;
if (FPBits(result).is_nan() || FPBits(result).is_inf())
diff --git a/libc/test/src/math/expm1f_test.cpp b/libc/test/src/math/expm1f_test.cpp
index 274fe3bb7afb..cf3fe9c26ae1 100644
--- a/libc/test/src/math/expm1f_test.cpp
+++ b/libc/test/src/math/expm1f_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/expm1f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -21,7 +21,7 @@ using LlvmLibcExpm1fTest = LIBC_NAMESPACE::testing::FPTest<float>;
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcExpm1fTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::expm1f(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExpm1fTest, SpecialNumbers) {
}
TEST_F(LlvmLibcExpm1fTest, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, LIBC_NAMESPACE::expm1f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
@@ -55,7 +55,7 @@ TEST_F(LlvmLibcExpm1fTest, Overflow) {
}
TEST_F(LlvmLibcExpm1fTest, Underflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::expm1f(FPBits(0xff7fffffU).get_val()));
float x = FPBits(0xc2cffff8U).get_val();
@@ -70,7 +70,7 @@ TEST_F(LlvmLibcExpm1fTest, Underflow) {
TEST_F(LlvmLibcExpm1fTest, Borderline) {
float x;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
x = FPBits(0x42affff8U).get_val();
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x,
LIBC_NAMESPACE::expm1f(x), 0.5);
@@ -119,15 +119,14 @@ TEST_F(LlvmLibcExpm1fTest, InFloatRange) {
float x = FPBits(v).get_val();
if (FPBits(v).is_nan() || FPBits(v).is_inf())
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
float result = LIBC_NAMESPACE::expm1f(x);
// If the computation resulted in an error or did not produce valid result
// in the single-precision floating point range, then ignore comparing with
// MPFR result as MPFR can still produce valid results because of its
// wider precision.
- if (FPBits(result).is_nan() || FPBits(result).is_inf() ||
- LIBC_NAMESPACE::libc_errno != 0)
+ if (FPBits(result).is_nan() || FPBits(result).is_inf() || libc_errno != 0)
continue;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x,
LIBC_NAMESPACE::expm1f(x), 0.5);
diff --git a/libc/test/src/math/log10_test.cpp b/libc/test/src/math/log10_test.cpp
index 01aa1f82ae5d..e9529d87c388 100644
--- a/libc/test/src/math/log10_test.cpp
+++ b/libc/test/src/math/log10_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/log10.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -101,7 +101,7 @@ TEST_F(LlvmLibcLog10Test, InDoubleRange) {
double x = FPBits(v).get_val();
if (FPBits(v).is_nan() || FPBits(v).is_inf() || x < 0.0)
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
double result = LIBC_NAMESPACE::log10(x);
++cc;
if (FPBits(result).is_nan() || FPBits(result).is_inf())
diff --git a/libc/test/src/math/log1p_test.cpp b/libc/test/src/math/log1p_test.cpp
index 107e965a0d3a..e5747b7e5ec0 100644
--- a/libc/test/src/math/log1p_test.cpp
+++ b/libc/test/src/math/log1p_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/log1p.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -102,7 +102,7 @@ TEST_F(LlvmLibcLog1pTest, InDoubleRange) {
double x = FPBits(v).get_val();
if (FPBits(v).is_nan() || FPBits(v).is_inf() || x < 0.0)
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
double result = LIBC_NAMESPACE::log1p(x);
++cc;
if (FPBits(result).is_nan() || FPBits(result).is_inf())
diff --git a/libc/test/src/math/log1pf_test.cpp b/libc/test/src/math/log1pf_test.cpp
index bb181dc5e43b..ffe2dd2c33dd 100644
--- a/libc/test/src/math/log1pf_test.cpp
+++ b/libc/test/src/math/log1pf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/log1pf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -75,7 +75,7 @@ TEST_F(LlvmLibcLog1pfTest, InFloatRange) {
float x = FPBits(v).get_val();
if (FPBits(v).is_nan() || FPBits(v).is_inf())
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log1p, x,
LIBC_NAMESPACE::log1pf(x), 0.5);
}
diff --git a/libc/test/src/math/log2_test.cpp b/libc/test/src/math/log2_test.cpp
index 8a07991a6888..fc440c09b42b 100644
--- a/libc/test/src/math/log2_test.cpp
+++ b/libc/test/src/math/log2_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/log2.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -100,7 +100,7 @@ TEST_F(LlvmLibcLog2Test, InDoubleRange) {
double x = FPBits(v).get_val();
if (FPBits(v).is_nan() || FPBits(v).is_inf() || x < 0.0)
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
double result = LIBC_NAMESPACE::log2(x);
++cc;
if (FPBits(result).is_nan() || FPBits(result).is_inf())
diff --git a/libc/test/src/math/log2f_test.cpp b/libc/test/src/math/log2f_test.cpp
index 83691fb75300..92226c763f45 100644
--- a/libc/test/src/math/log2f_test.cpp
+++ b/libc/test/src/math/log2f_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/log2f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -52,14 +52,13 @@ TEST_F(LlvmLibcLog2fTest, InFloatRange) {
float x = FPBits(v).get_val();
if (FPBits(v).is_nan() || FPBits(v).is_inf())
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
float result = LIBC_NAMESPACE::log2f(x);
// If the computation resulted in an error or did not produce valid result
// in the single-precision floating point range, then ignore comparing with
// MPFR result as MPFR can still produce valid results because of its
// wider precision.
- if (FPBits(result).is_nan() || FPBits(result).is_inf() ||
- LIBC_NAMESPACE::libc_errno != 0)
+ if (FPBits(result).is_nan() || FPBits(result).is_inf() || libc_errno != 0)
continue;
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log2, x,
LIBC_NAMESPACE::log2f(x), 0.5);
diff --git a/libc/test/src/math/log_test.cpp b/libc/test/src/math/log_test.cpp
index 969a469b2e1c..54afaa33d135 100644
--- a/libc/test/src/math/log_test.cpp
+++ b/libc/test/src/math/log_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/log.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -99,7 +99,7 @@ TEST_F(LlvmLibcLogTest, InDoubleRange) {
double x = FPBits(v).get_val();
if (FPBits(v).is_nan() || FPBits(v).is_inf() || x < 0.0)
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
double result = LIBC_NAMESPACE::log(x);
++cc;
if (FPBits(result).is_nan() || FPBits(result).is_inf())
diff --git a/libc/test/src/math/powf_test.cpp b/libc/test/src/math/powf_test.cpp
index 448dcc0035e9..4d189d813e58 100644
--- a/libc/test/src/math/powf_test.cpp
+++ b/libc/test/src/math/powf_test.cpp
@@ -78,7 +78,7 @@ TEST_F(LlvmLibcPowfTest, InFloatRange) {
if (FPBits(w).is_nan() || FPBits(w).is_inf())
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
float result = LIBC_NAMESPACE::powf(x, y);
++cc;
if (FPBits(result).is_nan() || FPBits(result).is_inf())
diff --git a/libc/test/src/math/sin_test.cpp b/libc/test/src/math/sin_test.cpp
index d4c6bd416a40..4d5d9ddf464b 100644
--- a/libc/test/src/math/sin_test.cpp
+++ b/libc/test/src/math/sin_test.cpp
@@ -71,7 +71,7 @@ TEST_F(LlvmLibcSinTest, InDoubleRange) {
double x = FPBits(v).get_val();
if (FPBits(v).is_nan() || FPBits(v).is_inf())
continue;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
double result = LIBC_NAMESPACE::sin(x);
++cc;
if (FPBits(result).is_nan() || FPBits(result).is_inf())
diff --git a/libc/test/src/math/sincosf_test.cpp b/libc/test/src/math/sincosf_test.cpp
index 2823110331f3..ad2155f329cd 100644
--- a/libc/test/src/math/sincosf_test.cpp
+++ b/libc/test/src/math/sincosf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/sincosf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -24,7 +24,7 @@ using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES;
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcSinCosfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
float sin, cos;
LIBC_NAMESPACE::sincosf(aNaN, &sin, &cos);
diff --git a/libc/test/src/math/sinf_test.cpp b/libc/test/src/math/sinf_test.cpp
index 8fd3ed1577ce..e0357e6157fd 100644
--- a/libc/test/src/math/sinf_test.cpp
+++ b/libc/test/src/math/sinf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/sinf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -24,7 +24,7 @@ using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES;
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcSinfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/sinhf_test.cpp b/libc/test/src/math/sinhf_test.cpp
index 6867c7aec57d..74f906ebaa98 100644
--- a/libc/test/src/math/sinhf_test.cpp
+++ b/libc/test/src/math/sinhf_test.cpp
@@ -9,7 +9,7 @@
#include "hdr/math_macros.h"
#include "src/__support/CPP/array.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/sinhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -22,7 +22,7 @@ using LlvmLibcSinhfTest = LIBC_NAMESPACE::testing::FPTest<float>;
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcSinhfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinhf(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -65,7 +65,7 @@ TEST_F(LlvmLibcSinhfTest, SmallValues) {
}
TEST_F(LlvmLibcSinhfTest, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, LIBC_NAMESPACE::sinhf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/sinpif_test.cpp b/libc/test/src/math/sinpif_test.cpp
index d00fd77d288c..986c676761f0 100644
--- a/libc/test/src/math/sinpif_test.cpp
+++ b/libc/test/src/math/sinpif_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/sinpif.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/src/math/sdcomp26094.h"
@@ -21,7 +21,7 @@ using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES;
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcSinpifTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinpif(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/FModTest.h b/libc/test/src/math/smoke/FModTest.h
index 8fbcc2a27654..04cbc659ece5 100644
--- a/libc/test/src/math/smoke/FModTest.h
+++ b/libc/test/src/math/smoke/FModTest.h
@@ -10,7 +10,7 @@
#define LLVM_LIBC_TEST_SRC_MATH_FMODTEST_H
#include "src/__support/FPUtil/FEnvImpl.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "test/UnitTest/FEnvSafeTest.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
diff --git a/libc/test/src/math/smoke/RoundToIntegerTest.h b/libc/test/src/math/smoke/RoundToIntegerTest.h
index 6ae97ce35a0d..745ccbc748ec 100644
--- a/libc/test/src/math/smoke/RoundToIntegerTest.h
+++ b/libc/test/src/math/smoke/RoundToIntegerTest.h
@@ -40,7 +40,7 @@ private:
void test_one_input(RoundToIntegerFunc func, F input, I expected,
bool expectError) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
ASSERT_EQ(func(input), expected);
diff --git a/libc/test/src/math/smoke/acos_test.cpp b/libc/test/src/math/smoke/acos_test.cpp
index 3a59bce26407..fe2caefb52ab 100644
--- a/libc/test/src/math/smoke/acos_test.cpp
+++ b/libc/test/src/math/smoke/acos_test.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "hdr/fenv_macros.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/acos.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -21,7 +21,7 @@ TEST_F(LlvmLibcAcosTest, SpecialNumbers) {
EXPECT_FP_EQ(0x1.921fb54442d18p0, LIBC_NAMESPACE::acos(zero));
EXPECT_FP_EQ(0x1.921fb54442d18p0, LIBC_NAMESPACE::acos(neg_zero));
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acos(inf),
FE_INVALID);
EXPECT_MATH_ERRNO(EDOM);
diff --git a/libc/test/src/math/smoke/acosf16_test.cpp b/libc/test/src/math/smoke/acosf16_test.cpp
index c4274b824509..7103dc33fec3 100644
--- a/libc/test/src/math/smoke/acosf16_test.cpp
+++ b/libc/test/src/math/smoke/acosf16_test.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/acosf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -15,7 +15,7 @@
using LlvmLibcAcosf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcAcosf16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::acosf16(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/acosf_test.cpp b/libc/test/src/math/smoke/acosf_test.cpp
index 74f68e00011a..257c6a3d1d22 100644
--- a/libc/test/src/math/smoke/acosf_test.cpp
+++ b/libc/test/src/math/smoke/acosf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/acosf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,7 +18,7 @@
using LlvmLibcAcosfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcAcosfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::acosf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/acoshf16_test.cpp b/libc/test/src/math/smoke/acoshf16_test.cpp
index 7681c2a4e7fb..6b9c995cf992 100644
--- a/libc/test/src/math/smoke/acoshf16_test.cpp
+++ b/libc/test/src/math/smoke/acoshf16_test.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "src/__support/FPUtil/cast.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/acoshf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -15,7 +15,7 @@
using LlvmLibcAcoshf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcAcoshf16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::acoshf16(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/acoshf_test.cpp b/libc/test/src/math/smoke/acoshf_test.cpp
index c5ba88055ac5..b6abfab99929 100644
--- a/libc/test/src/math/smoke/acoshf_test.cpp
+++ b/libc/test/src/math/smoke/acoshf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/acoshf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,7 +18,7 @@
using LlvmLibcAcoshfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcAcoshfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::acoshf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/acospif16_test.cpp b/libc/test/src/math/smoke/acospif16_test.cpp
index 66b94706eab9..4b2f6de3f7e3 100644
--- a/libc/test/src/math/smoke/acospif16_test.cpp
+++ b/libc/test/src/math/smoke/acospif16_test.cpp
@@ -6,14 +6,14 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/acospif16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
using LlvmLibcAcospif16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcAcospif16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::acospif16(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/asinf16_test.cpp b/libc/test/src/math/smoke/asinf16_test.cpp
index 9f675b08319c..b03f0a420a49 100644
--- a/libc/test/src/math/smoke/asinf16_test.cpp
+++ b/libc/test/src/math/smoke/asinf16_test.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/asinf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -15,7 +15,7 @@
using LlvmLibcAsinf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcAsinf16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::asinf16(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/asinf_test.cpp b/libc/test/src/math/smoke/asinf_test.cpp
index d817d2b36619..2615a8ddd16b 100644
--- a/libc/test/src/math/smoke/asinf_test.cpp
+++ b/libc/test/src/math/smoke/asinf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/asinf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,7 +18,7 @@
using LlvmLibcAsinfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcAsinfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::asinf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/asinhf16_test.cpp b/libc/test/src/math/smoke/asinhf16_test.cpp
index dcaab217331c..7f612ce3c467 100644
--- a/libc/test/src/math/smoke/asinhf16_test.cpp
+++ b/libc/test/src/math/smoke/asinhf16_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/asinhf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -14,7 +14,7 @@
using LlvmLibcAsinhf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcAsinhf16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::asinhf16(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/asinhf_test.cpp b/libc/test/src/math/smoke/asinhf_test.cpp
index 4a8743c50075..d812a2dffe8a 100644
--- a/libc/test/src/math/smoke/asinhf_test.cpp
+++ b/libc/test/src/math/smoke/asinhf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/asinhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,7 +18,7 @@
using LlvmLibcAsinhfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcAsinhfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::asinhf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/atan2f_test.cpp b/libc/test/src/math/smoke/atan2f_test.cpp
index 1fbcfbe96b2d..7f8cfb9830d2 100644
--- a/libc/test/src/math/smoke/atan2f_test.cpp
+++ b/libc/test/src/math/smoke/atan2f_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/atan2f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,7 +16,7 @@
using LlvmLibcAtan2fTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcAtan2fTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::atan2f(sNaN, sNaN),
FE_INVALID);
diff --git a/libc/test/src/math/smoke/atanf16_test.cpp b/libc/test/src/math/smoke/atanf16_test.cpp
index af50287d9b22..ba1e3b2fc8be 100644
--- a/libc/test/src/math/smoke/atanf16_test.cpp
+++ b/libc/test/src/math/smoke/atanf16_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/atanf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -14,7 +14,7 @@
using LlvmLibcAtanf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcAtanf16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::atanf16(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/atanf_test.cpp b/libc/test/src/math/smoke/atanf_test.cpp
index 7d09a28beaa3..b56b9d0162b9 100644
--- a/libc/test/src/math/smoke/atanf_test.cpp
+++ b/libc/test/src/math/smoke/atanf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/atanf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,7 +18,7 @@
using LlvmLibcAtanfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcAtanfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::atanf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/atanhf16_test.cpp b/libc/test/src/math/smoke/atanhf16_test.cpp
index 81df6da8cee2..c2a520f7638f 100644
--- a/libc/test/src/math/smoke/atanhf16_test.cpp
+++ b/libc/test/src/math/smoke/atanhf16_test.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "src/__support/FPUtil/cast.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/atanhf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -15,7 +15,7 @@
using LlvmLibcAtanhf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcAtanhf16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf16(sNaN),
FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/atanhf_test.cpp b/libc/test/src/math/smoke/atanhf_test.cpp
index 73a5b81b0240..038cb30d89a4 100644
--- a/libc/test/src/math/smoke/atanhf_test.cpp
+++ b/libc/test/src/math/smoke/atanhf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/atanhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -20,7 +20,7 @@ using LIBC_NAMESPACE::Sign;
using LlvmLibcAtanhfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcAtanhfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::atanhf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
// TODO: Strengthen errno,exception checks and remove these assert macros
diff --git a/libc/test/src/math/smoke/cosf16_test.cpp b/libc/test/src/math/smoke/cosf16_test.cpp
index 2638551fb1d1..4362a5a3a4bd 100644
--- a/libc/test/src/math/smoke/cosf16_test.cpp
+++ b/libc/test/src/math/smoke/cosf16_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/cosf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -14,7 +14,7 @@
using LlvmLibcCosf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcCosf16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::cosf16(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/cosf_test.cpp b/libc/test/src/math/smoke/cosf_test.cpp
index 99773583dcb1..470a876c63a7 100644
--- a/libc/test/src/math/smoke/cosf_test.cpp
+++ b/libc/test/src/math/smoke/cosf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/cosf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,7 +18,7 @@
using LlvmLibcCosfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcCosfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::cosf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/coshf16_test.cpp b/libc/test/src/math/smoke/coshf16_test.cpp
index 08d05ecce86b..7bf62afa24c4 100644
--- a/libc/test/src/math/smoke/coshf16_test.cpp
+++ b/libc/test/src/math/smoke/coshf16_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/coshf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,7 +16,7 @@
using LlvmLibcCoshf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcCoshf16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::coshf16(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcCoshf16Test, SpecialNumbers) {
}
TEST_F(LlvmLibcCoshf16Test, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::coshf16(max_normal),
FE_OVERFLOW | FE_INEXACT);
diff --git a/libc/test/src/math/smoke/coshf_test.cpp b/libc/test/src/math/smoke/coshf_test.cpp
index 1611ea1b9292..ee8f0199df3b 100644
--- a/libc/test/src/math/smoke/coshf_test.cpp
+++ b/libc/test/src/math/smoke/coshf_test.cpp
@@ -9,7 +9,7 @@
#include "hdr/math_macros.h"
#include "src/__support/CPP/array.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/coshf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -19,7 +19,7 @@
using LlvmLibcCoshfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcCoshfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::coshf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
@@ -41,7 +41,7 @@ TEST_F(LlvmLibcCoshfTest, SpecialNumbers) {
}
TEST_F(LlvmLibcCoshfTest, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, LIBC_NAMESPACE::coshf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/smoke/cospif16_test.cpp b/libc/test/src/math/smoke/cospif16_test.cpp
index edd8ed97b30f..fcde0cc79e35 100644
--- a/libc/test/src/math/smoke/cospif16_test.cpp
+++ b/libc/test/src/math/smoke/cospif16_test.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "src/__support/FPUtil/cast.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/cospif16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -15,7 +15,7 @@
using LlvmLibcCospif16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcCospif16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::cospif16(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/cospif_test.cpp b/libc/test/src/math/smoke/cospif_test.cpp
index 20153897dc45..3d48909cca93 100644
--- a/libc/test/src/math/smoke/cospif_test.cpp
+++ b/libc/test/src/math/smoke/cospif_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/cospif.h"
#include "test/UnitTest/FPMatcher.h"
@@ -15,7 +15,7 @@
using LlvmLibcCospifTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcCospifTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::cospif(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/exp10_test.cpp b/libc/test/src/math/smoke/exp10_test.cpp
index baf8a7681097..50d3de0c7fe7 100644
--- a/libc/test/src/math/smoke/exp10_test.cpp
+++ b/libc/test/src/math/smoke/exp10_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/exp10.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
diff --git a/libc/test/src/math/smoke/exp10f16_test.cpp b/libc/test/src/math/smoke/exp10f16_test.cpp
index 1c4ef2aa08a7..bda40348f883 100644
--- a/libc/test/src/math/smoke/exp10f16_test.cpp
+++ b/libc/test/src/math/smoke/exp10f16_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/exp10f16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,7 +16,7 @@
using LlvmLibcExp10f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcExp10f16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::exp10f16(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExp10f16Test, SpecialNumbers) {
}
TEST_F(LlvmLibcExp10f16Test, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp10f16(max_normal),
FE_OVERFLOW);
@@ -53,7 +53,7 @@ TEST_F(LlvmLibcExp10f16Test, Overflow) {
}
TEST_F(LlvmLibcExp10f16Test, Underflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp10f16(neg_max_normal),
FE_UNDERFLOW | FE_INEXACT);
diff --git a/libc/test/src/math/smoke/exp10f_test.cpp b/libc/test/src/math/smoke/exp10f_test.cpp
index bf39e2cc12d0..fcd334bb9e36 100644
--- a/libc/test/src/math/smoke/exp10f_test.cpp
+++ b/libc/test/src/math/smoke/exp10f_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/exp10f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,7 +18,7 @@
using LlvmLibcExp10fTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcExp10fTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::exp10f(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
@@ -44,7 +44,7 @@ TEST_F(LlvmLibcExp10fTest, SpecialNumbers) {
}
TEST_F(LlvmLibcExp10fTest, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, LIBC_NAMESPACE::exp10f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/smoke/exp10m1f16_test.cpp b/libc/test/src/math/smoke/exp10m1f16_test.cpp
index dfa7fa477d3d..ed2d5a48b316 100644
--- a/libc/test/src/math/smoke/exp10m1f16_test.cpp
+++ b/libc/test/src/math/smoke/exp10m1f16_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/exp10m1f16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,7 +16,7 @@
using LlvmLibcExp10m1f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcExp10m1f16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::exp10m1f16(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExp10m1f16Test, SpecialNumbers) {
}
TEST_F(LlvmLibcExp10m1f16Test, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp10m1f16(max_normal),
FE_OVERFLOW | FE_INEXACT);
@@ -67,7 +67,7 @@ TEST_F(LlvmLibcExp10m1f16Test, Overflow) {
}
TEST_F(LlvmLibcExp10m1f16Test, ResultNearNegOne) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(LIBC_NAMESPACE::fputil::cast<float16>(-1.0),
LIBC_NAMESPACE::exp10m1f16(neg_max_normal),
diff --git a/libc/test/src/math/smoke/exp10m1f_test.cpp b/libc/test/src/math/smoke/exp10m1f_test.cpp
index 2c2cfdbb08a3..19369a897aaa 100644
--- a/libc/test/src/math/smoke/exp10m1f_test.cpp
+++ b/libc/test/src/math/smoke/exp10m1f_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/exp10m1f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -14,7 +14,7 @@
using LlvmLibcExp10m1fTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcExp10m1fTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::exp10m1f(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
@@ -34,7 +34,7 @@ TEST_F(LlvmLibcExp10m1fTest, SpecialNumbers) {
}
TEST_F(LlvmLibcExp10m1fTest, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp10m1f(0x1.fffffep+127f),
FE_OVERFLOW);
@@ -50,7 +50,7 @@ TEST_F(LlvmLibcExp10m1fTest, Overflow) {
}
TEST_F(LlvmLibcExp10m1fTest, Underflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(-1.0f, LIBC_NAMESPACE::exp10m1f(-max_normal),
FE_UNDERFLOW);
diff --git a/libc/test/src/math/smoke/exp2_test.cpp b/libc/test/src/math/smoke/exp2_test.cpp
index 9ab9129416da..aebf80835072 100644
--- a/libc/test/src/math/smoke/exp2_test.cpp
+++ b/libc/test/src/math/smoke/exp2_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/exp2.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
diff --git a/libc/test/src/math/smoke/exp2f16_test.cpp b/libc/test/src/math/smoke/exp2f16_test.cpp
index f69b33a3cf37..1eb7343dcd22 100644
--- a/libc/test/src/math/smoke/exp2f16_test.cpp
+++ b/libc/test/src/math/smoke/exp2f16_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/exp2f16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,7 +16,7 @@
using LlvmLibcExp2f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcExp2f16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::exp2f16(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExp2f16Test, SpecialNumbers) {
}
TEST_F(LlvmLibcExp2f16Test, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp2f16(max_normal),
FE_OVERFLOW);
@@ -53,7 +53,7 @@ TEST_F(LlvmLibcExp2f16Test, Overflow) {
}
TEST_F(LlvmLibcExp2f16Test, Underflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp2f16(neg_max_normal),
FE_UNDERFLOW | FE_INEXACT);
diff --git a/libc/test/src/math/smoke/exp2f_test.cpp b/libc/test/src/math/smoke/exp2f_test.cpp
index a928389cc41b..c5243273d9ed 100644
--- a/libc/test/src/math/smoke/exp2f_test.cpp
+++ b/libc/test/src/math/smoke/exp2f_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/exp2f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,7 +18,7 @@
using LlvmLibcExp2fTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcExp2fTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::exp2f(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
@@ -45,7 +45,7 @@ TEST_F(LlvmLibcExp2fTest, SpecialNumbers) {
}
TEST_F(LlvmLibcExp2fTest, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, LIBC_NAMESPACE::exp2f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/smoke/exp2m1f16_test.cpp b/libc/test/src/math/smoke/exp2m1f16_test.cpp
index f423196a7036..635b7a6e187d 100644
--- a/libc/test/src/math/smoke/exp2m1f16_test.cpp
+++ b/libc/test/src/math/smoke/exp2m1f16_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/exp2m1f16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,7 +16,7 @@
using LlvmLibcExp2m1f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcExp2m1f16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::exp2m1f16(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -39,7 +39,7 @@ TEST_F(LlvmLibcExp2m1f16Test, SpecialNumbers) {
}
TEST_F(LlvmLibcExp2m1f16Test, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp2m1f16(max_normal),
FE_OVERFLOW | FE_INEXACT);
@@ -65,7 +65,7 @@ TEST_F(LlvmLibcExp2m1f16Test, Overflow) {
}
TEST_F(LlvmLibcExp2m1f16Test, ResultNearNegOne) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(-1.0, LIBC_NAMESPACE::exp2m1f16(neg_max_normal),
FE_INEXACT);
diff --git a/libc/test/src/math/smoke/exp2m1f_test.cpp b/libc/test/src/math/smoke/exp2m1f_test.cpp
index 99bdf0035df0..63852e11655a 100644
--- a/libc/test/src/math/smoke/exp2m1f_test.cpp
+++ b/libc/test/src/math/smoke/exp2m1f_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/exp2m1f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,7 +16,7 @@ using LIBC_NAMESPACE::fputil::testing::ForceRoundingMode;
using LIBC_NAMESPACE::fputil::testing::RoundingMode;
TEST_F(LlvmLibcExp2m1fTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::exp2m1f(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
@@ -34,7 +34,7 @@ TEST_F(LlvmLibcExp2m1fTest, SpecialNumbers) {
}
TEST_F(LlvmLibcExp2m1fTest, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp2m1f(0x1.fffffep+127),
FE_OVERFLOW);
@@ -50,7 +50,7 @@ TEST_F(LlvmLibcExp2m1fTest, Overflow) {
}
TEST_F(LlvmLibcExp2m1fTest, Underflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(-1.0f, LIBC_NAMESPACE::exp2m1f(-0x1.fffffep+127),
FE_UNDERFLOW);
diff --git a/libc/test/src/math/smoke/exp_test.cpp b/libc/test/src/math/smoke/exp_test.cpp
index f86243092f1f..c3b2ae70e1d9 100644
--- a/libc/test/src/math/smoke/exp_test.cpp
+++ b/libc/test/src/math/smoke/exp_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/exp.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
diff --git a/libc/test/src/math/smoke/expf16_test.cpp b/libc/test/src/math/smoke/expf16_test.cpp
index ab745a3cf6f5..863f694ffc41 100644
--- a/libc/test/src/math/smoke/expf16_test.cpp
+++ b/libc/test/src/math/smoke/expf16_test.cpp
@@ -9,7 +9,7 @@
#include "hdr/errno_macros.h"
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/expf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -17,7 +17,7 @@
using LlvmLibcExpf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcExpf16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::expf16(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -41,7 +41,7 @@ TEST_F(LlvmLibcExpf16Test, SpecialNumbers) {
}
TEST_F(LlvmLibcExpf16Test, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::expf16(max_normal),
FE_OVERFLOW);
@@ -54,7 +54,7 @@ TEST_F(LlvmLibcExpf16Test, Overflow) {
}
TEST_F(LlvmLibcExpf16Test, Underflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::expf16(neg_max_normal),
FE_UNDERFLOW | FE_INEXACT);
diff --git a/libc/test/src/math/smoke/expf_test.cpp b/libc/test/src/math/smoke/expf_test.cpp
index eee830499927..d34151735afa 100644
--- a/libc/test/src/math/smoke/expf_test.cpp
+++ b/libc/test/src/math/smoke/expf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/expf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,7 +18,7 @@
using LlvmLibcExpfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcExpfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::expf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExpfTest, SpecialNumbers) {
}
TEST_F(LlvmLibcExpfTest, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, LIBC_NAMESPACE::expf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/smoke/expm1_test.cpp b/libc/test/src/math/smoke/expm1_test.cpp
index bc71c53abc7a..c842fe3c45fe 100644
--- a/libc/test/src/math/smoke/expm1_test.cpp
+++ b/libc/test/src/math/smoke/expm1_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/expm1.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
diff --git a/libc/test/src/math/smoke/expm1f16_test.cpp b/libc/test/src/math/smoke/expm1f16_test.cpp
index f297c5dfc3c7..4d19a9bac5eb 100644
--- a/libc/test/src/math/smoke/expm1f16_test.cpp
+++ b/libc/test/src/math/smoke/expm1f16_test.cpp
@@ -9,7 +9,7 @@
#include "hdr/errno_macros.h"
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/expm1f16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -17,7 +17,7 @@
using LlvmLibcExpm1f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcExpm1f16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::expm1f16(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExpm1f16Test, SpecialNumbers) {
}
TEST_F(LlvmLibcExpm1f16Test, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::expm1f16(max_normal),
FE_OVERFLOW | FE_INEXACT);
@@ -67,7 +67,7 @@ TEST_F(LlvmLibcExpm1f16Test, Overflow) {
}
TEST_F(LlvmLibcExpm1f16Test, ResultNearNegOne) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(LIBC_NAMESPACE::fputil::cast<float16>(-1.0),
LIBC_NAMESPACE::expm1f16(neg_max_normal),
diff --git a/libc/test/src/math/smoke/expm1f_test.cpp b/libc/test/src/math/smoke/expm1f_test.cpp
index dfb474d70fb6..214bfe8abd4d 100644
--- a/libc/test/src/math/smoke/expm1f_test.cpp
+++ b/libc/test/src/math/smoke/expm1f_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/expm1f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,7 +18,7 @@
using LlvmLibcExpm1fTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcExpm1fTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::expm1f(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExpm1fTest, SpecialNumbers) {
}
TEST_F(LlvmLibcExpm1fTest, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, LIBC_NAMESPACE::expm1f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/smoke/log10_test.cpp b/libc/test/src/math/smoke/log10_test.cpp
index ff73850c5210..49cfda85111a 100644
--- a/libc/test/src/math/smoke/log10_test.cpp
+++ b/libc/test/src/math/smoke/log10_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/log10.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
diff --git a/libc/test/src/math/smoke/log10f16_test.cpp b/libc/test/src/math/smoke/log10f16_test.cpp
index 471e19893332..53f5ac46aa60 100644
--- a/libc/test/src/math/smoke/log10f16_test.cpp
+++ b/libc/test/src/math/smoke/log10f16_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/log10f16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,7 +16,7 @@
using LlvmLibcLog10f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcLog10f16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::log10f16(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/log1p_test.cpp b/libc/test/src/math/smoke/log1p_test.cpp
index 631c24b8abcf..61c56cd2c6dd 100644
--- a/libc/test/src/math/smoke/log1p_test.cpp
+++ b/libc/test/src/math/smoke/log1p_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/log1p.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
diff --git a/libc/test/src/math/smoke/log1pf_test.cpp b/libc/test/src/math/smoke/log1pf_test.cpp
index bd828ad58c4c..dc3489fddf99 100644
--- a/libc/test/src/math/smoke/log1pf_test.cpp
+++ b/libc/test/src/math/smoke/log1pf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/log1pf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
diff --git a/libc/test/src/math/smoke/log2_test.cpp b/libc/test/src/math/smoke/log2_test.cpp
index 9993d442967c..0534d00b1f40 100644
--- a/libc/test/src/math/smoke/log2_test.cpp
+++ b/libc/test/src/math/smoke/log2_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/log2.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
diff --git a/libc/test/src/math/smoke/log2f16_test.cpp b/libc/test/src/math/smoke/log2f16_test.cpp
index 6d98482aa449..fd20652d2f00 100644
--- a/libc/test/src/math/smoke/log2f16_test.cpp
+++ b/libc/test/src/math/smoke/log2f16_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/log2f16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,7 +16,7 @@
using LlvmLibcLog2f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcLog2f16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::log2f16(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/log2f_test.cpp b/libc/test/src/math/smoke/log2f_test.cpp
index 8648b75b88b8..53d54ac36763 100644
--- a/libc/test/src/math/smoke/log2f_test.cpp
+++ b/libc/test/src/math/smoke/log2f_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/log2f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
diff --git a/libc/test/src/math/smoke/log_test.cpp b/libc/test/src/math/smoke/log_test.cpp
index d31eb0c1db73..09e9ab0a9a4d 100644
--- a/libc/test/src/math/smoke/log_test.cpp
+++ b/libc/test/src/math/smoke/log_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/log.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
diff --git a/libc/test/src/math/smoke/logf16_test.cpp b/libc/test/src/math/smoke/logf16_test.cpp
index c7232aa1c1e3..2784f3d5fa54 100644
--- a/libc/test/src/math/smoke/logf16_test.cpp
+++ b/libc/test/src/math/smoke/logf16_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/logf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,7 +16,7 @@
using LlvmLibcLogf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcLogf16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::logf16(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/sincosf_test.cpp b/libc/test/src/math/smoke/sincosf_test.cpp
index 5f66868f12a1..8ba0d04347bb 100644
--- a/libc/test/src/math/smoke/sincosf_test.cpp
+++ b/libc/test/src/math/smoke/sincosf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/sincosf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,7 +18,7 @@
using LlvmLibcSinCosfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcSinCosfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
float sin, cos;
LIBC_NAMESPACE::sincosf(sNaN, &sin, &cos);
diff --git a/libc/test/src/math/smoke/sinf16_test.cpp b/libc/test/src/math/smoke/sinf16_test.cpp
index a0e7a7ba321f..6b168ac040db 100644
--- a/libc/test/src/math/smoke/sinf16_test.cpp
+++ b/libc/test/src/math/smoke/sinf16_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/sinf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -14,7 +14,7 @@
using LlvmLibcSinf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcSinf16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::sinf16(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/sinf_test.cpp b/libc/test/src/math/smoke/sinf_test.cpp
index de504b4f5335..8173969fb256 100644
--- a/libc/test/src/math/smoke/sinf_test.cpp
+++ b/libc/test/src/math/smoke/sinf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/sinf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,7 +18,7 @@
using LlvmLibcSinfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcSinfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::sinf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/sinhf16_test.cpp b/libc/test/src/math/smoke/sinhf16_test.cpp
index 4f21d33ba78e..d52739a9adb3 100644
--- a/libc/test/src/math/smoke/sinhf16_test.cpp
+++ b/libc/test/src/math/smoke/sinhf16_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/sinhf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,7 +16,7 @@
using LlvmLibcSinhf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcSinhf16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::sinhf16(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -38,7 +38,7 @@ TEST_F(LlvmLibcSinhf16Test, SpecialNumbers) {
}
TEST_F(LlvmLibcSinhf16Test, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::sinhf16(max_normal),
FE_OVERFLOW | FE_INEXACT);
diff --git a/libc/test/src/math/smoke/sinhf_test.cpp b/libc/test/src/math/smoke/sinhf_test.cpp
index e22cfc7ea14d..ea6a4474a780 100644
--- a/libc/test/src/math/smoke/sinhf_test.cpp
+++ b/libc/test/src/math/smoke/sinhf_test.cpp
@@ -9,7 +9,7 @@
#include "hdr/math_macros.h"
#include "src/__support/CPP/array.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/sinhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -19,7 +19,7 @@
using LlvmLibcSinhfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcSinhfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::sinhf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
@@ -52,7 +52,7 @@ TEST_F(LlvmLibcSinhfTest, SmallValues) {
}
TEST_F(LlvmLibcSinhfTest, Overflow) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, LIBC_NAMESPACE::sinhf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/smoke/sinpif16_test.cpp b/libc/test/src/math/smoke/sinpif16_test.cpp
index b2db6fb9f862..9edf2cc663d4 100644
--- a/libc/test/src/math/smoke/sinpif16_test.cpp
+++ b/libc/test/src/math/smoke/sinpif16_test.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "src/__support/FPUtil/cast.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/sinpif16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -15,7 +15,7 @@
using LlvmLibcSinpif16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcSinpif16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::sinpif16(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/sinpif_test.cpp b/libc/test/src/math/smoke/sinpif_test.cpp
index 1ba5c1d2b720..b840f3980eda 100644
--- a/libc/test/src/math/smoke/sinpif_test.cpp
+++ b/libc/test/src/math/smoke/sinpif_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/sinpif.h"
#include "test/UnitTest/FPMatcher.h"
@@ -15,7 +15,7 @@
using LlvmLibcSinpifTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcSinpifTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::sinpif(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/tanf16_test.cpp b/libc/test/src/math/smoke/tanf16_test.cpp
index f65b9fced72c..95d200cf5591 100644
--- a/libc/test/src/math/smoke/tanf16_test.cpp
+++ b/libc/test/src/math/smoke/tanf16_test.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/tanf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -15,7 +15,7 @@
using LlvmLibcTanf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcTanf16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::tanf16(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/tanf_test.cpp b/libc/test/src/math/smoke/tanf_test.cpp
index 178e9065f430..12deca5cf941 100644
--- a/libc/test/src/math/smoke/tanf_test.cpp
+++ b/libc/test/src/math/smoke/tanf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/tanf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,7 +18,7 @@
using LlvmLibcTanfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcTanfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::tanf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/tanhf16_test.cpp b/libc/test/src/math/smoke/tanhf16_test.cpp
index fa6328e9ef0a..eb90f02a8d7c 100644
--- a/libc/test/src/math/smoke/tanhf16_test.cpp
+++ b/libc/test/src/math/smoke/tanhf16_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/tanhf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,7 +16,7 @@
using LlvmLibcTanhf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcTanhf16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::tanhf16(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcTanhf16Test, SpecialNumbers) {
}
TEST_F(LlvmLibcTanhf16Test, ResultNearBounds) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(LIBC_NAMESPACE::fputil::cast<float16>(1.0),
LIBC_NAMESPACE::tanhf16(max_normal), FE_INEXACT);
diff --git a/libc/test/src/math/smoke/tanhf_test.cpp b/libc/test/src/math/smoke/tanhf_test.cpp
index c09761ef531f..b12a331b3190 100644
--- a/libc/test/src/math/smoke/tanhf_test.cpp
+++ b/libc/test/src/math/smoke/tanhf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/tanhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,7 +18,7 @@
using LlvmLibcTanhfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcTanhfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::tanhf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/tanpif16_test.cpp b/libc/test/src/math/smoke/tanpif16_test.cpp
index 74797d1649b1..ea896d7bb3e5 100644
--- a/libc/test/src/math/smoke/tanpif16_test.cpp
+++ b/libc/test/src/math/smoke/tanpif16_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/tanpif16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -14,7 +14,7 @@
using LlvmLibcTanpif16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcTanpif16Test, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::tanpif16(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/tanf_test.cpp b/libc/test/src/math/tanf_test.cpp
index 9061cf6fb30b..ecc70194b649 100644
--- a/libc/test/src/math/tanf_test.cpp
+++ b/libc/test/src/math/tanf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/tanf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -24,7 +24,7 @@ using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES;
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcTanfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/tanhf_test.cpp b/libc/test/src/math/tanhf_test.cpp
index 389abe4d8589..966ce649e2b3 100644
--- a/libc/test/src/math/tanhf_test.cpp
+++ b/libc/test/src/math/tanhf_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/math/tanhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -21,7 +21,7 @@ using LlvmLibcTanhfTest = LIBC_NAMESPACE::testing::FPTest<float>;
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcTanhfTest, SpecialNumbers) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanhf(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/poll/poll_test.cpp b/libc/test/src/poll/poll_test.cpp
index 30f5e41c61ec..97b7b0271817 100644
--- a/libc/test/src/poll/poll_test.cpp
+++ b/libc/test/src/poll/poll_test.cpp
@@ -7,18 +7,18 @@
//===----------------------------------------------------------------------===//
#include "hdr/limits_macros.h" // UINT_MAX
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/poll/poll.h"
#include "test/UnitTest/Test.h"
TEST(LlvmLibcPollTest, SmokeTest) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
int ret = LIBC_NAMESPACE::poll(nullptr, 0, 0);
ASSERT_ERRNO_SUCCESS();
ASSERT_EQ(0, ret);
}
TEST(LlvmLibcPollTest, SmokeFailureTest) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
int ret = LIBC_NAMESPACE::poll(nullptr, UINT_MAX, 0);
ASSERT_ERRNO_EQ(EINVAL);
ASSERT_EQ(-1, ret);
diff --git a/libc/test/src/sched/affinity_test.cpp b/libc/test/src/sched/affinity_test.cpp
index b5085203e5ce..b77f22f8e60d 100644
--- a/libc/test/src/sched/affinity_test.cpp
+++ b/libc/test/src/sched/affinity_test.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "src/__support/OSUtil/syscall.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/sched/sched_getaffinity.h"
#include "src/sched/sched_setaffinity.h"
#include "test/UnitTest/ErrnoSetterMatcher.h"
@@ -17,7 +17,7 @@
TEST(LlvmLibcSchedAffinityTest, SmokeTest) {
cpu_set_t mask;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
pid_t tid = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_gettid);
ASSERT_GT(tid, pid_t(0));
@@ -32,15 +32,15 @@ TEST(LlvmLibcSchedAffinityTest, BadMask) {
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
pid_t tid = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_gettid);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
ASSERT_THAT(
LIBC_NAMESPACE::sched_getaffinity(tid, sizeof(cpu_set_t), nullptr),
Fails(EFAULT));
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
ASSERT_THAT(
LIBC_NAMESPACE::sched_setaffinity(tid, sizeof(cpu_set_t), nullptr),
Fails(EFAULT));
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
}
diff --git a/libc/test/src/sched/cpu_count_test.cpp b/libc/test/src/sched/cpu_count_test.cpp
index 5250368a2616..919f1475e1d4 100644
--- a/libc/test/src/sched/cpu_count_test.cpp
+++ b/libc/test/src/sched/cpu_count_test.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "src/__support/OSUtil/syscall.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/sched/sched_getaffinity.h"
#include "src/sched/sched_getcpucount.h"
#include "test/UnitTest/ErrnoSetterMatcher.h"
@@ -17,7 +17,7 @@
TEST(LlvmLibcSchedCpuCountTest, SmokeTest) {
cpu_set_t mask;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
pid_t tid = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_gettid);
ASSERT_GT(tid, pid_t(0));
diff --git a/libc/test/src/sched/get_priority_test.cpp b/libc/test/src/sched/get_priority_test.cpp
index 59205c51e4a1..bb41dc0be201 100644
--- a/libc/test/src/sched/get_priority_test.cpp
+++ b/libc/test/src/sched/get_priority_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/sched/sched_get_priority_max.h"
#include "src/sched/sched_get_priority_min.h"
#include "test/UnitTest/Test.h"
@@ -58,7 +58,7 @@ TEST(LlvmLibcSchedGetPriorityTest, HandleBadPolicyTest) {
}
TEST(LlvmLibcSchedGetPriorityTest, SmokeTest) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
// We Test:
// SCHED_OTHER, SCHED_FIFO, SCHED_RR
diff --git a/libc/test/src/sched/param_and_scheduler_test.cpp b/libc/test/src/sched/param_and_scheduler_test.cpp
index 747c7e3409e4..4f2b6e412a4b 100644
--- a/libc/test/src/sched/param_and_scheduler_test.cpp
+++ b/libc/test/src/sched/param_and_scheduler_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/sched/sched_get_priority_max.h"
#include "src/sched/sched_get_priority_min.h"
#include "src/sched/sched_getparam.h"
@@ -37,7 +37,7 @@
class SchedTest : public LIBC_NAMESPACE::testing::Test {
public:
void testSched(int policy, bool is_mandatory) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
int init_policy = LIBC_NAMESPACE::sched_getscheduler(0);
ASSERT_GE(init_policy, 0);
@@ -55,30 +55,29 @@ public:
// Negative pid
ASSERT_EQ(LIBC_NAMESPACE::sched_setscheduler(-1, policy, &param), -1);
ASSERT_ERRNO_EQ(EINVAL);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
ASSERT_EQ(LIBC_NAMESPACE::sched_getscheduler(-1), -1);
ASSERT_ERRNO_EQ(EINVAL);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
// Invalid Policy
ASSERT_EQ(LIBC_NAMESPACE::sched_setscheduler(0, policy | 128, &param), -1);
ASSERT_ERRNO_EQ(EINVAL);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
// Out of bounds priority
param.sched_priority = min_priority - 1;
ASSERT_EQ(LIBC_NAMESPACE::sched_setscheduler(0, policy, &param), -1);
ASSERT_ERRNO_EQ(EINVAL);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
param.sched_priority = max_priority + 1;
ASSERT_EQ(LIBC_NAMESPACE::sched_setscheduler(0, policy, &param), -1);
// A bit hard to test as depending on user privileges we can run into
// different issues.
- ASSERT_TRUE(LIBC_NAMESPACE::libc_errno == EINVAL ||
- LIBC_NAMESPACE::libc_errno == EPERM);
- LIBC_NAMESPACE::libc_errno = 0;
+ ASSERT_TRUE(libc_errno == EINVAL || libc_errno == EPERM);
+ libc_errno = 0;
param.sched_priority = min_priority;
// Success/unsupported policy/missing permissions.
@@ -87,10 +86,9 @@ public:
ASSERT_TRUE(setscheduler_result == 0 || setscheduler_result == -1);
ASSERT_TRUE(
setscheduler_result != -1
- ? (LIBC_NAMESPACE::libc_errno == 0)
- : ((!is_mandatory && LIBC_NAMESPACE::libc_errno == EINVAL) ||
- LIBC_NAMESPACE::libc_errno == EPERM));
- LIBC_NAMESPACE::libc_errno = 0;
+ ? (libc_errno == 0)
+ : ((!is_mandatory && libc_errno == EINVAL) || libc_errno == EPERM));
+ libc_errno = 0;
ASSERT_EQ(LIBC_NAMESPACE::sched_getscheduler(0),
setscheduler_result != -1 ? policy : init_policy);
@@ -100,12 +98,12 @@ public:
param.sched_priority = -1;
ASSERT_EQ(LIBC_NAMESPACE::sched_setparam(0, &param), -1);
ASSERT_ERRNO_EQ(EINVAL);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
param.sched_priority = max_priority + 1;
ASSERT_EQ(LIBC_NAMESPACE::sched_setparam(0, &param), -1);
ASSERT_ERRNO_EQ(EINVAL);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
for (int priority = min_priority; priority <= max_priority; ++priority) {
ASSERT_EQ(LIBC_NAMESPACE::sched_getparam(0, &param), 0);
@@ -117,21 +115,20 @@ public:
// Negative pid
ASSERT_EQ(LIBC_NAMESPACE::sched_setparam(-1, &param), -1);
ASSERT_ERRNO_EQ(EINVAL);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
ASSERT_EQ(LIBC_NAMESPACE::sched_getparam(-1, &param), -1);
ASSERT_ERRNO_EQ(EINVAL);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
// Success/unsupported policy/missing permissions
int setparam_result = LIBC_NAMESPACE::sched_setparam(0, &param);
ASSERT_TRUE(setparam_result == 0 || setparam_result == -1);
ASSERT_TRUE(setparam_result != -1
- ? (LIBC_NAMESPACE::libc_errno == 0)
- : ((setscheduler_result == -1 &&
- LIBC_NAMESPACE::libc_errno == EINVAL) ||
- LIBC_NAMESPACE::libc_errno == EPERM));
- LIBC_NAMESPACE::libc_errno = 0;
+ ? (libc_errno == 0)
+ : ((setscheduler_result == -1 && libc_errno == EINVAL) ||
+ libc_errno == EPERM));
+ libc_errno = 0;
ASSERT_EQ(LIBC_NAMESPACE::sched_getparam(0, &param), 0);
ASSERT_ERRNO_SUCCESS();
@@ -143,7 +140,7 @@ public:
// Null test
ASSERT_EQ(LIBC_NAMESPACE::sched_setscheduler(0, policy, nullptr), -1);
ASSERT_ERRNO_EQ(EINVAL);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
}
};
@@ -161,13 +158,13 @@ LIST_SCHED_TESTS(SCHED_BATCH, true)
LIST_SCHED_TESTS(SCHED_IDLE, true)
TEST(LlvmLibcSchedParamAndSchedulerTest, NullParamTest) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
ASSERT_EQ(LIBC_NAMESPACE::sched_setparam(0, nullptr), -1);
ASSERT_ERRNO_EQ(EINVAL);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
ASSERT_EQ(LIBC_NAMESPACE::sched_getparam(0, nullptr), -1);
ASSERT_ERRNO_EQ(EINVAL);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
}
diff --git a/libc/test/src/sched/sched_rr_get_interval_test.cpp b/libc/test/src/sched/sched_rr_get_interval_test.cpp
index c22a2c76d743..a0fe5edbe014 100644
--- a/libc/test/src/sched/sched_rr_get_interval_test.cpp
+++ b/libc/test/src/sched/sched_rr_get_interval_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/sched/sched_get_priority_min.h"
#include "src/sched/sched_getscheduler.h"
#include "src/sched/sched_rr_get_interval.h"
@@ -17,7 +17,7 @@
#include <sched.h>
TEST(LlvmLibcSchedRRGetIntervalTest, SmokeTest) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
auto SetSched = [&](int policy) {
int min_priority = LIBC_NAMESPACE::sched_get_priority_min(policy);
ASSERT_GE(min_priority, 0);
@@ -58,19 +58,19 @@ TEST(LlvmLibcSchedRRGetIntervalTest, SmokeTest) {
// Null timespec
ASSERT_EQ(LIBC_NAMESPACE::sched_rr_get_interval(0, nullptr), -1);
ASSERT_ERRNO_EQ(EFAULT);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
// Negative pid
ASSERT_EQ(LIBC_NAMESPACE::sched_rr_get_interval(-1, &ts), -1);
ASSERT_ERRNO_EQ(EINVAL);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
}
// Negative tests don't have SCHED_RR set
SetSched(SCHED_OTHER);
ASSERT_EQ(LIBC_NAMESPACE::sched_rr_get_interval(0, &ts), 0);
ASSERT_ERRNO_SUCCESS();
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
// TODO: Missing unkown pid -> ESRCH. This is read only so safe to try a few
// unlikely values.
diff --git a/libc/test/src/sched/yield_test.cpp b/libc/test/src/sched/yield_test.cpp
index f1627a71fa9a..4d13d50e25eb 100644
--- a/libc/test/src/sched/yield_test.cpp
+++ b/libc/test/src/sched/yield_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/sched/sched_yield.h"
#include "test/UnitTest/Test.h"
TEST(LlvmLibcSchedYieldTest, SmokeTest) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
// sched_yield() always succeeds, just do a basic test that errno/ret are
// properly 0.
ASSERT_EQ(LIBC_NAMESPACE::sched_yield(), 0);
diff --git a/libc/test/src/signal/sigaltstack_test.cpp b/libc/test/src/signal/sigaltstack_test.cpp
index cc392da8f473..ce4dfddae248 100644
--- a/libc/test/src/signal/sigaltstack_test.cpp
+++ b/libc/test/src/signal/sigaltstack_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/signal_macros.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/signal/linux/signal_utils.h"
#include "src/signal/raise.h"
#include "src/signal/sigaction.h"
@@ -46,7 +46,7 @@ static void handler(int) {
TEST(LlvmLibcSignalTest, SigaltstackRunOnAltStack) {
struct sigaction action;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
ASSERT_THAT(LIBC_NAMESPACE::sigaction(SIGUSR1, nullptr, &action),
Succeeds(0));
action.sa_handler = handler;
diff --git a/libc/test/src/signal/signal_test.cpp b/libc/test/src/signal/signal_test.cpp
index bac9c3b8b68b..62b86bf44029 100644
--- a/libc/test/src/signal/signal_test.cpp
+++ b/libc/test/src/signal/signal_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/signal/raise.h"
#include "src/signal/signal.h"
@@ -17,7 +17,7 @@ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
TEST(LlvmLibcSignal, Invalid) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
auto *valid = +[](int) {};
EXPECT_THAT((void *)LIBC_NAMESPACE::signal(0, valid),
Fails(EINVAL, (void *)SIG_ERR));
diff --git a/libc/test/src/signal/sigprocmask_test.cpp b/libc/test/src/signal/sigprocmask_test.cpp
index 12403f68b593..891eac0f5bf7 100644
--- a/libc/test/src/signal/sigprocmask_test.cpp
+++ b/libc/test/src/signal/sigprocmask_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/signal/raise.h"
#include "src/signal/sigaddset.h"
#include "src/signal/sigemptyset.h"
@@ -33,7 +33,7 @@ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
// This tests for invalid input.
TEST_F(LlvmLibcSignalTest, SigprocmaskInvalid) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
sigset_t valid;
// 17 and -4 are out of the range for sigprocmask's how paramater.
diff --git a/libc/test/src/spawn/posix_spawn_file_actions_test.cpp b/libc/test/src/spawn/posix_spawn_file_actions_test.cpp
index c1edf56bdbd8..01ccb8218ee2 100644
--- a/libc/test/src/spawn/posix_spawn_file_actions_test.cpp
+++ b/libc/test/src/spawn/posix_spawn_file_actions_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/spawn/file_actions.h"
#include "src/spawn/posix_spawn_file_actions_addclose.h"
#include "src/spawn/posix_spawn_file_actions_adddup2.h"
diff --git a/libc/test/src/stdio/fdopen_test.cpp b/libc/test/src/stdio/fdopen_test.cpp
index ef36cff2ffbd..104fc478b100 100644
--- a/libc/test/src/stdio/fdopen_test.cpp
+++ b/libc/test/src/stdio/fdopen_test.cpp
@@ -9,7 +9,7 @@
#include "src/stdio/fdopen.h"
#include "hdr/fcntl_macros.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/fcntl/open.h"
#include "src/stdio/fclose.h"
#include "src/stdio/fgets.h"
@@ -22,7 +22,7 @@
TEST(LlvmLibcStdioFdopenTest, WriteAppendRead) {
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
constexpr const char *TEST_FILE_NAME = "testdata/write_read_append.test";
auto TEST_FILE = libc_make_test_file_path(TEST_FILE_NAME);
int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_TRUNC | O_RDWR, S_IRWXU);
@@ -53,7 +53,7 @@ TEST(LlvmLibcStdioFdopenTest, WriteAppendRead) {
}
TEST(LlvmLibcStdioFdopenTest, InvalidFd) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
constexpr const char *TEST_FILE_NAME = "testdata/invalid_fd.test";
auto TEST_FILE = libc_make_test_file_path(TEST_FILE_NAME);
int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_TRUNC);
@@ -65,7 +65,7 @@ TEST(LlvmLibcStdioFdopenTest, InvalidFd) {
}
TEST(LlvmLibcStdioFdopenTest, InvalidMode) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
constexpr const char *TEST_FILE_NAME = "testdata/invalid_mode.test";
auto TEST_FILE = libc_make_test_file_path(TEST_FILE_NAME);
int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_RDONLY, S_IRWXU);
@@ -83,7 +83,7 @@ TEST(LlvmLibcStdioFdopenTest, InvalidMode) {
auto *fp2 = LIBC_NAMESPACE::fdopen(fd, "w");
ASSERT_ERRNO_EQ(EINVAL);
ASSERT_TRUE(nullptr == fp2);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
LIBC_NAMESPACE::close(fd);
ASSERT_ERRNO_SUCCESS();
}
diff --git a/libc/test/src/stdio/fgetc_test.cpp b/libc/test/src/stdio/fgetc_test.cpp
index 2cc8436bd66f..56bde5f0099a 100644
--- a/libc/test/src/stdio/fgetc_test.cpp
+++ b/libc/test/src/stdio/fgetc_test.cpp
@@ -17,7 +17,7 @@
#include "test/UnitTest/Test.h"
#include "hdr/stdio_macros.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
class LlvmLibcGetcTest : public LIBC_NAMESPACE::testing::Test {
public:
@@ -33,7 +33,7 @@ public:
// This is an error and not a real EOF.
ASSERT_EQ(LIBC_NAMESPACE::feof(file), 0);
ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
diff --git a/libc/test/src/stdio/fgetc_unlocked_test.cpp b/libc/test/src/stdio/fgetc_unlocked_test.cpp
index 46cf12c2c253..90429ecf4e82 100644
--- a/libc/test/src/stdio/fgetc_unlocked_test.cpp
+++ b/libc/test/src/stdio/fgetc_unlocked_test.cpp
@@ -20,7 +20,7 @@
#include "test/UnitTest/Test.h"
#include "hdr/stdio_macros.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
class LlvmLibcGetcTest : public LIBC_NAMESPACE::testing::Test {
public:
@@ -36,7 +36,7 @@ public:
// This is an error and not a real EOF.
ASSERT_EQ(LIBC_NAMESPACE::feof(file), 0);
ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
diff --git a/libc/test/src/stdio/fgets_test.cpp b/libc/test/src/stdio/fgets_test.cpp
index a8a2c62f07b5..abed3d405293 100644
--- a/libc/test/src/stdio/fgets_test.cpp
+++ b/libc/test/src/stdio/fgets_test.cpp
@@ -14,7 +14,7 @@
#include "src/stdio/fwrite.h"
#include "test/UnitTest/Test.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
TEST(LlvmLibcFgetsTest, WriteAndReadCharacters) {
constexpr char FILENAME[] = "testdata/fgets.test";
@@ -35,7 +35,7 @@ TEST(LlvmLibcFgetsTest, WriteAndReadCharacters) {
// This is an error and not a real EOF.
ASSERT_EQ(LIBC_NAMESPACE::feof(file), 0);
ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
diff --git a/libc/test/src/stdio/fileop_test.cpp b/libc/test/src/stdio/fileop_test.cpp
index a0368d701a67..e624181c795b 100644
--- a/libc/test/src/stdio/fileop_test.cpp
+++ b/libc/test/src/stdio/fileop_test.cpp
@@ -21,7 +21,7 @@
#include "test/UnitTest/Test.h"
#include "hdr/stdio_macros.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::EQ;
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::NE;
@@ -41,7 +41,7 @@ TEST(LlvmLibcFILETest, SimpleFileOperations) {
ASSERT_THAT(LIBC_NAMESPACE::fread(read_data, 1, sizeof(CONTENT), file),
returns(EQ(size_t(0))).with_errno(NE(0)));
ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
LIBC_NAMESPACE::clearerr(file);
ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0);
@@ -72,7 +72,7 @@ TEST(LlvmLibcFILETest, SimpleFileOperations) {
ASSERT_THAT(LIBC_NAMESPACE::fwrite(CONTENT, 1, sizeof(CONTENT), file),
returns(EQ(size_t(0))).with_errno(NE(0)));
ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
LIBC_NAMESPACE::clearerr(file);
@@ -80,15 +80,15 @@ TEST(LlvmLibcFILETest, SimpleFileOperations) {
ASSERT_THAT(LIBC_NAMESPACE::fputs(CONTENT, file),
returns(EQ(EOF)).with_errno(NE(0)));
ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
LIBC_NAMESPACE::clearerr(file);
ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
ASSERT_THAT(LIBC_NAMESPACE::fwrite("nothing", 1, 1, file),
returns(EQ(size_t(0))).with_errno(NE(0)));
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
ASSERT_EQ(LIBC_NAMESPACE::fclose(file), 0);
@@ -103,10 +103,10 @@ TEST(LlvmLibcFILETest, SimpleFileOperations) {
ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0);
// This is not a readable file.
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
ASSERT_THAT(LIBC_NAMESPACE::fread(data, 1, 1, file),
returns(EQ(0)).with_errno(NE(0)));
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
@@ -121,15 +121,15 @@ TEST(LlvmLibcFILETest, SimpleFileOperations) {
// Check that the other functions correctly set libc_errno.
- // LIBC_NAMESPACE::libc_errno = 0;
+ // libc_errno = 0;
// ASSERT_NE(LIBC_NAMESPACE::fseek(file, 0, SEEK_SET), 0);
// ASSERT_ERRNO_FAILURE();
- // LIBC_NAMESPACE::libc_errno = 0;
+ // libc_errno = 0;
// ASSERT_NE(LIBC_NAMESPACE::fclose(file), 0);
// ASSERT_ERRNO_FAILURE();
- // LIBC_NAMESPACE::libc_errno = 0;
+ // libc_errno = 0;
// ASSERT_EQ(LIBC_NAMESPACE::fopen("INVALID FILE NAME", "r"),
// static_cast<FILE *>(nullptr));
// ASSERT_ERRNO_FAILURE();
@@ -165,7 +165,7 @@ TEST(LlvmLibcFILETest, FOpenFWriteSizeGreaterThanOne) {
constexpr size_t WRITE_NMEMB = sizeof(WRITE_DATA) / sizeof(MyStruct);
constexpr char FILENAME[] = "testdata/fread_fwrite.test";
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w");
ASSERT_FALSE(file == nullptr);
ASSERT_EQ(size_t(0), LIBC_NAMESPACE::fwrite(WRITE_DATA, 0, 1, file));
diff --git a/libc/test/src/stdio/fopencookie_test.cpp b/libc/test/src/stdio/fopencookie_test.cpp
index 61ce2a207fa1..03e1ac286b64 100644
--- a/libc/test/src/stdio/fopencookie_test.cpp
+++ b/libc/test/src/stdio/fopencookie_test.cpp
@@ -20,7 +20,7 @@
#include "hdr/stdio_macros.h"
#include "hdr/types/size_t.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
using MemoryView = LIBC_NAMESPACE::testing::MemoryView;
@@ -67,7 +67,7 @@ int seek_ss(void *cookie, off64_t *offset, int whence) {
} else if (whence == SEEK_END) {
new_offset = *offset + ss->endpos;
} else {
- LIBC_NAMESPACE::libc_errno = EINVAL;
+ libc_errno = EINVAL;
return -1;
}
if (new_offset < 0 || size_t(new_offset) > ss->bufsize)
@@ -115,7 +115,7 @@ TEST(LlvmLibcFOpenCookie, ReadOnlyCookieTest) {
ASSERT_EQ(size_t(0), LIBC_NAMESPACE::fwrite(CONTENT, 1, sizeof(CONTENT), f));
ASSERT_NE(LIBC_NAMESPACE::ferror(f), 0);
ASSERT_ERRNO_FAILURE();
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
LIBC_NAMESPACE::clearerr(f);
ASSERT_EQ(LIBC_NAMESPACE::ferror(f), 0);
@@ -149,7 +149,7 @@ TEST(LlvmLibcFOpenCookie, WriteOnlyCookieTest) {
LIBC_NAMESPACE::fread(read_data, 1, sizeof(WRITE_DATA), f));
ASSERT_NE(LIBC_NAMESPACE::ferror(f), 0);
ASSERT_ERRNO_EQ(EBADF);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
LIBC_NAMESPACE::clearerr(f);
ASSERT_EQ(LIBC_NAMESPACE::ferror(f), 0);
@@ -178,7 +178,7 @@ TEST(LlvmLibcFOpenCookie, AppendOnlyCookieTest) {
ASSERT_EQ(LIBC_NAMESPACE::fread(read_data, 1, READ_SIZE, f), size_t(0));
ASSERT_NE(LIBC_NAMESPACE::ferror(f), 0);
ASSERT_ERRNO_FAILURE();
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
LIBC_NAMESPACE::clearerr(f);
ASSERT_EQ(LIBC_NAMESPACE::ferror(f), 0);
diff --git a/libc/test/src/stdio/remove_test.cpp b/libc/test/src/stdio/remove_test.cpp
index 72875600903a..84984e26398c 100644
--- a/libc/test/src/stdio/remove_test.cpp
+++ b/libc/test/src/stdio/remove_test.cpp
@@ -14,13 +14,13 @@
#include "test/UnitTest/ErrnoSetterMatcher.h"
#include "test/UnitTest/Test.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include <unistd.h>
TEST(LlvmLibcRemoveTest, CreateAndRemoveFile) {
// The test strategy is to create a file and remove it, and also verify that
// it was removed.
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
@@ -39,7 +39,7 @@ TEST(LlvmLibcRemoveTest, CreateAndRemoveFile) {
TEST(LlvmLibcRemoveTest, CreateAndRemoveDir) {
// The test strategy is to create a dir and remove it, and also verify that
// it was removed.
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
constexpr const char *FILENAME = "remove.test.dir";
diff --git a/libc/test/src/stdio/rename_test.cpp b/libc/test/src/stdio/rename_test.cpp
index a5dd734c6361..ac494a4ecaf8 100644
--- a/libc/test/src/stdio/rename_test.cpp
+++ b/libc/test/src/stdio/rename_test.cpp
@@ -8,7 +8,7 @@
#include "include/llvm-libc-macros/linux/sys-stat-macros.h"
#include "include/llvm-libc-macros/linux/unistd-macros.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/fcntl/open.h"
#include "src/stdio/rename.h"
#include "src/unistd/access.h"
@@ -19,7 +19,7 @@
TEST(LlvmLibcRenameTest, CreateAndRenameFile) {
// The test strategy is to create a file and rename it, and also verify that
// it was renamed.
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
diff --git a/libc/test/src/stdio/setvbuf_test.cpp b/libc/test/src/stdio/setvbuf_test.cpp
index a1e1fee25db3..5872943c1bb4 100644
--- a/libc/test/src/stdio/setvbuf_test.cpp
+++ b/libc/test/src/stdio/setvbuf_test.cpp
@@ -14,7 +14,7 @@
#include "test/UnitTest/Test.h"
#include "hdr/stdio_macros.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
TEST(LlvmLibcSetvbufTest, SetNBFBuffer) {
// The idea in this test is that we open a file for writing and reading, and
@@ -102,6 +102,6 @@ TEST(LlvmLibcSetbufTest, InvalidBufferMode) {
0);
ASSERT_ERRNO_EQ(EINVAL);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
ASSERT_EQ(0, LIBC_NAMESPACE::fclose(f));
}
diff --git a/libc/test/src/stdio/sprintf_test.cpp b/libc/test/src/stdio/sprintf_test.cpp
index f6af6ad3e364..f1b545ba546f 100644
--- a/libc/test/src/stdio/sprintf_test.cpp
+++ b/libc/test/src/stdio/sprintf_test.cpp
@@ -10,7 +10,7 @@
#include "src/stdio/sprintf.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "test/UnitTest/RoundingModeUtils.h"
#include "test/UnitTest/Test.h"
#include <inttypes.h>
@@ -3228,46 +3228,46 @@ TEST(LlvmLibcSPrintfTest, StrerrorConv) {
char buff[1000];
int written;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
written = LIBC_NAMESPACE::sprintf(buff, "%m");
ASSERT_STREQ_LEN(written, buff, "Success");
- LIBC_NAMESPACE::libc_errno = ERANGE;
+ libc_errno = ERANGE;
written = LIBC_NAMESPACE::sprintf(buff, "%m");
ASSERT_STREQ_LEN(written, buff, "Numerical result out of range");
// Check that it correctly consumes no arguments.
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
written = LIBC_NAMESPACE::sprintf(buff, "%m %d", 1);
ASSERT_STREQ_LEN(written, buff, "Success 1");
// Width Tests
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
written = LIBC_NAMESPACE::sprintf(buff, "%10m");
ASSERT_STREQ_LEN(written, buff, " Success");
- LIBC_NAMESPACE::libc_errno = ERANGE;
+ libc_errno = ERANGE;
written = LIBC_NAMESPACE::sprintf(buff, "%10m");
ASSERT_STREQ_LEN(written, buff, "Numerical result out of range");
// Precision Tests
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
written = LIBC_NAMESPACE::sprintf(buff, "%.10m");
ASSERT_STREQ_LEN(written, buff, "Success");
- LIBC_NAMESPACE::libc_errno = ERANGE;
+ libc_errno = ERANGE;
written = LIBC_NAMESPACE::sprintf(buff, "%.10m");
ASSERT_STREQ_LEN(written, buff, "Numerical ");
// Flag Tests (Only '-' since the others only affect ints)
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
written = LIBC_NAMESPACE::sprintf(buff, "%-10m");
ASSERT_STREQ_LEN(written, buff, "Success ");
- LIBC_NAMESPACE::libc_errno = ERANGE;
+ libc_errno = ERANGE;
written = LIBC_NAMESPACE::sprintf(buff, "%-10m");
ASSERT_STREQ_LEN(written, buff, "Numerical result out of range");
@@ -3275,93 +3275,93 @@ TEST(LlvmLibcSPrintfTest, StrerrorConv) {
// Since alt mode here is effectively a completely separate conversion, it
// gets separate tests.
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
written = LIBC_NAMESPACE::sprintf(buff, "%#m");
ASSERT_STREQ_LEN(written, buff, "0");
- LIBC_NAMESPACE::libc_errno = ERANGE;
+ libc_errno = ERANGE;
written = LIBC_NAMESPACE::sprintf(buff, "%#m");
ASSERT_STREQ_LEN(written, buff, "ERANGE");
- LIBC_NAMESPACE::libc_errno = -9999;
+ libc_errno = -9999;
written = LIBC_NAMESPACE::sprintf(buff, "%#m");
ASSERT_STREQ_LEN(written, buff, "-9999");
// Alt Mode Width
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
written = LIBC_NAMESPACE::sprintf(buff, "%#10m");
ASSERT_STREQ_LEN(written, buff, " 0");
- LIBC_NAMESPACE::libc_errno = ERANGE;
+ libc_errno = ERANGE;
written = LIBC_NAMESPACE::sprintf(buff, "%#10m");
ASSERT_STREQ_LEN(written, buff, " ERANGE");
- LIBC_NAMESPACE::libc_errno = -9999;
+ libc_errno = -9999;
written = LIBC_NAMESPACE::sprintf(buff, "%#10m");
ASSERT_STREQ_LEN(written, buff, " -9999");
- LIBC_NAMESPACE::libc_errno = ERANGE;
+ libc_errno = ERANGE;
written = LIBC_NAMESPACE::sprintf(buff, "%#3m");
ASSERT_STREQ_LEN(written, buff, "ERANGE");
- LIBC_NAMESPACE::libc_errno = -9999;
+ libc_errno = -9999;
written = LIBC_NAMESPACE::sprintf(buff, "%#3m");
ASSERT_STREQ_LEN(written, buff, "-9999");
// Alt Mode Precision
- LIBC_NAMESPACE::libc_errno = ERANGE;
+ libc_errno = ERANGE;
written = LIBC_NAMESPACE::sprintf(buff, "%#.10m");
ASSERT_STREQ_LEN(written, buff, "ERANGE");
- LIBC_NAMESPACE::libc_errno = -9999;
+ libc_errno = -9999;
written = LIBC_NAMESPACE::sprintf(buff, "%#.10m");
ASSERT_STREQ_LEN(written, buff, "-0000009999");
- LIBC_NAMESPACE::libc_errno = ERANGE;
+ libc_errno = ERANGE;
written = LIBC_NAMESPACE::sprintf(buff, "%#.3m");
ASSERT_STREQ_LEN(written, buff, "ERA");
- LIBC_NAMESPACE::libc_errno = -9999;
+ libc_errno = -9999;
written = LIBC_NAMESPACE::sprintf(buff, "%#.3m");
ASSERT_STREQ_LEN(written, buff, "-9999");
// We don't test precision (or int flags) on errno = 0 because it behaves
// weirdly, see the docs for more information.
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
written = LIBC_NAMESPACE::sprintf(buff, "%#.1m");
ASSERT_STREQ_LEN(written, buff, "0");
// Alt Mode Flags
// '-' flag
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
written = LIBC_NAMESPACE::sprintf(buff, "%#-10m");
ASSERT_STREQ_LEN(written, buff, "0 ");
- LIBC_NAMESPACE::libc_errno = ERANGE;
+ libc_errno = ERANGE;
written = LIBC_NAMESPACE::sprintf(buff, "%#-10m");
ASSERT_STREQ_LEN(written, buff, "ERANGE ");
- LIBC_NAMESPACE::libc_errno = -9999;
+ libc_errno = -9999;
written = LIBC_NAMESPACE::sprintf(buff, "%#-10m");
ASSERT_STREQ_LEN(written, buff, "-9999 ");
- LIBC_NAMESPACE::libc_errno = ERANGE;
+ libc_errno = ERANGE;
written = LIBC_NAMESPACE::sprintf(buff, "%#-3m");
ASSERT_STREQ_LEN(written, buff, "ERANGE");
- LIBC_NAMESPACE::libc_errno = -9999;
+ libc_errno = -9999;
written = LIBC_NAMESPACE::sprintf(buff, "%#-3m");
ASSERT_STREQ_LEN(written, buff, "-9999");
// '+' flag
- LIBC_NAMESPACE::libc_errno = ERANGE;
+ libc_errno = ERANGE;
written = LIBC_NAMESPACE::sprintf(buff, "%#+m");
ASSERT_STREQ_LEN(written, buff, "ERANGE");
- LIBC_NAMESPACE::libc_errno = -9999;
+ libc_errno = -9999;
written = LIBC_NAMESPACE::sprintf(buff, "%#+m");
ASSERT_STREQ_LEN(written, buff, "-9999");
@@ -3370,38 +3370,38 @@ TEST(LlvmLibcSPrintfTest, StrerrorConv) {
// come up, but I've avoided it for the other %m tests for ease of
// refactoring if necessary. Here it needs to be positive to test that the
// flags that only affect positive signed integers are properly passed along.
- LIBC_NAMESPACE::libc_errno = 9999;
+ libc_errno = 9999;
written = LIBC_NAMESPACE::sprintf(buff, "%#+m");
ASSERT_STREQ_LEN(written, buff, "+9999");
// ' ' flag
- LIBC_NAMESPACE::libc_errno = ERANGE;
+ libc_errno = ERANGE;
written = LIBC_NAMESPACE::sprintf(buff, "%# m");
ASSERT_STREQ_LEN(written, buff, "ERANGE");
- LIBC_NAMESPACE::libc_errno = -9999;
+ libc_errno = -9999;
written = LIBC_NAMESPACE::sprintf(buff, "%# m");
ASSERT_STREQ_LEN(written, buff, "-9999");
- LIBC_NAMESPACE::libc_errno = 9999;
+ libc_errno = 9999;
written = LIBC_NAMESPACE::sprintf(buff, "%# m");
ASSERT_STREQ_LEN(written, buff, " 9999");
// '0' flag
- LIBC_NAMESPACE::libc_errno = ERANGE;
+ libc_errno = ERANGE;
written = LIBC_NAMESPACE::sprintf(buff, "%#010m");
ASSERT_STREQ_LEN(written, buff, " ERANGE");
- LIBC_NAMESPACE::libc_errno = -9999;
+ libc_errno = -9999;
written = LIBC_NAMESPACE::sprintf(buff, "%#010m");
ASSERT_STREQ_LEN(written, buff, "-000009999");
- LIBC_NAMESPACE::libc_errno = ERANGE;
+ libc_errno = ERANGE;
written = LIBC_NAMESPACE::sprintf(buff, "%#03m");
ASSERT_STREQ_LEN(written, buff, "ERANGE");
- LIBC_NAMESPACE::libc_errno = -9999;
+ libc_errno = -9999;
written = LIBC_NAMESPACE::sprintf(buff, "%#03m");
ASSERT_STREQ_LEN(written, buff, "-9999");
}
diff --git a/libc/test/src/stdio/unlocked_fileop_test.cpp b/libc/test/src/stdio/unlocked_fileop_test.cpp
index 67f1b0ff513b..5d482b70064b 100644
--- a/libc/test/src/stdio/unlocked_fileop_test.cpp
+++ b/libc/test/src/stdio/unlocked_fileop_test.cpp
@@ -17,7 +17,7 @@
#include "src/stdio/fwrite_unlocked.h"
#include "test/UnitTest/Test.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
TEST(LlvmLibcFILETest, UnlockedReadAndWrite) {
constexpr char fNAME[] = "testdata/unlocked_read_and_write.test";
@@ -36,7 +36,7 @@ TEST(LlvmLibcFILETest, UnlockedReadAndWrite) {
LIBC_NAMESPACE::fread_unlocked(data, 1, sizeof(READ_SIZE), f));
ASSERT_NE(LIBC_NAMESPACE::ferror_unlocked(f), 0);
ASSERT_ERRNO_FAILURE();
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
LIBC_NAMESPACE::clearerr_unlocked(f);
ASSERT_EQ(LIBC_NAMESPACE::ferror_unlocked(f), 0);
@@ -57,7 +57,7 @@ TEST(LlvmLibcFILETest, UnlockedReadAndWrite) {
LIBC_NAMESPACE::fwrite_unlocked(CONTENT, 1, sizeof(CONTENT), f));
ASSERT_NE(LIBC_NAMESPACE::ferror_unlocked(f), 0);
ASSERT_ERRNO_FAILURE();
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
LIBC_NAMESPACE::clearerr_unlocked(f);
ASSERT_EQ(LIBC_NAMESPACE::ferror_unlocked(f), 0);
diff --git a/libc/test/src/stdlib/StrtolTest.h b/libc/test/src/stdlib/StrtolTest.h
index 03f0a6539c78..3eeccc5727e7 100644
--- a/libc/test/src/stdlib/StrtolTest.h
+++ b/libc/test/src/stdlib/StrtolTest.h
@@ -9,6 +9,7 @@
#include "src/__support/CPP/limits.h"
#include "src/__support/CPP/type_traits.h"
#include "src/__support/ctype_utils.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/properties/architectures.h"
#include "test/UnitTest/ErrnoCheckingTest.h"
#include "test/UnitTest/Test.h"
diff --git a/libc/test/src/stdlib/strtoint32_test.cpp b/libc/test/src/stdlib/strtoint32_test.cpp
index 17df432fc8e6..e6da692714d2 100644
--- a/libc/test/src/stdlib/strtoint32_test.cpp
+++ b/libc/test/src/stdlib/strtoint32_test.cpp
@@ -8,9 +8,9 @@
#include <stdint.h>
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_integer.h"
-#include "src/errno/libc_errno.h"
#include "StrtolTest.h"
#include "test/UnitTest/Test.h"
@@ -21,7 +21,7 @@ int32_t strtoint32(const char *__restrict str, char **__restrict str_end,
int base) {
auto result = internal::strtointeger<int32_t>(str, base);
if (result.has_error())
- LIBC_NAMESPACE::libc_errno = result.error;
+ libc_errno = result.error;
if (str_end != nullptr)
*str_end = const_cast<char *>(str + result.parsed_len);
@@ -33,7 +33,7 @@ uint32_t strtouint32(const char *__restrict str, char **__restrict str_end,
int base) {
auto result = internal::strtointeger<uint32_t>(str, base);
if (result.has_error())
- LIBC_NAMESPACE::libc_errno = result.error;
+ libc_errno = result.error;
if (str_end != nullptr)
*str_end = const_cast<char *>(str + result.parsed_len);
diff --git a/libc/test/src/stdlib/strtoint64_test.cpp b/libc/test/src/stdlib/strtoint64_test.cpp
index b5fe69dfaa70..2c5d948f5fae 100644
--- a/libc/test/src/stdlib/strtoint64_test.cpp
+++ b/libc/test/src/stdlib/strtoint64_test.cpp
@@ -8,9 +8,9 @@
#include <stdint.h>
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include "src/__support/str_to_integer.h"
-#include "src/errno/libc_errno.h"
#include "StrtolTest.h"
#include "test/UnitTest/Test.h"
@@ -21,7 +21,7 @@ int64_t strtoint64(const char *__restrict str, char **__restrict str_end,
int base) {
auto result = internal::strtointeger<int64_t>(str, base);
if (result.has_error())
- LIBC_NAMESPACE::libc_errno = result.error;
+ libc_errno = result.error;
if (str_end != nullptr)
*str_end = const_cast<char *>(str + result.parsed_len);
@@ -33,7 +33,7 @@ uint64_t strtouint64(const char *__restrict str, char **__restrict str_end,
int base) {
auto result = internal::strtointeger<uint64_t>(str, base);
if (result.has_error())
- LIBC_NAMESPACE::libc_errno = result.error;
+ libc_errno = result.error;
if (str_end != nullptr)
*str_end = const_cast<char *>(str + result.parsed_len);
diff --git a/libc/test/src/stdlib/strtold_test.cpp b/libc/test/src/stdlib/strtold_test.cpp
index eb4056dc7ba6..c2f2b9c9a11c 100644
--- a/libc/test/src/stdlib/strtold_test.cpp
+++ b/libc/test/src/stdlib/strtold_test.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/uint128.h"
#include "src/stdlib/strtold.h"
diff --git a/libc/test/src/sys/mman/linux/mlock_test.cpp b/libc/test/src/sys/mman/linux/mlock_test.cpp
index 88abacad554e..6b81411ca604 100644
--- a/libc/test/src/sys/mman/linux/mlock_test.cpp
+++ b/libc/test/src/sys/mman/linux/mlock_test.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/sys/mman/madvise.h"
#include "src/sys/mman/mincore.h"
#include "src/sys/mman/mlock.h"
@@ -149,9 +149,8 @@ TEST_F(LlvmLibcMlockTest, MLockAll) {
Succeeds());
auto retval = LIBC_NAMESPACE::mlockall(MCL_CURRENT);
if (retval == -1) {
- EXPECT_TRUE(LIBC_NAMESPACE::libc_errno == ENOMEM ||
- LIBC_NAMESPACE::libc_errno == EPERM);
- LIBC_NAMESPACE::libc_errno = 0;
+ EXPECT_TRUE(libc_errno == ENOMEM || libc_errno == EPERM);
+ libc_errno = 0;
return;
}
unsigned char vec;
@@ -163,9 +162,8 @@ TEST_F(LlvmLibcMlockTest, MLockAll) {
{
auto retval = LIBC_NAMESPACE::mlockall(MCL_FUTURE);
if (retval == -1) {
- EXPECT_TRUE(LIBC_NAMESPACE::libc_errno == ENOMEM ||
- LIBC_NAMESPACE::libc_errno == EPERM);
- LIBC_NAMESPACE::libc_errno = 0;
+ EXPECT_TRUE(libc_errno == ENOMEM || libc_errno == EPERM);
+ libc_errno = 0;
return;
}
PageHolder holder;
@@ -180,9 +178,8 @@ TEST_F(LlvmLibcMlockTest, MLockAll) {
{
auto retval = LIBC_NAMESPACE::mlockall(MCL_FUTURE | MCL_ONFAULT);
if (retval == -1) {
- EXPECT_TRUE(LIBC_NAMESPACE::libc_errno == ENOMEM ||
- LIBC_NAMESPACE::libc_errno == EPERM);
- LIBC_NAMESPACE::libc_errno = 0;
+ EXPECT_TRUE(libc_errno == ENOMEM || libc_errno == EPERM);
+ libc_errno = 0;
return;
}
PageHolder holder;
diff --git a/libc/test/src/sys/statvfs/linux/fstatvfs_test.cpp b/libc/test/src/sys/statvfs/linux/fstatvfs_test.cpp
index 455a82678e18..ba0ee4f09109 100644
--- a/libc/test/src/sys/statvfs/linux/fstatvfs_test.cpp
+++ b/libc/test/src/sys/statvfs/linux/fstatvfs_test.cpp
@@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//
#include "hdr/fcntl_macros.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/fcntl/open.h"
#include "src/sys/stat/mkdirat.h"
#include "src/sys/statvfs/fstatvfs.h"
@@ -41,7 +41,7 @@ TEST_F(LlvmLibcSysFStatvfsTest, FStatvfsInvalidPath) {
// Always delete the folder so that we start in a consistent state.
LIBC_NAMESPACE::rmdir(TEST_DIR);
- LIBC_NAMESPACE::libc_errno = 0; // Reset errno
+ libc_errno = 0; // Reset errno
ASSERT_THAT(LIBC_NAMESPACE::mkdirat(AT_FDCWD, TEST_DIR, S_IRWXU),
Succeeds(0));
diff --git a/libc/test/src/sys/statvfs/linux/statvfs_test.cpp b/libc/test/src/sys/statvfs/linux/statvfs_test.cpp
index f356bb3d277b..327dec07a1b7 100644
--- a/libc/test/src/sys/statvfs/linux/statvfs_test.cpp
+++ b/libc/test/src/sys/statvfs/linux/statvfs_test.cpp
@@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//
#include "hdr/fcntl_macros.h"
+#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
-#include "src/errno/libc_errno.h"
#include "src/sys/stat/mkdirat.h"
#include "src/sys/statvfs/statvfs.h"
#include "src/unistd/rmdir.h"
@@ -37,7 +37,7 @@ TEST_F(LlvmLibcSysStatvfsTest, StatvfsInvalidPath) {
// Always delete the folder so that we start in a consistent state.
LIBC_NAMESPACE::rmdir(TEST_DIR);
- LIBC_NAMESPACE::libc_errno = 0; // Reset errno
+ libc_errno = 0; // Reset errno
ASSERT_THAT(LIBC_NAMESPACE::mkdirat(AT_FDCWD, TEST_DIR, S_IRWXU),
Succeeds(0));
diff --git a/libc/test/src/sys/time/setitimer_test.cpp b/libc/test/src/sys/time/setitimer_test.cpp
index 16d33fdf1e4f..115f9e662ed4 100644
--- a/libc/test/src/sys/time/setitimer_test.cpp
+++ b/libc/test/src/sys/time/setitimer_test.cpp
@@ -24,7 +24,7 @@ static bool timer_fired(false);
extern "C" void handle_sigalrm(int) { timer_fired = true; }
TEST_F(LlvmLibcSysTimeSetitimerTest, SmokeTest) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
struct sigaction sa;
sa.sa_handler = handle_sigalrm;
LIBC_NAMESPACE::sigemptyset(&sa.sa_mask);
diff --git a/libc/test/src/termios/termios_test.cpp b/libc/test/src/termios/termios_test.cpp
index f8fc09a8bbf0..5ec169a886b1 100644
--- a/libc/test/src/termios/termios_test.cpp
+++ b/libc/test/src/termios/termios_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/fcntl/open.h"
#include "src/termios/cfgetispeed.h"
#include "src/termios/cfgetospeed.h"
@@ -30,21 +30,21 @@ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
TEST(LlvmLibcTermiosTest, SpeedSmokeTest) {
struct termios t;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
ASSERT_THAT(LIBC_NAMESPACE::cfsetispeed(&t, B50), Succeeds(0));
ASSERT_EQ(LIBC_NAMESPACE::cfgetispeed(&t), speed_t(B50));
ASSERT_THAT(LIBC_NAMESPACE::cfsetospeed(&t, B75), Succeeds(0));
ASSERT_EQ(LIBC_NAMESPACE::cfgetospeed(&t), speed_t(B75));
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
ASSERT_THAT(LIBC_NAMESPACE::cfsetispeed(&t, ~CBAUD), Fails(EINVAL));
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
ASSERT_THAT(LIBC_NAMESPACE::cfsetospeed(&t, ~CBAUD), Fails(EINVAL));
}
TEST(LlvmLibcTermiosTest, GetAttrSmokeTest) {
struct termios t;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
int fd = LIBC_NAMESPACE::open("/dev/tty", O_RDONLY);
if (fd < 0)
return; // When /dev/tty is not available, no point continuing.
@@ -54,7 +54,7 @@ TEST(LlvmLibcTermiosTest, GetAttrSmokeTest) {
}
TEST(LlvmLibcTermiosTest, TcGetSidSmokeTest) {
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
int fd = LIBC_NAMESPACE::open("/dev/tty", O_RDONLY);
if (fd < 0)
return; // When /dev/tty is not available, no point continuing.
diff --git a/libc/test/src/time/asctime_r_test.cpp b/libc/test/src/time/asctime_r_test.cpp
index b595cfe02486..d840248b7df4 100644
--- a/libc/test/src/time/asctime_r_test.cpp
+++ b/libc/test/src/time/asctime_r_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/time/asctime_r.h"
#include "src/time/time_constants.h"
#include "test/UnitTest/Test.h"
diff --git a/libc/test/src/time/asctime_test.cpp b/libc/test/src/time/asctime_test.cpp
index 169a7463a303..cad25fffc65a 100644
--- a/libc/test/src/time/asctime_test.cpp
+++ b/libc/test/src/time/asctime_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/time/asctime.h"
#include "test/UnitTest/Test.h"
#include "test/src/time/TmHelper.h"
diff --git a/libc/test/src/time/ctime_r_test.cpp b/libc/test/src/time/ctime_r_test.cpp
index 27011b7e0fbd..fe43877aa499 100644
--- a/libc/test/src/time/ctime_r_test.cpp
+++ b/libc/test/src/time/ctime_r_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/time/ctime_r.h"
#include "src/time/time_constants.h"
#include "test/UnitTest/Test.h"
diff --git a/libc/test/src/time/ctime_test.cpp b/libc/test/src/time/ctime_test.cpp
index 6f1168f0b668..5ff69f6619b4 100644
--- a/libc/test/src/time/ctime_test.cpp
+++ b/libc/test/src/time/ctime_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/time/ctime.h"
#include "test/UnitTest/Test.h"
#include "test/src/time/TmHelper.h"
diff --git a/libc/test/src/time/gmtime_test.cpp b/libc/test/src/time/gmtime_test.cpp
index 6af5a18d3699..41236665d2ea 100644
--- a/libc/test/src/time/gmtime_test.cpp
+++ b/libc/test/src/time/gmtime_test.cpp
@@ -8,7 +8,7 @@
#include "hdr/types/struct_tm.h"
#include "src/__support/CPP/limits.h" // INT_MAX, INT_MIN
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/time/gmtime.h"
#include "src/time/time_constants.h"
#include "test/UnitTest/ErrnoSetterMatcher.h"
@@ -30,7 +30,7 @@ TEST(LlvmLibcGmTime, OutOfRange) {
EXPECT_TRUE(tm_data == nullptr);
ASSERT_ERRNO_EQ(EOVERFLOW);
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
seconds =
INT_MIN *
static_cast<int64_t>(
diff --git a/libc/test/src/time/nanosleep_test.cpp b/libc/test/src/time/nanosleep_test.cpp
index d4f98e29bd98..e0200ff3aaa2 100644
--- a/libc/test/src/time/nanosleep_test.cpp
+++ b/libc/test/src/time/nanosleep_test.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "hdr/types/struct_timespec.h"
-#include "src/errno/libc_errno.h"
+#include "src/__support/libc_errno.h"
#include "src/time/nanosleep.h"
#include "test/UnitTest/ErrnoSetterMatcher.h"
#include "test/UnitTest/Test.h"
@@ -17,7 +17,7 @@ namespace cpp = LIBC_NAMESPACE::cpp;
TEST(LlvmLibcNanosleep, SmokeTest) {
// TODO: When we have the code to read clocks, test that time has passed.
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
- LIBC_NAMESPACE::libc_errno = 0;
+ libc_errno = 0;
struct timespec tim = {1, 500};
struct timespec tim2 = {0, 0};