summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2002-04-24 21:53:13 +0000
committerMarc Espie <espie@cvs.openbsd.org>2002-04-24 21:53:13 +0000
commit7c0de9a6039bc6cbca0fd91e88e4c1b334df52d7 (patch)
treeeae09ebbce65e9c5a8b1e831523955aaa3847d61 /sys
parent767845303816d6a74680f4a7a5f9a70087b57e44 (diff)
Introduce a new file, machine/internal_types.h, to hold that specific arch
type characteristics. internal_types.h will contain only settings invisible from standard C, e.g., in the __* or _[A-Z]* namespace, and be reused by files like limits.h. This allows us to shorten machine/limits.h greatly, as all the common defines are now in sys/limits.h, plus a small stub in internal_types.h. Tested on all arches as far as I know. Approved after discussion with art, millert, deraadt, and others.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/alpha/include/internal_types.h8
-rw-r--r--sys/arch/alpha/include/limits.h51
-rw-r--r--sys/arch/amiga/include/internal_types.h3
-rw-r--r--sys/arch/hp300/include/internal_types.h3
-rw-r--r--sys/arch/hppa/include/internal_types.h6
-rw-r--r--sys/arch/hppa/include/limits.h51
-rw-r--r--sys/arch/i386/include/internal_types.h6
-rw-r--r--sys/arch/i386/include/limits.h41
-rw-r--r--sys/arch/m68k/include/internal_types.h6
-rw-r--r--sys/arch/m68k/include/limits.h40
-rw-r--r--sys/arch/mac68k/include/internal_types.h3
-rw-r--r--sys/arch/mac68k/mac68k/clock.c4
-rw-r--r--sys/arch/macppc/include/internal_types.h3
-rw-r--r--sys/arch/mvme68k/include/internal_types.h3
-rw-r--r--sys/arch/mvme88k/include/internal_types.h6
-rw-r--r--sys/arch/mvme88k/include/limits.h54
-rw-r--r--sys/arch/mvmeppc/include/internal_types.h3
-rw-r--r--sys/arch/powerpc/include/internal_types.h8
-rw-r--r--sys/arch/powerpc/include/limits.h38
-rw-r--r--sys/arch/sparc/include/internal_types.h6
-rw-r--r--sys/arch/sparc/include/limits.h40
-rw-r--r--sys/arch/sparc64/include/internal_types.h8
-rw-r--r--sys/arch/sparc64/include/limits.h45
-rw-r--r--sys/arch/sun3/include/internal_types.h3
-rw-r--r--sys/arch/vax/include/internal_types.h14
-rw-r--r--sys/arch/vax/include/limits.h41
-rw-r--r--sys/dev/raidframe/rf_types.h4
-rw-r--r--sys/kern/kern_clock.c4
-rw-r--r--sys/kern/subr_autoconf.c4
-rw-r--r--sys/lib/libkern/memset.c4
-rw-r--r--sys/lib/libkern/quad.h4
-rw-r--r--sys/sys/limits.h125
-rw-r--r--sys/sys/param.h4
33 files changed, 238 insertions, 405 deletions
diff --git a/sys/arch/alpha/include/internal_types.h b/sys/arch/alpha/include/internal_types.h
new file mode 100644
index 00000000000..076d2a5ee3c
--- /dev/null
+++ b/sys/arch/alpha/include/internal_types.h
@@ -0,0 +1,8 @@
+/* $OpenBSD: internal_types.h,v 1.1 2002/04/24 21:53:11 espie Exp $ */
+/* Public domain */
+#ifndef _MACHINE_INTERNAL_TYPES_H_
+#define _MACHINE_INTERNAL_TYPES_H_
+
+#define __machine_is_64_bits
+
+#endif
diff --git a/sys/arch/alpha/include/limits.h b/sys/arch/alpha/include/limits.h
index 3ae9bae45cc..71f75a01b34 100644
--- a/sys/arch/alpha/include/limits.h
+++ b/sys/arch/alpha/include/limits.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: limits.h,v 1.7 2000/07/31 20:06:01 millert Exp $ */
+/* $OpenBSD: limits.h,v 1.8 2002/04/24 21:53:11 espie Exp $ */
/* $NetBSD: limits.h,v 1.2 1996/04/12 01:38:25 cgd Exp $ */
/*
@@ -39,69 +39,20 @@
#ifndef _MACHINE_LIMITS_H_
#define _MACHINE_LIMITS_H_
-#define CHAR_BIT 8 /* number of bits in a char */
#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */
-/*
- * According to ANSI (section 2.2.4.2), the values below must be usable by
- * #if preprocessing directives. Additionally, the expression must have the
- * same type as would an expression that is an object of the corresponding
- * type converted according to the integral promotions. The subtraction for
- * INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an
- * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
- * These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values
- * are written as hex so that GCC will be quiet about large integer constants.
- */
-#define SCHAR_MAX 0x7f /* max value for a signed char */
-#define SCHAR_MIN (-0x7f-1) /* min value for a signed char */
-
-#define UCHAR_MAX 0xffU /* max value for an unsigned char */
-#define CHAR_MAX 0x7f /* max value for a char */
-#define CHAR_MIN (-0x7f-1) /* min value for a char */
-
-#define USHRT_MAX 0xffffU /* max value for an unsigned short */
-#define SHRT_MAX 0x7fff /* max value for a short */
-#define SHRT_MIN (-0x7fff-1) /* min value for a short */
-
-#define UINT_MAX 0xffffffffU /* max value for an unsigned int */
-#define INT_MAX 0x7fffffff /* max value for an int */
-#define INT_MIN (-0x7fffffff-1) /* min value for an int */
-
-#define ULONG_MAX 0xffffffffffffffffUL /* max for an unsigned long */
-#define LONG_MAX 0x7fffffffffffffffL /* max for a long */
-#define LONG_MIN (-0x7fffffffffffffffL-1) /* min for a long */
-
#if !defined(_ANSI_SOURCE)
#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */
#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
#define SIZE_T_MAX ULONG_MAX /* max value for a size_t */
-#define UID_MAX UINT_MAX /* max value for a uid_t */
-#define GID_MAX UINT_MAX /* max value for a gid_t */
-
/* Quads and longs are the same on the alpha */
#define UQUAD_MAX (ULONG_MAX) /* max value for a uquad_t */
#define QUAD_MAX (LONG_MAX) /* max value for a quad_t */
#define QUAD_MIN (LONG_MIN) /* min value for a quad_t */
-#define ULLONG_MAX (ULONG_MAX) /* max value for unsigned long long */
-#define LLONG_MAX (LONG_MAX) /* max value for a long long */
-#define LLONG_MIN (LONG_MIN) /* min value for a long long */
#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */
#endif /* !_ANSI_SOURCE */
-#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE)
-#define LONG_BIT 64
-#define WORD_BIT 32
-
-#define DBL_DIG 15
-#define DBL_MAX 1.7976931348623157E+308
-#define DBL_MIN 2.2250738585072014E-308
-
-#define FLT_DIG 6
-#define FLT_MAX 3.40282347E+38F
-#define FLT_MIN 1.17549435E-38F
-#endif
-
#endif /* _MACHINE_LIMITS_H_ */
diff --git a/sys/arch/amiga/include/internal_types.h b/sys/arch/amiga/include/internal_types.h
new file mode 100644
index 00000000000..61dd1740f08
--- /dev/null
+++ b/sys/arch/amiga/include/internal_types.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: internal_types.h,v 1.1 2002/04/24 21:53:11 espie Exp $ */
+/* Public domain */
+#include <m68k/internal_types.h>
diff --git a/sys/arch/hp300/include/internal_types.h b/sys/arch/hp300/include/internal_types.h
new file mode 100644
index 00000000000..61dd1740f08
--- /dev/null
+++ b/sys/arch/hp300/include/internal_types.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: internal_types.h,v 1.1 2002/04/24 21:53:11 espie Exp $ */
+/* Public domain */
+#include <m68k/internal_types.h>
diff --git a/sys/arch/hppa/include/internal_types.h b/sys/arch/hppa/include/internal_types.h
new file mode 100644
index 00000000000..4d1833cf8a0
--- /dev/null
+++ b/sys/arch/hppa/include/internal_types.h
@@ -0,0 +1,6 @@
+/* $OpenBSD: internal_types.h,v 1.1 2002/04/24 21:53:11 espie Exp $ */
+/* Public domain */
+#ifndef _MACHINE_INTERNAL_TYPES_H_
+#define _MACHINE_INTERNAL_TYPES_H_
+
+#endif
diff --git a/sys/arch/hppa/include/limits.h b/sys/arch/hppa/include/limits.h
index e8f263ef10d..4bf5a3261bb 100644
--- a/sys/arch/hppa/include/limits.h
+++ b/sys/arch/hppa/include/limits.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: limits.h,v 1.5 2002/04/20 22:25:29 mickey Exp $ */
+/* $OpenBSD: limits.h,v 1.6 2002/04/24 21:53:11 espie Exp $ */
/*
* Copyright (c) 1992-1994, The University of Utah and
@@ -61,70 +61,21 @@
#ifndef _MACHINE_LIMITS_H_
#define _MACHINE_LIMITS_H_
-#define CHAR_BIT 8 /* number of bits in a char */
#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */
-/*
- * According to ANSI (section 2.2.4.2), the values below must be usable by
- * #if preprocessing directives. Additionally, the expression must have the
- * same type as would an expression that is an object of the corresponding
- * type converted according to the integral promotions. The subtraction for
- * INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an
- * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
- * These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values
- * are written as hex so that GCC will be quiet about large integer constants.
- */
-#define SCHAR_MAX 127 /* min value for a signed char */
-#define SCHAR_MIN (-128) /* max value for a signed char */
-
-#define UCHAR_MAX 255 /* max value for an unsigned char */
-#define CHAR_MAX 127 /* max value for a char */
-#define CHAR_MIN (-128) /* min value for a char */
-
-#define USHRT_MAX 65535 /* max value for an unsigned short */
-#define SHRT_MAX 32767 /* max value for a short */
-#define SHRT_MIN (-32768) /* min value for a short */
-
-#define UINT_MAX 0xffffffff /* max value for an unsigned int */
-#define INT_MAX 2147483647 /* max value for an int */
-#define INT_MIN (-2147483647-1) /* min value for an int */
-
-#define ULONG_MAX 0xffffffffUL /* max value for an unsigned long */
-#define LONG_MAX 2147483647L /* max value for a long */
-#define LONG_MIN (-2147483647-1) /* min value for a long */
-
#if !defined(_ANSI_SOURCE)
#define SSIZE_MAX INT_MAX /* max value for a ssize_t */
#if !defined(_POSIX_SOURCE)
#define SIZE_T_MAX UINT_MAX /* max value for a size_t */
-#define UID_MAX UINT_MAX /* max value for a uid_t */
-#define GID_MAX UINT_MAX /* max value for a gid_t */
-
/* GCC requires that quad constants be written as expressions. */
#define UQUAD_MAX ((u_quad_t)0-1) /* max value for a uquad_t */
/* max value for a quad_t */
#define QUAD_MAX ((quad_t)(UQUAD_MAX >> 1))
#define QUAD_MIN (-QUAD_MAX-1) /* min value for a quad_t */
-#define ULLONG_MAX (UQUAD_MAX) /* max value for unsigned long long */
-#define LLONG_MAX (QUAD_MAX) /* max value for a signed long long */
-#define LLONG_MIN (QUAD_MIN) /* min value for a signed long long */
#endif /* !_POSIX_SOURCE */
#endif /* !_ANSI_SOURCE */
-#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE)
-#define LONG_BIT 32
-#define WORD_BIT 32
-
-#define DBL_DIG 15
-#define DBL_MAX 1.7976931348623157E+308
-#define DBL_MIN 2.2250738585072014E-308
-
-#define FLT_DIG 6
-#define FLT_MAX 3.40282347E+38F
-#define FLT_MIN 1.17549435E-38F
-#endif
-
#endif /* _MACHINE_LIMITS_H_ */
diff --git a/sys/arch/i386/include/internal_types.h b/sys/arch/i386/include/internal_types.h
new file mode 100644
index 00000000000..4d1833cf8a0
--- /dev/null
+++ b/sys/arch/i386/include/internal_types.h
@@ -0,0 +1,6 @@
+/* $OpenBSD: internal_types.h,v 1.1 2002/04/24 21:53:11 espie Exp $ */
+/* Public domain */
+#ifndef _MACHINE_INTERNAL_TYPES_H_
+#define _MACHINE_INTERNAL_TYPES_H_
+
+#endif
diff --git a/sys/arch/i386/include/limits.h b/sys/arch/i386/include/limits.h
index 3b7ea840a7f..8e3ceec04e4 100644
--- a/sys/arch/i386/include/limits.h
+++ b/sys/arch/i386/include/limits.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: limits.h,v 1.6 2000/08/05 22:07:31 niklas Exp $ */
+/* $OpenBSD: limits.h,v 1.7 2002/04/24 21:53:11 espie Exp $ */
/* $NetBSD: limits.h,v 1.11 1995/12/21 01:08:59 mycroft Exp $ */
/*
@@ -39,58 +39,19 @@
#ifndef _MACHINE_LIMITS_H_
#define _MACHINE_LIMITS_H_
-#define CHAR_BIT 8 /* number of bits in a char */
#define MB_LEN_MAX 1 /* no multibyte characters */
-#define SCHAR_MAX 0x7f /* max value for a signed char */
-#define SCHAR_MIN (-0x7f-1) /* min value for a signed char */
-
-#define UCHAR_MAX 0xffU /* max value for an unsigned char */
-#define CHAR_MAX 0x7f /* max value for a char */
-#define CHAR_MIN (-0x7f-1) /* min value for a char */
-
-#define USHRT_MAX 0xffffU /* max value for an unsigned short */
-#define SHRT_MAX 0x7fff /* max value for a short */
-#define SHRT_MIN (-0x7fff-1) /* min value for a short */
-
-#define UINT_MAX 0xffffffffU /* max value for an unsigned int */
-#define INT_MAX 0x7fffffff /* max value for an int */
-#define INT_MIN (-0x7fffffff-1) /* min value for an int */
-
-#define ULONG_MAX 0xffffffffUL /* max value for an unsigned long */
-#define LONG_MAX 0x7fffffffL /* max value for a long */
-#define LONG_MIN (-0x7fffffffL-1) /* min value for a long */
-
#if !defined(_ANSI_SOURCE)
#define SSIZE_MAX INT_MAX /* max value for a ssize_t */
#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
#define SIZE_T_MAX UINT_MAX /* max value for a size_t */
-#define UID_MAX UINT_MAX /* max value for a uid_t */
-#define GID_MAX UINT_MAX /* max value for a gid_t */
-
#define UQUAD_MAX 0xffffffffffffffffULL /* max unsigned quad */
#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */
#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */
-#define ULLONG_MAX (UQUAD_MAX) /* max value for unsigned long long */
-#define LLONG_MAX (QUAD_MAX) /* max value for a signed long long */
-#define LLONG_MIN (QUAD_MIN) /* min value for a signed long long */
#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */
#endif /* !_ANSI_SOURCE */
-#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE)
-#define LONG_BIT 32
-#define WORD_BIT 32
-
-#define DBL_DIG 15
-#define DBL_MAX 1.7976931348623157E+308
-#define DBL_MIN 2.2250738585072014E-308
-
-#define FLT_DIG 6
-#define FLT_MAX 3.40282347E+38F
-#define FLT_MIN 1.17549435E-38F
-#endif
-
#endif /* _MACHINE_LIMITS_H_ */
diff --git a/sys/arch/m68k/include/internal_types.h b/sys/arch/m68k/include/internal_types.h
new file mode 100644
index 00000000000..4d1833cf8a0
--- /dev/null
+++ b/sys/arch/m68k/include/internal_types.h
@@ -0,0 +1,6 @@
+/* $OpenBSD: internal_types.h,v 1.1 2002/04/24 21:53:11 espie Exp $ */
+/* Public domain */
+#ifndef _MACHINE_INTERNAL_TYPES_H_
+#define _MACHINE_INTERNAL_TYPES_H_
+
+#endif
diff --git a/sys/arch/m68k/include/limits.h b/sys/arch/m68k/include/limits.h
index b4f7cdc6ad1..d337cde7917 100644
--- a/sys/arch/m68k/include/limits.h
+++ b/sys/arch/m68k/include/limits.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: limits.h,v 1.4 2000/07/31 20:06:02 millert Exp $ */
+/* $OpenBSD: limits.h,v 1.5 2002/04/24 21:53:11 espie Exp $ */
/* $NetBSD: limits.h,v 1.9 1994/10/26 07:50:48 cgd Exp $ */
/*
@@ -36,56 +36,18 @@
* @(#)limits.h 7.2 (Berkeley) 6/28/90
*/
-#define CHAR_BIT 8 /* number of bits in a char */
#define MB_LEN_MAX 1 /* no multibyte characters */
-#define SCHAR_MIN (-0x7f-1) /* max value for a signed char */
-#define SCHAR_MAX 0x7f /* min value for a signed char */
-
-#define UCHAR_MAX 0xff /* max value for an unsigned char */
-#define CHAR_MAX 0x7f /* max value for a char */
-#define CHAR_MIN (-0x7f-1) /* min value for a char */
-
-#define USHRT_MAX 0xffff /* max value for an unsigned short */
-#define SHRT_MAX 0x7fff /* max value for a short */
-#define SHRT_MIN (-0x7fff-1) /* min value for a short */
-
-#define UINT_MAX 0xffffffffU /* max value for an unsigned int */
-#define INT_MAX 0x7fffffff /* max value for an int */
-#define INT_MIN (-0x7fffffff-1) /* min value for an int */
-
-#define ULONG_MAX 0xffffffffUL /* max value for an unsigned long */
-#define LONG_MAX 0x7fffffffL /* max value for a long */
-#define LONG_MIN (-0x7fffffffL-1) /* min value for a long */
-
#if !defined(_ANSI_SOURCE)
#define SSIZE_MAX INT_MAX /* max value for a ssize_t */
#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
#define SIZE_T_MAX UINT_MAX /* max value for a size_t */
-#define UID_MAX UINT_MAX /* max value for a uid_t */
-#define GID_MAX UINT_MAX /* max value for a gid_t */
-
#define UQUAD_MAX 0xffffffffffffffffULL /* max unsigned quad */
#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */
#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */
-#define ULLONG_MAX (UQUAD_MAX) /* max value for unsigned long long */
-#define LLONG_MAX (QUAD_MAX) /* max value for a signed long long */
-#define LLONG_MIN (QUAD_MIN) /* min value for a signed long long */
#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */
#endif /* !_ANSI_SOURCE */
-#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE)
-#define LONG_BIT 32
-#define WORD_BIT 32
-
-#define DBL_DIG 15
-#define DBL_MAX 1.7976931348623157E+308
-#define DBL_MIN 2.2250738585072014E-308
-
-#define FLT_DIG 6
-#define FLT_MAX 3.40282347E+38F
-#define FLT_MIN 1.17549435E-38F
-#endif
diff --git a/sys/arch/mac68k/include/internal_types.h b/sys/arch/mac68k/include/internal_types.h
new file mode 100644
index 00000000000..61dd1740f08
--- /dev/null
+++ b/sys/arch/mac68k/include/internal_types.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: internal_types.h,v 1.1 2002/04/24 21:53:11 espie Exp $ */
+/* Public domain */
+#include <m68k/internal_types.h>
diff --git a/sys/arch/mac68k/mac68k/clock.c b/sys/arch/mac68k/mac68k/clock.c
index 4a2d070925d..fc085e0e798 100644
--- a/sys/arch/mac68k/mac68k/clock.c
+++ b/sys/arch/mac68k/mac68k/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.13 2002/03/14 01:26:35 millert Exp $ */
+/* $OpenBSD: clock.c,v 1.14 2002/04/24 21:53:11 espie Exp $ */
/* $NetBSD: clock.c,v 1.36 1997/10/07 03:04:55 scottr Exp $ */
/*
@@ -80,13 +80,13 @@
#include <sys/param.h>
#include <sys/device.h>
+#include <sys/limits.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <machine/autoconf.h>
#include <machine/psl.h>
#include <machine/cpu.h>
-#include <machine/limits.h>
#if defined(GPROF) && defined(PROFTIMER)
#include <sys/gprof.h>
diff --git a/sys/arch/macppc/include/internal_types.h b/sys/arch/macppc/include/internal_types.h
new file mode 100644
index 00000000000..9622f58539c
--- /dev/null
+++ b/sys/arch/macppc/include/internal_types.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: internal_types.h,v 1.1 2002/04/24 21:53:11 espie Exp $ */
+/* Public domain */
+#include <powerpc/internal_types.h>
diff --git a/sys/arch/mvme68k/include/internal_types.h b/sys/arch/mvme68k/include/internal_types.h
new file mode 100644
index 00000000000..61dd1740f08
--- /dev/null
+++ b/sys/arch/mvme68k/include/internal_types.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: internal_types.h,v 1.1 2002/04/24 21:53:11 espie Exp $ */
+/* Public domain */
+#include <m68k/internal_types.h>
diff --git a/sys/arch/mvme88k/include/internal_types.h b/sys/arch/mvme88k/include/internal_types.h
new file mode 100644
index 00000000000..4d1833cf8a0
--- /dev/null
+++ b/sys/arch/mvme88k/include/internal_types.h
@@ -0,0 +1,6 @@
+/* $OpenBSD: internal_types.h,v 1.1 2002/04/24 21:53:11 espie Exp $ */
+/* Public domain */
+#ifndef _MACHINE_INTERNAL_TYPES_H_
+#define _MACHINE_INTERNAL_TYPES_H_
+
+#endif
diff --git a/sys/arch/mvme88k/include/limits.h b/sys/arch/mvme88k/include/limits.h
index b6c7e8908c2..b7a1be8da87 100644
--- a/sys/arch/mvme88k/include/limits.h
+++ b/sys/arch/mvme88k/include/limits.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: limits.h,v 1.8 2000/07/31 20:06:03 millert Exp $ */
+/* $OpenBSD: limits.h,v 1.9 2002/04/24 21:53:11 espie Exp $ */
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,76 +32,26 @@
* SUCH DAMAGE.
*
* from: @(#)limits.h 8.3 (Berkeley) 1/4/94
- * $Id: limits.h,v 1.8 2000/07/31 20:06:03 millert Exp $
+ * $Id: limits.h,v 1.9 2002/04/24 21:53:11 espie Exp $
*/
#ifndef _MACHINE_LIMITS_H_
#define _MACHINE_LIMITS_H_
-#define CHAR_BIT 8 /* number of bits in a char */
#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */
-/*
- * According to ANSI (section 2.2.4.2), the values below must be usable by
- * #if preprocessing directives. Additionally, the expression must have the
- * same type as would an expression that is an object of the corresponding
- * type converted according to the integral promotions. The subtraction for
- * INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an
- * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
- * These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values
- * are written as hex so that GCC will be quiet about large integer constants.
- */
-#define SCHAR_MAX 127 /* min value for a signed char */
-#define SCHAR_MIN (-128) /* max value for a signed char */
-
-#define UCHAR_MAX 255 /* max value for an unsigned char */
-#define CHAR_MAX 127 /* max value for a char */
-#define CHAR_MIN (-128) /* min value for a char */
-
-#define USHRT_MAX 65535 /* max value for an unsigned short */
-#define SHRT_MAX 32767 /* max value for a short */
-#define SHRT_MIN (-32768) /* min value for a short */
-
-#define UINT_MAX 0xffffffff /* max value for an unsigned int */
-#define INT_MAX 2147483647 /* max value for an int */
-#define INT_MIN (-2147483647-1) /* min value for an int */
-
-#define ULONG_MAX 0xffffffff /* max value for an unsigned long */
-#define LONG_MAX 2147483647 /* max value for a long */
-#define LONG_MIN (-2147483647-1) /* min value for a long */
-
#if !defined(_ANSI_SOURCE)
#define SSIZE_MAX INT_MAX /* max value for a ssize_t */
#if !defined(_POSIX_SOURCE)
#define SIZE_T_MAX UINT_MAX /* max value for a size_t */
-#define UID_MAX UINT_MAX /* max value for a uid_t */
-#define GID_MAX UINT_MAX /* max value for a gid_t */
-
/* GCC requires that quad constants be written as expressions. */
#define UQUAD_MAX ((u_quad_t)0-1) /* max value for a uquad_t */
/* max value for a quad_t */
#define QUAD_MAX ((quad_t)(UQUAD_MAX >> 1))
#define QUAD_MIN (-QUAD_MAX-1) /* min value for a quad_t */
-#define ULLONG_MAX (UQUAD_MAX) /* max value for unsigned long long */
-#define LLONG_MAX (QUAD_MAX) /* max value for a signed long long */
-#define LLONG_MIN (QUAD_MIN) /* min value for a signed long long */
-
#endif /* !_POSIX_SOURCE */
#endif /* !_ANSI_SOURCE */
-#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE)
-#define LONG_BIT 32
-#define WORD_BIT 32
-
-#define DBL_DIG 15
-#define DBL_MAX 1.7976931348623157E+308
-#define DBL_MIN 2.2250738585072014E-308
-
-#define FLT_DIG 6
-#define FLT_MAX 3.40282347E+38F
-#define FLT_MIN 1.17549435E-38F
-#endif
-
#endif /* _MACHINE_LIMITS_H_ */
diff --git a/sys/arch/mvmeppc/include/internal_types.h b/sys/arch/mvmeppc/include/internal_types.h
new file mode 100644
index 00000000000..9622f58539c
--- /dev/null
+++ b/sys/arch/mvmeppc/include/internal_types.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: internal_types.h,v 1.1 2002/04/24 21:53:11 espie Exp $ */
+/* Public domain */
+#include <powerpc/internal_types.h>
diff --git a/sys/arch/powerpc/include/internal_types.h b/sys/arch/powerpc/include/internal_types.h
new file mode 100644
index 00000000000..1079a9af700
--- /dev/null
+++ b/sys/arch/powerpc/include/internal_types.h
@@ -0,0 +1,8 @@
+/* $OpenBSD: internal_types.h,v 1.1 2002/04/24 21:53:12 espie Exp $ */
+/* Public domain */
+#ifndef _MACHINE_INTERNAL_TYPES_H_
+#define _MACHINE_INTERNAL_TYPES_H_
+
+#define __machine_has_unsigned_chars
+
+#endif
diff --git a/sys/arch/powerpc/include/limits.h b/sys/arch/powerpc/include/limits.h
index 8b7a8659981..02890d1f280 100644
--- a/sys/arch/powerpc/include/limits.h
+++ b/sys/arch/powerpc/include/limits.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: limits.h,v 1.9 2001/09/01 15:49:05 drahn Exp $ */
+/* $OpenBSD: limits.h,v 1.10 2002/04/24 21:53:12 espie Exp $ */
/* $NetBSD: limits.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */
/*-
@@ -35,25 +35,7 @@
#ifndef _POWERPC_LIMITS_H_
#define _POWERPC_LIMITS_H_
-#define CHAR_BIT 8 /* bits per char */
#define MB_LEN_MAX 1 /* no multibyte characters */
-#define CHAR_MIN 0 /* min value in char */
-#define CHAR_MAX 0xff /* max value in char */
-#define UCHAR_MAX 0xff /* max value in unsigned char */
-#define SCHAR_MIN (-0x7f-1) /* min value for a signed char */
-#define SCHAR_MAX 0x7f /* max value for a signed char */
-
-#define SHRT_MIN (-0x7fff-1) /* min value in short */
-#define SHRT_MAX 0x7fff /* max value in short */
-#define USHRT_MAX 0xffff /* max value in unsigned short */
-
-#define INT_MIN (-0x7fffffff-1) /* min value in int */
-#define INT_MAX 0x7fffffff /* max value in int */
-#define UINT_MAX 0xffffffff /* max value in unsigned int */
-
-#define LONG_MIN (-0x7fffffff-1) /* min value in long */
-#define LONG_MAX 0x7fffffff /* max value in long */
-#define ULONG_MAX 0xffffffff /* max value in unsigned long */
#if !defined(_ANSI_SOURCE)
#define SSIZE_MAX INT_MAX /* max value for a ssize_t */
@@ -61,28 +43,10 @@
#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
#define SIZE_T_MAX UINT_MAX /* max value for a size_t */
-#define UID_MAX UINT_MAX /* max value for a uid_t */
-#define GID_MAX UINT_MAX /* max value for a gid_t */
-
#define UQUAD_MAX 0xffffffffffffffffULL /* max unsigned quad */
#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */
#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */
-#define ULLONG_MAX (UQUAD_MAX) /* max value for unsigned long long */
-#define LLONG_MAX (QUAD_MAX) /* max value for a signed long long */
-#define LLONG_MIN (QUAD_MIN) /* min value for a signed long long */
#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */
#endif /* !_ANSI_SOURCE */
-#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE)
-#define LONG_BIT 32
-#define WORD_BIT 32
-
-#define DBL_DIG 15
-#define DBL_MAX 1.7976931348623157E+308
-#define DBL_MIN 2.2250738585072014E-308
-
-#define FLT_DIG 6
-#define FLT_MAX 3.40282347E+38F
-#define FLT_MIN 1.17549435E-38F
-#endif
#endif /* _POWERPC_LIMITS_H_ */
diff --git a/sys/arch/sparc/include/internal_types.h b/sys/arch/sparc/include/internal_types.h
new file mode 100644
index 00000000000..9280b667b82
--- /dev/null
+++ b/sys/arch/sparc/include/internal_types.h
@@ -0,0 +1,6 @@
+/* $OpenBSD: internal_types.h,v 1.1 2002/04/24 21:53:12 espie Exp $ */
+/* Public domain */
+#ifndef _MACHINE_INTERNAL_TYPES_H_
+#define _MACHINE_INTERNAL_TYPES_H_
+
+#endif
diff --git a/sys/arch/sparc/include/limits.h b/sys/arch/sparc/include/limits.h
index a8aa46777e0..9aab3e5048b 100644
--- a/sys/arch/sparc/include/limits.h
+++ b/sys/arch/sparc/include/limits.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: limits.h,v 1.6 2000/07/31 20:06:03 millert Exp $ */
+/* $OpenBSD: limits.h,v 1.7 2002/04/24 21:53:12 espie Exp $ */
/* $NetBSD: limits.h,v 1.7 1996/01/05 18:10:57 pk Exp $ */
/*
@@ -36,58 +36,20 @@
* @(#)limits.h 8.3 (Berkeley) 1/4/94
*/
-#define CHAR_BIT 8 /* number of bits in a char */
#define MB_LEN_MAX 1 /* no multibyte characters */
-#define SCHAR_MIN (-0x7f-1) /* max value for a signed char */
-#define SCHAR_MAX 0x7f /* min value for a signed char */
-
-#define UCHAR_MAX 0xffU /* max value for an unsigned char */
-#define CHAR_MAX 0x7f /* max value for a char */
-#define CHAR_MIN (-0x7f-1) /* min value for a char */
-
-#define USHRT_MAX 0xffffU /* max value for an unsigned short */
-#define SHRT_MAX 0x7fff /* max value for a short */
-#define SHRT_MIN (-0x7fff-1) /* min value for a short */
-
-#define UINT_MAX 0xffffffffU /* max value for an unsigned int */
-#define INT_MAX 0x7fffffff /* max value for an int */
-#define INT_MIN (-0x7fffffff-1) /* min value for an int */
-
-#define ULONG_MAX 0xffffffffUL /* max value for an unsigned long */
-#define LONG_MAX 0x7fffffffL /* max value for a long */
-#define LONG_MIN (-0x7fffffffL-1) /* min value for a long */
-
#if !defined(_ANSI_SOURCE)
#define SSIZE_MAX INT_MAX /* max value for a ssize_t */
#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
#define SIZE_T_MAX UINT_MAX /* max value for a size_t */
-#define UID_MAX UINT_MAX /* max value for a uid_t */
-#define GID_MAX UINT_MAX /* max value for a gid_t */
-
/* GCC requires that quad constants be written as expressions. */
#define UQUAD_MAX ((u_quad_t)0-1) /* max value for a uquad_t */
/* max value for a quad_t */
#define QUAD_MAX ((quad_t)(UQUAD_MAX >> 1))
#define QUAD_MIN (-QUAD_MAX-1) /* min value for a quad_t */
-#define ULLONG_MAX (UQUAD_MAX) /* max value for unsigned long long */
-#define LLONG_MAX (QUAD_MAX) /* max value for a signed long long */
-#define LLONG_MIN (QUAD_MIN) /* min value for a signed long long */
#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */
#endif /* !_ANSI_SOURCE */
-#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE)
-#define LONG_BIT 32
-#define WORD_BIT 32
-
-#define DBL_DIG 15
-#define DBL_MAX 1.7976931348623157E+308
-#define DBL_MIN 2.2250738585072014E-308
-
-#define FLT_DIG 6
-#define FLT_MAX 3.40282347E+38F
-#define FLT_MIN 1.17549435E-38F
-#endif
diff --git a/sys/arch/sparc64/include/internal_types.h b/sys/arch/sparc64/include/internal_types.h
new file mode 100644
index 00000000000..a7d0101a8ba
--- /dev/null
+++ b/sys/arch/sparc64/include/internal_types.h
@@ -0,0 +1,8 @@
+/* $OpenBSD: internal_types.h,v 1.1 2002/04/24 21:53:12 espie Exp $ */
+/* Public domain */
+#ifndef _MACHINE_INTERNAL_TYPES_H_
+#define _MACHINE_INTERNAL_TYPES_H_
+
+#define __machine_is_64_bits
+
+#endif
diff --git a/sys/arch/sparc64/include/limits.h b/sys/arch/sparc64/include/limits.h
index aedaf48bb5d..3d10be3b2a9 100644
--- a/sys/arch/sparc64/include/limits.h
+++ b/sys/arch/sparc64/include/limits.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: limits.h,v 1.3 2002/04/19 11:04:24 espie Exp $ */
+/* $OpenBSD: limits.h,v 1.4 2002/04/24 21:53:12 espie Exp $ */
/* $NetBSD: limits.h,v 1.8 2000/08/08 22:31:14 tshiozak Exp $ */
/*
@@ -39,45 +39,16 @@
#ifndef _MACHINE_LIMITS_H_
#define _MACHINE_LIMITS_H_
-#define CHAR_BIT 8 /* number of bits in a char */
#define MB_LEN_MAX 32 /* no multibyte characters */
-#define SCHAR_MIN (-0x7f-1) /* max value for a signed char */
-#define SCHAR_MAX 0x7f /* min value for a signed char */
-
-#define UCHAR_MAX 0xffU /* max value for an unsigned char */
-#define CHAR_MAX 0x7f /* max value for a char */
-#define CHAR_MIN (-0x7f-1) /* min value for a char */
-
-#define USHRT_MAX 0xffffU /* max value for an unsigned short */
-#define SHRT_MAX 0x7fff /* max value for a short */
-#define SHRT_MIN (-0x7fff-1) /* min value for a short */
-
-#define UINT_MAX 0xffffffffU /* max value for an unsigned int */
-#define INT_MAX 0x7fffffff /* max value for an int */
-#define INT_MIN (-0x7fffffff-1) /* min value for an int */
-
/* Make sure _LP64 is defined if we have a 64-bit compiler */
#ifndef _LP64
#define _LP64
#endif
-#define ULONG_MAX 0xffffffffffffffffUL /* max value for an unsigned long */
-#define LONG_MAX 0x7fffffffffffffffL /* max value for a long */
-#define LONG_MIN (-0x7fffffffffffffffL-1) /* min value for a long */
-
#if !defined(_ANSI_SOURCE)
#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */
-#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) || \
- defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L
-#define UID_MAX UINT_MAX /* max value for uid_t */
-#define GID_MAX UINT_MAX /* max value for gid_t */
-#define ULLONG_MAX 0xffffffffffffffffULL /* max unsigned long long */
-#define LLONG_MAX 0x7fffffffffffffffLL /* max signed long long */
-#define LLONG_MIN (-0x7fffffffffffffffLL-1) /* min signed long long */
-#endif
-
#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
#define SIZE_T_MAX ULONG_MAX /* max value for a size_t */
@@ -90,18 +61,4 @@
#endif /* !_POSIX_C_SOURCE && !_XOPEN_SOURCE */
#endif /* !_ANSI_SOURCE */
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) || \
- defined(_XOPEN_SOURCE)
-#define LONG_BIT 64
-#define WORD_BIT 32
-
-#define DBL_DIG 15
-#define DBL_MAX 1.7976931348623157E+308
-#define DBL_MIN 2.2250738585072014E-308
-
-#define FLT_DIG 6
-#define FLT_MAX 3.40282347E+38F
-#define FLT_MIN 1.17549435E-38F
-#endif
-
#endif /* _MACHINE_LIMITS_H_ */
diff --git a/sys/arch/sun3/include/internal_types.h b/sys/arch/sun3/include/internal_types.h
new file mode 100644
index 00000000000..02ee993a212
--- /dev/null
+++ b/sys/arch/sun3/include/internal_types.h
@@ -0,0 +1,3 @@
+/* $OpenBSD: internal_types.h,v 1.1 2002/04/24 21:53:12 espie Exp $ */
+/* Public domain */
+#include <m68k/internal_types.h>
diff --git a/sys/arch/vax/include/internal_types.h b/sys/arch/vax/include/internal_types.h
new file mode 100644
index 00000000000..3cf344f2df9
--- /dev/null
+++ b/sys/arch/vax/include/internal_types.h
@@ -0,0 +1,14 @@
+/* $OpenBSD: internal_types.h,v 1.1 2002/04/24 21:53:12 espie Exp $ */
+/* Public domain */
+#ifndef _MACHINE_INTERNAL_TYPES_H_
+#define _MACHINE_INTERNAL_TYPES_H_
+
+#define __DBL_DIG 16
+#define __DBL_MAX 1.701411834604692294E+38
+#define __DBL_MIN 2.938735877055718770E-39
+
+#define __FLT_DIG 6
+#define __FLT_MAX 1.70141173E+38F
+#define __FLT_MIN 2.93873588E-39F
+
+#endif
diff --git a/sys/arch/vax/include/limits.h b/sys/arch/vax/include/limits.h
index a81107da79e..36887664e92 100644
--- a/sys/arch/vax/include/limits.h
+++ b/sys/arch/vax/include/limits.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: limits.h,v 1.8 2001/01/27 21:31:41 hugh Exp $ */
+/* $OpenBSD: limits.h,v 1.9 2002/04/24 21:53:12 espie Exp $ */
/* $NetBSD: limits.h,v 1.9 2000/03/07 19:33:01 kleink Exp $ */
/*
@@ -39,58 +39,19 @@
#ifndef _MACHINE_LIMITS_H_
#define _MACHINE_LIMITS_H_
-#define CHAR_BIT 8 /* number of bits in a char */
#define MB_LEN_MAX 1 /* no multibyte characters */
-#define SCHAR_MAX 0x7f /* max value for a signed char */
-#define SCHAR_MIN (-0x7f-1) /* min value for a signed char */
-
-#define UCHAR_MAX 0xffU /* max value for an unsigned char */
-#define CHAR_MAX 0x7f /* max value for a char */
-#define CHAR_MIN (-0x7f-1) /* min value for a char */
-
-#define USHRT_MAX 0xffffU /* max value for an unsigned short */
-#define SHRT_MAX 0x7fff /* max value for a short */
-#define SHRT_MIN (-0x7fff-1) /* min value for a short */
-
-#define UINT_MAX 0xffffffffU /* max value for an unsigned int */
-#define INT_MAX 0x7fffffff /* max value for an int */
-#define INT_MIN (-0x7fffffff-1) /* min value for an int */
-
-#define ULONG_MAX 0xffffffffUL /* max value for an unsigned long */
-#define LONG_MAX 0x7fffffffL /* max value for a long */
-#define LONG_MIN (-0x7fffffffL-1)/* min value for a long */
-
#if !defined(_ANSI_SOURCE)
#define SSIZE_MAX INT_MAX /* max value for a ssize_t */
#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
#define SIZE_T_MAX UINT_MAX /* max value for a size_t */
-#define UID_MAX UINT_MAX /* max value for a uid_t */
-#define GID_MAX UINT_MAX /* max value for a gid_t */
-
#define UQUAD_MAX 0xffffffffffffffffULL /* max unsigned quad */
#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */
#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */
-#define ULLONG_MAX (UQUAD_MAX) /* max value for unsigned long long */
-#define LLONG_MAX (QUAD_MAX) /* max value for a signed long long */
-#define LLONG_MIN (QUAD_MIN) /* min value for a signed long long */
#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */
#endif /* !_ANSI_SOURCE */
-#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE)
-#define LONG_BIT 32
-#define WORD_BIT 32
-
-#define DBL_DIG 16
-#define DBL_MAX 1.701411834604692294E+38
-#define DBL_MIN 2.938735877055718770E-39
-
-#define FLT_DIG 6
-#define FLT_MAX 1.70141173E+38F
-#define FLT_MIN 2.93873588E-39F
-#endif
-
#endif /* _MACHINE_LIMITS_H_ */
diff --git a/sys/dev/raidframe/rf_types.h b/sys/dev/raidframe/rf_types.h
index bf98f2c7bd2..ef42b7eca18 100644
--- a/sys/dev/raidframe/rf_types.h
+++ b/sys/dev/raidframe/rf_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rf_types.h,v 1.3 2000/01/07 14:50:23 peter Exp $ */
+/* $OpenBSD: rf_types.h,v 1.4 2002/04/24 21:53:12 espie Exp $ */
/* $NetBSD: rf_types.h,v 1.6 1999/09/05 03:05:55 oster Exp $ */
/*
* rf_types.h
@@ -62,8 +62,8 @@
*/
#include <sys/types.h>
+#include <sys/limits.h>
#include <machine/endian.h>
-#include <machine/limits.h>
#if BYTE_ORDER == BIG_ENDIAN
#define RF_IS_BIG_ENDIAN 1
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c
index f786f4af760..d87811e5c26 100644
--- a/sys/kern/kern_clock.c
+++ b/sys/kern/kern_clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_clock.c,v 1.34 2002/02/18 03:45:08 nordin Exp $ */
+/* $OpenBSD: kern_clock.c,v 1.35 2002/04/24 21:53:12 espie Exp $ */
/* $NetBSD: kern_clock.c,v 1.34 1996/06/09 04:51:03 briggs Exp $ */
/*-
@@ -46,6 +46,7 @@
#include <sys/dkstat.h>
#include <sys/timeout.h>
#include <sys/kernel.h>
+#include <sys/limits.h>
#include <sys/proc.h>
#include <sys/resourcevar.h>
#include <sys/signalvar.h>
@@ -55,7 +56,6 @@
#include <sys/sched.h>
#include <machine/cpu.h>
-#include <machine/limits.h>
#ifdef GPROF
#include <sys/gmon.h>
diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c
index 2fb4ecbbbc1..b83a261c397 100644
--- a/sys/kern/subr_autoconf.c
+++ b/sys/kern/subr_autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_autoconf.c,v 1.30 2002/03/14 01:27:04 millert Exp $ */
+/* $OpenBSD: subr_autoconf.c,v 1.31 2002/04/24 21:53:12 espie Exp $ */
/* $NetBSD: subr_autoconf.c,v 1.21 1996/04/04 06:06:18 cgd Exp $ */
/*
@@ -49,9 +49,9 @@
#include <sys/param.h>
#include <sys/device.h>
+#include <sys/limits.h>
#include <sys/malloc.h>
#include <sys/systm.h>
-#include <machine/limits.h>
/* Extra stuff from Matthias Drochner <drochner@zelux6.zel.kfa-juelich.de> */
#include <sys/queue.h>
diff --git a/sys/lib/libkern/memset.c b/sys/lib/libkern/memset.c
index b0a34c1ea62..cc7f9a15568 100644
--- a/sys/lib/libkern/memset.c
+++ b/sys/lib/libkern/memset.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: memset.c,v 1.2 2000/04/25 15:24:01 mickey Exp $ */
+/* $OpenBSD: memset.c,v 1.3 2002/04/24 21:53:12 espie Exp $ */
/* $NetBSD: memset.c,v 1.6 1998/03/27 05:35:47 cgd Exp $ */
/*-
@@ -52,9 +52,9 @@ __RCSID("$NetBSD: memset.c,v 1.6 1998/03/27 05:35:47 cgd Exp $");
#include <string.h>
#include <limits.h>
#else
+#include <sys/limits.h>
#include <sys/systm.h>
#include <lib/libkern/libkern.h>
-#include <machine/limits.h>
#endif
#define wsize sizeof(u_int)
diff --git a/sys/lib/libkern/quad.h b/sys/lib/libkern/quad.h
index 5b4dfde04c0..b8ebe038388 100644
--- a/sys/lib/libkern/quad.h
+++ b/sys/lib/libkern/quad.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: quad.h,v 1.6 2002/03/14 01:27:07 millert Exp $ */
+/* $OpenBSD: quad.h,v 1.7 2002/04/24 21:53:12 espie Exp $ */
/* $NetBSD: quad.h,v 1.7 1996/04/18 02:20:04 cgd Exp $ */
/*-
@@ -60,7 +60,7 @@
#if !defined(_KERNEL) && !defined(_STANDALONE)
#include <limits.h>
#else
-#include <machine/limits.h>
+#include <sys/limits.h>
#endif
/*
diff --git a/sys/sys/limits.h b/sys/sys/limits.h
new file mode 100644
index 00000000000..0b385b0b561
--- /dev/null
+++ b/sys/sys/limits.h
@@ -0,0 +1,125 @@
+/* $OpenBSD: limits.h,v 1.1 2002/04/24 21:53:12 espie Exp $ */
+/*
+ * Copyright (c) 2002 Marc Espie.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBSD
+ * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _SYS_LIMITS_H_
+#define _SYS_LIMITS_H_
+
+/* Common definitions for limits.h. */
+
+/*
+ * <machine/internal_types.h> is meant to describe a specific architecture,
+ * but to be a safe include, that doesn't ever define anything that is
+ * user-visible (only typedefs and #define names that stays in the __xxx
+ * namespace).
+ *
+ * __machine_arch_is_64_bits (default is 32 bits arches)
+ * __machine_has_unsigned_chars (default is signed chars)
+ * __FLT_xxx/__DBL_xxx non standard values for floating
+ * points limits.
+ */
+#include <machine/internal_types.h>
+
+/* Legacy */
+#include <machine/limits.h>
+
+#define CHAR_BIT 8 /* number of bits in a char */
+
+#define SCHAR_MAX 0x7f /* max value for a signed char */
+#define SCHAR_MIN (-0x7f-1) /* min value for a signed char */
+
+#define UCHAR_MAX 0xffU /* max value for an unsigned char */
+#ifdef __machine_has_unsigned_chars
+# define CHAR_MIN 0 /* min value for a char */
+# define CHAR_MAX 0xff /* max value for a char */
+#else
+# define CHAR_MAX 0x7f
+# define CHAR_MIN (-0x7f-1)
+#endif
+
+#define USHRT_MAX 0xffffU /* max value for an unsigned short */
+#define SHRT_MAX 0x7fff /* max value for a short */
+#define SHRT_MIN (-0x7fff-1) /* min value for a short */
+
+#define UINT_MAX 0xffffffffU /* max value for an unsigned int */
+#define INT_MAX 0x7fffffff /* max value for an int */
+#define INT_MIN (-0x7fffffff-1) /* min value for an int */
+
+#ifdef __machine_is_64_bits
+# define ULONG_MAX 0xffffffffffffffffUL
+ /* max value for unsigned long */
+# define LONG_MAX 0x7fffffffffffffffL
+ /* max value for a signed long */
+# define LONG_MIN (-0x7fffffffffffffffL-1)
+ /* min value for a signed long */
+#else
+# define ULONG_MAX 0xffffffffUL /* max value for an unsigned long */
+# define LONG_MAX 0x7fffffffL /* max value for a long */
+# define LONG_MIN (-0x7fffffffL-1)/* min value for a long */
+#endif
+
+#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) || \
+ defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L
+# define ULLONG_MAX 0xffffffffffffffffULL
+ /* max value for unsigned long long */
+# define LLONG_MAX 0x7fffffffffffffffLL
+ /* max value for a signed long long */
+# define LLONG_MIN (-0x7fffffffffffffffLL-1)
+ /* min value for a signed long long */
+#endif
+
+#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
+# define UID_MAX UINT_MAX /* max value for a uid_t */
+# define GID_MAX UINT_MAX /* max value for a gid_t */
+#endif
+
+
+#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE)
+# ifdef __machine_is_64_bits
+# define LONG_BIT 64
+# else
+# define LONG_BIT 32
+# endif
+# define WORD_BIT 32
+
+# if defined(__DBL_DIG)
+# define DBL_DIG __DBL_DIG
+# define DBL_MAX __DBL_MAX
+# define DBL_MIN __DBL_MIN
+
+# define FLT_DIG __FLT_DIG
+# define FLT_MAX __FLT_MAX
+# define FLT_MIN __FLT_MIN
+# else
+# define DBL_DIG 15
+# define DBL_MAX 1.7976931348623157E+308
+# define DBL_MIN 2.2250738585072014E-308
+
+# define FLT_DIG 6
+# define FLT_MAX 3.40282347E+38F
+# define FLT_MIN 1.17549435E-38F
+# endif
+#endif
+
+#endif
diff --git a/sys/sys/param.h b/sys/sys/param.h
index 5057c48a1a5..a1f6591d4d1 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.47 2002/03/22 23:29:28 deraadt Exp $ */
+/* $OpenBSD: param.h,v 1.48 2002/04/24 21:53:12 espie Exp $ */
/* $NetBSD: param.h,v 1.23 1996/03/17 01:02:29 thorpej Exp $ */
/*-
@@ -95,8 +95,8 @@
#include <sys/signal.h>
/* Machine type dependent parameters. */
+#include <sys/limits.h>
#include <machine/param.h>
-#include <machine/limits.h>
/*
* Priorities. Note that with 32 run queues, differences less than 4 are