diff options
author | sjg <sjg@FreeBSD.org> | 2013-09-05 20:18:59 +0000 |
---|---|---|
committer | sjg <sjg@FreeBSD.org> | 2013-09-05 20:18:59 +0000 |
commit | 62bb1062226d3ce6a2350808256a25508978352d (patch) | |
tree | 22b131dceb13c3df96da594fbaadb693504797c7 /include | |
parent | 72ab90509b3a51ab361bf710338f2ef44a4e360d (diff) | |
parent | 04932445481c2cb89ff69a83b961bdef3d64757e (diff) | |
download | FreeBSD-src-62bb1062226d3ce6a2350808256a25508978352d.zip FreeBSD-src-62bb1062226d3ce6a2350808256a25508978352d.tar.gz |
Merge from head
Diffstat (limited to 'include')
-rw-r--r-- | include/Makefile | 31 | ||||
-rw-r--r-- | include/arpa/tftp.h | 2 | ||||
-rw-r--r-- | include/complex.h | 24 | ||||
-rw-r--r-- | include/dirent.h | 1 | ||||
-rw-r--r-- | include/fts.h | 18 | ||||
-rw-r--r-- | include/gssapi/gssapi.h | 27 | ||||
-rw-r--r-- | include/iconv.h | 43 | ||||
-rw-r--r-- | include/ifaddrs.h | 2 | ||||
-rw-r--r-- | include/malloc_np.h | 12 | ||||
-rw-r--r-- | include/paths.h | 2 | ||||
-rw-r--r-- | include/protocols/rwhod.h | 4 | ||||
-rw-r--r-- | include/rpcsvc/ypxfrd.x | 2 | ||||
-rw-r--r-- | include/stdatomic.h | 327 | ||||
-rw-r--r-- | include/stdlib.h | 18 | ||||
-rw-r--r-- | include/stringlist.h | 2 | ||||
-rw-r--r-- | include/tgmath.h | 3 | ||||
-rw-r--r-- | include/uchar.h | 67 | ||||
-rw-r--r-- | include/unistd.h | 2 | ||||
-rw-r--r-- | include/xlocale/Makefile | 2 | ||||
-rw-r--r-- | include/xlocale/_uchar.h | 46 |
20 files changed, 261 insertions, 374 deletions
diff --git a/include/Makefile b/include/Makefile index 87de693..d755693 100644 --- a/include/Makefile +++ b/include/Makefile @@ -19,11 +19,11 @@ INCS= a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \ printf.h proc_service.h pthread.h \ pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h \ res_update.h resolv.h runetype.h search.h semaphore.h setjmp.h \ - signal.h spawn.h stab.h stdalign.h stdatomic.h stdbool.h stddef.h \ + signal.h spawn.h stab.h stdalign.h stdbool.h stddef.h \ stdnoreturn.h stdio.h stdlib.h string.h stringlist.h \ strings.h sysexits.h tar.h termios.h tgmath.h \ time.h timeconv.h timers.h ttyent.h \ - ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h \ + uchar.h ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h \ wchar.h wctype.h wordexp.h xlocale.h .PATH: ${.CURDIR}/../contrib/libc-vis @@ -33,11 +33,11 @@ MHDRS= float.h floatingpoint.h stdarg.h PHDRS= sched.h _semaphore.h -LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \ - ucontext.h +LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ + syslog.h ucontext.h LDIRS= bsm cam geom net net80211 netatalk netgraph netinet netinet6 \ - netipsec ${_netipx} netnatm \ + netipsec ${_netipx} netnatm netsmb \ nfs nfsclient nfsserver \ sys vm @@ -48,7 +48,7 @@ LSUBDIRS= cam/ata cam/scsi \ dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \ fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ - fs/procfs fs/udf fs/unionfs \ + fs/procfs fs/smbfs fs/udf fs/unionfs \ geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ geom/mirror geom/mountver geom/multipath geom/nop \ geom/raid geom/raid3 geom/shsec geom/stripe geom/virstor \ @@ -72,18 +72,29 @@ _dev_ieee488= dev/ieee488 INCS+= hesiod.h .endif -.if ${MK_ICONV} != "no" -INCS+= iconv.h -.endif - .if ${MK_BLUETOOTH} != "no" LSUBSUBDIRS+= netgraph/bluetooth/include .endif +# XXX unconditionally needed by <netsmb/netbios.h> #.if ${MK_IPX} != "no" _netipx= netipx #.endif +# Handle the #define aliases for libiconv +.if ${MK_ICONV} == "yes" +CLEANFILES+= _libiconv_compat.h +INCS+= _libiconv_compat.h iconv.h +_libiconv_compat.h: ${.CURDIR}/Makefile + echo "/* Indicate whether libiconv symbols are present */" > _libiconv_compat.h +.if ${MK_LIBICONV_COMPAT} == "yes" + echo "#define __LIBICONV_COMPAT" >> _libiconv_compat.h +.else + echo "#undef __LIBICONV_COMPAT" >> _libiconv_compat.h +.endif +.endif + + # Define SHARED to indicate whether you want symbolic links to the system # source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is # probably only useful for developers and should be avoided if you do not diff --git a/include/arpa/tftp.h b/include/arpa/tftp.h index 5c2a4c7..20733ec 100644 --- a/include/arpa/tftp.h +++ b/include/arpa/tftp.h @@ -33,6 +33,8 @@ #ifndef _ARPA_TFTP_H_ #define _ARPA_TFTP_H_ +#include <sys/cdefs.h> + /* * Trivial File Transfer Protocol (IEN-133) */ diff --git a/include/complex.h b/include/complex.h index 0702541..4811255 100644 --- a/include/complex.h +++ b/include/complex.h @@ -46,14 +46,38 @@ _Static_assert(__generic(_Complex_I, float _Complex, 1, 0), #define complex _Complex #define I _Complex_I +#if __ISO_C_VISIBLE >= 2011 +#ifdef __clang__ +#define CMPLX(x, y) ((double complex){ x, y }) +#define CMPLXF(x, y) ((float complex){ x, y }) +#define CMPLXL(x, y) ((long double complex){ x, y }) +#elif __GNUC_PREREQ__(4, 7) +#define CMPLX(x, y) __builtin_complex((double)(x), (double)(y)) +#define CMPLXF(x, y) __builtin_complex((float)(x), (float)(y)) +#define CMPLXL(x, y) __builtin_complex((long double)(x), (long double)(y)) +#endif +#endif /* __ISO_C_VISIBLE >= 2011 */ + __BEGIN_DECLS double cabs(double complex); float cabsf(float complex); long double cabsl(long double complex); +double complex cacos(double complex); +float complex cacosf(float complex); +double complex cacosh(double complex); +float complex cacoshf(float complex); double carg(double complex); float cargf(float complex); long double cargl(long double complex); +double complex casin(double complex); +float complex casinf(float complex); +double complex casinh(double complex); +float complex casinhf(float complex); +double complex catan(double complex); +float complex catanf(float complex); +double complex catanh(double complex); +float complex catanhf(float complex); double complex ccos(double complex); float complex ccosf(float complex); double complex ccosh(double complex); diff --git a/include/dirent.h b/include/dirent.h index 941a977..d0b0a9a 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -79,6 +79,7 @@ int dirfd(DIR *); #endif #if __BSD_VISIBLE DIR *__opendir2(const char *, int); +int fdclosedir(DIR *); int getdents(int, char *, int); int getdirentries(int, char *, int, long *); #endif diff --git a/include/fts.h b/include/fts.h index a679ea6..f453e2b 100644 --- a/include/fts.h +++ b/include/fts.h @@ -33,15 +33,17 @@ #ifndef _FTS_H_ #define _FTS_H_ +#include <sys/_types.h> + typedef struct { struct _ftsent *fts_cur; /* current node */ struct _ftsent *fts_child; /* linked list of children */ struct _ftsent **fts_array; /* sort array */ - dev_t fts_dev; /* starting device # */ + __dev_t fts_dev; /* starting device # */ char *fts_path; /* path for this descent */ int fts_rfd; /* fd for root */ - size_t fts_pathlen; /* sizeof(path) */ - size_t fts_nitems; /* elements in the sort array */ + __size_t fts_pathlen; /* sizeof(path) */ + __size_t fts_nitems; /* elements in the sort array */ int (*fts_compar) /* compare function */ (const struct _ftsent * const *, const struct _ftsent * const *); @@ -72,12 +74,12 @@ typedef struct _ftsent { char *fts_path; /* root path */ int fts_errno; /* errno for this node */ int fts_symfd; /* fd for symlink */ - size_t fts_pathlen; /* strlen(fts_path) */ - size_t fts_namelen; /* strlen(fts_name) */ + __size_t fts_pathlen; /* strlen(fts_path) */ + __size_t fts_namelen; /* strlen(fts_name) */ - ino_t fts_ino; /* inode */ - dev_t fts_dev; /* device */ - nlink_t fts_nlink; /* link count */ + __ino_t fts_ino; /* inode */ + __dev_t fts_dev; /* device */ + __nlink_t fts_nlink; /* link count */ #define FTS_ROOTPARENTLEVEL -1 #define FTS_ROOTLEVEL 0 diff --git a/include/gssapi/gssapi.h b/include/gssapi/gssapi.h index 032e784..bd2722c 100644 --- a/include/gssapi/gssapi.h +++ b/include/gssapi/gssapi.h @@ -44,6 +44,33 @@ typedef __ssize_t ssize_t; #define _SSIZE_T_DECLARED #endif +/* Compatibility with Heimdal 1.5.1 */ +#ifndef GSSAPI_CPP_START +#ifdef __cplusplus +#define GSSAPI_CPP_START extern "C" { +#define GSSAPI_CPP_END } +#else +#define GSSAPI_CPP_START +#define GSSAPI_CPP_END +#endif +#endif + +/* Compatibility with Heimdal 1.5.1 */ +#ifndef BUILD_GSSAPI_LIB +#define GSSAPI_LIB_FUNCTION +#define GSSAPI_LIB_CALL +#define GSSAPI_LIB_VARIABLE +#endif + +/* Compatibility with Heimdal 1.5.1 */ +#ifndef GSSAPI_DEPRECATED_FUNCTION +#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1 ))) +#define GSSAPI_DEPRECATED_FUNCTION(X) __attribute__((deprecated)) +#else +#define GSSAPI_DEPRECATED_FUNCTION(X) +#endif +#endif + #if 0 /* * If the platform supports the xom.h header file, it should be diff --git a/include/iconv.h b/include/iconv.h index eecb2fd..3423a24 100644 --- a/include/iconv.h +++ b/include/iconv.h @@ -41,46 +41,57 @@ #include <sys/cdefs.h> #include <sys/types.h> -#define iconv_open libiconv_open -#define iconv_close libiconv_close -#define iconv(cd, in, insize, out, outsize) libiconv(cd, __DECONST(char **, in), insize, out, outsize) -#define iconv_t libiconv_t +#include <_libiconv_compat.h> +#ifdef __LIBICONV_COMPAT +#define libiconv_open iconv_open +#define libiconv_close iconv_close +#define libiconv iconv +#define libiconv_t iconv_t +#endif struct __tag_iconv_t; typedef struct __tag_iconv_t *iconv_t; __BEGIN_DECLS -iconv_t libiconv_open(const char *, const char *); -size_t libiconv(iconv_t, char ** __restrict, - size_t * __restrict, char ** __restrict, - size_t * __restrict); -int libiconv_close(iconv_t); +iconv_t iconv_open(const char *, const char *); +size_t iconv(iconv_t, const char ** __restrict, + size_t * __restrict, char ** __restrict, + size_t * __restrict); +int iconv_close(iconv_t); /* * non-portable interfaces for iconv */ int __iconv_get_list(char ***, size_t *, bool); void __iconv_free_list(char **, size_t); -size_t __iconv(iconv_t, char **, size_t *, char **, +size_t __iconv(iconv_t, const char **, size_t *, char **, size_t *, __uint32_t, size_t *); #define __ICONV_F_HIDE_INVALID 0x0001 /* * GNU interfaces for iconv */ -#define iconv_open_into libiconv_open_into -#define iconvctl libiconvctl -#define iconvlist libiconvlist +#ifdef __LIBICONV_COMPAT +#define libiconv_open_into iconv_open_into +#define libiconvctl iconvctl +#define libiconvlist iconvlist +#define libiconv_set_relocation_prefix iconv_set_relocation_prefix +#endif /* We have iconvctl() */ -#define _LIBICONV_VERSION 0x0108 -extern int _libiconv_version; +#define _ICONV_VERSION 0x0108 +extern int _iconv_version; + +#ifdef __LIBICONV_COMPAT +#define _libiconv_version _iconv_version +#define _LIBICONV_VERSION _ICONV_VERSION +#endif typedef struct { void *spaceholder[64]; } iconv_allocation_t; int iconv_open_into(const char *, const char *, iconv_allocation_t *); -void libiconv_set_relocation_prefix (const char *orig_prefix, +void iconv_set_relocation_prefix(const char *orig_prefix, const char *curr_prefix); /* diff --git a/include/ifaddrs.h b/include/ifaddrs.h index f0911a4..e768d50 100644 --- a/include/ifaddrs.h +++ b/include/ifaddrs.h @@ -31,7 +31,7 @@ struct ifaddrs { struct ifaddrs *ifa_next; char *ifa_name; - u_int ifa_flags; + unsigned int ifa_flags; struct sockaddr *ifa_addr; struct sockaddr *ifa_netmask; struct sockaddr *ifa_dstaddr; diff --git a/include/malloc_np.h b/include/malloc_np.h index e130552..77efd47 100644 --- a/include/malloc_np.h +++ b/include/malloc_np.h @@ -61,6 +61,18 @@ int rallocm(void **ptr, size_t *rsize, size_t size, size_t extra, int sallocm(const void *ptr, size_t *rsize, int flags) __nonnull(1); int dallocm(void *ptr, int flags) __nonnull(1); int nallocm(size_t *rsize, size_t size, int flags); + +void * __calloc(size_t, size_t) __malloc_like; +void * __malloc(size_t) __malloc_like; +void * __realloc(void *, size_t); +void __free(void *); +int __posix_memalign(void **, size_t, size_t); +size_t __malloc_usable_size(const void *); +int __allocm(void **, size_t *, size_t, int) __nonnull(1); +int __rallocm(void **, size_t *, size_t, size_t, int) __nonnull(1); +int __sallocm(const void *, size_t *, int) __nonnull(1); +int __dallocm(void *, int) __nonnull(1); +int __nallocm(size_t *, size_t, int); __END_DECLS #endif /* _MALLOC_NP_H_ */ diff --git a/include/paths.h b/include/paths.h index c96f37c..c0a99a5 100644 --- a/include/paths.h +++ b/include/paths.h @@ -57,6 +57,8 @@ #define _PATH_ETC "/etc" #define _PATH_FTPUSERS "/etc/ftpusers" #define _PATH_FWMEM "/dev/fwmem" +#define _PATH_GBDE "/sbin/gbde" +#define _PATH_GELI "/sbin/geli" #define _PATH_HALT "/sbin/halt" #ifdef COMPAT_32BIT #define _PATH_I18NMODULE "/usr/lib32/i18n" diff --git a/include/protocols/rwhod.h b/include/protocols/rwhod.h index f63bf76..49191a2 100644 --- a/include/protocols/rwhod.h +++ b/include/protocols/rwhod.h @@ -34,13 +34,15 @@ #ifndef _PROTOCOLS_RWHOD_H_ #define _PROTOCOLS_RWHOD_H_ +#include <sys/_types.h> + /* * rwho protocol packet format. */ struct outmp { char out_line[8]; /* tty name */ char out_name[8]; /* user id */ - int32_t out_time; /* time on */ + __int32_t out_time; /* time on */ }; struct whod { diff --git a/include/rpcsvc/ypxfrd.x b/include/rpcsvc/ypxfrd.x index 6a76768..7efab3d 100644 --- a/include/rpcsvc/ypxfrd.x +++ b/include/rpcsvc/ypxfrd.x @@ -75,7 +75,7 @@ const _YPMAXDOMAIN = 64; const _YPMAXMAP = 64; const _YPMAXPEER = 64; -/* Suggested default -- not necesarrily the one used. */ +/* Suggested default -- not necessarily the one used. */ const YPXFRBLOCK = 32767; /* diff --git a/include/stdatomic.h b/include/stdatomic.h deleted file mode 100644 index 44f73b5..0000000 --- a/include/stdatomic.h +++ /dev/null @@ -1,327 +0,0 @@ -/*- - * Copyright (c) 2011 Ed Schouten <ed@FreeBSD.org> - * David Chisnall <theraven@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _STDATOMIC_H_ -#define _STDATOMIC_H_ - -#include <sys/cdefs.h> -#include <sys/_types.h> - -#if __has_extension(c_atomic) || __has_extension(cxx_atomic) -#define __CLANG_ATOMICS -#elif __GNUC_PREREQ__(4, 7) -#define __GNUC_ATOMICS -#elif !defined(__GNUC__) -#error "stdatomic.h does not support your compiler" -#endif - -#if !defined(__CLANG_ATOMICS) -#define _Atomic(T) struct { volatile T __val; } -#endif - -/* - * 7.17.2 Initialization. - */ - -#if defined(__CLANG_ATOMICS) -#define ATOMIC_VAR_INIT(value) (value) -#define atomic_init(obj, value) __c11_atomic_init(obj, value) -#else -#define ATOMIC_VAR_INIT(value) { .__val = (value) } -#define atomic_init(obj, value) ((void)((obj)->__val = (value))) -#endif - -/* - * Clang and recent GCC both provide predefined macros for the memory - * orderings. If we are using a compiler that doesn't define them, use the - * clang values - these will be ignored in the fallback path. - */ - -#ifndef __ATOMIC_RELAXED -#define __ATOMIC_RELAXED 0 -#endif -#ifndef __ATOMIC_CONSUME -#define __ATOMIC_CONSUME 1 -#endif -#ifndef __ATOMIC_ACQUIRE -#define __ATOMIC_ACQUIRE 2 -#endif -#ifndef __ATOMIC_RELEASE -#define __ATOMIC_RELEASE 3 -#endif -#ifndef __ATOMIC_ACQ_REL -#define __ATOMIC_ACQ_REL 4 -#endif -#ifndef __ATOMIC_SEQ_CST -#define __ATOMIC_SEQ_CST 5 -#endif - -/* - * 7.17.3 Order and consistency. - * - * The memory_order_* constants that denote the barrier behaviour of the - * atomic operations. - */ - -enum memory_order { - memory_order_relaxed = __ATOMIC_RELAXED, - memory_order_consume = __ATOMIC_CONSUME, - memory_order_acquire = __ATOMIC_ACQUIRE, - memory_order_release = __ATOMIC_RELEASE, - memory_order_acq_rel = __ATOMIC_ACQ_REL, - memory_order_seq_cst = __ATOMIC_SEQ_CST -}; - -/* - * 7.17.4 Fences. - */ - -#ifdef __CLANG_ATOMICS -#define atomic_thread_fence(order) __c11_atomic_thread_fence(order) -#define atomic_signal_fence(order) __c11_atomic_signal_fence(order) -#elif defined(__GNUC_ATOMICS) -#define atomic_thread_fence(order) __atomic_thread_fence(order) -#define atomic_signal_fence(order) __atomic_signal_fence(order) -#else -#define atomic_thread_fence(order) ((void)(order), __sync_synchronize()) -#define atomic_signal_fence(order) __extension__ ({ \ - (void)(order); \ - __asm volatile ("" ::: "memory"); \ - (void)0; \ -}) -#endif - -/* - * 7.17.5 Lock-free property. - */ - -#if defined(__CLANG_ATOMICS) || defined(__GNUC_ATOMICS) -#define atomic_is_lock_free(obj) \ - __atomic_is_lock_free(sizeof((obj)->__val), &(obj)->val) -#else -#define atomic_is_lock_free(obj) \ - ((void)(obj), sizeof((obj)->__val) <= sizeof(void *)) -#endif - -/* - * 7.17.6 Atomic integer types. - */ - -typedef _Atomic(_Bool) atomic_bool; -typedef _Atomic(char) atomic_char; -typedef _Atomic(signed char) atomic_schar; -typedef _Atomic(unsigned char) atomic_uchar; -typedef _Atomic(short) atomic_short; -typedef _Atomic(unsigned short) atomic_ushort; -typedef _Atomic(int) atomic_int; -typedef _Atomic(unsigned int) atomic_uint; -typedef _Atomic(long) atomic_long; -typedef _Atomic(unsigned long) atomic_ulong; -typedef _Atomic(long long) atomic_llong; -typedef _Atomic(unsigned long long) atomic_ullong; -#if 0 -typedef _Atomic(__char16_t) atomic_char16_t; -typedef _Atomic(__char32_t) atomic_char32_t; -#endif -typedef _Atomic(__wchar_t) atomic_wchar_t; -typedef _Atomic(__int_least8_t) atomic_int_least8_t; -typedef _Atomic(__uint_least8_t) atomic_uint_least8_t; -typedef _Atomic(__int_least16_t) atomic_int_least16_t; -typedef _Atomic(__uint_least16_t) atomic_uint_least16_t; -typedef _Atomic(__int_least32_t) atomic_int_least32_t; -typedef _Atomic(__uint_least32_t) atomic_uint_least32_t; -typedef _Atomic(__int_least64_t) atomic_int_least64_t; -typedef _Atomic(__uint_least64_t) atomic_uint_least64_t; -typedef _Atomic(__int_fast8_t) atomic_int_fast8_t; -typedef _Atomic(__uint_fast8_t) atomic_uint_fast8_t; -typedef _Atomic(__int_fast16_t) atomic_int_fast16_t; -typedef _Atomic(__uint_fast16_t) atomic_uint_fast16_t; -typedef _Atomic(__int_fast32_t) atomic_int_fast32_t; -typedef _Atomic(__uint_fast32_t) atomic_uint_fast32_t; -typedef _Atomic(__int_fast64_t) atomic_int_fast64_t; -typedef _Atomic(__uint_fast64_t) atomic_uint_fast64_t; -typedef _Atomic(__intptr_t) atomic_intptr_t; -typedef _Atomic(__uintptr_t) atomic_uintptr_t; -typedef _Atomic(__size_t) atomic_size_t; -typedef _Atomic(__ptrdiff_t) atomic_ptrdiff_t; -typedef _Atomic(__intmax_t) atomic_intmax_t; -typedef _Atomic(__uintmax_t) atomic_uintmax_t; - -/* - * 7.17.7 Operations on atomic types. - */ - -/* - * Compiler-specific operations. - */ - -#if defined(__CLANG_ATOMICS) -#define atomic_compare_exchange_strong_explicit(object, expected, \ - desired, success, failure) \ - __c11_atomic_compare_exchange_strong(object, expected, desired, \ - success, failure) -#define atomic_compare_exchange_weak_explicit(object, expected, \ - desired, success, failure) \ - __c11_atomic_compare_exchange_weak(object, expected, desired, \ - success, failure) -#define atomic_exchange_explicit(object, desired, order) \ - __c11_atomic_exchange(object, desired, order) -#define atomic_fetch_add_explicit(object, operand, order) \ - __c11_atomic_fetch_add(object, operand, order) -#define atomic_fetch_and_explicit(object, operand, order) \ - __c11_atomic_fetch_and(object, operand, order) -#define atomic_fetch_or_explicit(object, operand, order) \ - __c11_atomic_fetch_or(object, operand, order) -#define atomic_fetch_sub_explicit(object, operand, order) \ - __c11_atomic_fetch_sub(object, operand, order) -#define atomic_fetch_xor_explicit(object, operand, order) \ - __c11_atomic_fetch_xor(object, operand, order) -#define atomic_load_explicit(object, order) \ - __c11_atomic_load(object, order) -#define atomic_store_explicit(object, desired, order) \ - __c11_atomic_store(object, desired, order) -#elif defined(__GNUC_ATOMICS) -#define atomic_compare_exchange_strong_explicit(object, expected, \ - desired, success, failure) \ - __atomic_compare_exchange_n(&(object)->__val, expected, \ - desired, 0, success, failure) -#define atomic_compare_exchange_weak_explicit(object, expected, \ - desired, success, failure) \ - __atomic_compare_exchange_n(&(object)->__val, expected, \ - desired, 1, success, failure) -#define atomic_exchange_explicit(object, desired, order) \ - __atomic_exchange_n(&(object)->__val, desired, order) -#define atomic_fetch_add_explicit(object, operand, order) \ - __atomic_fetch_add(&(object)->__val, operand, order) -#define atomic_fetch_and_explicit(object, operand, order) \ - __atomic_fetch_and(&(object)->__val, operand, order) -#define atomic_fetch_or_explicit(object, operand, order) \ - __atomic_fetch_or(&(object)->__val, operand, order) -#define atomic_fetch_sub_explicit(object, operand, order) \ - __atomic_fetch_sub(&(object)->__val, operand, order) -#define atomic_fetch_xor_explicit(object, operand, order) \ - __atomic_fetch_xor(&(object)->__val, operand, order) -#define atomic_load_explicit(object, order) \ - __atomic_load_n(&(object)->__val, order) -#define atomic_store_explicit(object, desired, order) \ - __atomic_store_n(&(object)->__val, desired, order) -#else -#define atomic_compare_exchange_strong_explicit(object, expected, \ - desired, success, failure) __extension__ ({ \ - __typeof__(expected) __ep = (expected); \ - __typeof__(*__ep) __e = *__ep; \ - (void)(success); (void)(failure); \ - (*__ep = __sync_val_compare_and_swap(&(object)->__val, \ - __e, desired)) == __e; \ -}) -#define atomic_compare_exchange_weak_explicit(object, expected, \ - desired, success, failure) \ - atomic_compare_exchange_strong_explicit(object, expected, \ - desired, success, failure) -#if __has_builtin(__sync_swap) -/* Clang provides a full-barrier atomic exchange - use it if available. */ -#define atomic_exchange_explicit(object, desired, order) \ - ((void)(order), __sync_swap(&(object)->__val, desired)) -#else -/* - * __sync_lock_test_and_set() is only an acquire barrier in theory (although in - * practice it is usually a full barrier) so we need an explicit barrier before - * it. - */ -#define atomic_exchange_explicit(object, desired, order) \ -__extension__ ({ \ - __typeof__(object) __o = (object); \ - __typeof__(desired) __d = (desired); \ - (void)(order); \ - __sync_synchronize(); \ - __sync_lock_test_and_set(&(__o)->__val, __d); \ -}) -#endif -#define atomic_fetch_add_explicit(object, operand, order) \ - ((void)(order), __sync_fetch_and_add(&(object)->__val, operand)) -#define atomic_fetch_and_explicit(object, operand, order) \ - ((void)(order), __sync_fetch_and_and(&(object)->__val, operand)) -#define atomic_fetch_or_explicit(object, operand, order) \ - ((void)(order), __sync_fetch_and_or(&(object)->__val, operand)) -#define atomic_fetch_sub_explicit(object, operand, order) \ - ((void)(order), __sync_fetch_and_sub(&(object)->__val, operand)) -#define atomic_fetch_xor_explicit(object, operand, order) \ - ((void)(order), __sync_fetch_and_xor(&(object)->__val, operand)) -#define atomic_load_explicit(object, order) \ - ((void)(order), __sync_fetch_and_add(&(object)->__val, 0)) -#define atomic_store_explicit(object, desired, order) \ - ((void)atomic_exchange_explicit(object, desired, order)) -#endif - -/* - * Convenience functions. - */ - -#define atomic_compare_exchange_strong(object, expected, desired) \ - atomic_compare_exchange_strong_explicit(object, expected, \ - desired, memory_order_seq_cst, memory_order_seq_cst) -#define atomic_compare_exchange_weak(object, expected, desired) \ - atomic_compare_exchange_weak_explicit(object, expected, \ - desired, memory_order_seq_cst, memory_order_seq_cst) -#define atomic_exchange(object, desired) \ - atomic_exchange_explicit(object, desired, memory_order_seq_cst) -#define atomic_fetch_add(object, operand) \ - atomic_fetch_add_explicit(object, operand, memory_order_seq_cst) -#define atomic_fetch_and(object, operand) \ - atomic_fetch_and_explicit(object, operand, memory_order_seq_cst) -#define atomic_fetch_or(object, operand) \ - atomic_fetch_or_explicit(object, operand, memory_order_seq_cst) -#define atomic_fetch_sub(object, operand) \ - atomic_fetch_sub_explicit(object, operand, memory_order_seq_cst) -#define atomic_fetch_xor(object, operand) \ - atomic_fetch_xor_explicit(object, operand, memory_order_seq_cst) -#define atomic_load(object) \ - atomic_load_explicit(object, memory_order_seq_cst) -#define atomic_store(object, desired) \ - atomic_store_explicit(object, desired, memory_order_seq_cst) - -/* - * 7.17.8 Atomic flag type and operations. - */ - -typedef atomic_bool atomic_flag; - -#define ATOMIC_FLAG_INIT ATOMIC_VAR_INIT(0) - -#define atomic_flag_clear_explicit(object, order) \ - atomic_store_explicit(object, 0, order) -#define atomic_flag_test_and_set_explicit(object, order) \ - atomic_compare_exchange_strong_explicit(object, 0, 1, order, order) - -#define atomic_flag_clear(object) \ - atomic_flag_clear_explicit(object, memory_order_seq_cst) -#define atomic_flag_test_and_set(object) \ - atomic_flag_test_and_set_explicit(object, memory_order_seq_cst) - -#endif /* !_STDATOMIC_H_ */ diff --git a/include/stdlib.h b/include/stdlib.h index b73a54f..93cf122 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -69,7 +69,7 @@ typedef struct { #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 -#define RAND_MAX 0x7fffffff +#define RAND_MAX 0x7ffffffd __BEGIN_DECLS #ifdef _XLOCALE_H_ @@ -161,14 +161,16 @@ _Noreturn void quick_exit(int); #endif /* __ISO_C_VISIBLE >= 2011 */ /* - * Extensions made by POSIX relative to C. We don't know yet which edition - * of POSIX made these extensions, so assume they've always been there until - * research can be done. + * Extensions made by POSIX relative to C. */ -#if __POSIX_VISIBLE /* >= ??? */ -int posix_memalign(void **, size_t, size_t); /* (ADV) */ -int rand_r(unsigned *); /* (TSF) */ +#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE char *realpath(const char * __restrict, char * __restrict); +#endif +#if __POSIX_VISIBLE >= 199506 +int rand_r(unsigned *); /* (TSF) */ +#endif +#if __POSIX_VISIBLE >= 200112 +int posix_memalign(void **, size_t, size_t); /* (ADV) */ int setenv(const char *, const char *, int); int unsetenv(const char *); #endif @@ -280,6 +282,8 @@ const char * int heapsort(void *, size_t, size_t, int (*)(const void *, const void *)); int l64a_r(long, char *, int); int mergesort(void *, size_t, size_t, int (*)(const void *, const void *)); +int mkostemp(char *, int); +int mkostemps(char *, int, int); void qsort_r(void *, size_t, size_t, void *, int (*)(void *, const void *, const void *)); int radixsort(const unsigned char **, int, const unsigned char *, diff --git a/include/stringlist.h b/include/stringlist.h index bae2a2c..d3154b3 100644 --- a/include/stringlist.h +++ b/include/stringlist.h @@ -51,7 +51,7 @@ __BEGIN_DECLS StringList *sl_init(void); int sl_add(StringList *, char *); void sl_free(StringList *, int); -char *sl_find(StringList *, char *); +char *sl_find(StringList *, const char *); __END_DECLS #endif /* _STRINGLIST_H */ diff --git a/include/tgmath.h b/include/tgmath.h index 9302302..7f4de6f 100644 --- a/include/tgmath.h +++ b/include/tgmath.h @@ -60,7 +60,8 @@ * compilers use an inefficient yet reliable version. */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ + __has_extension(c_generic_selections) #define __tg_generic(x, cfnl, cfn, cfnf, fnl, fn, fnf) \ _Generic(x, \ long double _Complex: cfnl, \ diff --git a/include/uchar.h b/include/uchar.h new file mode 100644 index 0000000..a3fd4fd --- /dev/null +++ b/include/uchar.h @@ -0,0 +1,67 @@ +/*- + * Copyright (c) 2013 Ed Schouten <ed@FreeBSD.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _UCHAR_H_ +#define _UCHAR_H_ + +#include <sys/cdefs.h> +#include <sys/_types.h> + +#ifndef _CHAR16_T_DECLARED +typedef __char16_t char16_t; +#define _CHAR16_T_DECLARED +#endif + +#ifndef _CHAR32_T_DECLARED +typedef __char32_t char32_t; +#define _CHAR32_T_DECLARED +#endif + +#ifndef _MBSTATE_T_DECLARED +typedef __mbstate_t mbstate_t; +#define _MBSTATE_T_DECLARED +#endif + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +__BEGIN_DECLS +size_t c16rtomb(char * __restrict, char16_t, mbstate_t * __restrict); +size_t c32rtomb(char * __restrict, char32_t, mbstate_t * __restrict); +size_t mbrtoc16(char16_t * __restrict, const char * __restrict, size_t, + mbstate_t * __restrict); +size_t mbrtoc32(char32_t * __restrict, const char * __restrict, size_t, + mbstate_t * __restrict); +#if __BSD_VISIBLE || defined(_XLOCALE_H_) +#include <xlocale/_uchar.h> +#endif +__END_DECLS + +#endif /* !_UCHAR_H_ */ diff --git a/include/unistd.h b/include/unistd.h index dabf178..5868ba2 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -493,6 +493,7 @@ const char * int crypt_set_format(const char *); int des_cipher(const char *, char *, long, int); int des_setkey(const char *key); +int dup3(int, int, int); int eaccess(const char *, int); void endusershell(void); int exect(const char *, char * const *, char * const *); @@ -533,6 +534,7 @@ char *mktemp(char *); #endif int nfssvc(int, void *); int nlm_syscall(int, int, int, char **); +int pipe2(int *, int); int profil(char *, size_t, vm_offset_t, int); int rcmd(char **, int, const char *, const char *, const char *, int *); int rcmd_af(char **, int, const char *, diff --git a/include/xlocale/Makefile b/include/xlocale/Makefile index ed494f3..2dd4a98 100644 --- a/include/xlocale/Makefile +++ b/include/xlocale/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ INCS= _ctype.h _inttypes.h _langinfo.h _locale.h _monetary.h _stdio.h\ - _stdlib.h _string.h _time.h _wchar.h + _stdlib.h _string.h _time.h _uchar.h _wchar.h INCSDIR=${INCLUDEDIR}/xlocale .include <bsd.prog.mk> diff --git a/include/xlocale/_uchar.h b/include/xlocale/_uchar.h new file mode 100644 index 0000000..4256c87 --- /dev/null +++ b/include/xlocale/_uchar.h @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2013 Ed Schouten <ed@FreeBSD.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _LOCALE_T_DEFINED +#define _LOCALE_T_DEFINED +typedef struct _xlocale *locale_t; +#endif + +#ifndef _XLOCALE_UCHAR_H_ +#define _XLOCALE_UCHAR_H_ + +size_t c16rtomb_l(char * __restrict, char16_t, mbstate_t * __restrict, + locale_t); +size_t c32rtomb_l(char * __restrict, char32_t, mbstate_t * __restrict, + locale_t); +size_t mbrtoc16_l(char16_t * __restrict, const char * __restrict, size_t, + mbstate_t * __restrict, locale_t); +size_t mbrtoc32_l(char32_t * __restrict, const char * __restrict, size_t, + mbstate_t * __restrict, locale_t); + +#endif /* _XLOCALE_UCHAR_H_ */ |