summaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/ioctl/mod.rs2
-rw-r--r--src/sys/mman.rs3
-rw-r--r--src/sys/mod.rs2
-rw-r--r--src/sys/signal.rs50
-rw-r--r--src/sys/socket/addr.rs14
-rw-r--r--src/sys/socket/mod.rs6
-rw-r--r--src/sys/socket/sockopt.rs5
-rw-r--r--src/sys/stat.rs2
-rw-r--r--src/sys/statvfs.rs2
-rw-r--r--src/sys/termios.rs20
-rw-r--r--src/sys/uio.rs4
11 files changed, 90 insertions, 20 deletions
diff --git a/src/sys/ioctl/mod.rs b/src/sys/ioctl/mod.rs
index 203b7d06..ce9c5db0 100644
--- a/src/sys/ioctl/mod.rs
+++ b/src/sys/ioctl/mod.rs
@@ -236,6 +236,7 @@ pub use self::linux::*;
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
+ target_os = "haiku",
target_os = "openbsd"))]
#[macro_use]
mod bsd;
@@ -246,6 +247,7 @@ mod bsd;
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
+ target_os = "haiku",
target_os = "openbsd"))]
pub use self::bsd::*;
diff --git a/src/sys/mman.rs b/src/sys/mman.rs
index a7469a17..700e231c 100644
--- a/src/sys/mman.rs
+++ b/src/sys/mman.rs
@@ -351,6 +351,7 @@ libc_bitflags!{
}
}
+#[cfg(not(target_os = "haiku"))]
libc_bitflags!{
/// Flags for [`mlockall`].
pub struct MlockAllFlags: c_int {
@@ -393,6 +394,7 @@ pub unsafe fn munlock(addr: *const c_void, length: size_t) -> Result<()> {
/// Locked pages never move to the swap area. For more information, see [`mlockall(2)`].
///
/// [`mlockall(2)`]: https://man7.org/linux/man-pages/man2/mlockall.2.html
+#[cfg(not(target_os = "haiku"))]
pub fn mlockall(flags: MlockAllFlags) -> Result<()> {
unsafe { Errno::result(libc::mlockall(flags.bits())) }.map(drop)
}
@@ -402,6 +404,7 @@ pub fn mlockall(flags: MlockAllFlags) -> Result<()> {
/// For more information, see [`munlockall(2)`].
///
/// [`munlockall(2)`]: https://man7.org/linux/man-pages/man2/munlockall.2.html
+#[cfg(not(target_os = "haiku"))]
pub fn munlockall() -> Result<()> {
unsafe { Errno::result(libc::munlockall()) }.map(drop)
}
diff --git a/src/sys/mod.rs b/src/sys/mod.rs
index e5639f20..9f0d037e 100644
--- a/src/sys/mod.rs
+++ b/src/sys/mod.rs
@@ -94,7 +94,7 @@ feature! {
pub mod reboot;
}
-#[cfg(not(any(target_os = "redox", target_os = "fuchsia", target_os = "illumos")))]
+#[cfg(not(any(target_os = "redox", target_os = "fuchsia", target_os = "illumos", target_os = "haiku")))]
feature! {
#![feature = "resource"]
pub mod resource;
diff --git a/src/sys/signal.rs b/src/sys/signal.rs
index f982b4e7..9a4e90e4 100644
--- a/src/sys/signal.rs
+++ b/src/sys/signal.rs
@@ -89,6 +89,8 @@ libc_enum!{
/// Window size changes
SIGWINCH,
/// Input/output possible signal
+ #[cfg(not(target_os = "haiku"))]
+ #[cfg_attr(docsrs, doc(cfg(all())))]
SIGIO,
#[cfg(any(target_os = "android", target_os = "emscripten",
target_os = "fuchsia", target_os = "linux"))]
@@ -99,13 +101,13 @@ libc_enum!{
SIGSYS,
#[cfg(not(any(target_os = "android", target_os = "emscripten",
target_os = "fuchsia", target_os = "linux",
- target_os = "redox")))]
+ target_os = "redox", target_os = "haiku")))]
#[cfg_attr(docsrs, doc(cfg(all())))]
/// Emulator trap
SIGEMT,
#[cfg(not(any(target_os = "android", target_os = "emscripten",
target_os = "fuchsia", target_os = "linux",
- target_os = "redox")))]
+ target_os = "redox", target_os = "haiku")))]
#[cfg_attr(docsrs, doc(cfg(all())))]
/// Information request
SIGINFO,
@@ -150,6 +152,7 @@ impl FromStr for Signal {
"SIGVTALRM" => Signal::SIGVTALRM,
"SIGPROF" => Signal::SIGPROF,
"SIGWINCH" => Signal::SIGWINCH,
+ #[cfg(not(target_os = "haiku"))]
"SIGIO" => Signal::SIGIO,
#[cfg(any(target_os = "android", target_os = "emscripten",
target_os = "fuchsia", target_os = "linux"))]
@@ -157,11 +160,11 @@ impl FromStr for Signal {
"SIGSYS" => Signal::SIGSYS,
#[cfg(not(any(target_os = "android", target_os = "emscripten",
target_os = "fuchsia", target_os = "linux",
- target_os = "redox")))]
+ target_os = "redox", target_os = "haiku")))]
"SIGEMT" => Signal::SIGEMT,
#[cfg(not(any(target_os = "android", target_os = "emscripten",
target_os = "fuchsia", target_os = "linux",
- target_os = "redox")))]
+ target_os = "redox", target_os = "haiku")))]
"SIGINFO" => Signal::SIGINFO,
_ => return Err(Errno::EINVAL),
})
@@ -208,6 +211,7 @@ impl Signal {
Signal::SIGVTALRM => "SIGVTALRM",
Signal::SIGPROF => "SIGPROF",
Signal::SIGWINCH => "SIGWINCH",
+ #[cfg(not(target_os = "haiku"))]
Signal::SIGIO => "SIGIO",
#[cfg(any(target_os = "android", target_os = "emscripten",
target_os = "fuchsia", target_os = "linux"))]
@@ -215,11 +219,11 @@ impl Signal {
Signal::SIGSYS => "SIGSYS",
#[cfg(not(any(target_os = "android", target_os = "emscripten",
target_os = "fuchsia", target_os = "linux",
- target_os = "redox")))]
+ target_os = "redox", target_os = "haiku")))]
Signal::SIGEMT => "SIGEMT",
#[cfg(not(any(target_os = "android", target_os = "emscripten",
target_os = "fuchsia", target_os = "linux",
- target_os = "redox")))]
+ target_os = "redox", target_os = "haiku")))]
Signal::SIGINFO => "SIGINFO",
}
}
@@ -274,6 +278,37 @@ const SIGNALS: [Signal; 29] = [
SIGWINCH,
SIGIO,
SIGSYS];
+#[cfg(target_os = "haiku")]
+#[cfg(feature = "signal")]
+const SIGNALS: [Signal; 28] = [
+ SIGHUP,
+ SIGINT,
+ SIGQUIT,
+ SIGILL,
+ SIGTRAP,
+ SIGABRT,
+ SIGBUS,
+ SIGFPE,
+ SIGKILL,
+ SIGUSR1,
+ SIGSEGV,
+ SIGUSR2,
+ SIGPIPE,
+ SIGALRM,
+ SIGTERM,
+ SIGCHLD,
+ SIGCONT,
+ SIGSTOP,
+ SIGTSTP,
+ SIGTTIN,
+ SIGTTOU,
+ SIGURG,
+ SIGXCPU,
+ SIGXFSZ,
+ SIGVTALRM,
+ SIGPROF,
+ SIGWINCH,
+ SIGSYS];
#[cfg(all(any(target_os = "linux", target_os = "android",
target_os = "emscripten", target_os = "fuchsia"),
not(any(target_arch = "mips", target_arch = "mips64",
@@ -349,7 +384,7 @@ const SIGNALS: [Signal; 30] = [
SIGSYS];
#[cfg(not(any(target_os = "linux", target_os = "android",
target_os = "fuchsia", target_os = "emscripten",
- target_os = "redox")))]
+ target_os = "redox", target_os = "haiku")))]
#[cfg(feature = "signal")]
const SIGNALS: [Signal; 31] = [
SIGHUP,
@@ -417,6 +452,7 @@ impl Signal {
/// Alias for [`SIGABRT`]
pub const SIGIOT : Signal = SIGABRT;
/// Alias for [`SIGIO`]
+#[cfg(not(target_os = "haiku"))]
pub const SIGPOLL : Signal = SIGIO;
/// Alias for [`SIGSYS`]
pub const SIGUNUSED : Signal = SIGSYS;
diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs
index 5cd4678c..6d38f26c 100644
--- a/src/sys/socket/addr.rs
+++ b/src/sys/socket/addr.rs
@@ -26,6 +26,7 @@ use crate::sys::socket::addr::sys_control::SysControlAddr;
target_os = "illumos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "haiku",
target_os = "fuchsia"))]
#[cfg(feature = "net")]
pub use self::datalink::LinkAddr;
@@ -120,6 +121,7 @@ pub enum AddressFamily {
#[cfg_attr(docsrs, doc(cfg(all())))]
Rose = libc::AF_ROSE,
/// DECet protocol sockets.
+ #[cfg(not(target_os = "haiku"))]
Decnet = libc::AF_DECnet,
/// Reserved for "802.2LLC project"; never used.
#[cfg(any(target_os = "android", target_os = "linux"))]
@@ -151,6 +153,7 @@ pub enum AddressFamily {
#[cfg_attr(docsrs, doc(cfg(all())))]
Rds = libc::AF_RDS,
/// IBM SNA
+ #[cfg(not(target_os = "haiku"))]
Sna = libc::AF_SNA,
/// Socket interface over IrDA
#[cfg(any(target_os = "android", target_os = "linux"))]
@@ -202,7 +205,7 @@ pub enum AddressFamily {
#[cfg_attr(docsrs, doc(cfg(all())))]
RxRpc = libc::AF_RXRPC,
/// New "modular ISDN" driver interface protocol
- #[cfg(not(any(target_os = "illumos", target_os = "solaris")))]
+ #[cfg(not(any(target_os = "illumos", target_os = "solaris", target_os = "haiku")))]
#[cfg_attr(docsrs, doc(cfg(all())))]
Isdn = libc::AF_ISDN,
/// Nokia cellular modem IPC/RPC interface
@@ -1158,6 +1161,7 @@ impl SockaddrIn {
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
+ target_os = "haiku",
target_os = "openbsd"))]
sin_len: Self::size() as u8,
sin_family: AddressFamily::Inet as sa_family_t,
@@ -1442,6 +1446,7 @@ impl SockaddrLike for SockaddrStorage {
target_os = "macos",
target_os = "illumos",
target_os = "netbsd",
+ target_os = "haiku",
target_os = "openbsd"))]
#[cfg(feature = "net")]
libc::AF_LINK => LinkAddr::from_raw(addr, l)
@@ -2411,6 +2416,7 @@ mod datalink {
target_os = "macos",
target_os = "illumos",
target_os = "netbsd",
+ target_os = "haiku",
target_os = "openbsd"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
mod datalink {
@@ -2425,11 +2431,13 @@ mod datalink {
impl LinkAddr {
/// interface index, if != 0, system given index for interface
+ #[cfg(not(target_os = "haiku"))]
pub fn ifindex(&self) -> usize {
self.0.sdl_index as usize
}
/// Datalink type
+ #[cfg(not(target_os = "haiku"))]
pub fn datalink_type(&self) -> u8 {
self.0.sdl_type
}
@@ -2445,6 +2453,7 @@ mod datalink {
}
/// link layer selector length
+ #[cfg(not(target_os = "haiku"))]
pub fn slen(&self) -> usize {
self.0.sdl_slen as usize
}
@@ -2737,7 +2746,8 @@ mod tests {
target_os = "macos",
target_os = "netbsd",
target_os = "illumos",
- target_os = "openbsd"))]
+ target_os = "openbsd",
+ target_os = "haiku"))]
let l = mem::size_of::<libc::sockaddr_dl>();
#[cfg(any(
target_os = "android",
diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs
index c6613892..6386e62b 100644
--- a/src/sys/socket/mod.rs
+++ b/src/sys/socket/mod.rs
@@ -38,7 +38,7 @@ pub use self::addr::{
UnixAddr,
};
#[allow(deprecated)]
-#[cfg(not(any(target_os = "illumos", target_os = "solaris")))]
+#[cfg(not(any(target_os = "illumos", target_os = "solaris", target_os = "haiku")))]
#[cfg(feature = "net")]
pub use self::addr::{
InetAddr,
@@ -57,7 +57,7 @@ pub use self::addr::{
UnixAddr,
};
#[allow(deprecated)]
-#[cfg(any(target_os = "illumos", target_os = "solaris"))]
+#[cfg(any(target_os = "illumos", target_os = "solaris", target_os = "haiku"))]
#[cfg(feature = "net")]
pub use self::addr::{
InetAddr,
@@ -118,6 +118,7 @@ pub enum SockType {
Raw = libc::SOCK_RAW,
/// Provides a reliable datagram layer that does not
/// guarantee ordering.
+ #[cfg(not(any(target_os = "haiku")))]
Rdm = libc::SOCK_RDM,
}
@@ -845,6 +846,7 @@ impl ControlMessageOwned {
let cred: libc::cmsgcred = ptr::read_unaligned(p as *const _);
ControlMessageOwned::ScmCreds(cred.into())
}
+ #[cfg(not(target_os = "haiku"))]
(libc::SOL_SOCKET, libc::SCM_TIMESTAMP) => {
let tv: libc::timeval = ptr::read_unaligned(p as *const _);
ControlMessageOwned::ScmTimestamp(TimeVal::from(tv))
diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs
index 14fea808..73d15406 100644
--- a/src/sys/socket/sockopt.rs
+++ b/src/sys/socket/sockopt.rs
@@ -399,7 +399,7 @@ cfg_if! {
TcpMaxSeg, GetOnly, libc::IPPROTO_TCP, libc::TCP_MAXSEG, u32);
}
}
-#[cfg(not(target_os = "openbsd"))]
+#[cfg(not(any(target_os = "openbsd", target_os = "haiku")))]
#[cfg(feature = "net")]
sockopt_impl!(
#[cfg_attr(docsrs, doc(cfg(feature = "net")))]
@@ -413,7 +413,7 @@ sockopt_impl!(
#[allow(missing_docs)]
// Not documented by Linux!
TcpRepair, Both, libc::IPPROTO_TCP, libc::TCP_REPAIR, u32);
-#[cfg(not(target_os = "openbsd"))]
+#[cfg(not(any(target_os = "openbsd", target_os = "haiku")))]
#[cfg(feature = "net")]
sockopt_impl!(
#[cfg_attr(docsrs, doc(cfg(feature = "net")))]
@@ -473,6 +473,7 @@ sockopt_impl!(
/// Specifies exact type of timestamping information collected by the kernel
/// [Further reading](https://www.kernel.org/doc/html/latest/networking/timestamping.html)
Timestamping, Both, libc::SOL_SOCKET, libc::SO_TIMESTAMPING, super::TimestampingFlag);
+#[cfg(not(target_os = "haiku"))]
sockopt_impl!(
/// Enable or disable the receiving of the `SO_TIMESTAMP` control message.
ReceiveTimestamp, Both, libc::SOL_SOCKET, libc::SO_TIMESTAMP, bool);
diff --git a/src/sys/stat.rs b/src/sys/stat.rs
index 67a1b7f7..5cf2deb7 100644
--- a/src/sys/stat.rs
+++ b/src/sys/stat.rs
@@ -53,7 +53,7 @@ pub fn mknod<P: ?Sized + NixPath>(path: &P, kind: SFlag, perm: Mode, dev: dev_t)
}
/// Create a special or ordinary file, relative to a given directory.
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox", target_os = "haiku")))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub fn mknodat<P: ?Sized + NixPath>(
dirfd: RawFd,
diff --git a/src/sys/statvfs.rs b/src/sys/statvfs.rs
index ab54b4b5..38b1fdcc 100644
--- a/src/sys/statvfs.rs
+++ b/src/sys/statvfs.rs
@@ -16,8 +16,10 @@ libc_bitflags!(
#[derive(Default)]
pub struct FsFlags: c_ulong {
/// Read Only
+ #[cfg(not(target_os = "haiku"))]
ST_RDONLY;
/// Do not allow the set-uid bits to have an effect
+ #[cfg(not(target_os = "haiku"))]
ST_NOSUID;
/// Do not interpret character or block-special devices
#[cfg(any(target_os = "android", target_os = "linux"))]
diff --git a/src/sys/termios.rs b/src/sys/termios.rs
index 8870f6be..2e1b53d7 100644
--- a/src/sys/termios.rs
+++ b/src/sys/termios.rs
@@ -255,8 +255,9 @@ libc_enum!{
/// enum.
///
/// B0 is special and will disable the port.
+ #[cfg_attr(all(any(target_os = "haiku"), target_pointer_width = "64"), repr(u8))]
#[cfg_attr(all(any(target_os = "ios", target_os = "macos"), target_pointer_width = "64"), repr(u64))]
- #[cfg_attr(not(all(any(target_os = "ios", target_os = "macos"), target_pointer_width = "64")), repr(u32))]
+ #[cfg_attr(not(all(any(target_os = "ios", target_os = "macos", target_os = "haiku"), target_pointer_width = "64")), repr(u32))]
#[non_exhaustive]
pub enum BaudRate {
B0,
@@ -374,6 +375,14 @@ impl From<BaudRate> for u32 {
}
}
+#[cfg(target_os = "haiku")]
+impl From<BaudRate> for u8 {
+ fn from(b: BaudRate) -> u8 {
+ b as u8
+ }
+}
+
+
// TODO: Add TCSASOFT, which will require treating this as a bitfield.
libc_enum! {
/// Specify when a port configuration change should occur.
@@ -426,6 +435,7 @@ libc_enum! {
}
// TODO: Make this usable directly as a slice index.
+#[cfg(not(target_os = "haiku"))]
libc_enum! {
/// Indices into the `termios.c_cc` array for special characters.
#[repr(usize)]
@@ -524,7 +534,7 @@ libc_bitflags! {
#[cfg(not(target_os = "redox"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
IXANY;
- #[cfg(not(target_os = "redox"))]
+ #[cfg(not(any(target_os = "redox", target_os = "haiku")))]
#[cfg_attr(docsrs, doc(cfg(all())))]
IMAXBEL;
#[cfg(any(target_os = "android", target_os = "linux", target_os = "macos"))]
@@ -851,7 +861,7 @@ libc_bitflags! {
#[cfg_attr(docsrs, doc(cfg(all())))]
ALTWERASE;
IEXTEN;
- #[cfg(not(target_os = "redox"))]
+ #[cfg(not(any(target_os = "redox", target_os = "haiku")))]
#[cfg_attr(docsrs, doc(cfg(all())))]
EXTPROC;
TOSTOP;
@@ -979,6 +989,7 @@ cfg_if!{
///
/// `cfsetspeed()` sets the input and output baud rate in the given `Termios` structure. Note that
/// this is part of the 4.4BSD standard and not part of POSIX.
+ #[cfg(not(target_os = "haiku"))]
pub fn cfsetspeed(termios: &mut Termios, baud: BaudRate) -> Result<()> {
let inner_termios = unsafe { termios.get_libc_termios_mut() };
let res = unsafe { libc::cfsetspeed(inner_termios, baud as libc::speed_t) };
@@ -1095,6 +1106,9 @@ mod test {
#[test]
fn try_from() {
assert_eq!(Ok(BaudRate::B0), BaudRate::try_from(libc::B0));
+ #[cfg(not(target_os = "haiku"))]
assert!(BaudRate::try_from(999999999).is_err());
+ #[cfg(target_os = "haiku")]
+ assert!(BaudRate::try_from(99).is_err());
}
}
diff --git a/src/sys/uio.rs b/src/sys/uio.rs
index ba6c64ef..4b3851f5 100644
--- a/src/sys/uio.rs
+++ b/src/sys/uio.rs
@@ -39,7 +39,7 @@ pub fn readv(fd: RawFd, iov: &mut [IoSliceMut<'_>]) -> Result<usize> {
/// or an error occurs. The file offset is not changed.
///
/// See also: [`writev`](fn.writev.html) and [`pwrite`](fn.pwrite.html)
-#[cfg(not(target_os = "redox"))]
+#[cfg(not(any(target_os = "redox", target_os = "haiku")))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub fn pwritev(fd: RawFd, iov: &[IoSlice<'_>],
offset: off_t) -> Result<usize> {
@@ -62,7 +62,7 @@ pub fn pwritev(fd: RawFd, iov: &[IoSlice<'_>],
/// changed.
///
/// See also: [`readv`](fn.readv.html) and [`pread`](fn.pread.html)
-#[cfg(not(target_os = "redox"))]
+#[cfg(not(any(target_os = "redox", target_os = "haiku")))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub fn preadv(fd: RawFd, iov: &mut [IoSliceMut<'_>],
offset: off_t) -> Result<usize> {