sel4_newlib/
errno.rs

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
//
// Copyright 2023, Colias Group, LLC
//
// SPDX-License-Identifier: BSD-2-Clause
//

use core::ffi::c_int;

#[cfg(feature = "errno")]
#[no_mangle]
static mut errno: c_int = 0;

#[cfg(not(feature = "errno"))]
extern "C" {
    static mut errno: c_int;
}

pub(crate) fn set_errno(err: c_int) {
    unsafe {
        errno = err;
    }
}

#[allow(dead_code)]
pub(crate) mod values {
    use super::*;

    pub(crate) const ENOENT: c_int = 2;
    pub(crate) const ENOMEM: c_int = 12;
}