Hardcode __NR_close_range (#25840)

### What does this PR do?

Fixes https://github.com/oven-sh/bun/issues/25839

### How did you verify your code works?
This commit is contained in:
Jarred Sumner
2026-01-06 15:07:19 +00:00
committed by GitHub
parent 3de2dc1287
commit c6a73fc23e

View File

@@ -200,15 +200,19 @@ extern "C" void windows_enable_stdio_inheritance()
#define CLOSE_RANGE_CLOEXEC (1U << 2)
#endif
#ifndef __NR_close_range
// True for architectures we support:
// - arch/arm64/include/asm/unistd32.h
// - include/uapi/asm-generic/unistd.h
// Not true for:
// - DEC Alpha AXP (Alpha architecture)
#define __NR_close_range 436
#endif
// close_range is glibc > 2.33, which is very new
extern "C" ssize_t bun_close_range(unsigned int start, unsigned int end, unsigned int flags)
{
// https://github.com/oven-sh/bun/issues/9669
#ifdef __NR_close_range
return syscall(__NR_close_range, start, end, flags);
#else
return ENOSYS;
#endif
}
static void unset_cloexec(int fd)