Add the system call eventfd (#7835)

This commit is contained in:
zmq810150896
2023-07-27 17:24:56 +08:00
committed by GitHub
parent 43b451b27c
commit 307e9e5e98
5 changed files with 319 additions and 0 deletions
+5
View File
@@ -25,6 +25,11 @@ if RT_USING_POSIX_FS
bool "Enable I/O Multiplexing select() <sys/select.h>"
select RT_USING_POSIX_POLL
default n
config RT_USING_POSIX_EVENTFD
bool "Enable I/O event eventfd <sys/eventfd.h>"
select RT_USING_POSIX_POLL
default n
config RT_USING_POSIX_SOCKET
bool "Enable BSD Socket I/O <sys/socket.h> <netdb.h>"
@@ -0,0 +1,14 @@
# RT-Thread building script for component
from building import *
cwd = GetCurrentDir()
src = []
CPPPATH = [cwd]
if GetDepend('RT_USING_POSIX_EVENTFD'):
src += ['eventfd.c']
group = DefineGroup('POSIX', src, depend = [''], CPPPATH = CPPPATH)
Return('group')
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2023-07-20 zmq810150896 First version
*/
#ifndef __EVENTFD_H__
#define __EVENTFD_H__
int eventfd(unsigned int count, int flags);
#endif /* __EVENTFD_H__ */
+10
View File
@@ -41,6 +41,7 @@
#include <sys/utsname.h>
#ifdef RT_USING_DFS
#include <eventfd.h>
#include <poll.h>
#include <sys/select.h>
#include <dfs_file.h>
@@ -5317,6 +5318,14 @@ sysret_t sys_symlink(const char *existing, const char *new)
return (ret < 0 ? GET_ERRNO() : ret);
}
sysret_t sys_eventfd2(unsigned int count, int flags)
{
int ret;
ret = eventfd(count, flags);
return (ret < 0 ? GET_ERRNO() : ret);
}
static const struct rt_syscall_def func_table[] =
{
SYSCALL_SIGN(sys_exit), /* 01 */
@@ -5548,6 +5557,7 @@ static const struct rt_syscall_def func_table[] =
SYSCALL_SIGN(sys_sigtimedwait),
SYSCALL_SIGN(sys_notimpl),
SYSCALL_SIGN(sys_notimpl), /* 190 */
SYSCALL_SIGN(sys_eventfd2),
};
const void *lwp_get_sys_api(rt_uint32_t number)