1998-10-27  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de> 
 
	* string/bits/string2.h: __USE_GNU already implies __USE_MISC. 
 
1998-10-27  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de> 

	* sysdeps/generic/bits/types.h (__FDS_BITS): New macro to access 
	fds_bits member. 
	* sysdeps/unix/sysv/linux/alpha/bits/types.h (__FDS_BITS): Likewise. 
	* sysdeps/unix/sysv/linux/bits/types.h (__FDS_BITS): Likewise. 
	* sysdeps/unix/sysv/linux/mips/bits/types.h (__FDS_BITS): Likewise. 
	* sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h (__FDS_BITS): 
	Likewise. 
	* sysdeps/unix/sysv/sysv4/solaris2/bits/types.h (__FDS_BITS): 
	Likewise. 
	* sysdeps/generic/bits/select.h (__FD_ZERO, __FD_SET, __FD_CLR, 
	__FD_ISSET): Use it. 
	* sysdeps/i386/bits/select.h (__FD_ZERO, __FD_SET, __FD_CLR, 
	__FD_ISSET): Likewise.
This commit is contained in:
Ulrich Drepper 1998-10-28 14:41:59 +00:00
parent c70ca1fa69
commit 6e2cc2c147
10 changed files with 55 additions and 97 deletions

View File

@ -1,3 +1,23 @@
1998-10-27 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
* string/bits/string2.h: __USE_GNU already implies __USE_MISC.
1998-10-27 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
* sysdeps/generic/bits/types.h (__FDS_BITS): New macro to access
fds_bits member.
* sysdeps/unix/sysv/linux/alpha/bits/types.h (__FDS_BITS): Likewise.
* sysdeps/unix/sysv/linux/bits/types.h (__FDS_BITS): Likewise.
* sysdeps/unix/sysv/linux/mips/bits/types.h (__FDS_BITS): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h (__FDS_BITS):
Likewise.
* sysdeps/unix/sysv/sysv4/solaris2/bits/types.h (__FDS_BITS):
Likewise.
* sysdeps/generic/bits/select.h (__FD_ZERO, __FD_SET, __FD_CLR,
__FD_ISSET): Use it.
* sysdeps/i386/bits/select.h (__FD_ZERO, __FD_SET, __FD_CLR,
__FD_ISSET): Likewise.
1998-10-28 Geoff Keating <geoffk@ozemail.com.au> 1998-10-28 Geoff Keating <geoffk@ozemail.com.au>
* sysdeps/unix/sysv/linux/powerpc/syscalls.list: Tidy up, correct * sysdeps/unix/sysv/linux/powerpc/syscalls.list: Tidy up, correct

View File

@ -23,26 +23,13 @@
/* We don't use `memset' because this would require a prototype and /* We don't use `memset' because this would require a prototype and
the array isn't too big. */ the array isn't too big. */
#ifdef __USE_XOPEN #define __FD_ZERO(s) \
# define __FD_ZERO(s) \
do { \ do { \
unsigned int __i; \ unsigned int __i; \
__fd_set *__arr = (s); \ __fd_set *__arr = (s); \
for (__i = 0; __i < sizeof (__fd_set) / sizeof (__fd_mask); ++__i) \ for (__i = 0; __i < sizeof (__fd_set) / sizeof (__fd_mask); ++__i) \
__arr->fds_bits[__i] = '\0'; \ __FDS_BITS (__arr)[__i] = '\0'; \
} while (0) } while (0)
# define __FD_SET(d, s) ((s)->fds_bits[__FDELT(d)] |= __FDMASK(d)) #define __FD_SET(d, s) (__FDS_BITS (s)[__FDELT(d)] |= __FDMASK(d))
# define __FD_CLR(d, s) ((s)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) #define __FD_CLR(d, s) (__FDS_BITS (s)[__FDELT(d)] &= ~__FDMASK(d))
# define __FD_ISSET(d, s) (((s)->fds_bits[__FDELT(d)] & __FDMASK(d)) != 0) #define __FD_ISSET(d, s) ((__FDS_BITS (s)[__FDELT(d)] & __FDMASK(d)) != 0)
#else
# define __FD_ZERO(s) \
do { \
unsigned int __i; \
__fd_set *__arr = (s); \
for (__i = 0; __i < sizeof (__fd_set) / sizeof (__fd_mask); ++__i) \
__arr->__fds_bits[__i] = '\0'; \
} while (0)
# define __FD_SET(d, s) ((s)->__fds_bits[__FDELT(d)] |= __FDMASK(d))
# define __FD_CLR(d, s) ((s)->__fds_bits[__FDELT(d)] &= ~__FDMASK(d))
# define __FD_ISSET(d, s) (((s)->__fds_bits[__FDELT(d)] & __FDMASK(d)) != 0)
#endif

