Skip to content

Commit b1008cb

Browse files
committed
Add support for QNX Neutrino 7.1
1 parent 4ab23c3 commit b1008cb

File tree

17 files changed

+511
-104
lines changed

17 files changed

+511
-104
lines changed

build.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ fn main() {
1414
solaris: { target_os = "solaris" },
1515
watchos: { target_os = "watchos" },
1616
tvos: { target_os = "tvos" },
17+
nto_qnx: { target_os = "nto"},
1718

1819

1920
// cfg aliases we would like to use
2021
apple_targets: { any(ios, macos, watchos, tvos) },
21-
bsd: { any(freebsd, dragonfly, netbsd, openbsd, apple_targets) },
22+
bsd: { any(freebsd, dragonfly, netbsd, openbsd, apple_targets, nto_qnx) },
2223
linux_android: { any(android, linux) },
2324
freebsdlike: { any(dragonfly, freebsd) },
2425
netbsdlike: { any(netbsd, openbsd) },

src/dir.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ impl Entry {
228228
target_os = "emscripten",
229229
target_os = "fuchsia",
230230
target_os = "haiku",
231+
target_os = "nto",
231232
target_os = "hurd",
232233
solarish,
233234
linux_android,
@@ -250,7 +251,7 @@ impl Entry {
250251
/// notably, some Linux filesystems don't implement this. The caller should use `stat` or
251252
/// `fstat` if this returns `None`.
252253
pub fn file_type(&self) -> Option<Type> {
253-
#[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))]
254+
#[cfg(not(any(solarish, target_os = "aix", target_os = "haiku", target_os = "nto",)))]
254255
match self.0.d_type {
255256
libc::DT_FIFO => Some(Type::Fifo),
256257
libc::DT_CHR => Some(Type::CharacterDevice),
@@ -263,7 +264,7 @@ impl Entry {
263264
}
264265

265266
// illumos, Solaris, and Haiku systems do not have the d_type member at all:
266-
#[cfg(any(solarish, target_os = "aix", target_os = "haiku"))]
267+
#[cfg(any(solarish, target_os = "aix", target_os = "haiku", target_os = "nto",))]
267268
None
268269
}
269270
}

src/errno.rs

Lines changed: 231 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ cfg_if! {
4848
unsafe fn errno_location() -> *mut c_int {
4949
unsafe { libc::_Errno() }
5050
}
51+
} else if #[cfg(target_os = "nto")] {
52+
unsafe fn errno_location() -> *mut c_int {
53+
unsafe { libc::__get_errno_ptr() }
54+
}
5155
}
5256
}
5357

@@ -603,10 +607,10 @@ fn desc(errno: Errno) -> &'static str {
603607
#[cfg(freebsdlike)]
604608
EDOOFUS => "Programming error",
605609

606-
#[cfg(any(freebsdlike, target_os = "hurd", target_os = "redox"))]
610+
#[cfg(any(freebsdlike, target_os = "hurd", target_os = "redox", target_os = "nto",))]
607611
EMULTIHOP => "Multihop attempted",
608612

609-
#[cfg(any(freebsdlike, target_os = "hurd", target_os = "redox"))]
613+
#[cfg(any(freebsdlike, target_os = "hurd", target_os = "redox", target_os = "nto",))]
610614
ENOLINK => "Link has been severed",
611615

612616
#[cfg(target_os = "freebsd")]
@@ -615,7 +619,7 @@ fn desc(errno: Errno) -> &'static str {
615619
#[cfg(target_os = "freebsd")]
616620
ECAPMODE => "Not permitted in capability mode",
617621

618-
#[cfg(any(bsd, target_os = "hurd"))]
622+
#[cfg(all(not(target_os = "nto"), any(bsd, target_os = "hurd")))]
619623
ENEEDAUTH => "Need authenticator",
620624

621625
#[cfg(any(bsd, target_os = "redox", solarish))]
@@ -627,17 +631,19 @@ fn desc(errno: Errno) -> &'static str {
627631
target_os = "netbsd",
628632
target_os = "redox",
629633
target_os = "haiku",
634+
target_os = "nto",
630635
target_os = "hurd"
631636
))]
632637
EILSEQ => "Illegal byte sequence",
633638

634-
#[cfg(any(bsd, target_os = "haiku"))]
639+
#[cfg(all(not(target_os = "nto"), any(bsd, target_os = "haiku")))]
635640
ENOATTR => "Attribute not found",
636641

637642
#[cfg(any(
638643
bsd,
639644
target_os = "redox",
640645
target_os = "haiku",
646+
target_os = "nto",
641647
target_os = "hurd"
642648
))]
643649
EBADMSG => "Bad message",
@@ -670,7 +676,7 @@ fn desc(errno: Errno) -> &'static str {
670676
))]
671677
ENOTSUP => "Operation not supported",
672678

