hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit b8f5350b97bdb7a3dbf6c8f3ee030ac1e2b939d8
parent e35f2284774436f422e06f0e8d290b173ced1677
Author: Drew DeVault <sir@cmpwn.com>
Date:   Wed, 14 Feb 2024 13:51:39 +0100

rt+freebsd: expand ioctl support

A similar change was made for +linux in 2021, but FreeBSD was forgotten.

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mrt/+freebsd/syscalls.ha | 13++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/rt/+freebsd/syscalls.ha b/rt/+freebsd/syscalls.ha @@ -91,9 +91,16 @@ export fn pipe2(pipefd: *[2]int, flags: int) (void | errno) = { wrap_return(syscall2(SYS_pipe2, pipefd: uintptr: u64, flags: u64))?; }; -export fn ioctl(fd: int, req: u64, arg: nullable *opaque) (int | errno) = { - return wrap_return(syscall3(SYS_ioctl, fd: u64, - req, arg: uintptr: u64))?: int; +export type ioctl_arg = (nullable *opaque | u64); + +export fn ioctl(fd: int, req: u64, arg: ioctl_arg) (int | errno) = { + let fd = fd: u64, req = req: u64; + return wrap_return(match (arg) { + case let u: u64 => + yield syscall3(SYS_ioctl, fd, req, u); + case let v: nullable *opaque => + yield syscall3(SYS_ioctl, fd, req, v: uintptr: u64); + })?: int; }; export fn openat(