View File

@ -1013,7 +1013,7 @@ __strsep_g (char **__s, __const char *__reject)
/* We need the memory allocation functions for inline strdup(). /* We need the memory allocation functions for inline strdup().
Referring to stdlib.h (even minimally) is not allowed Referring to stdlib.h (even minimally) is not allowed
in any of the tight standards compliant modes. */ in any of the tight standards compliant modes. */
#if defined __USE_MISC || defined __USE_GNU #ifdef __USE_MISC
# if !defined _HAVE_STRING_ARCH_strdup || !defined _HAVE_STRING_ARCH_strndup # if !defined _HAVE_STRING_ARCH_strdup || !defined _HAVE_STRING_ARCH_strndup
# define __need_malloc_and_calloc # define __need_malloc_and_calloc

View File

@ -23,26 +23,13 @@
/* We don't use `memset' because this would require a prototype and /* We don't use `memset' because this would require a prototype and
the array isn't too big. */ the array isn't too big. */
#ifdef __USE_XOPEN #define __FD_ZERO(s) \
# define __FD_ZERO(s) \
do { \ do { \
unsigned int __i; \ unsigned int __i; \
__fd_set *__arr = (s); \ __fd_set *__arr = (s); \
for (__i = 0; __i < sizeof (__fd_set) / sizeof (__fd_mask); ++__i) \ for (__i = 0; __i < sizeof (__fd_set) / sizeof (__fd_mask); ++__i) \
__arr->fds_bits[__i] = '\0'; \ __FDS_BITS (__arr)[__i] = '\0'; \
} while (0) } while (0)
# define __FD_SET(d, s) ((s)->fds_bits[__FDELT(d)] |= __FDMASK(d)) #define __FD_SET(d, s) (__FDS_BITS (s)[__FDELT(d)] |= __FDMASK(d))
# define __FD_CLR(d, s) ((s)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) #define __FD_CLR(d, s) (__FDS_BITS (s)[__FDELT(d)] &= ~__FDMASK(d))
# define __FD_ISSET(d, s) (((s)->fds_bits[__FDELT(d)] & __FDMASK(d)) != 0) #define __FD_ISSET(d, s) ((__FDS_BITS (s)[__FDELT(d)] & __FDMASK(d)) != 0)
#else
# define __FD_ZERO(s) \
do { \
unsigned int __i; \
__fd_set *__arr = (s); \
for (__i = 0; __i < sizeof (__fd_set) / sizeof (__fd_mask); ++__i) \
__arr->__fds_bits[__i] = '\0'; \
} while (0)
# define __FD_SET(d, s) ((s)->__fds_bits[__FDELT(d)] |= __FDMASK(d))
# define __FD_CLR(d, s) ((s)->__fds_bits[__FDELT(d)] &= ~__FDMASK(d))
# define __FD_ISSET(d, s) (((s)->__fds_bits[__FDELT(d)] & __FDMASK(d)) != 0)
#endif

View File

