1#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd"))]
9pub const EAGAIN: i32 = -35;
10#[cfg(not(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd")))]
11pub const EAGAIN: i32 = -11;
12
13pub const EOF: i32 = -541_478_725; pub const ENOMEM: i32 = -12;
18
19pub const EINVAL: i32 = -22;
21
22pub const BSF_NOT_FOUND: i32 = -1_179_861_752;
28
29#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd"))]
42pub const ETIMEDOUT: i32 = -60;
43#[cfg(windows)]
44pub const ETIMEDOUT: i32 = -138; #[cfg(not(any(
46 windows,
47 target_os = "macos",
48 target_os = "freebsd",
49 target_os = "openbsd"
50)))]
51pub const ETIMEDOUT: i32 = -110;
52
53#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd"))]
55pub const ECONNREFUSED: i32 = -61;
56#[cfg(windows)]
57pub const ECONNREFUSED: i32 = -107; #[cfg(not(any(
59 windows,
60 target_os = "macos",
61 target_os = "freebsd",
62 target_os = "openbsd"
63)))]
64pub const ECONNREFUSED: i32 = -111;
65
66#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd"))]
68pub const EHOSTUNREACH: i32 = -65;
69#[cfg(windows)]
70pub const EHOSTUNREACH: i32 = -110; #[cfg(not(any(
72 windows,
73 target_os = "macos",
74 target_os = "freebsd",
75 target_os = "openbsd"
76)))]
77pub const EHOSTUNREACH: i32 = -113;
78
79#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd"))]
81pub const ENETUNREACH: i32 = -51;
82#[cfg(windows)]
83pub const ENETUNREACH: i32 = -118; #[cfg(not(any(
85 windows,
86 target_os = "macos",
87 target_os = "freebsd",
88 target_os = "openbsd"
89)))]
90pub const ENETUNREACH: i32 = -101;
91
92pub const EIO: i32 = -5;
94
95pub const AVERROR_INVALIDDATA: i32 = -1_447_971_320;
100
101#[cfg(test)]
102mod tests {
103 use super::*;
104
105 #[test]
106 fn error_codes_should_all_be_negative() {
107 assert!(EAGAIN < 0);
108 assert!(EOF < 0);
109 assert!(ENOMEM < 0);
110 assert!(EINVAL < 0);
111 }
112
113 #[test]
114 fn averror_invaliddata_should_be_negative_and_distinct_from_einval() {
115 assert!(AVERROR_INVALIDDATA < 0);
116 assert_ne!(AVERROR_INVALIDDATA, EINVAL);
117 }
118
119 #[test]
120 fn averror_invaliddata_should_have_expected_value() {
121 assert_eq!(AVERROR_INVALIDDATA, -1_447_971_320);
123 }
124}