mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-28 18:30:06 +00:00
Add set_blocking for network sockets
This commit is contained in:
@@ -225,6 +225,11 @@ TCP_CORK: int : 3
|
||||
|
||||
MSG_TRUNC : int : 0x20
|
||||
|
||||
// TODO: add remaining fcntl commands
|
||||
// reference: https://github.com/torvalds/linux/blob/master/include/uapi/asm-generic/fcntl.h
|
||||
F_GETFL: int : 3 /* Get file flags */
|
||||
F_SETFL: int : 4 /* Set file flags */
|
||||
|
||||
// NOTE(zangent): These are OS specific!
|
||||
// Do not mix these up!
|
||||
RTLD_LAZY :: 0x001
|
||||
@@ -1074,3 +1079,11 @@ shutdown :: proc(sd: Socket, how: int) -> (Errno) {
|
||||
}
|
||||
return ERROR_NONE
|
||||
}
|
||||
|
||||
fcntl :: proc(fd: int, cmd: int, arg: int) -> (int, Errno) {
|
||||
result := unix.sys_fcntl(fd, cmd, arg)
|
||||
if result < 0 {
|
||||
return 0, _get_errno(result)
|
||||
}
|
||||
return result, ERROR_NONE
|
||||
}
|
||||
Reference in New Issue
Block a user