posix_types.h type correction

a sun (asun@zoology.washington.edu)
Thu, 12 Jun 1997 09:06:32 -0700 (PDT)


of course, i screwed up a little on the last patch. my space key isn't
as quick as i thought it was. here's a correction:

--- linux/include/asm-alpha/posix_types.h.save Thu Jun 12 08:17:02 1997
+++ linux/include/asm-alpha/posix_types.h Thu Jun 12 08:32:37 1997
@@ -35,45 +35,59 @@

#ifndef __GNUC__

+#ifndef __FD_SET
#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
+#endif
+
+#ifndef __FD_CLR
#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
+#endif
+
+#ifndef __FD_ISSET
#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
+#endif
+
+#ifndef __FD_ZERO
#define __FD_ZERO(set) \
((void) memset ((__ptr_t) (set), 0, sizeof (__kernel_fd_set)))
+#endif

#else /* __GNUC__ */

/* With GNU C, use inline functions instead so args are evaluated only once: */

-#undef __FD_SET
+#ifndef __FD_SET
static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
{
unsigned long _tmp = fd / __NFDBITS;
unsigned long _rem = fd % __NFDBITS;
fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
}
+#endif

-#undef __FD_CLR
+#ifndef __FD_CLR
static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
{
unsigned long _tmp = fd / __NFDBITS;
unsigned long _rem = fd % __NFDBITS;
fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
}
+#endif

-#undef __FD_ISSET
+#ifndef __FD_ISSET
static __inline__ int __FD_ISSET(unsigned long fd, const __kernel_fd_set *p)
{
unsigned long _tmp = fd / __NFDBITS;
unsigned long _rem = fd % __NFDBITS;
return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
}
+#endif

/*
* This will unroll the loop for the normal constant case (8 ints,
* for a 256-bit fd_set)
*/
-#undef __FD_ZERO
+#ifndef __FD_ZERO
static __inline__ void __FD_ZERO(__kernel_fd_set *p)
{
unsigned long *tmp = p->fds_bits;
@@ -105,6 +119,7 @@
tmp++;
}
}
+#endif

#endif /* __GNUC__ */

--- linux/include/asm-i386/posix_types.h.save Thu Jun 12 08:28:37 1997
+++ linux/include/asm-i386/posix_types.h Thu Jun 12 08:42:00 1997
@@ -36,29 +36,33 @@
#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
} __kernel_fsid_t;

-#undef __FD_SET
+#ifndef __FD_SET
#define __FD_SET(fd,fdsetp) \
__asm__ __volatile__("btsl %1,%0": \
"=m" (*(__kernel_fd_set *) (fdsetp)):"r" ((int) (fd)))
+#endif

-#undef __FD_CLR
+#ifndef __FD_CLR
#define __FD_CLR(fd,fdsetp) \
__asm__ __volatile__("btrl %1,%0": \
"=m" (*(__kernel_fd_set *) (fdsetp)):"r" ((int) (fd)))
+#endif

-#undef __FD_ISSET
+#ifndef __FD_ISSET
#define __FD_ISSET(fd,fdsetp) (__extension__ ({ \
unsigned char __result; \
__asm__ __volatile__("btl %1,%2 ; setb %0" \
:"=q" (__result) :"r" ((int) (fd)), \
"m" (*(__kernel_fd_set *) (fdsetp))); \
__result; }))
+#endif

-#undef __FD_ZERO
+#ifndef __FD_ZERO
#define __FD_ZERO(fdsetp) \
__asm__ __volatile__("cld ; rep ; stosl" \
:"=m" (*(__kernel_fd_set *) (fdsetp)) \
:"a" (0), "c" (__FDSET_LONGS), \
"D" ((__kernel_fd_set *) (fdsetp)) :"cx","di")
+#endif

#endif
--- linux/include/asm-m68k/posix_types.h.save Thu Jun 12 08:35:23 1997
+++ linux/include/asm-m68k/posix_types.h Thu Jun 12 08:35:51 1997
@@ -36,16 +36,20 @@
#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
} __kernel_fsid_t;

-#undef __FD_SET
+#ifndef __FD_SET
#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
+#endif

-#undef __FD_CLR
+#ifndef __FD_CLR
#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
+#endif

-#undef __FD_ISSET
+#ifndef __FD_ISSET
#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
+#endif

-#undef __FD_ZERO
+#ifndef __FD_ZERO
#define __FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof(*(fd_set *)fdsetp)))
+#endif

#endif
--- linux/include/asm-ppc/posix_types.h.save Thu Jun 12 08:36:15 1997
+++ linux/include/asm-ppc/posix_types.h Thu Jun 12 08:37:40 1997
@@ -34,45 +34,59 @@

