Merge pull request #6537 from RaphGL/freebsd-ioctl

added ioctl and stdio FILENO constants to core:sys/freebsd
This commit is contained in:
gingerBill
2026-04-11 21:34:55 +01:00
committed by GitHub
2 changed files with 25 additions and 0 deletions

View File

@@ -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)

View File

@@ -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
}