aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/_types.h
diff options
context:
space:
mode:
authorMike Barcroft <mike@FreeBSD.org>2002-08-23 16:49:06 +0000
committerMike Barcroft <mike@FreeBSD.org>2002-08-23 16:49:06 +0000
commitbd8e0716d91cb8b715ba2d2e1b340e4308a25fd9 (patch)
treee3c9129aee1cdf5fcda7ca2632c4f5aacdcbcdc9 /sys/sys/_types.h
parent3a48fb1bf779a6a116d69936fc99f1f76bca9f9d (diff)
downloadsrc-bd8e0716d91cb8b715ba2d2e1b340e4308a25fd9.tar.gz
src-bd8e0716d91cb8b715ba2d2e1b340e4308a25fd9.zip
Move several MI types from <machine/_types.h> to <sys/_types.h>.
These types are unlikely to ever become very MD. They include: clockid_t, ct_rune_t, fflags_t, intrmask_t, mbstate_t, off_t, pid_t, rune_t, socklen_t, timer_t, wchar_t, and wint_t. While moving them, make a few adjustments (submitted by bde): o __ct_rune_t needs to be precisely `int', not necessarily __int32_t, since the arg type of the ctype functions is int. o __rune_t, __wchar_t and __wint_t inherit this via a typedef of __ct_rune_t. o Some minor wording changes in the comment blocks for ct_rune_t and mbstate_t. Submitted by: bde (partially)
Notes
Notes: svn path=/head/; revision=102315
Diffstat (limited to 'sys/sys/_types.h')
-rw-r--r--sys/sys/_types.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/sys/sys/_types.h b/sys/sys/_types.h
index 864ba71d91ec..da644ea8493a 100644
--- a/sys/sys/_types.h
+++ b/sys/sys/_types.h
@@ -32,10 +32,52 @@
#include <sys/cdefs.h>
#include <machine/_types.h>
+/*
+ * Standard type definitions.
+ */
+typedef __int32_t __clockid_t; /* clock_gettime()... */
+typedef __uint32_t __fflags_t; /* file flags */
typedef __uint64_t __fsblkcnt_t;
typedef __uint64_t __fsfilcnt_t;
+typedef __uint32_t __intrmask_t;
typedef __uint32_t __gid_t;
+typedef __int64_t __off_t; /* file offset */
+typedef __int32_t __pid_t; /* process [group] */
typedef __uint8_t __sa_family_t;
+typedef __uint32_t __socklen_t;
+typedef __int32_t __timer_t; /* timer_gettime()... */
typedef __uint32_t __uid_t;
+/*
+ * Unusual type definitions.
+ */
+/*
+ * rune_t is declared to be an ``int'' instead of the more natural
+ * ``unsigned long'' or ``long''. Two things are happening here. It is not
+ * unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
+ * it looks like 10646 will be a 31 bit standard. This means that if your
+ * ints cannot hold 32 bits, you will be in trouble. The reason an int was
+ * chosen over a long is that the is*() and to*() routines take ints (says
+ * ANSI C), but they use __ct_rune_t instead of int.
+ *
+ * NOTE: rune_t is not covered by ANSI nor other standards, and should not
+ * be instantiated outside of lib/libc/locale. Use wchar_t. wchar_t and
+ * rune_t must be the same type. Also, wint_t must be no narrower than
+ * wchar_t, and should be able to hold all members of the largest
+ * character set plus one extra value (WEOF), and must be at least 16 bits.
+ */
+typedef int __ct_rune_t;
+typedef __ct_rune_t __rune_t;
+typedef __ct_rune_t __wchar_t;
+typedef __ct_rune_t __wint_t;
+
+/*
+ * mbstate_t is an opaque object to keep conversion state during multibyte
+ * stream conversions.
+ */
+typedef union {
+ char __mbstate8[128];
+ __int64_t _mbstateL; /* for alignment */
+} __mbstate_t;
+
#endif /* !_SYS__TYPES_H_ */