#ifndef __GNUC__

+#ifndef __FD_SET
#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
+#endif
+
+#ifndef __FD_CLR
#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
+#endif
+
+#ifndef __FD_ISSET_
#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
+#endif
+
+#ifndef __FD_ZERO
#define __FD_ZERO(set) \
((void) memset ((__ptr_t) (set), 0, sizeof (__kernel_fd_set)))
+#endif

#else /* __GNUC__ */

/* With GNU C, use inline functions instead so args are evaluated only once: */

-#undef __FD_SET
+#ifndef __FD_SET
static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
{
unsigned long _tmp = fd / __NFDBITS;
unsigned long _rem = fd % __NFDBITS;
fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
}
+#endif

-#undef __FD_CLR
+#ifndef __FD_CLR
static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
{
unsigned long _tmp = fd / __NFDBITS;
unsigned long _rem = fd % __NFDBITS;
fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
}
+#endif

-#undef __FD_ISSET
+#ifndef __FD_ISSET
static __inline__ int __FD_ISSET(unsigned long fd, __kernel_fd_set *p)
{
unsigned long _tmp = fd / __NFDBITS;
unsigned long _rem = fd % __NFDBITS;
return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
}
+#endif

/*
* This will unroll the loop for the normal constant case (8 ints,
* for a 256-bit fd_set)
*/
-#undef __FD_ZERO
+#ifndef __FD_ZERO
static __inline__ void __FD_ZERO(__kernel_fd_set *p)
{
unsigned int *tmp = (unsigned int *)p->fds_bits;
@@ -93,6 +107,7 @@
tmp++;
}
}
+#endif

#endif /* __GNUC__ */

--- linux/include/asm-sparc/posix_types.h.save Thu Jun 12 08:37:53 1997
+++ linux/include/asm-sparc/posix_types.h Thu Jun 12 08:38:41 1997
@@ -39,35 +39,38 @@
int val[2];
} __kernel_fsid_t;

-#undef __FD_SET
+#ifndef __FD_SET
static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
{
unsigned long _tmp = fd / __NFDBITS;
unsigned long _rem = fd % __NFDBITS;
fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
}
+#endif

-#undef __FD_CLR
+#ifndef __FD_CLR
static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
{
unsigned long _tmp = fd / __NFDBITS;
unsigned long _rem = fd % __NFDBITS;
fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
}
+#endif

-#undef __FD_ISSET
+#ifndef __FD_ISSET
static __inline__ int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p)
{
unsigned long _tmp = fd / __NFDBITS;
unsigned long _rem = fd % __NFDBITS;
return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
}
+#endif

/*
* This will unroll the loop for the normal constant cases (8 or 32 longs,
* for 256 and 1024-bit fd_sets respectively)
*/
-#undef __FD_ZERO
+#ifndef __FD_ZERO
static __inline__ void __FD_ZERO(__kernel_fd_set *p)
{
unsigned long *tmp = p->fds_bits;
@@ -107,5 +110,6 @@
tmp++;
}
}
+#endif

#endif /* !(__ARCH_SPARC_POSIX_TYPES_H) */
--- linux/include/asm-sparc64/posix_types.h.save Thu Jun 12 08:38:54 1997
+++ linux/include/asm-sparc64/posix_types.h Thu Jun 12 08:39:36 1997
@@ -55,35 +55,38 @@
typedef long __kernel_loff_t32;
typedef __kernel_fsid_t __kernel_fsid_t32;

-#undef __FD_SET
+#ifndef __FD_SET
static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
{
unsigned long _tmp = fd / __NFDBITS;
unsigned long _rem = fd % __NFDBITS;
fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
}
+#endif

-#undef __FD_CLR
+#ifndef __FD_CLR
static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
{
unsigned long _tmp = fd / __NFDBITS;
unsigned long _rem = fd % __NFDBITS;
fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
}
+#endif

-#undef __FD_ISSET
+#ifndef __FD_ISSET
static __inline__ int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p)
{
unsigned long _tmp = fd / __NFDBITS;
unsigned long _rem = fd % __NFDBITS;
return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
}
+#endif

/*
* This will unroll the loop for the normal constant cases (8 or 32 longs,
* for 256 and 1024-bit fd_sets respectively)
*/
-#undef __FD_ZERO
+#ifndef __FD_ZERO
static __inline__ void __FD_ZERO(__kernel_fd_set *p)
{
unsigned long *tmp = p->fds_bits;
@@ -123,5 +126,6 @@
tmp++;
}
}
+#endif

#endif /* !(__ARCH_SPARC64_POSIX_TYPES_H) */