diff --git a/src/kernel/libroot/posix/glibc/include/bits/errno.h b/src/kernel/libroot/posix/glibc/include/bits/errno.h index 2881ad513f..30938a779c 100644 --- a/src/kernel/libroot/posix/glibc/include/bits/errno.h +++ b/src/kernel/libroot/posix/glibc/include/bits/errno.h @@ -1,32 +1,20 @@ -/* -** Copyright 2004, Oliver Tappe. All rights reserved. -** Distributed under the terms of the Haiku License. -** -** This file represents a haiku-specific implementation of errno.h. -** It's main purpose is to define the E_...-error constants. -** In a full glibc-setup, this file would live under sysdeps, but since -** we do not have/need this abstraction, I placed it here. -*/ +/* Copyright (C) 1991, 1994, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. -#ifndef _ERRNO_H_ -#define _ERRNO_H_ + 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. -#include + 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. -#define ENOERR 0 -#define EOK ENOERR /* some code assumes EOK exists */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int *_errnop(void); - -#ifdef __cplusplus -} -#endif - -#define errno (*(_errnop())) - -#endif /* _ERRNO_H_ */ + 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. */ +#include_next +#define __set_errno(val) errno = (val) diff --git a/src/kernel/libroot/posix/glibc/include/bp-sym.h b/src/kernel/libroot/posix/glibc/include/bp-sym.h new file mode 100644 index 0000000000..1aeb2364eb --- /dev/null +++ b/src/kernel/libroot/posix/glibc/include/bp-sym.h @@ -0,0 +1,26 @@ +/* Bounded-pointer symbol modifier. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Greg McGary + + 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. */ + +#define BP_SYM(name) _BP_SYM (name) +#if __BOUNDED_POINTERS__ +# define _BP_SYM(name) __BP_##name +#else +# define _BP_SYM(name) name +#endif diff --git a/src/kernel/libroot/posix/glibc/include/dlfcn.h b/src/kernel/libroot/posix/glibc/include/dlfcn.h new file mode 100644 index 0000000000..d21cff6020 --- /dev/null +++ b/src/kernel/libroot/posix/glibc/include/dlfcn.h @@ -0,0 +1,8 @@ +#ifndef _DLFCN_H + +#include_next + +# define DL_CALL_FCT(fctp, args) \ + (*(fctp)) args + +#endif diff --git a/src/kernel/libroot/posix/glibc/include/errno.h b/src/kernel/libroot/posix/glibc/include/errno.h new file mode 100644 index 0000000000..645a439db7 --- /dev/null +++ b/src/kernel/libroot/posix/glibc/include/errno.h @@ -0,0 +1,73 @@ +/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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. */ + +/* + * ISO C99 Standard: 7.5 Errors + */ + +#ifndef _ERRNO_H + +/* The includer defined __need_Emath if he wants only the definitions + of EDOM and ERANGE, and not everything else. */ +#ifndef __need_Emath +#define _ERRNO_H 1 +#include +#endif + +__BEGIN_DECLS + +/* Get the error number constants from the system-specific file. + This file will test __need_Emath and _ERRNO_H. */ +#include +#undef __need_Emath + +#ifdef _ERRNO_H + +/* Declare the `errno' variable, unless it's defined as a macro by + bits/errno.h. This is the case in GNU, where it is a per-thread + variable. This redeclaration using the macro still works, but it + will be a function declaration without a prototype and may trigger + a -Wstrict-prototypes warning. */ +#ifndef errno +extern int errno; +#endif + +#ifdef __USE_GNU + +/* The full and simple forms of the name with which the program was + invoked. These variables are set up automatically at startup based on + the value of ARGV[0] (this works only if you use GNU ld). */ +extern char *program_invocation_name, *program_invocation_short_name; +#endif /* __USE_GNU */ +#endif /* _ERRNO_H */ + +__END_DECLS + +#endif /* _ERRNO_H */ + +/* The Hurd defines `error_t' as an enumerated type so + that printing `error_t' values in the debugger shows the names. We + might need this definition sometimes even if this file was included + before. */ +#if defined __USE_GNU || defined __need_error_t +# ifndef __error_t_defined +typedef int error_t; +# define __error_t_defined 1 +# endif +# undef __need_error_t +#endif diff --git a/src/kernel/libroot/posix/glibc/include/langinfo.h b/src/kernel/libroot/posix/glibc/include/langinfo.h index 8f93671658..2a81c6ddaf 100644 --- a/src/kernel/libroot/posix/glibc/include/langinfo.h +++ b/src/kernel/libroot/posix/glibc/include/langinfo.h @@ -1,9 +1 @@ -#ifndef _LANGINFO_H - #include - -libc_hidden_proto (nl_langinfo) - -extern __typeof (nl_langinfo_l) __nl_langinfo_l; - -#endif diff --git a/src/kernel/libroot/posix/glibc/include/locale.h b/src/kernel/libroot/posix/glibc/include/locale.h index 22770b9ad2..4374792d14 100644 --- a/src/kernel/libroot/posix/glibc/include/locale.h +++ b/src/kernel/libroot/posix/glibc/include/locale.h @@ -1,22 +1,10 @@ #ifndef _LOCALE_H #include -extern __typeof (uselocale) __uselocale; - -libc_hidden_proto (setlocale) - -/* This has to be changed whenever a new locale is defined. */ -#define __LC_LAST 13 - -extern struct loaded_l10nfile *_nl_locale_file_list[] attribute_hidden; - /* Locale object for C locale. */ -extern struct __locale_struct _nl_C_locobj attribute_hidden; +extern struct __locale_struct _nl_C_locobj; /* Now define the internal interfaces. */ extern struct lconv *__localeconv (void); -/* Fetch the name of the current locale set in the given category. */ -extern const char *__current_locale_name (int category) attribute_hidden; - #endif diff --git a/src/kernel/libroot/posix/glibc/include/math.h b/src/kernel/libroot/posix/glibc/include/math.h new file mode 100644 index 0000000000..8759c28bff --- /dev/null +++ b/src/kernel/libroot/posix/glibc/include/math.h @@ -0,0 +1,8 @@ +#ifndef _MATH_H + +#include + +/* Now define the internal interfaces. */ +extern int __matherr (struct exception *__exc); + +#endif diff --git a/src/kernel/libroot/posix/glibc/include/nl_types.h b/src/kernel/libroot/posix/glibc/include/nl_types.h new file mode 100644 index 0000000000..71cb425995 --- /dev/null +++ b/src/kernel/libroot/posix/glibc/include/nl_types.h @@ -0,0 +1 @@ +#include diff --git a/src/kernel/libroot/posix/glibc/include/stdlib.h b/src/kernel/libroot/posix/glibc/include/stdlib.h index 6b17f35ec6..675ed768c6 100644 --- a/src/kernel/libroot/posix/glibc/include/stdlib.h +++ b/src/kernel/libroot/posix/glibc/include/stdlib.h @@ -4,40 +4,10 @@ #define __Need_M_And_C #endif -#include #include /* Now define the internal interfaces. */ #ifndef __Need_M_And_C - -extern __typeof (strtol_l) __strtol_l; -extern __typeof (strtoul_l) __strtoul_l; -extern __typeof (strtoll_l) __strtoll_l; -extern __typeof (strtoull_l) __strtoull_l; -extern __typeof (strtod_l) __strtod_l; -extern __typeof (strtof_l) __strtof_l; -extern __typeof (strtold_l) __strtold_l; - -libc_hidden_proto (exit) -libc_hidden_proto (abort) -libc_hidden_proto (getenv) -libc_hidden_proto (bsearch) -libc_hidden_proto (qsort) -libc_hidden_proto (ecvt_r) -libc_hidden_proto (fcvt_r) -libc_hidden_proto (qecvt_r) -libc_hidden_proto (qfcvt_r) -libc_hidden_proto (lrand48_r) -libc_hidden_proto (wctomb) -libc_hidden_proto (__secure_getenv) -libc_hidden_proto (__strtof_internal) -libc_hidden_proto (__strtod_internal) -libc_hidden_proto (__strtold_internal) -libc_hidden_proto (__strtol_internal) -libc_hidden_proto (__strtoll_internal) -libc_hidden_proto (__strtoul_internal) -libc_hidden_proto (__strtoull_internal) - extern long int __random (void); extern void __srandom (unsigned int __seed); extern char *__initstate (unsigned int __seed, char *__statebuf, @@ -68,9 +38,6 @@ extern int __lcong48_r (unsigned short int __param[7], extern int __drand48_iterate (unsigned short int __xsubi[3], struct drand48_data *__buffer); -/* Global state for non-reentrant functions. Defined in drand48-iter.c. */ -extern struct drand48_data __libc_drand48_data attribute_hidden; - extern int __setenv (__const char *__name, __const char *__value, int __replace); extern int __unsetenv (__const char *__name); @@ -90,115 +57,15 @@ extern void _quicksort (void *const pbase, size_t total_elems, extern int __on_exit (void (*__func) (int __status, void *__arg), void *__arg); extern int __cxa_atexit (void (*func) (void *), void *arg, void *d); -extern int __cxa_atexit_internal (void (*func) (void *), void *arg, void *d) - attribute_hidden; extern void __cxa_finalize (void *d); extern int __posix_memalign (void **memptr, size_t alignment, size_t size) __attribute_malloc__; -extern void *__libc_memalign (size_t alignment, size_t size) - __attribute_malloc__; extern int __libc_system (const char *line); -extern double ____strtod_l_internal (__const char *__restrict __nptr, - char **__restrict __endptr, int __group, - __locale_t __loc) __THROW; -extern float ____strtof_l_internal (__const char *__restrict __nptr, - char **__restrict __endptr, int __group, - __locale_t __loc) __THROW; -extern long double ____strtold_l_internal (__const char *__restrict __nptr, - char **__restrict __endptr, - int __group, __locale_t __loc) - __THROW; -extern long int ____strtol_l_internal (__const char *__restrict __nptr, - char **__restrict __endptr, - int __base, int __group, - __locale_t __loc) __THROW; -extern unsigned long int ____strtoul_l_internal (__const char * - __restrict __nptr, - char **__restrict __endptr, - int __base, int __group, - __locale_t __loc) __THROW; -__extension__ -extern long long int ____strtoll_l_internal (__const char *__restrict __nptr, - char **__restrict __endptr, - int __base, int __group, - __locale_t __loc) __THROW; -__extension__ -extern unsigned long long int ____strtoull_l_internal (__const char * - __restrict __nptr, - char ** - __restrict __endptr, - int __base, int __group, - __locale_t __loc) - __THROW; - -libc_hidden_proto (____strtof_l_internal) -libc_hidden_proto (____strtod_l_internal) -libc_hidden_proto (____strtold_l_internal) -libc_hidden_proto (____strtol_l_internal) -libc_hidden_proto (____strtoll_l_internal) -libc_hidden_proto (____strtoul_l_internal) -libc_hidden_proto (____strtoull_l_internal) - -extern __inline double -__strtod_l (__const char *__restrict __nptr, char **__restrict __endptr, - __locale_t __loc) __THROW -{ - return ____strtod_l_internal (__nptr, __endptr, 0, __loc); -} -extern __inline long int -__strtol_l (__const char *__restrict __nptr, char **__restrict __endptr, - int __base, __locale_t __loc) __THROW -{ - return ____strtol_l_internal (__nptr, __endptr, __base, 0, __loc); -} -extern __inline unsigned long int -__strtoul_l (__const char *__restrict __nptr, char **__restrict __endptr, - int __base, __locale_t __loc) __THROW -{ - return ____strtoul_l_internal (__nptr, __endptr, __base, 0, __loc); -} -extern __inline float -__strtof_l (__const char *__restrict __nptr, char **__restrict __endptr, - __locale_t __loc) __THROW -{ - return ____strtof_l_internal (__nptr, __endptr, 0, __loc); -} -extern __inline long double -__strtold_l (__const char *__restrict __nptr, char **__restrict __endptr, - __locale_t __loc) __THROW -{ - return ____strtold_l_internal (__nptr, __endptr, 0, __loc); -} -__extension__ extern __inline long long int -__strtoll_l (__const char *__restrict __nptr, char **__restrict __endptr, - int __base, __locale_t __loc) __THROW -{ - return ____strtoll_l_internal (__nptr, __endptr, __base, 0, __loc); -} -__extension__ extern __inline unsigned long long int -__strtoull_l (__const char * __restrict __nptr, char **__restrict __endptr, - int __base, __locale_t __loc) __THROW -{ - return ____strtoull_l_internal (__nptr, __endptr, __base, 0, __loc); -} - - -# ifndef NOT_IN_libc -# undef MB_CUR_MAX -# define MB_CUR_MAX (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX)) - -# define __cxa_atexit(func, arg, d) INTUSE(__cxa_atexit) (func, arg, d) -# endif - #endif - -extern void * __default_morecore (ptrdiff_t); -libc_hidden_proto (__default_morecore) - #undef __Need_M_And_C #endif /* include/stdlib.h */ diff --git a/src/kernel/libroot/posix/glibc/include/string.h b/src/kernel/libroot/posix/glibc/include/string.h index 28fcb7525b..f97a431836 100644 --- a/src/kernel/libroot/posix/glibc/include/string.h +++ b/src/kernel/libroot/posix/glibc/include/string.h @@ -6,6 +6,8 @@ /* map the internal glibc interface to the public one */ #define __memcpy(to, from, size) memcpy(to, from, size) #define __strchrnul(string, character) strchrnul(string, character) +#define __strnlen strnlen +#define __strerror_r strerror_r static inline void * __mempcpy(void *to, const void *from, size_t size) diff --git a/src/kernel/libroot/posix/glibc/include/sysdep.h b/src/kernel/libroot/posix/glibc/include/sysdep.h new file mode 100644 index 0000000000..36e6884705 --- /dev/null +++ b/src/kernel/libroot/posix/glibc/include/sysdep.h @@ -0,0 +1,45 @@ +/* Generic asm macros used on many machines. + Copyright (C) 1991, 92, 93, 96, 98 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. */ + +#include "libc-symbols.h" + +#ifndef C_LABEL + +/* Define a macro we can use to construct the asm name for a C symbol. */ +#ifdef NO_UNDERSCORES +#ifdef __STDC__ +#define C_LABEL(name) name##: +#else +#define C_LABEL(name) name/**/: +#endif +#else +#ifdef __STDC__ +#define C_LABEL(name) _##name##: +#else +#define C_LABEL(name) _/**/name/**/: +#endif +#endif + +#endif + +/* Mark the end of function named SYM. This is used on some platforms + to generate correct debugging information. */ +#ifndef END +#define END(sym) +#endif diff --git a/src/kernel/libroot/posix/glibc/include/wchar.h b/src/kernel/libroot/posix/glibc/include/wchar.h index a9cd440eec..7ab4359ef2 100644 --- a/src/kernel/libroot/posix/glibc/include/wchar.h +++ b/src/kernel/libroot/posix/glibc/include/wchar.h @@ -2,51 +2,6 @@ #include # ifdef _WCHAR_H - -extern __typeof (wcscasecmp_l) __wcscasecmp_l; -extern __typeof (wcsncasecmp_l) __wcsncasecmp_l; -extern __typeof (wcscoll_l) __wcscoll_l; -extern __typeof (wcsxfrm_l) __wcsxfrm_l; -extern __typeof (wcstol_l) __wcstol_l; -extern __typeof (wcstoul_l) __wcstoul_l; -extern __typeof (wcstoll_l) __wcstoll_l; -extern __typeof (wcstoull_l) __wcstoull_l; -extern __typeof (wcstod_l) __wcstod_l; -extern __typeof (wcstof_l) __wcstof_l; -extern __typeof (wcstold_l) __wcstold_l; -extern __typeof (wcsftime_l) __wcsftime_l; -libc_hidden_proto (__wcsftime_l) - - -libc_hidden_proto (__wcstof_internal) -libc_hidden_proto (__wcstod_internal) -libc_hidden_proto (__wcstold_internal) -libc_hidden_proto (__wcstol_internal) -libc_hidden_proto (__wcstoll_internal) -libc_hidden_proto (__wcstoul_internal) -libc_hidden_proto (__wcstoull_internal) - -libc_hidden_proto (__wcscasecmp_l) -libc_hidden_proto (__wcsncasecmp_l) - -libc_hidden_proto (fputws_unlocked) -libc_hidden_proto (putwc_unlocked) -libc_hidden_proto (putwc) - -libc_hidden_proto (vswscanf) - -libc_hidden_proto (mbrtowc) -libc_hidden_proto (wcrtomb) -libc_hidden_proto (wcscmp) -libc_hidden_proto (wcsftime) -libc_hidden_proto (wcsspn) -libc_hidden_proto (wcschr) -libc_hidden_proto (wcscoll) -libc_hidden_proto (wcspbrk) - -libc_hidden_proto (wmemchr) -libc_hidden_proto (wmemset) - /* Now define the internal interfaces. */ extern int __wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __attribute_pure__; @@ -63,8 +18,6 @@ extern int __mbsinit (__const __mbstate_t *__ps); extern size_t __mbrtowc (wchar_t *__restrict __pwc, __const char *__restrict __s, size_t __n, __mbstate_t *__restrict __p); -libc_hidden_proto (__mbrtowc) -libc_hidden_proto (__mbrlen) extern size_t __wcrtomb (char *__restrict __s, wchar_t __wc, __mbstate_t *__restrict __ps); extern size_t __mbsrtowcs (wchar_t *__restrict __dst, @@ -109,9 +62,5 @@ extern int __vfwprintf (__FILE *__restrict __s, __gnuc_va_list __arg) /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */; - -/* Internal functions. */ -extern size_t __mbsrtowcs_l (wchar_t *dst, const char **src, size_t len, - mbstate_t *ps, __locale_t l) attribute_hidden; # endif #endif diff --git a/src/kernel/libroot/posix/glibc/include/wctype.h b/src/kernel/libroot/posix/glibc/include/wctype.h new file mode 100644 index 0000000000..2a944915a5 --- /dev/null +++ b/src/kernel/libroot/posix/glibc/include/wctype.h @@ -0,0 +1,12 @@ +#ifndef _WCTYPE_H + +#include + +/* Internal interfaces. */ +extern int __iswspace (wint_t __wc); +extern int __iswctype (wint_t __wc, wctype_t __desc); +extern wctype_t __wctype (__const char *__property); +extern wint_t __towctrans (wint_t __wc, wctrans_t __desc); + + +#endif