commit
8215a83523
|
@ -28,6 +28,23 @@
|
|||
#include <dfs_poll.h>
|
||||
#include <dfs_select.h>
|
||||
|
||||
static void fdszero(fd_set *set, int nfds)
|
||||
{
|
||||
fd_mask *m;
|
||||
int n;
|
||||
|
||||
/*
|
||||
The 'sizeof(fd_set)' of the system space may differ from user space,
|
||||
so the actual size of the 'fd_set' is determined here with the parameter 'nfds'
|
||||
*/
|
||||
m = (fd_mask*)set;
|
||||
for (n = 0; n < nfds; n += (sizeof(fd_mask) * 8))
|
||||
{
|
||||
rt_memset(m, 0, sizeof(fd_mask));
|
||||
m ++;
|
||||
}
|
||||
}
|
||||
|
||||
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
|
||||
{
|
||||
int fd;
|
||||
|
@ -113,17 +130,17 @@ int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struc
|
|||
/* Now set up the return values */
|
||||
if (readfds)
|
||||
{
|
||||
memset(readfds, 0, sizeof(fd_set));
|
||||
fdszero(readfds, nfds);
|
||||
}
|
||||
|
||||
if (writefds)
|
||||
{
|
||||
memset(writefds, 0, sizeof(fd_set));
|
||||
fdszero(writefds, nfds);
|
||||
}
|
||||
|
||||
if (exceptfds)
|
||||
{
|
||||
memset(exceptfds, 0, sizeof(fd_set));
|
||||
fdszero(exceptfds, nfds);
|
||||
}
|
||||
|
||||
/* Convert the poll descriptor list back into selects 3 bitsets */
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <lwp_syscall.h>
|
||||
|
||||
#include <dfs_poll.h>
|
||||
#include <dfs_select.h>
|
||||
|
||||
#if (defined(RT_USING_SAL) && defined(SAL_USING_POSIX))
|
||||
#include <sys/socket.h>
|
||||
|
||||
|
@ -235,7 +237,7 @@ const static void* func_table[] =
|
|||
|
||||
(void *)sys_gettimeofday, // 0x0b
|
||||
(void *)sys_settimeofday, // 0x0c
|
||||
|
||||
|
||||
(void *)sys_malloc, // 0x0d
|
||||
(void *)sys_free, // 0x0e
|
||||
(void *)sys_realloc, //0x0f
|
||||
|
@ -256,6 +258,8 @@ const static void* func_table[] =
|
|||
SYSCALL_NET(send), // 0x1d
|
||||
SYSCALL_NET(sendto), // 0x1e
|
||||
SYSCALL_NET(socket), // 0x1f
|
||||
|
||||
select, // 0x20
|
||||
};
|
||||
|
||||
const void *lwp_get_sys_api(rt_uint32_t number)
|
||||
|
|
Loading…
Reference in New Issue