Skip to main content

Crate bun_sys

Crate bun_sys 

Source
Expand description

bun_sys — syscall wrappers (port of src/sys/sys.zig).

Re-exports§

pub use fd::ErrorCase;
pub use fd::FdExt;
pub use fd::FdOptionalExt;
pub use fd::FdT;
pub use fd::HashMapContext;
pub use fd::MakeLibUvOwnedError;
pub use fd::MovableIfWindowsFd;
pub use fd::RawFd;
pub use fd::UvFile;
pub use signal_code::SignalCode;
pub use tmp::Tmpfile;
pub use file::File;
pub use file::ReadToEndResult;
pub use PlatformIoVec as PlatformIOVec;
pub use PlatformIoVecConst as PlatformIOVecConst;
pub use posix_stat::PosixStat;
pub use posix_stat::stat_atime;
pub use posix_stat::stat_birthtime;
pub use posix_stat::stat_ctime;
pub use posix_stat::stat_mtime;
pub use make_path as MakePath;
pub use dir::*;

Modules§

O
RTLD
std.c.RTLD flags for dlopen.
S
stat mode-flag constants and predicates (Zig: std.posix.S). Values are POSIX-standard octal; identical across linux/darwin/freebsd. Constants are typed u32 (== bun_core::Mode); on Darwin/FreeBSD the kernel mode_t is u16 so the upper 16 bits are always zero — every call site already casts (as i32/as u32/as _) so the wider type is harmless, and on Linux mode_t == u32 so it’s a drop-in re-export. stat mode-flag constants and predicates (Zig: std.posix.S).
UV_E
c
copy_file
coreutils_error_map
darwin
dir
bun.sys.Dir — directory handle + helpers. Port of the Dir half of src/sys/sys.zig (Zig: bun.sys.Dirstd.fs.Dir).
dir_iterator
elf
std.elf constants (just what bun_exe_format/bun_crash need).
fd
file
bun.sys.File — high-level file handle. Port of src/sys/File.zig.
freebsd
fs
High-level filesystem convenience functions (read_to_string, write, metadata, OpenOptions). High-level filesystem convenience functions built on top of bun_sys primitives.
libuv_error_map
linux
macho
make_path
std.fs.Dir.makeOpenPath reachable as a module (Zig callers do bun.makePath / bun.makeOpenPath).
net
posix
posix_stat
bun.sys.PosixStat — uv-shaped stat struct (src/sys/PosixStat.zig). Re-exported here so dependents (node_fs.rs, Stat.rs) can spell bun_sys::PosixStat exactly as the Zig source spells bun.sys.PosixStat.
signal_code
sys_uv
Zig: pub const sys_uv = if (Environment.isWindows) @import("./sys_uv.zig") else sys; On non-Windows, sys_uv is just an alias for the regular syscall surface so callers (e.g. pack_command) can write bun_sys::sys_uv::fstat(fd) portably.
syscall
time
std.time shim — re-exported from bun_core so callers that wrote bun_sys::time::timestamp() (matching Zig’s std.time import via bun.sys) resolve without an extra dep. bun.Timer / std.time.Timer — minimal monotonic stopwatch. Mirrors Zig’s std.time.Timer.{start,read} so callers ported verbatim (e.g. Lockfile::clean_with_logger, LifecycleScriptSubprocess) compile against the tier-0 surface without pulling in bun_perf.
tmp
walker_skippable

Macros§

dlsym_with_handle
bun.c.dlsymWithHandle — once-cached typed lookup. The Zig version monomorphises per (Type, name, handle_getter); in Rust this is a macro.
syslog
bun.sys.syslog — debug-scoped log under SYS (Zig: Output.scoped(.SYS)). PORT NOTE: bun_core::scoped_log! only accepts a bare $scope:ident, so we re-expand its body verbatim here with the qualified $crate::fd::SYS path and ::bun_core:: helpers — keeping the [sys] tag prefix, trailing-\n append, and pretty_fmt! ANSI rewrite (output.zig:893-933) that ScopedLogger::log() does not add on its own.

