[libc] fix the sys/select.h problem (#5790)
This commit is contained in:
parent
03823b5016
commit
de6d7eca5a
@ -12,7 +12,7 @@
|
||||
#ifndef __SYS_SELECT_H__
|
||||
#define __SYS_SELECT_H__
|
||||
|
||||
#include <rtconfig.h>
|
||||
#include <rtthread.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
@ -53,7 +53,7 @@ typedef struct _types_fd_set {
|
||||
#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS)))
|
||||
#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS)))
|
||||
#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS)))
|
||||
#define FD_ZERO(p) memset((void*)(p), 0, sizeof(*(p)))
|
||||
#define FD_ZERO(p) rt_memset((void*)(p), 0, sizeof(*(p)))
|
||||
#endif /* _SYS_TYPES_FD_SET */
|
||||
|
||||
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
|
@ -1,15 +0,0 @@
|
||||
# RT-Thread building script for bridge
|
||||
|
||||
import os
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
objs = []
|
||||
list = os.listdir(cwd)
|
||||
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
objs = objs + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
Return('objs')
|
@ -1,20 +0,0 @@
|
||||
from shutil import copy
|
||||
from building import *
|
||||
from gcc import *
|
||||
Import('rtconfig')
|
||||
|
||||
src = []
|
||||
cwd = GetCurrentDir()
|
||||
CPPPATH = [cwd]
|
||||
group = []
|
||||
|
||||
# sys/select.h does not exist in newlib 2.2.0 or lower version
|
||||
if rtconfig.PLATFORM == 'gcc' and (CheckHeader(rtconfig, 'sys/select.h') == False):
|
||||
try:
|
||||
copy("../../../../common/nogcc/sys/select.h", "./sys/select.h") # copy from 'nogcc/sys/select.h'
|
||||
except:
|
||||
pass
|
||||
|
||||
group = DefineGroup('Compiler', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
@ -1,2 +0,0 @@
|
||||
Newlib 2.2.0 or lower version does not provide `sys/select.h`, and `fd_set` is defined in `sys/types.h`. It will be generated by scons automatically, and **DO NOT** change it.
|
||||
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-07-21 Meco Man The first version
|
||||
*/
|
||||
|
||||
#ifndef __SYS_SELECT_H__
|
||||
#define __SYS_SELECT_H__
|
||||
|
||||
#include <rtconfig.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
|
||||
#ifndef FD_SETSIZE
|
||||
#define FD_SETSIZE 32
|
||||
#endif
|
||||
|
||||
#ifdef SAL_USING_POSIX
|
||||
#ifdef FD_SETSIZE
|
||||
#undef FD_SETSIZE
|
||||
#endif
|
||||
#define FD_SETSIZE DFS_FD_MAX
|
||||
#endif /* SAL_USING_POSIX */
|
||||
|
||||
typedef long fd_mask;
|
||||
|
||||
#ifndef _WIN32
|
||||
#ifndef _SYS_TYPES_FD_SET /* MIPS */
|
||||
|
||||
#define NBBY 8 /* number of bits in a byte */
|
||||
#define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */
|
||||
#ifndef howmany
|
||||
#define howmany(x,y) (((x)+((y)-1))/(y))
|
||||
#endif
|
||||
|
||||
typedef struct _types_fd_set {
|
||||
fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
|
||||
} _types_fd_set;
|
||||
#define fd_set _types_fd_set
|
||||
|
||||
#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS)))
|
||||
#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS)))
|
||||
#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS)))
|
||||
#define FD_ZERO(p) memset((void*)(p), 0, sizeof(*(p)))
|
||||
#endif /* _SYS_TYPES_FD_SET */
|
||||
|
||||
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#endif /* __SYS_SELECT_H__ */
|
Loading…
x
Reference in New Issue
Block a user