Skip to content

Commit e7358ef

Browse files
author
lind
committed
formatted according to rustdoc
1 parent 4b8470c commit e7358ef

File tree

1 file changed

+32
-17
lines changed

1 file changed

+32
-17
lines changed

src/safeposix/syscalls/fs_calls.rs

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,27 +2041,42 @@ impl Cage {
20412041
}
20422042
}
20432043

2044-
//------------------------------------IOCTL SYSCALL------------------------------------
2045-
//Description
2046-
//ioctl manipulates the underlying device parameters of special files. In particular, it is used as a way
2047-
//for user-space applications to interface with device drivers.
2048-
2049-
//Function arguments
2050-
//The function accepts three arguments:
2051-
//1. fd - an open file descriptor that refers to a device.
2052-
//2. request - the control function to be performed. The set of valid request values depends entirely on the device
2044+
/// ### Description
2045+
///
2046+
/// The `ioctl_syscall()` manipulates the underlying device parameters of special files. In particular, it is used as a way
2047+
/// for user-space applications to interface with device drivers.
2048+
///
2049+
/// ### Arguments
2050+
///
2051+
/// The `ioctl_syscall()` accepts three arguments:
2052+
/// * `fd` - an open file descriptor that refers to a device.
2053+
/// * `request` - the control function to be performed. The set of valid request values depends entirely on the device
20532054
// being addressed. MEDIA_IOC_DEVICE_INFO is an example of an ioctl control function to query device
20542055
// information that all media devices must support.
2055-
//3. ptrunion - additional information needed by the addressed device to perform the selected control function.
2056+
/// * `ptrunion` - additional information needed by the addressed device to perform the selected control function.
20562057
// In the example of MEDIA_IOC_DEVICE_INFO request, a valid ptrunion value is a pointer to a struct
20572058
// media_device_info, from which the device information is obtained.
2058-
2059-
//Return values
2060-
//Upon successful completion, a value other than -1 that depends on the selected control function is returned.
2061-
//In case of a failure, -1 is returned with errno set to a particular value, like EBADF, EINVAL, etc.
2062-
2063-
//To learn more about the syscall, control functions applicable to all the devices, and possible error values,
2064-
//see https://man.openbsd.org/ioctl
2059+
///
2060+
/// ### Returns
2061+
///
2062+
/// Upon successful completion, a value other than -1 that depends on the selected control function is returned.
2063+
/// In case of a failure, -1 is returned with errno set to a particular value, like EBADF, EINVAL, etc.
2064+
///
2065+
/// ### Errors and Panics
2066+
///
2067+
/// * `EBADF` - fd is not a valid file descriptor
2068+
/// * `EFAULT` - ptrunion references an inaccessible memory area
2069+
/// * `EINVAL` - request or ptrunion is not valid
2070+
/// * `ENOTTY` - fd is not associated with a character special device
2071+
/// When `ioctl_syscall() is called on a Socket with `FIONBIO` control function, an underlying call to `libc::fcntl()` is made,
2072+
/// which can return with an error. For a complete list of possible erorrs, see
2073+
/// [fcntl(2)](https://linux.die.net/man/2/fcntl)
2074+
///
2075+
/// A panic occurs either when a provided file descriptor is out of bounds or when
2076+
/// an underlying call to `libc::fcntl()` for Socket type is returned with an unknown error.
2077+
///
2078+
/// To learn more about the syscall, control functions applicable to all the devices, and possible error values, see
2079+
/// [ioctl(2)](https://man.openbsd.org/ioctl)
20652080
20662081
pub fn ioctl_syscall(&self, fd: i32, request: u32, ptrunion: IoctlPtrUnion) -> i32 {
20672082
//BUG

0 commit comments

Comments
 (0)