1998-10-27  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/i386/bits/select.h [!__USE_XOPEN]: Add special version
	of __FD_* macros which use __fds_bits.
	* sysdeps/generic/bits/select.h: Likewise.
	Reported by Matt McLean <keys@yikes.com>.
This commit is contained in:
Ulrich Drepper 1998-10-27 10:27:11 +00:00
parent c1a61edb7f
commit 2898c3a514
4 changed files with 102 additions and 23 deletions

View File

@ -1,3 +1,10 @@
1998-10-27 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/i386/bits/select.h [!__USE_XOPEN]: Add special version
of __FD_* macros which use __fds_bits.
* sysdeps/generic/bits/select.h: Likewise.
Reported by Matt McLean <keys@yikes.com>.
1998-10-27 Philip Blundell <pb@nexus.co.uk>
* elf/elf.h: Update ARM definitions.

View File

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