Structs§

CloseOnDrop
RAII guard that closes a raw Fd on drop. Most code should prefer File / Dir, which are owning RAII handles already; reach for this only when working with a bare Fd in a context where a typed wrapper would be misleading (e.g. an fd that is sometimes a file, sometimes a directory, sometimes a pipe).
DynLib
Error
Fd
FdOptional
Niche-packed Option<Fd> (enum(backing_int) { none = @bitCast(invalid), _ }). Use instead of encoding the invalid value directly.
FileReader
std::io::Read adapter for Fd (used by File::reader). Port of File.Reader = std.Io.GenericReader(File, anyerror, stdIoRead).
FileWriter
std::io::Write adapter for Fd (used by File::writer/buffered_writer). Port of File.Writer = std.Io.GenericWriter(File, anyerror, stdIoWrite).
OpenFlags
std.fs.File.OpenFlags — convenience flagset for open_file* helpers.
PlatformIoVecConst
Renameat2Flags
Flags for renameat2. Port of bun.sys.RenameAt2Flags (sys.zig:2472). On Linux maps to RENAME_EXCHANGE/RENAME_NOREPLACE; on macOS maps to RENAME_SWAP/RENAME_EXCL/RENAME_NOFOLLOW_ANY.
RenameatConcurrentlyOptions
sys.zig:2461 — option struct for renameat_concurrently. Zig used a comptime anonymous struct param { move_fallback: bool = false }; Rust surfaces it as a runtime options struct so callers can build it inline.
SystemError
Port of SystemError (src/jsc/SystemError.zig) — the JS-facing rich error (path/dest/syscall as bun.String). The data side has no JSC dependency: the *JSGlobalObject-taking conversion methods (toErrorInstance etc.) live in bun_jsc as inherent extensions. #[repr(C)] and field order match the Zig extern struct exactly so the C++ SystemError__* externs (BunObject.cpp) read the same layout.
Tag
TimeLike
bun.jsc.Node.TimeLiketimespec shape, decoupled from JSC (T6). sys.zig takes this for futimens/utimens; the JSC binding constructs it from JS Date/number. T1 owns the data shape.
Timespec
bun.timespec — re-exported from bun_core so PosixStat.rs can spell crate::Timespec (matching the Zig bun.timespec namespacing).
WindowsSymlinkOptions
Port of WindowsSymlinkOptions (sys.zig:2653) — Windows-only flag struct plus a process-global “symlink creation has failed once” sticky bit. The flag is checked by the install linker to decide whether to fall back to junctions; on POSIX the flag is harmless dead state. Only the sticky bit is needed cross-platform (PackageManager::init sets it when BUN_FEATURE_FLAG_FORCE_WINDOWS_JUNCTIONS is on).
WriteFileArgs
Args struct (Zig: anon-struct init at call sites).

Enums§

EntryKind
ExistsAtType
sys.zig:3636 ExistsAtType.
FdKind
Zig Kind — tag in bit 63 on Windows, enum(u0) (zero-width) on POSIX.
FileKind
MemfdFlags
bun.sys.MemfdFlags (Zig: enum(u32)).
PathOrFileDescriptor
Target — path (relative to dirfd) or an already-open fd.
SizeHint
bun.sys.File.SizeHint — pre-reserve hint for read_to_end_with_array_list. Mirrors Zig’s enum { probably_small, unknown_size } (File.zig:298).
Stdio
SystemErrno
WriteFileData
Data payload for write_file_with_path_buffer.
WriteFileEncoding
Encoding tag (only Buffer is honoured at T1).

Constants§

