lib: add basic Safety section

This commit is contained in:
Matt Bilker 2022-04-12 07:41:03 +00:00
parent 35d51635c8
commit fa31a73ef5
No known key found for this signature in database
GPG Key ID: 69ADF8AEB6C8B5D1

View File

@ -244,6 +244,10 @@ impl fmt::Debug for VgpuConfig {
} }
} }
/// # Safety
///
/// This is actually unsafe since `ioctl` is variadic. All the `ioctl` calls in the
/// 460.32.04 `nvidia-vgpu-mgr` and `nvidia-vgpud` binaries use only one argument.
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn ioctl(fd: RawFd, request: c_ulong, argp: *mut c_void) -> c_int { pub unsafe extern "C" fn ioctl(fd: RawFd, request: c_ulong, argp: *mut c_void) -> c_int {
static mut IOCTL_FN_PTR: Option<unsafe extern "C" fn(RawFd, c_ulong, ...) -> c_int> = None; static mut IOCTL_FN_PTR: Option<unsafe extern "C" fn(RawFd, c_ulong, ...) -> c_int> = None;