Little reorganization:
- created internal names for fixed-size integral types, like __int32_t. They will be used to make several headers self-sufficient. - <stdlib.h> don't include <machine/types.h> anymore. - created <sys/inttypes.h>, which can be used as <inttypes.h>. - declaration of uoff_t and ufs_daddr_t moved to <sys/types.h>. Reviewed by: bde
This commit is contained in:
parent
f52393a257
commit
8252a465b9
@ -41,8 +41,6 @@
|
||||
#include <machine/ansi.h>
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
|
||||
#include <machine/types.h>
|
||||
|
||||
#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 *));
|
||||
|
@ -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_ */
|
||||
|
@ -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);
|
||||
|
@ -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_ */
|
||||
|
@ -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));
|
||||
|
24
sys/sys/inttypes.h
Normal file
24
sys/sys/inttypes.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* This file is in the public domain.
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _SYS_INTTYPES_H_
|
||||
#define _SYS_INTTYPES_H_
|
||||
|
||||
#include <machine/ansi.h>
|
||||
|
||||
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_ */
|
@ -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 <sys/cdefs.h>
|
||||
|
||||
/* Machine type dependent parameters. */
|
||||
#include <machine/ansi.h>
|
||||
#include <sys/inttypes.h> /* includes <machine/ansi.h> */
|
||||
#include <machine/types.h>
|
||||
|
||||
#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 */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user