Skip to content

Commit a49950c

Browse files
authored
Auto merge of rust-lang#395 - lemonrock:windows_posix_errors, r=alexcrichton
Adding POSIX 'E' error code constants for Windows Believe it or not, Windows actually defines a few POSIX 'E' error codes (eg EINVAL). By adding them to libc, the Windows bindings for things like `read()` become useful.
2 parents 36bec35 + 3784990 commit a49950c

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

src/windows.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,47 @@ pub const LC_MONETARY: ::c_int = 3;
105105
pub const LC_NUMERIC: ::c_int = 4;
106106
pub const LC_TIME: ::c_int = 5;
107107

108+
pub const EPERM: ::c_int = 1;
109+
pub const ENOENT: ::c_int = 2;
110+
pub const ESRCH: ::c_int = 3;
111+
pub const EINTR: ::c_int = 4;
112+
pub const EIO: ::c_int = 5;
113+
pub const ENXIO: ::c_int = 6;
114+
pub const E2BIG: ::c_int = 7;
115+
pub const ENOEXEC: ::c_int = 8;
116+
pub const EBADF: ::c_int = 9;
117+
pub const ECHILD: ::c_int = 10;
118+
pub const EAGAIN: ::c_int = 11;
119+
pub const ENOMEM: ::c_int = 12;
120+
pub const EACCES: ::c_int = 13;
121+
pub const EFAULT: ::c_int = 14;
122+
pub const EBUSY: ::c_int = 16;
123+
pub const EEXIST: ::c_int = 17;
124+
pub const EXDEV: ::c_int = 18;
125+
pub const ENODEV: ::c_int = 19;
126+
pub const ENOTDIR: ::c_int = 20;
127+
pub const EISDIR: ::c_int = 21;
128+
pub const EINVAL: ::c_int = 22;
129+
pub const ENFILE: ::c_int = 23;
130+
pub const EMFILE: ::c_int = 24;
131+
pub const ENOTTY: ::c_int = 25;
132+
pub const EFBIG: ::c_int = 27;
133+
pub const ENOSPC: ::c_int = 28;
134+
pub const ESPIPE: ::c_int = 29;
135+
pub const EROFS: ::c_int = 30;
136+
pub const EMLINK: ::c_int = 31;
137+
pub const EPIPE: ::c_int = 32;
138+
pub const EDOM: ::c_int = 33;
139+
pub const ERANGE: ::c_int = 34;
140+
pub const EDEADLK: ::c_int = 36;
141+
pub const EDEADLOCK: ::c_int = 36;
142+
pub const ENAMETOOLONG: ::c_int = 38;
143+
pub const ENOLCK: ::c_int = 39;
144+
pub const ENOSYS: ::c_int = 40;
145+
pub const ENOTEMPTY: ::c_int = 41;
146+
pub const EILSEQ: ::c_int = 42;
147+
pub const STRUNCATE: ::c_int = 80;
148+
108149
#[cfg(target_env = "msvc")] // " if " -- appease style checker
109150
#[link(name = "msvcrt")]
110151
extern {}

0 commit comments

Comments
 (0)