patch-1.3.44 linux/include/asm-sparc/types.h

Next file: linux/include/asm-sparc/ultra.h
Previous file: linux/include/asm-sparc/tsunami.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.43/linux/include/asm-sparc/types.h linux/include/asm-sparc/types.h
@@ -1,3 +1,4 @@
+/* $Id: types.h,v 1.8 1995/11/25 02:33:08 davem Exp $ */
 #ifndef _SPARC_TYPES_H
 #define _SPARC_TYPES_H
 
@@ -6,10 +7,6 @@
  * header files exported to user space   <-- Linus sez this
  */
 
-/* NOTE: I will have to change these when the V9 sparcs come into play,
- *       however this won't be for a while.
- */
-
 #ifndef _SIZE_T
 #define _SIZE_T
 #ifdef __svr4__
@@ -26,9 +23,30 @@
 
 #ifndef _PTRDIFF_T
 #define _PTRDIFF_T
-typedef int ptrdiff_t;
+typedef long int ptrdiff_t;
+#endif
+
+#ifndef _TIME_T
+#define _TIME_T
+typedef long time_t;
 #endif
 
+#ifndef _CLOCK_T
+#define _CLOCK_T
+typedef long clock_t;
+#endif
+
+typedef int pid_t;
+typedef unsigned short uid_t;
+typedef unsigned short gid_t;
+typedef unsigned short dev_t;
+typedef unsigned long ino_t;
+typedef unsigned short mode_t;
+typedef unsigned short umode_t;
+typedef short nlink_t;
+typedef long daddr_t;
+typedef long off_t;
+
 typedef signed char __s8;
 typedef unsigned char __u8;
 
@@ -38,8 +56,6 @@
 typedef signed int __s32;
 typedef unsigned int __u32;
 
-/* Only 32-bit sparcs for now so.... */
-
 typedef signed long long __s64;
 typedef unsigned long long __u64;
 
@@ -54,11 +70,62 @@
 typedef signed int s32;
 typedef unsigned int u32;
 
-/* Again, only have to worry about 32-bits */
-
 typedef signed long long s64;
 typedef unsigned long long u64;
 
 #endif /* __KERNEL__ */
+
+#undef __FD_SET
+static __inline__ void __FD_SET(unsigned long fd, fd_set *fdsetp)
+{
+	unsigned long _tmp = fd / __NFDBITS;
+	unsigned long _rem = fd % __NFDBITS;
+	fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
+}
+
+#undef __FD_CLR
+static __inline__ void __FD_CLR(unsigned long fd, fd_set *fdsetp)
+{
+	unsigned long _tmp = fd / __NFDBITS;
+	unsigned long _rem = fd % __NFDBITS;
+	fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
+}
+
+#undef __FD_ISSET
+static __inline__ int __FD_ISSET(unsigned long fd, fd_set *p)
+{ 
+	unsigned long _tmp = fd / __NFDBITS;
+	unsigned long _rem = fd % __NFDBITS;
+	return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
+}
+
+/*
+ * This will unroll the loop for the normal constant cases (4 or 8 longs,
+ * for 256 and 512-bit fd_sets respectively)
+ */
+#undef __FD_ZERO
+static __inline__ void __FD_ZERO(fd_set *p)
+{
+	unsigned int *tmp = p->fds_bits;
+	int i;
+
+	if (__builtin_constant_p(__FDSET_INTS)) {
+		switch (__FDSET_INTS) {
+			case 8:
+				tmp[0] = 0; tmp[1] = 0; tmp[2] = 0; tmp[3] = 0;
+				tmp[4] = 0; tmp[5] = 0; tmp[6] = 0; tmp[7] = 0;
+				return;
+			case 4:
+				tmp[0] = 0; tmp[1] = 0; tmp[2] = 0; tmp[3] = 0;
+				return;
+		}
+	}
+	i = __FDSET_INTS;
+	while (i) {
+		i--;
+		*tmp = 0;
+		tmp++;
+	}
+}
 
 #endif /* defined(_SPARC_TYPES_H) */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this