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 (see param(3)
The following standards-compliant system data types are defined:
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:
The type ssize_t is capable of storing integer values at least in the range [-1, SSIZE_MAX].
The type useconds_t is an unsigned integer capable of storing values at least in the range [0, 1000000].
The type suseconds_t is a signed integer capable of storing values at least in the range [-1, 1000000].
The time_t and clock_t types are either integers or real-floating types.
The following types are integers: gid_t, id_t, mode_t, nlink_t, and uid_t.
The following types are signed integers: blkcnt_t, blksize_t, off_t, pid_t, and ssize_t.
The following types are unsigned integers: fsblkcnt_t, fsfilcnt_t, ino_t, and size_t.
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:
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 other words, uint32_t should be used instead of u_int32_t).