Rollup merge of #128817 - biabbas:vxworks_update, r=tgross35
VxWorks code refactored 1. Extern TaskNameSet as minimum supported version of os is VxWorks 7 which would have taskNameSet 2. Vx_TASK_NAME_LEN is 31 on VxWorks7, defined variable res. 3. Add unsafe blocks on Non::Zero usage in available_parallelism() 4. Update vxworks docs. r? `@tgross35` cc `@devnexen`
This commit is contained in:
commit
53729366a9
@ -3,12 +3,7 @@ use crate::mem::{self, ManuallyDrop};
|
|||||||
use crate::num::NonZero;
|
use crate::num::NonZero;
|
||||||
#[cfg(all(target_os = "linux", target_env = "gnu"))]
|
#[cfg(all(target_os = "linux", target_env = "gnu"))]
|
||||||
use crate::sys::weak::dlsym;
|
use crate::sys::weak::dlsym;
|
||||||
#[cfg(any(
|
#[cfg(any(target_os = "solaris", target_os = "illumos", target_os = "nto",))]
|
||||||
target_os = "solaris",
|
|
||||||
target_os = "illumos",
|
|
||||||
target_os = "nto",
|
|
||||||
target_os = "vxworks"
|
|
||||||
))]
|
|
||||||
use crate::sys::weak::weak;
|
use crate::sys::weak::weak;
|
||||||
use crate::sys::{os, stack_overflow};
|
use crate::sys::{os, stack_overflow};
|
||||||
use crate::time::Duration;
|
use crate::time::Duration;
|
||||||
@ -220,23 +215,16 @@ impl Thread {
|
|||||||
#[cfg(target_os = "vxworks")]
|
#[cfg(target_os = "vxworks")]
|
||||||
pub fn set_name(name: &CStr) {
|
pub fn set_name(name: &CStr) {
|
||||||
// FIXME(libc): adding real STATUS, ERROR type eventually.
|
// FIXME(libc): adding real STATUS, ERROR type eventually.
|
||||||
weak! {
|
extern "C" {
|
||||||
fn taskNameSet(
|
fn taskNameSet(task_id: libc::TASK_ID, task_name: *mut libc::c_char) -> libc::c_int;
|
||||||
libc::TASK_ID, *mut libc::c_char
|
|
||||||
) -> libc::c_int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We can't assume taskNameSet is necessarily available.
|
// VX_TASK_NAME_LEN is 31 in VxWorks 7.
|
||||||
// VX_TASK_NAME_LEN can be found set to 31,
|
const VX_TASK_NAME_LEN: usize = 31;
|
||||||
// however older versions can be set to only 10.
|
|
||||||
// FIXME(vxworks): if the minimum supported VxWorks is >= 7, the maximum length can be changed to 31.
|
|
||||||
if let Some(f) = taskNameSet.get() {
|
|
||||||
const VX_TASK_NAME_LEN: usize = 10;
|
|
||||||
|
|
||||||
let name = truncate_cstr::<{ VX_TASK_NAME_LEN }>(name);
|
let mut name = truncate_cstr::<{ VX_TASK_NAME_LEN }>(name);
|
||||||
let status = unsafe { f(libc::taskIdSelf(), name.as_mut_ptr()) };
|
let res = unsafe { taskNameSet(libc::taskIdSelf(), name.as_mut_ptr()) };
|
||||||
debug_assert_eq!(res, libc::OK);
|
debug_assert_eq!(res, libc::OK);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
@ -489,9 +477,11 @@ pub fn available_parallelism() -> io::Result<NonZero<usize>> {
|
|||||||
fn vxCpuEnabledGet() -> libc::cpuset_t;
|
fn vxCpuEnabledGet() -> libc::cpuset_t;
|
||||||
}
|
}
|
||||||
|
|
||||||
// always fetches a valid bitmask
|
// SAFETY: `vxCpuEnabledGet` always fetches a mask with at least one bit set
|
||||||
let set = unsafe { vxCpuEnabledGet() };
|
unsafe{
|
||||||
Ok(NonZero::new_unchecked(set.count_ones() as usize))
|
let set = vxCpuEnabledGet();
|
||||||
|
Ok(NonZero::new_unchecked(set.count_ones() as usize))
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// FIXME: implement on Redox, l4re
|
// FIXME: implement on Redox, l4re
|
||||||
Err(io::const_io_error!(io::ErrorKind::Unsupported, "Getting the number of hardware threads is not supported on the target platform"))
|
Err(io::const_io_error!(io::ErrorKind::Unsupported, "Getting the number of hardware threads is not supported on the target platform"))
|
||||||
|
@ -282,7 +282,7 @@ target | std | host | notes
|
|||||||
[`armv7-unknown-linux-uclibceabihf`](platform-support/armv7-unknown-linux-uclibceabihf.md) | ✓ | ? | Armv7-A Linux with uClibc, hardfloat
|
[`armv7-unknown-linux-uclibceabihf`](platform-support/armv7-unknown-linux-uclibceabihf.md) | ✓ | ? | Armv7-A Linux with uClibc, hardfloat
|
||||||
`armv7-unknown-freebsd` | ✓ | ✓ | Armv7-A FreeBSD
|
`armv7-unknown-freebsd` | ✓ | ✓ | Armv7-A FreeBSD
|
||||||
[`armv7-unknown-netbsd-eabihf`](platform-support/netbsd.md) | ✓ | ✓ | Armv7-A NetBSD w/hard-float
|
[`armv7-unknown-netbsd-eabihf`](platform-support/netbsd.md) | ✓ | ✓ | Armv7-A NetBSD w/hard-float
|
||||||
[`armv7-wrs-vxworks-eabihf`](platform-support/vxworks.md) | ? | | Armv7-A for VxWorks
|
[`armv7-wrs-vxworks-eabihf`](platform-support/vxworks.md) | ✓ | | Armv7-A for VxWorks
|
||||||
[`armv7a-kmc-solid_asp3-eabi`](platform-support/kmc-solid.md) | ✓ | | ARM SOLID with TOPPERS/ASP3
|
[`armv7a-kmc-solid_asp3-eabi`](platform-support/kmc-solid.md) | ✓ | | ARM SOLID with TOPPERS/ASP3
|
||||||
[`armv7a-kmc-solid_asp3-eabihf`](platform-support/kmc-solid.md) | ✓ | | ARM SOLID with TOPPERS/ASP3, hardfloat
|
[`armv7a-kmc-solid_asp3-eabihf`](platform-support/kmc-solid.md) | ✓ | | ARM SOLID with TOPPERS/ASP3, hardfloat
|
||||||
[`armv7a-none-eabihf`](platform-support/arm-none-eabi.md) | * | | Bare Armv7-A, hardfloat
|
[`armv7a-none-eabihf`](platform-support/arm-none-eabi.md) | * | | Bare Armv7-A, hardfloat
|
||||||
@ -308,7 +308,7 @@ target | std | host | notes
|
|||||||
`i686-uwp-windows-gnu` | ✓ | | [^x86_32-floats-return-ABI]
|
`i686-uwp-windows-gnu` | ✓ | | [^x86_32-floats-return-ABI]
|
||||||
`i686-uwp-windows-msvc` | ✓ | | [^x86_32-floats-return-ABI]
|
`i686-uwp-windows-msvc` | ✓ | | [^x86_32-floats-return-ABI]
|
||||||
[`i686-win7-windows-msvc`](platform-support/win7-windows-msvc.md) | ✓ | | 32-bit Windows 7 support [^x86_32-floats-return-ABI]
|
[`i686-win7-windows-msvc`](platform-support/win7-windows-msvc.md) | ✓ | | 32-bit Windows 7 support [^x86_32-floats-return-ABI]
|
||||||
[`i686-wrs-vxworks`](platform-support/vxworks.md) | ? | | [^x86_32-floats-return-ABI]
|
[`i686-wrs-vxworks`](platform-support/vxworks.md) | ✓ | | [^x86_32-floats-return-ABI]
|
||||||
[`m68k-unknown-linux-gnu`](platform-support/m68k-unknown-linux-gnu.md) | ? | | Motorola 680x0 Linux
|
[`m68k-unknown-linux-gnu`](platform-support/m68k-unknown-linux-gnu.md) | ? | | Motorola 680x0 Linux
|
||||||
`mips-unknown-linux-gnu` | ✓ | ✓ | MIPS Linux (kernel 4.4, glibc 2.23)
|
`mips-unknown-linux-gnu` | ✓ | ✓ | MIPS Linux (kernel 4.4, glibc 2.23)
|
||||||
`mips-unknown-linux-musl` | ✓ | | MIPS Linux with musl 1.2.3
|
`mips-unknown-linux-musl` | ✓ | | MIPS Linux with musl 1.2.3
|
||||||
@ -334,13 +334,13 @@ target | std | host | notes
|
|||||||
`powerpc-unknown-linux-musl` | ? | | PowerPC Linux with musl 1.2.3
|
`powerpc-unknown-linux-musl` | ? | | PowerPC Linux with musl 1.2.3
|
||||||
[`powerpc-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD 32-bit powerpc systems
|
[`powerpc-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD 32-bit powerpc systems
|
||||||
[`powerpc-unknown-openbsd`](platform-support/powerpc-unknown-openbsd.md) | * | |
|
[`powerpc-unknown-openbsd`](platform-support/powerpc-unknown-openbsd.md) | * | |
|
||||||
[`powerpc-wrs-vxworks-spe`](platform-support/vxworks.md) | ? | |
|
[`powerpc-wrs-vxworks-spe`](platform-support/vxworks.md) | ✓ | |
|
||||||
[`powerpc-wrs-vxworks`](platform-support/vxworks.md) | ? | |
|
[`powerpc-wrs-vxworks`](platform-support/vxworks.md) | ✓ | |
|
||||||
`powerpc64-unknown-freebsd` | ✓ | ✓ | PPC64 FreeBSD (ELFv1 and ELFv2)
|
`powerpc64-unknown-freebsd` | ✓ | ✓ | PPC64 FreeBSD (ELFv1 and ELFv2)
|
||||||
`powerpc64le-unknown-freebsd` | | | PPC64LE FreeBSD
|
`powerpc64le-unknown-freebsd` | | | PPC64LE FreeBSD
|
||||||
`powerpc-unknown-freebsd` | | | PowerPC FreeBSD
|
`powerpc-unknown-freebsd` | | | PowerPC FreeBSD
|
||||||
`powerpc64-unknown-linux-musl` | ? | | 64-bit PowerPC Linux with musl 1.2.3
|
`powerpc64-unknown-linux-musl` | ? | | 64-bit PowerPC Linux with musl 1.2.3
|
||||||
`powerpc64-wrs-vxworks` | ? | |
|
[`powerpc64-wrs-vxworks`](platform-support/vxworks.md) | ✓ | |
|
||||||
`powerpc64le-unknown-linux-musl` | ? | | 64-bit PowerPC Linux with musl 1.2.3, Little Endian
|
`powerpc64le-unknown-linux-musl` | ? | | 64-bit PowerPC Linux with musl 1.2.3, Little Endian
|
||||||
[`powerpc64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/powerpc64
|
[`powerpc64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/powerpc64
|
||||||
[`powerpc64-ibm-aix`](platform-support/aix.md) | ? | | 64-bit AIX (7.2 and newer)
|
[`powerpc64-ibm-aix`](platform-support/aix.md) | ? | | 64-bit AIX (7.2 and newer)
|
||||||
@ -383,7 +383,7 @@ target | std | host | notes
|
|||||||
`x86_64-uwp-windows-gnu` | ✓ | |
|
`x86_64-uwp-windows-gnu` | ✓ | |
|
||||||
`x86_64-uwp-windows-msvc` | ✓ | |
|
`x86_64-uwp-windows-msvc` | ✓ | |
|
||||||
[`x86_64-win7-windows-msvc`](platform-support/win7-windows-msvc.md) | ✓ | | 64-bit Windows 7 support
|
[`x86_64-win7-windows-msvc`](platform-support/win7-windows-msvc.md) | ✓ | | 64-bit Windows 7 support
|
||||||
[`x86_64-wrs-vxworks`](platform-support/vxworks.md) | ? | |
|
[`x86_64-wrs-vxworks`](platform-support/vxworks.md) | ✓ | |
|
||||||
[`x86_64h-apple-darwin`](platform-support/x86_64h-apple-darwin.md) | ✓ | ✓ | macOS with late-gen Intel (at least Haswell)
|
[`x86_64h-apple-darwin`](platform-support/x86_64h-apple-darwin.md) | ✓ | ✓ | macOS with late-gen Intel (at least Haswell)
|
||||||
[`x86_64-unknown-linux-none`](platform-support/x86_64-unknown-linux-none.md) | * | | 64-bit Linux with no libc
|
[`x86_64-unknown-linux-none`](platform-support/x86_64-unknown-linux-none.md) | * | | 64-bit Linux with no libc
|
||||||
[`xtensa-esp32-none-elf`](platform-support/xtensa.md) | * | | Xtensa ESP32
|
[`xtensa-esp32-none-elf`](platform-support/xtensa.md) | * | | Xtensa ESP32
|
||||||
|
@ -12,6 +12,7 @@ Target triplets available:
|
|||||||
- `i686-wrs-vxworks`
|
- `i686-wrs-vxworks`
|
||||||
- `armv7-wrs-vxworks-eabihf`
|
- `armv7-wrs-vxworks-eabihf`
|
||||||
- `powerpc-wrs-vxworks`
|
- `powerpc-wrs-vxworks`
|
||||||
|
- `powerpc64-wrs-vxworks`
|
||||||
- `powerpc-wrs-vxworks-spe`
|
- `powerpc-wrs-vxworks-spe`
|
||||||
|
|
||||||
## Target maintainers
|
## Target maintainers
|
||||||
@ -42,6 +43,7 @@ target = [
|
|||||||
"i686-wrs-vxworks",
|
"i686-wrs-vxworks",
|
||||||
"armv7-wrs-vxworks-eabihf",
|
"armv7-wrs-vxworks-eabihf",
|
||||||
"powerpc-wrs-vxworks",
|
"powerpc-wrs-vxworks",
|
||||||
|
"powerpc64-wrs-vxworks",
|
||||||
"powerpc-wrs-vxworks-spe",
|
"powerpc-wrs-vxworks-spe",
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user