patch-1.3.78 linux/include/linux/types.h

Next file: linux/include/linux/vt.h
Previous file: linux/include/linux/tty.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.77/linux/include/linux/types.h linux/include/linux/types.h
@@ -1,68 +1,92 @@
 #ifndef _LINUX_TYPES_H
 #define _LINUX_TYPES_H
 
-/*
- * This allows for 256 file descriptors: if NR_OPEN is ever grown beyond that
- * you'll have to change this too. But 256 fd's seem to be enough even for such
- * "real" unices like SunOS, so hopefully this is one limit that doesn't have
- * to be changed.
- *
- * Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in <sys/time.h>
- * (and thus <linux/time.h>) - but this is a more logical place for them. Solved
- * by having dummy defines in <sys/time.h>.
- */
+#include <linux/posix_types.h>
+#include <asm/types.h>
+
+#ifndef _LINUX_TYPES_DONT_EXPORT
+
+typedef __fd_set	fd_set;
+typedef __dev_t		dev_t;
+typedef __ino_t		ino_t;
+typedef __mode_t	mode_t;
+typedef __nlink_t	nlink_t;
+typedef __off_t		off_t;
+typedef __pid_t		pid_t;
+typedef __uid_t		uid_t;
+typedef __gid_t		gid_t;
+typedef __daddr_t	daddr_t;
+
+/* bsd */
+
+typedef __u_char	u_char;
+typedef __u_short	u_short;
+typedef __u_int		u_int;
+typedef __u_long	u_long;
 
 /*
- * Those macros may have been defined in <gnu/types.h>. But we always
- * use the ones here. 
+ * The following typedefs are also protected by individual ifdefs for
+ * historical reasons:
  */
-#undef __NFDBITS
-#define __NFDBITS	(8 * sizeof(unsigned int))
+#ifndef _SIZE_T
+#define _SIZE_T
+typedef __size_t	size_t;
+#endif
 
-#undef __FD_SETSIZE
-#define __FD_SETSIZE	256
+#ifndef _SSIZE_T
+#define _SSIZE_T
+typedef __ssize_t	ssize_t;
+#endif
 
-#undef __FDSET_INTS
-#define __FDSET_INTS	(__FD_SETSIZE/__NFDBITS)
+#ifndef _PTRDIFF_T
+#define _PTRDIFF_T
+typedef __ptrdiff_t	ptrdiff_t;
+#endif
 
-typedef struct fd_set {
-	unsigned int fds_bits [__FDSET_INTS];
-} fd_set;
+#ifndef _TIME_T
+#define _TIME_T
+typedef __time_t	time_t;
+#endif
 
-#include <asm/types.h>
+#ifndef _CLOCK_T
+#define _CLOCK_T
+typedef __clock_t	clock_t;
+#endif
 
-#ifndef NULL
-#define NULL ((void *) 0)
+#ifndef _CADDR_T
+#define _CADDR_T
+typedef __caddr_t	caddr_t;
 #endif
 
+/* sysv */
+typedef unsigned char	unchar;
+typedef unsigned short	ushort;
+typedef unsigned int	uint;
+typedef unsigned long	ulong;
+
+#endif /* _LINUX_TYPES_DONT_EXPORT */
+
+/*
+ * Below are truly Linux-specific types that should never collide with
+ * any application/library that wants linux/types.h.
+ */
+
 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+
+typedef long long	__loff_t;
+
+#ifndef _LINUX_TYPES_DONT_EXPORT
 #define _LOFF_T
-typedef long long loff_t;
+typedef __loff_t	loff_t;
 #endif
 
-/* bsd */
-typedef unsigned char u_char;
-typedef unsigned short u_short;
-typedef unsigned int u_int;
-typedef unsigned long u_long;
-
-/* sysv */
-typedef unsigned char unchar;
-typedef unsigned short ushort;
-typedef unsigned int uint;
-typedef unsigned long ulong;
-
-typedef char *caddr_t;
-
-typedef unsigned char cc_t;
-typedef unsigned int speed_t;
-typedef unsigned int tcflag_t;
+#endif
 
 struct ustat {
-	daddr_t f_tfree;
-	ino_t f_tinode;
-	char f_fname[6];
-	char f_fpack[6];
+	__daddr_t	f_tfree;
+	__ino_t		f_tinode;
+	char		f_fname[6];
+	char		f_fpack[6];
 };
 
-#endif
+#endif /* _LINUX_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