mirror of
https://github.com/oven-sh/bun
synced 2026-02-12 03:48:56 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user