/** * Linux POSIX ACL absence check (SH-00084). * * Access ACLs change effective permissions independently of mode and group. * The guarded writers do not copy ACLs, so they require verified absence on * supported Linux/glibc. A default ACL initializes direct children at * creation, not existing descendants: query it only for directories where the * caller will create an object. * * Presence is queried only (size 0); no attribute value is read or copied. * * errno is thread-local and any later libc call on this thread, or a signal * handler that does not preserve it, can overwrite it. The probe therefore: * - resets errno before each query where the layer can write it, * - reads it as the very next step after the call, with nothing allocated in * between (the call returns an immediate number, not a BigInt, and errno is * read with bun:ffi's read.i32, which allocates nothing), * - re-queries a bounded number of times when the result is -1 with an errno * other than the two "absent" answers, since a stray overwrite does not * repeat while a genuine failure does. A persistent failure refuses. * A result other than -1 (the attribute exists, or an anomalous value) always * refuses at once and never depends on errno. */ /** ENODATA on the asm-generic errno table (Linux x86_64 and aarch64). */ export declare const LINUX_ENODATA = 61; /** EOPNOTSUPP, which glibc also names ENOTSUP, on the asm-generic table. */ export declare const LINUX_EOPNOTSUPP = 95; /** Queries per attribute before an unexplained failure refuses. */ export declare const LINUX_ACL_QUERY_ATTEMPTS = 4; /** * Filesystems where an unsupported POSIX ACL attribute means the kernel * enforces no ACL at all (support compiled out, or mounted with noacl), so * mode and ownership are the whole access model. Network and FUSE filesystems * (NFSv4, SMB, 9p, FUSE and others) also answer EOPNOTSUPP while enforcing * their own ACLs or server-side access, so they stay unverified. */ export declare const LINUX_ACL_FREE_WHEN_UNSUPPORTED: ReadonlySet; /** The raw operations, separable so tests can drive every errno path. */ export interface LinuxAclProbe { /** process.arch of the running binary; only asm-generic errno tables are admitted. */ readonly arch: string; /** Thread-local errno of the calling thread, or null when it cannot be located. */ readonly errno: { get(): number; set?(value: number): void; } | null; /** fgetxattr(fd, name, NULL, 0): the attribute size, or -1. */ fgetxattr(fd: number, attribute: string): number | bigint; /** fstatfs(fd).f_type, or null when fstatfs fails. */ filesystemType(fd: number): bigint | null; } /** True only when every queried POSIX ACL attribute is verifiably absent. */ export declare function linuxAccessAclAbsent(probe: LinuxAclProbe, fd: number, creationParent: boolean): boolean; /** Run with the glibc probe; any loading or ABI failure refuses (false). */ export declare function withGlibcAclProbe(use: (probe: LinuxAclProbe) => boolean): boolean;