From 92ec9fa3d05f06257d267ac7dc0fbe533d5f96be Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Thu, 16 Apr 2026 23:35:56 +0100 Subject: [PATCH 1/2] std.c: Remove serenity's serenity_{open,readlink}() functions See: https://github.com/SerenityOS/serenity/commit/e4c989e45f0d30b7049b3f1d001cf4a87104d277 --- lib/std/c.zig | 2 -- lib/std/c/serenity.zig | 3 --- 2 files changed, 5 deletions(-) diff --git a/lib/std/c.zig b/lib/std/c.zig index 449501d89e254e0a46232d92afe64a919a9bde62..c2ad800a95b60fbfbd88535e4b9fcf3c0ab2d547 100644 --- a/lib/std/c.zig +++ b/lib/std/c.zig @@ -11466,8 +11466,6 @@ pub const perf_event = serenity.perf_event; pub const perf_register_string = serenity.perf_register_string; pub const get_stack_bounds = serenity.get_stack_bounds; pub const anon_create = serenity.anon_create; -pub const serenity_readlink = serenity.serenity_readlink; -pub const serenity_open = serenity.serenity_open; pub const getkeymap = serenity.getkeymap; pub const setkeymap = serenity.setkeymap; diff --git a/lib/std/c/serenity.zig b/lib/std/c/serenity.zig index b69eb602991c5d871b2c9eb05e4ca30548c059fd..b51b0e3ae655de966e34105abc23c1af859ce2e2 100644 --- a/lib/std/c/serenity.zig +++ b/lib/std/c/serenity.zig @@ -66,9 +66,6 @@ pub extern "c" fn get_stack_bounds(user_stack_base: *usize, user_stack_size: *us pub extern "c" fn anon_create(size: usize, options: O) c_int; -pub extern "c" fn serenity_readlink(path: [*]const u8, path_length: usize, buffer: [*]u8, buffer_size: usize) c_int; -pub extern "c" fn serenity_open(path: [*]const u8, path_length: usize, options: c_int, ...) c_int; - pub extern "c" fn getkeymap(name_buffer: [*]u8, name_buffer_size: usize, map: [*]u32, shift_map: [*]u32, alt_map: [*]u32, altgr_map: [*]u32, shift_altgr_map: [*]u32) c_int; pub extern "c" fn setkeymap(name: [*]const u8, map: [*]const u32, shift_map: [*]const u32, alt_map: [*]const u32, altgr_map: [*]const u32, shift_altgr_map: [*]const u32) c_int; -- 2.54.0 From 8abb14141e987a9d469eedf98c14eb0141d0875c Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Thu, 16 Apr 2026 23:38:08 +0100 Subject: [PATCH 2/2] std.c: Fix serenity's futex() declaration Two mistakes I made when translating from the C header: - The timeout and userspace_address2 pointers should be nullable. - futex_wait() and futex_wake() are defined as static functions and therefore not available as exported symbols. They're just thin wrappers around futex() anyway so that's fine. --- lib/std/c.zig | 2 -- lib/std/c/serenity.zig | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/std/c.zig b/lib/std/c.zig index c2ad800a95b60fbfbd88535e4b9fcf3c0ab2d547..bb028dbdaa4fa4b84212d81efb7ffab0c4b863de 100644 --- a/lib/std/c.zig +++ b/lib/std/c.zig @@ -11459,8 +11459,6 @@ pub const disown = serenity.disown; pub const profiling_enable = serenity.profiling_enable; pub const profiling_disable = serenity.profiling_disable; pub const profiling_free_buffer = serenity.profiling_free_buffer; -pub const futex_wait = serenity.futex_wait; -pub const futex_wake = serenity.futex_wake; pub const purge = serenity.purge; pub const perf_event = serenity.perf_event; pub const perf_register_string = serenity.perf_register_string; diff --git a/lib/std/c/serenity.zig b/lib/std/c/serenity.zig index b51b0e3ae655de966e34105abc23c1af859ce2e2..649e9b71fdff4641654387140c2b8452af6fb6c1 100644 --- a/lib/std/c/serenity.zig +++ b/lib/std/c/serenity.zig @@ -53,9 +53,7 @@ pub extern "c" fn profiling_enable(pid: pid_t, event_mask: PERF_EVENT) c_int; pub extern "c" fn profiling_disable(pid: pid_t) c_int; pub extern "c" fn profiling_free_buffer(pid: pid_t) c_int; -pub extern "c" fn futex(userspace_address: *u32, futex_op: c_int, value: u32, timeout: *const timespec, userspace_address2: *u32, value3: u32) c_int; -pub extern "c" fn futex_wait(userspace_address: *u32, value: u32, abstime: *const timespec, clockid: clockid_t, process_shared: c_int) c_int; -pub extern "c" fn futex_wake(userspace_address: *u32, count: u32, process_shared: c_int) c_int; +pub extern "c" fn futex(userspace_address: *u32, futex_op: c_int, value: u32, timeout: ?*const timespec, userspace_address2: ?*u32, value3: u32) c_int; pub extern "c" fn purge(mode: c_int) c_int; -- 2.54.0