673-
#[cfg(any(bsd, target_os = "aix", target_os = "hurd"))]
679+
#[cfg(all(not(target_os = "nto"), any(bsd, target_os = "aix", target_os = "hurd")))]
674680
EPROCLIM => "Too many processes",
675681

676682
#[cfg(any(
@@ -718,10 +724,10 @@ fn desc(errno: Errno) -> &'static str {
718724
#[cfg(any(bsd, target_os = "hurd"))]
719725
EPROCUNAVAIL => "Bad procedure for program",
720726

721-
#[cfg(any(bsd, target_os = "hurd"))]
727+
#[cfg(all(not(target_os = "nto"), any(bsd, target_os = "hurd")))]
722728
EFTYPE => "Inappropriate file type or format",
723729

724-
#[cfg(any(bsd, target_os = "hurd"))]
730+
#[cfg(all(not(target_os = "nto"), any(bsd, target_os = "hurd")))]
725731
EAUTH => "Authentication error",
726732

727733
#[cfg(any(
@@ -757,7 +763,8 @@ fn desc(errno: Errno) -> &'static str {
757763
apple_targets,
758764
target_os = "aix",
759765
target_os = "netbsd",
760-
target_os = "redox"
766+
target_os = "redox",
767+
target_os = "nto",
761768
))]
762769
ENODATA => "No message available on STREAM",
763770

@@ -768,23 +775,26 @@ fn desc(errno: Errno) -> &'static str {
768775
apple_targets,
769776
target_os = "aix",
770777
target_os = "netbsd",
771-
target_os = "redox"
778+
target_os = "redox",
779+
target_os = "nto",
772780
))]
773781
ENOSR => "No STREAM resources",
774782

775783
#[cfg(any(
776784
apple_targets,
777785
target_os = "aix",
778786
target_os = "netbsd",
779-
target_os = "redox"
787+
target_os = "redox",
788+
target_os = "nto",
780789
))]
781790
ENOSTR => "Not a STREAM",
782791

783792
#[cfg(any(
784793
apple_targets,
785794
target_os = "aix",
786795
target_os = "netbsd",
787-
target_os = "redox"
796+
target_os = "redox",
797+
target_os = "nto",
788798
))]
789799
ETIME => "STREAM ioctl timeout",
790800

@@ -797,7 +807,7 @@ fn desc(errno: Errno) -> &'static str {
797807
#[cfg(apple_targets)]
798808
EQFULL => "Interface output queue is full",
799809

800-
#[cfg(any(target_os = "openbsd", target_os = "hurd"))]
810+
#[cfg(any(target_os = "openbsd", target_os = "hurd", target_os = "nto",))]
801811
EOPNOTSUPP => "Operation not supported",
802812

