Skip to content

Commit 34bcc8e

Browse files
committed
Don't cast thread name to an integer for prctl
libc::prctl and the prctl definitions in glibc, musl, and the kernel headers are C variadic functions. Therefore, all the arguments (except for the first) are untyped. It is only the Linux man page which says that prctl takes 4 unsigned long arguments. I have no idea why it says this. In any case, the upshot is that we don't need to cast the pointer to an integer and confuse Miri.
1 parent 168a020 commit 34bcc8e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl Thread {
122122
// pthread wrapper only appeared in glibc 2.12, so we use syscall
123123
// directly.
124124
unsafe {
125-
libc::prctl(PR_SET_NAME, name.as_ptr() as libc::c_ulong, 0, 0, 0);
125+
libc::prctl(PR_SET_NAME, name.as_ptr(), 0, 0, 0);
126126
}
127127
}
128128

0 commit comments

Comments
 (0)