diff options
| author | 孙冬梅 <[email protected]> | 2018-03-10 18:33:45 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-03-10 18:33:45 +0800 |
| commit | 6e987b2350badd1777454b7324fc88d3275407d6 (patch) | |
| tree | 1bbd5fc2cdaff0719d76122c91e0e736bf3f8116 /include/libc | |
| parent | 351f15be4bdf575789be2e1d74934e830bd60554 (diff) | |
| parent | 5534bab89ee767757a451b2efeb5341c1fb74872 (diff) | |
Merge pull request #2 from RT-Thread/master
update form origin
Diffstat (limited to 'include/libc')
| -rw-r--r-- | include/libc/libc_fcntl.h | 42 | ||||
| -rw-r--r-- | include/libc/libc_signal.h | 38 |
2 files changed, 57 insertions, 23 deletions
diff --git a/include/libc/libc_fcntl.h b/include/libc/libc_fcntl.h index f8dd66c7fd..7c5a075a97 100644 --- a/include/libc/libc_fcntl.h +++ b/include/libc/libc_fcntl.h @@ -1,6 +1,28 @@ /* - * fcntl.h file in libc - */ + * File : libc_fcntl.h + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2017 - 2018, RT-Thread Development Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Change Logs: + * Date Author Notes + * 2018-02-07 Bernard Add O_DIRECTORY definition in NEWLIB mode. + * 2018-02-09 Bernard Add O_BINARY definition + */ + #ifndef LIBC_FCNTL_H__ #define LIBC_FCNTL_H__ @@ -8,11 +30,10 @@ #include <fcntl.h> #ifndef O_NONBLOCK -#define O_NONBLOCK 04000 +#define O_NONBLOCK 0x4000 #endif #if defined(_WIN32) -#define O_DIRECTORY 0200000 #define O_ACCMODE (_O_RDONLY | _O_WRONLY | _O_RDWR) #endif @@ -23,6 +44,18 @@ #define F_SETFL 4 #endif +#ifndef O_DIRECTORY +#define O_DIRECTORY 0x200000 +#endif + +#ifndef O_BINARY +#ifdef _O_BINARY +#define O_BINARY _O_BINARY +#else +#define O_BINARY 0 +#endif +#endif + #else #define O_RDONLY 00 #define O_WRONLY 01 @@ -77,4 +110,3 @@ #endif #endif - diff --git a/include/libc/libc_signal.h b/include/libc/libc_signal.h index cc4552f990..dabcad1a34 100644 --- a/include/libc/libc_signal.h +++ b/include/libc/libc_signal.h @@ -30,6 +30,7 @@ extern "C" { #endif +#ifndef HAVE_SYS_SIGNALS /* Signal Generation and Delivery, P1003.1b-1993, p. 63 NOTE: P1003.1c/D10, p. 34 adds sigev_notify_function and sigev_notify_attributes to the sigevent structure. */ @@ -59,14 +60,15 @@ struct siginfo union sigval si_value; }; typedef struct siginfo siginfo_t; +#endif -#define SI_USER 0x01 /* Signal sent by kill(). */ -#define SI_QUEUE 0x02 /* Signal sent by sigqueue(). */ -#define SI_TIMER 0x03 /* Signal generated by expiration of a +#define SI_USER 0x01 /* Signal sent by kill(). */ +#define SI_QUEUE 0x02 /* Signal sent by sigqueue(). */ +#define SI_TIMER 0x03 /* Signal generated by expiration of a timer set by timer_settime(). */ -#define SI_ASYNCIO 0x04 /* Signal generated by completion of an - asynchronous I/O request. */ -#define SI_MESGQ 0x05 /* Signal generated by arrival of a +#define SI_ASYNCIO 0x04 /* Signal generated by completion of an + asynchronous I/O request. */ +#define SI_MESGQ 0x05 /* Signal generated by arrival of a message on an empty message queue. */ #ifdef RT_USING_NEWLIB @@ -107,17 +109,17 @@ typedef unsigned long sigset_t; #define SIGRTMAX 31 #define NSIG 32 -#define SIG_SETMASK 0 /* set mask with sigprocmask() */ -#define SIG_BLOCK 1 /* set of signals to block */ -#define SIG_UNBLOCK 2 /* set of signals to, well, unblock */ +#define SIG_SETMASK 0 /* set mask with sigprocmask() */ +#define SIG_BLOCK 1 /* set of signals to block */ +#define SIG_UNBLOCK 2 /* set of signals to, well, unblock */ typedef void (*_sig_func_ptr)(int); struct sigaction { - _sig_func_ptr sa_handler; - sigset_t sa_mask; - int sa_flags; + _sig_func_ptr sa_handler; + sigset_t sa_mask; + int sa_flags; }; #define sigaddset(what,sig) (*(what) |= (1<<(sig)), 0) @@ -163,17 +165,17 @@ typedef unsigned long sigset_t; #define SIGRTMAX 31 #define NSIG 32 -#define SIG_SETMASK 0 /* set mask with sigprocmask() */ -#define SIG_BLOCK 1 /* set of signals to block */ -#define SIG_UNBLOCK 2 /* set of signals to, well, unblock */ +#define SIG_SETMASK 0 /* set mask with sigprocmask() */ +#define SIG_BLOCK 1 /* set of signals to block */ +#define SIG_UNBLOCK 2 /* set of signals to, well, unblock */ typedef void (*_sig_func_ptr)(int); struct sigaction { - _sig_func_ptr sa_handler; - sigset_t sa_mask; - int sa_flags; + _sig_func_ptr sa_handler; + sigset_t sa_mask; + int sa_flags; }; #define sigaddset(what,sig) (*(what) |= (1<<(sig)), 0) |
