diff options
author | kib <kib@FreeBSD.org> | 2017-04-23 20:32:46 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2017-04-23 20:32:46 +0000 |
commit | bc743032ad67f907e01ab07b89fa2c5417004333 (patch) | |
tree | 0d47e469cd483a5664a7e6aa1e11d412c4523637 /sys/sys | |
parent | 240392415ab16d458302b3fdfead83d6cfa884e1 (diff) | |
download | FreeBSD-src-bc743032ad67f907e01ab07b89fa2c5417004333.zip FreeBSD-src-bc743032ad67f907e01ab07b89fa2c5417004333.tar.gz |
MFC r316213:
Implement the memset_s(3) function as specified by the C11 ISO/IEC
9899:2011 Appendix K 3.7.4.1.
MFC r316258:
Only activate __EXT1_VISIBLE block when using sys/errno.h in userspace.
Diffstat (limited to 'sys/sys')
-rw-r--r-- | sys/sys/cdefs.h | 14 | ||||
-rw-r--r-- | sys/sys/errno.h | 10 | ||||
-rw-r--r-- | sys/sys/stdint.h | 7 |
3 files changed, 31 insertions, 0 deletions
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 8027d33..7455e8e 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -758,24 +758,38 @@ #define __XSI_VISIBLE 0 #define __BSD_VISIBLE 0 #define __ISO_C_VISIBLE 1990 +#define __EXT1_VISIBLE 0 #elif defined(_C99_SOURCE) /* Localism to specify strict C99 env. */ #define __POSIX_VISIBLE 0 #define __XSI_VISIBLE 0 #define __BSD_VISIBLE 0 #define __ISO_C_VISIBLE 1999 +#define __EXT1_VISIBLE 0 #elif defined(_C11_SOURCE) /* Localism to specify strict C11 env. */ #define __POSIX_VISIBLE 0 #define __XSI_VISIBLE 0 #define __BSD_VISIBLE 0 #define __ISO_C_VISIBLE 2011 +#define __EXT1_VISIBLE 0 #else /* Default environment: show everything. */ #define __POSIX_VISIBLE 200809 #define __XSI_VISIBLE 700 #define __BSD_VISIBLE 1 #define __ISO_C_VISIBLE 2011 +#define __EXT1_VISIBLE 1 #endif #endif +/* User override __EXT1_VISIBLE */ +#if defined(__STDC_WANT_LIB_EXT1__) +#undef __EXT1_VISIBLE +#if __STDC_WANT_LIB_EXT1__ +#define __EXT1_VISIBLE 1 +#else +#define __EXT1_VISIBLE 0 +#endif +#endif /* __STDC_WANT_LIB_EXT1__ */ + #if defined(__mips) || defined(__powerpc64__) || defined(__riscv__) #define __NO_TLS 1 #endif diff --git a/sys/sys/errno.h b/sys/sys/errno.h index b6056d2..5f9df4d 100644 --- a/sys/sys/errno.h +++ b/sys/sys/errno.h @@ -193,4 +193,14 @@ __END_DECLS #define ERELOOKUP (-5) /* retry the directory lookup */ #endif +#ifndef _KERNEL +#if __EXT1_VISIBLE +/* ISO/IEC 9899:2011 K.3.2.2 */ +#ifndef _ERRNO_T_DEFINED +#define _ERRNO_T_DEFINED +typedef int errno_t; +#endif +#endif /* __EXT1_VISIBLE */ +#endif + #endif diff --git a/sys/sys/stdint.h b/sys/sys/stdint.h index ec3698b..e3d696b 100644 --- a/sys/sys/stdint.h +++ b/sys/sys/stdint.h @@ -66,4 +66,11 @@ typedef __uint_fast64_t uint_fast64_t; #define WCHAR_MIN __WCHAR_MIN #define WCHAR_MAX __WCHAR_MAX +#if __EXT1_VISIBLE +/* ISO/IEC 9899:2011 K.3.4.4 */ +#ifndef RSIZE_MAX +#define RSIZE_MAX (SIZE_MAX >> 1) +#endif +#endif /* __EXT1_VISIBLE */ + #endif /* !_SYS_STDINT_H_ */ |