hare

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

commit 1dcc8f623dd9052c8ac23a39bc3052e74c251d48
parent ce67adb5aea8b1d17d366700551806f868585dcc
Author: Lorenz (xha) <me@xha.li>
Date:   Mon, 18 Dec 2023 12:36:08 +0100

OpenBSD: fix net/ calls to rt functions

during the port to OpenBSD i converted a lot of rt:: networking
functions to use void as a return type instead of int just to make
things cleaner. i forgot to change some of the wrappers in net::,
this fixes that. other platforms should also be changed, just haven't
found time to do that.

Signed-off-by: Lorenz (xha) <me@xha.li>

Diffstat:
Mnet/tcp/+openbsd.ha | 10+++++-----
Mnet/udp/+openbsd.ha | 4++--
Mnet/unix/+openbsd.ha | 6+++---
Mrt/+openbsd/syscalls.ha | 1-
4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/net/tcp/+openbsd.ha b/net/tcp/+openbsd.ha @@ -51,7 +51,7 @@ export fn connect( if (err != rt::EINPROGRESS) { return errors::errno(err); }; - case int => void; + case void => void; }; return io::fdopen(sockfd); }; @@ -104,12 +104,12 @@ export fn listen( match (rt::bind(sockfd, &sockaddr, sz)) { case let err: rt::errno => return errors::errno(err); - case int => void; + case void => void; }; match (rt::listen(sockfd, bk)) { case let err: rt::errno => return errors::errno(err); - case int => void; + case void => void; }; for (let i = 0z; i < len(options); i += 1) { @@ -124,7 +124,7 @@ export fn listen( match (rt::getsockname(sockfd, &sn, &al)) { case let err: rt::errno => return errors::errno(err); - case int => void; + case void => void; }; const addr = ip::from_native(sn); *portout = addr.1; @@ -154,6 +154,6 @@ fn setsockopt( &val: *opaque, size(int): u32)) { case let err: rt::errno => return errors::errno(err); - case int => void; + case void => void; }; }; diff --git a/net/udp/+openbsd.ha b/net/udp/+openbsd.ha @@ -101,7 +101,7 @@ export fn listen( match (rt::getsockname(sockfd, &sn, &al)) { case let err: rt::errno => return errors::errno(err); - case int => void; + case void => void; }; const addr = ip::from_native(sn); *portout = addr.1; @@ -193,6 +193,6 @@ fn setsockopt( &val: *opaque, size(int): u32)) { case let err: rt::errno => return errors::errno(err); - case int => void; + case void => void; }; }; diff --git a/net/unix/+openbsd.ha b/net/unix/+openbsd.ha @@ -39,7 +39,7 @@ export fn connect( match (rt::connect(sockfd, &sockaddr, sz)) { case let err: rt::errno => return errors::errno(err); - case int => void; + case void => void; }; return io::fdopen(sockfd); }; @@ -83,12 +83,12 @@ export fn listen( match (rt::bind(sockfd, &sockaddr, size(rt::sockaddr_un): u32)) { case let err: rt::errno => return errors::errno(err); - case int => void; + case void => void; }; match (rt::listen(sockfd, bk)) { case let err: rt::errno => return errors::errno(err); - case int => void; + case void => void; }; return sockfd; diff --git a/rt/+openbsd/syscalls.ha b/rt/+openbsd/syscalls.ha @@ -744,7 +744,6 @@ export fn setsockopt( @symbol("listen") fn libc_listen(s: int, backlog: int) int; -// TODO: backlog should be int. export fn listen(sockfd: int, backlog: u32) (void | errno) = { let res = libc_listen(sockfd, backlog: int); if (res == -1) {