|
Packit |
6c4009 |
/* bits/types.h -- definitions of __*_t types underlying *_t types.
|
|
Packit |
6c4009 |
Copyright (C) 2002-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/*
|
|
Packit |
6c4009 |
* Never include this file directly; use <sys/types.h> instead.
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifndef _BITS_TYPES_H
|
|
Packit |
6c4009 |
#define _BITS_TYPES_H 1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <features.h>
|
|
Packit |
6c4009 |
#include <bits/wordsize.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Convenience types. */
|
|
Packit |
6c4009 |
typedef unsigned char __u_char;
|
|
Packit |
6c4009 |
typedef unsigned short int __u_short;
|
|
Packit |
6c4009 |
typedef unsigned int __u_int;
|
|
Packit |
6c4009 |
typedef unsigned long int __u_long;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Fixed-size types, underlying types depend on word size and compiler. */
|
|
Packit |
6c4009 |
typedef signed char __int8_t;
|
|
Packit |
6c4009 |
typedef unsigned char __uint8_t;
|
|
Packit |
6c4009 |
typedef signed short int __int16_t;
|
|
Packit |
6c4009 |
typedef unsigned short int __uint16_t;
|
|
Packit |
6c4009 |
typedef signed int __int32_t;
|
|
Packit |
6c4009 |
typedef unsigned int __uint32_t;
|
|
Packit |
6c4009 |
#if __WORDSIZE == 64
|
|
Packit |
6c4009 |
typedef signed long int __int64_t;
|
|
Packit |
6c4009 |
typedef unsigned long int __uint64_t;
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
__extension__ typedef signed long long int __int64_t;
|
|
Packit |
6c4009 |
__extension__ typedef unsigned long long int __uint64_t;
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Smallest types with at least a given width. */
|
|
Packit |
6c4009 |
typedef __int8_t __int_least8_t;
|
|
Packit |
6c4009 |
typedef __uint8_t __uint_least8_t;
|
|
Packit |
6c4009 |
typedef __int16_t __int_least16_t;
|
|
Packit |
6c4009 |
typedef __uint16_t __uint_least16_t;
|
|
Packit |
6c4009 |
typedef __int32_t __int_least32_t;
|
|
Packit |
6c4009 |
typedef __uint32_t __uint_least32_t;
|
|
Packit |
6c4009 |
typedef __int64_t __int_least64_t;
|
|
Packit |
6c4009 |
typedef __uint64_t __uint_least64_t;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* quad_t is also 64 bits. */
|
|
Packit |
6c4009 |
#if __WORDSIZE == 64
|
|
Packit |
6c4009 |
typedef long int __quad_t;
|
|
Packit |
6c4009 |
typedef unsigned long int __u_quad_t;
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
__extension__ typedef long long int __quad_t;
|
|
Packit |
6c4009 |
__extension__ typedef unsigned long long int __u_quad_t;
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Largest integral types. */
|
|
Packit |
6c4009 |
#if __WORDSIZE == 64
|
|
Packit |
6c4009 |
typedef long int __intmax_t;
|
|
Packit |
6c4009 |
typedef unsigned long int __uintmax_t;
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
__extension__ typedef long long int __intmax_t;
|
|
Packit |
6c4009 |
__extension__ typedef unsigned long long int __uintmax_t;
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* The machine-dependent file <bits/typesizes.h> defines __*_T_TYPE
|
|
Packit |
6c4009 |
macros for each of the OS types we define below. The definitions
|
|
Packit |
6c4009 |
of those macros must use the following macros for underlying types.
|
|
Packit |
6c4009 |
We define __S<SIZE>_TYPE and __U<SIZE>_TYPE for the signed and unsigned
|
|
Packit |
6c4009 |
variants of each of the following integer types on this machine.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
16 -- "natural" 16-bit type (always short)
|
|
Packit |
6c4009 |
32 -- "natural" 32-bit type (always int)
|
|
Packit |
6c4009 |
64 -- "natural" 64-bit type (long or long long)
|
|
Packit |
6c4009 |
LONG32 -- 32-bit type, traditionally long
|
|
Packit Service |
c82647 |
QUAD -- 64-bit type, always long long
|
|
Packit |
6c4009 |
WORD -- natural type of __WORDSIZE bits (int or long)
|
|
Packit |
6c4009 |
LONGWORD -- type of __WORDSIZE bits, traditionally long
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the
|
|
Packit |
6c4009 |
conventional uses of `long' or `long long' type modifiers match the
|
|
Packit |
6c4009 |
types we define, even when a less-adorned type would be the same size.
|
|
Packit |
6c4009 |
This matters for (somewhat) portably writing printf/scanf formats for
|
|
Packit |
6c4009 |
these types, where using the appropriate l or ll format modifiers can
|
|
Packit |
6c4009 |
make the typedefs and the formats match up across all GNU platforms. If
|
|
Packit |
6c4009 |
we used `long' when it's 64 bits where `long long' is expected, then the
|
|
Packit |
6c4009 |
compiler would warn about the formats not matching the argument types,
|
|
Packit |
6c4009 |
and the programmer changing them to shut up the compiler would break the
|
|
Packit |
6c4009 |
program's portability.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
Here we assume what is presently the case in all the GCC configurations
|
|
Packit |
6c4009 |
we support: long long is always 64 bits, long is always word/address size,
|
|
Packit |
6c4009 |
and int is always 32 bits. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define __S16_TYPE short int
|
|
Packit |
6c4009 |
#define __U16_TYPE unsigned short int
|
|
Packit |
6c4009 |
#define __S32_TYPE int
|
|
Packit |
6c4009 |
#define __U32_TYPE unsigned int
|
|
Packit |
6c4009 |
#define __SLONGWORD_TYPE long int
|
|
Packit |
6c4009 |
#define __ULONGWORD_TYPE unsigned long int
|
|
Packit |
6c4009 |
#if __WORDSIZE == 32
|
|
Packit Service |
c82647 |
# define __SQUAD_TYPE __quad_t
|
|
Packit Service |
c82647 |
# define __UQUAD_TYPE __u_quad_t
|
|
Packit |
6c4009 |
# define __SWORD_TYPE int
|
|
Packit |
6c4009 |
# define __UWORD_TYPE unsigned int
|
|
Packit |
6c4009 |
# define __SLONG32_TYPE long int
|
|
Packit |
6c4009 |
# define __ULONG32_TYPE unsigned long int
|
|
Packit Service |
c82647 |
# define __S64_TYPE __quad_t
|
|
Packit Service |
c82647 |
# define __U64_TYPE __u_quad_t
|
|
Packit |
6c4009 |
/* We want __extension__ before typedef's that use nonstandard base types
|
|
Packit |
6c4009 |
such as `long long' in C89 mode. */
|
|
Packit |
6c4009 |
# define __STD_TYPE __extension__ typedef
|
|
Packit |
6c4009 |
#elif __WORDSIZE == 64
|
|
Packit |
6c4009 |
# define __SQUAD_TYPE long int
|
|
Packit |
6c4009 |
# define __UQUAD_TYPE unsigned long int
|
|
Packit |
6c4009 |
# define __SWORD_TYPE long int
|
|
Packit |
6c4009 |
# define __UWORD_TYPE unsigned long int
|
|
Packit |
6c4009 |
# define __SLONG32_TYPE int
|
|
Packit |
6c4009 |
# define __ULONG32_TYPE unsigned int
|
|
Packit |
6c4009 |
# define __S64_TYPE long int
|
|
Packit |
6c4009 |
# define __U64_TYPE unsigned long int
|
|
Packit |
6c4009 |
/* No need to mark the typedef with __extension__. */
|
|
Packit |
6c4009 |
# define __STD_TYPE typedef
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# error
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
#include <bits/typesizes.h> /* Defines __*_T_TYPE macros. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
__STD_TYPE __DEV_T_TYPE __dev_t; /* Type of device numbers. */
|
|
Packit |
6c4009 |
__STD_TYPE __UID_T_TYPE __uid_t; /* Type of user identifications. */
|
|
Packit |
6c4009 |
__STD_TYPE __GID_T_TYPE __gid_t; /* Type of group identifications. */
|
|
Packit |
6c4009 |
__STD_TYPE __INO_T_TYPE __ino_t; /* Type of file serial numbers. */
|
|
Packit |
6c4009 |
__STD_TYPE __INO64_T_TYPE __ino64_t; /* Type of file serial numbers (LFS).*/
|
|
Packit |
6c4009 |
__STD_TYPE __MODE_T_TYPE __mode_t; /* Type of file attribute bitmasks. */
|
|
Packit |
6c4009 |
__STD_TYPE __NLINK_T_TYPE __nlink_t; /* Type of file link counts. */
|
|
Packit |
6c4009 |
__STD_TYPE __OFF_T_TYPE __off_t; /* Type of file sizes and offsets. */
|
|
Packit |
6c4009 |
__STD_TYPE __OFF64_T_TYPE __off64_t; /* Type of file sizes and offsets (LFS). */
|
|
Packit |
6c4009 |
__STD_TYPE __PID_T_TYPE __pid_t; /* Type of process identifications. */
|
|
Packit |
6c4009 |
__STD_TYPE __FSID_T_TYPE __fsid_t; /* Type of file system IDs. */
|
|
Packit |
6c4009 |
__STD_TYPE __CLOCK_T_TYPE __clock_t; /* Type of CPU usage counts. */
|
|
Packit |
6c4009 |
__STD_TYPE __RLIM_T_TYPE __rlim_t; /* Type for resource measurement. */
|
|
Packit |
6c4009 |
__STD_TYPE __RLIM64_T_TYPE __rlim64_t; /* Type for resource measurement (LFS). */
|
|
Packit |
6c4009 |
__STD_TYPE __ID_T_TYPE __id_t; /* General type for IDs. */
|
|
Packit |
6c4009 |
__STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */
|
|
Packit |
6c4009 |
__STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */
|
|
Packit |
6c4009 |
__STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
__STD_TYPE __DADDR_T_TYPE __daddr_t; /* The type of a disk address. */
|
|
Packit |
6c4009 |
__STD_TYPE __KEY_T_TYPE __key_t; /* Type of an IPC key. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Clock ID used in clock and timer functions. */
|
|
Packit |
6c4009 |
__STD_TYPE __CLOCKID_T_TYPE __clockid_t;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Timer ID returned by `timer_create'. */
|
|
Packit |
6c4009 |
__STD_TYPE __TIMER_T_TYPE __timer_t;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Type to represent block size. */
|
|
Packit |
6c4009 |
__STD_TYPE __BLKSIZE_T_TYPE __blksize_t;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Types from the Large File Support interface. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Type to count number of disk blocks. */
|
|
Packit |
6c4009 |
__STD_TYPE __BLKCNT_T_TYPE __blkcnt_t;
|
|
Packit |
6c4009 |
__STD_TYPE __BLKCNT64_T_TYPE __blkcnt64_t;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Type to count file system blocks. */
|
|
Packit |
6c4009 |
__STD_TYPE __FSBLKCNT_T_TYPE __fsblkcnt_t;
|
|
Packit |
6c4009 |
__STD_TYPE __FSBLKCNT64_T_TYPE __fsblkcnt64_t;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Type to count file system nodes. */
|
|
Packit |
6c4009 |
__STD_TYPE __FSFILCNT_T_TYPE __fsfilcnt_t;
|
|
Packit |
6c4009 |
__STD_TYPE __FSFILCNT64_T_TYPE __fsfilcnt64_t;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Type of miscellaneous file system fields. */
|
|
Packit |
6c4009 |
__STD_TYPE __FSWORD_T_TYPE __fsword_t;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
__STD_TYPE __SSIZE_T_TYPE __ssize_t; /* Type of a byte count, or error. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Signed long type used in system calls. */
|
|
Packit |
6c4009 |
__STD_TYPE __SYSCALL_SLONG_TYPE __syscall_slong_t;
|
|
Packit |
6c4009 |
/* Unsigned long type used in system calls. */
|
|
Packit |
6c4009 |
__STD_TYPE __SYSCALL_ULONG_TYPE __syscall_ulong_t;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* These few don't really vary by system, they always correspond
|
|
Packit |
6c4009 |
to one of the other defined types. */
|
|
Packit |
6c4009 |
typedef __off64_t __loff_t; /* Type of file sizes and offsets (LFS). */
|
|
Packit |
6c4009 |
typedef char *__caddr_t;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Duplicates info from stdint.h but this is used in unistd.h. */
|
|
Packit |
6c4009 |
__STD_TYPE __SWORD_TYPE __intptr_t;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Duplicate info from sys/socket.h. */
|
|
Packit |
6c4009 |
__STD_TYPE __U32_TYPE __socklen_t;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* C99: An integer type that can be accessed as an atomic entity,
|
|
Packit |
6c4009 |
even in the presence of asynchronous interrupts.
|
|
Packit |
6c4009 |
It is not currently necessary for this to be machine-specific. */
|
|
Packit |
6c4009 |
typedef int __sig_atomic_t;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#undef __STD_TYPE
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#endif /* bits/types.h */
|