proc.5: Remove duplicated /proc/[pid]/gid_map entry
[man-pages.git] / man7 / system_data_types.7
blobd117b1d2bca52cb4ee0d21a1e5fc262734e18a3b
1 .\" Copyright (c) 2020 by Alejandro Colomar <colomar.6.4.3@gmail.com>
2 .\" and Copyright (c) 2020 by Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .\"
27 .TH SYSTEM_DATA_TYPES 7 2021-03-22 "Linux" "Linux Programmer's Manual"
28 .SH NAME
29 system_data_types \- overview of system data types
30 .SH DESCRIPTION
31 .\" Layout:
32 .\"     A list of type names (the struct/union keyword will be omitted).
33 .\"     Each entry will have the following parts:
34 .\"             * Include (see NOTES)
35 .\"
36 .\"             * Definition (no "Definition" header)
37 .\"                     Only struct/union types will have definition;
38 .\"                     typedefs will remain opaque.
39 .\"
40 .\"             * Description (no "Description" header)
41 .\"                     A few lines describing the type.
42 .\"
43 .\"             * Versions (optional)
44 .\"
45 .\"             * Conforming to (see NOTES)
46 .\"                     Format: CXY and later; POSIX.1-XXXX and later.
47 .\"
48 .\"             * Notes (optional)
49 .\"
50 .\"             * Bugs (if any)
51 .\"
52 .\"             * See also
53 .\"------------------------------------- aiocb ------------------------/
54 .TP
55 .I aiocb
56 .RS
57 .IR Include :
58 .IR <aio.h> .
59 .PP
60 .EX
61 struct aiocb {
62     int             aio_fildes;    /* File descriptor */
63     off_t           aio_offset;    /* File offset */
64     volatile void  *aio_buf;       /* Location of buffer */
65     size_t          aio_nbytes;    /* Length of transfer */
66     int             aio_reqprio;   /* Request priority offset */
67     struct sigevent aio_sigevent;  /* Signal number and value */
68     int             aio_lio_opcode;/* Operation to be performed */
70 .EE
71 .PP
72 For further information about this structure, see
73 .BR aio (7).
74 .PP
75 .IR "Conforming to" :
76 POSIX.1-2001 and later.
77 .PP
78 .IR "See also" :
79 .BR aio_cancel (3),
80 .BR aio_error (3),
81 .BR aio_fsync (3),
82 .BR aio_read (3),
83 .BR aio_return (3),
84 .BR aio_suspend (3),
85 .BR aio_write (3),
86 .BR lio_listio (3)
87 .RE
88 .\"------------------------------------- blkcnt_t ---------------------/
89 .TP
90 .I blkcnt_t
91 .RS
92 .IR Include :
93 .IR <sys/types.h> .
94 Alternatively,
95 .IR <sys/stat.h> .
96 .PP
97 Used for file block counts.
98 According to POSIX,
99 it shall be a signed integer type.
101 .IR "Conforming to" :
102 POSIX.1-2001 and later.
104 .IR "See also" :
105 .BR stat (2)
107 .\"------------------------------------- blksize_t --------------------/
109 .I blksize_t
111 .IR Include :
112 .IR <sys/types.h> .
113 Alternatively,
114 .IR <sys/stat.h> .
116 Used for file block sizes.
117 According to POSIX,
118 it shall be a signed integer type.
120 .IR "Conforming to" :
121 POSIX.1-2001 and later.
123 .IR "See also" :
124 .BR stat (2)
126 .\"------------------------------------- cc_t -------------------------/
128 .I cc_t
130 .IR Include :
131 .IR <termios.h> .
133 Used for terminal special characters.
134 According to POSIX,
135 it shall be an unsigned integer type.
137 .IR "Conforming to" :
138 POSIX.1-2001 and later.
140 .IR "See also" :
141 .BR termios (3)
143 .\"------------------------------------- clock_t ----------------------/
145 .I clock_t
147 .IR Include :
148 .I <time.h>
150 .IR <sys/types.h> .
151 Alternatively,
152 .IR <sys/time.h> .
154 Used for system time in clock ticks or
155 .B CLOCKS_PER_SEC
156 (defined in
157 .IR <time.h> ).
158 According to POSIX,
159 it shall be an integer type or a real-floating type.
161 .IR "Conforming to" :
162 C99 and later; POSIX.1-2001 and later.
164 .IR "See also" :
165 .BR times (2),
166 .BR clock (3)
168 .\"------------------------------------- clockid_t --------------------/
170 .I clockid_t
172 .IR Include :
173 .IR <sys/types.h> .
174 Alternatively,
175 .IR <time.h> .
177 Used for clock ID type in the clock and timer functions.
178 According to POSIX,
179 it shall be defined as an arithmetic type.
181 .IR "Conforming to" :
182 POSIX.1-2001 and later.
184 .IR "See also" :
185 .BR clock_adjtime (2),
186 .BR clock_getres (2),
187 .BR clock_nanosleep (2),
188 .BR timer_create (2),
189 .BR clock_getcpuclockid (3)
191 .\"------------------------------------- dev_t ------------------------/
193 .I dev_t
195 .IR Include :
196 .IR <sys/types.h> .
197 Alternatively,
198 .IR <sys/stat.h> .
200 Used for device IDs.
201 According to POSIX,
202 it shall be an integer type.
203 For further details of this type, see
204 .BR makedev (3).
206 .IR "Conforming to" :
207 POSIX.1-2001 and later.
209 .IR "See also" :
210 .BR mknod (2),
211 .BR stat (2)
213 .\"------------------------------------- div_t ------------------------/
215 .I div_t
217 .IR Include :
218 .IR <stdlib.h> .
221 typedef struct {
222     int quot; /* Quotient */
223     int rem;  /* Remainder */
224 } div_t;
227 It is the type of the value returned by the
228 .BR div (3)
229 function.
231 .IR "Conforming to" :
232 C99 and later; POSIX.1-2001 and later.
234 .IR "See also" :
235 .BR div (3)
237 .\"------------------------------------- double_t ---------------------/
239 .I double_t
241 .IR Include :
242 .IR <math.h> .
244 The implementation's most efficient floating type at least as wide as
245 .IR double .
246 Its type depends on the value of the macro
247 .B FLT_EVAL_METHOD
248 (defined in
249 .IR <float.h> ):
252 .I double_t
254 .IR double .
257 .I double_t
259 .IR double .
262 .I double_t
264 .IR "long double" .
266 For other values of
267 .BR FLT_EVAL_METHOD ,
268 the type of
269 .I double_t
270 is implementation-defined.
272 .IR "Conforming to" :
273 C99 and later; POSIX.1-2001 and later.
275 .IR "See also" :
277 .I float_t
278 type in this page.
280 .\"------------------------------------- fd_set -----------------------/
282 .I fd_set
284 .IR Include :
285 .IR <sys/select.h> .
286 Alternatively,
287 .IR <sys/time.h> .
289 A structure type that can represent a set of file descriptors.
290 According to POSIX,
291 the maximum number of file descriptors in an
292 .I fd_set
293 structure is the value of the macro
294 .BR FD_SETSIZE .
296 .IR "Conforming to" :
297 POSIX.1-2001 and later.
299 .IR "See also" :
300 .BR select (2)
302 .\"------------------------------------- fenv_t -----------------------/
304 .I fenv_t
306 .IR Include :
307 .IR <fenv.h> .
309 This type represents the entire floating-point environment,
310 including control modes and status flags; for further details, see
311 .BR fenv (3).
313 .IR "Conforming to" :
314 C99 and later; POSIX.1-2001 and later.
316 .IR "See also" :
317 .BR fenv (3)
319 .\"------------------------------------- fexcept_t --------------------/
321 .I fexcept_t
323 .IR Include :
324 .IR <fenv.h> .
326 This type represents the floating-point status flags collectively;
327 for further details see
328 .BR fenv (3).
330 .IR "Conforming to" :
331 C99 and later; POSIX.1-2001 and later.
333 .IR "See also" :
334 .BR fenv (3)
336 .\"------------------------------------- FILE -------------------------/
338 .I FILE
340 .IR Include :
341 .IR <stdio.h> .
342 Alternatively,
343 .IR <wchar.h> .
345 An object type used for streams.
347 .IR "Conforming to" :
348 C99 and later; POSIX.1-2001 and later.
350 .IR "See also" :
351 .BR fclose (3),
352 .BR flockfile (3),
353 .BR fopen (3),
354 .BR fprintf (3),
355 .BR fread (3),
356 .BR fscanf (3),
357 .BR stdin (3),
358 .BR stdio (3)
360 .\"------------------------------------- float_t ----------------------/
362 .I float_t
364 .IR Include :
365 .IR <math.h> .
367 The implementation's most efficient floating type at least as wide as
368 .IR float .
369 Its type depends on the value of the macro
370 .B FLT_EVAL_METHOD
371 (defined in
372 .IR <float.h> ):
375 .I float_t
377 .IR float .
380 .I float_t
382 .IR double .
385 .I float_t
387 .IR "long double" .
389 For other values of
390 .BR FLT_EVAL_METHOD ,
391 the type of
392 .I float_t
393 is implementation-defined.
395 .IR "Conforming to" :
396 C99 and later; POSIX.1-2001 and later.
398 .IR "See also" :
400 .I double_t
401 type in this page.
403 .\"------------------------------------- gid_t ------------------------/
405 .I gid_t
407 .IR Include :
408 .IR <sys/types.h> .
409 Alternatively,
410 .IR <grp.h> ,
411 .IR <pwd.h> ,
412 .IR <signal.h> ,
413 .IR <stropts.h> ,
414 .IR <sys/ipc.h> ,
415 .IR <sys/stat.h> ,
417 .IR <unistd.h> .
419 A type used to hold group IDs.
420 According to POSIX,
421 this shall be an integer type.
423 .IR "Conforming to" :
424 POSIX.1-2001 and later.
426 .IR "See also" :
427 .BR chown (2),
428 .BR getgid (2),
429 .BR getegid (2),
430 .BR getgroups (2),
431 .BR getresgid (2),
432 .BR getgrnam (3),
433 .BR credentials (7)
435 .\"------------------------------------- id_t -------------------------/
437 .I id_t
439 .IR Include :
440 .IR <sys/types.h> .
441 Alternatively,
442 .IR <sys/resource.h> .
444 A type used to hold a general identifier.
445 According to POSIX,
446 this shall be an integer type that can be used to contain a
447 .IR pid_t ,
448 .IR uid_t ,
450 .IR gid_t .
452 .IR "Conforming to" :
453 POSIX.1-2001 and later.
455 .IR "See also" :
456 .BR getpriority (2),
457 .BR waitid (2)
459 .\"------------------------------------- imaxdiv_t --------------------/
461 .I imaxdiv_t
463 .IR Include :
464 .IR <inttypes.h> .
467 typedef struct {
468     intmax_t    quot; /* Quotient */
469     intmax_t    rem;  /* Remainder */
470 } imaxdiv_t;
473 It is the type of the value returned by the
474 .BR imaxdiv (3)
475 function.
477 .IR "Conforming to" :
478 C99 and later; POSIX.1-2001 and later.
480 .IR "See also" :
481 .BR imaxdiv (3)
483 .\"------------------------------------- intmax_t ---------------------/
485 .I intmax_t
487 .IR Include :
488 .IR <stdint.h> .
489 Alternatively,
490 .IR <inttypes.h> .
492 A signed integer type
493 capable of representing any value of any signed integer type
494 supported by the implementation.
495 According to the C language standard, it shall be
496 capable of storing values in the range
497 .RB [ INTMAX_MIN ,
498 .BR INTMAX_MAX ].
500 The macro
501 .BR INTMAX_C ()
502 .\" TODO: Document INT*_C(3)
503 expands its argument to an integer constant of type
504 .IR intmax_t .
506 The length modifier for
507 .I intmax_t
508 for the
509 .BR printf (3)
510 and the
511 .BR scanf (3)
512 families of functions is
513 .BR j ;
514 resulting commonly in
515 .B %jd
517 .B %ji
518 for printing
519 .I intmax_t
520 values.
522 .IR "Conforming to" :
523 C99 and later; POSIX.1-2001 and later.
525 .IR Bugs :
526 .I intmax_t
527 is not large enough to represent values of type
528 .I __int128
529 in implementations where
530 .I __int128
531 is defined and
532 .I long long
533 is less than 128 bits wide.
535 .IR "See also" :
537 .I uintmax_t
538 type in this page.
540 .\"------------------------------------- intN_t -----------------------/
542 .IR int N _t
544 .IR Include :
545 .IR <stdint.h> .
546 Alternatively,
547 .IR <inttypes.h> .
549 .IR int8_t ,
550 .IR int16_t ,
551 .IR int32_t ,
552 .I int64_t
554 A signed integer type
555 of a fixed width of exactly N bits,
556 N being the value specified in its type name.
557 According to the C language standard, they shall be
558 capable of storing values in the range
559 .RB [ INT N _MIN ,
560 .BR INT N _MAX ],
561 substituting N by the appropriate number.
563 According to POSIX,
564 .IR int8_t ,
565 .IR int16_t ,
567 .I int32_t
568 are required;
569 .I int64_t
570 is only required in implementations that provide integer types
571 with width 64;
572 and all other types of this form are optional.
574 The length modifiers for the
575 .IR int N _t
576 types for the
577 .BR printf (3)
578 family of functions
579 are expanded by macros of the forms
580 .BR PRId N
582 .BR PRIi N
583 (defined in
584 .IR <inttypes.h> );
585 resulting for example in
586 .B %"PRId64"
588 .B %"PRIi64"
589 for printing
590 .I int64_t
591 values.
592 The length modifiers for the
593 .IR int N _t
594 types for the
595 .BR scanf (3)
596 family of functions
597 are expanded by macros of the forms
598 .BR SCNd N
600 .BR SCNi N,
601 (defined in
602 .IR <inttypes.h> );
603 resulting for example in
604 .B %"SCNd8"
606 .B %"SCNi8"
607 for scanning
608 .I int8_t
609 values.
611 .IR "Conforming to" :
612 C99 and later; POSIX.1-2001 and later.
614 .IR "See also" :
616 .IR intmax_t ,
617 .IR uint N _t ,
619 .I uintmax_t
620 types in this page.
622 .\"------------------------------------- intptr_t ---------------------/
624 .I intptr_t
626 .IR Include :
627 .IR <stdint.h> .
628 Alternatively,
629 .IR <inttypes.h> .
631 A signed integer type
632 such that any valid
633 .RI ( "void *" )
634 value can be converted to this type and back.
635 According to the C language standard, it shall be
636 capable of storing values in the range
637 .RB [ INTPTR_MIN ,
638 .BR INTPTR_MAX ].
640 The length modifier for
641 .I intptr_t
642 for the
643 .BR printf (3)
644 family of functions
645 is expanded by the macros
646 .B PRIdPTR
648 .B PRIiPTR
649 (defined in
650 .IR <inttypes.h> );
651 resulting commonly in
652 .B %"PRIdPTR"
654 .B %"PRIiPTR"
655 for printing
656 .I intptr_t
657 values.
658 The length modifier for
659 .I intptr_t
660 for the
661 .BR scanf (3)
662 family of functions
663 is expanded by the macros
664 .B SCNdPTR
666 .B SCNiPTR,
667 (defined in
668 .IR <inttypes.h> );
669 resulting commonly in
670 .B %"SCNdPTR"
672 .B %"SCNiPTR"
673 for scanning
674 .I intptr_t
675 values.
677 .IR "Conforming to" :
678 C99 and later; POSIX.1-2001 and later.
680 .IR "See also" :
682 .I uintptr_t
684 .I void *
685 types in this page.
687 .\"------------------------------------- lconv ------------------------/
689 .I lconv
691 .IR Include :
692 .IR <locale.h> .
695 struct lconv {                  /* Values in the "C" locale: */
696     char   *decimal_point;      /* "." */
697     char   *thousands_sep;      /* "" */
698     char   *grouping;           /* "" */
699     char   *mon_decimal_point;  /* "" */
700     char   *mon_thousands_sep;  /* "" */
701     char   *mon_grouping;       /* "" */
702     char   *positive_sign;      /* "" */
703     char   *negative_sign;      /* "" */
704     char   *currency_symbol;    /* "" */
705     char    frac_digits;        /* CHAR_MAX */
706     char    p_cs_precedes;      /* CHAR_MAX */
707     char    n_cs_precedes;      /* CHAR_MAX */
708     char    p_sep_by_space;     /* CHAR_MAX */
709     char    n_sep_by_space;     /* CHAR_MAX */
710     char    p_sign_posn;        /* CHAR_MAX */
711     char    n_sign_posn;        /* CHAR_MAX */
712     char   *int_curr_symbol;    /* "" */
713     char    int_frac_digits;    /* CHAR_MAX */
714     char    int_p_cs_precedes;  /* CHAR_MAX */
715     char    int_n_cs_precedes;  /* CHAR_MAX */
716     char    int_p_sep_by_space; /* CHAR_MAX */
717     char    int_n_sep_by_space; /* CHAR_MAX */
718     char    int_p_sign_posn;    /* CHAR_MAX */
719     char    int_n_sign_posn;    /* CHAR_MAX */
723 Contains members related to the formatting of numeric values.
724 In the "C" locale, its members have the values
725 shown in the comments above.
727 .IR "Conforming to" :
728 C11 and later; POSIX.1-2001 and later.
730 .IR "See also" :
731 .BR setlocale (3),
732 .BR localeconv (3),
733 .BR charsets (7),
734 .BR locale (7)
736 .\"------------------------------------- ldiv_t -----------------------/
738 .I ldiv_t
740 .IR Include :
741 .IR <stdlib.h> .
744 typedef struct {
745     long    quot; /* Quotient */
746     long    rem;  /* Remainder */
747 } ldiv_t;
750 It is the type of the value returned by the
751 .BR ldiv (3)
752 function.
754 .IR "Conforming to" :
755 C99 and later; POSIX.1-2001 and later.
757 .IR "See also" :
758 .BR ldiv (3)
760 .\"------------------------------------- lldiv_t ----------------------/
762 .I lldiv_t
764 .IR Include :
765 .IR <stdlib.h> .
768 typedef struct {
769     long long   quot; /* Quotient */
770     long long   rem;  /* Remainder */
771 } lldiv_t;
774 It is the type of the value returned by the
775 .BR lldiv (3)
776 function.
778 .IR "Conforming to" :
779 C99 and later; POSIX.1-2001 and later.
781 .IR "See also" :
782 .BR lldiv (3)
784 .\"------------------------------------- mode_t -----------------------/
786 .I mode_t
788 .IR Include :
789 .IR <sys/types.h> .
790 Alternatively,
791 .IR <fcntl.h> ,
792 .IR <ndbm.h> ,
793 .IR <spawn.h> ,
794 .IR <sys/ipc.h> ,
795 .IR <sys/mman.h> ,
797 .IR <sys/stat.h> .
799 Used for some file attributes (e.g., file mode).
800 According to POSIX,
801 it shall be an integer type.
803 .IR "Conforming to" :
804 POSIX.1-2001 and later.
806 .IR "See also" :
807 .BR chmod (2),
808 .BR mkdir (2),
809 .BR open (2),
810 .BR stat (2),
811 .BR umask (2)
813 .\"------------------------------------- off64_t ----------------------/
815 .I off64_t
817 .IR Include :
818 .IR <sys/types.h> .
820 Used for file sizes.
821 It is a 64-bit signed integer type.
823 .IR "Conforming to" :
824 Present in glibc.
825 It is not standardized by the C language standard nor POSIX.
827 .IR Notes :
828 The feature test macro
829 .B _LARGEFILE64_SOURCE
830 has to be defined for this type to be available.
832 .IR "See also" :
833 .BR copy_file_range (2),
834 .BR readahead (2),
835 .BR sync_file_range (2),
836 .BR lseek64 (3),
837 .BR feature_test_macros (7)
839 See also the
840 .\" .I loff_t
841 .\" and
842 .I off_t
843 type in this page.
845 .\"------------------------------------- off_t ------------------------/
847 .I off_t
849 .IR Include :
850 .IR <sys/types.h> .
851 Alternatively,
852 .IR <aio.h> ,
853 .IR <fcntl.h> ,
854 .IR <stdio.h> ,
855 .IR <sys/mman.h> ,
856 .IR <sys/stat.h.h> ,
858 .IR <unistd.h> .
860 Used for file sizes.
861 According to POSIX,
862 this shall be a signed integer type.
864 .IR Versions :
865 .I <aio.h>
867 .I <stdio.h>
868 define
869 .I off_t
870 since POSIX.1-2008.
872 .IR "Conforming to" :
873 POSIX.1-2001 and later.
875 .IR Notes :
876 On some architectures,
877 the width of this type can be controlled with the feature test macro
878 .BR _FILE_OFFSET_BITS .
880 .IR "See also" :
881 .\" .BR fallocate (2),
882 .BR lseek (2),
883 .BR mmap (2),
884 .\" .BR mmap2 (2),
885 .BR posix_fadvise (2),
886 .BR pread (2),
887 .\" .BR preadv (2),
888 .BR truncate (2),
889 .BR fseeko (3),
890 .\" .BR getdirentries (3),
891 .BR lockf (3),
892 .BR posix_fallocate (3),
893 .BR feature_test_macros (7)
895 See also the
896 .\" .I loff_t
897 .\" and
898 .I off64_t
899 type in this page.
901 .\"------------------------------------- pid_t ------------------------/
903 .I pid_t
905 .IR Include :
906 .IR <sys/types.h> .
907 Alternatively,
908 .IR <fcntl.h> ,
909 .IR <sched.h> ,
910 .IR <signal.h> ,
911 .IR <spawn.h> ,
912 .IR <sys/msg.h> ,
913 .IR <sys/sem.h> ,
914 .IR <sys/shm.h> ,
915 .IR <sys/wait.h> ,
916 .IR <termios.h> ,
917 .IR <time.h> ,
918 .IR <unistd.h> ,
920 .IR <utmpx.h> .
922 This type is used for storing process IDs, process group IDs, and session IDs.
923 According to POSIX, it shall be a signed integer type,
924 and the implementation shall support one or more programming environments
925 where the width of
926 .I pid_t
927 is no greater than the width of the type
928 .IR long .
930 .IR "Conforming to" :
931 POSIX.1-2001 and later.
933 .IR "See also" :
934 .BR fork (2),
935 .BR getpid (2),
936 .BR getppid (2),
937 .BR getsid (2),
938 .BR gettid (2),
939 .BR getpgid (2),
940 .BR kill (2),
941 .BR pidfd_open (2),
942 .BR sched_setscheduler (2),
943 .BR waitpid (2),
944 .BR sigqueue (3),
945 .BR credentials (7),
947 .\"------------------------------------- ptrdiff_t --------------------/
949 .I ptrdiff_t
951 .IR Include :
952 .IR <stddef.h> .
954 Used for a count of elements, and array indices.
955 It is the result of subtracting two pointers.
956 According to the C language standard, it shall be a signed integer type
957 capable of storing values in the range
958 .RB [ PTRDIFF_MIN ,
959 .BR PTRDIFF_MAX ].
961 The length modifier for
962 .I ptrdiff_t
963 for the
964 .BR printf (3)
965 and the
966 .BR scanf (3)
967 families of functions is
968 .BR t ;
969 resulting commonly in
970 .B %td
972 .B %ti
973 for printing
974 .I ptrdiff_t
975 values.
977 .IR "Conforming to" :
978 C99 and later; POSIX.1-2001 and later.
980 .IR "See also" :
982 .I size_t
984 .I ssize_t
985 types in this page.
987 .\"------------------------------------- regex_t ----------------------/
989 .I regex_t
991 .IR Include :
992 .IR <regex.h> .
995 typedef struct {
996     size_t  re_nsub; /* Number of parenthesized subexpressions */
997 } regex_t;
1000 This is a structure type used in regular expression matching.
1001 It holds a compiled regular expression, compiled with
1002 .BR regcomp (3).
1004 .IR "Conforming to" :
1005 POSIX.1-2001 and later.
1007 .IR "See also" :
1008 .BR regex (3)
1010 .\"------------------------------------- regmatch_t -------------------/
1012 .I regmatch_t
1014 .IR Include :
1015 .IR <regex.h> .
1018 typedef struct {
1019     regoff_t    rm_so; /* Byte offset from start of string
1020                           to start of substring */
1021     regoff_t    rm_eo; /* Byte offset from start of string of
1022                           the first character after the end of
1023                           substring */
1024 } regmatch_t;
1027 This is a structure type used in regular expression matching.
1029 .IR "Conforming to" :
1030 POSIX.1-2001 and later.
1032 .IR "See also" :
1033 .BR regexec (3)
1035 .\"------------------------------------- regoff_t ---------------------/
1037 .I regoff_t
1039 .IR Include :
1040 .IR <regex.h> .
1042 According to POSIX, it shall be a signed integer type
1043 capable of storing the largest value that can be stored in either a
1044 .I ptrdiff_t
1045 type or a
1046 .I ssize_t
1047 type.
1049 .IR Versions :
1050 Prior to POSIX.1-2008, the type was capable of storing
1051 the largest value that can be stored in either an
1052 .I off_t
1053 type or a
1054 .I ssize_t
1055 type.
1057 .IR "Conforming to" :
1058 POSIX.1-2001 and later.
1060 .IR "See also" :
1062 .I regmatch_t
1063 structure and the
1064 .I ptrdiff_t
1066 .I ssize_t
1067 types in this page.
1069 .\"------------------------------------- sigevent ---------------------/
1071 .I sigevent
1073 .IR Include :
1074 .IR <signal.h> .
1075 Alternatively,
1076 .IR <aio.h> ,
1077 .IR <mqueue.h> ,
1079 .IR <time.h> .
1082 struct sigevent {
1083     int             sigev_notify; /* Notification type */
1084     int             sigev_signo;  /* Signal number */
1085     union sigval    sigev_value;  /* Signal value */
1086     void          (*sigev_notify_function)(union sigval);
1087                                   /* Notification function */
1088     pthread_attr_t *sigev_notify_attributes;
1089                                   /* Notification attributes */
1093 For further details about this type, see
1094 .BR sigevent (7).
1096 .IR Versions :
1097 .I <aio.h>
1099 .I <time.h>
1100 define
1101 .I sigevent
1102 since POSIX.1-2008.
1104 .IR "Conforming to" :
1105 POSIX.1-2001 and later.
1107 .IR "See also" :
1108 .BR timer_create (2),
1109 .BR getaddrinfo_a (3),
1110 .BR lio_listio (3),
1111 .BR mq_notify (3)
1113 See also the
1114 .I aiocb
1115 structure in this page.
1117 .\"------------------------------------- siginfo_t --------------------/
1119 .I siginfo_t
1121 .IR Include :
1122 .IR <signal.h> .
1123 Alternatively,
1124 .IR <sys/wait.h> .
1127 typedef struct {
1128     int      si_signo;  /* Signal number */
1129     int      si_code;   /* Signal code */
1130     pid_t    si_pid;    /* Sending process ID */
1131     uid_t    si_uid;    /* Real user ID of sending process */
1132     void    *si_addr;   /* Address of faulting instruction */
1133     int      si_status; /* Exit value or signal */
1134     union sigval si_value;  /* Signal value */
1135 } siginfo_t;
1138 Information associated with a signal.
1139 For further details on this structure
1140 (including additional, Linux-specific fields), see
1141 .BR sigaction (2).
1143 .IR "Conforming to" :
1144 POSIX.1-2001 and later.
1146 .IR "See also" :
1147 .BR pidfd_send_signal (2),
1148 .BR rt_sigqueueinfo (2),
1149 .BR sigaction (2),
1150 .BR sigwaitinfo (2),
1151 .BR psiginfo (3)
1153 .\"------------------------------------- sigset_t ---------------------/
1155 .I sigset_t
1157 .IR Include :
1158 .IR <signal.h> .
1159 Alternatively,
1160 .IR <spawn.h> ,
1162 .IR <sys/select.h> .
1164 This is a type that represents a set of signals.
1165 According to POSIX, this shall be an integer or structure type.
1167 .IR "Conforming to" :
1168 POSIX.1-2001 and later.
1170 .IR "See also" :
1171 .BR epoll_pwait (2),
1172 .BR ppoll (2),
1173 .BR pselect (2),
1174 .BR sigaction (2),
1175 .BR signalfd (2),
1176 .BR sigpending (2),
1177 .BR sigprocmask (2),
1178 .BR sigsuspend (2),
1179 .BR sigwaitinfo (2),
1180 .BR signal (7)
1182 .\"------------------------------------- sigval -----------------------/
1184 .I sigval
1186 .IR Include :
1187 .IR <signal.h> .
1190 union sigval {
1191     int     sigval_int; /* Integer value */
1192     void   *sigval_ptr; /* Pointer value */
1196 Data passed with a signal.
1198 .IR "Conforming to" :
1199 POSIX.1-2001 and later.
1201 .IR "See also" :
1202 .BR pthread_sigqueue (3),
1203 .BR sigqueue (3),
1204 .BR sigevent (7)
1206 See also the
1207 .I sigevent
1208 structure
1209 and the
1210 .I siginfo_t
1211 type
1212 in this page.
1214 .\"------------------------------------- size_t -----------------------/
1216 .I size_t
1218 .IR Include :
1219 .I <stddef.h>
1221 .IR <sys/types.h> .
1222 Alternatively,
1223 .IR <aio.h> ,
1224 .IR <glob.h> ,
1225 .IR <grp.h> ,
1226 .IR <iconv.h> ,
1227 .IR <monetary.h> ,
1228 .IR <mqueue.h> ,
1229 .IR <ndbm.h> ,
1230 .IR <pwd.h> ,
1231 .IR <regex.h> ,
1232 .IR <search.h> ,
1233 .IR <signal.h> ,
1234 .IR <stdio.h> ,
1235 .IR <stdlib.h> ,
1236 .IR <string.h> ,
1237 .IR <strings.h> ,
1238 .IR <sys/mman.h> ,
1239 .IR <sys/msg.h> ,
1240 .IR <sys/sem.h> ,
1241 .IR <sys/shm.h> ,
1242 .IR <sys/socket.h> ,
1243 .IR <sys/uio.h> ,
1244 .IR <time.h> ,
1245 .IR <unistd.h> ,
1246 .IR <wchar.h> ,
1248 .IR <wordexp.h> .
1250 Used for a count of bytes.
1251 It is the result of the
1252 .I sizeof
1253 operator.
1254 According to the C language standard,
1255 it shall be an unsigned integer type
1256 capable of storing values in the range [0,
1257 .BR SIZE_MAX ].
1258 According to POSIX,
1259 the implementation shall support one or more programming environments
1260 where the width of
1261 .I size_t
1262 is no greater than the width of the type
1263 .IR long .
1265 The length modifier for
1266 .I size_t
1267 for the
1268 .BR printf (3)
1269 and the
1270 .BR scanf (3)
1271 families of functions is
1272 .BR z ;
1273 resulting commonly in
1274 .B %zu
1276 .B %zx
1277 for printing
1278 .I size_t
1279 values.
1281 .IR Versions :
1282 .IR <aio.h> ,
1283 .IR <glob.h> ,
1284 .IR <grp.h> ,
1285 .IR <iconv.h> ,
1286 .IR <mqueue.h> ,
1287 .IR <pwd.h> ,
1288 .IR <signal.h> ,
1290 .I <sys/socket.h>
1291 define
1292 .I size_t
1293 since POSIX.1-2008.
1295 .IR "Conforming to" :
1296 C99 and later; POSIX.1-2001 and later.
1298 .IR "See also" :
1299 .BR read (2),
1300 .BR write (2),
1301 .BR fread (3),
1302 .BR fwrite (3),
1303 .BR memcmp (3),
1304 .BR memcpy (3),
1305 .BR memset (3),
1306 .BR offsetof (3)
1308 See also the
1309 .I ptrdiff_t
1311 .I ssize_t
1312 types in this page.
1314 .\"------------------------------------- sockaddr ---------------------/
1316 .I sockaddr
1318 .IR Include :
1319 .IR <sys/socket.h> .
1322 struct sockaddr {
1323     sa_family_t sa_family; /* Address family */
1324     char        sa_data[]; /* Socket address */
1328 Describes a socket address.
1330 .IR "Conforming to" :
1331 POSIX.1-2001 and later.
1333 .IR "See also" :
1334 .BR accept (2),
1335 .BR getpeername (2),
1336 .BR getsockname (2),
1337 .BR socket (2)
1339 .\"------------------------------------- socklen_t --------------------/
1341 .I socklen_t
1343 .IR Include :
1344 .IR <sys/socket.h> .
1345 Alternatively,
1346 .IR <netdb.h> .
1348 Describes the length of a socket address.
1349 According to POSIX,
1350 this shall be an integer type of at least 32 bits.
1352 .IR "Conforming to" :
1353 POSIX.1-2001 and later.
1355 .IR "See also" :
1356 .BR accept (2),
1357 .BR bind (2),
1358 .BR connect (2),
1359 .BR gethostbyaddr (2),
1360 .BR getnameinfo (2),
1361 .BR socket (2)
1363 See also the
1364 .I sockaddr
1365 structure in this page.
1367 .\"------------------------------------- ssize_t ----------------------/
1369 .I ssize_t
1371 .IR Include :
1372 .IR <sys/types.h> .
1373 Alternatively,
1374 .IR <aio.h> ,
1375 .IR <monetary.h> ,
1376 .IR <mqueue.h> ,
1377 .IR <stdio.h> ,
1378 .IR <sys/msg.h> ,
1379 .IR <sys/socket.h> ,
1380 .IR <sys/uio.h> ,
1382 .IR <unistd.h> .
1384 Used for a count of bytes or an error indication.
1385 According to POSIX, it shall be a signed integer type
1386 capable of storing values at least in the range [-1,
1387 .BR SSIZE_MAX ],
1388 and the implementation shall support one or more programming environments
1389 where the width of
1390 .I ssize_t
1391 is no greater than the width of the type
1392 .IR long .
1394 Glibc and most other implementations provide a length modifier for
1395 .I ssize_t
1396 for the
1397 .BR printf (3)
1398 and the
1399 .BR scanf (3)
1400 families of functions, which is
1401 .BR z ;
1402 resulting commonly in
1403 .B %zd
1405 .B %zi
1406 for printing
1407 .I ssize_t
1408 values.
1409 Although
1410 .B z
1411 works for
1412 .I ssize_t
1413 on most implementations,
1414 portable POSIX programs should avoid using it\(emfor example,
1415 by converting the value to
1416 .I intmax_t
1417 and using its length modifier
1418 .RB ( j ).
1420 .IR "Conforming to" :
1421 POSIX.1-2001 and later.
1423 .IR "See also" :
1424 .BR read (2),
1425 .BR readlink (2),
1426 .BR readv (2),
1427 .BR recv (2),
1428 .BR send (2),
1429 .BR write (2)
1431 See also the
1432 .I ptrdiff_t
1434 .I size_t
1435 types in this page.
1437 .\"------------------------------------- suseconds_t ------------------/
1439 .I suseconds_t
1441 .IR Include :
1442 .IR <sys/types.h> .
1443 Alternatively,
1444 .IR <sys/select.h> ,
1446 .IR <sys/time.h> .
1448 Used for time in microseconds.
1449 According to POSIX, it shall be a signed integer type
1450 capable of storing values at least in the range [-1, 1000000],
1451 and the implementation shall support one or more programming environments
1452 where the width of
1453 .I suseconds_t
1454 is no greater than the width of the type
1455 .IR long .
1457 .IR "Conforming to" :
1458 POSIX.1-2001 and later.
1460 .IR "See also" :
1462 .I timeval
1463 structure in this page.
1465 .\"------------------------------------- time_t -----------------------/
1467 .I time_t
1469 .IR Include :
1470 .I <time.h>
1472 .IR <sys/types.h> .
1473 Alternatively,
1474 .IR <sched.h> ,
1475 .IR <sys/msg.h> ,
1476 .IR <sys/select.h> ,
1477 .IR <sys/sem.h> ,
1478 .IR <sys/shm.h> ,
1479 .IR <sys/stat.h> ,
1480 .IR <sys/time.h> ,
1482 .IR <utime.h> .
1484 Used for time in seconds.
1485 According to POSIX, it shall be an integer type.
1486 .\" In POSIX.1-2001, the type was specified as being either an integer
1487 .\" type or a real-floating type. However, existing implementations
1488 .\" used an integer type, and POSIX.1-2008 tightened the specification
1489 .\" to reflect this.
1491 .IR Versions :
1492 .I <sched.h>
1493 defines
1494 .I time_t
1495 since POSIX.1-2008.
1497 .IR "Conforming to" :
1498 C99 and later; POSIX.1-2001 and later.
1500 .IR "See also" :
1501 .BR stime (2),
1502 .BR time (2),
1503 .BR ctime (3),
1504 .BR difftime (3)
1506 .\"------------------------------------- timer_t ----------------------/
1508 .I timer_t
1510 .IR Include :
1511 .IR <sys/types.h> .
1512 Alternatively,
1513 .IR <time.h> .
1515 Used for timer ID returned by
1516 .BR timer_create (2).
1517 According to POSIX,
1518 there are no defined comparison or assignment operators for this type.
1520 .IR "Conforming to" :
1521 POSIX.1-2001 and later.
1523 .IR "See also" :
1524 .BR timer_create (2),
1525 .BR timer_delete (2),
1526 .BR timer_getoverrun (2),
1527 .BR timer_settime (2)
1529 .\"------------------------------------- timespec ---------------------/
1531 .I timespec
1533 .IR Include :
1534 .IR <time.h> .
1535 Alternatively,
1536 .IR <aio.h> ,
1537 .IR <mqueue.h> ,
1538 .IR <sched.h> ,
1539 .IR <signal.h> ,
1540 .IR <sys/select.h> ,
1542 .IR <sys/stat.h> .
1545 struct timespec {
1546     time_t  tv_sec;  /* Seconds */
1547     long    tv_nsec; /* Nanoseconds */
1551 Describes times in seconds and nanoseconds.
1553 .IR "Conforming to" :
1554 C11 and later; POSIX.1-2001 and later.
1556 .IR "See also" :
1557 .BR clock_gettime (2),
1558 .BR clock_nanosleep (2),
1559 .BR nanosleep (2),
1560 .BR timerfd_gettime (2),
1561 .BR timer_gettime (2)
1563 .\"------------------------------------- timeval ----------------------/
1565 .I timeval
1567 .IR Include :
1568 .IR <sys/time.h> .
1569 Alternatively,
1570 .IR <sys/resource.h> ,
1571 .IR <sys/select.h> ,
1573 .IR <utmpx.h> .
1576 struct timeval {
1577     time_t      tv_sec;  /* Seconds */
1578     suseconds_t tv_usec; /* Microseconds */
1582 Describes times in seconds and microseconds.
1584 .IR "Conforming to" :
1585 POSIX.1-2001 and later.
1587 .IR "See also" :
1588 .BR gettimeofday (2),
1589 .BR select (2),
1590 .BR utimes (2),
1591 .BR adjtime (3),
1592 .BR futimes (3),
1593 .BR timeradd (3)
1595 .\"------------------------------------- uid_t ----------------------/
1597 .I uid_t
1599 .IR Include :
1600 .IR <sys/types.h> .
1601 Alternatively,
1602 .IR <pwd.h> ,
1603 .IR <signal.h> ,
1604 .IR <stropts.h> ,
1605 .IR <sys/ipc.h> ,
1606 .IR <sys/stat.h> ,
1608 .IR <unistd.h> .
1610 A type used to hold user IDs.
1611 According to POSIX,
1612 this shall be an integer type.
1614 .IR "Conforming to" :
1615 POSIX.1-2001 and later.
1617 .IR "See also" :
1618 .BR chown (2),
1619 .BR getuid (2),
1620 .BR geteuid (2),
1621 .BR getresuid (2),
1622 .BR getpwnam (3),
1623 .BR credentials (7)
1625 .\"------------------------------------- uintmax_t --------------------/
1627 .I uintmax_t
1629 .IR Include :
1630 .IR <stdint.h> .
1631 Alternatively,
1632 .IR <inttypes.h> .
1634 An unsigned integer type
1635 capable of representing any value of any unsigned integer type
1636 supported by the implementation.
1637 According to the C language standard, it shall be
1638 capable of storing values in the range [0,
1639 .BR UINTMAX_MAX ].
1641 The macro
1642 .BR UINTMAX_C ()
1643 .\" TODO: Document UINT*_C(3)
1644 expands its argument to an integer constant of type
1645 .IR uintmax_t .
1647 The length modifier for
1648 .I uintmax_t
1649 for the
1650 .BR printf (3)
1651 and the
1652 .BR scanf (3)
1653 families of functions is
1654 .BR j ;
1655 resulting commonly in
1656 .B %ju
1658 .B %jx
1659 for printing
1660 .I uintmax_t
1661 values.
1663 .IR "Conforming to" :
1664 C99 and later; POSIX.1-2001 and later.
1666 .IR Bugs :
1667 .I uintmax_t
1668 is not large enough to represent values of type
1669 .I unsigned __int128
1670 in implementations where
1671 .I unsigned __int128
1672 is defined and
1673 .I unsigned long long
1674 is less than 128 bits wide.
1676 .IR "See also" :
1678 .I intmax_t
1679 type in this page.
1681 .\"------------------------------------- uintN_t ----------------------/
1683 .IR uint N _t
1685 .IR Include :
1686 .IR <stdint.h> .
1687 Alternatively,
1688 .IR <inttypes.h> .
1690 .IR uint8_t ,
1691 .IR uint16_t ,
1692 .IR uint32_t ,
1693 .I uint64_t
1695 An unsigned integer type
1696 of a fixed width of exactly N bits,
1697 N being the value specified in its type name.
1698 According to the C language standard, they shall be
1699 capable of storing values in the range [0,
1700 .BR UINT N _MAX ],
1701 substituting N by the appropriate number.
1703 According to POSIX,
1704 .IR uint8_t ,
1705 .IR uint16_t ,
1707 .I uint32_t
1708 are required;
1709 .I uint64_t
1710 is only required in implementations that provide integer types
1711 with width 64;
1712 and all other types of this form are optional.
1714 The length modifiers for the
1715 .IR uint N _t
1716 types for the
1717 .BR printf (3)
1718 family of functions
1719 are expanded by macros of the forms
1720 .BR PRIu N,
1721 .BR PRIo N,
1722 .BR PRIx N,
1724 .BR PRIX N
1725 (defined in
1726 .IR <inttypes.h> );
1727 resulting for example in
1728 .B %"PRIu32"
1730 .B %"PRIx32"
1731 for printing
1732 .I uint32_t
1733 values.
1734 The length modifiers for the
1735 .IR uint N _t
1736 types for the
1737 .BR scanf (3)
1738 family of functions
1739 are expanded by macros of the forms
1740 .BR SCNu N,
1741 .BR SCNo N,
1742 .BR SCNx N,
1744 .BR SCNX N
1745 (defined in
1746 .IR <inttypes.h> );
1747 resulting for example in
1748 .B %"SCNu16"
1750 .B %"SCNx16"
1751 for scanning
1752 .I uint16_t
1753 values.
1755 .IR "Conforming to" :
1756 C99 and later; POSIX.1-2001 and later.
1758 .IR "See also" :
1760 .IR intmax_t ,
1761 .IR int N _t ,
1763 .IR uintmax_t
1764 types in this page.
1766 .\"------------------------------------- uintptr_t --------------------/
1768 .I uintptr_t
1770 .IR Include :
1771 .IR <stdint.h> .
1772 Alternatively,
1773 .IR <inttypes.h> .
1775 An unsigned integer type
1776 such that any valid
1777 .RI ( "void *" )
1778 value can be converted to this type and back.
1779 According to the C language standard, it shall be
1780 capable of storing values in the range [0,
1781 .BR UINTPTR_MAX ].
1783 The length modifier for
1784 .I uintptr_t
1785 for the
1786 .BR printf (3)
1787 family of functions
1788 is expanded by the macros
1789 .BR PRIuPTR ,
1790 .BR PRIoPTR ,
1791 .BR PRIxPTR ,
1793 .B PRIXPTR
1794 (defined in
1795 .IR <inttypes.h> );
1796 resulting commonly in
1797 .B %"PRIuPTR"
1799 .B %"PRIxPTR"
1800 for printing
1801 .I uintptr_t
1802 values.
1803 The length modifier for
1804 .I uintptr_t
1805 for the
1806 .BR scanf (3)
1807 family of functions
1808 is expanded by the macros
1809 .BR SCNuPTR,
1810 .BR SCNoPTR,
1811 .BR SCNxPTR ,
1813 .B SCNXPTR
1814 (defined in
1815 .IR <inttypes.h> );
1816 resulting commonly in
1817 .B %"SCNuPTR"
1819 .B %"SCNxPTR"
1820 for scanning
1821 .I uintptr_t
1822 values.
1824 .IR "Conforming to" :
1825 C99 and later; POSIX.1-2001 and later.
1827 .IR "See also" :
1829 .I intptr_t
1831 .I void *
1832 types in this page.
1834 .\"------------------------------------- va_list ----------------------/
1836 .I va_list
1838 .IR Include :
1839 .IR <stdarg> .
1840 Alternatively,
1841 .IR <stdio.h> ,
1843 .IR <wchar.h> .
1845 Used by functions with a varying number of arguments of varying types.
1846 The function must declare an object of type
1847 .I va_list
1848 which is used by the macros
1849 .BR va_start (3),
1850 .BR va_arg (3),
1851 .BR va_copy (3),
1853 .BR va_end (3)
1854 to traverse the list of arguments.
1856 .IR "Conforming to" :
1857 C99 and later; POSIX.1-2001 and later.
1859 .IR "See also" :
1860 .BR va_start (3),
1861 .BR va_arg (3),
1862 .BR va_copy (3),
1863 .BR va_end (3)
1865 .\"------------------------------------- void * -----------------------/
1867 .I void *
1869 According to the C language standard,
1870 a pointer to any object type may be converted to a pointer to
1871 .I void
1872 and back.
1873 POSIX further requires that any pointer,
1874 including pointers to functions,
1875 may be converted to a pointer to
1876 .I void
1877 and back.
1879 Conversions from and to any other pointer type are done implicitly,
1880 not requiring casts at all.
1881 Note that this feature prevents any kind of type checking:
1882 the programmer should be careful not to convert a
1883 .I void *
1884 value to a type incompatible to that of the underlying data,
1885 because that would result in undefined behavior.
1887 This type is useful in function parameters and return value
1888 to allow passing values of any type.
1889 The function will typically use some mechanism to know
1890 the real type of the data being passed via a pointer to
1891 .IR void .
1893 A value of this type can't be dereferenced,
1894 as it would give a value of type
1895 .IR void ,
1896 which is not possible.
1897 Likewise, pointer arithmetic is not possible with this type.
1898 However, in GNU C, pointer arithmetic is allowed
1899 as an extension to the standard;
1900 this is done by treating the size of a
1901 .I void
1902 or of a function as 1.
1903 A consequence of this is that
1904 .I sizeof
1905 is also allowed on
1906 .I void
1907 and on function types, and returns 1.
1909 The conversion specifier for
1910 .I void *
1911 for the
1912 .BR printf (3)
1913 and the
1914 .BR scanf (3)
1915 families of functions is
1916 .BR p .
1918 .IR Versions :
1919 The POSIX requirement about compatibility between
1920 .I void *
1921 and function pointers was added in
1922 POSIX.1-2008 Technical Corrigendum 1 (2013).
1924 .IR "Conforming to" :
1925 C99 and later; POSIX.1-2001 and later.
1927 .IR "See also" :
1928 .BR malloc (3),
1929 .BR memcmp (3),
1930 .BR memcpy (3),
1931 .BR memset (3)
1933 See also the
1934 .I intptr_t
1936 .I uintptr_t
1937 types in this page.
1939 .\"--------------------------------------------------------------------/
1940 .SH NOTES
1941 The structures described in this manual page shall contain,
1942 at least, the members shown in their definition, in no particular order.
1944 Most of the integer types described in this page don't have
1945 a corresponding length modifier for the
1946 .BR printf (3)
1947 and the
1948 .BR scanf (3)
1949 families of functions.
1950 To print a value of an integer type that doesn't have a length modifier,
1951 it should be converted to
1952 .I intmax_t
1954 .I uintmax_t
1955 by an explicit cast.
1956 To scan into a variable of an integer type
1957 that doesn't have a length modifier,
1958 an intermediate temporary variable of type
1959 .I intmax_t
1961 .I uintmax_t
1962 should be used.
1963 When copying from the temporary variable to the destination variable,
1964 the value could overflow.
1965 If the type has upper and lower limits,
1966 the user should check that the value is within those limits,
1967 before actually copying the value.
1968 The example below shows how these conversions should be done.
1969 .SS Conventions used in this page
1970 In "Conforming to" we only concern ourselves with
1971 C99 and later and POSIX.1-2001 and later.
1972 Some types may be specified in earlier versions of one of these standards,
1973 but in the interests of simplicity we omit details from earlier standards.
1975 In "Include", we first note the "primary" header(s) that
1976 define the type according to either the C or POSIX.1 standards.
1977 Under "Alternatively", we note additional headers that
1978 the standards specify shall define the type.
1979 .SH EXAMPLES
1980 The program shown below scans from a string and prints a value stored in
1981 a variable of an integer type that doesn't have a length modifier.
1982 The appropriate conversions from and to
1983 .IR intmax_t ,
1984 and the appropriate range checks,
1985 are used as explained in the notes section above.
1988 #include <stdint.h>
1989 #include <stdio.h>
1990 #include <stdlib.h>
1991 #include <sys/types.h>
1994 main (void)
1996     static const char *const str = "500000 us in half a second";
1997     suseconds_t us;
1998     intmax_t    tmp;
2000     /* Scan the number from the string into the temporary variable. */
2002     sscanf(str, "%jd", &tmp);
2004     /* Check that the value is within the valid range of suseconds_t. */
2006     if (tmp < \-1 || tmp > 1000000) {
2007         fprintf(stderr, "Scanned value outside valid range!\en");
2008         exit(EXIT_FAILURE);
2009     }
2011     /* Copy the value to the suseconds_t variable \(aqus\(aq. */
2013     us = tmp;
2015     /* Even though suseconds_t can hold the value \-1, this isn\(aqt
2016        a sensible number of microseconds. */
2018     if (us < 0) {
2019         fprintf(stderr, "Scanned value shouldn\(aqt be negative!\en");
2020         exit(EXIT_FAILURE);
2021     }
2023     /* Print the value. */
2025     printf("There are %jd microseconds in half a second.\en",
2026             (intmax_t) us);
2028     exit(EXIT_SUCCESS);
2031 .SH SEE ALSO
2032 .BR feature_test_macros (7),
2033 .BR standards (7)