mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 11:42:38 +03:00
Oops, forgot to add the select() files to LibC a while ago.
This commit is contained in:
parent
f92e721ae8
commit
5605295d00
Notes:
sideshowbarker
2024-07-19 16:01:10 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/5605295d00e
11
LibC/sys/select.cpp
Normal file
11
LibC/sys/select.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include <sys/select.h>
|
||||
#include <Kernel/Syscall.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, struct timeval* timeout)
|
||||
{
|
||||
Syscall::SC_select_params params { nfds, readfds, writefds, exceptfds, timeout };
|
||||
int rc = syscall(SC_select, ¶ms);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
22
LibC/sys/select.h
Normal file
22
LibC/sys/select.h
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define FD_SETSIZE 64
|
||||
#define FD_ZERO(set) memset((set), 0, sizeof(fd_set));
|
||||
#define FD_CLR(fd, set) ((set)->bits[(fd / 8)] &= ~(1 << (fd) % 8))
|
||||
#define FD_SET(fd, set) ((set)->bits[(fd / 8)] |= (1 << (fd) % 8))
|
||||
#define FD_ISSET(fd, set) ((set)->bits[(fd / 8)] & (1 << (fd) % 8))
|
||||
|
||||
struct fd_set {
|
||||
unsigned char bits[FD_SETSIZE / 8];
|
||||
};
|
||||
|
||||
int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, struct timeval* timeout);
|
||||
|
||||
__END_DECLS
|
||||
|
Loading…
Reference in New Issue
Block a user