sys_types.h(0P)

๐ŸŒธ sys_types.h(0P) โ€” the POSIX Programmer's Manual one ๐ŸŒธ

okay bestie, so this is sys_types.h(0P) from the POSIX Programmer's Manual ๐Ÿ’– buckle up, we're talking about types and honestly? it's giving foundational.


โš ๏ธ PROLOG โš ๏ธ

so like. this manual page is part of the POSIX Programmer's Manual. but here's the tea: the Linux implementation of this interface may differ (so pls go consult the corresponding Linux manual page for the deets on Linux behavior), or โ€” and this is the part that hurts ๐Ÿ˜ญ โ€” the interface might not even be implemented on Linux at all. vibe check accordingly.


โœจ NAME โœจ

sys/types.h โ€” data types. that's it. that's the whole name. iconic minimalism.


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

#include <sys/types.h>

literally just include it and you're in. no cap. ๐Ÿซถ


๐Ÿ’… DESCRIPTION ๐Ÿ’…

the <sys/types.h> header shall define at least the following types, and bestie, there's a LOT of them:

  • blkcnt_t โ€” for file block counts ๐Ÿ“ฆ
  • blksize_t โ€” for block sizes ๐Ÿ“
  • clock_t โ€” for system times, measured in clock ticks or CLOCKS_PER_SEC; go peek at <time.h> for the lore โฐ
  • clockid_t โ€” the clock ID type used in the clock and timer functions ๐Ÿ•ฐ๏ธ
  • dev_t โ€” for device IDs ๐Ÿ”Œ
  • fsblkcnt_t โ€” for file system block counts ๐Ÿ—‚๏ธ
  • fsfilcnt_t โ€” for file system file counts ๐Ÿ“
  • gid_t โ€” for group IDs ๐Ÿ‘ฅ
  • id_t โ€” a general identifier type; it can hold at least a pid_t, a uid_t, or a gid_t. she's versatile ๐Ÿ’โ€โ™€๏ธ
  • ino_t โ€” for file serial numbers ๐Ÿ”ข
  • key_t โ€” for XSI interprocess communication ๐Ÿ”‘
  • mode_t โ€” for some file attributes ๐Ÿ› ๏ธ
  • nlink_t โ€” for link counts ๐Ÿ”—
  • off_t โ€” for file sizes ๐Ÿ“
  • pid_t โ€” for process IDs and process group IDs ๐Ÿ‘‘
  • pthread_attr_t โ€” identifies a thread attribute object ๐Ÿงต
  • pthread_barrier_t โ€” identifies a barrier ๐Ÿšง
  • pthread_barrierattr_t โ€” defines a barrier attributes object ๐Ÿšงโœจ
  • pthread_cond_t โ€” for condition variables ๐Ÿ˜ด
  • pthread_condattr_t โ€” identifies a condition attribute object ๐Ÿ˜ดโœจ
  • pthread_key_t โ€” for thread-specific data keys ๐Ÿ—๏ธ
  • pthread_mutex_t โ€” for mutexes ๐Ÿ”’
  • pthread_mutexattr_t โ€” identifies a mutex attribute object ๐Ÿ”’โœจ
  • pthread_once_t โ€” for dynamic package initialization 1๏ธโƒฃ
  • pthread_rwlock_t โ€” for read-write locks ๐Ÿ“–โœ๏ธ
  • pthread_rwlockattr_t โ€” for read-write lock attributes ๐Ÿ“–โœ๏ธโœจ
  • pthread_spinlock_t โ€” identifies a spin lock ๐ŸŒ€
  • pthread_t โ€” identifies a thread ๐Ÿงต๐Ÿ‘‘
  • size_t โ€” for sizes of objects ๐Ÿ“ฆ๐Ÿ“ฆ
  • ssize_t โ€” for a count of bytes, or an error indication ๐Ÿšจ
  • suseconds_t โ€” for time in microseconds โšก
  • time_t โ€” for time in seconds โณ
  • timer_t โ€” the timer ID returned by timer_create() โฒ๏ธ
  • trace_attr_t โ€” identifies a trace stream attributes object ๐Ÿ”
  • trace_event_id_t โ€” identifies a trace event type ๐Ÿ”โœจ
  • trace_event_set_t โ€” identifies a trace event type set ๐Ÿ”โœจโœจ
  • trace_id_t โ€” identifies a trace stream ๐Ÿ”๐ŸŒŠ
  • uid_t โ€” for user IDs ๐Ÿซต

fr fr, all of these types shall be defined as arithmetic types of an appropriate length, with these exceptions (the girlies that are not arithmetic types):

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_t shall be an integer type.
  • dev_t shall be an integer type.
  • nlink_t, uid_t, gid_t, and id_t shall be integer types.
  • blkcnt_t and off_t shall be signed integer types.
  • fsblkcnt_t, fsfilcnt_t, and ino_t shall be defined as unsigned integer types.
  • size_t shall be an unsigned integer type.
  • blksize_t, pid_t, and ssize_t shall be signed integer types.
  • clock_t shall be an integer or real-floating type. and time_t shall be an integer type. (they're a duo but not twins, iykyk ๐Ÿ’ซ)

the type ssize_t shall be capable of storing values at least in the range [-1, {SSIZE_MAX}]. slay.

the type suseconds_t shall be a signed integer type capable of storing values at least in the range [-1, 1000000]. ๐Ÿ’ฏ

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. the names of these programming environments can be obtained using the confstr() function or the getconf utility. (we love a lookup moment ๐Ÿ•ต๏ธโ€โ™€๏ธ)

๐Ÿšฉ heads up bestie: there are no defined comparison or assignment operators for the following types. so don't be out here comparing them like they're regular numbers, because they are NOT. periodt.
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

the following sections are informative. โœจ


๐Ÿ’œ APPLICATION USAGE ๐Ÿ’œ

none. literally nothing. she said "no notes." ๐Ÿ˜Œ


๐Ÿ’œ RATIONALE ๐Ÿ’œ

none. again. empty. the void. ๐Ÿ•ณ๏ธโœจ


๐Ÿ’œ FUTURE DIRECTIONS ๐Ÿ’œ

none. the future is, apparently, also quiet. ๐Ÿ”ฎ


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

  • <time.h>
  • The System Interfaces volume of POSIX.1โ€2017, confstr()
  • The Shell and Utilities volume of POSIX.1โ€2017, getconf

okay so legally speaking, 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.

and here's the important bit, no cap: 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 one came to you courtesy of IEEE/The Open Group, 2017 โ€” mwah, go forth and #include responsibly ๐Ÿ’–โœจ๐ŸŽ€

๐Ÿ“ฆ where this page comes from