MAX_COUNT
Max single read/write count (sys.zig:1832): Linux caps at 0x7ffff000; Darwin/BSD use signed 32-bit byte counts.
MSG_DONTWAIT
SEND_FLAGS_NONBLOCK
STATX_MASK_FOR_STATS
STATX_* request mask covering every field node:fs Stats consumes (sys.zig:614 StatxField — all variants OR’d, the only mask the Zig callers ever pass).
UTIME_NOW
UTIME_OMIT

Statics§

SUPPORTS_STATX_ON_LINUX
WINDOWS_SYMLINK_HAS_FAILED
Zig: pub var has_failed_to_create_symlink = false; (sys.zig:2669).

Traits§

AsFd
Anything that can hand out an Fd without giving up ownership: a raw Fd, or a reference to an owning File / Dir. Mirrors std::os::fd::AsFd. Implemented for references only (not owned File / Dir) so syscall wrappers can’t accidentally consume and drop-close an owned handle.
GetErrno
Zig’s getErrno(rc: anytype) switches on @TypeOf(rc) to pick the errno extraction strategy. Rust has no type-switch, so we model it as a trait with per-type impls — call as rc.get_errno() or get_errno(rc).
MaybeExt
Zig Maybe(T) static helpers — .success(), .errno(e, tag), .errnoSys(rc, tag). Ported as a trait over Result<T, Error> so call sites can keep writing bun_sys::Result::<()>::errno_sys(rc, tag) exactly as the Zig spells it. Windows-only paths in windows/mod.rs lean on these for the NTSTATUS → E mapping.

Functions§

