Files
bare-operating-system/packages/bare-os-booter/lib/bare-os-posix-errno.js
T
Raven Scott 346bb71ffe Complete the internal “100 task” roadmap: coreutils and shell parity (xargs,
sh, diff/patch, sort, printf, find, test, getfacl/setfacl/xattr), expanded
/proc and metrics (process table, syscalls, replication, net, security
posture, worker budget, swarm/replication hints), initd DAG supervision
metadata and richer restart journal telemetry, synthetic process groups via
IPC (assignProcessGroup/signalProcessGroup) mirrored into process_table,
optional kernel.ext.d incremental hot reload (BARE_OS_KERNEL_EXT_D_HOT_RELOAD)
with reload audit NDJSON, features proc for hyperblobs dedup and systemd
subset documentation, vault threat model doc plus posture fields for AEAD,
Pear enclave pointer, account rotation continuity, and Ed25519 consistency
across boot manifest / extensions / replication. Adds or extends tests and
keeps kernel/ and packages/bare-os-seeder/kernel/ in parity; guest init is
bundled from kernel/lib/init/init-main.js via bundle-kernel-init.
2026-04-04 21:23:49 -04:00

63 lines
1.1 KiB
JavaScript

/**
* POSIX errno names ↔ numeric hints for guest errors and `/proc` introspection.
* Values follow Linux/x86-64 style where Bare OS surfaces them in messages.
*/
export const BARE_OS_POSIX_ERRNO_MAP = Object.freeze({
EPERM: 1,
ENOENT: 2,
ESRCH: 3,
EINTR: 4,
EIO: 5,
ENXIO: 6,
E2BIG: 7,
ENOEXEC: 8,
EBADF: 9,
ECHILD: 10,
EAGAIN: 11,
ENOMEM: 12,
EACCES: 13,
EFAULT: 14,
ENOTBLK: 15,
EBUSY: 16,
EEXIST: 17,
EXDEV: 18,
ENODEV: 19,
ENOTDIR: 20,
EISDIR: 21,
EINVAL: 22,
ENFILE: 23,
EMFILE: 24,
ENOTTY: 25,
ETXTBSY: 26,
EFBIG: 27,
ENOSPC: 28,
ESPIPE: 29,
EROFS: 30,
EMLINK: 31,
EPIPE: 32,
EDOM: 33,
ERANGE: 34,
ELOOP: 40,
ENAMETOOLONG: 36,
ENOSYS: 38,
ENOTEMPTY: 39,
EOPNOTSUPP: 95
})
/**
* @param {string} name
* @returns {number | undefined}
*/
export function bareOsErrnoNumber(name) {
const k = String(name || '').toUpperCase()
return /** @type {Record<string, number>} */ (BARE_OS_POSIX_ERRNO_MAP)[k]
}
/**
* @returns {Record<string, number>}
*/
export function bareOsErrnoTableForProc() {
return { ...BARE_OS_POSIX_ERRNO_MAP }
}