diff options
Diffstat (limited to 'libc/sysdeps/linux/common')
| -rw-r--r-- | libc/sysdeps/linux/common/bits/uClibc_charclass.h | 40 | ||||
| -rw-r--r-- | libc/sysdeps/linux/common/bits/uClibc_ctype.h | 75 | ||||
| -rw-r--r-- | libc/sysdeps/linux/common/bits/uClibc_locale.h | 4 | ||||
| -rw-r--r-- | libc/sysdeps/linux/common/capset.c | 2 | ||||
| -rw-r--r-- | libc/sysdeps/linux/common/cmsg_nxthdr.c | 2 | ||||
| -rw-r--r-- | libc/sysdeps/linux/common/getpgrp.c | 14 | 
6 files changed, 65 insertions, 72 deletions
diff --git a/libc/sysdeps/linux/common/bits/uClibc_charclass.h b/libc/sysdeps/linux/common/bits/uClibc_charclass.h new file mode 100644 index 000000000..50df539b9 --- /dev/null +++ b/libc/sysdeps/linux/common/bits/uClibc_charclass.h @@ -0,0 +1,40 @@ +/*  Copyright (C) 2008  Denys Vlasenko  <vda.linux@googlemail.com> + * + *  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.1 of the License, or (at your option) any later version. + */ + +#ifndef _BITS_UCLIBC_CHARCLASS_H +#define _BITS_UCLIBC_CHARCLASS_H + +/* Taking advantage of the C99 mutual-exclusion guarantees for the various + * (w)ctype classes, including the descriptions of printing and control + * (w)chars, we can place each in one of the following mutually-exlusive + * subsets.  Since there are less than 16, we can store the data for + * each (w)chars in a nibble. In contrast, glibc uses an unsigned int + * per (w)char, with one bit flag for each is* type.  While this allows + * a simple '&' operation to determine the type vs. a range test and a + * little special handling for the "blank" and "xdigit" types in my + * approach, it also uses 8 times the space for the tables on the typical + * 32-bit archs we supported.*/ +enum { +	__CTYPE_unclassified = 0, +	__CTYPE_alpha_nonupper_nonlower, +	__CTYPE_alpha_lower, +	__CTYPE_alpha_upper_lower, +	__CTYPE_alpha_upper, +	__CTYPE_digit, +	__CTYPE_punct, +	__CTYPE_graph, +	__CTYPE_print_space_nonblank, +	__CTYPE_print_space_blank, +	__CTYPE_space_nonblank_noncntrl, +	__CTYPE_space_blank_noncntrl, +	__CTYPE_cntrl_space_nonblank, +	__CTYPE_cntrl_space_blank, +	__CTYPE_cntrl_nonspace +}; + +#endif diff --git a/libc/sysdeps/linux/common/bits/uClibc_ctype.h b/libc/sysdeps/linux/common/bits/uClibc_ctype.h index 0b02c5dbf..3c07b5799 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_ctype.h +++ b/libc/sysdeps/linux/common/bits/uClibc_ctype.h @@ -31,57 +31,15 @@  #error Always include <{w}ctype.h> rather than <bits/uClibc_ctype.h>  #endif -#ifndef _BITS_CTYPE_H -#define _BITS_CTYPE_H +#ifndef _BITS_UCLIBC_CTYPE_H +#define _BITS_UCLIBC_CTYPE_H  #ifdef __UCLIBC_GEN_LOCALE +/* We are in extra/locale/gen_XXX tools build */ -/* Taking advantage of the C99 mutual-exclusion guarantees for the various - * (w)ctype classes, including the descriptions of printing and control - * (w)chars, we can place each in one of the following mutually-exlusive - * subsets.  Since there are less than 16, we can store the data for - * each (w)chars in a nibble. In contrast, glibc uses an unsigned int - * per (w)char, with one bit flag for each is* type.  While this allows - * a simple '&' operation to determine the type vs. a range test and a - * little special handling for the "blank" and "xdigit" types in my - * approach, it also uses 8 times the space for the tables on the typical - * 32-bit archs we supported.*/ -enum { -	__CTYPE_unclassified = 0, -	__CTYPE_alpha_nonupper_nonlower, -	__CTYPE_alpha_lower, -	__CTYPE_alpha_upper_lower, -	__CTYPE_alpha_upper, -	__CTYPE_digit, -	__CTYPE_punct, -	__CTYPE_graph, -	__CTYPE_print_space_nonblank, -	__CTYPE_print_space_blank, -	__CTYPE_space_nonblank_noncntrl, -	__CTYPE_space_blank_noncntrl, -	__CTYPE_cntrl_space_nonblank, -	__CTYPE_cntrl_space_blank, -	__CTYPE_cntrl_nonspace -}; - -/* Some macros that test for various (w)ctype classes when passed one of the - * designator values enumerated above. */ -#define __CTYPE_isalnum(D)		((unsigned int)(D-1) <= (__CTYPE_digit-1)) -#define __CTYPE_isalpha(D)		((unsigned int)(D-1) <= (__CTYPE_alpha_upper-1)) -#define __CTYPE_isblank(D) \ -	((((unsigned int)(D - __CTYPE_print_space_nonblank)) <= 5) && (D & 1)) -#define __CTYPE_iscntrl(D)		(((unsigned int)(D - __CTYPE_cntrl_space_nonblank)) <= 2) -#define __CTYPE_isdigit(D)		(D == __CTYPE_digit) -#define __CTYPE_isgraph(D)		((unsigned int)(D-1) <= (__CTYPE_graph-1)) -#define __CTYPE_islower(D)		(((unsigned int)(D - __CTYPE_alpha_lower)) <= 1) -#define __CTYPE_isprint(D)		((unsigned int)(D-1) <= (__CTYPE_print_space_blank-1)) -#define __CTYPE_ispunct(D)		(D == __CTYPE_punct) -#define __CTYPE_isspace(D)		(((unsigned int)(D - __CTYPE_print_space_nonblank)) <= 5) -#define __CTYPE_isupper(D)		(((unsigned int)(D - __CTYPE_alpha_upper_lower)) <= 1) -/*  #define __CTYPE_isxdigit(D) -- isxdigit is untestable this way. - *  But that's ok as isxdigit() (and isdigit() too) are locale-invariant. */ - -#else  /* __UCLIBC_GEN_LOCALE *****************************************/ +#include "uClibc_charclass.h" + +#else /* !__UCLIBC_GEN_LOCALE */  /* Define some ctype macros valid for the C/POSIX locale. */ @@ -189,21 +147,6 @@ __END_DECLS  /**********************************************************************/  #ifdef __GNUC__ -#define __isbody_C_macro(f,args)  __C_ ## f args - -#define __isbody(f,c) \ -	(__extension__ ({ \ -		int __res; \ -		if (sizeof(c) > sizeof(char)) { \ -			int __c = (c); \ -			__res = __isbody_C_macro(f,(__c)); \ -		} else { \ -			unsigned char __c = (c); \ -			__res = __isbody_C_macro(f,(__c)); \ -		} \ -		__res; \ -	})) -  #define __body_C_macro(f,args)  __C_ ## f args  #define __body(f,c) \ @@ -253,15 +196,13 @@ __END_DECLS  #define tolower(c)			__tolower(c)  #define toupper(c)			__toupper(c) -  #endif -#else  /* _GNUC__   ***************************************************/ +#else  /* !_GNUC__ */  #if !defined __NO_CTYPE && !defined __cplusplus  /* These macros should be safe from side effects. */ -  #define isdigit(c)			__C_isdigit(c)  #define isalpha(c)			__C_isalpha(c)  #define isprint(c)			__C_isprint(c) @@ -276,4 +217,4 @@ __END_DECLS  #endif  /* __UCLIBC_GEN_LOCALE */ -#endif /* _BITS_CTYPE_H */ +#endif /* _BITS_UCLIBC_CTYPE_H */ diff --git a/libc/sysdeps/linux/common/bits/uClibc_locale.h b/libc/sysdeps/linux/common/bits/uClibc_locale.h index a6b381c95..0ac12578e 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_locale.h +++ b/libc/sysdeps/linux/common/bits/uClibc_locale.h @@ -174,7 +174,7 @@ typedef struct __uclibc_locale_struct {  	const unsigned char *idx8ctype;  	const unsigned char *tbl8ctype;  	const unsigned char *idx8uplow; -    const unsigned char *tbl8uplow; +	const unsigned char *tbl8uplow;  #ifdef __UCLIBC_HAS_WCHAR__  	const unsigned char *idx8c2wc;  	const uint16_t *tbl8c2wc;	/* char > 0x7f to wide char */ @@ -301,8 +301,6 @@ typedef struct __uclibc_locale_struct {  	const char *era_d_t_fmt;  	const char *era_t_fmt; -	/* collate is at the end */ -  	/* messages */  	const char *yesexpr;  	const char *noexpr; diff --git a/libc/sysdeps/linux/common/capset.c b/libc/sysdeps/linux/common/capset.c index f8936285e..0a77e05f4 100644 --- a/libc/sysdeps/linux/common/capset.c +++ b/libc/sysdeps/linux/common/capset.c @@ -11,7 +11,7 @@  int capset(void *header, const void *data);  #ifdef __NR_capset  _syscall2(int, capset, void *, header, const void *, data) -#else +#elif defined __UCLIBC_HAS_STUBS__  int capset(void *header, const void *data)  {  	__set_errno(ENOSYS); diff --git a/libc/sysdeps/linux/common/cmsg_nxthdr.c b/libc/sysdeps/linux/common/cmsg_nxthdr.c index 7dbf7bec5..5230fc6be 100644 --- a/libc/sysdeps/linux/common/cmsg_nxthdr.c +++ b/libc/sysdeps/linux/common/cmsg_nxthdr.c @@ -19,6 +19,8 @@  #define __FORCE_GLIBC  #include <features.h> +/* Prevent math.h from defining a colliding inline */ +#undef __USE_EXTERN_INLINES  #include <sys/socket.h>  /* libc_hidden_proto(__cmsg_nxthdr) */ diff --git a/libc/sysdeps/linux/common/getpgrp.c b/libc/sysdeps/linux/common/getpgrp.c index c9de68cd3..5d36ba155 100644 --- a/libc/sysdeps/linux/common/getpgrp.c +++ b/libc/sysdeps/linux/common/getpgrp.c @@ -2,7 +2,7 @@  /*   * getpgrp() for uClibc   * - * Copyright (C) 2000-2006 by Erik Andersen <andersen@codepoet.org> + * Copyright (C) 2000-2008 by Erik Andersen <andersen@codepoet.org>   *   * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.   */ @@ -13,4 +13,16 @@  #ifdef __NR_getpgrp  /* According to the manpage the POSIX.1 version is favoured */  _syscall0(pid_t, getpgrp) +#elif defined __NR_getpgid && (defined __NR_getpid || defined __NR_getxpid) +/* IA64 doesn't have a getpgrp syscall */ +pid_t getpgrp(void) +{ +	return getpgid(getpid()); +} +#elif defined __UCLIBC_HAS_STUBS__ +pid_t getpgrp(void) +{ +	__set_errno(ENOSYS); +	return -1; +}  #endif  | 