Bun__errnoName
Exported for headers-handwritten.h Bun__errnoName. Returns a NUL-terminated upper-case errno name (e.g. "ENOENT") or null for an unrecognised code. The pointer is thread-local and valid until the next call on the same thread; both C++ callers consume it immediately.
Bun__unlink
Small “fire and forget” wrapper around unlink for C usage that handles EINTR, Windows path conversion, etc. Zig: export fn Bun__unlink(ptr, len).
access
can_use_memfd
bun.sys.canUseMemfd() — false on non-Linux; on Linux, false once memfd_create has returned ENOSYS/EPERM/EACCES.
chdir
chmod
chown
clonefile
clonefile — macOS-only CoW copy. On non-Darwin returns ENOTSUP so callers can fall back to copy_file.
clonefileat
clonefileat — macOS-only CoW copy relative to directory fds. On non-Darwin returns ENOTSUP so callers can fall back to a manual copy.
close
copy_file
bun.sys.copyFile — fd→fd full transfer using the best available kernel fast path (ioctl_ficlone / copy_file_range / sendfile / read-write loop).
copy_file_z_slow_with_handle
sys.zig:4305 — copyFileZSlowWithHandle (POSIX read/write fallback arm).
cwd
std.fs.cwd() — Zig callers do bun_sys::cwd() for the process cwd Dir.
delete_tree_absolute
std.fs.deleteTreeAbsolute — best-effort recursive delete of an absolute path. Routes through Dir::delete_tree on the parent directory.
directory_exists_at
sys.zig:3533 — directoryExistsAt(dir, sub). ENOENT → Ok(false).
disable_linger
sys.zig:3835 disableLinger — set SO_LINGER {1,0} so close sends RST.
dlopen
sys.zig:4557 — dlopen(filename, flags). Windows → LoadLibraryA.
dlsym_impl
sys.zig:4565 — dlsym(handle, name).
dup
sys.zig:3897 — fcntl(F_DUPFD_CLOEXEC, 0) so the dup’d fd doesn’t leak to children. NOT dup(2) (which lacks CLOEXEC).
dup2
dup_with_flags
sys.zig:3873 — fcntl(F_DUPFD_CLOEXEC) (POSIX) / DuplicateHandle (Win). _flags is ignored (Zig signature parity).
e_from_negated
Zig: SystemError.getErrno@enumFromInt(this.errno * -1).
environ
std.os.environ — borrowed slice of KEY=VALUE\0 C strings. SAFETY note: the returned slice borrows the libc environ global; do not mutate the environment concurrently.
environ_ptr
std.os.environ.ptr — raw NULL-terminated **c_char for FFI envp args (e.g. posix_spawn). Unlike environ() this returns the raw libc global pointer (already NULL-terminated) rather than a length-bounded borrowed slice, so it is suitable to pass directly as envp.
errno
std.c._errno() — pointer to thread-local errno. Prefer last_errno() for the value; this exists for callers that match the Zig *_errno() API shape (unsafe { *bun_sys::errno() }).
errno_to_zig_err
Zig: bun.errnoToZigErr(errno) (bun.zig) — re-exported here so callers that already depend on bun_sys (e.g. bun_install Windows paths) can write bun_sys::errno_to_zig_err(..) without also importing bun_core.
eventfd
eventfd(initval, flags) — kernel notification fd. Linux native (Android included since API 8); FreeBSD 13+ gained a Linux-compatible eventfd(2) via the libc shim.
exists
sys.zig:3482 — bun.sys.exists. Non-NUL-terminated convenience over exists_z: copies into a stack PathBuffer, NUL-terminates, then access(path, F_OK) (POSIX) / GetFileAttributesW (Windows).
exists_at
exists_at_type
sys.zig:3640 — fstatat then S_ISDIR.
exists_os_path
sys.zig:3447 — access(path, F_OK) == 0. file_only ignored on POSIX.
exists_z
sys.zig:1748 — Windows uses GetFileAttributesW; posix is plain access.
faccessat
sys.zig:3504 — never returns .err; any non-zero rc → Ok(false).
fchdir
fchmod
fchmodat
fchown
fchownat
fcntl
fdatasync
fetch_cache_directory_path
bun.fetchCacheDirectoryPath — resolve $BUN_INSTALL_CACHE_DIR / $XDG_CACHE_HOME/.bun/install/cache / $HOME/.bun/install/cache. PORT NOTE: full env-override chain lives in bun_install; this is the fallback so the symbol resolves at T1. Returns an owned path (caller frees).
force_link
Force the linker to include all #[no_mangle] dispatch symbols. Called from dependent crate test harnesses to prevent link GC.
fstat
fstatat
fstatx
fsync
ftruncate
futimens
get_errno
get_fcntl_flags
sys.zig:3599 — fcntl(fd, F_GETFL, 0).
get_fd_path
sys.zig:2940 — fd → absolute path. Linux: readlink /proc/self/fd/N; macOS: fcntl(F_GETPATH); Windows: GetFinalPathNameByHandle.
get_fd_path_w
get_fd_path_z
bun.zig:1303 — bun.getFdPathZ(fd, buf). Wraps get_fd_path then NUL-terminates in-place so callers receive a &ZStr.
get_file_size
sys.zig:4152 — fstat then @max(st_size, 0) (clamp negative).
getcwd
getcwd_alloc
bun.getcwdAlloc(allocator) (bun.zig:1256) — read cwd into a stack PathBuffer, then duplicate into a heap-owned NUL-terminated ZBox.
getcwd_z
bun.sys.getcwdZ(buf) (sys.zig:349) — getcwd returning a NUL-terminated borrow into buf. POSIX getcwd(3) already NUL-terminates; on Windows the libuv path does too.
is_executable_file_path
sys.zig:3767 — calls extern C is_executable_file (c-bindings.cpp:72-89). We FFI to the same symbol so the behaviour is identical.
is_regular_file
Zig: bun.isRegularFile(mode) (bun.zig) — S.ISREG(@intCast(mode)).
isatty
iterate_dir
bun.iterateDir(dir) — convenience wrapper around dir_iterator::iterate.
kind_from_mode
last_errno
Read thread-local libc errno (set by the failing syscall). Zig: std.c._errno().* (sys.zig). On Windows this reads the CRT’s thread-local _errno(); libuv-backed paths that need Win32 GetLastError() go through bun_sys::windows::get_last_errno instead.
lchmod
lchmod is BSD/Darwin-only; Linux: fchmodat(.., AT_SYMLINK_NOFOLLOW) (sys.zig:434).
lchown
link
linkat
linkat_tmpfile
linkatTmpfile (sys.zig:3973): materialize an O_TMPFILE fd. Fast path uses linkat(tmpfd, "", dirfd, name, AT_EMPTY_PATH) (requires CAP_DAC_READ_SEARCH); falls back to /proc/self/fd/N + AT_SYMLINK_FOLLOW. Linux-only; on other unix this errors with EOPNOTSUPP (Zig same).
lseek
lstat
lstatat
lstatx
lutimens
make_path_w
bun.zig:2319 — Windows-only makePath over UTF-16. On POSIX, transcodes to UTF-8 and delegates to mkdir_recursive_at.
memfd_create
bun.sys.memfd_create(name, flags) — Linux only. Retries on EINTR; on EINVAL retries once with the pre-6.3 flag set (drops MFD_EXEC/MFD_NOEXEC_SEAL); on ENOSYS/EPERM/EACCES latches can_use_memfd to false.
mkdir
mkdir_recursive
bun.mkdirRecursivemake_path cwd-relative, taking a slice.
mkdir_recursive_at
bun.makePathmkdirat walking up parents on ENOENT, like mkdir -p. Port of std.fs.Dir.makePath (Zig std/fs/Dir.zig).
mkdir_recursive_at_mode
mkdir_recursive_at with an explicit mode for created directories (matches bun.api.node.fs.NodeFS.mkdirRecursive’s mode arg).
mkdirat
mkdirat_z
mkdiratZmkdirat with already-NUL-terminated path. Same as mkdirat.
mmap
mmap_file
bun.sys.mmapFile — open path RDWR, fstat for size, mmap [offset, offset+len). Returns a process-lifetime mmap slice; caller is responsible for munmap. Mirrors Zig mmapFile (sys.zig).
move_file_z
sys.zig:4246 — moveFileZ. Tries the rename first (no source open on the hot path); on EISDIR removes the dest dir and retries; on EXDEV falls back to the slow open+copy path. Only opens the source inside the EXDEV branch.
move_file_z_slow
sys.zig:4291 — moveFileZSlow: open source, unlink, copy to dest.
move_file_z_slow_maybe
sys.zig:4296 — moveFileZSlowMaybe. Thin wrapper kept for source parity with Zig callers (renameatConcurrently falls back through here).
move_file_z_with_handle
renameat; on EISDIR removes the dest dir and retries; on EXDEV falls back to copy-then-unlink. Port of bun.sys.moveFileZWithHandle.
munmap
open
open_a
openA — like open but takes a non-NUL-terminated slice.
open_dir_absolute
bun.zig:890 openDirAbsolute. PORT NOTE: returns Fd, not std.fs.Dir.
open_dir_absolute_not_for_deleting_or_renaming
bun.zig:899 — Windows variant skips DELETE access; on POSIX identical.
open_dir_at
bun.zig:879 openDirA — open a path as an iterable directory fd.
open_dir_for_iteration
bun.zig:883 — openDirForIteration(dir, sub).
open_dir_for_iteration_os_path
bun.openDirForIterationOSPathopenat(dir, path, O_DIRECTORY|O_RDONLY) on POSIX; CreateFileW with FILE_FLAG_BACKUP_SEMANTICS on Windows.
open_file
std.fs.cwd().openFile — non-NUL-terminated convenience.
open_file_absolute_z
std.fs.openFileAbsoluteZ — open an absolute, NUL-terminated path.
open_file_read_only
openFileReadOnlyopen(path, O_RDONLY|O_CLOEXEC).
openat
openat2_beneath
openat_a
openatA — like openat but takes a non-NUL-terminated slice.
openat_os_path
sys.zig:1705 openatOSPathopenat taking a platform-native path (OSPathSliceZ = ZStr on POSIX, WStr on Windows). On POSIX this is identical to openat; on Windows it routes through the NT openat path.
openat_read_only
openatReadOnlyopenat(dir, path, O_RDONLY|O_CLOEXEC).
page_size
pidfd_open
pidfd_open(2) — Linux ≥ 5.3. Returns a pollable fd referring to pid. Callers fall back to the waiter-thread on ENOSYS/EPERM/EACCES.
pipe
sys.zig:3839 — plain pipe(&fds), NO CLOEXEC. Callers that want CLOEXEC set it themselves (matches Zig).
platform_iovec_const_create
platform_iovec_create
pread
preadv
bun.sys.preadv — scatter-read at position. macOS uses preadv$NOCANCEL with no EINTR retry (sys.zig:2016-2048).
preallocate_file
sys.zig:4536 — fallocate(fd, 0, offset, len) on Linux, result discarded; no-op elsewhere.
pwrite
pwritev
bun.sys.pwritev — gather-write at offset. Returns bytes written (may be less than the sum of vecs lengths on a short write).
read
read_nonblocking
sys.zig:4046 — Linux: preadv2(.., RWF_NOWAIT); else plain read.
readlink
readlinkat
readv
bun.sys.readv — scatter-read. macOS uses readv$NOCANCEL with no EINTR retry (sys.zig:1982-2014); other POSIX retries on EINTR.
realpath
realpathrealpath$DARWIN_EXTSN on macOS for proper symlink resolution (Zig: bun.c.realpath). Writes into buf and returns the written slice.
recv
recv_non_block
rename
renameat
renameat2
renameat2(2) (Linux) / renameatx_np (macOS). FreeBSD and any other unix without an atomic-exchange rename get ENOSYS when flags are set, matching bun.sys.renameat2 (sys.zig:2503).
renameat_concurrently
sys.zig:2461 — renameatConcurrently. Tries an atomic NOREPLACE rename, then EXCHANGE, then a racy delete-tree + rename. With move_fallback set, an EXDEV result falls through to a slow open/copy.
renameat_concurrently_a
&[u8]-taking convenience over renameat_concurrently — Z-terminates both paths into stack buffers (Zig signature is [:0]const u8).
renameat_concurrently_without_fallback
sys.zig:2480 — renameatConcurrentlyWithoutFallback.
renameat_z
renameatZ alias (bun_install reaches for it as the NUL-terminated form).
rmdir
Port of sys.zig:2876 rmdirrmdirat(FD.cwd(), to). Exposed on all platforms (POSIX unlinkat(.., AT_REMOVEDIR); Windows DeleteFileBun).
self_process_memory_usage
bun.sys.selfProcessMemoryUsage() — returns the resident set size of the current process in bytes, or None on failure. Thin wrapper around the C++ getRSS shim (lives in src/jsc/bindings/memory.cpp).
send
send_non_block
sys.zig:2205 — MSG_DONTWAIT | MSG_NOSIGNAL so a broken-pipe write returns EPIPE instead of raising SIGPIPE.
sendfile
sys.zig:504 — sendfile(src, dest, len). Clamps len (avoid EINVAL on
set_close_on_exec
sys.zig:3054 setCloseOnExecfcntl(F_GETFD) then OR in FD_CLOEXEC.
set_file_offset
sys.zig:3788 — lseek(fd, offset, SEEK_SET); result discarded.
set_nonblocking
sys.zig:3614.
socketpair
sys.zig:3103 socketpairsocketpairImpl(.., for_shell = false). Linux uses SOCK_CLOEXEC|SOCK_NONBLOCK type flags; non-Linux sets CLOEXEC + nonblock + (Darwin) SO_NOSIGPIPE per-fd, closing both on any post-step error.
socketpair_for_shell
sys.zig:3125 socketpairForShellsocketpairImpl(.., for_shell = true). On macOS this skips SO_NOSIGPIPE (so the child’s writes get SIGPIPE when the read end closes — required for yes | head-style pipelines) and bumps SO_RCVBUF/SO_SNDBUF to 128 KB instead. On Linux/other POSIX it is identical to socketpair.
stat
statfs
bun.sys.statfs — query filesystem stats for path. Retries on EINTR.
statx
stderr_writer
bun.Output.stderrWriter()std::io::Write over stderr fd. Used by callers that want a borrowed writer without going through bun_core::Output.
symlink
symlink_running_executable
sys.zig:2615 symlinkRunningExecutable — same as symlink, except it handles ETXTBSY/EBUSY by unlinking the destination and retrying once.
symlinkat
sys_preadv2
Linux preadv2(2) — real implementation (was a -1 stub in bao_native_stubs).
sys_pwritev2
Linux pwritev2(2) — real implementation (was undeclared; only declared via extern).
to_posix_path
std.posix.toPosixPath — copy path into a NUL-terminated buffer. Returns NameTooLong if path contains an interior NUL.
umask
unlink
unlinkat
sys.zig:2912 unlinkat — 2-arg form (flags = 0). Zig’s surface is 2-arg; the 3-arg variant is unlinkatWithFlags.
unlinkat_with_flags
sys.zig:2884 unlinkatWithFlags — explicit flags (e.g. AT_REMOVEDIR). Zig builds the error via errnoSysFP(.., .unlink, dirfd, to) so the surfaced SystemError carries BOTH the dirfd and the path.
update_nonblocking
sys.zig:3618 — GETFL → toggle O_NONBLOCK → SETFL (only if changed).
utimens
write
write_file_with_path_buffer
NodeFS::writeFileWithPathBuffer — sync openat(CREAT|TRUNC) + write_all. path_buf is a scratch buffer for NUL-terminating the relative path.
write_nonblocking
sys.zig:4099 — Linux: pwritev2(.., RWF_NOWAIT); else plain write.
writev
bun.sys.writev — gather-write. macOS uses writev$NOCANCEL with no EINTR retry (sys.zig:1923-1934); other POSIX retries on EINTR.

Type Aliases§

E
Kernel errno enum. Zig’s std.posix.E and Bun’s SystemErrno share the exact same discriminant space on each POSIX target; alias rather than duplicate. Resolves to the per-OS SystemErrno via the glob re-export above. TODO(port): Zig’s E uses unprefixed variant names (PERM, NOENT); SystemErrno uses EPERM, ENOENT. Callers matching on E::PERM must migrate to E::EPERM (or this becomes a distinct enum).
EnvMap
std.process.EnvMap — owned KEY → VALUE map of environment variables. Minimal real def (no Zig hash-map semantics needed; Rust callers iterate).
Errno
std.posix.E — un-prefixed errno enum (.SUCCESS, .AGAIN, …). PORT NOTE: aliased to bun_errno::E (= SystemErrno); variants currently keep the E prefix (EAGAIN not AGAIN). Unprefixed associated consts live on SystemErrno directly (errno crate); callers comparing against Errno::AGAIN/Errno::EXIST rely on those.
ErrorInt
bun.sys.Error.Int — backing integer for errno.
FcntlInt
FdNative
std.posix.fd_tc_int on POSIX, HANDLE (*anyopaque) on Windows.
Maybe
Maybe(T) — Zig’s union(enum) { result: T, err: Error }. In Rust this is just Result<T, Error>; keep the alias so ported call sites type-check.
Mode
PlatformIoVec
RenameOptions
Alias: bun_install call sites spell this RenameOptions.
Result
SocketT
std.posix.socket_tc_int on POSIX, SOCKET (usize) on Windows.
Stat
StatFS