@ -23,97 +23,51 @@
#if defined __GNUC__ && __GNUC__ >= 2 #if defined __GNUC__ && __GNUC__ >= 2
# ifdef __USE_XOPEN # define __FD_ZERO(fdsp) \
# define __FD_ZERO(fdsp) \
do { \ do { \
int __d0, __d1; \ int __d0, __d1; \
__asm__ __volatile__ ("cld; rep; stosl" \ __asm__ __volatile__ ("cld; rep; stosl" \
: "=m" ((fdsp)->fds_bits[__FDELT (__FD_SETSIZE)]), \ : "=m" (__FDS_BITS (fdsp)[__FDELT (__FD_SETSIZE)]), \
"=&c" (__d0), "=&D" (__d1) \ "=&c" (__d0), "=&D" (__d1) \
: "a" (0), "1" (sizeof (__fd_set) \ : "a" (0), "1" (sizeof (__fd_set) \
/ sizeof (__fd_mask)), \ / sizeof (__fd_mask)), \
"2" (&(fdsp)->fds_bits[0]) \ "2" (&__FDS_BITS (fdsp)[0]) \
: "memory"); \ : "memory"); \
} while (0) } while (0)
# define __FD_SET(fd, fdsp) \ # define __FD_SET(fd, fdsp) \
__asm__ __volatile__ ("btsl %1,%0" \ __asm__ __volatile__ ("btsl %1,%0" \
: "=m" ((fdsp)->fds_bits[__FDELT (fd)]) \ : "=m" (__FDS_BITS (fdsp)[__FDELT (fd)]) \
: "r" (((int) (fd)) % __NFDBITS) \ : "r" (((int) (fd)) % __NFDBITS) \
: "cc","memory") : "cc","memory")
# define __FD_CLR(fd, fdsp) \ # define __FD_CLR(fd, fdsp) \
__asm__ __volatile__ ("btrl %1,%0" \ __asm__ __volatile__ ("btrl %1,%0" \
: "=m" ((fdsp)->fds_bits[__FDELT (fd)]) \ : "=m" (__FDS_BITS (fdsp)[__FDELT (fd)]) \
: "r" (((int) (fd)) % __NFDBITS) \ : "r" (((int) (fd)) % __NFDBITS) \
: "cc","memory") : "cc","memory")
# define __FD_ISSET(fd, fdsp) \ # define __FD_ISSET(fd, fdsp) \
(__extension__ \ (__extension__ \
({register char __result; \ ({register char __result; \
__asm__ __volatile__ ("btl %1,%2 ; setcb %b0" \ __asm__ __volatile__ ("btl %1,%2 ; setcb %b0" \
: "=q" (__result) \ : "=q" (__result) \
: "r" (((int) (fd)) % __NFDBITS), \ : "r" (((int) (fd)) % __NFDBITS), \
"m" ((fdsp)->fds_bits[__FDELT (fd)]) \ "m" (__FDS_BITS (fdsp)[__FDELT (fd)]) \
: "cc"); \ : "cc"); \
__result; })) __result; }))
# else
# define __FD_ZERO(fdsp) \
do { \
int __d0, __d1; \
__asm__ __volatile__ ("cld; rep; stosl" \
: "=m" ((fdsp)->__fds_bits[__FDELT (__FD_SETSIZE)]),\
"=&c" (__d0), "=&D" (__d1) \
: "a" (0), "1" (sizeof (__fd_set) \
/ sizeof (__fd_mask)), \
"2" (&(fdsp)->__fds_bits[0]) \
: "memory"); \
} while (0)
# define __FD_SET(fd, fdsp) \
__asm__ __volatile__ ("btsl %1,%0" \
: "=m" ((fdsp)->__fds_bits[__FDELT (fd)]) \
: "r" (((int) (fd)) % __NFDBITS) \
: "cc","memory")
# define __FD_CLR(fd, fdsp) \
__asm__ __volatile__ ("btrl %1,%0" \
: "=m" ((fdsp)->__fds_bits[__FDELT (fd)]) \
: "r" (((int) (fd)) % __NFDBITS) \
: "cc","memory")
# define __FD_ISSET(fd, fdsp) \
(__extension__ \
({register char __result; \
__asm__ __volatile__ ("btl %1,%2 ; setcb %b0" \
: "=q" (__result) \
: "r" (((int) (fd)) % __NFDBITS), \
"m" ((fdsp)->__fds_bits[__FDELT (fd)]) \
: "cc"); \
__result; }))
# endif
#else /* ! GNU CC */ #else /* ! GNU CC */
/* We don't use `memset' because this would require a prototype and /* We don't use `memset' because this would require a prototype and
the array isn't too big. */ the array isn't too big. */
# ifdef __USE_XOPEN # define __FD_ZERO(set) \
# define __FD_ZERO(set) \
do { \ do { \
unsigned int __i; \ unsigned int __i; \
__fd_set *__arr = (set); \ __fd_set *__arr = (set); \
for (__i = 0; __i < sizeof (__fd_set) / sizeof (__fd_mask); ++__i) \ for (__i = 0; __i < sizeof (__fd_set) / sizeof (__fd_mask); ++__i) \
__arr->fds_bits[__i] = 0; \ __FDS_BITS (__arr)[__i] = 0; \
} while (0) } while (0)
# define __FD_SET(d, set) ((set)->fds_bits[__FDELT (d)] |= __FDMASK (d)) # define __FD_SET(d, set) (__FDS_BITS (set)[__FDELT (d)] |= __FDMASK (d))
# define __FD_CLR(d, set) ((set)->fds_bits[__FDELT (d)] &= ~__FDMASK (d)) # define __FD_CLR(d, set) (__FDS_BITS (set)[__FDELT (d)] &= ~__FDMASK (d))
# define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT (d)] & __FDMASK (d)) # define __FD_ISSET(d, set) (__FDS_BITS (set)[__FDELT (d)] & __FDMASK (d))
# else
do { \
unsigned int __i; \
__fd_set *__arr = (set); \
for (__i = 0; __i < sizeof (__fd_set) / sizeof (__fd_mask); ++__i) \
__arr->__fds_bits[__i] = 0; \
} while (0)
# define __FD_SET(d, set) ((set)->__fds_bits[__FDELT (d)] |= __FDMASK (d))
# define __FD_CLR(d, set) ((set)->__fds_bits[__FDELT (d)] &= ~__FDMASK (d))
# define __FD_ISSET(d, set) ((set)->__fds_bits[__FDELT (d)] & __FDMASK (d))
# endif
#endif /* GNU CC */ #endif /* GNU CC */

