Kernel/LibC: Implement super basic select
This does not really even block but it works... :D
This commit is contained in:
@@ -7,9 +7,7 @@
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define __need_time_t
|
||||
#define __need_suseconds_t
|
||||
#include <sys/types.h>
|
||||
#include <bits/types/timeval.h>
|
||||
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
@@ -50,6 +48,16 @@ typedef struct {
|
||||
(setp)->__bits[i] = (__fd_mask)0; \
|
||||
} while (0)
|
||||
|
||||
struct sys_pselect_t
|
||||
{
|
||||
int nfds;
|
||||
fd_set* readfds;
|
||||
fd_set* writefds;
|
||||
fd_set* errorfds;
|
||||
const struct timespec* timeout;
|
||||
const sigset_t* sigmask;
|
||||
};
|
||||
|
||||
int pselect(int nfds, fd_set* __restrict readfds, fd_set* __restrict writefds, fd_set* __restrict errorfds, const struct timespec* __restrict timeout, const sigset_t* __restrict sigmask);
|
||||
int select(int nfds, fd_set* __restrict readfds, fd_set* __restrict writefds, fd_set* __restrict errorfds, struct timeval* __restrict timeout);
|
||||
|
||||
|
||||
@@ -71,6 +71,7 @@ __BEGIN_DECLS
|
||||
#define SYS_ACCEPT 70
|
||||
#define SYS_CONNECT 71
|
||||
#define SYS_LISTEN 72
|
||||
#define SYS_PSELECT 73
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
||||
@@ -7,18 +7,10 @@
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define __need_time_t
|
||||
#define __need_suseconds_t
|
||||
#include <sys/types.h>
|
||||
|
||||
// NOTE: select is declared from here
|
||||
#include <sys/select.h>
|
||||
|
||||
struct timeval
|
||||
{
|
||||
time_t tv_sec; /* Seconds. */
|
||||
suseconds_t tc_usec; /* Microseconds. */
|
||||
};
|
||||
#include <bits/types/timeval.h>
|
||||
|
||||
struct itimerval
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user