libc: Add wrapper for poll()
This commit is contained in:
parent
df4227eab8
commit
6593f9241b
@ -32,6 +32,7 @@ set(SOURCES
|
|||||||
src/sys/pstat.cpp
|
src/sys/pstat.cpp
|
||||||
src/sys/resource.cpp
|
src/sys/resource.cpp
|
||||||
src/sys/socket.cpp
|
src/sys/socket.cpp
|
||||||
|
src/sys/poll.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if(${LUNA_ARCH} STREQUAL "x86_64")
|
if(${LUNA_ARCH} STREQUAL "x86_64")
|
||||||
|
20
libc/include/sys/poll.h
Normal file
20
libc/include/sys/poll.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/* sys/poll.h: Wait for events on multiple file descriptors. */
|
||||||
|
|
||||||
|
#ifndef _SYS_POLL_H
|
||||||
|
#define _SYS_POLL_H
|
||||||
|
|
||||||
|
#include <bits/poll.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Wait for events on multiple file descriptors. */
|
||||||
|
int poll(struct pollfd* fds, nfds_t nfds, int timeout);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
13
libc/src/sys/poll.cpp
Normal file
13
libc/src/sys/poll.cpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#include <bits/errno-return.h>
|
||||||
|
#include <sys/poll.h>
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
int poll(struct pollfd* fds, nfds_t nfds, int timeout)
|
||||||
|
{
|
||||||
|
long rc = syscall(SYS_poll, fds, nfds, timeout);
|
||||||
|
__errno_return(rc, int);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user