diff --git a/changelog/2537.added.md b/changelog/2537.added.md index e6eac2b197..110b82ab34 100644 --- a/changelog/2537.added.md +++ b/changelog/2537.added.md @@ -1 +1 @@ -Add support for `syslog`, `openlog`, `closelog` on `macos`. +Add support for `syslog`, `openlog`, `closelog` on all `unix`. diff --git a/src/lib.rs b/src/lib.rs index 42a4aae34a..bd8e552f61 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -202,7 +202,6 @@ feature! { pub mod spawn; } -#[cfg(unix)] feature! { #![feature = "syslog"] pub mod syslog; diff --git a/src/syslog.rs b/src/syslog.rs index 0c09730645..cdb2c3ce3d 100644 --- a/src/syslog.rs +++ b/src/syslog.rs @@ -40,7 +40,12 @@ where /// ```rust /// use nix::syslog::{openlog, syslog, Facility, LogFlags, Severity}; /// -/// openlog(None::<&str>, LogFlags::LOG_PID, Facility::LOG_USER).unwrap(); +/// #[cfg(not(target_os = "haiku"))] +/// let flags = LogFlags::LOG_PID; +/// #[cfg(target_os = "haiku")] +/// let flags = LogFlags::empty(); +/// +/// openlog(None::<&str>, flags, Facility::LOG_USER).unwrap(); /// syslog(Severity::LOG_EMERG, "Hello, nix!").unwrap(); /// /// // use `format!` to format the message diff --git a/test/test.rs b/test/test.rs index 7947c5795a..3ca7c0a755 100644 --- a/test/test.rs +++ b/test/test.rs @@ -42,7 +42,6 @@ mod test_sendfile; ))] mod test_spawn; -#[cfg(unix)] mod test_syslog; mod test_time; diff --git a/test/test_syslog.rs b/test/test_syslog.rs index ad83b1e5a9..d0f6e780d9 100644 --- a/test/test_syslog.rs +++ b/test/test_syslog.rs @@ -2,7 +2,12 @@ use nix::syslog::{openlog, syslog, Facility, LogFlags, Severity}; #[test] fn test_syslog_hello_world() { - openlog(None::<&str>, LogFlags::LOG_PID, Facility::LOG_USER).unwrap(); + #[cfg(not(target_os = "haiku"))] + let flags = LogFlags::LOG_PID; + #[cfg(target_os = "haiku")] + let flags = LogFlags::empty(); + + openlog(None::<&str>, flags, Facility::LOG_USER).unwrap(); syslog(Severity::LOG_EMERG, "Hello, nix!").unwrap(); let name = "syslog";