1SYSTEM_DATA_TYPES(7)       Linux Programmer's Manual      SYSTEM_DATA_TYPES(7)
2
3
4

NAME

6       system_data_types - overview of system data types
7

DESCRIPTION

9       aiocb
10              Include: <aio.h>.
11
12              struct aiocb {
13                  int             aio_fildes;    /* File descriptor */
14                  off_t           aio_offset;    /* File offset */
15                  volatile void  *aio_buf;       /* Location of buffer */
16                  size_t          aio_nbytes;    /* Length of transfer */
17                  int             aio_reqprio;   /* Request priority offset */
18                  struct sigevent aio_sigevent;  /* Signal number and value */
19                  int             aio_lio_opcode;/* Operation to be performed */
20              };
21
22              For further information about this structure, see aio(7).
23
24              Conforming to: POSIX.1-2001 and later.
25
26              See    also:    aio_cancel(3),    aio_error(3),    aio_fsync(3),
27              aio_read(3),   aio_return(3),   aio_suspend(3),    aio_write(3),
28              lio_listio(3)
29
30       clock_t
31              Include:     <time.h>    or    <sys/types.h>.     Alternatively,
32              <sys/time.h>.
33
34              Used for system time in clock ticks or  CLOCKS_PER_SEC  (defined
35              in  <time.h>).   According to POSIX, it shall be an integer type
36              or a real-floating type.
37
38              Conforming to: C99 and later; POSIX.1-2001 and later.
39
40              See also: times(2), clock(3)
41
42       clockid_t
43              Include: <sys/types.h>.  Alternatively, <time.h>.
44
45              Used for clock ID type in the clock and  timer  functions.   Ac‐
46              cording to POSIX, it shall be defined as an arithmetic type.
47
48              Conforming to: POSIX.1-2001 and later.
49
50              See also: clock_adjtime(2), clock_getres(2), clock_nanosleep(2),
51              timer_create(2), clock_getcpuclockid(3)
52
53       dev_t
54              Include: <sys/types.h>.  Alternatively, <sys/stat.h>.
55
56              Used for device IDs.  According to POSIX, it shall be an integer
57              type.  For further details of this type, see makedev(3).
58
59              Conforming to: POSIX.1-2001 and later.
60
61              See also: mknod(2), stat(2)
62
63       div_t
64              Include: <stdlib.h>.
65
66              typedef struct {
67                  int quot; /* Quotient */
68                  int rem;  /* Remainder */
69              } div_t;
70
71              It is the type of the value returned by the div(3) function.
72
73              Conforming to: C99 and later; POSIX.1-2001 and later.
74
75              See also: div(3)
76
77       double_t
78              Include: <math.h>.
79
80              The  implementation's  most  efficient floating type at least as
81              wide as double.  Its type depends on  the  value  of  the  macro
82              FLT_EVAL_METHOD (defined in <float.h>):
83
84              0      double_t is double.
85
86              1      double_t is double.
87
88              2      double_t is long double.
89
90              For other values of FLT_EVAL_METHOD, the type of double_t is im‐
91              plementation-defined.
92
93              Conforming to: C99 and later; POSIX.1-2001 and later.
94
95              See also: the float_t type in this page.
96
97       fd_set
98              Include: <sys/select.h>.  Alternatively, <sys/time.h>.
99
100              A structure type that can represent a set of  file  descriptors.
101              According to POSIX, the maximum number of file descriptors in an
102              fd_set structure is the value of the macro FD_SETSIZE.
103
104              Conforming to: POSIX.1-2001 and later.
105
106              See also: select(2)
107
108       fenv_t
109              Include: <fenv.h>.
110
111              This type represents the entire floating-point environment,  in‐
112              cluding control modes and status flags; for further details, see
113              fenv(3).
114
115              Conforming to: C99 and later; POSIX.1-2001 and later.
116
117              See also: fenv(3)
118
119       fexcept_t
120              Include: <fenv.h>.
121
122              This type represents the  floating-point  status  flags  collec‐
123              tively; for further details see fenv(3).
124
125              Conforming to: C99 and later; POSIX.1-2001 and later.
126
127              See also: fenv(3)
128
129       FILE
130              Include: <stdio.h>.  Alternatively, <wchar.h>.
131
132              An object type used for streams.
133
134              Conforming to: C99 and later; POSIX.1-2001 and later.
135
136              See   also:   fclose(3),   flockfile(3),  fopen(3),  fprintf(3),
137              fread(3), fscanf(3), stdin(3), stdio(3)
138
139       float_t
140              Include: <math.h>.
141
142              The implementation's most efficient floating type  at  least  as
143              wide  as  float.   Its  type  depends  on the value of the macro
144              FLT_EVAL_METHOD (defined in <float.h>):
145
146              0      float_t is float.
147
148              1      float_t is double.
149
150              2      float_t is long double.
151
152              For other values of FLT_EVAL_METHOD, the type of float_t is  im‐
153              plementation-defined.
154
155              Conforming to: C99 and later; POSIX.1-2001 and later.
156
157              See also: the double_t type in this page.
158
159       gid_t
160              Include:  <sys/types.h>.  Alternatively, <grp.h>, <pwd.h>, <sig‐
161              nal.h>, <stropts.h>, <sys/ipc.h>, <sys/stat.h>, or <unistd.h>.
162
163              A type used to hold group IDs.  According to POSIX,  this  shall
164              be an integer type.
165
166              Conforming to: POSIX.1-2001 and later.
167
168              See also: chown(2), getgid(2), getegid(2), getgroups(2), getres‐
169              gid(2), getgrnam(2), credentials(7)
170
171       id_t
172              Include: <sys/types.h>.  Alternatively, <sys/resource.h>.
173
174              A type used to hold a general identifier.  According  to  POSIX,
175              this  shall  be  an  integer  type that can be used to contain a
176              pid_t, uid_t, or gid_t.
177
178              Conforming to: POSIX.1-2001 and later.
179
180              See also: getpriority(2), waitid(2)
181
182       imaxdiv_t
183              Include: <inttypes.h>.
184
185              typedef struct {
186                  intmax_t    quot; /* Quotient */
187                  intmax_t    rem;  /* Remainder */
188              } imaxdiv_t;
189
190              It is the type of the value returned by the imaxdiv(3) function.
191
192              Conforming to: C99 and later; POSIX.1-2001 and later.
193
194              See also: imaxdiv(3)
195
196       intmax_t
197              Include: <stdint.h>.  Alternatively, <inttypes.h>.
198
199              A signed integer type capable of representing any value  of  any
200              signed  integer type supported by the implementation.  According
201              to the C language standard, it shall be capable of storing  val‐
202              ues in the range [INTMAX_MIN, INTMAX_MAX].
203
204              The macro INTMAX_C() expands its argument to an integer constant
205              of type intmax_t.
206
207              The length modifier for  intmax_t  for  the  printf(3)  and  the
208              scanf(3)  families  of functions is j; resulting commonly in %jd
209              or %ji for printing intmax_t values.
210
211              Conforming to: C99 and later; POSIX.1-2001 and later.
212
213              Bugs: intmax_t is not large enough to represent values  of  type
214              __int128  in  implementations where __int128 is defined and long
215              long is less than 128 bits wide.
216
217              See also: the uintmax_t type in this page.
218
219       intN_t
220              Include: <stdint.h>.  Alternatively, <inttypes.h>.
221
222              int8_t, int16_t, int32_t, int64_t
223
224              A signed integer type of a fixed width of exactly N bits, N  be‐
225              ing  the  value  specified in its type name.  According to the C
226              language standard, they shall be capable of  storing  values  in
227              the  range [INTN_MIN, INTN_MAX], substituting N by the appropri‐
228              ate number.
229
230              According to POSIX, int8_t, int16_t, and int32_t  are  required;
231              int64_t is only required in implementations that provide integer
232              types with width 64; and all other types of this  form  are  op‐
233              tional.
234
235              The length modifiers for the intN_t types for the printf(3) fam‐
236              ily of functions are expanded by macros of the forms  PRIdN  and
237              PRIiN  (defined  in  <inttypes.h>);  resulting  for  example  in
238              %"PRId64" or %"PRIi64" for printing int64_t values.  The  length
239              modifiers  for the intN_t types for the scanf(3) family of func‐
240              tions are expanded by macros of the forms SCNdN and SCNiN,  (de‐
241              fined  in  <inttypes.h>);  resulting  for example in %"SCNd8" or
242              %"SCNi8" for scanning int8_t values.
243
244              Conforming to: C99 and later; POSIX.1-2001 and later.
245
246              See also: the intmax_t, uintN_t, and  uintmax_t  types  in  this
247              page.
248
249       intptr_t
250              Include: <stdint.h>.  Alternatively, <inttypes.h>.
251
252              A  signed integer type such that any valid (void *) value can be
253              converted to this type and back.  According to  the  C  language
254              standard,  it  shall  be  capable of storing values in the range
255              [INTPTR_MIN, INTPTR_MAX].
256
257              The length modifier for intptr_t for  the  printf(3)  family  of
258              functions is expanded by the macros PRIdPTR and PRIiPTR (defined
259              in <inttypes.h>); resulting commonly in %"PRIdPTR" or %"PRIiPTR"
260              for  printing intptr_t values.  The length modifier for intptr_t
261              for the scanf(3) family of functions is expanded by  the  macros
262              SCNdPTR  and  SCNiPTR, (defined in <inttypes.h>); resulting com‐
263              monly in %"SCNdPTR" or %"SCNiPTR" for scanning intptr_t values.
264
265              Conforming to: C99 and later; POSIX.1-2001 and later.
266
267              See also: the uintptr_t and void * types in this page.
268
269       lconv
270              Include: <locale.h>.
271
272              struct lconv {                  /* Values in the "C" locale: */
273                  char   *decimal_point;      /* "." */
274                  char   *thousands_sep;      /* "" */
275                  char   *grouping;           /* "" */
276                  char   *mon_decimal_point;  /* "" */
277                  char   *mon_thousands_sep;  /* "" */
278                  char   *mon_grouping;       /* "" */
279                  char   *positive_sign;      /* "" */
280                  char   *negative_sign;      /* "" */
281                  char   *currency_symbol;    /* "" */
282                  char    frac_digits;        /* CHAR_MAX */
283                  char    p_cs_precedes;      /* CHAR_MAX */
284                  char    n_cs_precedes;      /* CHAR_MAX */
285                  char    p_sep_by_space;     /* CHAR_MAX */
286                  char    n_sep_by_space;     /* CHAR_MAX */
287                  char    p_sign_posn;        /* CHAR_MAX */
288                  char    n_sign_posn;        /* CHAR_MAX */
289                  char   *int_curr_symbol;    /* "" */
290                  char    int_frac_digits;    /* CHAR_MAX */
291                  char    int_p_cs_precedes;  /* CHAR_MAX */
292                  char    int_n_cs_precedes;  /* CHAR_MAX */
293                  char    int_p_sep_by_space; /* CHAR_MAX */
294                  char    int_n_sep_by_space; /* CHAR_MAX */
295                  char    int_p_sign_posn;    /* CHAR_MAX */
296                  char    int_n_sign_posn;    /* CHAR_MAX */
297              };
298
299              Contains members related to the formatting  of  numeric  values.
300              In the "C" locale, its members have the values shown in the com‐
301              ments above.
302
303              Conforming to: C11 and later; POSIX.1-2001 and later.
304
305              See also: setlocale(3), localeconv(3), charsets(5), locale(7)
306
307       ldiv_t
308              Include: <stdlib.h>.
309
310              typedef struct {
311                  long    quot; /* Quotient */
312                  long    rem;  /* Remainder */
313              } ldiv_t;
314
315              It is the type of the value returned by the ldiv(3) function.
316
317              Conforming to: C99 and later; POSIX.1-2001 and later.
318
319              See also: ldiv(3)
320
321       lldiv_t
322              Include: <stdlib.h>.
323
324              typedef struct {
325                  long long   quot; /* Quotient */
326                  long long   rem;  /* Remainder */
327              } lldiv_t;
328
329              It is the type of the value returned by the lldiv(3) function.
330
331              Conforming to: C99 and later; POSIX.1-2001 and later.
332
333              See also: lldiv(3)
334
335       off_t
336              Include:  <sys/types.h>.   Alternatively,  <aio.h>,   <fcntl.h>,
337              <stdio.h>, <sys/mman.h>, <sys/stat.h.h>, or <unistd.h>.
338
339              Used for file sizes.  According to POSIX, this shall be a signed
340              integer type.
341
342              Versions: <aio.h> and <stdio.h> define off_t since POSIX.1-2008.
343
344              Conforming to: POSIX.1-2001 and later.
345
346              Notes: On some architectures, the width of this type can be con‐
347              trolled with the feature test macro _FILE_OFFSET_BITS.
348
349              See  also:  lseek(2), mmap(2), posix_fadvise(2), pread(2), trun‐
350              cate(2),   fseeko(3),   lockf(3),    posix_fallocate(3),    fea‐
351              ture_test_macros(7)
352
353       pid_t
354              Include:  <sys/types.h>.   Alternatively,  <fcntl.h>, <sched.h>,
355              <signal.h>, <spawn.h>,  <sys/msg.h>,  <sys/sem.h>,  <sys/shm.h>,
356              <sys/wait.h>, <termios.h>, <time.h>, <unistd.h>, or <utmpx.h>.
357
358              This  type  is  used for storing process IDs, process group IDs,
359              and session IDs.  According to POSIX, it shall be a signed inte‐
360              ger  type, and the implementation shall support one or more pro‐
361              gramming environments where the width of  pid_t  is  no  greater
362              than the width of the type long.
363
364              Conforming to: POSIX.1-2001 and later.
365
366              See  also: fork(2), getpid(2), getppid(2), getsid(2), gettid(2),
367              getpgid(2), kill(2), pidfd_open(2), sched_setscheduler(2), wait‐
368              pid(2), sigqueue(3), credentials(7),
369
370       ptrdiff_t
371              Include: <stddef.h>.
372
373              Used  for a count of elements, and array indices.  It is the re‐
374              sult of subtracting two pointers.  According to the  C  language
375              standard,  it  shall be a signed integer type capable of storing
376              values in the range [PTRDIFF_MIN, PTRDIFF_MAX].
377
378              The length modifier for ptrdiff_t  for  the  printf(3)  and  the
379              scanf(3)  families  of functions is t; resulting commonly in %td
380              or %ti for printing ptrdiff_t values.
381
382              Conforming to: C99 and later; POSIX.1-2001 and later.
383
384              See also: the size_t and ssize_t types in this page.
385
386       regex_t
387              Include: <regex.h>.
388
389              typedef struct {
390                  size_t  re_nsub; /* Number of parenthesized subexpressions. */
391              } regex_t;
392
393              This is a structure type used in  regular  expression  matching.
394              It  holds  a  compiled  regular  expression,  compiled with reg‐
395              comp(3).
396
397              Conforming to: POSIX.1-2001 and later.
398
399              See also: regex(3)
400
401       regmatch_t
402              Include: <regex.h>.
403
404              typedef struct {
405                  regoff_t    rm_so; /* Byte offset from start of string
406                                        to start of substring */
407                  regoff_t    rm_eo; /* Byte offset from start of string of
408                                        the first character after the end of
409                                        substring */
410              } regmatch_t;
411
412              This is a structure type used in regular expression matching.
413
414              Conforming to: POSIX.1-2001 and later.
415
416              See also: regexec(3)
417
418       regoff_t
419              Include: <regex.h>.
420
421              According to POSIX, it shall be a signed integer type capable of
422              storing  the  largest  value  that  can  be  stored  in either a
423              ptrdiff_t type or a ssize_t type.
424
425              Versions: Prior to POSIX.1-2008, the type was capable of storing
426              the  largest value that can be stored in either an off_t type or
427              a ssize_t type.
428
429              Conforming to: POSIX.1-2001 and later.
430
431              See also: the regmatch_t structure and the ptrdiff_t and ssize_t
432              types in this page.
433
434       sigevent
435              Include:  <signal.h>.   Alternatively,  <aio.h>,  <mqueue.h>, or
436              <time.h>.
437
438              struct sigevent {
439                  int             sigev_notify; /* Notification type */
440                  int             sigev_signo;  /* Signal number */
441                  union sigval    sigev_value;  /* Signal value */
442                  void          (*sigev_notify_function)(union sigval);
443                                                /* Notification function */
444                  pthread_attr_t *sigev_notify_attributes;
445                                                /* Notification attributes */
446              };
447
448              For further details about this type, see sigevent(7).
449
450              Versions:   <aio.h>   and   <time.h>   define   sigevent   since
451              POSIX.1-2008.
452
453              Conforming to: POSIX.1-2001 and later.
454
455              See   also:  timer_create(2),  getaddrinfo_a(3),  lio_listio(3),
456              mq_notify(3)
457
458              See also the aiocb structure in this page.
459
460       siginfo_t
461              Include: <signal.h>.  Alternatively, <sys/wait.h>.
462
463              typedef struct {
464                  int      si_signo;  /* Signal number */
465                  int      si_code;   /* Signal code */
466                  pid_t    si_pid;    /* Sending process ID */
467                  uid_t    si_uid;    /* Real user ID of sending process */
468                  void    *si_addr;   /* Address of faulting instruction */
469                  int      si_status; /* Exit value or signal */
470                  union sigval si_value;  /* Signal value */
471              } siginfo_t;
472
473              Information associated with a signal.  For  further  details  on
474              this  structure  (including  additional, Linux-specific fields),
475              see sigaction(2).
476
477              Conforming to: POSIX.1-2001 and later.
478
479              See  also:  pidfd_send_signal(2),   rt_sigqueueinfo(2),   sigac‐
480              tion(2), sigwaitinfo(2), psiginfo(3)
481
482       sigset_t
483              Include:  <signal.h>.   Alternatively,  <spawn.h>,  or  <sys/se‐
484              lect.h>.
485
486              This is a type that represents a set of signals.   According  to
487              POSIX, this shall be an integer or structure type.
488
489              Conforming to: POSIX.1-2001 and later.
490
491              See  also:  epoll_pwait(2),  ppoll(2), pselect(2), sigaction(2),
492              signalfd(2), sigpending(2), sigprocmask(2), sigsuspend(2),  sig‐
493              waitinfo(2), signal(7)
494
495       sigval
496              Include: <signal.h>.
497
498              union sigval {
499                  int     sigval_int; /* Integer value */
500                  void   *sigval_ptr; /* Pointer value */
501              };
502
503              Data passed with a signal.
504
505              Conforming to: POSIX.1-2001 and later.
506
507              See also: pthread_sigqueue(3), sigqueue(3), sigevent(7)
508
509              See  also  the sigevent structure and the siginfo_t type in this
510              page.
511
512       size_t
513              Include: <stddef.h> or <sys/types.h>.   Alternatively,  <aio.h>,
514              <glob.h>,    <grp.h>,   <iconv.h>,   <monetary.h>,   <mqueue.h>,
515              <ndbm.h>, <pwd.h>, <regex.h>, <search.h>, <signal.h>, <stdio.h>,
516              <stdlib.h>,  <string.h>, <strings.h>, <sys/mman.h>, <sys/msg.h>,
517              <sys/sem.h>, <sys/shm.h>, <sys/socket.h>, <sys/uio.h>, <time.h>,
518              <unistd.h>, <wchar.h>, or <wordexp.h>.
519
520              Used for a count of bytes.  It is the result of the sizeof oper‐
521              ator.  According to the C language standard, it shall be an  un‐
522              signed  integer  type capable of storing values in the range [0,
523              SIZE_MAX].  According to POSIX, the implementation shall support
524              one  or  more programming environments where the width of size_t
525              is no greater than the width of the type long.
526
527              The length  modifier  for  size_t  for  the  printf(3)  and  the
528              scanf(3)  families  of functions is z; resulting commonly in %zu
529              or %zx for printing size_t values.
530
531              Versions: <aio.h>,  <glob.h>,  <grp.h>,  <iconv.h>,  <mqueue.h>,
532              <pwd.h>,  <signal.h>,  and  <sys/socket.h>  define  size_t since
533              POSIX.1-2008.
534
535              Conforming to: C99 and later; POSIX.1-2001 and later.
536
537              See also: read(2),  write(2),  fread(3),  fwrite(3),  memcmp(3),
538              memcpy(3), memset(3), offsetof(3)
539
540              See also the ptrdiff_t and ssize_t types in this page.
541
542       ssize_t
543              Include:  <sys/types.h>.   Alternatively, <aio.h>, <monetary.h>,
544              <mqueue.h>, <stdio.h>, <sys/msg.h>, <sys/socket.h>, <sys/uio.h>,
545              or <unistd.h>.
546
547              Used  for a count of bytes or an error indication.  According to
548              POSIX, it shall be a signed integer type capable of storing val‐
549              ues  at  least in the range [-1, SSIZE_MAX], and the implementa‐
550              tion shall support one or more  programming  environments  where
551              the  width  of  ssize_t is no greater than the width of the type
552              long.
553
554              Glibc and most other implementations provide a  length  modifier
555              for ssize_t for the printf(3) and the scanf(3) families of func‐
556              tions, which is z; resulting commonly in %zd or %zi for printing
557              ssize_t  values.  Although z works for ssize_t on most implemen‐
558              tations, portable POSIX programs should avoid using it—for exam‐
559              ple,  by  converting  the value to intmax_t and using its length
560              modifier (j).
561
562              Conforming to: POSIX.1-2001 and later.
563
564              See also:  read(2),  readlink(2),  readv(2),  recv(2),  send(2),
565              write(2)
566
567              See also the ptrdiff_t and size_t types in this page.
568
569       suseconds_t
570              Include:   <sys/types.h>.    Alternatively,  <sys/select.h>,  or
571              <sys/time.h>.
572
573              Used for time in microseconds.  According to POSIX, it shall  be
574              a  signed integer type capable of storing values at least in the
575              range [-1, 1000000], and the implementation shall support one or
576              more  programming environments where the width of suseconds_t is
577              no greater than the width of the type long.
578
579              Conforming to: POSIX.1-2001 and later.
580
581              See also: the timeval structure in this page.
582
583       time_t
584              Include: <time.h> or <sys/types.h>.   Alternatively,  <sched.h>,
585              <sys/msg.h>,     <sys/select.h>,    <sys/sem.h>,    <sys/shm.h>,
586              <sys/stat.h>, <sys/time.h>, or <utime.h>.
587
588              Used for time in seconds.  According to POSIX, it  shall  be  an
589              integer type.
590
591              Versions: <sched.h> defines time_t since POSIX.1-2008.
592
593              Conforming to: C99 and later; POSIX.1-2001 and later.
594
595              See also: stime(2), time(2), ctime(3), difftime(3)
596
597       timer_t
598              Include: <sys/types.h>.  Alternatively, <time.h>.
599
600              Used  for  timer  ID  returned by timer_create(2).  According to
601              POSIX, there are no defined comparison or  assignment  operators
602              for this type.
603
604              Conforming to: POSIX.1-2001 and later.
605
606              See also: timer_create(2), timer_delete(2), timer_getoverrun(2),
607              timer_settime(2)
608
609       timespec
610              Include:   <time.h>.    Alternatively,   <aio.h>,    <mqueue.h>,
611              <sched.h>, <signal.h>, <sys/select.h>, or <sys/stat.h>.
612
613              struct timespec {
614                  time_t  tv_sec;  /* Seconds */
615                  long    tv_nsec; /* Nanoseconds */
616              };
617
618              Describes times in seconds and nanoseconds.
619
620              Conforming to: C11 and later; POSIX.1-2001 and later.
621
622              See  also:  clock_gettime(2),  clock_nanosleep(2), nanosleep(2),
623              timerfd_gettime(2), timer_gettime(2)
624
625       timeval
626              Include:   <sys/time.h>.     Alternatively,    <sys/resource.h>,
627              <sys/select.h>, or <utmpx.h>.
628
629              struct timeval {
630                  time_t      tv_sec;  /* Seconds */
631                  suseconds_t tv_usec; /* Microseconds */
632              };
633
634              Describes times in seconds and microseconds.
635
636              Conforming to: POSIX.1-2001 and later.
637
638              See also: gettimeofday(2), select(2), utimes(2), adjtime(3), fu‐
639              times(3), timeradd(3)
640
641       uid_t
642              Include:  <sys/types.h>.   Alternatively,  <pwd.h>,  <signal.h>,
643              <stropts.h>, <sys/ipc.h>, <sys/stat.h>, or <unistd.h>.
644
645              A type used to hold user IDs.  According to POSIX, this shall be
646              an integer type.
647
648              Conforming to: POSIX.1-2001 and later.
649
650              See also: chown(2), getuid(2), geteuid(2), getresuid(2),  getpw‐
651              nam(2), credentials(7)
652
653       uintmax_t
654              Include: <stdint.h>.  Alternatively, <inttypes.h>.
655
656              An  unsigned  integer  type capable of representing any value of
657              any unsigned integer type supported by the implementation.   Ac‐
658              cording to the C language standard, it shall be capable of stor‐
659              ing values in the range [0, UINTMAX_MAX].
660
661              The macro UINTMAX_C() expands its argument to  an  integer  con‐
662              stant of type uintmax_t.
663
664              The  length  modifier  for  uintmax_t  for the printf(3) and the
665              scanf(3) families of functions is j; resulting commonly  in  %ju
666              or %jx for printing uintmax_t values.
667
668              Conforming to: C99 and later; POSIX.1-2001 and later.
669
670              Bugs:  uintmax_t is not large enough to represent values of type
671              unsigned __int128 in implementations where unsigned __int128  is
672              defined and unsigned long long is less than 128 bits wide.
673
674              See also: the intmax_t type in this page.
675
676       uintN_t
677              Include: <stdint.h>.  Alternatively, <inttypes.h>.
678
679              uint8_t, uint16_t, uint32_t, uint64_t
680
681              An  unsigned  integer type of a fixed width of exactly N bits, N
682              being the value specified in its type name.  According to the  C
683              language  standard,  they  shall be capable of storing values in
684              the range [0, UINTN_MAX], substituting N by the appropriate num‐
685              ber.
686
687              According  to  POSIX,  uint8_t,  uint16_t,  and uint32_t are re‐
688              quired; uint64_t is only required in implementations  that  pro‐
689              vide  integer  types  with width 64; and all other types of this
690              form are optional.
691
692              The length modifiers for the uintN_t  types  for  the  printf(3)
693              family  of  functions are expanded by macros of the forms PRIuN,
694              PRIoN, PRIxN, and PRIXN (defined in <inttypes.h>); resulting for
695              example  in %"PRIu32" or %"PRIx32" for printing uint32_t values.
696              The length modifiers for the uintN_t types for the scanf(3) fam‐
697              ily  of functions are expanded by macros of the forms SCNuN, SC‐
698              NoN, SCNxN, and SCNXN (defined in <inttypes.h>);  resulting  for
699              example in %"SCNu16" or %"SCNx16" for scanning uint16_t values.
700
701              Conforming to: C99 and later; POSIX.1-2001 and later.
702
703              See  also:  the  intmax_t,  intN_t,  and uintmax_t types in this
704              page.
705
706       uintptr_t
707              Include: <stdint.h>.  Alternatively, <inttypes.h>.
708
709              An unsigned integer type such that any valid (void *) value  can
710              be converted to this type and back.  According to the C language
711              standard, it shall be capable of storing values in the range [0,
712              UINTPTR_MAX].
713
714              The  length  modifier  for uintptr_t for the printf(3) family of
715              functions is expanded by the macros PRIuPTR,  PRIoPTR,  PRIxPTR,
716              and  PRIXPTR  (defined  in  <inttypes.h>); resulting commonly in
717              %"PRIuPTR" or %"PRIxPTR" for  printing  uintptr_t  values.   The
718              length  modifier  for uintptr_t for the scanf(3) family of func‐
719              tions is expanded by the macros SCNuPTR, SCNoPTR,  SCNxPTR,  and
720              SCNXPTR  (defined  in <inttypes.h>); resulting commonly in %"SC‐
721              NuPTR" or %"SCNxPTR" for scanning uintptr_t values.
722
723              Conforming to: C99 and later; POSIX.1-2001 and later.
724
725              See also: the intptr_t and void * types in this page.
726
727       va_list
728              Include: <stdarg>.  Alternatively, <stdio.h>, or <wchar.h>.
729
730              Used by functions with a varying number of arguments of  varying
731              types.   The  function  must  declare  an object of type va_list
732              which is used by the macros va_start(3), va_arg(3),  va_copy(3),
733              and va_end(3) to traverse the list of arguments.
734
735              Conforming to: C99 and later; POSIX.1-2001 and later.
736
737              See also: va_start(3), va_arg(3), va_copy(3), va_end(3)
738
739       void *
740              According  to  the  C language standard, a pointer to any object
741              type may be converted to a pointer to void and back.  POSIX fur‐
742              ther requires that any pointer, including pointers to functions,
743              may be converted to a pointer to void and back.
744
745              Conversions from and to any other pointer type are done  implic‐
746              itly,  not  requiring casts at all.  Note that this feature pre‐
747              vents any kind of type checking: the programmer should be  care‐
748              ful not to convert a void * value to a type incompatible to that
749              of the underlying data, because that would result  in  undefined
750              behavior.
751
752              This  type  is useful in function parameters and return value to
753              allow passing values of any type.  The function  will  typically
754              use  some  mechanism  to  know  the  real type of the data being
755              passed via a pointer to void.
756
757              A value of this type can't be dereferenced, as it would  give  a
758              value  of  type  void, which is not possible.  Likewise, pointer
759              arithmetic is not possible with this type.  However, in  GNU  C,
760              pointer  arithmetic  is allowed as an extension to the standard;
761              this is done by treating the size of a void or of a function  as
762              1.  A consequence of this is that sizeof is also allowed on void
763              and on function types, and returns 1.
764
765              The conversion specifier for void * for the  printf(3)  and  the
766              scanf(3) families of functions is p.
767
768              Versions: The POSIX requirement about compatibility between void
769              * and function pointers was added in POSIX.1-2008 Technical Cor‐
770              rigendum 1 (2013).
771
772              Conforming to: C99 and later; POSIX.1-2001 and later.
773
774              See also: malloc(3), memcmp(3), memcpy(3), memset(3)
775
776              See also the intptr_t and uintptr_t types in this page.
777

