TYPES(3) Library Functions Manual TYPES(3)
NAME
typesstandard system data types
SYNOPSIS
#include <sys/types.h>
DESCRIPTION
The <sys/types.h> header contains the common data types used in the system. Although these are meant to be used within the kernel, most of the system data types are accessible also to user code. A companion header <sys/param.h>, typically used in the kernel, includes <sys/types.h> and provides additional types as well as other facilities.
Standard Types
The following standards-compliant system data types are defined:
 
Type
Typical use
Example
blkcnt_t
file block counts
blksize_t
block sizes
clock_t
system clock ticks
clockid_t
clock IDs
dev_t
device IDs
fsblkcnt_t
file system block counts
-
fsfilcnt_t
file system file counts
-
gid_t
group IDs
id_t
general identifier
ino_t
file serial numbers
key_t
interprocess communication
mode_t
file attributes
nlink_t
link counts
off_t
file sizes
pid_t
process and process group IDs
size_t
size of objects
ssize_t
count of bytes
suseconds_t
microseconds
time_t
time in seconds
timer_t
timer IDs
uid_t
user IDs
useconds_t
time in microseconds
 
In addition, when included in user applications, <sys/types.h> includes <pthread.h>, and thus it defines also the types used in the POSIX Threads Library, pthread(3).
 
Each described type may vary across machines and operating systems. Only the following properties are guaranteed by the IEEE Std 1003.1-2001 (“POSIX.1”) standard:
1.
The type ssize_t is capable of storing integer values at least in the range [-1, SSIZE_MAX].
2.
The type useconds_t is an unsigned integer capable of storing values at least in the range [0, 1000000].
3.
The type suseconds_t is a signed integer capable of storing values at least in the range [-1, 1000000].
4.
The time_t and clock_t types are either integers or real-floating types.
5.
The following types are integers: gid_t, id_t, mode_t, nlink_t, and uid_t.
6.
The following types are signed integers: blkcnt_t, blksize_t, off_t, pid_t, and ssize_t.
7.
The following types are unsigned integers: fsblkcnt_t, fsfilcnt_t, ino_t, and size_t.
NetBSD-specific Types
In addition to the standard types, <sys/types.h> defines some data types specific to NetBSD. These are mostly used in the kernel. A portable implementation should not rely on these types to be available in other systems. Examples include:
Type
Typical use
Example
cpuid_t
CPU IDs
daddr_t
disk address
devmajor_t
major device number
lwp_t
typedef of struct lwp
u_quad_t
synonym for uint64_t
 
It can be noted that the standard “C99 types” described in stdint(3) are preferred to the older fixed size integer types prefixed with an “u_” (in another words, uint32_t should be used instead of u_int32_t).
SEE ALSO
STANDARDS
The <sys/types.h> header conforms to IEEE Std 1003.1-2001 (“POSIX.1”) with respect to the described standard types.
HISTORY
The <sys/types.h> header first appeared in Version 7 AT&T UNIX. In the current form the header appeared in NetBSD 0.9.