From 8252a465b9bb7c2df6954163de046ceb4ac383dd Mon Sep 17 00:00:00 2001 From: Dmitrij Tejblum Date: Sat, 19 Dec 1998 00:02:34 +0000 Subject: [PATCH] Little reorganization: - created internal names for fixed-size integral types, like __int32_t. They will be used to make several headers self-sufficient. - don't include anymore. - created , which can be used as . - declaration of uoff_t and ufs_daddr_t moved to . Reviewed by: bde --- include/stdlib.h | 8 +++----- sys/alpha/include/ansi.h | 21 +++++++++++++++++---- sys/alpha/include/types.h | 24 +++--------------------- sys/i386/include/ansi.h | 18 ++++++++++++++---- sys/i386/include/types.h | 23 +++-------------------- sys/sys/inttypes.h | 24 ++++++++++++++++++++++++ sys/sys/types.h | 26 +++++++++----------------- 7 files changed, 73 insertions(+), 71 deletions(-) create mode 100644 sys/sys/inttypes.h diff --git a/include/stdlib.h b/include/stdlib.h index a78dafa5dbf3..db30a5abc900 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -41,8 +41,6 @@ #include #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) -#include - #ifdef _BSD_RUNE_T_ typedef _BSD_RUNE_T_ rune_t; #undef _BSD_RUNE_T_ @@ -132,7 +130,7 @@ void srand48 __P((long)); void *alloca __P((size_t)); /* built-in for gcc */ /* getcap(3) functions */ -u_int32_t +__uint32_t arc4random __P((void)); void arc4random_addrandom __P((unsigned char *dat, int datlen)); void arc4random_stir __P((void)); @@ -170,8 +168,8 @@ void srandom __P((unsigned long)); void srandomdev __P((void)); char *user_from_uid __P((unsigned long, int)); #ifndef __STRICT_ANSI__ -int64_t strtoq __P((const char *, char **, int)); -u_int64_t +__int64_t strtoq __P((const char *, char **, int)); +__uint64_t strtouq __P((const char *, char **, int)); #endif void unsetenv __P((const char *)); diff --git a/sys/alpha/include/ansi.h b/sys/alpha/include/ansi.h index aeaba523e685..09413e7d49f0 100644 --- a/sys/alpha/include/ansi.h +++ b/sys/alpha/include/ansi.h @@ -1,4 +1,4 @@ -/* $Id: ansi.h,v 1.2 1998/03/09 05:53:07 jb Exp $ */ +/* $Id: ansi.h,v 1.3 1998/10/12 23:57:58 alex Exp $ */ /* From: NetBSD: ansi.h,v 1.9 1997/11/23 20:20:53 kleink Exp */ /*- @@ -63,9 +63,6 @@ typedef struct { #define _BSD_TIMER_T_ int /* timer_t */ #define _BSD_SUSECONDS_T_ int /* suseconds_t */ #define _BSD_USECONDS_T_ unsigned int /* useconds_t */ -#define _BSD_UINT8_T_ unsigned char /* uint8_t */ -#define _BSD_UINT16_T_ unsigned short /* uint16_t */ -#define _BSD_UINT32_T_ unsigned int /* uint32_t */ /* * Types which are fundamental to the implementation and must be used @@ -108,4 +105,20 @@ typedef struct { #define _BSD_CLK_TCK_ 100 #define _BSD_CLOCKS_PER_SEC_ 100 +/* + * Internal names for basic integral types. Omit the typedef if + * not possible for a machine/compiler combination. + */ +typedef __signed char __int8_t; +typedef unsigned char __uint8_t; +typedef short __int16_t; +typedef unsigned short __uint16_t; +typedef int __int32_t; +typedef unsigned int __uint32_t; +typedef long __int64_t; +typedef unsigned long __uint64_t; + +typedef long __intptr_t; +typedef unsigned long __uintptr_t; + #endif /* _ANSI_H_ */ diff --git a/sys/alpha/include/types.h b/sys/alpha/include/types.h index 1bf185c65193..f293bc5268da 100644 --- a/sys/alpha/include/types.h +++ b/sys/alpha/include/types.h @@ -1,4 +1,4 @@ -/* $Id: types.h,v 1.7 1998/07/10 02:34:50 bde Exp $ */ +/* $Id: types.h,v 1.8 1998/07/14 05:09:42 bde Exp $ */ /* From: NetBSD: types.h,v 1.8 1997/04/06 08:47:45 cgd Exp */ /*- @@ -56,34 +56,16 @@ typedef long vm_ooffset_t; typedef unsigned long vm_pindex_t; typedef unsigned long vm_size_t; -/* - * Basic integral types. Omit the typedef if - * not possible for a machine/compiler combination. - */ -#define __BIT_TYPES_DEFINED__ -typedef __signed char int8_t; -typedef unsigned char u_int8_t; -typedef short int16_t; -typedef unsigned short u_int16_t; -typedef int int32_t; -typedef unsigned int u_int32_t; -typedef long int64_t; -typedef unsigned long u_int64_t; -typedef int64_t register_t; - -typedef int32_t ufs_daddr_t; +typedef __int64_t register_t; #ifdef KERNEL typedef long intfptr_t; typedef unsigned long uintfptr_t; -typedef long intptr_t; -typedef unsigned long uintptr_t; -typedef unsigned long uoff_t; #endif /* Interrupt mask (spl, xxx_imask, etc) */ -typedef u_int32_t intrmask_t; +typedef __uint32_t intrmask_t; /* Interrupt handler function type - arg should be "void *" one day */ typedef void inthand2_t(int _unit); diff --git a/sys/i386/include/ansi.h b/sys/i386/include/ansi.h index 52dad0bf856d..9d7494e0fc12 100644 --- a/sys/i386/include/ansi.h +++ b/sys/i386/include/ansi.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ansi.h 8.2 (Berkeley) 1/4/94 - * $Id: ansi.h,v 1.14 1998/01/08 00:27:30 alex Exp $ + * $Id: ansi.h,v 1.15 1998/06/14 14:00:47 bde Exp $ */ #ifndef _MACHINE_ANSI_H_ @@ -54,9 +54,6 @@ #define _BSD_SSIZE_T_ int /* byte count or error */ #define _BSD_TIME_T_ long /* time()... */ #define _BSD_TIMER_T_ int /* timer_gettime()... */ -#define _BSD_UINT8_T_ unsigned char /* unsigned exactly 8 bits */ -#define _BSD_UINT16_T_ unsigned short /* unsigned exactly 16 bits */ -#define _BSD_UINT32_T_ unsigned int /* unsigned exactly 32 bits */ #define _BSD_WCHAR_T_ _BSD_CT_RUNE_T_ /* wchar_t (see below) */ /* @@ -109,5 +106,18 @@ typedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t; typedef long long __int64_t; typedef unsigned long long __uint64_t; #endif +/* + * Internal names for basic integral types. Omit the typedef if + * not possible for a machine/compiler combination. + */ +typedef __signed char __int8_t; +typedef unsigned char __uint8_t; +typedef short __int16_t; +typedef unsigned short __uint16_t; +typedef int __int32_t; +typedef unsigned int __uint32_t; + +typedef int __intptr_t; +typedef unsigned int __uintptr_t; #endif /* !_MACHINE_ANSI_H_ */ diff --git a/sys/i386/include/types.h b/sys/i386/include/types.h index fa4d88f9cbc2..f28d633cbd3c 100644 --- a/sys/i386/include/types.h +++ b/sys/i386/include/types.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)types.h 8.3 (Berkeley) 1/5/94 - * $Id: types.h,v 1.14 1998/07/10 02:27:15 bde Exp $ + * $Id: types.h,v 1.15 1998/07/14 05:09:43 bde Exp $ */ #ifndef _MACHINE_TYPES_H_ @@ -52,33 +52,16 @@ typedef __int64_t vm_ooffset_t; typedef unsigned int vm_pindex_t; typedef unsigned int vm_size_t; -/* - * Basic integral types. Omit the typedef if - * not possible for a machine/compiler combination. - */ -typedef __signed char int8_t; -typedef unsigned char u_int8_t; -typedef short int16_t; -typedef unsigned short u_int16_t; -typedef int int32_t; -typedef unsigned int u_int32_t; -typedef __int64_t int64_t; -typedef __uint64_t u_int64_t; +typedef __int32_t register_t; -typedef int32_t register_t; - -typedef int32_t ufs_daddr_t; #ifdef KERNEL typedef int intfptr_t; typedef unsigned int uintfptr_t; -typedef int intptr_t; -typedef unsigned int uintptr_t; -typedef __uint64_t uoff_t; #endif /* Interrupt mask (spl, xxx_imask, etc) */ -typedef u_int32_t intrmask_t; +typedef __uint32_t intrmask_t; /* Interrupt handler function type. */ typedef void inthand2_t __P((void *_cookie)); diff --git a/sys/sys/inttypes.h b/sys/sys/inttypes.h new file mode 100644 index 000000000000..824786a65aa6 --- /dev/null +++ b/sys/sys/inttypes.h @@ -0,0 +1,24 @@ +/* + * This file is in the public domain. + * $Id$ + */ + +#ifndef _SYS_INTTYPES_H_ +#define _SYS_INTTYPES_H_ + +#include + +typedef __int8_t int8_t; +typedef __int16_t int16_t; +typedef __int32_t int32_t; +typedef __int64_t int64_t; + +typedef __uint8_t uint8_t; +typedef __uint16_t uint16_t; +typedef __uint32_t uint32_t; +typedef __uint64_t uint64_t; + +typedef __intptr_t intptr_t; +typedef __uintptr_t uintptr_t; + +#endif /* !_SYS_INTTYPES_H_ */ diff --git a/sys/sys/types.h b/sys/sys/types.h index 085825bee890..93f8698e6786 100644 --- a/sys/sys/types.h +++ b/sys/sys/types.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)types.h 8.6 (Berkeley) 2/19/95 - * $Id: types.h,v 1.24 1998/02/24 02:11:39 bde Exp $ + * $Id: types.h,v 1.25 1998/06/07 17:13:05 dfr Exp $ */ #ifndef _SYS_TYPES_H_ @@ -45,7 +45,7 @@ #include /* Machine type dependent parameters. */ -#include +#include /* includes */ #include #ifndef _POSIX_SOURCE @@ -57,6 +57,11 @@ typedef unsigned short ushort; /* Sys V compatibility */ typedef unsigned int uint; /* Sys V compatibility */ #endif +typedef __uint8_t u_int8_t; +typedef __uint16_t u_int16_t; +typedef __uint32_t u_int32_t; +typedef __uint64_t u_int64_t; + typedef u_int64_t u_quad_t; /* quads */ typedef int64_t quad_t; typedef quad_t * qaddr_t; @@ -79,10 +84,12 @@ typedef int64_t segsz_t; /* segment size */ typedef int32_t segsz_t; /* segment size */ #endif typedef int32_t swblk_t; /* swap offset */ +typedef int32_t ufs_daddr_t; typedef u_int32_t uid_t; /* user id */ #ifdef KERNEL typedef int boolean_t; +typedef u_int64_t uoff_t; typedef struct vm_page *vm_page_t; #endif @@ -129,21 +136,6 @@ typedef _BSD_TIMER_T_ timer_t; #undef _BSD_TIMER_T_ #endif -#ifdef _BSD_UINT8_T_ -typedef _BSD_UINT8_T_ uint8_t; -#undef _BSD_UINT8_T_ -#endif - -#ifdef _BSD_UINT16_T_ -typedef _BSD_UINT16_T_ uint16_t; -#undef _BSD_UINT16_T_ -#endif - -#ifdef _BSD_UINT32_T_ -typedef _BSD_UINT32_T_ uint32_t; -#undef _BSD_UINT32_T_ -#endif - #ifndef _POSIX_SOURCE #define NBBY 8 /* number of bits in a byte */