diff options
| author | B I Mohammed Abbas <bimohammadabbas@gmail.com> | 2025-05-14 13:52:04 +0530 |
|---|---|---|
| committer | B I Mohammed Abbas <bimohammadabbas@gmail.com> | 2025-05-14 13:52:31 +0530 |
| commit | e1f1878da550408e800742217881730c2b06d1ec (patch) | |
| tree | 3bd71ac23499fb9663051dafcee86288e10bbedc /library | |
| parent | 414482f6a0d4e7290f614300581a0b55442552a3 (diff) | |
| download | rust-e1f1878da550408e800742217881730c2b06d1ec.tar.gz rust-e1f1878da550408e800742217881730c2b06d1ec.zip | |
Fix set_name for vxworks. Length of name should be truncated to VX_TASK_RENAME_LENGTH-1
Diffstat (limited to 'library')
| -rw-r--r-- | library/std/src/sys/pal/unix/thread.rs | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/library/std/src/sys/pal/unix/thread.rs b/library/std/src/sys/pal/unix/thread.rs index afda7c65e10..d8b189413f4 100644 --- a/library/std/src/sys/pal/unix/thread.rs +++ b/library/std/src/sys/pal/unix/thread.rs @@ -222,16 +222,8 @@ impl Thread { #[cfg(target_os = "vxworks")] pub fn set_name(name: &CStr) { - // FIXME(libc): adding real STATUS, ERROR type eventually. - unsafe extern "C" { - fn taskNameSet(task_id: libc::TASK_ID, task_name: *mut libc::c_char) -> libc::c_int; - } - - // VX_TASK_NAME_LEN is 31 in VxWorks 7. - const VX_TASK_NAME_LEN: usize = 31; - - let mut name = truncate_cstr::<{ VX_TASK_NAME_LEN }>(name); - let res = unsafe { taskNameSet(libc::taskIdSelf(), name.as_mut_ptr()) }; + let mut name = truncate_cstr::<{ libc::VX_TASK_RENAME_LENGTH - 1 }>(name); + let res = unsafe { libc::taskNameSet(libc::taskIdSelf(), name.as_mut_ptr()) }; debug_assert_eq!(res, libc::OK); } |
