Skip to content

Commit

Permalink
fix(kvm): handle the pthread_t definition in musl
Browse files Browse the repository at this point in the history
`pthread_t` is defined as `struct __pthread *` in musl[1] and
`unsigned long int` in glibc[2]. Use `as _` to let rust compiler do
the conversion.

[1] http://git.musl-libc.org/cgit/musl/tree/include/alltypes.h.in
[2] https://elixir.bootlin.com/glibc/latest/source/sysdeps/nptl/bits/pthreadtypes.h#L27

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
  • Loading branch information
Lencerf committed May 11, 2024
1 parent 9816318 commit 592f643
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion alioth/src/hv/kvm/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl Vm for KvmVm {
}

fn stop_vcpu<T>(_id: u32, handle: &JoinHandle<T>) -> Result<(), Error> {
ffi!(unsafe { libc::pthread_kill(handle.as_pthread_t(), SIGRTMIN()) })?;
ffi!(unsafe { libc::pthread_kill(handle.as_pthread_t() as _, SIGRTMIN()) })?;
Ok(())
}

Expand Down

0 comments on commit 592f643

Please sign in to comment.