View File

@ -106,8 +106,10 @@ typedef struct
from the user namespace. */ from the user namespace. */
#ifdef __USE_XOPEN #ifdef __USE_XOPEN
__fd_mask fds_bits[__FD_SETSIZE / __NFDBITS]; __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS];
# define __FDS_BITS(set) ((set)->fds_bits)
#else #else
__fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS]; __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS];
# define __FDS_BITS(set) ((set)->__fds_bits)
#endif #endif
} __fd_set; } __fd_set;

View File

@ -103,8 +103,10 @@ typedef struct
from the global namespace. */ from the global namespace. */
#ifdef __USE_XOPEN #ifdef __USE_XOPEN
__fd_mask fds_bits[__FD_SETSIZE / __NFDBITS]; __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS];
# define __FDS_BITS(set) ((set)->fds_bits)
#else #else
__fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS]; __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS];
# define __FDS_BITS(set) ((set)->__fds_bits)
#endif #endif
} __fd_set; } __fd_set;

View File

@ -103,8 +103,10 @@ typedef struct
from the user namespace. */ from the user namespace. */
#ifdef __USE_XOPEN #ifdef __USE_XOPEN
__fd_mask fds_bits[__FD_SETSIZE / __NFDBITS]; __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS];
# define __FDS_BITS(set) ((set)->fds_bits)
#else #else
__fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS]; __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS];
# define __FDS_BITS(set) ((set)->__fds_bits)
#endif #endif
} __fd_set; } __fd_set;

View File

@ -97,8 +97,10 @@ typedef struct
from the user namespace. */ from the user namespace. */
#ifdef __USE_XOPEN #ifdef __USE_XOPEN
__fd_mask fds_bits[__FD_SETSIZE / __NFDBITS]; __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS];
# define __FDS_BITS(set) ((set)->fds_bits)
#else #else
__fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS]; __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS];
# define __FDS_BITS(set) ((set)->__fds_bits)
#endif #endif
} __fd_set; } __fd_set;

View File

@ -94,8 +94,10 @@ typedef struct
from the user namespace. */ from the user namespace. */
#ifdef __USE_XOPEN #ifdef __USE_XOPEN
unsigned long int fds_bits[(__FD_SETSIZE + (__NFDBITS - 1)) / __NFDBITS]; unsigned long int fds_bits[(__FD_SETSIZE + (__NFDBITS - 1)) / __NFDBITS];
# define __FDS_BITS(set) ((set)->fds_bits)
#else #else
unsigned long int __fds_bits[(__FD_SETSIZE + (__NFDBITS - 1)) / __NFDBITS]; unsigned long int __fds_bits[(__FD_SETSIZE + (__NFDBITS - 1)) / __NFDBITS];
# define __FDS_BITS(set) ((set)->__fds_bits)
#endif #endif
} __fd_set; } __fd_set;