xref: /aosp_15_r20/external/crosvm/base/src/sys/unix/mod.rs (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1 // Copyright 2023 The ChromiumOS Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 pub mod descriptor;
6 pub mod file_traits;
7 #[macro_use]
8 pub mod handle_eintr;
9 mod fcntl;
10 mod file_flags;
11 mod iobuf;
12 pub mod net;
13 mod sock_ctrl_msg;
14 mod stream_channel;
15 pub mod system_info;
16 mod time;
17 pub mod tube;
18 
19 pub use descriptor::*;
20 pub use fcntl::*;
21 pub use file_flags::*;
22 pub use iobuf::IoBuf;
23 pub use sock_ctrl_msg::*;
24 pub use stream_channel::*;
25 pub use system_info::iov_max;
26 pub use system_info::number_of_logical_cores;
27 pub use system_info::pagesize;
28 pub use time::duration_to_timespec;
29 
30 /// Process identifier.
31 pub type Pid = libc::pid_t;
32 
33 #[macro_export]
34 macro_rules! syscall {
35     ($e:expr) => {{
36         let res = $e;
37         if res < 0 {
38             $crate::errno_result()
39         } else {
40             Ok(res)
41         }
42     }};
43 }
44