mirror of
https://github.com/devkitPro/wut.git
synced 2026-09-29 05:16:37 -05:00
wutsocket fixes: select() handles timeout wrong, and poll() lacks a safety check (#428)
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
* - Fix select() to also update the fd_set arguments on timeout condition. - Move the nfds argument restriction to the nsysnet side. - Allow user-defined FD_SETSIZE, since newlib's fd_set allow custom sizes. - Define __socklen_t_defined when socklen_t is typedefed. * Added safety check for poll(): the nsysnet fd must fit in nsysnet_fd_set. --------- Co-authored-by: Daniel K. O. (dkosmari) <none@none>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef FD_SETSIZE
|
||||
#define FD_SETSIZE 32
|
||||
#endif
|
||||
|
||||
#include_next <sys/select.h>
|
||||
|
||||
@@ -53,7 +53,11 @@
|
||||
#define SO_NOSLOWSTART 0x4000 // disable slowstart
|
||||
#define SO_RUSRBUF 0x10000 // enable somemopt provided memory for receive buffer
|
||||
|
||||
typedef uint32_t socklen_t;
|
||||
#ifndef __socklen_t_defined
|
||||
typedef __socklen_t socklen_t;
|
||||
#define __socklen_t_defined
|
||||
#endif
|
||||
|
||||
typedef uint16_t sa_family_t;
|
||||
|
||||
struct sockaddr
|
||||
|
||||
Reference in New Issue
Block a user