diff options
author | Russ Allbery <rra@stanford.edu> | 2010-02-21 17:45:55 -0800 |
---|---|---|
committer | Russ Allbery <rra@stanford.edu> | 2010-02-21 17:45:55 -0800 |
commit | 60210334fa3dbd5dd168199063c6ee850d750d0c (patch) | |
tree | 31e832ba6788076075d38e20ffd27ebf09430407 /portable/system.h | |
parent | e571a8eb96f42de5a114cf11ff1c3d63e5a8d301 (diff) |
Imported Upstream version 0.10
Diffstat (limited to 'portable/system.h')
-rw-r--r-- | portable/system.h | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/portable/system.h b/portable/system.h index 1408ba7..461601b 100644 --- a/portable/system.h +++ b/portable/system.h @@ -1,7 +1,9 @@ -/* $Id$ +/* + * Standard system includes and portability adjustments. * * Declarations of routines and variables in the C library. Including this - * file is the equivalent of including all of the following headers, portably: + * file is the equivalent of including all of the following headers, + * portably: * * #include <sys/types.h> * #include <stdarg.h> @@ -13,8 +15,8 @@ * #include <string.h> * #include <unistd.h> * - * Missing functions are provided via #define or prototyped if available. - * Also provides some standard #defines. + * Missing functions are provided via #define or prototyped if available from + * the portable helper library. Also provides some standard #defines. * * Written by Russ Allbery <rra@stanford.edu> * This work is hereby placed in the public domain by its author. @@ -56,13 +58,17 @@ BEGIN_DECLS +/* Default to a hidden visibility for all portability functions. */ +#pragma GCC visibility push(hidden) + /* * Provide prototypes for functions not declared in system headers. Use the - * HAVE_DECL macros for those functions that may be prototyped but - * implemented incorrectly or implemented without a prototype. + * HAVE_DECL macros for those functions that may be prototyped but implemented + * incorrectly or implemented without a prototype. */ #if !HAVE_ASPRINTF -extern int asprintf(char **, const char *, ...); +extern int asprintf(char **, const char *, ...) + __attribute__((__format__(printf, 2, 3))); extern int vasprintf(char **, const char *, va_list); #endif #if !HAVE_DECL_SNPRINTF @@ -72,6 +78,12 @@ extern int snprintf(char *, size_t, const char *, ...) #if !HAVE_DECL_VSNPRINTF extern int vsnprintf(char *, size_t, const char *, va_list); #endif +#if !HAVE_MKSTEMP +extern int mkstemp(char *); +#endif +#if !HAVE_SETENV +extern int setenv(const char *, const char *, int); +#endif #if !HAVE_STRLCAT extern size_t strlcat(char *, const char *, size_t); #endif @@ -79,6 +91,9 @@ extern size_t strlcat(char *, const char *, size_t); extern size_t strlcpy(char *, const char *, size_t); #endif +/* Undo default visibility change. */ +#pragma GCC visibility pop + END_DECLS /* Windows provides snprintf under a different name. */ @@ -91,9 +106,9 @@ END_DECLS * been defined, all the rest almost certainly have. */ #ifndef STDIN_FILENO -# define STDIN_FILENO 0 -# define STDOUT_FILENO 1 -# define STDERR_FILENO 2 +# define STDIN_FILENO 0 +# define STDOUT_FILENO 1 +# define STDERR_FILENO 2 #endif /* @@ -102,9 +117,9 @@ END_DECLS */ #ifndef va_copy # ifdef __va_copy -# define va_copy(d, s) __va_copy((d), (s)) +# define va_copy(d, s) __va_copy((d), (s)) # else -# define va_copy(d, s) memcpy(&(d), &(s), sizeof(va_list)) +# define va_copy(d, s) memcpy(&(d), &(s), sizeof(va_list)) # endif #endif |