diff options
Diffstat (limited to 'newlib/libc/sys/linux/include')
-rw-r--r-- | newlib/libc/sys/linux/include/dlfcn.h | 149 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/getopt.h | 7 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/ltdl.h | 361 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/stdint.h | 269 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/unistd.h | 2 |
5 files changed, 80 insertions, 708 deletions
diff --git a/newlib/libc/sys/linux/include/dlfcn.h b/newlib/libc/sys/linux/include/dlfcn.h index 67ba73d5d..75d7526b0 100644 --- a/newlib/libc/sys/linux/include/dlfcn.h +++ b/newlib/libc/sys/linux/include/dlfcn.h @@ -1,84 +1,65 @@ -/* User functions for run-time dynamic loading. - Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _DLFCN_H -#define _DLFCN_H 1 - -#include <features.h> - -/* Collect various system dependent definitions and declarations. */ -#include <sys/dlfcn.h> - - -/* If the first argument of `dlsym' or `dlvsym' is set to RTLD_NEXT - the run-time address of the symbol called NAME in the next shared - object is returned. The "next" relation is defined by the order - the shared objects were loaded. */ -# define RTLD_NEXT ((void *) -1l) - -/* If the first argument to `dlsym' or `dlvsym' is set to RTLD_DEFAULT - the run-time address of the symbol called NAME in the global scope - is returned. */ -# define RTLD_DEFAULT ((void *) 0) - - -__BEGIN_DECLS - -/* Open the shared object FILE and map it in; return a handle that can be - passed to `dlsym' to get symbol values from it. */ -extern void *dlopen (__const char *__file, int __mode) __THROW; - -/* Unmap and close a shared object opened by `dlopen'. - The handle cannot be used again after calling `dlclose'. */ -extern int dlclose (void *__handle) __THROW; - -/* Find the run-time address in the shared object HANDLE refers to - of the symbol called NAME. */ -extern void *dlsym (void *__restrict __handle, - __const char *__restrict __name) __THROW; - -/* Find the run-time address in the shared object HANDLE refers to - of the symbol called NAME with VERSION. */ -extern void *dlvsym (void *__restrict __handle, - __const char *__restrict __name, - __const char *__restrict __version) __THROW; - -/* When any of the above functions fails, call this function - to return a string describing the error. Each call resets - the error string so that a following call returns null. */ -extern char *dlerror (void) __THROW; - - -/* Structure containing information about object searched using - `dladdr'. */ -typedef struct -{ - __const char *dli_fname; /* File name of defining object. */ - void *dli_fbase; /* Load address of that object. */ - __const char *dli_sname; /* Name of nearest symbol. */ - void *dli_saddr; /* Exact value of nearest symbol. */ -} Dl_info; - -/* Fill in *INFO with the following information about ADDRESS. - Returns 0 iff no shared object's segments contain that address. */ -extern int dladdr (__const void *__address, Dl_info *__info) __THROW; - -__END_DECLS - -#endif /* dlfcn.h */ +#ifndef _DLFCN_H +#include <dl/dlfcn.h> + +#define internal_function + +/* Internally used flag. */ +#define __RTLD_DLOPEN 0x80000000 +#define __RTLD_SPROF 0x40000000 + +/* Now define the internal interfaces. */ +extern void *__dlvsym (void *__handle, __const char *__name, + __const char *__version); + +extern void *__libc_dlopen (__const char *__name); +extern void *__libc_dlsym (void *__map, __const char *__name); +extern int __libc_dlclose (void *__map); + +/* Locate shared object containing the given address. */ +extern int _dl_addr (const void *address, Dl_info *info) + internal_function; + +/* Open the shared object NAME, relocate it, and run its initializer if it + hasn't already been run. MODE is as for `dlopen' (see <dlfcn.h>). If + the object is already opened, returns its existing map. */ +extern void *_dl_open (const char *name, int mode, const void *caller) + internal_function; + +/* Close an object previously opened by _dl_open. */ +extern void _dl_close (void *map) + internal_function; + +/* Look up NAME in shared object HANDLE (which may be RTLD_DEFAULT or + RTLD_NEXT). WHO is the calling function, for RTLD_NEXT. Returns + the symbol value, which may be NULL. */ +extern void *_dl_sym (void *handle, const char *name, void *who) + internal_function; + +/* Look up version VERSION of symbol NAME in shared object HANDLE + (which may be RTLD_DEFAULT or RTLD_NEXT). WHO is the calling + function, for RTLD_NEXT. Returns the symbol value, which may be + NULL. */ +extern void *_dl_vsym (void *handle, const char *name, const char *version, + void *who) + internal_function; + +/* Call OPERATE, catching errors from `dl_signal_error'. If there is no + error, *ERRSTRING is set to null. If there is an error, *ERRSTRING is + set to a string constructed from the strings passed to _dl_signal_error, + and the error code passed is the return value and *OBJNAME is set to + the object name which experienced the problems. ERRSTRING if nonzero + points to a malloc'ed string which the caller has to free after use. + ARGS is passed as argument to OPERATE. */ +extern int _dl_catch_error (const char **objname, const char **errstring, + void (*operate) (void *), + void *args) + internal_function; + +/* Helper function for <dlfcn.h> functions. Runs the OPERATE function via + _dl_catch_error. Returns zero for success, nonzero for failure; and + arranges for `dlerror' to return the error details. + ARGS is passed as argument to OPERATE. */ +extern int _dlerror_run (void (*operate) (void *), void *args) + internal_function; + +#endif diff --git a/newlib/libc/sys/linux/include/getopt.h b/newlib/libc/sys/linux/include/getopt.h index 3fdf4645c..994f86001 100644 --- a/newlib/libc/sys/linux/include/getopt.h +++ b/newlib/libc/sys/linux/include/getopt.h @@ -8,11 +8,8 @@ #include <unistd.h> -enum { NO_ARG, REQUIRED_ARG, OPTIONAL_ARG }; -/* Define glibc names as well for compatibility. */ -#define no_argument NO_ARG -#define required_argument REQUIRED_ARG -#define optional_argument OPTIONAL_ARG + +enum { no_argument, required_argument, optional_argument }; struct option { const char *name; diff --git a/newlib/libc/sys/linux/include/ltdl.h b/newlib/libc/sys/linux/include/ltdl.h deleted file mode 100644 index 2bbfa302c..000000000 --- a/newlib/libc/sys/linux/include/ltdl.h +++ /dev/null @@ -1,361 +0,0 @@ -/* ltdl.h -- generic dlopen functions - Copyright (C) 1998-2000 Free Software Foundation, Inc. - Originally by Thomas Tanner <tanner@ffii.org> - This file is part of GNU Libtool. - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -As a special exception to the GNU Lesser General Public License, -if you distribute this file as part of a program or library that -is built using GNU libtool, you may include it under the same -distribution terms that you use for the rest of that program. - -This library 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 -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA -*/ - -/* Only include this header file once. */ -#ifndef LTDL_H -#define LTDL_H 1 - -#include <sys/types.h> /* for size_t declaration */ - - -/* --- MACROS FOR PORTABILITY --- */ - - -/* Saves on those hard to debug '\0' typos.... */ -#define LT_EOS_CHAR '\0' - -/* LTDL_BEGIN_C_DECLS should be used at the beginning of your declarations, - so that C++ compilers don't mangle their names. Use LTDL_END_C_DECLS at - the end of C declarations. */ -#ifdef __cplusplus -# define LT_BEGIN_C_DECLS extern "C" { -# define LT_END_C_DECLS } -#else -# define LT_BEGIN_C_DECLS /* empty */ -# define LT_END_C_DECLS /* empty */ -#endif - -LT_BEGIN_C_DECLS - - -/* LT_PARAMS is a macro used to wrap function prototypes, so that compilers - that don't understand ANSI C prototypes still work, and ANSI C - compilers can issue warnings about type mismatches. */ -#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32) || defined(__cplusplus) -# define LT_PARAMS(protos) protos -# define lt_ptr void* -#else -# define LT_PARAMS(protos) () -# define lt_ptr char* -#endif - -/* LT_STMT_START/END are used to create macros which expand to a - a single compound statement in a portable way. */ -#if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus) -# define LT_STMT_START (void)( -# define LT_STMT_END ) -#else -# if (defined (sun) || defined (__sun__)) -# define LT_STMT_START if (1) -# define LT_STMT_END else (void)0 -# else -# define LT_STMT_START do -# define LT_STMT_END while (0) -# endif -#endif - -/* LT_CONC creates a new concatenated symbol for the compiler - in a portable way. */ -#if defined(__STDC__) || defined(__cplusplus) -# define LT_CONC(s,t) s##t -#else -# define LT_CONC(s,t) s/**/t -#endif - -/* LT_STRLEN can be used safely on NULL pointers. */ -#define LT_STRLEN(s) (((s) && (s)[0]) ? strlen (s) : 0) - - - -/* --- WINDOWS SUPPORT --- */ - - -/* Canonicalise Windows and Cygwin recognition macros. */ -#ifdef __CYGWIN32__ -# ifndef __CYGWIN__ -# define __CYGWIN__ __CYGWIN32__ -# endif -#endif -#if defined(_WIN32) || defined(WIN32) -# ifndef __WINDOWS__ -# ifdef _WIN32 -# define __WINDOWS__ _WIN32 -# else -# ifdef WIN32 -# define __WINDOWS__ WIN32 -# endif -# endif -# endif -#endif - -#ifdef __WINDOWS__ -# ifndef __CYGWIN__ -/* LT_DIRSEP_CHAR is accepted *in addition* to '/' as a directory - separator when it is set. */ -# define LT_DIRSEP_CHAR '\\' -# define LT_PATHSEP_CHAR ';' -# endif -#endif -#ifndef LT_PATHSEP_CHAR -# define LT_PATHSEP_CHAR ':' -#endif - -/* DLL building support on win32 hosts; mostly to workaround their - ridiculous implementation of data symbol exporting. */ -#ifndef LT_SCOPE -# ifdef __WINDOWS__ -# ifdef DLL_EXPORT /* defined by libtool (if required) */ -# define LT_SCOPE __declspec(dllexport) -# endif -# ifdef LIBLTDL_DLL_IMPORT /* define if linking with this dll */ -# define LT_SCOPE extern __declspec(dllimport) -# endif -# endif -# ifndef LT_SCOPE /* static linking or !__WINDOWS__ */ -# define LT_SCOPE extern -# endif -#endif - - - - -/* --- DYNAMIC MODULE LOADING API --- */ - - -typedef struct lt_dlhandle_struct *lt_dlhandle; /* A loaded module. */ - -/* Initialisation and finalisation functions for libltdl. */ -extern int lt_dlinit LT_PARAMS((void)); -extern int lt_dlexit LT_PARAMS((void)); - -/* Module search path manipulation. */ -extern int lt_dladdsearchdir LT_PARAMS((const char *search_dir)); -extern int lt_dlinsertsearchdir LT_PARAMS((const char *before, - const char *search_dir)); -extern int lt_dlsetsearchpath LT_PARAMS((const char *search_path)); -extern const char *lt_dlgetsearchpath LT_PARAMS((void)); -extern int lt_dlforeachfile LT_PARAMS(( - const char *search_path, - int (*func) (const char *filename, lt_ptr data), - lt_ptr data)); - -/* Portable libltdl versions of the system dlopen() API. */ -extern lt_dlhandle lt_dlopen LT_PARAMS((const char *filename)); -extern lt_dlhandle lt_dlopenext LT_PARAMS((const char *filename)); -extern lt_ptr lt_dlsym LT_PARAMS((lt_dlhandle handle, - const char *name)); -extern const char *lt_dlerror LT_PARAMS((void)); -extern int lt_dlclose LT_PARAMS((lt_dlhandle handle)); - -/* Module residency management. */ -extern int lt_dlmakeresident LT_PARAMS((lt_dlhandle handle)); -extern int lt_dlisresident LT_PARAMS((lt_dlhandle handle)); - - - - -/* --- MUTEX LOCKING --- */ - - -typedef void lt_dlmutex_lock LT_PARAMS((void)); -typedef void lt_dlmutex_unlock LT_PARAMS((void)); -typedef void lt_dlmutex_seterror LT_PARAMS((const char *errmsg)); -typedef const char *lt_dlmutex_geterror LT_PARAMS((void)); - -extern int lt_dlmutex_register LT_PARAMS((lt_dlmutex_lock *lock, - lt_dlmutex_unlock *unlock, - lt_dlmutex_seterror *seterror, - lt_dlmutex_geterror *geterror)); - - - - -/* --- MEMORY HANDLING --- */ - - -/* By default, the realloc function pointer is set to our internal - realloc implementation which iself uses lt_dlmalloc and lt_dlfree. - libltdl relies on a featureful realloc, but if you are sure yours - has the right semantics then you can assign it directly. Generally, - it is safe to assign just a malloc() and a free() function. */ -LT_SCOPE lt_ptr (*lt_dlmalloc) LT_PARAMS((size_t size)); -LT_SCOPE lt_ptr (*lt_dlrealloc) LT_PARAMS((lt_ptr ptr, size_t size)); -LT_SCOPE void (*lt_dlfree) LT_PARAMS((lt_ptr ptr)); - - - - -/* --- PRELOADED MODULE SUPPORT --- */ - - -/* A preopened symbol. Arrays of this type comprise the exported - symbols for a dlpreopened module. */ -typedef struct { - const char *name; - lt_ptr address; -} lt_dlsymlist; - -extern int lt_dlpreload LT_PARAMS((const lt_dlsymlist *preloaded)); -extern int lt_dlpreload_default - LT_PARAMS((const lt_dlsymlist *preloaded)); - -#define LTDL_SET_PRELOADED_SYMBOLS() LT_STMT_START{ \ - extern const lt_dlsymlist lt_preloaded_symbols[]; \ - lt_dlpreload_default(lt_preloaded_symbols); \ - }LT_STMT_END - - - - -/* --- MODULE INFORMATION --- */ - - -/* Read only information pertaining to a loaded module. */ -typedef struct { - char *filename; /* file name */ - char *name; /* module name */ - int ref_count; /* number of times lt_dlopened minus - number of times lt_dlclosed. */ -} lt_dlinfo; - -extern const lt_dlinfo *lt_dlgetinfo LT_PARAMS((lt_dlhandle handle)); -extern lt_dlhandle lt_dlhandle_next LT_PARAMS((lt_dlhandle place)); -extern int lt_dlforeach LT_PARAMS(( - int (*func) (lt_dlhandle handle, lt_ptr data), - lt_ptr data)); - -/* Associating user data with loaded modules. */ -typedef unsigned lt_dlcaller_id; - -extern lt_dlcaller_id lt_dlcaller_register LT_PARAMS((void)); -extern lt_ptr lt_dlcaller_set_data LT_PARAMS((lt_dlcaller_id key, - lt_dlhandle handle, - lt_ptr data)); -extern lt_ptr lt_dlcaller_get_data LT_PARAMS((lt_dlcaller_id key, - lt_dlhandle handle)); - - - -/* --- USER MODULE LOADER API --- */ - - -typedef struct lt_dlloader lt_dlloader; -typedef lt_ptr lt_user_data; -typedef lt_ptr lt_module; - -/* Function pointer types for creating user defined module loaders. */ -typedef lt_module lt_module_open LT_PARAMS((lt_user_data loader_data, - const char *filename)); -typedef int lt_module_close LT_PARAMS((lt_user_data loader_data, - lt_module handle)); -typedef lt_ptr lt_find_sym LT_PARAMS((lt_user_data loader_data, - lt_module handle, - const char *symbol)); -typedef int lt_dlloader_exit LT_PARAMS((lt_user_data loader_data)); - -struct lt_user_dlloader { - const char *sym_prefix; - lt_module_open *module_open; - lt_module_close *module_close; - lt_find_sym *find_sym; - lt_dlloader_exit *dlloader_exit; - lt_user_data dlloader_data; -}; - -extern lt_dlloader *lt_dlloader_next LT_PARAMS((lt_dlloader *place)); -extern lt_dlloader *lt_dlloader_find LT_PARAMS(( - const char *loader_name)); -extern const char *lt_dlloader_name LT_PARAMS((lt_dlloader *place)); -extern lt_user_data *lt_dlloader_data LT_PARAMS((lt_dlloader *place)); -extern int lt_dlloader_add LT_PARAMS((lt_dlloader *place, - const struct lt_user_dlloader *dlloader, - const char *loader_name)); -extern int lt_dlloader_remove LT_PARAMS(( - const char *loader_name)); - - - -/* --- ERROR MESSAGE HANDLING --- */ - - -/* Defining error strings alongside their symbolic names in a macro in - this way allows us to expand the macro in different contexts with - confidence that the enumeration of symbolic names will map correctly - onto the table of error strings. */ -#define lt_dlerror_table \ - LT_ERROR(UNKNOWN, "unknown error") \ - LT_ERROR(DLOPEN_NOT_SUPPORTED, "dlopen support not available") \ - LT_ERROR(INVALID_LOADER, "invalid loader") \ - LT_ERROR(INIT_LOADER, "loader initialization failed") \ - LT_ERROR(REMOVE_LOADER, "loader removal failed") \ - LT_ERROR(FILE_NOT_FOUND, "file not found") \ - LT_ERROR(DEPLIB_NOT_FOUND, "dependency library not found") \ - LT_ERROR(NO_SYMBOLS, "no symbols defined") \ - LT_ERROR(CANNOT_OPEN, "can't open the module") \ - LT_ERROR(CANNOT_CLOSE, "can't close the module") \ - LT_ERROR(SYMBOL_NOT_FOUND, "symbol not found") \ - LT_ERROR(NO_MEMORY, "not enough memory") \ - LT_ERROR(INVALID_HANDLE, "invalid module handle") \ - LT_ERROR(BUFFER_OVERFLOW, "internal buffer overflow") \ - LT_ERROR(INVALID_ERRORCODE, "invalid errorcode") \ - LT_ERROR(SHUTDOWN, "library already shutdown") \ - LT_ERROR(CLOSE_RESIDENT_MODULE, "can't close resident module") \ - LT_ERROR(INVALID_MUTEX_ARGS, "invalid mutex handler registration") \ - LT_ERROR(INVALID_POSITION, "invalid search path insert position") - -/* Enumerate the symbolic error names. */ -enum { -#define LT_ERROR(name, diagnostic) LT_CONC(LT_ERROR_, name), - lt_dlerror_table -#undef LT_ERROR - - LT_ERROR_MAX -}; - -/* These functions are only useful from inside custom module loaders. */ -extern int lt_dladderror LT_PARAMS((const char *diagnostic)); -extern int lt_dlseterror LT_PARAMS((int errorcode)); - - - - -/* --- SOURCE COMPATIBILITY WITH OLD LIBLTDL --- */ - - -#ifdef LT_NON_POSIX_NAMESPACE -# define lt_ptr_t lt_ptr -# define lt_module_t lt_module -# define lt_module_open_t lt_module_open -# define lt_module_close_t lt_module_close -# define lt_find_sym_t lt_find_sym -# define lt_dlloader_exit_t lt_dlloader_exit -# define lt_dlloader_t lt_dlloader -# define lt_dlloader_data_t lt_user_data -#endif - -LT_END_C_DECLS - -#endif /* !LTDL_H */ diff --git a/newlib/libc/sys/linux/include/stdint.h b/newlib/libc/sys/linux/include/stdint.h index d1197f66c..5c89acd22 100644 --- a/newlib/libc/sys/linux/include/stdint.h +++ b/newlib/libc/sys/linux/include/stdint.h @@ -1,265 +1,18 @@ -/* - * Copyright (c) 2004, 2005 by - * Ralf Corsepius, Ulm/Germany. All rights reserved. - * - * Permission to use, copy, modify, and distribute this software - * is freely granted, provided that this notice is preserved. - */ - -/* - * @todo - Add fast<N>_t types. - * @todo - Add support for wint_t types. - */ - -#ifndef _STDINT_H -#define _STDINT_H - -#include <sys/types.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(__GNUC__) && (__GNUC__ >= 3 ) \ - && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ > 2 ) -#define __STDINT_EXP(x) __##x##__ -#else -#define __STDINT_EXP(x) x -#include <limits.h> -#endif - -#if __STDINT_EXP(SCHAR_MAX) == 0x7f -#define __int8_t_defined 1 -#endif - -#if __int8_t_defined -typedef signed char int_least8_t; -typedef unsigned char uint_least8_t; -#define __int_least8_t_defined 1 -#endif - -#if __STDINT_EXP(SHRT_MAX) == 0x7fff -#define __int16_t_defined 1 -#elif __STDINT_EXP(INT_MAX) == 0x7fff -#define __int16_t_defined 1 -#elif __STDINT_EXP(SCHAR_MAX) == 0x7fff -#define __int16_t_defined 1 -#endif - -#if __int16_t_defined -typedef int16_t int_least16_t; -typedef uint16_t uint_least16_t; -#define __int_least16_t_defined 1 - -#ifndef __int_least8_t_defined -typedef int16_t int_least8_t; -typedef uint16_t uint_least8_t; -#define __int_least8_t_defined 1 -#endif -#endif - -#if __STDINT_EXP(INT_MAX) == 0x7fffffffL -#define __int32_t_defined 1 -#elif __STDINT_EXP(LONG_MAX) == 0x7fffffffL -#define __int32_t_defined 1 -#define __have_long32 1 -#elif __STDINT_EXP(SHRT_MAX) == 0x7fffffffL -#define __int32_t_defined 1 -#elif __STDINT_EXP(SCHAR_MAX) == 0x7fffffffL -#define __int32_t_defined 1 -#endif - -#if __int32_t_defined -typedef int32_t int_least32_t; -typedef uint32_t uint_least32_t; -#define __int_least32_t_defined 1 - -#ifndef __int_least8_t_defined -typedef int32_t int_least8_t; -typedef uint32_t uint_least8_t; -#define __int_least8_t_defined 1 -#endif - -#ifndef __int_least16_t_defined -typedef int32_t int_least16_t; -typedef uint32_t uint_least16_t; -#define __int_least16_t_defined 1 -#endif -#endif - -#if __STDINT_EXP(LONG_MAX) > 0x7fffffff -#define __int64_t_defined 1 -#define __have_long64 1 -#elif defined(__LONG_LONG_MAX__) && (__LONG_LONG_MAX__ > 0x7fffffff) -#define __int64_t_defined 1 -#define __have_longlong64 1 -#elif defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff) -#define __int64_t_defined 1 -#define __have_longlong64 1 -#elif __STDINT_EXP(INT_MAX) > 0x7fffffff -#define __int64_t_defined 1 -#endif - -#if __int64_t_defined -typedef int64_t int_least64_t; -typedef uint64_t uint_least64_t; -#define __int_least64_t_defined 1 - -#ifndef __int_least8_t_defined -typedef int64_t int_least8_t; -typedef uint64_t uint_least8_t; -#define __int_least8_t_defined 1 -#endif - -#ifndef __int_least16_t_defined -typedef int64_t int_least16_t; -typedef uint64_t uint_least16_t; -#define __int_least16_t_defined 1 -#endif +/* libc/sys/linux/include/stdint.h - Standard integer types */ -#ifndef __int_least32_t_defined -typedef int64_t int_least32_t; -typedef uint64_t uint_least32_t; -#define __int_least32_t_defined 1 -#endif -#endif - -/* Greatest-width integer types */ -/* Modern GCCs provide __INTMAX_TYPE__ */ -#if defined(__INTMAX_TYPE__) - typedef __INTMAX_TYPE__ intmax_t; -#elif __have_longlong64 - typedef signed long long intmax_t; -#else - typedef signed long intmax_t; -#endif - -/* Modern GCCs provide __UINTMAX_TYPE__ */ -#if defined(__UINTMAX_TYPE__) - typedef __UINTMAX_TYPE__ uintmax_t; -#elif __have_longlong64 - typedef unsigned long long uintmax_t; -#else - typedef unsigned long uintmax_t; -#endif - -/* Limits of Specified-Width Integer Types */ +/* Written 2000 by Werner Almesberger */ -#if __int8_t_defined -#define INT8_MIN -128 -#define INT8_MAX 127 -#define UINT8_MAX 255 -#endif -#if __int_least8_t_defined -#define INT_LEAST8_MIN -128 -#define INT_LEAST8_MAX 127 -#define UINT_LEAST8_MAX 255 -#else -#error required type int_least8_t missing -#endif - -#if __int16_t_defined -#define INT16_MIN -32768 -#define INT16_MAX 32767 -#define UINT16_MAX 65535 -#endif - -#if __int_least16_t_defined -#define INT_LEAST16_MIN -32768 -#define INT_LEAST16_MAX 32767 -#define UINT_LEAST16_MAX 65535 -#else -#error required type int_least16_t missing -#endif - -#if __int32_t_defined -#define INT32_MIN (-2147483647-1) -#define INT32_MAX 2147483647 -#define UINT32_MAX 4294967295U -#endif - -#if __int_least32_t_defined -#define INT_LEAST32_MIN (-2147483647-1) -#define INT_LEAST32_MAX 2147483647 -#define UINT_LEAST32_MAX 4294967295U -#else -#error required type int_least32_t missing -#endif - -#if __int64_t_defined -#ifdef __have_long64 -#define INT64_MIN (-9223372036854775807L-1L) -#define INT64_MAX 9223372036854775807L -#define UINT64_MAX 18446744073709551615U -#elif defined(__have_longlong64) -#define INT64_MIN (-9223372036854775807LL-1LL) -#define INT64_MAX 9223372036854775807LL -#define UINT64_MAX 18446744073709551615ULL -#endif -#endif +#ifndef _NEWLIB_STDINT_H +#define _NEWLIB_STDINT_H -#if __int_least64_t_defined -#ifdef __have_long64 -#define INT_LEAST64_MIN (-9223372036854775807L-1L) -#define INT_LEAST64_MAX 9223372036854775807L -#define UINT_LEAST64_MAX 18446744073709551615U -#elif defined(__have_longlong64) -#define INT_LEAST64_MIN (-9223372036854775807LL-1LL) -#define INT_LEAST64_MAX 9223372036854775807LL -#define UINT_LEAST64_MAX 18446744073709551615ULL -#endif -#endif - -/* This must match size_t in stddef.h, currently long unsigned int */ -#define SIZE_MIN (-__STDINT_EXP(LONG_MAX) - 1L) -#define SIZE_MAX __STDINT_EXP(LONG_MAX) - -/* This must match sig_atomic_t in <signal.h> (currently int) */ -#define SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1) -#define SIG_ATOMIC_MAX __STDINT_EXP(INT_MAX) - -/* This must match ptrdiff_t in <stddef.h> (currently long int) */ -#define PTRDIFF_MIN (-__STDINT_EXP(LONG_MAX) - 1L) -#define PTRDIFF_MAX __STDINT_EXP(LONG_MAX) - -/** Macros for minimum-width integer constant expressions */ -#define INT8_C(x) x -#define UINT8_C(x) x##U - -#define INT16_C(x) x -#define UINT16_C(x) x##U - -#if __have_long32 -#define INT32_C(x) x##L -#define UINT32_C(x) x##UL -#else -#define INT32_C(x) x -#define UINT32_C(x) x##U -#endif - -#if __int64_t_defined -#if __have_longlong64 -#define INT64_C(x) x##LL -#define UINT64_C(x) x##ULL -#else -#define INT64_C(x) x##L -#define UINT64_C(x) x##UL -#endif -#endif - -/** Macros for greatest-width integer constant expression */ -#if __have_longlong64 -#define INTMAX_C(x) x##LL -#define UINTMAX_C(x) x##ULL -#else -#define INTMAX_C(x) x##L -#define UINTMAX_C(x) x##UL -#endif +/* + * FIXME: linux/types.h defines various types that rightfully belong into + * stdint.h. So we have no choice but to include linux/types.h directly, even + * if this causes name space pollution. Note: we have to go via sys/types.h + * in order to resolve some other compatibility issues. + */ +#include <sys/types.h> -#ifdef __cplusplus -} #endif - -#endif /* _STDINT_H */ diff --git a/newlib/libc/sys/linux/include/unistd.h b/newlib/libc/sys/linux/include/unistd.h index 55ecc3a4e..e2f562a3a 100644 --- a/newlib/libc/sys/linux/include/unistd.h +++ b/newlib/libc/sys/linux/include/unistd.h @@ -15,4 +15,6 @@ extern char *optarg; extern int optind, opterr, optopt; +int readlink(const char *path, char *buf, size_t bufsiz); + #endif |