NOTES

779       The  structures  described in this manual page shall contain, at least,
780       the members shown in their definition, in no particular order.
781
782       Most of the integer types described in this page don't  have  a  corre‐
783       sponding length modifier for the printf(3) and the scanf(3) families of
784       functions.  To print a value of an integer type  that  doesn't  have  a
785       length  modifier, it should be converted to intmax_t or uintmax_t by an
786       explicit cast.  To scan into a variable of an integer type that doesn't
787       have a length modifier, an intermediate temporary variable of type int‐
788       max_t or uintmax_t should be used.  When  copying  from  the  temporary
789       variable to the destination variable, the value could overflow.  If the
790       type has upper and lower limits, the user should check that  the  value
791       is within those limits, before actually copying the value.  The example
792       below shows how these conversions should be done.
793
794   Conventions used in this page
795       In "Conforming to" we only concern ourselves with  C99  and  later  and
796       POSIX.1-2001  and  later.   Some types may be specified in earlier ver‐
797       sions of one of these standards, but in the interests of simplicity  we
798       omit details from earlier standards.
799
800       In  "Include",  we  first  note the "primary" header(s) that define the
801       type according to either the C or POSIX.1 standards.   Under  "Alterna‐
802       tively",  we  note  additional headers that the standards specify shall
803       define the type.
804

