1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// SPDX-License-Identifier: Apache-2.0 OR MIT
// https://github.com/ARM-software/abi-aa/blob/2025Q1/semihosting/semihosting.rst#sys-errno-0x13
// > Whether `errno` is set or not, and to what value, is entirely host-specific,
// > except where the ISO C standard defines the behavior.
//
// For now, this only includes values matched in all host platforms officially
// supported by QEMU (i.e, Linux, macOS, FreeBSD, NetBSD, OpenBSD, Windows).
// https://github.com/qemu/qemu/blob/v10.2.0/docs/about/build-platforms.rst
// TODO(sys): should we expose this as public API of `sys` module?
use c_int;
pub const EPERM: c_int = 1;
pub const ENOENT: c_int = 2;
pub const ESRCH: c_int = 3;
pub const EINTR: c_int = 4;
pub const EIO: c_int = 5;
pub const ENXIO: c_int = 6;
pub const E2BIG: c_int = 7;
pub const ENOEXEC: c_int = 8;
pub const EBADF: c_int = 9;
pub const ECHILD: c_int = 10;
// pub(crate) const EAGAIN: c_int = 11; // linux, solarish, windows
// pub(crate) const EWOULDBLOCK: c_int = EAGAIN; // linux, solarish
// pub(crate) const EDEADLK: c_int = 11; // bsd-like
pub const ENOMEM: c_int = 12;
pub const EACCES: c_int = 13;
pub const EFAULT: c_int = 14;
// pub(crate) const ENOTBLK: c_int = 15; // linux, solarish, bsd-like
pub const EBUSY: c_int = 16;
pub const EEXIST: c_int = 17;
pub const EXDEV: c_int = 18;
pub const ENODEV: c_int = 19;
pub const ENOTDIR: c_int = 20;
pub const EISDIR: c_int = 21;
pub const EINVAL: c_int = 22;
pub const ENFILE: c_int = 23;
pub const EMFILE: c_int = 24;
pub const ENOTTY: c_int = 25;
// pub(crate) const ETXTBSY: c_int = 26; // linux, solarish, bsd-like
pub const EFBIG: c_int = 27;
pub const ENOSPC: c_int = 28;
pub const ESPIPE: c_int = 29;
pub const EROFS: c_int = 30;
pub const EMLINK: c_int = 31;
pub const EPIPE: c_int = 32;
pub const EDOM: c_int = 33;
pub const ERANGE: c_int = 34;
// pub(crate) const EAGAIN: c_int = 35; // bsd-like
// pub(crate) const EWOULDBLOCK: c_int = EAGAIN; // bsd-like
// pub(crate) const EDEADLK: c_int = 36; // windows
// pub(crate) const EDEADLOCK: c_int = EDEADLK; // windows
// pub(crate) const ETXTBSY: c_int = 139; // windows
// pub(crate) const EWOULDBLOCK: c_int = 140; // windows