Kernel/LibC: Implement super basic select

This does not really even block but it works... :D
This commit is contained in:
2024-02-12 17:26:33 +02:00
parent f50b4be162
commit 3fc1edede0
34 changed files with 285 additions and 41 deletions

View File

@@ -0,0 +1,20 @@
#ifndef _BITS_TIMEVAL_H
#define _BITS_TIMEVAL_H 1
#include <sys/cdefs.h>
__BEGIN_DECLS
#define __need_time_t
#define __need_suseconds_t
#include <sys/types.h>
struct timeval
{
time_t tv_sec; /* Seconds. */
suseconds_t tc_usec; /* Microseconds. */
};
__END_DECLS
#endif

View File

@@ -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);

View File

@@ -71,6 +71,7 @@ __BEGIN_DECLS
#define SYS_ACCEPT 70
#define SYS_CONNECT 71
#define SYS_LISTEN 72
#define SYS_PSELECT 73
__END_DECLS

View File

@@ -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
{