Skip to content

Commit 864b625

Browse files
committed
Auto merge of #106673 - flba-eb:add_qnx_nto_stdlib, r=workingjubilee
Add support for QNX Neutrino to standard library This change: - adds standard library support for QNX Neutrino (7.1). - upgrades `libc` to version `0.2.139` which supports QNX Neutrino `@gh-tr` ⚠️ Backtraces on QNX require rust-lang/backtrace-rs#507 which is not yet merged! (But everything else works without these changes) ⚠️ Tested mainly with a x86_64 virtual machine (see qnx-nto.md) and partially with an aarch64 hardware (some tests fail due to constrained resources).
2 parents 0b4ba4c + a510715 commit 864b625

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+603
-81
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2319,9 +2319,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
23192319

23202320
[[package]]
23212321
name = "libc"
2322-
version = "0.2.138"
2322+
version = "0.2.139"
23232323
source = "registry+https://github.com/rust-lang/crates.io-index"
2324-
checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8"
2324+
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
23252325
dependencies = [
23262326
"rustc-std-workspace-core",
23272327
]

library/core/src/ffi/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ mod c_char_definition {
144144
)
145145
),
146146
all(target_os = "fuchsia", target_arch = "aarch64"),
147+
all(target_os = "nto", target_arch = "aarch64"),
147148
target_os = "horizon"
148149
))] {
149150
pub type c_char = u8;

library/std/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
1515
panic_unwind = { path = "../panic_unwind", optional = true }
1616
panic_abort = { path = "../panic_abort" }
1717
core = { path = "../core" }
18-
libc = { version = "0.2.138", default-features = false, features = ['rustc-dep-of-std'] }
18+
libc = { version = "0.2.139", default-features = false, features = ['rustc-dep-of-std'] }
1919
compiler_builtins = { version = "0.1.87" }
2020
profiler_builtins = { path = "../profiler_builtins", optional = true }
2121
unwind = { path = "../unwind" }

library/std/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ fn main() {
3131
|| target.contains("espidf")
3232
|| target.contains("solid")
3333
|| target.contains("nintendo-3ds")
34+
|| target.contains("nto")
3435
{
3536
// These platforms don't have any special requirements.
3637
} else {

library/std/src/net/tcp/tests.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,10 @@ fn debug() {
670670
// FIXME: re-enabled openbsd tests once their socket timeout code
671671
// no longer has rounding errors.
672672
// VxWorks ignores SO_SNDTIMEO.
673-
#[cfg_attr(any(target_os = "netbsd", target_os = "openbsd", target_os = "vxworks"), ignore)]
673+
#[cfg_attr(
674+
any(target_os = "netbsd", target_os = "openbsd", target_os = "vxworks", target_os = "nto"),
675+
ignore
676+
)]
674677
#[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
675678
#[test]
676679
fn timeouts() {

library/std/src/net/udp/tests.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,10 @@ fn debug() {
180180
// FIXME: re-enabled openbsd/netbsd tests once their socket timeout code
181181
// no longer has rounding errors.
182182
// VxWorks ignores SO_SNDTIMEO.
183-
#[cfg_attr(any(target_os = "netbsd", target_os = "openbsd", target_os = "vxworks"), ignore)]
183+
#[cfg_attr(
184+
any(target_os = "netbsd", target_os = "openbsd", target_os = "vxworks", target_os = "nto"),
185+
ignore
186+
)]
184187
#[test]
185188
fn timeouts() {
186189
let addr = next_test_ip4();

library/std/src/os/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ pub mod l4re;
127127
pub mod macos;
128128
#[cfg(target_os = "netbsd")]
129129
pub mod netbsd;
130+
#[cfg(target_os = "nto")]
131+
pub mod nto;
130132
#[cfg(target_os = "openbsd")]
131133
pub mod openbsd;
132134
#[cfg(target_os = "redox")]

library/std/src/os/nto/fs.rs

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#![stable(feature = "metadata_ext", since = "1.1.0")]
2+
3+
use crate::fs::Metadata;
4+
use crate::sys_common::AsInner;
5+
6+
#[stable(feature = "metadata_ext", since = "1.1.0")]
7+
pub trait MetadataExt {
8+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
9+
fn st_dev(&self) -> u64;
10+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
11+
fn st_ino(&self) -> u64;
12+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
13+
fn st_mode(&self) -> u32;
14+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
15+
fn st_nlink(&self) -> u64;
16+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
17+
fn st_uid(&self) -> u32;
18+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
19+
fn st_gid(&self) -> u32;
20+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
21+
fn st_rdev(&self) -> u64;
22+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
23+
fn st_size(&self) -> u64;
24+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
25+
fn st_atime(&self) -> i64;
26+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
27+
fn st_atime_nsec(&self) -> i64;
28+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
29+
fn st_mtime(&self) -> i64;
30+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
31+
fn st_mtime_nsec(&self) -> i64;
32+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
33+
fn st_ctime(&self) -> i64;
34+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
35+
fn st_ctime_nsec(&self) -> i64;
36+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
37+
fn st_blksize(&self) -> u64;
38+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
39+
fn st_blocks(&self) -> u64;
40+
}
41+
42+
#[stable(feature = "metadata_ext", since = "1.1.0")]
43+
impl MetadataExt for Metadata {
44+
fn st_dev(&self) -> u64 {
45+
self.as_inner().as_inner().st_dev as u64
46+
}
47+
fn st_ino(&self) -> u64 {
48+
self.as_inner().as_inner().st_ino as u64
49+
}
50+
fn st_mode(&self) -> u32 {
51+
self.as_inner().as_inner().st_mode as u32
52+
}
53+
fn st_nlink(&self) -> u64 {
54+
self.as_inner().as_inner().st_nlink as u64
55+
}
56+
fn st_uid(&self) -> u32 {
57+
self.as_inner().as_inner().st_uid as u32
58+
}
59+
fn st_gid(&self) -> u32 {
60+
self.as_inner().as_inner().st_gid as u32
61+
}
62+
fn st_rdev(&self) -> u64 {
63+
self.as_inner().as_inner().st_rdev as u64
64+
}
65+
fn st_size(&self) -> u64 {
66+
self.as_inner().as_inner().st_size as u64
67+
}
68+
fn st_atime(&self) -> i64 {
69+
self.as_inner().as_inner().st_atim.tv_sec as i64
70+
}
71+
fn st_atime_nsec(&self) -> i64 {
72+
self.as_inner().as_inner().st_atim.tv_nsec as i64
73+
}
74+
fn st_mtime(&self) -> i64 {
75+
self.as_inner().as_inner().st_mtim.tv_sec as i64
76+
}
77+
fn st_mtime_nsec(&self) -> i64 {
78+
self.as_inner().as_inner().st_mtim.tv_nsec as i64
79+
}
80+
fn st_ctime(&self) -> i64 {
81+
self.as_inner().as_inner().st_ctim.tv_sec as i64
82+
}
83+
fn st_ctime_nsec(&self) -> i64 {
84+
self.as_inner().as_inner().st_ctim.tv_nsec as i64
85+
}
86+
fn st_blksize(&self) -> u64 {
87+
self.as_inner().as_inner().st_blksize as u64
88+
}
89+
fn st_blocks(&self) -> u64 {
90+
self.as_inner().as_inner().st_blocks as u64
91+
}
92+
}

library/std/src/os/nto/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#![stable(feature = "raw_ext", since = "1.1.0")]
2+
3+
pub mod fs;
4+
pub(super) mod raw;

library/std/src/os/nto/raw.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#![stable(feature = "raw_ext", since = "1.1.0")]
2+
#![deprecated(
3+
since = "1.8.0",
4+
note = "these type aliases are no longer supported by \
5+
the standard library, the `libc` crate on \
6+
crates.io should be used instead for the correct \
7+
definitions"
8+
)]
9+
#![allow(deprecated)]
10+
11+
use crate::os::raw::c_int;
12+
13+
#[stable(feature = "raw_ext", since = "1.1.0")]
14+
pub type dev_t = u32;
15+
#[stable(feature = "raw_ext", since = "1.1.0")]
16+
pub type mode_t = u32;
17+
18+
#[stable(feature = "pthread_t", since = "1.8.0")]
19+
pub type pthread_t = c_int;
20+
21+
#[doc(inline)]
22+
#[stable(feature = "raw_ext", since = "1.1.0")]
23+
pub use self::arch::{blkcnt_t, blksize_t, ino_t, nlink_t, off_t, time_t};
24+
25+
mod arch {
26+
use crate::os::raw::c_long;
27+
28+
#[stable(feature = "raw_ext", since = "1.1.0")]
29+
pub type blkcnt_t = i64;
30+
#[stable(feature = "raw_ext", since = "1.1.0")]
31+
pub type blksize_t = i32;
32+
#[stable(feature = "raw_ext", since = "1.1.0")]
33+
pub type ino_t = u64;
34+
#[stable(feature = "raw_ext", since = "1.1.0")]
35+
pub type nlink_t = u32;
36+
#[stable(feature = "raw_ext", since = "1.1.0")]
37+
pub type off_t = i64;
38+
#[stable(feature = "raw_ext", since = "1.1.0")]
39+
pub type time_t = c_long;
40+
}

0 commit comments

Comments
 (0)