sys_types.h(7POSIX)
πΈ sys_types.h β POSIX Programmer's Manual, sys_types.h(7POSIX) π
okay bestie, buckle up, we're doing header files today and honestly? this one is the blueprint. it's giving "types, types, and more types" and I am obsessed. π
β¨ PROLOG β¨
real talk first, because this matters: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ β so like, consult the corresponding Linux manual page for the details on Linux behavior, fr fr. or, worstie scenario, the interface may not be implemented on Linux at all. π
π NAME π
sys/types.h β data types. that's it. that's the whole vibe. it's the header that defines your types.
π¦ SYNOPSIS π¦
#include <sys/types.h>
one line. iconic. no notes. β¨
π DESCRIPTION π
so the <sys/types.h> header shall define at least the following types, and no, we are not skipping any of them, every single one is getting its moment:
blkcnt_tβ used for file block counts.blksize_tβ used for block sizes.clock_tβ used for system times in clock ticks orCLOCKS_PER_SEC; peep<time.h>for more.clockid_tβ used for the clock ID type in the clock and timer functions.dev_tβ used for device IDs.fsblkcnt_tβ used for file system block counts.fsfilcnt_tβ used for file system file counts.gid_tβ used for group IDs.id_tβ used as a general identifier; can hold at least apid_t,uid_t, orgid_t.ino_tβ used for file serial numbers.key_tβ used for XSI interprocess communication.mode_tβ used for some file attributes.nlink_tβ used for link counts.off_tβ used for file sizes.pid_tβ used for process IDs and process group IDs.pthread_attr_tβ used to identify a thread attribute object.pthread_barrier_tβ used to identify a barrier.pthread_barrierattr_tβ used to define a barrier attributes object.pthread_cond_tβ used for condition variables.pthread_condattr_tβ used to identify a condition attribute object.pthread_key_tβ used for thread-specific data keys.pthread_mutex_tβ used for mutexes.pthread_mutexattr_tβ used to identify a mutex attribute object.pthread_once_tβ used for dynamic package initialization.pthread_rwlock_tβ used for read-write locks.pthread_rwlockattr_tβ used for read-write lock attributes.pthread_spinlock_tβ used to identify a spin lock.pthread_tβ used to identify a thread.size_tβ used for sizes of objects.ssize_tβ used for a count of bytes or an error indication.suseconds_tβ used for time in microseconds.time_tβ used for time in seconds.timer_tβ used for the timer ID returned bytimer_create().trace_attr_tβ used to identify a trace stream attributes objecttrace_event_id_tβ used to identify a trace event type.trace_event_set_tβ used to identify a trace event type set.trace_id_tβ used to identify a trace stream.uid_tβ used for user IDs.
π§ the arithmetic-type rule (aka the plot twist)
all of the types shall be defined as arithmetic types of an appropriate length, with the following exceptions, and bestie these exceptions are a whole list:
pthread_attr_t
pthread_barrier_t
pthread_barrierattr_t
pthread_cond_t
pthread_condattr_t
pthread_key_t
pthread_mutex_t
pthread_mutexattr_t
pthread_once_t
pthread_rwlock_t
pthread_rwlockattr_t
pthread_spinlock_t
pthread_t
timer_t
trace_attr_t
trace_event_id_t
trace_event_set_t
trace_id_t
β¨ additionally β¨
mode_tshall be an integer type.dev_tshall be an integer type.nlink_t,uid_t,gid_t, andid_tshall be integer types.blkcnt_tandoff_tshall be signed integer types.fsblkcnt_t,fsfilcnt_t, andino_tshall be defined as unsigned integer types.size_tshall be an unsigned integer type.blksize_t,pid_t, andssize_tshall be signed integer types.clock_tshall be an integer or real-floating type.time_tshall be an integer type.
π the range receipts
the type ssize_t shall be capable of storing values at least in the range [-1, {SSIZE_MAX}]. yes, negative one included, because error indications gotta live somewhere. π
the type suseconds_t shall be a signed integer type capable of storing values at least in the range [-1, 1000000].
π«Ά programming environments
the implementation shall support one or more programming environments in which the widths of blksize_t, pid_t, size_t, ssize_t, and suseconds_t are no greater than the width of type long. wanna know the names of these programming environments? you can get them using the confstr() function or the getconf utility. slay. π
π no operators, sorry
there are no defined comparison or assignment operators for the following types. so like, don't try it. seriously:
pthread_attr_t
pthread_barrier_t
pthread_barrierattr_t
pthread_cond_t
pthread_condattr_t
pthread_mutex_t
pthread_mutexattr_t
pthread_rwlock_t
pthread_rwlockattr_t
pthread_spinlock_t
timer_t
trace_attr_t
also, heads up: the following sections are informative. π’
π APPLICATION USAGE π
None.
that's right. nothing. empty. the silence is the statement. π
πΈ RATIONALE πΈ
None.
again. nothing. iconic behavior honestly. β¨
π¦ FUTURE DIRECTIONS π¦
None.
three for three. no cap. π
β SEE ALSO β
<time.h>- The System Interfaces volume of POSIX.1β2017,
confstr() - The Shell and Utilities volume of POSIX.1β2017,
getconf
π COPYRIGHT π
okay legal bestie moment, gotta be precise here:
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page, bestie!! π«Ά this absolute classic was brought to you by IEEE/The Open Group, dated 2017, and it lives at sys_types.h(7POSIX). go forth and typedef responsibly. π
β¨
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms