iceoryx2_pal_posix/
lib.rs

1// Copyright (c) 2023 Contributors to the Eclipse Foundation
2//
3// See the NOTICE file(s) distributed with this work for additional
4// information regarding copyright ownership.
5//
6// This program and the accompanying materials are made available under the
7// terms of the Apache Software License 2.0 which is available at
8// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
9// which is available at https://opensource.org/licenses/MIT.
10//
11// SPDX-License-Identifier: Apache-2.0 OR MIT
12
13#![cfg_attr(
14    not(any(
15        target_os = "android",
16        target_os = "windows",
17        target_os = "macos",
18        target_os = "freebsd"
19    )),
20    no_std
21)]
22#![allow(clippy::missing_safety_doc)]
23#![warn(clippy::alloc_instead_of_core)]
24#![warn(clippy::std_instead_of_alloc)]
25#![warn(clippy::std_instead_of_core)]
26
27extern crate alloc;
28
29mod common;
30
31#[cfg(platform_override)]
32mod os {
33    #![allow(non_upper_case_globals)]
34    #![allow(non_camel_case_types)]
35    #![allow(non_snake_case)]
36    #![allow(unused)]
37    #![allow(improper_ctypes)]
38    #![allow(unknown_lints)]
39    #![allow(unnecessary_transmutes)]
40    #![allow(clippy::all)]
41    include!(concat!(env!("IOX2_CUSTOM_POSIX_PLATFORM_PATH"), "/os.rs"));
42}
43
44#[cfg(not(platform_override))]
45#[cfg(all(target_os = "linux", feature = "libc_platform"))]
46#[path = "libc/os.rs"]
47mod os;
48
49#[cfg(not(platform_override))]
50#[cfg(target_os = "android")]
51#[path = "android/os.rs"]
52mod os;
53
54#[cfg(not(platform_override))]
55#[cfg(target_os = "freebsd")]
56#[path = "freebsd/os.rs"]
57mod os;
58
59#[cfg(not(platform_override))]
60#[cfg(target_os = "macos")]
61#[path = "macos/os.rs"]
62mod os;
63
64#[cfg(not(platform_override))]
65#[cfg(all(target_os = "linux", not(feature = "libc_platform")))]
66#[path = "linux/os.rs"]
67pub mod os;
68
69#[cfg(not(platform_override))]
70#[cfg(target_os = "nto")]
71#[path = "qnx/os.rs"]
72mod os;
73
74#[cfg(not(platform_override))]
75#[cfg(target_os = "windows")]
76#[path = "windows/os.rs"]
77mod os;
78
79#[cfg(not(platform_override))]
80#[cfg(all(target_os = "none", not(feature = "libc_platform")))]
81#[path = "stub/os.rs"]
82mod os;
83
84#[cfg(all(not(feature = "libc_platform"), not(target_os = "none")))]
85pub(crate) mod internal {
86    #![allow(non_upper_case_globals)]
87    #![allow(non_camel_case_types)]
88    #![allow(non_snake_case)]
89    #![allow(unused)]
90    #![allow(improper_ctypes)]
91    #![allow(unknown_lints)]
92    #![allow(unnecessary_transmutes)]
93    #![allow(clippy::all)]
94    include!(concat!(
95        env!("OUT_DIR"),
96        env!("BAZEL_BINDGEN_PATH_CORRECTION"),
97        "/posix_generated.rs"
98    ));
99
100    pub const ESUCCES: u32 = 0;
101}
102
103#[cfg(feature = "libc_platform")]
104pub(crate) mod internal {
105    pub use libc::*;
106}
107
108pub mod posix {
109    #![allow(dead_code)]
110    use super::*;
111
112    pub use common::cpu_set_t::cpu_set_t;
113    pub use common::mem_zeroed_struct::MemZeroedStruct;
114    pub use common::sockaddr_in::SockAddrIn;
115
116    #[allow(unused_imports)]
117    pub(crate) use common::string_operations::*;
118
119    pub use crate::os::posix::*;
120}