From 92c62a8fab541a89aa5d37d15d43864ca072dd13 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sat, 11 Sep 2021 11:25:43 -0400 Subject: 标准化 弱化 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/compilers/common/poll.h | 40 +++++++++++++++++++++++++++++ components/libc/compilers/common/sys/time.h | 6 ++--- 2 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 components/libc/compilers/common/poll.h (limited to 'components/libc/compilers/common') diff --git a/components/libc/compilers/common/poll.h b/components/libc/compilers/common/poll.h new file mode 100644 index 0000000000..1862373559 --- /dev/null +++ b/components/libc/compilers/common/poll.h @@ -0,0 +1,40 @@ +#ifndef __POLL_H__ +#define __POLL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(POLLIN) && !defined(POLLOUT) +#define POLLIN (0x01) +#define POLLRDNORM (0x01) +#define POLLRDBAND (0x01) +#define POLLPRI (0x01) + +#define POLLOUT (0x02) +#define POLLWRNORM (0x02) +#define POLLWRBAND (0x02) + +#define POLLERR (0x04) +#define POLLHUP (0x08) +#define POLLNVAL (0x10) + +typedef unsigned int nfds_t; + +struct pollfd +{ + int fd; + short events; + short revents; +}; +#endif /* !defined(POLLIN) && !defined(POLLOUT) */ + +#define POLLMASK_DEFAULT (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM) + +int poll(struct pollfd *fds, nfds_t nfds, int timeout); + +#ifdef __cplusplus +} +#endif + +#endif /* __POLL_H__ */ diff --git a/components/libc/compilers/common/sys/time.h b/components/libc/compilers/common/sys/time.h index c2320429e0..9d4422e17a 100644 --- a/components/libc/compilers/common/sys/time.h +++ b/components/libc/compilers/common/sys/time.h @@ -8,8 +8,8 @@ * 2020-09-07 Meco Man combine gcc armcc iccarm * 2021-02-12 Meco Man move all definitions located in to this file */ -#ifndef _SYS_TIME_H_ -#define _SYS_TIME_H_ +#ifndef __SYS_TIME_H__ +#define __SYS_TIME_H__ #include #include @@ -73,7 +73,7 @@ struct timespec { }; #endif -/* posix clock and timer */ +/* POSIX clock and timer */ #define MILLISECOND_PER_SECOND 1000UL #define MICROSECOND_PER_SECOND 1000000UL #define NANOSECOND_PER_SECOND 1000000000UL -- cgit v1.3.1