Skip to content

Commit 2686217

Browse files
Rollup merge of rust-lang#140990 - biabbas:vxworks, r=tgross35
VxWorks: updates from recent libc versions Vxworks changes. Required changes were added to libc in pr rust-lang/libc#4407 and rust-lang/libc#4337
2 parents a933842 + 544c8ce commit 2686217

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

library/std/src/sys/fs/unix.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1498,11 +1498,10 @@ impl File {
14981498
None => Ok(libc::timespec { tv_sec: 0, tv_nsec: libc::UTIME_OMIT as _ }),
14991499
};
15001500
cfg_if::cfg_if! {
1501-
if #[cfg(any(target_os = "redox", target_os = "espidf", target_os = "horizon", target_os = "vxworks", target_os = "nuttx"))] {
1501+
if #[cfg(any(target_os = "redox", target_os = "espidf", target_os = "horizon", target_os = "nuttx"))] {
15021502
// Redox doesn't appear to support `UTIME_OMIT`.
15031503
// ESP-IDF and HorizonOS do not support `futimens` at all and the behavior for those OS is therefore
15041504
// the same as for Redox.
1505-
// `futimens` and `UTIME_OMIT` are a work in progress for vxworks.
15061505
let _ = times;
15071506
Err(io::const_error!(
15081507
io::ErrorKind::Unsupported,

library/std/src/sys/pal/unix/thread.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -222,16 +222,8 @@ impl Thread {
222222

223223
#[cfg(target_os = "vxworks")]
224224
pub fn set_name(name: &CStr) {
225-
// FIXME(libc): adding real STATUS, ERROR type eventually.
226-
unsafe extern "C" {
227-
fn taskNameSet(task_id: libc::TASK_ID, task_name: *mut libc::c_char) -> libc::c_int;
228-
}
229-
230-
// VX_TASK_NAME_LEN is 31 in VxWorks 7.
231-
const VX_TASK_NAME_LEN: usize = 31;
232-
233-
let mut name = truncate_cstr::<{ VX_TASK_NAME_LEN }>(name);
234-
let res = unsafe { taskNameSet(libc::taskIdSelf(), name.as_mut_ptr()) };
225+
let mut name = truncate_cstr::<{ libc::VX_TASK_RENAME_LENGTH - 1 }>(name);
226+
let res = unsafe { libc::taskNameSet(libc::taskIdSelf(), name.as_mut_ptr()) };
235227
debug_assert_eq!(res, libc::OK);
236228
}
237229

0 commit comments

Comments
 (0)