aboutsummaryrefslogtreecommitdiff
path: root/src/linux_c.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-12-06 14:14:27 -0800
committerGravatar GitHub <noreply@github.com> 2022-12-06 14:14:27 -0800
commit81317a52ea13b39de22d2cdeff8ecc231224f9e7 (patch)
tree677bc306ab6b56937f024a5bdf3e8b624b7137c6 /src/linux_c.zig
parent7d29782896f31ae5249f00e9505fd978e9733644 (diff)
downloadbun-81317a52ea13b39de22d2cdeff8ecc231224f9e7.tar.gz
bun-81317a52ea13b39de22d2cdeff8ecc231224f9e7.tar.zst
bun-81317a52ea13b39de22d2cdeff8ecc231224f9e7.zip
Fix glibc symbol version issues preventing `bun install` from being used in older glibc versions (#1580)
* Prevent integer overflow in connectError * Add missing deepEquals() type to Bun * fix missing glibc symbols * Fix missing symbol issues * Try this * Update glibc-versions-hack.cpp * Update glibc-versions-hack.cpp * Update glibc-versions-hack.cpp Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/linux_c.zig')
-rw-r--r--src/linux_c.zig19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/linux_c.zig b/src/linux_c.zig
index b200becdc..7758a9aa8 100644
--- a/src/linux_c.zig
+++ b/src/linux_c.zig
@@ -1,5 +1,6 @@
const std = @import("std");
const sysResource = @cImport(@cInclude("sys/resource.h"));
+const bun = @import("bun");
pub const SystemErrno = enum(u8) {
SUCCESS = 0,
EPERM = 1,
@@ -456,11 +457,21 @@ pub const POSIX_SPAWN_SETSIGMASK = @as(c_int, 0x08);
pub const POSIX_SPAWN_SETSCHEDPARAM = @as(c_int, 0x10);
pub const POSIX_SPAWN_SETSCHEDULER = @as(c_int, 0x20);
-pub extern "c" fn posix_spawn_file_actions_addfchdir_np(actions: *posix_spawn_file_actions_t, filedes: fd_t) c_int;
+const posix_spawn_file_actions_addfchdir_np_type = fn (actions: *posix_spawn_file_actions_t, filedes: fd_t) c_int;
+const posix_spawn_file_actions_addchdir_np_type = fn (actions: *posix_spawn_file_actions_t, path: [*:0]const u8) c_int;
-// not available in linux
-// pub extern "c" fn posix_spawn_file_actions_addinherit_np(actions: *posix_spawn_file_actions_t, filedes: fd_t) c_int;
+/// When not available, these functions will return 0.
+pub fn posix_spawn_file_actions_addfchdir_np(actions: *posix_spawn_file_actions_t, filedes: std.os.fd_t) c_int {
+ var function = bun.C.dlsym(posix_spawn_file_actions_addfchdir_np_type, "posix_spawn_file_actions_addfchdir_np") orelse
+ return 0;
+ return function(actions, filedes);
+}
-pub extern "c" fn posix_spawn_file_actions_addchdir_np(actions: *posix_spawn_file_actions_t, path: [*:0]const u8) c_int;
+/// When not available, these functions will return 0.
+pub fn posix_spawn_file_actions_addchdir_np(actions: *posix_spawn_file_actions_t, path: [*:0]const u8) c_int {
+ var function = bun.C.dlsym(posix_spawn_file_actions_addchdir_np_type, "posix_spawn_file_actions_addchdir_np") orelse
+ return 0;
+ return function(actions, path);
+}
pub extern fn vmsplice(fd: c_int, iovec: [*]const std.os.iovec, iovec_count: usize, flags: u32) isize;