mirror of
https://github.com/odin-lang/Odin.git
synced 2026-05-25 05:09:53 +00:00
Merge pull request #6537 from RaphGL/freebsd-ioctl
added ioctl and stdio FILENO constants to core:sys/freebsd
This commit is contained in:
@@ -3,3 +3,17 @@ package sys_freebsd
|
||||
/* Get window size */
|
||||
TIOCGWINSZ :: 0x40087468
|
||||
|
||||
/*
|
||||
Standard input file descriptor
|
||||
*/
|
||||
STDIN_FILENO :: Fd(0)
|
||||
|
||||
/*
|
||||
Standard output file descriptor
|
||||
*/
|
||||
STDOUT_FILENO :: Fd(1)
|
||||
|
||||
/*
|
||||
Standard error file descriptor
|
||||
*/
|
||||
STDERR_FILENO :: Fd(2)
|
||||
|
||||
@@ -23,6 +23,7 @@ SYS_recvfrom : uintptr : 29
|
||||
SYS_accept : uintptr : 30
|
||||
SYS_getpeername: uintptr : 31
|
||||
SYS_getsockname: uintptr : 32
|
||||
SYS_ioctl : uintptr : 54
|
||||
SYS_fcntl : uintptr : 92
|
||||
SYS_fsync : uintptr : 95
|
||||
SYS_socket : uintptr : 97
|
||||
@@ -634,3 +635,13 @@ accept4_nil :: proc "contextless" (s: Fd, flags: Socket_Flags = {}) -> (Fd, Errn
|
||||
}
|
||||
|
||||
accept4 :: proc { accept4_nil, accept4_T }
|
||||
|
||||
ioctl :: proc "contextless" (fd: Fd, request: c.ulong, arg: uintptr) -> (int, Errno) {
|
||||
result, ok := intrinsics.syscall_bsd(SYS_ioctl, cast(uintptr)fd, arg)
|
||||
|
||||
if !ok {
|
||||
return -1, cast(Errno)result
|
||||
}
|
||||
|
||||
return cast(int)result, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user