diff options
author | Steve Lau <stevelauc@outlook.com> | 2022-12-07 20:31:38 +0800 |
---|---|---|
committer | Steve Lau <stevelauc@outlook.com> | 2022-12-07 20:31:38 +0800 |
commit | 2f546c98cb1abb4463f13b084443ae4bf1597cb3 (patch) | |
tree | 89c41b7cb16953b71925efd5064d59d167daf4b7 /src/kmod.rs | |
parent | 67f7d46c6e9d2089f03b2322d31dcb4b388eb730 (diff) | |
download | nix-2f546c98cb1abb4463f13b084443ae4bf1597cb3.zip |
feat: I/O safety for 'kmod'
Diffstat (limited to 'src/kmod.rs')
-rw-r--r-- | src/kmod.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/kmod.rs b/src/kmod.rs index 1fa6c170..d7146612 100644 --- a/src/kmod.rs +++ b/src/kmod.rs @@ -3,7 +3,7 @@ //! For more details see use std::ffi::CStr; -use std::os::unix::io::AsRawFd; +use std::os::unix::io::{AsFd, AsRawFd}; use crate::errno::Errno; use crate::Result; @@ -79,15 +79,15 @@ libc_bitflags!( /// ``` /// /// See [`man init_module(2)`](https://man7.org/linux/man-pages/man2/init_module.2.html) for more information. -pub fn finit_module<T: AsRawFd>( - fd: &T, +pub fn finit_module<Fd: AsFd>( + fd: &Fd, param_values: &CStr, flags: ModuleInitFlags, ) -> Result<()> { let res = unsafe { libc::syscall( libc::SYS_finit_module, - fd.as_raw_fd(), + fd.as_fd().as_raw_fd(), param_values.as_ptr(), flags.bits(), ) |