mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Clean up some FreeBSD core:net code
This commit is contained in:
@@ -27,8 +27,9 @@ Dial_Error :: enum c.int {
|
|||||||
Already_Connected = cast(c.int)freebsd.Errno.EISCONN,
|
Already_Connected = cast(c.int)freebsd.Errno.EISCONN,
|
||||||
Timeout = cast(c.int)freebsd.Errno.ETIMEDOUT,
|
Timeout = cast(c.int)freebsd.Errno.ETIMEDOUT,
|
||||||
Refused_By_Remote_Host = cast(c.int)freebsd.Errno.ECONNREFUSED,
|
Refused_By_Remote_Host = cast(c.int)freebsd.Errno.ECONNREFUSED,
|
||||||
// `Refused` alias for core:net tests.
|
// `Refused` alias for `core:net` tests.
|
||||||
Refused = cast(c.int)freebsd.Errno.ECONNREFUSED,
|
// The above default name `Refused_By_Remote_Host` is more explicit.
|
||||||
|
Refused = Refused_By_Remote_Host,
|
||||||
Reset_By_Remote_Host = cast(c.int)freebsd.Errno.ECONNRESET,
|
Reset_By_Remote_Host = cast(c.int)freebsd.Errno.ECONNRESET,
|
||||||
Network_Unreachable = cast(c.int)freebsd.Errno.ENETUNREACH,
|
Network_Unreachable = cast(c.int)freebsd.Errno.ENETUNREACH,
|
||||||
Host_Unreachable = cast(c.int)freebsd.Errno.EHOSTUNREACH,
|
Host_Unreachable = cast(c.int)freebsd.Errno.EHOSTUNREACH,
|
||||||
@@ -138,13 +139,15 @@ TCP_Send_Error :: enum c.int {
|
|||||||
specified, and the requested operation would block. */
|
specified, and the requested operation would block. */
|
||||||
Would_Block = cast(c.int)freebsd.Errno.EAGAIN,
|
Would_Block = cast(c.int)freebsd.Errno.EAGAIN,
|
||||||
|
|
||||||
// NOTE: This error arises for two distinct reasons.
|
/* NOTE: This error arises for two distinct reasons:
|
||||||
/* The system was unable to allocate an internal buffer.
|
|
||||||
The operation may succeed when buffers become available. */
|
|
||||||
|
|
||||||
/* The output queue for a network interface was full.
|
1. The system was unable to allocate an internal buffer.
|
||||||
|
The operation may succeed when buffers become available.
|
||||||
|
|
||||||
|
2. The output queue for a network interface was full.
|
||||||
This generally indicates that the interface has stopped
|
This generally indicates that the interface has stopped
|
||||||
sending, but may be caused by transient congestion. */
|
sending, but may be caused by transient congestion.
|
||||||
|
*/
|
||||||
No_Buffer_Space_Available = cast(c.int)freebsd.Errno.ENOBUFS,
|
No_Buffer_Space_Available = cast(c.int)freebsd.Errno.ENOBUFS,
|
||||||
|
|
||||||
Host_Unreachable = cast(c.int)freebsd.Errno.EHOSTUNREACH,
|
Host_Unreachable = cast(c.int)freebsd.Errno.EHOSTUNREACH,
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ close :: proc "contextless" (fd: Fd) -> Errno {
|
|||||||
//
|
//
|
||||||
// The getpid() function appeared in Version 7 AT&T UNIX.
|
// The getpid() function appeared in Version 7 AT&T UNIX.
|
||||||
getpid :: proc "contextless" () -> pid_t {
|
getpid :: proc "contextless" () -> pid_t {
|
||||||
// always succeeds
|
// This always succeeds.
|
||||||
result, _ := intrinsics.syscall_bsd(SYS_getpid)
|
result, _ := intrinsics.syscall_bsd(SYS_getpid)
|
||||||
return cast(pid_t)result
|
return cast(pid_t)result
|
||||||
}
|
}
|
||||||
@@ -468,7 +468,7 @@ accept4_T :: proc "contextless" (s: Fd, sockaddr: ^$T, flags: Socket_Flags = {})
|
|||||||
where
|
where
|
||||||
intrinsics.type_is_subtype_of(T, Socket_Address_Header)
|
intrinsics.type_is_subtype_of(T, Socket_Address_Header)
|
||||||
{
|
{
|
||||||
// sockaddr must contain a valid pointer, or this will segfault because
|
// `sockaddr` must contain a valid pointer, or this will segfault because
|
||||||
// we're telling the syscall that there's memory available to write to.
|
// we're telling the syscall that there's memory available to write to.
|
||||||
addrlen: u32 = size_of(T)
|
addrlen: u32 = size_of(T)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user