Skip to content

Commit 95af0c8

Browse files
author
Al Hoang
committed
haiku: enable socket
1 parent a723b1d commit 95af0c8

File tree

5 files changed

+21
-8
lines changed

5 files changed

+21
-8
lines changed

src/sys/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ feature! {
126126
pub mod signalfd;
127127
}
128128

129-
#[cfg(not(any(target_os = "redox", target_os = "haiku")))]
129+
#[cfg(not(any(target_os = "redox")))]
130130
feature! {
131131
#![feature = "socket"]
132132
#[allow(missing_docs)]

src/sys/socket/addr.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use crate::sys::socket::addr::sys_control::SysControlAddr;
2626
target_os = "illumos",
2727
target_os = "netbsd",
2828
target_os = "openbsd",
29+
target_os = "haiku",
2930
target_os = "fuchsia"))]
3031
#[cfg(feature = "net")]
3132
pub use self::datalink::LinkAddr;
@@ -120,6 +121,7 @@ pub enum AddressFamily {
120121
#[cfg_attr(docsrs, doc(cfg(all())))]
121122
Rose = libc::AF_ROSE,
122123
/// DECet protocol sockets.
124+
#[cfg(not(any(target_os = "haiku")))]
123125
Decnet = libc::AF_DECnet,
124126
/// Reserved for "802.2LLC project"; never used.
125127
#[cfg(any(target_os = "android", target_os = "linux"))]
@@ -151,6 +153,7 @@ pub enum AddressFamily {
151153
#[cfg_attr(docsrs, doc(cfg(all())))]
152154
Rds = libc::AF_RDS,
153155
/// IBM SNA
156+
#[cfg(not(any(target_os = "haiku")))]
154157
Sna = libc::AF_SNA,
155158
/// Socket interface over IrDA
156159
#[cfg(any(target_os = "android", target_os = "linux"))]
@@ -202,7 +205,7 @@ pub enum AddressFamily {
202205
#[cfg_attr(docsrs, doc(cfg(all())))]
203206
RxRpc = libc::AF_RXRPC,
204207
/// New "modular ISDN" driver interface protocol
205-
#[cfg(not(any(target_os = "illumos", target_os = "solaris")))]
208+
#[cfg(not(any(target_os = "illumos", target_os = "solaris", target_os = "haiku")))]
206209
#[cfg_attr(docsrs, doc(cfg(all())))]
207210
Isdn = libc::AF_ISDN,
208211
/// Nokia cellular modem IPC/RPC interface
@@ -1158,6 +1161,7 @@ impl SockaddrIn {
11581161
target_os = "ios",
11591162
target_os = "macos",
11601163
target_os = "netbsd",
1164+
target_os = "haiku",
11611165
target_os = "openbsd"))]
11621166
sin_len: Self::size() as u8,
11631167
sin_family: AddressFamily::Inet as sa_family_t,
@@ -1420,6 +1424,7 @@ impl SockaddrLike for SockaddrStorage {
14201424
target_os = "macos",
14211425
target_os = "illumos",
14221426
target_os = "netbsd",
1427+
target_os = "haiku",
14231428
target_os = "openbsd"))]
14241429
#[cfg(feature = "net")]
14251430
libc::AF_LINK => LinkAddr::from_raw(addr, l)
@@ -1504,6 +1509,7 @@ impl SockaddrStorage {
15041509
as_sockaddr_in, as_sockaddr_in_mut, SockaddrIn,
15051510
AddressFamily::Inet, libc::sockaddr_in, sin}
15061511

1512+
#[cfg(not(any(target_os = "haiku")))]
15071513
#[cfg(feature = "net")]
15081514
accessors!{
15091515
as_sockaddr_in6, as_sockaddr_in6_mut, SockaddrIn6,
@@ -2389,6 +2395,7 @@ mod datalink {
23892395
target_os = "macos",
23902396
target_os = "illumos",
23912397
target_os = "netbsd",
2398+
target_os = "haiku",
23922399
target_os = "openbsd"))]
23932400
#[cfg_attr(docsrs, doc(cfg(all())))]
23942401
mod datalink {
@@ -2403,11 +2410,13 @@ mod datalink {
24032410

24042411
impl LinkAddr {
24052412
/// interface index, if != 0, system given index for interface
2413+
#[cfg(not(any(target_os = "haiku")))]
24062414
pub fn ifindex(&self) -> usize {
24072415
self.0.sdl_index as usize
24082416
}
24092417

24102418
/// Datalink type
2419+
#[cfg(not(any(target_os = "haiku")))]
24112420
pub fn datalink_type(&self) -> u8 {
24122421
self.0.sdl_type
24132422
}
@@ -2423,6 +2432,7 @@ mod datalink {
24232432
}
24242433

24252434
/// link layer selector length
2435+
#[cfg(not(any(target_os = "haiku")))]
24262436
pub fn slen(&self) -> usize {
24272437
self.0.sdl_slen as usize
24282438
}
@@ -2715,7 +2725,8 @@ mod tests {
27152725
target_os = "macos",
27162726
target_os = "netbsd",
27172727
target_os = "illumos",
2718-
target_os = "openbsd"))]
2728+
target_os = "openbsd",
2729+
target_os = "haiku"))]
27192730
let l = mem::size_of::<libc::sockaddr_dl>();
27202731
#[cfg(any(
27212732
target_os = "android",

