From 5083adeaad7af01b4cbc9244f75690950f7a0c92 Mon Sep 17 00:00:00 2001 From: Umesh Kalappa Date: Wed, 30 Oct 2019 01:38:32 -0700 Subject: Implemented the home_dir for VxWorks --- src/libstd/sys/vxworks/os.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/libstd/sys') diff --git a/src/libstd/sys/vxworks/os.rs b/src/libstd/sys/vxworks/os.rs index f4798da1876..baa6c425d2e 100644 --- a/src/libstd/sys/vxworks/os.rs +++ b/src/libstd/sys/vxworks/os.rs @@ -287,7 +287,8 @@ pub fn temp_dir() -> PathBuf { } pub fn home_dir() -> Option { - None + crate::env::var_os("HOME").or_else(|| None + ).map(PathBuf::from) } pub fn exit(code: i32) -> ! { -- cgit 1.4.1-3-g733a5 From 23d221153f3d453166a765010f0029369e77b508 Mon Sep 17 00:00:00 2001 From: nia Date: Mon, 4 Nov 2019 17:16:11 +0000 Subject: Use KERN_ARND syscall for random numbers on NetBSD, same as FreeBSD. This system call is present on all supported NetBSD versions and provides an endless stream of non-blocking random data from the kernel's ChaCha20-based CSPRNG. It doesn't require a file descriptor to be opened. The system call is documented here (under kern.arandom): https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+7+NetBSD-7.0 And defined here: https://nxr.netbsd.org/xref/src/sys/sys/sysctl.h#273 The semantics are the same as FreeBSD so reading 256 bytes per call is fine. Similar change for getrandom crate: rust-random/getrandom#115 --- src/libstd/sys/unix/rand.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/libstd/sys') diff --git a/src/libstd/sys/unix/rand.rs b/src/libstd/sys/unix/rand.rs index be112f6fc03..decb705a049 100644 --- a/src/libstd/sys/unix/rand.rs +++ b/src/libstd/sys/unix/rand.rs @@ -15,6 +15,7 @@ pub fn hashmap_random_keys() -> (u64, u64) { not(target_os = "ios"), not(target_os = "openbsd"), not(target_os = "freebsd"), + not(target_os = "netbsd"), not(target_os = "fuchsia"), not(target_os = "redox")))] mod imp { @@ -142,7 +143,7 @@ mod imp { } } -#[cfg(target_os = "freebsd")] +#[cfg(target_os = "freebsd", target_os = "netbsd")] mod imp { use crate::ptr; -- cgit 1.4.1-3-g733a5 From b4f92eaea23bee1b8574128878f909b8534b0f3d Mon Sep 17 00:00:00 2001 From: nia Date: Mon, 4 Nov 2019 17:34:29 +0000 Subject: Use any() in code shared between FreeBSD and NetBSD --- src/libstd/sys/unix/rand.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libstd/sys') diff --git a/src/libstd/sys/unix/rand.rs b/src/libstd/sys/unix/rand.rs index decb705a049..bc387544c4c 100644 --- a/src/libstd/sys/unix/rand.rs +++ b/src/libstd/sys/unix/rand.rs @@ -143,7 +143,7 @@ mod imp { } } -#[cfg(target_os = "freebsd", target_os = "netbsd")] +#[cfg(any(target_os = "freebsd", target_os = "netbsd"))] mod imp { use crate::ptr; -- cgit 1.4.1-3-g733a5 From 49e240346fe75eb5380469fb8e901f007fa829c1 Mon Sep 17 00:00:00 2001 From: David Wood Date: Tue, 5 Nov 2019 13:17:05 +0000 Subject: libstd: allow `improper_ctypes` in `sys/sgx` Signed-off-by: David Wood --- src/libstd/sys/sgx/abi/mod.rs | 1 + src/libstd/sys/sgx/rwlock.rs | 3 +++ 2 files changed, 4 insertions(+) (limited to 'src/libstd/sys') diff --git a/src/libstd/sys/sgx/abi/mod.rs b/src/libstd/sys/sgx/abi/mod.rs index 0f107de83f0..3a9b1fc8684 100644 --- a/src/libstd/sys/sgx/abi/mod.rs +++ b/src/libstd/sys/sgx/abi/mod.rs @@ -53,6 +53,7 @@ unsafe extern "C" fn tcs_init(secondary: bool) { // (main function exists). If this is a library, the crate author should be // able to specify this #[cfg(not(test))] +#[allow(improper_ctypes)] #[no_mangle] extern "C" fn entry(p1: u64, p2: u64, p3: u64, secondary: bool, p4: u64, p5: u64) -> (u64, u64) { // FIXME: how to support TLS in library mode? diff --git a/src/libstd/sys/sgx/rwlock.rs b/src/libstd/sys/sgx/rwlock.rs index e2f94b1d928..c32e6dd3786 100644 --- a/src/libstd/sys/sgx/rwlock.rs +++ b/src/libstd/sys/sgx/rwlock.rs @@ -172,6 +172,7 @@ const EINVAL: i32 = 22; #[cfg(not(test))] #[no_mangle] +#[allow(improper_ctypes)] pub unsafe extern "C" fn __rust_rwlock_rdlock(p: *mut RWLock) -> i32 { if p.is_null() { return EINVAL; @@ -181,6 +182,7 @@ pub unsafe extern "C" fn __rust_rwlock_rdlock(p: *mut RWLock) -> i32 { } #[cfg(not(test))] +#[allow(improper_ctypes)] #[no_mangle] pub unsafe extern "C" fn __rust_rwlock_wrlock(p: *mut RWLock) -> i32 { if p.is_null() { @@ -190,6 +192,7 @@ pub unsafe extern "C" fn __rust_rwlock_wrlock(p: *mut RWLock) -> i32 { return 0; } #[cfg(not(test))] +#[allow(improper_ctypes)] #[no_mangle] pub unsafe extern "C" fn __rust_rwlock_unlock(p: *mut RWLock) -> i32 { if p.is_null() { -- cgit 1.4.1-3-g733a5