Debian Codegraph @

upstream/debian-unstable/man7/system_data_types.7

raw
1 .\" Copyright 2020, Michael Kerrisk <[email protected]>
2 .\" Copyright, the authors of the Linux man-pages project
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .TH system_data_types 7 2026-02-08 "Linux man-pages 6.18"
7 .SH NAME
8 system_data_types \- overview of system data types
9 .SH DESCRIPTION
10 .\" Layout:
11 .\" A list of type names (the struct/union keyword will be omitted).
12 .\" Each entry will have the following parts:
13 .\" * Include (see NOTES)
14 .\"
15 .\" * Definition (no "Definition" header)
16 .\" Only struct/union types will have definition;
17 .\" typedefs will remain opaque.
18 .\"
19 .\" * Description (no "Description" header)
20 .\" A few lines describing the type.
21 .\"
22 .\" * Versions (optional)
23 .\"
24 .\" * Conforming to (see NOTES)
25 .\" Format: CXY and later; POSIX.1-XXXX and later.
26 .\"
27 .\" * Notes (optional)
28 .\"
29 .\" * Bugs (if any)
30 .\"
31 .\" * See also
32 .\"------------------------------------- aiocb ------------------------/
33 .\"------------------------------------- blkcnt_t ---------------------/
34 .\"------------------------------------- blksize_t --------------------/
35 .\"------------------------------------- cc_t -------------------------/
36 .\"------------------------------------- clock_t ----------------------/
37 .\"------------------------------------- clockid_t --------------------/
38 .\"------------------------------------- dev_t ------------------------/
39 .\"------------------------------------- div_t ------------------------/
40 .\"------------------------------------- double_t ---------------------/
41 .\"------------------------------------- fd_set -----------------------/
42 .\"------------------------------------- fenv_t -----------------------/
43 .\"------------------------------------- fexcept_t --------------------/
44 .\"------------------------------------- FILE -------------------------/
45 .\"------------------------------------- float_t ----------------------/
46 .\"------------------------------------- gid_t ------------------------/
47 .\"------------------------------------- id_t -------------------------/
48 .\"------------------------------------- imaxdiv_t --------------------/
49 .\"------------------------------------- intmax_t ---------------------/
50 .\"------------------------------------- intN_t -----------------------/
51 .\"------------------------------------- intptr_t ---------------------/
52 .\"------------------------------------- lconv ------------------------/
53 .\"------------------------------------- ldiv_t -----------------------/
54 .\"------------------------------------- lldiv_t ----------------------/
55 .\"------------------------------------- mode_t -----------------------/
56 .\"------------------------------------- off64_t ----------------------/
57 .\"------------------------------------- off_t ------------------------/
58 .\"------------------------------------- pid_t ------------------------/
59 .\"------------------------------------- ptrdiff_t --------------------/
60 .\"------------------------------------- regex_t ----------------------/
61 .\"------------------------------------- regmatch_t -------------------/
62 .\"------------------------------------- regoff_t ---------------------/
63 .\"------------------------------------- sigevent ---------------------/
64 .\"------------------------------------- siginfo_t --------------------/
65 .TP
66 .I siginfo_t
67 .RS
68 .IR Include :
69 .IR <signal.h> .
70 Alternatively,
71 .IR <sys/wait.h> .
72 .P
73 .EX
74 typedef struct {
75 int si_signo; /* Signal number */
76 int si_code; /* Signal code */
77 pid_t si_pid; /* Sending process ID */
78 uid_t si_uid; /* Real user ID of sending process */
79 void *si_addr; /* Memory location which caused fault */
80 int si_status; /* Exit value or signal */
81 union sigval si_value; /* Signal value */
82 } siginfo_t;
83 .EE
84 .P
85 Information associated with a signal.
86 For further details on this structure
87 (including additional, Linux-specific fields), see
88 .BR sigaction (2).
89 .P
90 .IR "Conforming to" :
91 POSIX.1-2001 and later.
92 .P
93 .IR "See also" :
94 .BR pidfd_send_signal (2),
95 .BR rt_sigqueueinfo (2),
96 .BR sigaction (2),
97 .BR sigwaitinfo (2),
98 .BR psiginfo (3)
99 .RE
100 .\"------------------------------------- sigset_t ---------------------/
101 .TP
102 .I sigset_t
103 .RS
104 .IR Include :
105 .IR <signal.h> .
106 Alternatively,
107 .IR <spawn.h> ,
108 or
109 .IR <sys/select.h> .
110 .P
111 This is a type that represents a set of signals.
112 According to POSIX, this shall be an integer or structure type.
113 .P
114 .IR "Conforming to" :
115 POSIX.1-2001 and later.
116 .P
117 .IR "See also" :
118 .BR epoll_pwait (2),
119 .BR ppoll (2),
120 .BR pselect (2),
121 .BR sigaction (2),
122 .BR signalfd (2),
123 .BR sigpending (2),
124 .BR sigprocmask (2),
125 .BR sigsuspend (2),
126 .BR sigwaitinfo (2),
127 .BR signal (7)
128 .RE
129 .\"------------------------------------- sigval -----------------------/
130 .\"------------------------------------- size_t -----------------------/
131 .\"------------------------------------- sockaddr ---------------------/
132 .\"------------------------------------- socklen_t --------------------/
133 .\"------------------------------------- ssize_t ----------------------/
134 .\"------------------------------------- stat -------------------------/
135 .\"------------------------------------- suseconds_t ------------------/
136 .\"------------------------------------- time_t -----------------------/
137 .\"------------------------------------- timer_t ----------------------/
138 .\"------------------------------------- timespec ---------------------/
139 .\"------------------------------------- timeval ----------------------/
140 .\"------------------------------------- uid_t ----------------------/
141 .\"------------------------------------- uintmax_t --------------------/
142 .\"------------------------------------- uintN_t ----------------------/
143 .\"------------------------------------- uintptr_t --------------------/
144 .\"------------------------------------- useconds_t -------------------/
145 .\"------------------------------------- va_list ----------------------/
146 .\"------------------------------------- void * -----------------------/
147 .\"--------------------------------------------------------------------/
148 .SH NOTES
149 The structures described in this manual page shall contain,
150 at least, the members shown in their definition, in no particular order.
151 .P
152 Most of the integer types described in this page don't have
153 a corresponding length modifier for the
154 .BR printf (3)
155 and the
156 .BR scanf (3)
157 families of functions.
158 To print a value of an integer type that doesn't have a length modifier,
159 it should be converted to
160 .I intmax_t
161 or
162 .I uintmax_t
163 by an explicit cast.
164 To scan into a variable of an integer type
165 that doesn't have a length modifier,
166 an intermediate temporary variable of type
167 .I intmax_t
168 or
169 .I uintmax_t
170 should be used.
171 When copying from the temporary variable to the destination variable,
172 the value could overflow.
173 If the type has upper and lower limits,
174 the user should check that the value is within those limits,
175 before actually copying the value.
176 The example below shows how these conversions should be done.
177 .SS Conventions used in this page
178 In "Conforming to" we only concern ourselves with
179 C99 and later and POSIX.1-2001 and later.
180 Some types may be specified in earlier versions of one of these standards,
181 but in the interests of simplicity we omit details from earlier standards.
182 .P
183 In "Include", we first note the "primary" header(s) that
184 define the type according to either the C or POSIX.1 standards.
185 Under "Alternatively", we note additional headers that
186 the standards specify shall define the type.
187 .SH EXAMPLES
188 The program shown below scans from a string and prints a value stored in
189 a variable of an integer type that doesn't have a length modifier.
190 The appropriate conversions from and to
191 .IR intmax_t ,
192 and the appropriate range checks,
193 are used as explained in the notes section above.
194 .P
195 .EX
196 #include <stdint.h>
197 #include <stdio.h>
198 #include <stdlib.h>
199 #include <sys/types.h>
200 \&
201 int
202 main (void)
203 {
204 static const char *const str = "500000 us in half a second";
205 suseconds_t us;
206 intmax_t tmp;
207 \&
208 /* Scan the number from the string into the temporary variable. */
209 \&
210 sscanf(str, "%jd", &tmp);
211 \&
212 /* Check that the value is within the valid range of suseconds_t. */
213 \&
214 if (tmp < \-1 || tmp > 1000000) {
215 fprintf(stderr, "Scanned value outside valid range!\[rs]n");
216 exit(EXIT_FAILURE);
217 }
218 \&
219 /* Copy the value to the suseconds_t variable \[aq]us\[aq]. */
220 \&
221 us = tmp;
222 \&
223 /* Even though suseconds_t can hold the value \-1, this isn\[aq]t
224 a sensible number of microseconds. */
225 \&
226 if (us < 0) {
227 fprintf(stderr, "Scanned value shouldn\[aq]t be negative!\[rs]n");
228 exit(EXIT_FAILURE);
229 }
230 \&
231 /* Print the value. */
232 \&
233 printf("There are %jd microseconds in half a second.\[rs]n",
234 (intmax_t) us);
235 \&
236 exit(EXIT_SUCCESS);
237 }
238 .EE
239 .SH SEE ALSO
240 .BR feature_test_macros (7),
241 .BR standards (7)