803813
#[cfg(target_os = "openbsd")]
@@ -3334,3 +3344,212 @@ mod consts {
33343344
}
33353345
}
33363346
}
3347+
3348+
#[cfg(target_os = "nto")]
3349+
mod consts {
3350+
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
3351+
#[repr(i32)]
3352+
#[non_exhaustive]
3353+
pub enum Errno {
3354+
UnknownErrno = 0,
3355+
EPERM = libc::EPERM,
3356+
ENOENT = libc::ENOENT,
3357+
ESRCH = libc::ESRCH,
3358+
EINTR = libc::EINTR,
3359+
EIO = libc::EIO,
3360+
ENXIO = libc::ENXIO,
3361+
E2BIG = libc::E2BIG,
3362+
ENOEXEC = libc::ENOEXEC,
3363+
EBADF = libc::EBADF,
3364+
ECHILD = libc::ECHILD,
3365+
EDEADLK = libc::EDEADLK,
3366+
ENOMEM = libc::ENOMEM,
3367+
EACCES = libc::EACCES,
3368+
EFAULT = libc::EFAULT,
3369+
ENOTBLK = libc::ENOTBLK,
3370+
EBUSY = libc::EBUSY,
3371+
EEXIST = libc::EEXIST,
3372+
EXDEV = libc::EXDEV,
3373+
ENODEV = libc::ENODEV,
3374+
ENOTDIR = libc::ENOTDIR,
3375+
EISDIR = libc::EISDIR,
3376+
EINVAL = libc::EINVAL,
3377+
ENFILE = libc::ENFILE,
3378+
EMFILE = libc::EMFILE,
3379+
ENOTTY = libc::ENOTTY,
3380+
ETXTBSY = libc::ETXTBSY,
3381+
EFBIG = libc::EFBIG,
3382+
ENOSPC = libc::ENOSPC,
3383+
ESPIPE = libc::ESPIPE,
3384+
EROFS = libc::EROFS,
3385+
EMLINK = libc::EMLINK,
3386+
EPIPE = libc::EPIPE,
3387+
EDOM = libc::EDOM,
3388+
ERANGE = libc::ERANGE,
3389+
EAGAIN = libc::EAGAIN,
3390+
EINPROGRESS = libc::EINPROGRESS,
3391+
EALREADY = libc::EALREADY,
3392+
ENOTSOCK = libc::ENOTSOCK,
3393+
EDESTADDRREQ = libc::EDESTADDRREQ,
3394+
EMSGSIZE = libc::EMSGSIZE,
3395+
EPROTOTYPE = libc::EPROTOTYPE,
3396+
ENOPROTOOPT = libc::ENOPROTOOPT,
3397+
EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
3398+
ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT,
3399+
EOPNOTSUPP = libc::EOPNOTSUPP,
3400+
EPFNOSUPPORT = libc::EPFNOSUPPORT,
3401+
EAFNOSUPPORT = libc::EAFNOSUPPORT,
3402+
EADDRINUSE = libc::EADDRINUSE,
3403+
EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
3404+
ENETDOWN = libc::ENETDOWN,
3405+
ENETUNREACH = libc::ENETUNREACH,
3406+
ENETRESET = libc::ENETRESET,
3407+
ECONNABORTED = libc::ECONNABORTED,
3408+
ECONNRESET = libc::ECONNRESET,
3409+
ENOBUFS = libc::ENOBUFS,
3410+
EISCONN = libc::EISCONN,
3411+
ENOTCONN = libc::ENOTCONN,
3412+
ESHUTDOWN = libc::ESHUTDOWN,
3413+
ETOOMANYREFS = libc::ETOOMANYREFS,
3414+
ETIMEDOUT = libc::ETIMEDOUT,
3415+
ECONNREFUSED = libc::ECONNREFUSED,
3416+
ELOOP = libc::ELOOP,
3417+
ENAMETOOLONG = libc::ENAMETOOLONG,
3418+
EHOSTDOWN = libc::EHOSTDOWN,
3419+
EHOSTUNREACH = libc::EHOSTUNREACH,
3420+
ENOTEMPTY = libc::ENOTEMPTY,
3421+
EUSERS = libc::EUSERS,
3422+
EDQUOT = libc::EDQUOT,
3423+
ESTALE = libc::ESTALE,
3424+
EREMOTE = libc::EREMOTE,
3425+
EBADRPC = libc::EBADRPC,
3426+
ERPCMISMATCH = libc::ERPCMISMATCH,
3427+
EPROGUNAVAIL = libc::EPROGUNAVAIL,
3428+
EPROGMISMATCH = libc::EPROGMISMATCH,
3429+
EPROCUNAVAIL = libc::EPROCUNAVAIL,
3430+
ENOLCK = libc::ENOLCK,
3431+
ENOSYS = libc::ENOSYS,
3432+
EIDRM = libc::EIDRM,
3433+
ENOMSG = libc::ENOMSG,
3434+
EOVERFLOW = libc::EOVERFLOW,
3435+
EILSEQ = libc::EILSEQ,
3436+
ENOTSUP = libc::ENOTSUP,
3437+
ECANCELED = libc::ECANCELED,
3438+
EBADMSG = libc::EBADMSG,
3439+
ENODATA = libc::ENODATA,
3440+
ENOSR = libc::ENOSR,
3441+
ENOSTR = libc::ENOSTR,
3442+
ETIME = libc::ETIME,
3443+
EMULTIHOP = libc::EMULTIHOP,
3444+
ENOLINK = libc::ENOLINK,
3445+
EPROTO = libc::EPROTO,
3446+
}
3447+
3448+
impl Errno {
3449+
pub const ELAST: Errno = Errno::ENOTSUP;
3450+
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
3451+
}
3452+
3453+
#[deprecated(
3454+
since = "0.28.0",
3455+
note = "please use `Errno::from_raw()` instead"
3456+
)]
3457+
pub const fn from_i32(e: i32) -> Errno {
3458+
use self::Errno::*;
3459+
3460+
match e {
3461+
libc::EPERM => EPERM,
3462+
libc::ENOENT => ENOENT,
3463+
libc::ESRCH => ESRCH,
3464+
libc::EINTR => EINTR,
3465+
libc::EIO => EIO,
3466+
libc::ENXIO => ENXIO,
3467+
libc::E2BIG => E2BIG,
3468+
libc::ENOEXEC => ENOEXEC,
3469+
libc::EBADF => EBADF,
3470+
libc::ECHILD => ECHILD,
3471+
libc::EDEADLK => EDEADLK,
3472+
libc::ENOMEM => ENOMEM,
3473+
libc::EACCES => EACCES,
3474+
libc::EFAULT => EFAULT,
3475+
libc::ENOTBLK => ENOTBLK,
3476+
libc::EBUSY => EBUSY,
3477+
libc::EEXIST => EEXIST,
3478+
libc::EXDEV => EXDEV,
3479+
libc::ENODEV => ENODEV,
3480+
libc::ENOTDIR => ENOTDIR,
3481+
libc::EISDIR => EISDIR,
3482+
libc::EINVAL => EINVAL,
3483+
libc::ENFILE => ENFILE,
3484+
libc::EMFILE => EMFILE,
3485+
libc::ENOTTY => ENOTTY,
3486+
libc::ETXTBSY => ETXTBSY,
3487+
libc::EFBIG => EFBIG,
3488+
libc::ENOSPC => ENOSPC,
3489+
libc::ESPIPE => ESPIPE,
3490+
libc::EROFS => EROFS,
3491+
libc::EMLINK => EMLINK,
3492+
libc::EPIPE => EPIPE,
3493+
libc::EDOM => EDOM,
3494+
libc::ERANGE => ERANGE,
3495+
libc::EAGAIN => EAGAIN,
3496+
libc::EINPROGRESS => EINPROGRESS,
3497+
libc::EALREADY => EALREADY,
3498+
libc::ENOTSOCK => ENOTSOCK,
3499+
libc::EDESTADDRREQ => EDESTADDRREQ,
3500+
libc::EMSGSIZE => EMSGSIZE,
3501+
libc::EPROTOTYPE => EPROTOTYPE,
3502+
libc::ENOPROTOOPT => ENOPROTOOPT,
3503+
libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
3504+
libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT,
3505+
libc::EOPNOTSUPP => EOPNOTSUPP,
3506+
libc::EPFNOSUPPORT => EPFNOSUPPORT,
3507+
libc::EAFNOSUPPORT => EAFNOSUPPORT,
3508+
libc::EADDRINUSE => EADDRINUSE,
3509+
libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
3510+
libc::ENETDOWN => ENETDOWN,
3511+
libc::ENETUNREACH => ENETUNREACH,
3512+
libc::ENETRESET => ENETRESET,
3513+
libc::ECONNABORTED => ECONNABORTED,
3514+
libc::ECONNRESET => ECONNRESET,
3515+
libc::ENOBUFS => ENOBUFS,
3516+
libc::EISCONN => EISCONN,
3517+
libc::ENOTCONN => ENOTCONN,
3518+
libc::ESHUTDOWN => ESHUTDOWN,
3519+
libc::ETOOMANYREFS => ETOOMANYREFS,
3520+
libc::ETIMEDOUT => ETIMEDOUT,
3521+
libc::ECONNREFUSED => ECONNREFUSED,
3522+
libc::ELOOP => ELOOP,
3523+
libc::ENAMETOOLONG => ENAMETOOLONG,
3524+
libc::EHOSTDOWN => EHOSTDOWN,
3525+
libc::EHOSTUNREACH => EHOSTUNREACH,
3526+
libc::ENOTEMPTY => ENOTEMPTY,
3527+
libc::EUSERS => EUSERS,
3528+
libc::EDQUOT => EDQUOT,
3529+
libc::ESTALE => ESTALE,
3530+
libc::EREMOTE => EREMOTE,
3531+
libc::EBADRPC => EBADRPC,
3532+
libc::ERPCMISMATCH => ERPCMISMATCH,
3533+
libc::EPROGUNAVAIL => EPROGUNAVAIL,
3534+
libc::EPROGMISMATCH => EPROGMISMATCH,
3535+
libc::EPROCUNAVAIL => EPROCUNAVAIL,
3536+
libc::ENOLCK => ENOLCK,
3537+
libc::ENOSYS => ENOSYS,
3538+
libc::EIDRM => EIDRM,
3539+
libc::ENOMSG => ENOMSG,
3540+
libc::EOVERFLOW => EOVERFLOW,
3541+
libc::EILSEQ => EILSEQ,
3542+
libc::ENOTSUP => ENOTSUP,
3543+
libc::ECANCELED => ECANCELED,
3544+
libc::EBADMSG => EBADMSG,
3545+
libc::ENODATA => ENODATA,
3546+
libc::ENOSR => ENOSR,
3547+
libc::ENOSTR => ENOSTR,
3548+
libc::ETIME => ETIME,
3549+
libc::EMULTIHOP => EMULTIHOP,
3550+
libc::ENOLINK => ENOLINK,
3551+
libc::EPROTO => EPROTO,
3552+
_ => UnknownErrno,
3553+
}
3554+
}
3555+
}

0 commit comments

Comments
 (0)