mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-18 20:40:28 +00:00
sys/linux: Add binding to ioctl syscall + fd consts
Add binding to ioctl syscall, due to the vast nature of this syscall adding more device specific request values is possible. Also added the stdin, stdout and stderr, to constants.odin
This commit is contained in:
@@ -1,6 +1,21 @@
|
||||
|
||||
package linux
|
||||
|
||||
/*
|
||||
Standard input file descriptor
|
||||
*/
|
||||
STDIN_FILENO :: Fd(0)
|
||||
|
||||
/*
|
||||
Standard output file descriptor
|
||||
*/
|
||||
STDOUT_FILENO :: Fd(1)
|
||||
|
||||
/*
|
||||
Standard output file descriptor
|
||||
*/
|
||||
STDERR_FILENO :: Fd(2)
|
||||
|
||||
/*
|
||||
Special file descriptor to pass to `*at` functions to specify
|
||||
that relative paths are relative to current directory.
|
||||
|
||||
@@ -216,7 +216,17 @@ rt_sigprocmask :: proc "contextless" (mask_kind: Sig_Mask_Kind, new_set: ^Sig_Se
|
||||
return Errno(-ret)
|
||||
}
|
||||
|
||||
// TODO(flysand): ioctl
|
||||
/*
|
||||
Control devices. The ioctl syscall is a bit special because
|
||||
its argument is usually a pointer to some driver-specific structure.
|
||||
The request value is device-specific. Consult your LibC implementation's
|
||||
ioctls.h file to learn more.
|
||||
Available since Linux 1.0.
|
||||
*/
|
||||
ioctl :: proc "contextless" (fd: Fd, request: u64, arg: u64) -> (Errno) {
|
||||
ret := syscall(SYS_ioctl, fd, request, arg)
|
||||
return Errno(-ret)
|
||||
}
|
||||
|
||||
/*
|
||||
Read the file at a specified offset.
|
||||
|
||||
Reference in New Issue
Block a user