diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-10-04 07:38:56 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-10-04 07:38:56 +0000 |
commit | 0ee72c0b1534e16e6240e99f822b2401cfc1dd4d (patch) | |
tree | c7e7345c649b805563fd0ec44c4e12dd75816bad | |
parent | dc52a36cadc2279f9cc104b921ef8f3b3ad9531a (diff) |
Patch from David McCullough <davidm@lineo.com>:
* reduce the sigset types to 32 bits (I've mentioned this before)
I think I saw this change go in for another platform anyway ;-)
* Do not use _IO_FILE as it clashes with the C++ libraries which know
too much about how glibc workds :-(
* Do not use _G_va_list for the same reason.
* remove the CTORS/DTORS from crt0.S for ARM as the compiler provided
crtbegin.o and crtend.o have these (and only these) already in them and
you get multiple defined errs :-(
-rw-r--r-- | include/stdio.h | 31 | ||||
-rw-r--r-- | libc/sysdeps/linux/arm/bits/sigset.h | 76 | ||||
-rw-r--r-- | libc/sysdeps/linux/arm/crt0.S | 2 | ||||
-rw-r--r-- | libc/sysdeps/linux/sh/bits/sigset.h | 79 |
4 files changed, 38 insertions, 150 deletions
diff --git a/include/stdio.h b/include/stdio.h index def468794..e92220186 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -46,14 +46,15 @@ __BEGIN_DECLS /* when you add or change fields here, be sure to change the initialization * in stdio_init and fopen */ -struct _IO_FILE { + +struct _UC_FILE { unsigned char *bufpos; /* the next byte to write to or read from */ unsigned char *bufread; /* the end of data returned by last read() */ unsigned char *bufwrite; /* 1 + highest address writable by macro */ unsigned char *bufstart; /* the start of the buffer */ unsigned char *bufend; /* the end of the buffer; ie the byte after the last malloc()ed byte */ - struct _IO_FILE * next; + struct _UC_FILE * next; int fd; /* the file descriptor associated with the stream */ @@ -61,7 +62,8 @@ struct _IO_FILE { unsigned char ungot; char unbuf[2]; /* The buffer for 'unbuffered' streams */ }; -typedef struct _IO_FILE FILE; + +typedef struct _UC_FILE FILE; # define __FILE_defined 1 #endif /* FILE not defined. */ @@ -71,7 +73,7 @@ typedef struct _IO_FILE FILE; #if !defined ____FILE_defined && defined __need___FILE /* The opaque type of streams. This is the definition used elsewhere. */ -typedef struct _IO_FILE __FILE; +typedef struct _UC_FILE __FILE; # define ____FILE_defined 1 #endif /* __FILE not defined. */ @@ -82,7 +84,6 @@ typedef struct _IO_FILE __FILE; #undef _STDIO_USES_IOSTREAM #include <stdarg.h> -typedef va_list _G_va_list; /* The type of the second argument to `fgetpos' and `fsetpos'. */ #ifndef __USE_FILE_OFFSET64 @@ -300,13 +301,13 @@ extern int sprintf (char *__restrict __s, /* Write formatted output to S from argument list ARG. */ extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format, - _G_va_list __arg) __THROW; + va_list __arg) __THROW; /* Write formatted output to stdout from argument list ARG. */ -extern int vprintf (__const char *__restrict __format, _G_va_list __arg) +extern int vprintf (__const char *__restrict __format, va_list __arg) __THROW; /* Write formatted output to S from argument list ARG. */ extern int vsprintf (char *__restrict __s, __const char *__restrict __format, - _G_va_list __arg) __THROW; + va_list __arg) __THROW; #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98 /* Maximum chars of output to write in MAXLEN. */ @@ -315,7 +316,7 @@ extern int snprintf (char *__restrict __s, size_t __maxlen, __THROW __attribute__ ((__format__ (__printf__, 3, 4))); extern int vsnprintf (char *__restrict __s, size_t __maxlen, - __const char *__restrict __format, _G_va_list __arg) + __const char *__restrict __format, va_list __arg) __THROW __attribute__ ((__format__ (__printf__, 3, 0))); #endif @@ -323,7 +324,7 @@ extern int vsnprintf (char *__restrict __s, size_t __maxlen, /* Write formatted output to a string dynamically allocated with `malloc'. Store the address of the string in *PTR. */ extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f, - _G_va_list __arg) + va_list __arg) __THROW __attribute__ ((__format__ (__printf__, 2, 0))); extern int __asprintf (char **__restrict __ptr, __const char *__restrict __fmt, ...) @@ -334,7 +335,7 @@ extern int asprintf (char **__restrict __ptr, /* Write formatted output to a file descriptor. */ extern int vdprintf (int __fd, __const char *__restrict __fmt, - _G_va_list __arg) + va_list __arg) __THROW __attribute__ ((__format__ (__printf__, 2, 0))); extern int dprintf (int __fd, __const char *__restrict __fmt, ...) __THROW __attribute__ ((__format__ (__printf__, 2, 3))); @@ -353,16 +354,16 @@ extern int sscanf (__const char *__restrict __s, #ifdef __USE_ISOC99 /* Read formatted input from S into argument list ARG. */ extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format, - _G_va_list __arg) + va_list __arg) __THROW __attribute__ ((__format__ (__scanf__, 2, 0))); /* Read formatted input from stdin into argument list ARG. */ -extern int vscanf (__const char *__restrict __format, _G_va_list __arg) +extern int vscanf (__const char *__restrict __format, va_list __arg) __THROW __attribute__ ((__format__ (__scanf__, 1, 0))); /* Read formatted input from S into argument list ARG. */ extern int vsscanf (__const char *__restrict __s, - __const char *__restrict __format, _G_va_list __arg) + __const char *__restrict __format, va_list __arg) __THROW __attribute__ ((__format__ (__scanf__, 2, 0))); #endif /* Use ISO C9x. */ @@ -636,7 +637,7 @@ extern int obstack_printf (struct obstack *__restrict __obstack, __const char *__restrict __format, ...) __THROW; extern int obstack_vprintf (struct obstack *__restrict __obstack, __const char *__restrict __format, - _G_va_list __args) __THROW; + va_list __args) __THROW; #endif /* Use GNU. */ diff --git a/libc/sysdeps/linux/arm/bits/sigset.h b/libc/sysdeps/linux/arm/bits/sigset.h index 7ccadda45..6a516cd29 100644 --- a/libc/sysdeps/linux/arm/bits/sigset.h +++ b/libc/sysdeps/linux/arm/bits/sigset.h @@ -24,11 +24,7 @@ typedef int __sig_atomic_t; /* A `sigset_t' has a bit for each signal. */ -# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int))) -typedef struct - { - unsigned long int __val[_SIGSET_NWORDS]; - } __sigset_t; +typedef unsigned long __sigset_t; #endif @@ -47,79 +43,27 @@ typedef struct # endif /* Return a mask that includes the bit for SIG only. */ -# define __sigmask(sig) \ - (((unsigned long int) 1) << (((sig) - 1) % (8 * sizeof (unsigned long int)))) - -/* Return the word index for SIG. */ -# define __sigword(sig) (((sig) - 1) / (8 * sizeof (unsigned long int))) +# define __sigmask(sig) (1L << ((sig) - 1)) # if defined __GNUC__ && __GNUC__ >= 2 -# define __sigemptyset(set) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - sigset_t *__set = (set); \ - while (--__cnt >= 0) __set->__val[__cnt] = 0; \ - 0; })) -# define __sigfillset(set) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - sigset_t *__set = (set); \ - while (--__cnt >= 0) __set->__val[__cnt] = ~0UL; \ - 0; })) +# define __sigemptyset(set) (*(set) = 0) +# define __sigfillset(set) (*(set) = ~0) # ifdef __USE_GNU /* The POSIX does not specify for handling the whole signal set in one command. This is often wanted and so we define three more functions here. */ -# define __sigisemptyset(set) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - const sigset_t *__set = (set); \ - int __ret = __set->__val[--__cnt]; \ - while (!__ret && --__cnt >= 0) \ - __ret = __set->__val[__cnt]; \ - __ret == 0; })) -# define __sigandset(dest, left, right) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - sigset_t *__dest = (dest); \ - const sigset_t *__left = (left); \ - const sigset_t *__right = (right); \ - while (--__cnt >= 0) \ - __dest->__val[__cnt] = (__left->__val[__cnt] \ - & __right->__val[__cnt]); \ - 0; })) -# define __sigorset(dest, left, right) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - sigset_t *__dest = (dest); \ - const sigset_t *__left = (left); \ - const sigset_t *__right = (right); \ - while (--__cnt >= 0) \ - __dest->__val[__cnt] = (__left->__val[__cnt] \ - | __right->__val[__cnt]); \ - 0; })) +# define __sigisemptyset(set) (*(set) == 0) +# define __sigandset(dest, left, right) (*(dest) = *(left) & *(right)) +# define __sigorset(dest, left, right) (*(dest) = *(left) | *(right)) # endif # endif /* These functions needn't check for a bogus signal number -- error checking is done in the non __ versions. */ -extern int __sigismember (__const __sigset_t *, int); -extern int __sigaddset (__sigset_t *, int); -extern int __sigdelset (__sigset_t *, int); - -# ifdef __USE_EXTERN_INLINES -# define __SIGSETFN(NAME, BODY, CONST) \ - _EXTERN_INLINE int \ - NAME (CONST __sigset_t *__set, int __sig) \ - { \ - unsigned long int __mask = __sigmask (__sig); \ - unsigned long int __word = __sigword (__sig); \ - return BODY; \ - } - -__SIGSETFN (__sigismember, (__set->__val[__word] & __mask) ? 1 : 0, __const) -__SIGSETFN (__sigaddset, ((__set->__val[__word] |= __mask), 0), ) -__SIGSETFN (__sigdelset, ((__set->__val[__word] &= ~__mask), 0), ) - -# undef __SIGSETFN -# endif - +# define __sigismember(set, sig) (*(set) & (1L << ((sig)-1))) +# define __sigaddset(set, sig) (*(set) |= (1L << ((sig)-1))) +# define __sigdelset(set, sig) (*(set) &= ~(1L << ((sig)-1))) #endif /* ! _SIGSET_H_fns. */ diff --git a/libc/sysdeps/linux/arm/crt0.S b/libc/sysdeps/linux/arm/crt0.S index 01bcb321f..65253881c 100644 --- a/libc/sysdeps/linux/arm/crt0.S +++ b/libc/sysdeps/linux/arm/crt0.S @@ -62,6 +62,7 @@ _start: /* Ok, now run uClibc's main() -- shouldn't return */ bl __uClibc_main +#if 0 /* this is already provided by crtbegin/crtend in the arm-elf compiler */ /* a little bit of stuff to support C++ */ .section .ctors,"aw" .align 4 @@ -74,3 +75,4 @@ __CTOR_LIST__: .global __DTOR_LIST__ __DTOR_LIST__: .long -1 +#endif diff --git a/libc/sysdeps/linux/sh/bits/sigset.h b/libc/sysdeps/linux/sh/bits/sigset.h index de852a8a0..dcdc924c2 100644 --- a/libc/sysdeps/linux/sh/bits/sigset.h +++ b/libc/sysdeps/linux/sh/bits/sigset.h @@ -24,11 +24,7 @@ typedef int __sig_atomic_t; /* A `sigset_t' has a bit for each signal. */ -# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int))) -typedef struct - { - unsigned long int __val[_SIGSET_NWORDS]; - } __sigset_t; +typedef unsigned long __sigset_t; #endif @@ -47,82 +43,27 @@ typedef struct # endif /* Return a mask that includes the bit for SIG only. */ -# define __sigmask(sig) \ - (((unsigned long int) 1) << (((sig) - 1) % (8 * sizeof (unsigned long int)))) - -/* Return the word index for SIG. */ -# define __sigword(sig) (((sig) - 1) / (8 * sizeof (unsigned long int))) +# define __sigmask(sig) (1L << ((sig) - 1)) # if defined __GNUC__ && __GNUC__ >= 2 -# define __sigemptyset(set) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - sigset_t *__set = (set); \ - while (--__cnt >= 0) __set->__val[__cnt] = 0; \ - 0; })) -# define __sigfillset(set) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - sigset_t *__set = (set); \ - while (--__cnt >= 0) __set->__val[__cnt] = ~0UL; \ - 0; })) +# define __sigemptyset(set) (*(set) = 0) +# define __sigfillset(set) (*(set) = ~0) # ifdef __USE_GNU /* The POSIX does not specify for handling the whole signal set in one command. This is often wanted and so we define three more functions here. */ -# define __sigisemptyset(set) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - const sigset_t *__set = (set); \ - int __ret = __set->__val[--__cnt]; \ - while (!__ret && --__cnt >= 0) \ - __ret = __set->__val[__cnt]; \ - __ret == 0; })) -# define __sigandset(dest, left, right) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - sigset_t *__dest = (dest); \ - const sigset_t *__left = (left); \ - const sigset_t *__right = (right); \ - while (--__cnt >= 0) \ - __dest->__val[__cnt] = (__left->__val[__cnt] \ - & __right->__val[__cnt]); \ - 0; })) -# define __sigorset(dest, left, right) \ - (__extension__ ({ int __cnt = _SIGSET_NWORDS; \ - sigset_t *__dest = (dest); \ - const sigset_t *__left = (left); \ - const sigset_t *__right = (right); \ - while (--__cnt >= 0) \ - __dest->__val[__cnt] = (__left->__val[__cnt] \ - | __right->__val[__cnt]); \ - 0; })) +# define __sigisemptyset(set) (*(set) == 0) +# define __sigandset(dest, left, right) (*(dest) = *(left) & *(right)) +# define __sigorset(dest, left, right) (*(dest) = *(left) | *(right)) # endif # endif -__BEGIN_DECLS - /* These functions needn't check for a bogus signal number -- error checking is done in the non __ versions. */ -extern int __sigismember (__const __sigset_t *, int); -extern int __sigaddset (__sigset_t *, int); -extern int __sigdelset (__sigset_t *, int); - -# ifdef __USE_EXTERN_INLINES -# define __SIGSETFN(NAME, BODY, CONST) \ - _EXTERN_INLINE int \ - NAME (CONST __sigset_t *__set, int __sig) \ - { \ - unsigned long int __mask = __sigmask (__sig); \ - unsigned long int __word = __sigword (__sig); \ - return BODY; \ - } - -__SIGSETFN (__sigismember, (__set->__val[__word] & __mask) ? 1 : 0, __const) -__SIGSETFN (__sigaddset, ((__set->__val[__word] |= __mask), 0), ) -__SIGSETFN (__sigdelset, ((__set->__val[__word] &= ~__mask), 0), ) - -# undef __SIGSETFN -# endif - -__END_DECLS +# define __sigismember(set, sig) (*(set) & (1L << ((sig)-1))) +# define __sigaddset(set, sig) (*(set) |= (1L << ((sig)-1))) +# define __sigdelset(set, sig) (*(set) &= ~(1L << ((sig)-1))) #endif /* ! _SIGSET_H_fns. */ |