aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/i386
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-10-27 10:27:11 +0000
committerUlrich Drepper <drepper@redhat.com>1998-10-27 10:27:11 +0000
commit2898c3a51449ade24995c6711d27858218efbd4c (patch)
treec44d16df4bbdcf45e5780a61b8410a0459899d16 /sysdeps/i386
parentc1a61edb7f4f98f0e501a5cd34fbb0bc4f3646ee (diff)
downloadglibc-2898c3a51449ade24995c6711d27858218efbd4c.tar
glibc-2898c3a51449ade24995c6711d27858218efbd4c.tar.gz
glibc-2898c3a51449ade24995c6711d27858218efbd4c.tar.bz2
glibc-2898c3a51449ade24995c6711d27858218efbd4c.zip
Update.
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>.
Diffstat (limited to 'sysdeps/i386')
-rw-r--r--sysdeps/i386/bits/select.h72
1 files changed, 59 insertions, 13 deletions
diff --git a/sysdeps/i386/bits/select.h b/sysdeps/i386/bits/select.h
index f21407f81f..2e31f3bc59 100644
--- a/sysdeps/i386/bits/select.h
+++ b/sysdeps/i386/bits/select.h
@@ -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 */