src/sys/socket/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub use self::addr::{
5757
UnixAddr,
5858
};
5959
#[allow(deprecated)]
60-
#[cfg(any(target_os = "illumos", target_os = "solaris"))]
60+
#[cfg(any(target_os = "illumos", target_os = "solaris", target_os = "haiku"))]
6161
#[cfg(feature = "net")]
6262
pub use self::addr::{
6363
InetAddr,
@@ -118,6 +118,7 @@ pub enum SockType {
118118
Raw = libc::SOCK_RAW,
119119
/// Provides a reliable datagram layer that does not
120120
/// guarantee ordering.
121+
#[cfg(not(any(target_os = "haiku")))]
121122
Rdm = libc::SOCK_RDM,
122123
}
123124

@@ -328,7 +329,6 @@ libc_bitflags!{
328329
#[cfg(any(target_os = "android",
329330
target_os = "dragonfly",
330331
target_os = "freebsd",
331-
target_os = "haiku",
332332
target_os = "linux",
333333
target_os = "netbsd",
334334
target_os = "openbsd"))]
@@ -846,6 +846,7 @@ impl ControlMessageOwned {
846846
let cred: libc::cmsgcred = ptr::read_unaligned(p as *const _);
847847
ControlMessageOwned::ScmCreds(cred.into())
848848
}
849+
#[cfg(not(any(target_os = "haiku")))]
849850
(libc::SOL_SOCKET, libc::SCM_TIMESTAMP) => {
850851
let tv: libc::timeval = ptr::read_unaligned(p as *const _);
851852
ControlMessageOwned::ScmTimestamp(TimeVal::from(tv))

src/sys/socket/sockopt.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ cfg_if! {
396396
TcpMaxSeg, GetOnly, libc::IPPROTO_TCP, libc::TCP_MAXSEG, u32);
397397
}
398398
}
399-
#[cfg(not(target_os = "openbsd"))]
399+
#[cfg(not(any(target_os = "openbsd", target_os = "haiku")))]
400400
#[cfg(feature = "net")]
401401
sockopt_impl!(
402402
#[cfg_attr(docsrs, doc(cfg(feature = "net")))]
@@ -410,7 +410,7 @@ sockopt_impl!(
410410
#[allow(missing_docs)]
411411
// Not documented by Linux!
412412
TcpRepair, Both, libc::IPPROTO_TCP, libc::TCP_REPAIR, u32);
413-
#[cfg(not(target_os = "openbsd"))]
413+
#[cfg(not(any(target_os = "openbsd", target_os = "haiku")))]
414414
#[cfg(feature = "net")]
415415
sockopt_impl!(
416416
#[cfg_attr(docsrs, doc(cfg(feature = "net")))]
@@ -470,6 +470,7 @@ sockopt_impl!(
470470
/// Specifies exact type of timestamping information collected by the kernel
471471
/// [Further reading](https://www.kernel.org/doc/html/latest/networking/timestamping.html)
472472
Timestamping, Both, libc::SOL_SOCKET, libc::SO_TIMESTAMPING, super::TimestampingFlag);
473+
#[cfg(not(any(target_os = "haiku")))]
473474
sockopt_impl!(
474475
/// Enable or disable the receiving of the `SO_TIMESTAMP` control message.
475476
ReceiveTimestamp, Both, libc::SOL_SOCKET, libc::SO_TIMESTAMP, bool);

test/sys/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mod test_mman;
1717
mod test_signalfd;
1818
#[cfg(not(any(target_os = "redox", target_os = "haiku")))]
1919
mod test_socket;
20-
#[cfg(not(any(target_os = "redox", target_os = "haiku")))]
20+
#[cfg(not(any(target_os = "redox")))]
2121
mod test_sockopt;
2222
#[cfg(not(target_os = "redox"))]
2323
mod test_select;

0 commit comments

Comments
 (0)