Skip to content

Commit 67d5bd5

Browse files
author
Al Hoang
committed
haiku: enable socket
1 parent 64204ef commit 67d5bd5

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,
@@ -1442,6 +1446,7 @@ impl SockaddrLike for SockaddrStorage {
14421446
target_os = "macos",
14431447
target_os = "illumos",
14441448
target_os = "netbsd",
1449+
target_os = "haiku",
14451450
target_os = "openbsd"))]
14461451
#[cfg(feature = "net")]
14471452
libc::AF_LINK => LinkAddr::from_raw(addr, l)
@@ -1526,6 +1531,7 @@ impl SockaddrStorage {
15261531
as_sockaddr_in, as_sockaddr_in_mut, SockaddrIn,
15271532
AddressFamily::Inet, libc::sockaddr_in, sin}
15281533

1534+
#[cfg(not(any(target_os = "haiku")))]
15291535
#[cfg(feature = "net")]
15301536
accessors!{
15311537
as_sockaddr_in6, as_sockaddr_in6_mut, SockaddrIn6,
@@ -2411,6 +2417,7 @@ mod datalink {
24112417
target_os = "macos",
24122418
target_os = "illumos",
24132419
target_os = "netbsd",
2420+
target_os = "haiku",
24142421
target_os = "openbsd"))]
24152422
#[cfg_attr(docsrs, doc(cfg(all())))]
24162423
mod datalink {
@@ -2425,11 +2432,13 @@ mod datalink {
24252432

24262433
impl LinkAddr {
24272434
/// interface index, if != 0, system given index for interface
2435+
#[cfg(not(any(target_os = "haiku")))]
24282436
pub fn ifindex(&self) -> usize {
24292437
self.0.sdl_index as usize
24302438
}
24312439

24322440
/// Datalink type
2441+
#[cfg(not(any(target_os = "haiku")))]
24332442
pub fn datalink_type(&self) -> u8 {
24342443
self.0.sdl_type
24352444
}
@@ -2445,6 +2454,7 @@ mod datalink {
24452454
}
24462455

24472456
/// link layer selector length
2457+
#[cfg(not(any(target_os = "haiku")))]
24482458
pub fn slen(&self) -> usize {
24492459
self.0.sdl_slen as usize
24502460
}
@@ -2737,7 +2747,8 @@ mod tests {
27372747
target_os = "macos",
27382748
target_os = "netbsd",
27392749
target_os = "illumos",
2740-
target_os = "openbsd"))]
2750+
target_os = "openbsd",
2751+
target_os = "haiku"))]
27412752
let l = mem::size_of::<libc::sockaddr_dl>();
27422753
#[cfg(any(
27432754
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)