EXAMPLES

806       The program shown below scans from a string and prints a  value  stored
807       in  a  variable of an integer type that doesn't have a length modifier.
808       The appropriate conversions from and to intmax_t, and  the  appropriate
809       range checks, are used as explained in the notes section above.
810
811       #include <stdint.h>
812       #include <stdio.h>
813       #include <stdlib.h>
814       #include <sys/types.h>
815
816       int
817       main (void)
818       {
819           static const char *const str = "500000 us in half a second";
820           suseconds_t us;
821           intmax_t    tmp;
822
823           /* Scan the number from the string into the temporary variable */
824
825           sscanf(str, "%jd", &tmp);
826
827           /* Check that the value is within the valid range of suseconds_t */
828
829           if (tmp < -1 || tmp > 1000000) {
830               fprintf(stderr, "Scanned value outside valid range!\n");
831               exit(EXIT_FAILURE);
832           }
833
834           /* Copy the value to the suseconds_t variable 'us' */
835
836           us = tmp;
837
838           /* Even though suseconds_t can hold the value -1, this isn't
839              a sensible number of microseconds */
840
841           if (us < 0) {
842               fprintf(stderr, "Scanned value shouldn't be negative!\n");
843               exit(EXIT_FAILURE);
844           }
845
846           /* Print the value */
847
848           printf("There are %jd microseconds in half a second.\n",
849                   (intmax_t) us);
850
851           exit(EXIT_SUCCESS);
852       }
853

SEE ALSO

855       feature_test_macros(7), standards(7)
856

COLOPHON

858       This  page  is  part of release 5.10 of the Linux man-pages project.  A
859       description of the project, information about reporting bugs,  and  the
860       latest     version     of     this    page,    can    be    found    at
861       https://www.kernel.org/doc/man-pages/.
862
863
864
865Linux                             2020-12-21              SYSTEM_DATA_TYPES(7)
Impressum