From 70fa6508e525bd40a918ad42e5225b40071af75f Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Wed, 28 Oct 2026 03:54:45 +0000 Subject: [PATCH] Remove dead code from the glibc wraps, `#[uws_callback]`, and two re-export lists - `--wrap=mknod` and `--wrap=fstatat`, with `__wrap_mknod`, `__wrap_fstatat` and their version pins. libarchive was the one caller of both symbols, and #46638 removed libarchive. - The `thunk = "name"` option of `#[uws_callback]`. #42590 removed its one use. - The root re-exports `bun_tar::Reader` and `bun_archive::Plucker`. Every user names the defining module. - The `onClose` and `onDrain` members of the `NativePtr` type. --- scripts/build/flags.ts | 2 -- src/archive/lib.rs | 2 +- src/js/internal/streams/native-readable.ts | 2 -- src/jsc/bindings/workaround-missing-symbols.cpp | 12 +----------- src/jsc_macros/lib.rs | 14 +++----------- src/tar/lib.rs | 2 +- 6 files changed, 6 insertions(+), 28 deletions(-) diff --git a/scripts/build/flags.ts b/scripts/build/flags.ts index c0badfc80582..08b51539fca3 100644 --- a/scripts/build/flags.ts +++ b/scripts/build/flags.ts @@ -1385,9 +1385,7 @@ export const linkerFlags: Flag[] = [ // stat-family inline → real symbol (2.33) "fstat", "fstat64", - "fstatat", "fstatat64", - "mknod", // syscall wrappers (2.27/2.28) "copy_file_range", "memfd_create", diff --git a/src/archive/lib.rs b/src/archive/lib.rs index f8d73ee761a2..b5c087d3f7b9 100644 --- a/src/archive/lib.rs +++ b/src/archive/lib.rs @@ -482,7 +482,7 @@ pub mod archiver { } } -pub use archiver::{Context, ExtractOptions, Plucker}; +pub use archiver::{Context, ExtractOptions}; pub trait ArchiveAppender { /// Mirrors `@hasDecl(Child, "onFirstDirectoryName")`. diff --git a/src/js/internal/streams/native-readable.ts b/src/js/internal/streams/native-readable.ts index b2f52f8dc8eb..794f52b4122d 100644 --- a/src/js/internal/streams/native-readable.ts +++ b/src/js/internal/streams/native-readable.ts @@ -43,8 +43,6 @@ interface NativeReadable extends $Node.Readable { } interface NativePtr { - onClose: () => void; - onDrain: (chunk: any) => void; start: (highWaterMark: number) => number; drain: () => any; pull: (view: any, closer: any) => any; diff --git a/src/jsc/bindings/workaround-missing-symbols.cpp b/src/jsc/bindings/workaround-missing-symbols.cpp index f2b6db3744ff..6ab4e89a1e77 100644 --- a/src/jsc/bindings/workaround-missing-symbols.cpp +++ b/src/jsc/bindings/workaround-missing-symbols.cpp @@ -405,27 +405,17 @@ extern "C" int __pthread_key_create(pthread_key_t*, void (*)(void*)); extern "C" int __wrap___pthread_key_create(pthread_key_t* k, void (*d)(void*)) { return __pthread_key_create(k, d); } // Group B: stat family became real symbols in 2.33. Before that they were -// header inlines around __fxstat*/__xmknod, which still exist at ≤ 2.17. +// header inlines around __fxstat*, which still exist at ≤ 2.17. extern "C" int __fxstat(int, int, struct stat*); extern "C" int __fxstat64(int, int, struct stat64*); -extern "C" int __fxstatat(int, int, const char*, struct stat*, int); extern "C" int __fxstatat64(int, int, const char*, struct stat64*, int); -extern "C" int __xmknod(int, const char*, mode_t, dev_t*); BUN_SYMVER(__fxstat, BUN_GLIBC_BASE); BUN_SYMVER(__fxstat64, BUN_GLIBC_BASE); -BUN_SYMVER(__fxstatat, BUN_GLIBC_2_4); BUN_SYMVER(__fxstatat64, BUN_GLIBC_2_4); -BUN_SYMVER(__xmknod, BUN_GLIBC_BASE); - -#ifndef _MKNOD_VER -#define _MKNOD_VER 0 -#endif extern "C" int __wrap_fstat(int fd, struct stat* st) { return __fxstat(_STAT_VER, fd, st); } extern "C" int __wrap_fstat64(int fd, struct stat64* st) { return __fxstat64(_STAT_VER, fd, st); } -extern "C" int __wrap_fstatat(int dfd, const char* p, struct stat* st, int f) { return __fxstatat(_STAT_VER, dfd, p, st, f); } extern "C" int __wrap_fstatat64(int dfd, const char* p, struct stat64* st, int f) { return __fxstatat64(_STAT_VER, dfd, p, st, f); } -extern "C" int __wrap_mknod(const char* p, mode_t m, dev_t d) { return __xmknod(_MKNOD_VER, p, m, &d); } // Group C: thin syscall wrappers added in 2.27/2.28. Kernel has had the // syscalls since 4.5 (copy_file_range), 3.17 (memfd_create), 4.11 (statx); diff --git a/src/jsc_macros/lib.rs b/src/jsc_macros/lib.rs index 9f6620f78cd7..3b6467586390 100644 --- a/src/jsc_macros/lib.rs +++ b/src/jsc_macros/lib.rs @@ -46,7 +46,7 @@ pub fn host_call(_attr: TokenStream, item: TokenStream) -> TokenStream { } // ────────────────────────────────────────────────────────────────────────── -// #[uws_callback] / #[uws_callback(export = "Name", no_catch, thunk = "name")] +// #[uws_callback] / #[uws_callback(export = "Name", no_catch)] // // Wraps a `&self` / `&mut self` method in an `extern "C"` thunk suitable for // registration with uWS / uSockets / any C-ABI callback that round-trips a @@ -75,7 +75,7 @@ pub fn host_call(_attr: TokenStream, item: TokenStream) -> TokenStream { // the caller passed to the C side, and any `(ptr, len)` pair describes a slice // valid for the duration of the callback. // -// Generated thunk name defaults to `___c`; override with `thunk = "x"`. +// The generated thunk is named `___c`. // `export = "Sym"` adds `#[unsafe(export_name = "Sym")]` for link-time // dispatch shims (cycle-break externs). // ────────────────────────────────────────────────────────────────────────── @@ -83,7 +83,6 @@ pub fn host_call(_attr: TokenStream, item: TokenStream) -> TokenStream { #[derive(Default)] struct UwsCallbackArgs { export: Option, - thunk: Option, no_catch: bool, } @@ -98,10 +97,6 @@ impl Parse for UwsCallbackArgs { input.parse::()?; out.export = Some(input.parse()?); } - "thunk" => { - input.parse::()?; - out.thunk = Some(input.parse()?); - } other => { return Err(syn::Error::new( ident.span(), @@ -222,10 +217,7 @@ fn expand_uws_callback(args: &UwsCallbackArgs, func: &ItemFn) -> syn::Result quote! { #t }, }; - let thunk_ident = match &args.thunk { - Some(l) => format_ident!("{}", l.value()), - None => format_ident!("__{}_c", fn_name), - }; + let thunk_ident = format_ident!("__{}_c", fn_name); let export_attr = args.export.as_ref().map(|l| { quote! { #[unsafe(export_name = #l)] } }); diff --git a/src/tar/lib.rs b/src/tar/lib.rs index 7dadfee1cb8c..e9097c579f5c 100644 --- a/src/tar/lib.rs +++ b/src/tar/lib.rs @@ -22,4 +22,4 @@ pub mod writer; pub use decoder::{Decoder, MemoryDecoder}; pub use error::{Error, Result}; -pub use reader::{Charset, Dialect, Entry, Event, Options, Reader}; +pub use reader::{Charset, Dialect, Entry, Event, Options};