1SYSTEM_DATA_TYPES(7) Linux Programmer's Manual SYSTEM_DATA_TYPES(7)
2
3
4
6 system_data_types - overview of system data types
7
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 blkcnt_t
31 Include: <sys/types.h>. Alternatively, <sys/stat.h>.
32
33 Used for file block counts. According to POSIX, it shall be a
34 signed integer type.
35
36 Conforming to: POSIX.1-2001 and later.
37
38 See also: stat(2)
39
40 blksize_t
41 Include: <sys/types.h>. Alternatively, <sys/stat.h>.
42
43 Used for file block sizes. According to POSIX, it shall be a
44 signed integer type.
45
46 Conforming to: POSIX.1-2001 and later.
47
48 See also: stat(2)
49
50 cc_t
51 Include: <termios.h>.
52
53 Used for terminal special characters. According to POSIX, it
54 shall be an unsigned integer type.
55
56 Conforming to: POSIX.1-2001 and later.
57
58 See also: termios(3)
59
60 clock_t
61 Include: <time.h> or <sys/types.h>. Alternatively,
62 <sys/time.h>.
63
64 Used for system time in clock ticks or CLOCKS_PER_SEC (defined
65 in <time.h>). According to POSIX, it shall be an integer type
66 or a real-floating type.
67
68 Conforming to: C99 and later; POSIX.1-2001 and later.
69
70 See also: times(2), clock(3)
71
72 clockid_t
73 Include: <sys/types.h>. Alternatively, <time.h>.
74
75 Used for clock ID type in the clock and timer functions. Ac‐
76 cording to POSIX, it shall be defined as an arithmetic type.
77
78 Conforming to: POSIX.1-2001 and later.
79
80 See also: clock_adjtime(2), clock_getres(2), clock_nanosleep(2),
81 timer_create(2), clock_getcpuclockid(3)
82
83 dev_t
84 Include: <sys/types.h>. Alternatively, <sys/stat.h>.
85
86 Used for device IDs. According to POSIX, it shall be an integer
87 type. For further details of this type, see makedev(3).
88
89 Conforming to: POSIX.1-2001 and later.
90
91 See also: mknod(2), stat(2)
92
93 div_t
94 Include: <stdlib.h>.
95
96 typedef struct {
97 int quot; /* Quotient */
98 int rem; /* Remainder */
99 } div_t;
100
101 It is the type of the value returned by the div(3) function.
102
103 Conforming to: C99 and later; POSIX.1-2001 and later.
104
105 See also: div(3)
106
107 double_t
108 Include: <math.h>.
109
110 The implementation's most efficient floating type at least as
111 wide as double. Its type depends on the value of the macro
112 FLT_EVAL_METHOD (defined in <float.h>):
113
114 0 double_t is double.
115
116 1 double_t is double.
117
118 2 double_t is long double.
119
120 For other values of FLT_EVAL_METHOD, the type of double_t is im‐
121 plementation-defined.
122
123 Conforming to: C99 and later; POSIX.1-2001 and later.
124
125 See also: the float_t type in this page.
126
127 fd_set
128 Include: <sys/select.h>. Alternatively, <sys/time.h>.
129
130 A structure type that can represent a set of file descriptors.
131 According to POSIX, the maximum number of file descriptors in an
132 fd_set structure is the value of the macro FD_SETSIZE.
133
134 Conforming to: POSIX.1-2001 and later.
135
136 See also: select(2)
137
138 fenv_t
139 Include: <fenv.h>.
140
141 This type represents the entire floating-point environment, in‐
142 cluding control modes and status flags; for further details, see
143 fenv(3).
144
145 Conforming to: C99 and later; POSIX.1-2001 and later.
146
147 See also: fenv(3)
148
149 fexcept_t
150 Include: <fenv.h>.
151
152 This type represents the floating-point status flags collec‐
153 tively; for further details see fenv(3).
154
155 Conforming to: C99 and later; POSIX.1-2001 and later.
156
157 See also: fenv(3)
158
159 FILE
160 Include: <stdio.h>. Alternatively, <wchar.h>.
161
162 An object type used for streams.
163
164 Conforming to: C99 and later; POSIX.1-2001 and later.
165
166 See also: fclose(3), flockfile(3), fopen(3), fprintf(3),
167 fread(3), fscanf(3), stdin(3), stdio(3)
168
169 float_t
170 Include: <math.h>.
171
172 The implementation's most efficient floating type at least as
173 wide as float. Its type depends on the value of the macro
174 FLT_EVAL_METHOD (defined in <float.h>):
175
176 0 float_t is float.
177
178 1 float_t is double.
179
180 2 float_t is long double.
181
182 For other values of FLT_EVAL_METHOD, the type of float_t is im‐
183 plementation-defined.
184
185 Conforming to: C99 and later; POSIX.1-2001 and later.
186
187 See also: the double_t type in this page.
188
189 gid_t
190 Include: <sys/types.h>. Alternatively, <grp.h>, <pwd.h>, <sig‐
191 nal.h>, <stropts.h>, <sys/ipc.h>, <sys/stat.h>, or <unistd.h>.
192
193 A type used to hold group IDs. According to POSIX, this shall
194 be an integer type.
195
196 Conforming to: POSIX.1-2001 and later.
197
198 See also: chown(2), getgid(2), getegid(2), getgroups(2), getres‐
199 gid(2), getgrnam(3), credentials(7)
200
201 id_t
202 Include: <sys/types.h>. Alternatively, <sys/resource.h>.
203
204 A type used to hold a general identifier. According to POSIX,
205 this shall be an integer type that can be used to contain a
206 pid_t, uid_t, or gid_t.
207
208 Conforming to: POSIX.1-2001 and later.
209
210 See also: getpriority(2), waitid(2)
211
212 imaxdiv_t
213 Include: <inttypes.h>.
214
215 typedef struct {
216 intmax_t quot; /* Quotient */
217 intmax_t rem; /* Remainder */
218 } imaxdiv_t;
219
220 It is the type of the value returned by the imaxdiv(3) function.
221
222 Conforming to: C99 and later; POSIX.1-2001 and later.
223
224 See also: imaxdiv(3)
225
226 intmax_t
227 Include: <stdint.h>. Alternatively, <inttypes.h>.
228
229 A signed integer type capable of representing any value of any
230 signed integer type supported by the implementation. According
231 to the C language standard, it shall be capable of storing val‐
232 ues in the range [INTMAX_MIN, INTMAX_MAX].
233
234 The macro INTMAX_C() expands its argument to an integer constant
235 of type intmax_t.
236
237 The length modifier for intmax_t for the printf(3) and the
238 scanf(3) families of functions is j; resulting commonly in %jd
239 or %ji for printing intmax_t values.
240
241 Conforming to: C99 and later; POSIX.1-2001 and later.
242
243 Bugs: intmax_t is not large enough to represent values of type
244 __int128 in implementations where __int128 is defined and long
245 long is less than 128 bits wide.
246
247 See also: the uintmax_t type in this page.
248
249 intN_t
250 Include: <stdint.h>. Alternatively, <inttypes.h>.
251
252 int8_t, int16_t, int32_t, int64_t
253
254 A signed integer type of a fixed width of exactly N bits, N be‐
255 ing the value specified in its type name. According to the C
256 language standard, they shall be capable of storing values in
257 the range [INTN_MIN, INTN_MAX], substituting N by the appropri‐
258 ate number.
259
260 According to POSIX, int8_t, int16_t, and int32_t are required;
261 int64_t is only required in implementations that provide integer
262 types with width 64; and all other types of this form are op‐
263 tional.
264
265 The length modifiers for the intN_t types for the printf(3) fam‐
266 ily of functions are expanded by macros of the forms PRIdN and
267 PRIiN (defined in <inttypes.h>); resulting for example in
268 %"PRId64" or %"PRIi64" for printing int64_t values. The length
269 modifiers for the intN_t types for the scanf(3) family of func‐
270 tions are expanded by macros of the forms SCNdN and SCNiN, (de‐
271 fined in <inttypes.h>); resulting for example in %"SCNd8" or
272 %"SCNi8" for scanning int8_t values.
273
274 Conforming to: C99 and later; POSIX.1-2001 and later.
275
276 See also: the intmax_t, uintN_t, and uintmax_t types in this
277 page.
278
279 intptr_t
280 Include: <stdint.h>. Alternatively, <inttypes.h>.
281
282 A signed integer type such that any valid (void *) value can be
283 converted to this type and back. According to the C language
284 standard, it shall be capable of storing values in the range
285 [INTPTR_MIN, INTPTR_MAX].
286
287 The length modifier for intptr_t for the printf(3) family of
288 functions is expanded by the macros PRIdPTR and PRIiPTR (defined
289 in <inttypes.h>); resulting commonly in %"PRIdPTR" or %"PRIiPTR"
290 for printing intptr_t values. The length modifier for intptr_t
291 for the scanf(3) family of functions is expanded by the macros
292 SCNdPTR and SCNiPTR, (defined in <inttypes.h>); resulting com‐
293 monly in %"SCNdPTR" or %"SCNiPTR" for scanning intptr_t values.
294
295 Conforming to: C99 and later; POSIX.1-2001 and later.
296
297 See also: the uintptr_t and void * types in this page.
298
299 lconv
300 Include: <locale.h>.
301
302 struct lconv { /* Values in the "C" locale: */
303 char *decimal_point; /* "." */
304 char *thousands_sep; /* "" */
305 char *grouping; /* "" */
306 char *mon_decimal_point; /* "" */
307 char *mon_thousands_sep; /* "" */
308 char *mon_grouping; /* "" */
309 char *positive_sign; /* "" */
310 char *negative_sign; /* "" */
311 char *currency_symbol; /* "" */
312 char frac_digits; /* CHAR_MAX */
313 char p_cs_precedes; /* CHAR_MAX */
314 char n_cs_precedes; /* CHAR_MAX */
315 char p_sep_by_space; /* CHAR_MAX */
316 char n_sep_by_space; /* CHAR_MAX */
317 char p_sign_posn; /* CHAR_MAX */
318 char n_sign_posn; /* CHAR_MAX */
319 char *int_curr_symbol; /* "" */
320 char int_frac_digits; /* CHAR_MAX */
321 char int_p_cs_precedes; /* CHAR_MAX */
322 char int_n_cs_precedes; /* CHAR_MAX */
323 char int_p_sep_by_space; /* CHAR_MAX */
324 char int_n_sep_by_space; /* CHAR_MAX */
325 char int_p_sign_posn; /* CHAR_MAX */
326 char int_n_sign_posn; /* CHAR_MAX */
327 };
328
329 Contains members related to the formatting of numeric values.
330 In the "C" locale, its members have the values shown in the com‐
331 ments above.
332
333 Conforming to: C11 and later; POSIX.1-2001 and later.
334
335 See also: setlocale(3), localeconv(3), charsets(7), locale(7)
336
337 ldiv_t
338 Include: <stdlib.h>.
339
340 typedef struct {
341 long quot; /* Quotient */
342 long rem; /* Remainder */
343 } ldiv_t;
344
345 It is the type of the value returned by the ldiv(3) function.
346
347 Conforming to: C99 and later; POSIX.1-2001 and later.
348
349 See also: ldiv(3)
350
351 lldiv_t
352 Include: <stdlib.h>.
353
354 typedef struct {
355 long long quot; /* Quotient */
356 long long rem; /* Remainder */
357 } lldiv_t;
358
359 It is the type of the value returned by the lldiv(3) function.
360
361 Conforming to: C99 and later; POSIX.1-2001 and later.
362
363 See also: lldiv(3)
364
365 mode_t
366 Include: <sys/types.h>. Alternatively, <fcntl.h>, <ndbm.h>,
367 <spawn.h>, <sys/ipc.h>, <sys/mman.h>, or <sys/stat.h>.
368
369 Used for some file attributes (e.g., file mode). According to
370 POSIX, it shall be an integer type.
371
372 Conforming to: POSIX.1-2001 and later.
373
374 See also: chmod(2), mkdir(2), open(2), stat(2), umask(2)
375
376 off64_t
377 Include: <sys/types.h>.
378
379 Used for file sizes. It is a 64-bit signed integer type.
380
381 Conforming to: Present in glibc. It is not standardized by the
382 C language standard nor POSIX.
383
384 Notes: The feature test macro _LARGEFILE64_SOURCE has to be de‐
385 fined for this type to be available.
386
387 See also: copy_file_range(2), readahead(2), sync_file_range(2),
388 lseek64(3), feature_test_macros(7)
389
390 See also the off_t type in this page.
391
392 off_t
393 Include: <sys/types.h>. Alternatively, <aio.h>, <fcntl.h>,
394 <stdio.h>, <sys/mman.h>, <sys/stat.h.h>, or <unistd.h>.
395
396 Used for file sizes. According to POSIX, this shall be a signed
397 integer type.
398
399 Versions: <aio.h> and <stdio.h> define off_t since POSIX.1-2008.
400
401 Conforming to: POSIX.1-2001 and later.
402
403 Notes: On some architectures, the width of this type can be con‐
404 trolled with the feature test macro _FILE_OFFSET_BITS.
405
406 See also: lseek(2), mmap(2), posix_fadvise(2), pread(2), trun‐
407 cate(2), fseeko(3), lockf(3), posix_fallocate(3), fea‐
408 ture_test_macros(7)
409
410 See also the off64_t type in this page.
411
412 pid_t
413 Include: <sys/types.h>. Alternatively, <fcntl.h>, <sched.h>,
414 <signal.h>, <spawn.h>, <sys/msg.h>, <sys/sem.h>, <sys/shm.h>,
415 <sys/wait.h>, <termios.h>, <time.h>, <unistd.h>, or <utmpx.h>.
416
417 This type is used for storing process IDs, process group IDs,
418 and session IDs. According to POSIX, it shall be a signed inte‐
419 ger type, and the implementation shall support one or more pro‐
420 gramming environments where the width of pid_t is no greater
421 than the width of the type long.
422
423 Conforming to: POSIX.1-2001 and later.
424
425 See also: fork(2), getpid(2), getppid(2), getsid(2), gettid(2),
426 getpgid(2), kill(2), pidfd_open(2), sched_setscheduler(2), wait‐
427 pid(2), sigqueue(3), credentials(7),
428
429 ptrdiff_t
430 Include: <stddef.h>.
431
432 Used for a count of elements, and array indices. It is the re‐
433 sult of subtracting two pointers. According to the C language
434 standard, it shall be a signed integer type capable of storing
435 values in the range [PTRDIFF_MIN, PTRDIFF_MAX].
436
437 The length modifier for ptrdiff_t for the printf(3) and the
438 scanf(3) families of functions is t; resulting commonly in %td
439 or %ti for printing ptrdiff_t values.
440
441 Conforming to: C99 and later; POSIX.1-2001 and later.
442
443 See also: the size_t and ssize_t types in this page.
444
445 regex_t
446 Include: <regex.h>.
447
448 typedef struct {
449 size_t re_nsub; /* Number of parenthesized subexpressions */
450 } regex_t;
451
452 This is a structure type used in regular expression matching.
453 It holds a compiled regular expression, compiled with reg‐
454 comp(3).
455
456 Conforming to: POSIX.1-2001 and later.
457
458 See also: regex(3)
459
460 regmatch_t
461 Include: <regex.h>.
462
463 typedef struct {
464 regoff_t rm_so; /* Byte offset from start of string
465 to start of substring */
466 regoff_t rm_eo; /* Byte offset from start of string of
467 the first character after the end of
468 substring */
469 } regmatch_t;
470
471 This is a structure type used in regular expression matching.
472
473 Conforming to: POSIX.1-2001 and later.
474
475 See also: regexec(3)
476
477 regoff_t
478 Include: <regex.h>.
479
480 According to POSIX, it shall be a signed integer type capable of
481 storing the largest value that can be stored in either a
482 ptrdiff_t type or a ssize_t type.
483
484 Versions: Prior to POSIX.1-2008, the type was capable of storing
485 the largest value that can be stored in either an off_t type or
486 a ssize_t type.
487
488 Conforming to: POSIX.1-2001 and later.
489
490 See also: the regmatch_t structure and the ptrdiff_t and ssize_t
491 types in this page.
492
493 sigevent
494 Include: <signal.h>. Alternatively, <aio.h>, <mqueue.h>, or
495 <time.h>.
496
497 struct sigevent {
498 int sigev_notify; /* Notification type */
499 int sigev_signo; /* Signal number */
500 union sigval sigev_value; /* Signal value */
501 void (*sigev_notify_function)(union sigval);
502 /* Notification function */
503 pthread_attr_t *sigev_notify_attributes;
504 /* Notification attributes */
505 };
506
507 For further details about this type, see sigevent(7).
508
509 Versions: <aio.h> and <time.h> define sigevent since
510 POSIX.1-2008.
511
512 Conforming to: POSIX.1-2001 and later.
513
514 See also: timer_create(2), getaddrinfo_a(3), lio_listio(3),
515 mq_notify(3)
516
517 See also the aiocb structure in this page.
518
519 siginfo_t
520 Include: <signal.h>. Alternatively, <sys/wait.h>.
521
522 typedef struct {
523 int si_signo; /* Signal number */
524 int si_code; /* Signal code */
525 pid_t si_pid; /* Sending process ID */
526 uid_t si_uid; /* Real user ID of sending process */
527 void *si_addr; /* Address of faulting instruction */
528 int si_status; /* Exit value or signal */
529 union sigval si_value; /* Signal value */
530 } siginfo_t;
531
532 Information associated with a signal. For further details on
533 this structure (including additional, Linux-specific fields),
534 see sigaction(2).
535
536 Conforming to: POSIX.1-2001 and later.
537
538 See also: pidfd_send_signal(2), rt_sigqueueinfo(2), sigac‐
539 tion(2), sigwaitinfo(2), psiginfo(3)
540
541 sigset_t
542 Include: <signal.h>. Alternatively, <spawn.h>, or <sys/se‐
543 lect.h>.
544
545 This is a type that represents a set of signals. According to
546 POSIX, this shall be an integer or structure type.
547
548 Conforming to: POSIX.1-2001 and later.
549
550 See also: epoll_pwait(2), ppoll(2), pselect(2), sigaction(2),
551 signalfd(2), sigpending(2), sigprocmask(2), sigsuspend(2), sig‐
552 waitinfo(2), signal(7)
553
554 sigval
555 Include: <signal.h>.
556
557 union sigval {
558 int sigval_int; /* Integer value */
559 void *sigval_ptr; /* Pointer value */
560 };
561
562 Data passed with a signal.
563
564 Conforming to: POSIX.1-2001 and later.
565
566 See also: pthread_sigqueue(3), sigqueue(3), sigevent(7)
567
568 See also the sigevent structure and the siginfo_t type in this
569 page.
570
571 size_t
572 Include: <stddef.h> or <sys/types.h>. Alternatively, <aio.h>,
573 <glob.h>, <grp.h>, <iconv.h>, <monetary.h>, <mqueue.h>,
574 <ndbm.h>, <pwd.h>, <regex.h>, <search.h>, <signal.h>, <stdio.h>,
575 <stdlib.h>, <string.h>, <strings.h>, <sys/mman.h>, <sys/msg.h>,
576 <sys/sem.h>, <sys/shm.h>, <sys/socket.h>, <sys/uio.h>, <time.h>,
577 <unistd.h>, <wchar.h>, or <wordexp.h>.
578
579 Used for a count of bytes. It is the result of the sizeof oper‐
580 ator. According to the C language standard, it shall be an un‐
581 signed integer type capable of storing values in the range [0,
582 SIZE_MAX]. According to POSIX, the implementation shall support
583 one or more programming environments where the width of size_t
584 is no greater than the width of the type long.
585
586 The length modifier for size_t for the printf(3) and the
587 scanf(3) families of functions is z; resulting commonly in %zu
588 or %zx for printing size_t values.
589
590 Versions: <aio.h>, <glob.h>, <grp.h>, <iconv.h>, <mqueue.h>,
591 <pwd.h>, <signal.h>, and <sys/socket.h> define size_t since
592 POSIX.1-2008.
593
594 Conforming to: C99 and later; POSIX.1-2001 and later.
595
596 See also: read(2), write(2), fread(3), fwrite(3), memcmp(3),
597 memcpy(3), memset(3), offsetof(3)
598
599 See also the ptrdiff_t and ssize_t types in this page.
600
601 sockaddr
602 Include: <sys/socket.h>.
603
604 struct sockaddr {
605 sa_family_t sa_family; /* Address family */
606 char sa_data[]; /* Socket address */
607 };
608
609 Describes a socket address.
610
611 Conforming to: POSIX.1-2001 and later.
612
613 See also: accept(2), getpeername(2), getsockname(2), socket(2)
614
615 socklen_t
616 Include: <sys/socket.h>. Alternatively, <netdb.h>.
617
618 Describes the length of a socket address. According to POSIX,
619 this shall be an integer type of at least 32 bits.
620
621 Conforming to: POSIX.1-2001 and later.
622
623 See also: accept(2), bind(2), connect(2), gethostbyaddr(2), get‐
624 nameinfo(2), socket(2)
625
626 See also the sockaddr structure in this page.
627
628 ssize_t
629 Include: <sys/types.h>. Alternatively, <aio.h>, <monetary.h>,
630 <mqueue.h>, <stdio.h>, <sys/msg.h>, <sys/socket.h>, <sys/uio.h>,
631 or <unistd.h>.
632
633 Used for a count of bytes or an error indication. According to
634 POSIX, it shall be a signed integer type capable of storing val‐
635 ues at least in the range [-1, SSIZE_MAX], and the implementa‐
636 tion shall support one or more programming environments where
637 the width of ssize_t is no greater than the width of the type
638 long.
639
640 Glibc and most other implementations provide a length modifier
641 for ssize_t for the printf(3) and the scanf(3) families of func‐
642 tions, which is z; resulting commonly in %zd or %zi for printing
643 ssize_t values. Although z works for ssize_t on most implemen‐
644 tations, portable POSIX programs should avoid using it—for exam‐
645 ple, by converting the value to intmax_t and using its length
646 modifier (j).
647
648 Conforming to: POSIX.1-2001 and later.
649
650 See also: read(2), readlink(2), readv(2), recv(2), send(2),
651 write(2)
652
653 See also the ptrdiff_t and size_t types in this page.
654
655 suseconds_t
656 Include: <sys/types.h>. Alternatively, <sys/select.h>, or
657 <sys/time.h>.
658
659 Used for time in microseconds. According to POSIX, it shall be
660 a signed integer type capable of storing values at least in the
661 range [-1, 1000000], and the implementation shall support one or
662 more programming environments where the width of suseconds_t is
663 no greater than the width of the type long.
664
665 Conforming to: POSIX.1-2001 and later.
666
667 See also: the timeval structure in this page.
668
669 time_t
670 Include: <time.h> or <sys/types.h>. Alternatively, <sched.h>,
671 <sys/msg.h>, <sys/select.h>, <sys/sem.h>, <sys/shm.h>,
672 <sys/stat.h>, <sys/time.h>, or <utime.h>.
673
674 Used for time in seconds. According to POSIX, it shall be an
675 integer type.
676
677 Versions: <sched.h> defines time_t since POSIX.1-2008.
678
679 Conforming to: C99 and later; POSIX.1-2001 and later.
680
681 See also: stime(2), time(2), ctime(3), difftime(3)
682
683 timer_t
684 Include: <sys/types.h>. Alternatively, <time.h>.
685
686 Used for timer ID returned by timer_create(2). According to
687 POSIX, there are no defined comparison or assignment operators
688 for this type.
689
690 Conforming to: POSIX.1-2001 and later.
691
692 See also: timer_create(2), timer_delete(2), timer_getoverrun(2),
693 timer_settime(2)
694
695 timespec
696 Include: <time.h>. Alternatively, <aio.h>, <mqueue.h>,
697 <sched.h>, <signal.h>, <sys/select.h>, or <sys/stat.h>.
698
699 struct timespec {
700 time_t tv_sec; /* Seconds */
701 long tv_nsec; /* Nanoseconds */
702 };
703
704 Describes times in seconds and nanoseconds.
705
706 Conforming to: C11 and later; POSIX.1-2001 and later.
707
708 See also: clock_gettime(2), clock_nanosleep(2), nanosleep(2),
709 timerfd_gettime(2), timer_gettime(2)
710
711 timeval
712 Include: <sys/time.h>. Alternatively, <sys/resource.h>,
713 <sys/select.h>, or <utmpx.h>.
714
715 struct timeval {
716 time_t tv_sec; /* Seconds */
717 suseconds_t tv_usec; /* Microseconds */
718 };
719
720 Describes times in seconds and microseconds.
721
722 Conforming to: POSIX.1-2001 and later.
723
724 See also: gettimeofday(2), select(2), utimes(2), adjtime(3), fu‐
725 times(3), timeradd(3)
726
727 uid_t
728 Include: <sys/types.h>. Alternatively, <pwd.h>, <signal.h>,
729 <stropts.h>, <sys/ipc.h>, <sys/stat.h>, or <unistd.h>.
730
731 A type used to hold user IDs. According to POSIX, this shall be
732 an integer type.
733
734 Conforming to: POSIX.1-2001 and later.
735
736 See also: chown(2), getuid(2), geteuid(2), getresuid(2), getpw‐
737 nam(3), credentials(7)
738
739 uintmax_t
740 Include: <stdint.h>. Alternatively, <inttypes.h>.
741
742 An unsigned integer type capable of representing any value of
743 any unsigned integer type supported by the implementation. Ac‐
744 cording to the C language standard, it shall be capable of stor‐
745 ing values in the range [0, UINTMAX_MAX].
746
747 The macro UINTMAX_C() expands its argument to an integer con‐
748 stant of type uintmax_t.
749
750 The length modifier for uintmax_t for the printf(3) and the
751 scanf(3) families of functions is j; resulting commonly in %ju
752 or %jx for printing uintmax_t values.
753
754 Conforming to: C99 and later; POSIX.1-2001 and later.
755
756 Bugs: uintmax_t is not large enough to represent values of type
757 unsigned __int128 in implementations where unsigned __int128 is
758 defined and unsigned long long is less than 128 bits wide.
759
760 See also: the intmax_t type in this page.
761
762 uintN_t
763 Include: <stdint.h>. Alternatively, <inttypes.h>.
764
765 uint8_t, uint16_t, uint32_t, uint64_t
766
767 An unsigned integer type of a fixed width of exactly N bits, N
768 being the value specified in its type name. According to the C
769 language standard, they shall be capable of storing values in
770 the range [0, UINTN_MAX], substituting N by the appropriate num‐
771 ber.
772
773 According to POSIX, uint8_t, uint16_t, and uint32_t are re‐
774 quired; uint64_t is only required in implementations that pro‐
775 vide integer types with width 64; and all other types of this
776 form are optional.
777
778 The length modifiers for the uintN_t types for the printf(3)
779 family of functions are expanded by macros of the forms PRIuN,
780 PRIoN, PRIxN, and PRIXN (defined in <inttypes.h>); resulting for
781 example in %"PRIu32" or %"PRIx32" for printing uint32_t values.
782 The length modifiers for the uintN_t types for the scanf(3) fam‐
783 ily of functions are expanded by macros of the forms SCNuN, SC‐
784 NoN, SCNxN, and SCNXN (defined in <inttypes.h>); resulting for
785 example in %"SCNu16" or %"SCNx16" for scanning uint16_t values.
786
787 Conforming to: C99 and later; POSIX.1-2001 and later.
788
789 See also: the intmax_t, intN_t, and uintmax_t types in this
790 page.
791
792 uintptr_t
793 Include: <stdint.h>. Alternatively, <inttypes.h>.
794
795 An unsigned integer type such that any valid (void *) value can
796 be converted to this type and back. According to the C language
797 standard, it shall be capable of storing values in the range [0,
798 UINTPTR_MAX].
799
800 The length modifier for uintptr_t for the printf(3) family of
801 functions is expanded by the macros PRIuPTR, PRIoPTR, PRIxPTR,
802 and PRIXPTR (defined in <inttypes.h>); resulting commonly in
803 %"PRIuPTR" or %"PRIxPTR" for printing uintptr_t values. The
804 length modifier for uintptr_t for the scanf(3) family of func‐
805 tions is expanded by the macros SCNuPTR, SCNoPTR, SCNxPTR, and
806 SCNXPTR (defined in <inttypes.h>); resulting commonly in %"SC‐
807 NuPTR" or %"SCNxPTR" for scanning uintptr_t values.
808
809 Conforming to: C99 and later; POSIX.1-2001 and later.
810
811 See also: the intptr_t and void * types in this page.
812
813 va_list
814 Include: <stdarg>. Alternatively, <stdio.h>, or <wchar.h>.
815
816 Used by functions with a varying number of arguments of varying
817 types. The function must declare an object of type va_list
818 which is used by the macros va_start(3), va_arg(3), va_copy(3),
819 and va_end(3) to traverse the list of arguments.
820
821 Conforming to: C99 and later; POSIX.1-2001 and later.
822
823 See also: va_start(3), va_arg(3), va_copy(3), va_end(3)
824
825 void *
826 According to the C language standard, a pointer to any object
827 type may be converted to a pointer to void and back. POSIX fur‐
828 ther requires that any pointer, including pointers to functions,
829 may be converted to a pointer to void and back.
830
831 Conversions from and to any other pointer type are done implic‐
832 itly, not requiring casts at all. Note that this feature pre‐
833 vents any kind of type checking: the programmer should be care‐
834 ful not to convert a void * value to a type incompatible to that
835 of the underlying data, because that would result in undefined
836 behavior.
837
838 This type is useful in function parameters and return value to
839 allow passing values of any type. The function will typically
840 use some mechanism to know the real type of the data being
841 passed via a pointer to void.
842
843 A value of this type can't be dereferenced, as it would give a
844 value of type void, which is not possible. Likewise, pointer
845 arithmetic is not possible with this type. However, in GNU C,
846 pointer arithmetic is allowed as an extension to the standard;
847 this is done by treating the size of a void or of a function as
848 1. A consequence of this is that sizeof is also allowed on void
849 and on function types, and returns 1.
850
851 The conversion specifier for void * for the printf(3) and the
852 scanf(3) families of functions is p.
853
854 Versions: The POSIX requirement about compatibility between void
855 * and function pointers was added in POSIX.1-2008 Technical Cor‐
856 rigendum 1 (2013).
857
858 Conforming to: C99 and later; POSIX.1-2001 and later.
859
860 See also: malloc(3), memcmp(3), memcpy(3), memset(3)
861
862 See also the intptr_t and uintptr_t types in this page.
863
865 The structures described in this manual page shall contain, at least,
866 the members shown in their definition, in no particular order.
867
868 Most of the integer types described in this page don't have a corre‐
869 sponding length modifier for the printf(3) and the scanf(3) families of
870 functions. To print a value of an integer type that doesn't have a
871 length modifier, it should be converted to intmax_t or uintmax_t by an
872 explicit cast. To scan into a variable of an integer type that doesn't
873 have a length modifier, an intermediate temporary variable of type int‐
874 max_t or uintmax_t should be used. When copying from the temporary
875 variable to the destination variable, the value could overflow. If the
876 type has upper and lower limits, the user should check that the value
877 is within those limits, before actually copying the value. The example
878 below shows how these conversions should be done.
879
880 Conventions used in this page
881 In "Conforming to" we only concern ourselves with C99 and later and
882 POSIX.1-2001 and later. Some types may be specified in earlier ver‐
883 sions of one of these standards, but in the interests of simplicity we
884 omit details from earlier standards.
885
886 In "Include", we first note the "primary" header(s) that define the
887 type according to either the C or POSIX.1 standards. Under "Alterna‐
888 tively", we note additional headers that the standards specify shall
889 define the type.
890
892 The program shown below scans from a string and prints a value stored
893 in a variable of an integer type that doesn't have a length modifier.
894 The appropriate conversions from and to intmax_t, and the appropriate
895 range checks, are used as explained in the notes section above.
896
897 #include <stdint.h>
898 #include <stdio.h>
899 #include <stdlib.h>
900 #include <sys/types.h>
901
902 int
903 main (void)
904 {
905 static const char *const str = "500000 us in half a second";
906 suseconds_t us;
907 intmax_t tmp;
908
909 /* Scan the number from the string into the temporary variable. */
910
911 sscanf(str, "%jd", &tmp);
912
913 /* Check that the value is within the valid range of suseconds_t. */
914
915 if (tmp < -1 || tmp > 1000000) {
916 fprintf(stderr, "Scanned value outside valid range!\n");
917 exit(EXIT_FAILURE);
918 }
919
920 /* Copy the value to the suseconds_t variable 'us'. */
921
922 us = tmp;
923
924 /* Even though suseconds_t can hold the value -1, this isn't
925 a sensible number of microseconds. */
926
927 if (us < 0) {
928 fprintf(stderr, "Scanned value shouldn't be negative!\n");
929 exit(EXIT_FAILURE);
930 }
931
932 /* Print the value. */
933
934 printf("There are %jd microseconds in half a second.\n",
935 (intmax_t) us);
936
937 exit(EXIT_SUCCESS);
938 }
939
941 feature_test_macros(7), standards(7)
942
944 This page is part of release 5.13 of the Linux man-pages project. A
945 description of the project, information about reporting bugs, and the
946 latest version of this page, can be found at
947 https://www.kernel.org/doc/man-pages/.
948
949
950
951Linux 2021-03-22 SYSTEM_DATA_TYPES(7)