File make added (mode: 100755) (index 0000000..41e3bcf) |
|
1 |
|
#!/bin/sh |
|
2 |
|
|
|
3 |
|
#this script is brutal and verbose, has no tricks and is quite linear, then |
|
4 |
|
#quite easy to deal with |
|
5 |
|
#for the moment, it's hardcoded for a gcc toolchain... BAD! Since now |
|
6 |
|
#gcc is a c++ piece of shit |
|
7 |
|
|
|
8 |
|
# stolen from ffmpeg configure like a pig |
|
9 |
|
set -e |
|
10 |
|
|
|
11 |
|
# prevent locale nonsense from breaking basic text processing |
|
12 |
|
LC_ALL=C |
|
13 |
|
export LC_ALL |
|
14 |
|
|
|
15 |
|
# libtool versioning |
|
16 |
|
libuuid_api=1 |
|
17 |
|
libuuid_rev=3 |
|
18 |
|
libuuid_age=0 |
|
19 |
|
libuuid_so_version=${libuuid_api}.${libuuid_rev}.${libuuid_age} |
|
20 |
|
fake_root=fake_root |
|
21 |
|
#------------------------------------------------------------------------------- |
|
22 |
|
|
|
23 |
|
# it's benign here, but keep in mind it does define the order of static linking |
|
24 |
|
# which is important for proper symbol selection |
|
25 |
|
libuuid_src_files=' |
|
26 |
|
src/clear.c |
|
27 |
|
src/compare.c |
|
28 |
|
src/copy.c |
|
29 |
|
src/gen_uuid.c |
|
30 |
|
src/isnull.c |
|
31 |
|
src/pack.c |
|
32 |
|
src/parse.c |
|
33 |
|
src/unpack.c |
|
34 |
|
src/unparse.c |
|
35 |
|
src/uuid_time.c |
|
36 |
|
src/randutils.c |
|
37 |
|
' |
|
38 |
|
|
|
39 |
|
# it's benign here, but keep in mind it does define the order of static linking |
|
40 |
|
# which is important for proper symbol selection |
|
41 |
|
uuidgen_src_files=' |
|
42 |
|
src/uuidgen.c |
|
43 |
|
' |
|
44 |
|
#------------------------------------------------------------------------------- |
|
45 |
|
|
|
46 |
|
sep_start() |
|
47 |
|
{ |
|
48 |
|
printf '###############################################################################\n' |
|
49 |
|
} |
|
50 |
|
|
|
51 |
|
sep_end() |
|
52 |
|
{ |
|
53 |
|
printf '###############################################################################\n\n' |
|
54 |
|
} |
|
55 |
|
|
|
56 |
|
subsep_start() |
|
57 |
|
{ |
|
58 |
|
printf '*******************************************************************************\n' |
|
59 |
|
} |
|
60 |
|
|
|
61 |
|
subsep_end() |
|
62 |
|
{ |
|
63 |
|
printf '*******************************************************************************\n' |
|
64 |
|
} |
|
65 |
|
|
|
66 |
|
################################################################################ |
|
67 |
|
|
|
68 |
|
sep_start;echo 'looking for source path:' |
|
69 |
|
if test -f make; then |
|
70 |
|
src_path=. |
|
71 |
|
else |
|
72 |
|
src_path=$(cd $(dirname "$0"); pwd) |
|
73 |
|
echo "$src_path" | grep -q '[[:blank:]]' && |
|
74 |
|
die "out of tree builds are impossible with whitespace in source path." |
|
75 |
|
test -e "$src_path/config.h" && |
|
76 |
|
die "out of tree builds are impossible with config.h in source dir." |
|
77 |
|
fi |
|
78 |
|
echo "source path is $src_path";sep_end |
|
79 |
|
|
|
80 |
|
################################################################################ |
|
81 |
|
|
|
82 |
|
is_in() |
|
83 |
|
{ |
|
84 |
|
value=$1 |
|
85 |
|
shift |
|
86 |
|
for var in $*; do |
|
87 |
|
[ $var = $value ] && return 0 |
|
88 |
|
done |
|
89 |
|
return 1 |
|
90 |
|
} |
|
91 |
|
|
|
92 |
|
die_unknown() |
|
93 |
|
{ |
|
94 |
|
echo "Unknown option \"$1\"." |
|
95 |
|
echo "See $0 --help for available options." |
|
96 |
|
exit 1 |
|
97 |
|
} |
|
98 |
|
|
|
99 |
|
set_default() |
|
100 |
|
{ |
|
101 |
|
for opt; do |
|
102 |
|
eval : \${$opt:=\$${opt}_default} |
|
103 |
|
done |
|
104 |
|
} |
|
105 |
|
|
|
106 |
|
CMDLINE_SET=' |
|
107 |
|
bin_cc |
|
108 |
|
bin_ccld |
|
109 |
|
libuuid_cc |
|
110 |
|
libuuid_ar |
|
111 |
|
dbin_cc |
|
112 |
|
dbin_ccld |
|
113 |
|
slibuuid_cc |
|
114 |
|
slibuuid_ccld |
|
115 |
|
prefix |
|
116 |
|
eprefix |
|
117 |
|
bindir |
|
118 |
|
libdir |
|
119 |
|
includedir |
|
120 |
|
sysconfdir |
|
121 |
|
localstatedir |
|
122 |
|
pkglibexecdir |
|
123 |
|
version |
|
124 |
|
' |
|
125 |
|
|
|
126 |
|
################################################################################ |
|
127 |
|
|
|
128 |
|
#command line set defaults |
|
129 |
|
#------------------------------------------------------------------------------- |
|
130 |
|
bin_cc_default='gcc -Wall -Wextra -std=gnu99 -O2 -c' |
|
131 |
|
bin_ccld_default='gcc -static' |
|
132 |
|
|
|
133 |
|
libuuid_cc_default='gcc -Wall -Wextra -std=gnu99 -O2 -fPIC -c' |
|
134 |
|
libuuid_ar_default="ar rcs" |
|
135 |
|
|
|
136 |
|
dbin_cc_default='gcc -Wall -Wextra -std=gnu99 -O2 -c' |
|
137 |
|
dbin_ccld_default='gcc -Wl,--as-needed' |
|
138 |
|
|
|
139 |
|
slibuuid_cc_default="gcc -Wall -Wextra \ |
|
140 |
|
-std=gnu99 -O2 -fPIC -c |
|
141 |
|
" |
|
142 |
|
slibuuid_ccld_default="gcc -shared \ |
|
143 |
|
-Wl,--version-script=$src_path/libuuid.sym \ |
|
144 |
|
-Wl,-soname,libuuid.so.$libuuid_api \ |
|
145 |
|
-Wl,--as-needed \ |
|
146 |
|
" |
|
147 |
|
#------------------------------------------------------------------------------- |
|
148 |
|
|
|
149 |
|
prefix_default=/usr/local |
|
150 |
|
eprefix_default='$prefix' |
|
151 |
|
bindir_default='$prefix/bin' |
|
152 |
|
libdir_default='$eprefix/lib' |
|
153 |
|
includedir_default='$prefix/include' |
|
154 |
|
sysconfdir_default='$prefix/etc' |
|
155 |
|
localstatedir_default='$prefix/var' |
|
156 |
|
pkglibexecdir_default='$libdir/udev' |
|
157 |
|
version_default=24 |
|
158 |
|
set_default $CMDLINE_SET |
|
159 |
|
|
|
160 |
|
libuuid_only=no |
|
161 |
|
disable_static=no |
|
162 |
|
disable_dynamic=no |
|
163 |
|
|
|
164 |
|
################################################################################ |
|
165 |
|
|
|
166 |
|
|
|
167 |
|
################################################################################ |
|
168 |
|
|
|
169 |
|
show_help(){ |
|
170 |
|
cat <<EOF |
|
171 |
|
Usage: make [options] |
|
172 |
|
|
|
173 |
|
default is to build libuuid and uuidgen |
|
174 |
|
|
|
175 |
|
Options: [defaults in brackets after descriptions] |
|
176 |
|
|
|
177 |
|
Help options: |
|
178 |
|
--help print this message |
|
179 |
|
|
|
180 |
|
Standard options: |
|
181 |
|
--libuuid-only build only libblkid |
|
182 |
|
--disable-static disable the build of static lib and static binary |
|
183 |
|
--disable-shared disable the build of shared lib and dynamic binary |
|
184 |
|
|
|
185 |
|
--prefix=PREFIX architecture independent prefix [$prefix_default] |
|
186 |
|
--eprefix=EPREFIX architecture dependent exec prefix [$eprefix_default] |
|
187 |
|
--libdir=DIR object code libraries [$libdir_default] |
|
188 |
|
--includedir=DIR C header files [$includedir_default] |
|
189 |
|
--sysconfdir=DIR read-only single-machine data [$sysconfdir_default] |
|
190 |
|
--localstatedir=DIR modifiable single-machine data [$localstatedir_default] |
|
191 |
|
--pkglibexecdir=DIR program executables [$pkglibexecdir_default] |
|
192 |
|
|
|
193 |
|
--version=VERSION override the version number [$version_default] |
|
194 |
|
|
|
195 |
|
--man build man pages |
|
196 |
|
|
|
197 |
|
Advanced options: |
|
198 |
|
--bin-cc=CC use C compiler command line CC for static target uuidgen [$bin_cc_default] |
|
199 |
|
--bin-ccld=CCLD use linker command line CCLD for static target uuidgen [$bin_ccld_default] |
|
200 |
|
|
|
201 |
|
--dbin-cc=CC use C compiler command line CC for dynamic target uuidgen [$dbin_cc_default] |
|
202 |
|
--dbin-ccld=CCLD use linker command line CCLD for dynamic target uuidgen [$dbin_ccld_default] |
|
203 |
|
|
|
204 |
|
--libuuid-cc=CC use C compiler command line CC for static target libuuid [$libuuid_cc_default] |
|
205 |
|
--libuuid-ar=AR use archive command line AR for static target libuuid [$libuuid_ar_default] |
|
206 |
|
|
|
207 |
|
--slibuuid-cc=CC use C compiler command line CC for shared target libuuid [$slibuuid_cc_default] |
|
208 |
|
--slibuuid-ccld=CCLD use linker command line CCLD for shared target libuuid [$slibuuid_ccld_default] |
|
209 |
|
EOF |
|
210 |
|
exit 0 |
|
211 |
|
} |
|
212 |
|
|
|
213 |
|
################################################################################ |
|
214 |
|
|
|
215 |
|
for opt do |
|
216 |
|
optval="${opt#*=}" |
|
217 |
|
case "$opt" in |
|
218 |
|
--help|-h) show_help |
|
219 |
|
;; |
|
220 |
|
--libuuid-only) |
|
221 |
|
libuuid_only=yes |
|
222 |
|
;; |
|
223 |
|
--disable-static) |
|
224 |
|
disable_static=yes |
|
225 |
|
;; |
|
226 |
|
--disable-dynamic) |
|
227 |
|
disable_dynamic=yes |
|
228 |
|
;; |
|
229 |
|
--man) |
|
230 |
|
MAN=yes |
|
231 |
|
;; |
|
232 |
|
*) |
|
233 |
|
optname=${opt%%=*} |
|
234 |
|
optname=${optname#--} |
|
235 |
|
optname=$(echo "$optname" | sed 's/-/_/g') |
|
236 |
|
if is_in $optname $CMDLINE_SET; then |
|
237 |
|
eval $optname='$optval' |
|
238 |
|
else |
|
239 |
|
die_unknown $opt |
|
240 |
|
fi |
|
241 |
|
;; |
|
242 |
|
esac |
|
243 |
|
done |
|
244 |
|
|
|
245 |
|
################################################################################ |
|
246 |
|
|
|
247 |
|
path_expand() |
|
248 |
|
{ |
|
249 |
|
e_v=$1 |
|
250 |
|
#we set a maximum expansion depth of 3 |
|
251 |
|
for d in 1 2 3 |
|
252 |
|
do |
|
253 |
|
e_v=$(eval echo "$e_v") |
|
254 |
|
done |
|
255 |
|
#get rid of ugly double // in path |
|
256 |
|
echo "$e_v" | sed -e 's%//%/%g' |
|
257 |
|
} |
|
258 |
|
|
|
259 |
|
sep_start;echo 'expanding final paths:' |
|
260 |
|
e_prefix=$(path_expand "$prefix") |
|
261 |
|
e_eprefix=$(path_expand "$eprefix") |
|
262 |
|
e_bindir=$(path_expand "$bindir") |
|
263 |
|
e_libdir=$(path_expand "$libdir") |
|
264 |
|
e_includedir=$(path_expand "$includedir") |
|
265 |
|
e_sysconfdir=$(path_expand "$sysconfdir") |
|
266 |
|
e_localstatedir=$(path_expand "$localstatedir") |
|
267 |
|
e_pkglibexecdir=$(path_expand "$pkglibexecdir") |
|
268 |
|
echo "prefix=$e_prefix" |
|
269 |
|
echo "eprefix=$e_eprefix" |
|
270 |
|
echo "bin=$e_bindir" |
|
271 |
|
echo "libdir=$e_libdir" |
|
272 |
|
echo "includedir=$e_includedir" |
|
273 |
|
echo "sysconfdir=$e_sysconfdir" |
|
274 |
|
echo "localstatedir=$e_localstatedir" |
|
275 |
|
echo "pkglibexecdir=$e_pkglibexecdir" |
|
276 |
|
sep_end |
|
277 |
|
|
|
278 |
|
################################################################################ |
|
279 |
|
|
|
280 |
|
mkdir -p -- ./src |
|
281 |
|
printf "#ifndef PATH_H\n#define PATH_H\n#define _PATH_LOCALSTATEDIR \"%b\"\n#endif" "$e_localstatedir" >./src/uuid_paths.h |
|
282 |
|
|
|
283 |
|
################################################################################ |
|
284 |
|
|
|
285 |
|
. $src_path/make.libuuid.sh |
|
286 |
|
if test x$libuuid_only != xyes; then |
|
287 |
|
. $src_path/make.uuidgen.sh |
|
288 |
|
fi |
|
289 |
|
|
|
290 |
|
################################################################################ |
|
291 |
|
|
|
292 |
|
|
|
293 |
|
|
|
294 |
|
|
|
295 |
|
exit |
|
296 |
|
|
|
297 |
|
|
|
298 |
|
|
|
299 |
|
libudev_api=0 |
|
300 |
|
fake_root=fake_root |
|
301 |
|
|
|
302 |
|
#------------------------------------------------------------------------------- |
|
303 |
|
libudev_src_files=' |
|
304 |
|
libudev.c |
|
305 |
|
libudev-device.c |
|
306 |
|
libudev-device-private.c |
|
307 |
|
libudev-enumerate.c |
|
308 |
|
libudev-list.c |
|
309 |
|
libudev-monitor.c |
|
310 |
|
libudev-queue.c |
|
311 |
|
libudev-queue-private.c |
|
312 |
|
libudev-util.c |
|
313 |
|
libudev-util-private.c |
|
314 |
|
' |
|
315 |
|
|
|
316 |
|
udevd_common_src_files=' |
|
317 |
|
udev-event.c |
|
318 |
|
udev-watch.c |
|
319 |
|
udev-node.c |
|
320 |
|
udev-rules.c |
|
321 |
|
udev-ctrl.c |
|
322 |
|
udev-builtin.c |
|
323 |
|
udev-builtin-blkid.c |
|
324 |
|
udev-builtin-hwdb.c |
|
325 |
|
udev-builtin-input_id.c |
|
326 |
|
udev-builtin-kmod.c |
|
327 |
|
udev-builtin-path_id.c |
|
328 |
|
udev-builtin-usb_id.c |
|
329 |
|
' |
|
330 |
|
|
|
331 |
|
udevd_src_files=' |
|
332 |
|
udevd.c |
|
333 |
|
' |
|
334 |
|
|
|
335 |
|
udevadm_src_files=' |
|
336 |
|
udevadm.c |
|
337 |
|
udevadm-info.c |
|
338 |
|
udevadm-control.c |
|
339 |
|
udevadm-monitor.c |
|
340 |
|
udevadm-settle.c |
|
341 |
|
udevadm-trigger.c |
|
342 |
|
udevadm-test.c |
|
343 |
|
udevadm-test-builtin.c |
|
344 |
|
' |
|
345 |
|
|
|
346 |
|
#------------------------------------------------------------------------------- |
|
347 |
|
|
|
348 |
|
clean_do() |
|
349 |
|
{ |
|
350 |
|
all_src_files="$libudev_src_files $udevd_common_src_files $udevd_src_files $udevadm_src_files" |
|
351 |
|
|
|
352 |
|
rm -Rf "$fake_root" |
|
353 |
|
for src_file in $all_src_files |
|
354 |
|
do |
|
355 |
|
pp_file=${src_file%.c} |
|
356 |
|
pp_file=${pp_file}.pp.c |
|
357 |
|
rm -f ${pp_file} |
|
358 |
|
o_file=${src_file%.c} |
|
359 |
|
o_file=${o_file}.o |
|
360 |
|
rm -f ${o_file} |
|
361 |
|
#clean directories, but keep root of build tree |
|
362 |
|
tgt_dir=$(dirname $src_file) |
|
363 |
|
if test -d $tgt_dir -a "$tgt_dir" != "."; then |
|
364 |
|
rmdir --ignore-fail-on-non-empty -p $tgt_dir |
|
365 |
|
fi |
|
366 |
|
done |
|
367 |
|
exit 0 |
|
368 |
|
} |
|
369 |
|
|
|
370 |
|
sep_start() |
|
371 |
|
{ |
|
372 |
|
printf '###############################################################################\n' |
|
373 |
|
} |
|
374 |
|
|
|
375 |
|
sep_end() |
|
376 |
|
{ |
|
377 |
|
printf '###############################################################################\n\n' |
|
378 |
|
} |
|
379 |
|
|
|
380 |
|
subsep_start() |
|
381 |
|
{ |
|
382 |
|
printf '*******************************************************************************\n' |
|
383 |
|
} |
|
384 |
|
|
|
385 |
|
subsep_end() |
|
386 |
|
{ |
|
387 |
|
printf '*******************************************************************************\n' |
|
388 |
|
} |
|
389 |
|
|
|
390 |
|
################################################################################ |
|
391 |
|
|
|
392 |
|
is_in(){ |
|
393 |
|
value=$1 |
|
394 |
|
shift |
|
395 |
|
for var in $*; do |
|
396 |
|
[ $var = $value ] && return 0 |
|
397 |
|
done |
|
398 |
|
return 1 |
|
399 |
|
} |
|
400 |
|
|
|
401 |
|
die_unknown(){ |
|
402 |
|
echo "Unknown option \"$1\"." |
|
403 |
|
echo "See $0 --help for available options." |
|
404 |
|
exit 1 |
|
405 |
|
} |
|
406 |
|
|
|
407 |
|
set_default(){ |
|
408 |
|
for opt; do |
|
409 |
|
eval : \${$opt:=\$${opt}_default} |
|
410 |
|
done |
|
411 |
|
} |
|
412 |
|
|
|
413 |
|
CMDLINE_SET=' |
|
414 |
|
bin_cpp |
|
415 |
|
bin_cc |
|
416 |
|
bin_ccld |
|
417 |
|
libudev_cpp |
|
418 |
|
libudev_cc |
|
419 |
|
libudev_ar |
|
420 |
|
dbin_cpp |
|
421 |
|
dbin_cc |
|
422 |
|
dbin_ccld |
|
423 |
|
slibudev_cpp |
|
424 |
|
slibudev_cc |
|
425 |
|
slibudev_ccld |
|
426 |
|
prefix |
|
427 |
|
eprefix |
|
428 |
|
libdir |
|
429 |
|
includedir |
|
430 |
|
sysconfdir |
|
431 |
|
pkglibexecdir |
|
432 |
|
usb_database |
|
433 |
|
pci_database |
|
434 |
|
version |
|
435 |
|
' |
|
436 |
|
|
|
437 |
|
################################################################################ |
|
438 |
|
|
|
439 |
|
#command line set defaults |
|
440 |
|
#------------------------------------------------------------------------------- |
|
441 |
|
#This defaults are for gcc, tested with version 4.7.3. You will need to |
|
442 |
|
#override those for you compiler (tinycc/open64/pcc...). Additionnally, source |
|
443 |
|
#support for different toolchains is not done. |
|
444 |
|
#The right way to do it is to have a toolchain abstraction layer since there are |
|
445 |
|
#no accurate enough standards |
|
446 |
|
bin_cpp_default='gcc -E -D_GNU_SOURCE' |
|
447 |
|
bin_cc_default='gcc -Wno-unused-parameter -Wno-missing-field-initializers -std=gnu99 -O2 -c' |
|
448 |
|
bin_ccld_default='gcc -static' |
|
449 |
|
|
|
450 |
|
libudev_cpp_default='gcc -E -D_GNU_SOURCE' |
|
451 |
|
libudev_cc_default='gcc -Wno-unused-parameter -std=gnu99 -O2 -fPIC -c' |
|
452 |
|
libudev_ar_default="ar rcs" |
|
453 |
|
|
|
454 |
|
dbin_cpp_default='gcc -E -D_GNU_SOURCE' |
|
455 |
|
dbin_cc_default='gcc -Wno-unused-parameter -Wno-missing-field-initializers -std=gnu99 -O2 -c' |
|
456 |
|
dbin_ccld_default='gcc' |
|
457 |
|
|
|
458 |
|
slibudev_cpp_default='gcc -E -D_GNU_SOURCE' |
|
459 |
|
slibudev_cc_default='gcc -Wno-unused-parameter -std=gnu99 -O2 -fPIC -c' |
|
460 |
|
slibudev_ccld_default="gcc -shared -Wl,-h,libudev.so.$libudev_api -lc -lrt" |
|
461 |
|
#------------------------------------------------------------------------------- |
|
462 |
|
|
|
463 |
|
prefix_default=/usr/local |
|
464 |
|
eprefix_default='$prefix' |
|
465 |
|
libdir_default='$eprefix/lib' |
|
466 |
|
includedir_default='$prefix/include' |
|
467 |
|
sysconfdir_default='$prefix/etc' |
|
468 |
|
pkglibexecdir_default='$libdir/udev' |
|
469 |
|
#MUST PUT A / AT THE END OR WON'T WORK! |
|
470 |
|
usb_database_default='$prefix/share/hwdata/usb.ids' |
|
471 |
|
pci_database_default='$prefix/share/hwdata/pci.ids' |
|
472 |
|
version_default=189 |
|
473 |
|
set_default $CMDLINE_SET |
|
474 |
|
|
|
475 |
|
libudev_only=no |
|
476 |
|
disable_static=no |
|
477 |
|
disable_dynamic=no |
|
478 |
|
|
|
479 |
|
################################################################################ |
|
480 |
|
|
|
481 |
|
show_help(){ |
|
482 |
|
cat <<EOF |
|
483 |
|
Usage: make [options] [operations] |
|
484 |
|
|
|
485 |
|
Operations: [default is to build libudev, udevd and udevadm]: |
|
486 |
|
clean clean build products |
|
487 |
|
|
|
488 |
|
Options: [defaults in brackets after descriptions] |
|
489 |
|
|
|
490 |
|
Help options: |
|
491 |
|
--help print this message |
|
492 |
|
|
|
493 |
|
Standard options: |
|
494 |
|
--libudev-only build only libudev |
|
495 |
|
--disable-static disable the build of static lib and static binaries |
|
496 |
|
--disable-shared disable the build of shared libs and dynamic binaries |
|
497 |
|
--enable-logging enable logging code paths |
|
498 |
|
--enable-debug enable debug code paths |
|
499 |
|
|
|
500 |
|
--prefix=PREFIX architecture independent prefix [$prefix_default] |
|
501 |
|
--eprefix=EPREFIX architecture dependent exec prefix [$eprefix_default] |
|
502 |
|
--libdir=DIR object code libraries [$libdir_default] |
|
503 |
|
--includedir=DIR C header files [$includedir_default] |
|
504 |
|
--sysconfdir=DIR read-only single-machine data [$sysconfdir_default] |
|
505 |
|
--pkglibexecdir=DIR program executables [$pkglibexecdir_default] |
|
506 |
|
|
|
507 |
|
--usb-database=FILE_PATH the usb database path [$usb_database_default] |
|
508 |
|
--pci-databased=FILE_PATH the pci database path [$pci_database_default] |
|
509 |
|
|
|
510 |
|
--version=VERSION override the version number [$version_default] |
|
511 |
|
|
|
512 |
|
--man build man pages |
|
513 |
|
|
|
514 |
|
Advanced options: |
|
515 |
|
--bin-cpp=CPP use CPP compiler command line CPP for static target binaries [$bin_cpp_default] |
|
516 |
|
--bin-cc=CC use C compiler command line CC for static target binaries [$bin_cc_default] |
|
517 |
|
--bin-ccld=CCLD use linker command line CCLD for static target binaries [$bin_ccld_default] |
|
518 |
|
|
|
519 |
|
--dbin-cpp=CPP use CPP compiler command line CPP for dynamic target binaries [$dbin_cpp_default] |
|
520 |
|
--dbin-cc=CC use C compiler command line CC for dynamic target binaries [$dbin_cc_default] |
|
521 |
|
--dbin-ccld=CCLD use linker command line CCLD for dynamic target binaries [$dbin_ccld_default] |
|
522 |
|
|
|
523 |
|
--libudev-cpp=CPP use CPP compiler command line CPP for static target libudev [$libudev_cpp_default] |
|
524 |
|
--libudev-cc=CC use C compiler command line CC for static target libudev [$libudev_cc_default] |
|
525 |
|
--libudev-ar=AR use archive command line AR for static target libudev [$libudev_ar_default] |
|
526 |
|
|
|
527 |
|
--slibudev-cpp=CPP use CPP compiler command line CPP for shared target libudev [$slibudev_cpp_default] |
|
528 |
|
--slibudev-cc=CC use C compiler command line CC for shared target libudev [$slibudev_cc_default] |
|
529 |
|
--slibudev-ccld=CCLD use linker command line CCLD for shared target libudev [$slibudev_ccld_default] |
|
530 |
|
EOF |
|
531 |
|
exit 0 |
|
532 |
|
} |
|
533 |
|
|
|
534 |
|
################################################################################ |
|
535 |
|
|
|
536 |
|
for opt do |
|
537 |
|
optval="${opt#*=}" |
|
538 |
|
case "$opt" in |
|
539 |
|
clean) clean_do |
|
540 |
|
;; |
|
541 |
|
--help|-h) show_help |
|
542 |
|
;; |
|
543 |
|
--enable-logging) |
|
544 |
|
INTERNAL_CPPFLAGS="$INTERNAL_CPPFLAGS -DENABLE_LOGGING" |
|
545 |
|
;; |
|
546 |
|
--enable-debug) |
|
547 |
|
INTERNAL_CPPFLAGS="$INTERNAL_CPPFLAGS -DENABLE_DEBUG" |
|
548 |
|
;; |
|
549 |
|
--libudev-only) |
|
550 |
|
libudev_only=yes |
|
551 |
|
;; |
|
552 |
|
--disable-static) |
|
553 |
|
disable_static=yes |
|
554 |
|
;; |
|
555 |
|
--disable-dynamic) |
|
556 |
|
disable_dynamic=yes |
|
557 |
|
;; |
|
558 |
|
--man) |
|
559 |
|
MAN=yes |
|
560 |
|
;; |
|
561 |
|
*) |
|
562 |
|
optname=${opt%%=*} |
|
563 |
|
optname=${optname#--} |
|
564 |
|
optname=$(echo "$optname" | sed 's/-/_/g') |
|
565 |
|
if is_in $optname $CMDLINE_SET; then |
|
566 |
|
eval $optname='$optval' |
|
567 |
|
else |
|
568 |
|
die_unknown $opt |
|
569 |
|
fi |
|
570 |
|
;; |
|
571 |
|
esac |
|
572 |
|
done |
|
573 |
|
|
|
574 |
|
################################################################################ |
|
575 |
|
|
|
576 |
|
path_expand() |
|
577 |
|
{ |
|
578 |
|
e_v=$1 |
|
579 |
|
#we set a maximum expansion depth of 3 |
|
580 |
|
for d in 1 2 3 |
|
581 |
|
do |
|
582 |
|
e_v=$(eval echo "$e_v") |
|
583 |
|
done |
|
584 |
|
#get rid of ugly double // in path |
|
585 |
|
echo "$e_v" | sed -e 's%//%/%g' |
|
586 |
|
} |
|
587 |
|
|
|
588 |
|
sep_start;echo 'expanding final paths:' |
|
589 |
|
e_prefix=$(path_expand "$prefix") |
|
590 |
|
e_eprefix=$(path_expand "$eprefix") |
|
591 |
|
e_libdir=$(path_expand "$libdir") |
|
592 |
|
e_includedir=$(path_expand "$includedir") |
|
593 |
|
e_sysconfdir=$(path_expand "$sysconfdir") |
|
594 |
|
e_pkglibexecdir=$(path_expand "$pkglibexecdir") |
|
595 |
|
e_usb_database=$(path_expand "$usb_database") |
|
596 |
|
e_pci_database=$(path_expand "$pci_database") |
|
597 |
|
echo "prefix=$e_prefix" |
|
598 |
|
echo "eprefix=$e_eprefix" |
|
599 |
|
echo "libdir=$e_libdir" |
|
600 |
|
echo "includedir=$e_includedir" |
|
601 |
|
echo "sysconfdir=$e_sysconfdir" |
|
602 |
|
echo "pkglibexecdir=$e_pkglibexecdir" |
|
603 |
|
echo "usb_database=$e_usb_database" |
|
604 |
|
echo "pci_database=$e_pci_database" |
|
605 |
|
sep_end |
|
606 |
|
|
|
607 |
|
################################################################################ |
|
608 |
|
|
|
609 |
|
sep_start;echo 'looking for source path:' |
|
610 |
|
if test -f make; then |
|
611 |
|
src_path=. |
|
612 |
|
else |
|
613 |
|
src_path=$(cd $(dirname "$0"); pwd) |
|
614 |
|
echo "$src_path" | grep -q '[[:blank:]]' && |
|
615 |
|
die "out of tree builds are impossible with whitespace in source path." |
|
616 |
|
test -e "$src_path/config.h" && |
|
617 |
|
die "out of tree builds are impossible with config.h in source dir." |
|
618 |
|
fi |
|
619 |
|
echo "source path is $src_path";sep_end |
|
620 |
|
|
|
621 |
|
################################################################################ |
|
622 |
|
|
|
623 |
|
INTERNAL_CPPFLAGS="$INTERNAL_CPPFLAGS -DSYSCONFDIR=\"$e_sysconfdir\"" |
|
624 |
|
INTERNAL_CPPFLAGS="$INTERNAL_CPPFLAGS -DPKGLIBEXECDIR=\"$e_pkglibexecdir\"" |
|
625 |
|
INTERNAL_CPPFLAGS="$INTERNAL_CPPFLAGS -DUSB_DATABASE=\"$e_usb_database\"" |
|
626 |
|
INTERNAL_CPPFLAGS="$INTERNAL_CPPFLAGS -DPCI_DATABASE=\"$e_pci_database\"" |
|
627 |
|
INTERNAL_CPPFLAGS="$INTERNAL_CPPFLAGS -DVERSION=\"$e_version\"" |
|
628 |
|
|
|
629 |
|
################################################################################ |
|
630 |
|
|
|
631 |
|
. $src_path/make.libudev.sh |
|
632 |
|
if test x$libudev_only != xyes; then |
|
633 |
|
. $src_path/make.udevd_all.sh |
|
634 |
|
fi |
|
635 |
|
|
|
636 |
|
################################################################################ |
|
637 |
|
|
|
638 |
|
mkdir -p -- "$fake_root/$e_libdir/pkgconfig" |
|
639 |
|
|
|
640 |
|
if test x$libudev_only != xyes; then |
|
641 |
|
sep_start;echo 'generating pkg-config file for udev' |
|
642 |
|
cp -f $src_path/src/udev.pc.in "$fake_root/$e_libdir/pkgconfig/udev.pc" |
|
643 |
|
sed -i "s%@VERSION@%$version%" "$fake_root/$e_libdir/pkgconfig/udev.pc" |
|
644 |
|
sed -i "s%@pkglibexecdir@%$e_pkglibexecdir%" "$fake_root/$e_libdir/pkgconfig/udev.pc" |
|
645 |
|
sep_end |
|
646 |
|
fi |
|
647 |
|
|
|
648 |
|
sep_start;echo 'generating pkg-config file for libudev' |
|
649 |
|
cp -f $src_path/src/libudev.pc.in "$fake_root/$e_libdir/pkgconfig/libudev.pc" |
|
650 |
|
sed -i "s%@VERSION@%$version%" "$fake_root/$e_libdir/pkgconfig/libudev.pc" |
|
651 |
|
sed -i "s%@prefix@%$e_prefix%" "$fake_root/$e_libdir/pkgconfig/libudev.pc" |
|
652 |
|
sed -i "s%@exec_prefix@%$e_eprefix%" "$fake_root/$e_libdir/pkgconfig/libudev.pc" |
|
653 |
|
sed -i "s%@libdir@%$e_libdir%" "$fake_root/$e_libdir/pkgconfig/libudev.pc" |
|
654 |
|
sed -i "s%@includedir@%$e_includedir%" "$fake_root/$e_libdir/pkgconfig/libudev.pc" |
|
655 |
|
sep_end |
|
656 |
|
|
|
657 |
|
################################################################################ |
|
658 |
|
|
|
659 |
|
if test x$libudev_only != xyes; then |
|
660 |
|
sep_start;echo 'fake installing the system udev rules' |
|
661 |
|
mkdir -p -- "$fake_root/$e_pkglibexecdir" |
|
662 |
|
rm -Rf -- "$fake_root/$e_pkglibexecdir/rules.d" |
|
663 |
|
cp -rf -- "$src_path/rules" "$fake_root/$e_pkglibexecdir/rules.d" |
|
664 |
|
sep_end |
|
665 |
|
fi |
|
666 |
|
|
|
667 |
|
################################################################################ |
|
668 |
|
|
|
669 |
|
if [ -z "$MAN" ]; then |
|
670 |
|
exit 0 |
|
671 |
|
fi |
|
672 |
|
#hardly tested... |
|
673 |
|
sep_start;echo 'generating man pages' |
|
674 |
|
mkdir -p -- "$fake_root/$e_prefix/share/man8" "$fake_root/$e_prefix/share/man7" |
|
675 |
|
xsltproc -o "$fake_root/$e_prefix/share/man7/udev.7" -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl "$src_path/src/udev.xml" |
|
676 |
|
xsltproc -o "$fake_root/$e_prefix/share/man8/udevadm.8" -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl "$src_path/src/udevadm.xml" |
|
677 |
|
xsltproc -o "$fake_root/$e_prefix/share/man8/udevd.8" -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl "$src_path/src/udev.xml" |
|
678 |
|
sep_end |
File src/config.h added (mode: 100644) (index 0000000..5576a08) |
|
1 |
|
/* config.h. Generated from config.h.in by configure. */ |
|
2 |
|
/* config.h.in. Generated from configure.ac by autoheader. */ |
|
3 |
|
|
|
4 |
|
#include "uuid_paths.h" |
|
5 |
|
|
|
6 |
|
/* Define if building universal (internal helper macro) */ |
|
7 |
|
/* #undef AC_APPLE_UNIVERSAL_BUILD */ |
|
8 |
|
|
|
9 |
|
/* Enable agetty --reload feature */ |
|
10 |
|
#define AGETTY_RELOAD 1 |
|
11 |
|
|
|
12 |
|
/* Should chfn and chsh require the user to enter the password? */ |
|
13 |
|
#define CHFN_CHSH_PASSWORD 1 |
|
14 |
|
|
|
15 |
|
/* Path to hwclock adjtime file */ |
|
16 |
|
#define CONFIG_ADJTIME_PATH "/etc/adjtime" |
|
17 |
|
|
|
18 |
|
/* Define to 1 if translation of program messages to the user's native |
|
19 |
|
language is requested. */ |
|
20 |
|
/* #undef ENABLE_NLS */ |
|
21 |
|
|
|
22 |
|
/* search path for fs helpers */ |
|
23 |
|
#define FS_SEARCH_PATH "/sbin:/sbin/fs.d:/sbin/fs:/bin" |
|
24 |
|
|
|
25 |
|
/* Define to 1 if you have the <asm/io.h> header file. */ |
|
26 |
|
/* #undef HAVE_ASM_IO_H */ |
|
27 |
|
|
|
28 |
|
/* Define if btrfs stuff is available */ |
|
29 |
|
#define HAVE_BTRFS_SUPPORT 1 |
|
30 |
|
|
|
31 |
|
/* Define to 1 if you have the <byteswap.h> header file. */ |
|
32 |
|
#define HAVE_BYTESWAP_H 1 |
|
33 |
|
|
|
34 |
|
/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the |
|
35 |
|
CoreFoundation framework. */ |
|
36 |
|
/* #undef HAVE_CFLOCALECOPYCURRENT */ |
|
37 |
|
|
|
38 |
|
/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in |
|
39 |
|
the CoreFoundation framework. */ |
|
40 |
|
/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ |
|
41 |
|
|
|
42 |
|
/* Define to 1 if you have the `clock_gettime' function. */ |
|
43 |
|
#define HAVE_CLOCK_GETTIME 1 |
|
44 |
|
|
|
45 |
|
/* Define to 1 if the system has the type `cpu_set_t'. */ |
|
46 |
|
#define HAVE_CPU_SET_T 1 |
|
47 |
|
|
|
48 |
|
/* Define to 1 if you have the <crypt.h> header file. */ |
|
49 |
|
#define HAVE_CRYPT_H 1 |
|
50 |
|
|
|
51 |
|
/* Define if the GNU dcgettext() function is already present or preinstalled. |
|
52 |
|
*/ |
|
53 |
|
/* #undef HAVE_DCGETTEXT */ |
|
54 |
|
|
|
55 |
|
/* Define to 1 if you have the declaration of `CPU_ALLOC', and to 0 if you |
|
56 |
|
don't. */ |
|
57 |
|
#define HAVE_DECL_CPU_ALLOC 1 |
|
58 |
|
|
|
59 |
|
/* Define to 1 if you have the declaration of `dirfd', and to 0 if you don't. |
|
60 |
|
*/ |
|
61 |
|
/* #undef HAVE_DECL_DIRFD */ |
|
62 |
|
|
|
63 |
|
/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. |
|
64 |
|
*/ |
|
65 |
|
/* #undef HAVE_DECL_TZNAME */ |
|
66 |
|
|
|
67 |
|
/* Define to 1 if you have the declaration of `_NL_TIME_WEEK_1STDAY', and to 0 |
|
68 |
|
if you don't. */ |
|
69 |
|
#define HAVE_DECL__NL_TIME_WEEK_1STDAY 1 |
|
70 |
|
|
|
71 |
|
/* Define to 1 if you have the `dirfd' function. */ |
|
72 |
|
#define HAVE_DIRFD 1 |
|
73 |
|
|
|
74 |
|
/* Define to 1 if `dd_fd' is a member of `DIR'. */ |
|
75 |
|
/* #undef HAVE_DIR_DD_FD */ |
|
76 |
|
|
|
77 |
|
/* Define to 1 if you have the <dlfcn.h> header file. */ |
|
78 |
|
#define HAVE_DLFCN_H 1 |
|
79 |
|
|
|
80 |
|
/* Define to 1 if you have the <endian.h> header file. */ |
|
81 |
|
#define HAVE_ENDIAN_H 1 |
|
82 |
|
|
|
83 |
|
/* Define to 1 if have **environ prototype */ |
|
84 |
|
#define HAVE_ENVIRON_DECL 1 |
|
85 |
|
|
|
86 |
|
/* Define to 1 if you have the `err' function. */ |
|
87 |
|
#define HAVE_ERR 1 |
|
88 |
|
|
|
89 |
|
/* Define to 1 if you have the <errno.h> header file. */ |
|
90 |
|
#define HAVE_ERRNO_H 1 |
|
91 |
|
|
|
92 |
|
/* Define to 1 if you have the `errx' function. */ |
|
93 |
|
#define HAVE_ERRX 1 |
|
94 |
|
|
|
95 |
|
/* Define to 1 if you have the <err.h> header file. */ |
|
96 |
|
#define HAVE_ERR_H 1 |
|
97 |
|
|
|
98 |
|
/* Define to 1 if you have the `explicit_bzero' function. */ |
|
99 |
|
#define HAVE_EXPLICIT_BZERO 1 |
|
100 |
|
|
|
101 |
|
/* Have valid fallocate() function */ |
|
102 |
|
#define HAVE_FALLOCATE 1 |
|
103 |
|
|
|
104 |
|
/* Define to 1 if you have the <fcntl.h> header file. */ |
|
105 |
|
#define HAVE_FCNTL_H 1 |
|
106 |
|
|
|
107 |
|
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ |
|
108 |
|
#define HAVE_FSEEKO 1 |
|
109 |
|
|
|
110 |
|
/* Define to 1 if you have the `fstatat' function. */ |
|
111 |
|
#define HAVE_FSTATAT 1 |
|
112 |
|
|
|
113 |
|
/* Define to 1 if you have the `fsync' function. */ |
|
114 |
|
#define HAVE_FSYNC 1 |
|
115 |
|
|
|
116 |
|
/* Define to 1 if you have the `futimens' function. */ |
|
117 |
|
#define HAVE_FUTIMENS 1 |
|
118 |
|
|
|
119 |
|
/* Define to 1 if you have the `getdomainname' function. */ |
|
120 |
|
#define HAVE_GETDOMAINNAME 1 |
|
121 |
|
|
|
122 |
|
/* Define to 1 if you have the `getdtablesize' function. */ |
|
123 |
|
#define HAVE_GETDTABLESIZE 1 |
|
124 |
|
|
|
125 |
|
/* Define to 1 if you have the `getexecname' function. */ |
|
126 |
|
/* #undef HAVE_GETEXECNAME */ |
|
127 |
|
|
|
128 |
|
/* Define to 1 if you have the `getmntinfo' function. */ |
|
129 |
|
/* #undef HAVE_GETMNTINFO */ |
|
130 |
|
|
|
131 |
|
/* Define to 1 if you have the <getopt.h> header file. */ |
|
132 |
|
#define HAVE_GETOPT_H 1 |
|
133 |
|
|
|
134 |
|
/* Define to 1 if you have the `getrandom' function. */ |
|
135 |
|
#define HAVE_GETRANDOM 1 |
|
136 |
|
|
|
137 |
|
/* Define to 1 if you have the `getrlimit' function. */ |
|
138 |
|
#define HAVE_GETRLIMIT 1 |
|
139 |
|
|
|
140 |
|
/* Define to 1 if you have the `getsgnam' function. */ |
|
141 |
|
#define HAVE_GETSGNAM 1 |
|
142 |
|
|
|
143 |
|
/* Define if the GNU gettext() function is already present or preinstalled. */ |
|
144 |
|
/* #undef HAVE_GETTEXT */ |
|
145 |
|
|
|
146 |
|
/* Define if you have the iconv() function and it works. */ |
|
147 |
|
/* #undef HAVE_ICONV */ |
|
148 |
|
|
|
149 |
|
/* Define to 1 if you have the `inotify_init' function. */ |
|
150 |
|
#define HAVE_INOTIFY_INIT 1 |
|
151 |
|
|
|
152 |
|
/* Define to 1 if you have the `inotify_init1' function. */ |
|
153 |
|
#define HAVE_INOTIFY_INIT1 1 |
|
154 |
|
|
|
155 |
|
/* Define to 1 if you have the <inttypes.h> header file. */ |
|
156 |
|
#define HAVE_INTTYPES_H 1 |
|
157 |
|
|
|
158 |
|
/* Define to 1 if you have the `ioperm' function. */ |
|
159 |
|
#define HAVE_IOPERM 1 |
|
160 |
|
|
|
161 |
|
/* Define to 1 if you have the `iopl' function. */ |
|
162 |
|
#define HAVE_IOPL 1 |
|
163 |
|
|
|
164 |
|
/* Define to 1 if you have the `isnan' function. */ |
|
165 |
|
#define HAVE_ISNAN 1 |
|
166 |
|
|
|
167 |
|
/* Define to 1 if you have the `jrand48' function. */ |
|
168 |
|
#define HAVE_JRAND48 1 |
|
169 |
|
|
|
170 |
|
/* Define to 1 if you have the <langinfo.h> header file. */ |
|
171 |
|
#define HAVE_LANGINFO_H 1 |
|
172 |
|
|
|
173 |
|
/* Define to 1 if you have the <lastlog.h> header file. */ |
|
174 |
|
#define HAVE_LASTLOG_H 1 |
|
175 |
|
|
|
176 |
|
/* Define to 1 if you have the `lchown' function. */ |
|
177 |
|
#define HAVE_LCHOWN 1 |
|
178 |
|
|
|
179 |
|
/* Define to 1 if you have the `audit' library (-laudit). */ |
|
180 |
|
/* #undef HAVE_LIBAUDIT */ |
|
181 |
|
|
|
182 |
|
/* Define to 1 if you have the -lblkid. */ |
|
183 |
|
#define HAVE_LIBBLKID 1 |
|
184 |
|
|
|
185 |
|
/* Define to 1 if you have the `cap-ng' library (-lcap-ng). */ |
|
186 |
|
/* #undef HAVE_LIBCAP_NG */ |
|
187 |
|
|
|
188 |
|
/* Do we need -lcrypt? */ |
|
189 |
|
#define HAVE_LIBCRYPT 1 |
|
190 |
|
|
|
191 |
|
/* Define if libmount available. */ |
|
192 |
|
#define HAVE_LIBMOUNT 1 |
|
193 |
|
|
|
194 |
|
/* Define if ncurses library available */ |
|
195 |
|
#define HAVE_LIBNCURSES 1 |
|
196 |
|
|
|
197 |
|
/* Define if ncursesw library available */ |
|
198 |
|
/* #undef HAVE_LIBNCURSESW */ |
|
199 |
|
|
|
200 |
|
/* Define to 1 if you have the `readline' library (-lreadline). */ |
|
201 |
|
/* #undef HAVE_LIBREADLINE */ |
|
202 |
|
|
|
203 |
|
/* Define if librtas exists */ |
|
204 |
|
/* #undef HAVE_LIBRTAS */ |
|
205 |
|
|
|
206 |
|
/* Define if SELinux is available */ |
|
207 |
|
/* #undef HAVE_LIBSELINUX */ |
|
208 |
|
|
|
209 |
|
/* Define if libsystemd is available */ |
|
210 |
|
/* #undef HAVE_LIBSYSTEMD */ |
|
211 |
|
|
|
212 |
|
/* Define if libtinfo available. */ |
|
213 |
|
/* #undef HAVE_LIBTINFO */ |
|
214 |
|
|
|
215 |
|
/* Define to 1 if you have the `udev' library (-ludev). */ |
|
216 |
|
/* #undef HAVE_LIBUDEV */ |
|
217 |
|
|
|
218 |
|
/* Define if libuser is available */ |
|
219 |
|
/* #undef HAVE_LIBUSER */ |
|
220 |
|
|
|
221 |
|
/* Define to 1 if you have the `utempter' library (-lutempter). */ |
|
222 |
|
/* #undef HAVE_LIBUTEMPTER */ |
|
223 |
|
|
|
224 |
|
/* Define to 1 if you have the `util' library (-lutil). */ |
|
225 |
|
#define HAVE_LIBUTIL 1 |
|
226 |
|
|
|
227 |
|
/* Define to 1 if you have the <libutil.h> header file. */ |
|
228 |
|
/* #undef HAVE_LIBUTIL_H */ |
|
229 |
|
|
|
230 |
|
/* Define to 1 if you have the -luuid. */ |
|
231 |
|
#define HAVE_LIBUUID 1 |
|
232 |
|
|
|
233 |
|
/* Define to 1 if you have the <linux/blkpg.h> header file. */ |
|
234 |
|
#define HAVE_LINUX_BLKPG_H 1 |
|
235 |
|
|
|
236 |
|
/* Define to 1 if you have the <linux/blkzoned.h> header file. */ |
|
237 |
|
#define HAVE_LINUX_BLKZONED_H 1 |
|
238 |
|
|
|
239 |
|
/* Define to 1 if you have the <linux/btrfs.h> header file. */ |
|
240 |
|
#define HAVE_LINUX_BTRFS_H 1 |
|
241 |
|
|
|
242 |
|
/* Define to 1 if you have the <linux/cdrom.h> header file. */ |
|
243 |
|
#define HAVE_LINUX_CDROM_H 1 |
|
244 |
|
|
|
245 |
|
/* Define to 1 if you have the <linux/compiler.h> header file. */ |
|
246 |
|
/* #undef HAVE_LINUX_COMPILER_H */ |
|
247 |
|
|
|
248 |
|
/* Define to 1 if you have the <linux/falloc.h> header file. */ |
|
249 |
|
#define HAVE_LINUX_FALLOC_H 1 |
|
250 |
|
|
|
251 |
|
/* Define to 1 if you have the <linux/fd.h> header file. */ |
|
252 |
|
#define HAVE_LINUX_FD_H 1 |
|
253 |
|
|
|
254 |
|
/* Define to 1 if you have the <linux/gsmmux.h> header file. */ |
|
255 |
|
#define HAVE_LINUX_GSMMUX_H 1 |
|
256 |
|
|
|
257 |
|
/* Define to 1 if you have the <linux/major.h> header file. */ |
|
258 |
|
#define HAVE_LINUX_MAJOR_H 1 |
|
259 |
|
|
|
260 |
|
/* Define to 1 if you have the <linux/raw.h> header file. */ |
|
261 |
|
#define HAVE_LINUX_RAW_H 1 |
|
262 |
|
|
|
263 |
|
/* Define to 1 if you have the <linux/securebits.h> header file. */ |
|
264 |
|
#define HAVE_LINUX_SECUREBITS_H 1 |
|
265 |
|
|
|
266 |
|
/* Define to 1 if you have the <linux/tiocl.h> header file. */ |
|
267 |
|
#define HAVE_LINUX_TIOCL_H 1 |
|
268 |
|
|
|
269 |
|
/* Define to 1 if you have the <linux/version.h> header file. */ |
|
270 |
|
#define HAVE_LINUX_VERSION_H 1 |
|
271 |
|
|
|
272 |
|
/* Define to 1 if you have the <linux/watchdog.h> header file. */ |
|
273 |
|
#define HAVE_LINUX_WATCHDOG_H 1 |
|
274 |
|
|
|
275 |
|
/* Define to 1 if you have the `llseek' function. */ |
|
276 |
|
#define HAVE_LLSEEK 1 |
|
277 |
|
|
|
278 |
|
/* Define to 1 if have llseek prototype */ |
|
279 |
|
/* #undef HAVE_LLSEEK_PROTOTYPE */ |
|
280 |
|
|
|
281 |
|
/* Define to 1 if you have the <locale.h> header file. */ |
|
282 |
|
#define HAVE_LOCALE_H 1 |
|
283 |
|
|
|
284 |
|
/* Define to 1 if the system has the type `loff_t'. */ |
|
285 |
|
#define HAVE_LOFF_T 1 |
|
286 |
|
|
|
287 |
|
/* Define to 1 if you have the `lseek64' function. */ |
|
288 |
|
#define HAVE_LSEEK64 1 |
|
289 |
|
|
|
290 |
|
/* Define to 1 if have lseek64 prototype */ |
|
291 |
|
#define HAVE_LSEEK64_PROTOTYPE 1 |
|
292 |
|
|
|
293 |
|
/* Define to 1 if you have the <memory.h> header file. */ |
|
294 |
|
#define HAVE_MEMORY_H 1 |
|
295 |
|
|
|
296 |
|
/* Define to 1 if you have the `mempcpy' function. */ |
|
297 |
|
#define HAVE_MEMPCPY 1 |
|
298 |
|
|
|
299 |
|
/* Define to 1 if you have the `mkostemp' function. */ |
|
300 |
|
#define HAVE_MKOSTEMP 1 |
|
301 |
|
|
|
302 |
|
/* Define to 1 if you have the <mntent.h> header file. */ |
|
303 |
|
#define HAVE_MNTENT_H 1 |
|
304 |
|
|
|
305 |
|
/* Define to 1 if you have the `nanosleep' function. */ |
|
306 |
|
#define HAVE_NANOSLEEP 1 |
|
307 |
|
|
|
308 |
|
/* Define to 1 if you have the <ncursesw/ncurses.h> header file. */ |
|
309 |
|
/* #undef HAVE_NCURSESW_NCURSES_H */ |
|
310 |
|
|
|
311 |
|
/* Define to 1 if you have the <ncursesw/term.h> header file. */ |
|
312 |
|
/* #undef HAVE_NCURSESW_TERM_H */ |
|
313 |
|
|
|
314 |
|
/* Define to 1 if you have the <ncurses.h> header file. */ |
|
315 |
|
#define HAVE_NCURSES_H 1 |
|
316 |
|
|
|
317 |
|
/* Define to 1 if you have the <ncurses/ncurses.h> header file. */ |
|
318 |
|
/* #undef HAVE_NCURSES_NCURSES_H */ |
|
319 |
|
|
|
320 |
|
/* Define to 1 if you have the <ncurses/term.h> header file. */ |
|
321 |
|
/* #undef HAVE_NCURSES_TERM_H */ |
|
322 |
|
|
|
323 |
|
/* Define to 1 if you have the <netinet/in.h> header file. */ |
|
324 |
|
#define HAVE_NETINET_IN_H 1 |
|
325 |
|
|
|
326 |
|
/* Define to 1 if you have the <net/if_dl.h> header file. */ |
|
327 |
|
/* #undef HAVE_NET_IF_DL_H */ |
|
328 |
|
|
|
329 |
|
/* Define to 1 if you have the <net/if.h> header file. */ |
|
330 |
|
#define HAVE_NET_IF_H 1 |
|
331 |
|
|
|
332 |
|
/* Define to 1 if you have the `ntp_gettime' function. */ |
|
333 |
|
#define HAVE_NTP_GETTIME 1 |
|
334 |
|
|
|
335 |
|
/* Define to 1 if you have the `openat' function. */ |
|
336 |
|
#define HAVE_OPENAT 1 |
|
337 |
|
|
|
338 |
|
/* Define to 1 if you have the `open_memstream' function. */ |
|
339 |
|
#define HAVE_OPEN_MEMSTREAM 1 |
|
340 |
|
|
|
341 |
|
/* Define to 1 if you have the <paths.h> header file. */ |
|
342 |
|
#define HAVE_PATHS_H 1 |
|
343 |
|
|
|
344 |
|
/* Define to 1 if you have the `personality' function. */ |
|
345 |
|
#define HAVE_PERSONALITY 1 |
|
346 |
|
|
|
347 |
|
/* Define to 1 if you have the `posix_fadvise' function. */ |
|
348 |
|
#define HAVE_POSIX_FADVISE 1 |
|
349 |
|
|
|
350 |
|
/* Have valid posix_fallocate() function */ |
|
351 |
|
#define HAVE_POSIX_FALLOCATE 1 |
|
352 |
|
|
|
353 |
|
/* Define to 1 if you have the `prctl' function. */ |
|
354 |
|
#define HAVE_PRCTL 1 |
|
355 |
|
|
|
356 |
|
/* Define to 1 if you have the `prlimit' function. */ |
|
357 |
|
#define HAVE_PRLIMIT 1 |
|
358 |
|
|
|
359 |
|
/* Define if program_invocation_short_name is defined */ |
|
360 |
|
#define HAVE_PROGRAM_INVOCATION_SHORT_NAME 1 |
|
361 |
|
|
|
362 |
|
/* Define to 1 if you have the <pty.h> header file. */ |
|
363 |
|
#define HAVE_PTY_H 1 |
|
364 |
|
|
|
365 |
|
/* Define to 1 if you have the `qsort_r' function. */ |
|
366 |
|
#define HAVE_QSORT_R 1 |
|
367 |
|
|
|
368 |
|
/* Define to 1 if you have the `reboot' function. */ |
|
369 |
|
#define HAVE_REBOOT 1 |
|
370 |
|
|
|
371 |
|
/* Define if curses library has the resizeterm(). */ |
|
372 |
|
/* #undef HAVE_RESIZETERM */ |
|
373 |
|
|
|
374 |
|
/* Define to 1 if you have the `rpmatch' function. */ |
|
375 |
|
#define HAVE_RPMATCH 1 |
|
376 |
|
|
|
377 |
|
/* Define if struct sockaddr contains sa_len */ |
|
378 |
|
/* #undef HAVE_SA_LEN */ |
|
379 |
|
|
|
380 |
|
/* Define to 1 if you have the `scandirat' function. */ |
|
381 |
|
#define HAVE_SCANDIRAT 1 |
|
382 |
|
|
|
383 |
|
/* scanf %as modifier */ |
|
384 |
|
/* #undef HAVE_SCANF_AS_MODIFIER */ |
|
385 |
|
|
|
386 |
|
/* scanf %ms modifier */ |
|
387 |
|
#define HAVE_SCANF_MS_MODIFIER 1 |
|
388 |
|
|
|
389 |
|
/* Define to 1 if you have the `sched_setattr' function. */ |
|
390 |
|
/* #undef HAVE_SCHED_SETATTR */ |
|
391 |
|
|
|
392 |
|
/* Define to 1 if you have the `sched_setscheduler' function. */ |
|
393 |
|
#define HAVE_SCHED_SETSCHEDULER 1 |
|
394 |
|
|
|
395 |
|
/* Define to 1 if you have the `secure_getenv' function. */ |
|
396 |
|
#define HAVE_SECURE_GETENV 1 |
|
397 |
|
|
|
398 |
|
/* Define to 1 if you have the `security_get_initial_context' function. */ |
|
399 |
|
/* #undef HAVE_SECURITY_GET_INITIAL_CONTEXT */ |
|
400 |
|
|
|
401 |
|
/* Define to 1 if you have the <security/openpam.h> header file. */ |
|
402 |
|
/* #undef HAVE_SECURITY_OPENPAM_H */ |
|
403 |
|
|
|
404 |
|
/* Define to 1 if you have the <security/pam_appl.h> header file. */ |
|
405 |
|
/* #undef HAVE_SECURITY_PAM_APPL_H */ |
|
406 |
|
|
|
407 |
|
/* Define to 1 if you have the <security/pam_misc.h> header file. */ |
|
408 |
|
/* #undef HAVE_SECURITY_PAM_MISC_H */ |
|
409 |
|
|
|
410 |
|
/* Define to 1 if you have the `setns' function. */ |
|
411 |
|
#define HAVE_SETNS 1 |
|
412 |
|
|
|
413 |
|
/* Define to 1 if you have the `setprogname' function. */ |
|
414 |
|
/* #undef HAVE_SETPROGNAME */ |
|
415 |
|
|
|
416 |
|
/* Define to 1 if you have the `setresgid' function. */ |
|
417 |
|
#define HAVE_SETRESGID 1 |
|
418 |
|
|
|
419 |
|
/* Define to 1 if you have the `setresuid' function. */ |
|
420 |
|
#define HAVE_SETRESUID 1 |
|
421 |
|
|
|
422 |
|
/* Define to 1 if you have the <shadow.h> header file. */ |
|
423 |
|
#define HAVE_SHADOW_H 1 |
|
424 |
|
|
|
425 |
|
/* Define to 1 if the system has the type `sighandler_t'. */ |
|
426 |
|
#define HAVE_SIGHANDLER_T 1 |
|
427 |
|
|
|
428 |
|
/* Define to 1 if you have the `sigqueue' function. */ |
|
429 |
|
#define HAVE_SIGQUEUE 1 |
|
430 |
|
|
|
431 |
|
/* Define to 1 if you have the <slang.h> header file. */ |
|
432 |
|
/* #undef HAVE_SLANG_H */ |
|
433 |
|
|
|
434 |
|
/* Define to 1 if you have the <slang/slang.h> header file. */ |
|
435 |
|
/* #undef HAVE_SLANG_SLANG_H */ |
|
436 |
|
|
|
437 |
|
/* Define to 1 if you have the <slang/slcurses.h> header file. */ |
|
438 |
|
/* #undef HAVE_SLANG_SLCURSES_H */ |
|
439 |
|
|
|
440 |
|
/* Define to 1 if you have the <slcurses.h> header file. */ |
|
441 |
|
/* #undef HAVE_SLCURSES_H */ |
|
442 |
|
|
|
443 |
|
/* Add SMACK support */ |
|
444 |
|
/* #undef HAVE_SMACK */ |
|
445 |
|
|
|
446 |
|
/* Define to 1 if you have the `srandom' function. */ |
|
447 |
|
#define HAVE_SRANDOM 1 |
|
448 |
|
|
|
449 |
|
/* Define to 1 if you have the <stdint.h> header file. */ |
|
450 |
|
#define HAVE_STDINT_H 1 |
|
451 |
|
|
|
452 |
|
/* Define to 1 if you have the <stdio_ext.h> header file. */ |
|
453 |
|
#define HAVE_STDIO_EXT_H 1 |
|
454 |
|
|
|
455 |
|
/* Define to 1 if you have the <stdlib.h> header file. */ |
|
456 |
|
#define HAVE_STDLIB_H 1 |
|
457 |
|
|
|
458 |
|
/* Define to 1 if you have the <strings.h> header file. */ |
|
459 |
|
#define HAVE_STRINGS_H 1 |
|
460 |
|
|
|
461 |
|
/* Define to 1 if you have the <string.h> header file. */ |
|
462 |
|
#define HAVE_STRING_H 1 |
|
463 |
|
|
|
464 |
|
/* Define to 1 if you have the `strnchr' function. */ |
|
465 |
|
/* #undef HAVE_STRNCHR */ |
|
466 |
|
|
|
467 |
|
/* Define to 1 if you have the `strndup' function. */ |
|
468 |
|
#define HAVE_STRNDUP 1 |
|
469 |
|
|
|
470 |
|
/* Define to 1 if you have the `strnlen' function. */ |
|
471 |
|
#define HAVE_STRNLEN 1 |
|
472 |
|
|
|
473 |
|
/* Define to 1 if have strsignal function prototype */ |
|
474 |
|
#define HAVE_STRSIGNAL_DECL 1 |
|
475 |
|
|
|
476 |
|
/* Define to 1 if `st_mtim.tv_nsec' is a member of `struct stat'. */ |
|
477 |
|
#define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1 |
|
478 |
|
|
|
479 |
|
/* Define to 1 if `c_line' is a member of `struct termios'. */ |
|
480 |
|
#define HAVE_STRUCT_TERMIOS_C_LINE 1 |
|
481 |
|
|
|
482 |
|
/* Define to 1 if `tm_zone' is a member of `struct tm'. */ |
|
483 |
|
#define HAVE_STRUCT_TM_TM_ZONE 1 |
|
484 |
|
|
|
485 |
|
/* Define to 1 if you have the `sysconf' function. */ |
|
486 |
|
#define HAVE_SYSCONF 1 |
|
487 |
|
|
|
488 |
|
/* Define to 1 if you have the `sysinfo' function. */ |
|
489 |
|
#define HAVE_SYSINFO 1 |
|
490 |
|
|
|
491 |
|
/* Define to 1 if you have the <sys/disklabel.h> header file. */ |
|
492 |
|
/* #undef HAVE_SYS_DISKLABEL_H */ |
|
493 |
|
|
|
494 |
|
/* Define to 1 if you have the <sys/disk.h> header file. */ |
|
495 |
|
/* #undef HAVE_SYS_DISK_H */ |
|
496 |
|
|
|
497 |
|
/* Define to 1 if you have the <sys/endian.h> header file. */ |
|
498 |
|
/* #undef HAVE_SYS_ENDIAN_H */ |
|
499 |
|
|
|
500 |
|
/* Define to 1 if you have the <sys/file.h> header file. */ |
|
501 |
|
#define HAVE_SYS_FILE_H 1 |
|
502 |
|
|
|
503 |
|
/* Define to 1 if you have the <sys/ioccom.h> header file. */ |
|
504 |
|
/* #undef HAVE_SYS_IOCCOM_H */ |
|
505 |
|
|
|
506 |
|
/* Define to 1 if you have the <sys/ioctl.h> header file. */ |
|
507 |
|
#define HAVE_SYS_IOCTL_H 1 |
|
508 |
|
|
|
509 |
|
/* Define to 1 if you have the <sys/io.h> header file. */ |
|
510 |
|
#define HAVE_SYS_IO_H 1 |
|
511 |
|
|
|
512 |
|
/* Define to 1 if you have the <sys/mkdev.h> header file. */ |
|
513 |
|
/* #undef HAVE_SYS_MKDEV_H */ |
|
514 |
|
|
|
515 |
|
/* Define to 1 if you have the <sys/mount.h> header file. */ |
|
516 |
|
#define HAVE_SYS_MOUNT_H 1 |
|
517 |
|
|
|
518 |
|
/* Define to 1 if you have the <sys/param.h> header file. */ |
|
519 |
|
#define HAVE_SYS_PARAM_H 1 |
|
520 |
|
|
|
521 |
|
/* Define to 1 if you have the <sys/prctl.h> header file. */ |
|
522 |
|
#define HAVE_SYS_PRCTL_H 1 |
|
523 |
|
|
|
524 |
|
/* Define to 1 if you have the <sys/resource.h> header file. */ |
|
525 |
|
#define HAVE_SYS_RESOURCE_H 1 |
|
526 |
|
|
|
527 |
|
/* Define to 1 if you have the <sys/signalfd.h> header file. */ |
|
528 |
|
#define HAVE_SYS_SIGNALFD_H 1 |
|
529 |
|
|
|
530 |
|
/* Define to 1 if you have the <sys/socket.h> header file. */ |
|
531 |
|
#define HAVE_SYS_SOCKET_H 1 |
|
532 |
|
|
|
533 |
|
/* Define to 1 if you have the <sys/sockio.h> header file. */ |
|
534 |
|
/* #undef HAVE_SYS_SOCKIO_H */ |
|
535 |
|
|
|
536 |
|
/* Define to 1 if you have the <sys/stat.h> header file. */ |
|
537 |
|
#define HAVE_SYS_STAT_H 1 |
|
538 |
|
|
|
539 |
|
/* Define to 1 if you have the <sys/swap.h> header file. */ |
|
540 |
|
#define HAVE_SYS_SWAP_H 1 |
|
541 |
|
|
|
542 |
|
/* Define to 1 if you have the <sys/syscall.h> header file. */ |
|
543 |
|
#define HAVE_SYS_SYSCALL_H 1 |
|
544 |
|
|
|
545 |
|
/* Define to 1 if you have the <sys/sysmacros.h> header file. */ |
|
546 |
|
#define HAVE_SYS_SYSMACROS_H 1 |
|
547 |
|
|
|
548 |
|
/* Define to 1 if you have the <sys/timex.h> header file. */ |
|
549 |
|
#define HAVE_SYS_TIMEX_H 1 |
|
550 |
|
|
|
551 |
|
/* Define to 1 if you have the <sys/time.h> header file. */ |
|
552 |
|
#define HAVE_SYS_TIME_H 1 |
|
553 |
|
|
|
554 |
|
/* Define to 1 if you have the <sys/ttydefaults.h> header file. */ |
|
555 |
|
#define HAVE_SYS_TTYDEFAULTS_H 1 |
|
556 |
|
|
|
557 |
|
/* Define to 1 if you have the <sys/types.h> header file. */ |
|
558 |
|
#define HAVE_SYS_TYPES_H 1 |
|
559 |
|
|
|
560 |
|
/* Define to 1 if you have the <sys/ucred.h> header file. */ |
|
561 |
|
/* #undef HAVE_SYS_UCRED_H */ |
|
562 |
|
|
|
563 |
|
/* Define to 1 if you have the <sys/un.h> header file. */ |
|
564 |
|
#define HAVE_SYS_UN_H 1 |
|
565 |
|
|
|
566 |
|
/* Define to 1 if you have the <term.h> header file. */ |
|
567 |
|
#define HAVE_TERM_H 1 |
|
568 |
|
|
|
569 |
|
/* Define to 1 if you have the `timegm' function. */ |
|
570 |
|
#define HAVE_TIMEGM 1 |
|
571 |
|
|
|
572 |
|
/* Define to 1 if you have the `timer_create' function. */ |
|
573 |
|
/* #undef HAVE_TIMER_CREATE */ |
|
574 |
|
|
|
575 |
|
/* Define to 1 if the target supports thread-local storage. */ |
|
576 |
|
#define HAVE_TLS 1 |
|
577 |
|
|
|
578 |
|
/* Does struct tm have a field tm_gmtoff? */ |
|
579 |
|
#define HAVE_TM_GMTOFF 1 |
|
580 |
|
|
|
581 |
|
/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use |
|
582 |
|
`HAVE_STRUCT_TM_TM_ZONE' instead. */ |
|
583 |
|
#define HAVE_TM_ZONE 1 |
|
584 |
|
|
|
585 |
|
/* Define to 1 if you don't have `tm_zone' but do have the external array |
|
586 |
|
`tzname'. */ |
|
587 |
|
/* #undef HAVE_TZNAME */ |
|
588 |
|
|
|
589 |
|
/* Define to 1 if the system has the type `union semun'. */ |
|
590 |
|
/* #undef HAVE_UNION_SEMUN */ |
|
591 |
|
|
|
592 |
|
/* Define to 1 if you have the <unistd.h> header file. */ |
|
593 |
|
#define HAVE_UNISTD_H 1 |
|
594 |
|
|
|
595 |
|
/* Define to 1 if you have the `unlinkat' function. */ |
|
596 |
|
#define HAVE_UNLINKAT 1 |
|
597 |
|
|
|
598 |
|
/* Define to 1 if you have the `unshare' function. */ |
|
599 |
|
#define HAVE_UNSHARE 1 |
|
600 |
|
|
|
601 |
|
/* Define to 1 if you have the `updwtmpx' function. */ |
|
602 |
|
#define HAVE_UPDWTMPX 1 |
|
603 |
|
|
|
604 |
|
/* Define if curses library has the use_default_colors(). */ |
|
605 |
|
/* #undef HAVE_USE_DEFAULT_COLORS */ |
|
606 |
|
|
|
607 |
|
/* Define to 1 if you have the `usleep' function. */ |
|
608 |
|
#define HAVE_USLEEP 1 |
|
609 |
|
|
|
610 |
|
/* Define to 1 if you have the `utimensat' function. */ |
|
611 |
|
#define HAVE_UTIMENSAT 1 |
|
612 |
|
|
|
613 |
|
/* Define to 1 if you have the <utmpx.h> header file. */ |
|
614 |
|
#define HAVE_UTMPX_H 1 |
|
615 |
|
|
|
616 |
|
/* Define to 1 if you have the <utmp.h> header file. */ |
|
617 |
|
#define HAVE_UTMP_H 1 |
|
618 |
|
|
|
619 |
|
/* Define to 1 if you want to use uuid daemon. */ |
|
620 |
|
#define HAVE_UUIDD 1 |
|
621 |
|
|
|
622 |
|
/* Define to 1 if you have the `warn' function. */ |
|
623 |
|
#define HAVE_WARN 1 |
|
624 |
|
|
|
625 |
|
/* Define to 1 if you have the `warnx' function. */ |
|
626 |
|
#define HAVE_WARNX 1 |
|
627 |
|
|
|
628 |
|
/* Do we have wide character support? */ |
|
629 |
|
#define HAVE_WIDECHAR 1 |
|
630 |
|
|
|
631 |
|
/* Define to 1 if you have the `__fpending' function. */ |
|
632 |
|
#define HAVE___FPENDING 1 |
|
633 |
|
|
|
634 |
|
/* Define if __progname is defined */ |
|
635 |
|
#define HAVE___PROGNAME 1 |
|
636 |
|
|
|
637 |
|
/* Define to 1 if you have the `__secure_getenv' function. */ |
|
638 |
|
/* #undef HAVE___SECURE_GETENV */ |
|
639 |
|
|
|
640 |
|
/* libblkid date string */ |
|
641 |
|
#define LIBBLKID_DATE "02-Jun-2017" |
|
642 |
|
|
|
643 |
|
/* libblkid version string */ |
|
644 |
|
#define LIBBLKID_VERSION "2.30.0" |
|
645 |
|
|
|
646 |
|
/* libfdisk version string */ |
|
647 |
|
#define LIBFDISK_VERSION "2.30.0" |
|
648 |
|
|
|
649 |
|
/* libmount version string */ |
|
650 |
|
#define LIBMOUNT_VERSION "2.30.0" |
|
651 |
|
|
|
652 |
|
/* libsmartcols version string */ |
|
653 |
|
#define LIBSMARTCOLS_VERSION "2.30.0" |
|
654 |
|
|
|
655 |
|
/* Should login chown /dev/vcsN? */ |
|
656 |
|
/* #undef LOGIN_CHOWN_VCS */ |
|
657 |
|
|
|
658 |
|
/* Should login stat() the mailbox? */ |
|
659 |
|
/* #undef LOGIN_STAT_MAIL */ |
|
660 |
|
|
|
661 |
|
/* Define to the sub-directory where libtool stores uninstalled libraries. */ |
|
662 |
|
#define LT_OBJDIR ".libs/" |
|
663 |
|
|
|
664 |
|
/* Define to 1 if assertions should be disabled. */ |
|
665 |
|
/* #undef NDEBUG */ |
|
666 |
|
|
|
667 |
|
/* Should chsh allow only shells in /etc/shells? */ |
|
668 |
|
#define ONLY_LISTED_SHELLS 1 |
|
669 |
|
|
|
670 |
|
/* Name of package */ |
|
671 |
|
#define PACKAGE "util-linux" |
|
672 |
|
|
|
673 |
|
/* Define to the address where bug reports for this package should be sent. */ |
|
674 |
|
#define PACKAGE_BUGREPORT "kzak@redhat.com" |
|
675 |
|
|
|
676 |
|
/* Define to the full name of this package. */ |
|
677 |
|
#define PACKAGE_NAME "util-linux" |
|
678 |
|
|
|
679 |
|
/* Define to the full name and version of this package. */ |
|
680 |
|
#define PACKAGE_STRING "util-linux 2.30" |
|
681 |
|
|
|
682 |
|
/* Define to the one symbol short name of this package. */ |
|
683 |
|
#define PACKAGE_TARNAME "util-linux" |
|
684 |
|
|
|
685 |
|
/* Define to the home page for this package. */ |
|
686 |
|
#define PACKAGE_URL "http://www.kernel.org/pub/linux/utils/util-linux/" |
|
687 |
|
|
|
688 |
|
/* Define to the version of this package. */ |
|
689 |
|
#define PACKAGE_VERSION "2.30" |
|
690 |
|
|
|
691 |
|
/* Should pg ring the bell on invalid keys? */ |
|
692 |
|
#define PG_BELL 1 |
|
693 |
|
|
|
694 |
|
/* Define to 1 if you have the ANSI C header files. */ |
|
695 |
|
#define STDC_HEADERS 1 |
|
696 |
|
|
|
697 |
|
/* Is swapon() declared with two parameters? */ |
|
698 |
|
#define SWAPON_HAS_TWO_ARGS 1 |
|
699 |
|
|
|
700 |
|
/* Fallback syscall number for fallocate */ |
|
701 |
|
/* #undef SYS_fallocate */ |
|
702 |
|
|
|
703 |
|
/* Fallback syscall number for ioprio_get */ |
|
704 |
|
/* #undef SYS_ioprio_get */ |
|
705 |
|
|
|
706 |
|
/* Fallback syscall number for ioprio_set */ |
|
707 |
|
/* #undef SYS_ioprio_set */ |
|
708 |
|
|
|
709 |
|
/* Fallback syscall number for pivot_root */ |
|
710 |
|
/* #undef SYS_pivot_root */ |
|
711 |
|
|
|
712 |
|
/* Fallback syscall number for prlimit64 */ |
|
713 |
|
/* #undef SYS_prlimit64 */ |
|
714 |
|
|
|
715 |
|
/* Fallback syscall number for sched_getaffinity */ |
|
716 |
|
/* #undef SYS_sched_getaffinity */ |
|
717 |
|
|
|
718 |
|
/* Fallback syscall number for sched_setattr */ |
|
719 |
|
/* #undef SYS_sched_setattr */ |
|
720 |
|
|
|
721 |
|
/* Fallback syscall number for setns */ |
|
722 |
|
/* #undef SYS_setns */ |
|
723 |
|
|
|
724 |
|
/* Fallback syscall number for unshare */ |
|
725 |
|
/* #undef SYS_unshare */ |
|
726 |
|
|
|
727 |
|
/* Define to 1 if your <sys/time.h> declares `struct tm'. */ |
|
728 |
|
/* #undef TM_IN_SYS_TIME */ |
|
729 |
|
|
|
730 |
|
/* Enables colorized output from utils by default */ |
|
731 |
|
#define USE_COLORS_BY_DEFAULT 1 |
|
732 |
|
|
|
733 |
|
/* Define to 1 if want to support mtab. */ |
|
734 |
|
/* #undef USE_LIBMOUNT_SUPPORT_MTAB */ |
|
735 |
|
|
|
736 |
|
/* Enable plymouth support feature for sulogin and aggety */ |
|
737 |
|
#define USE_PLYMOUTH_SUPPORT 1 |
|
738 |
|
|
|
739 |
|
/* Should sulogin use a emergency mount of /dev and /proc? */ |
|
740 |
|
/* #undef USE_SULOGIN_EMERGENCY_MOUNT */ |
|
741 |
|
|
|
742 |
|
/* Enable extensions on AIX 3, Interix. */ |
|
743 |
|
#ifndef _ALL_SOURCE |
|
744 |
|
# define _ALL_SOURCE 1 |
|
745 |
|
#endif |
|
746 |
|
/* Enable GNU extensions on systems that have them. */ |
|
747 |
|
#ifndef _GNU_SOURCE |
|
748 |
|
# define _GNU_SOURCE 1 |
|
749 |
|
#endif |
|
750 |
|
/* Enable threading extensions on Solaris. */ |
|
751 |
|
#ifndef _POSIX_PTHREAD_SEMANTICS |
|
752 |
|
# define _POSIX_PTHREAD_SEMANTICS 1 |
|
753 |
|
#endif |
|
754 |
|
/* Enable extensions on HP NonStop. */ |
|
755 |
|
#ifndef _TANDEM_SOURCE |
|
756 |
|
# define _TANDEM_SOURCE 1 |
|
757 |
|
#endif |
|
758 |
|
/* Enable general extensions on Solaris. */ |
|
759 |
|
#ifndef __EXTENSIONS__ |
|
760 |
|
# define __EXTENSIONS__ 1 |
|
761 |
|
#endif |
|
762 |
|
|
|
763 |
|
|
|
764 |
|
/* Should wall and write be installed setgid tty? */ |
|
765 |
|
/* #undef USE_TTY_GROUP */ |
|
766 |
|
|
|
767 |
|
/* Define to 1 to remove /bin and /sbin from PATH env.variable */ |
|
768 |
|
/* #undef USE_USRDIR_PATHS_ONLY */ |
|
769 |
|
|
|
770 |
|
/* Version number of package */ |
|
771 |
|
#define VERSION "2.30" |
|
772 |
|
|
|
773 |
|
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most |
|
774 |
|
significant byte first (like Motorola and SPARC, unlike Intel). */ |
|
775 |
|
#if defined AC_APPLE_UNIVERSAL_BUILD |
|
776 |
|
# if defined __BIG_ENDIAN__ |
|
777 |
|
# define WORDS_BIGENDIAN 1 |
|
778 |
|
# endif |
|
779 |
|
#else |
|
780 |
|
# ifndef WORDS_BIGENDIAN |
|
781 |
|
/* # undef WORDS_BIGENDIAN */ |
|
782 |
|
# endif |
|
783 |
|
#endif |
|
784 |
|
|
|
785 |
|
/* Enable MAP_ANON in sys/mman.h on Mac OS X */ |
|
786 |
|
/* #undef _DARWIN_C_SOURCE */ |
|
787 |
|
|
|
788 |
|
/* Enable large inode numbers on Mac OS X 10.5. */ |
|
789 |
|
#ifndef _DARWIN_USE_64_BIT_INODE |
|
790 |
|
# define _DARWIN_USE_64_BIT_INODE 1 |
|
791 |
|
#endif |
|
792 |
|
|
|
793 |
|
/* Number of bits in a file offset, on hosts where this is settable. */ |
|
794 |
|
/* #undef _FILE_OFFSET_BITS */ |
|
795 |
|
|
|
796 |
|
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ |
|
797 |
|
/* #undef _LARGEFILE_SOURCE */ |
|
798 |
|
|
|
799 |
|
/* Define for large files, on AIX-style hosts. */ |
|
800 |
|
/* #undef _LARGE_FILES */ |
|
801 |
|
|
|
802 |
|
/* Define to 1 if on MINIX. */ |
|
803 |
|
/* #undef _MINIX */ |
|
804 |
|
|
|
805 |
|
/* Define to 2 if the system does not provide POSIX.1 features except with |
|
806 |
|
this defined. */ |
|
807 |
|
/* #undef _POSIX_1_SOURCE */ |
|
808 |
|
|
|
809 |
|
/* Define to 1 if you need to in order for `stat' and other things to work. */ |
|
810 |
|
/* #undef _POSIX_SOURCE */ |
|
811 |
|
|
|
812 |
|
/* Define to empty if `const' does not conform to ANSI C. */ |
|
813 |
|
/* #undef const */ |
|
814 |
|
|
|
815 |
|
/* Define to empty if the keyword `volatile' does not work. Warning: valid |
|
816 |
|
code using `volatile' can become incorrect without. Disable with care. */ |
|
817 |
|
/* #undef volatile */ |
File src/gen_uuid.c added (mode: 100644) (index 0000000..d29279f) |
|
1 |
|
/* |
|
2 |
|
* gen_uuid.c --- generate a DCE-compatible uuid |
|
3 |
|
* |
|
4 |
|
* Copyright (C) 1996, 1997, 1998, 1999 Theodore Ts'o. |
|
5 |
|
* |
|
6 |
|
* %Begin-Header% |
|
7 |
|
* Redistribution and use in source and binary forms, with or without |
|
8 |
|
* modification, are permitted provided that the following conditions |
|
9 |
|
* are met: |
|
10 |
|
* 1. Redistributions of source code must retain the above copyright |
|
11 |
|
* notice, and the entire permission notice in its entirety, |
|
12 |
|
* including the disclaimer of warranties. |
|
13 |
|
* 2. Redistributions in binary form must reproduce the above copyright |
|
14 |
|
* notice, this list of conditions and the following disclaimer in the |
|
15 |
|
* documentation and/or other materials provided with the distribution. |
|
16 |
|
* 3. The name of the author may not be used to endorse or promote |
|
17 |
|
* products derived from this software without specific prior |
|
18 |
|
* written permission. |
|
19 |
|
* |
|
20 |
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
|
21 |
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
|
22 |
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF |
|
23 |
|
* WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE |
|
24 |
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
25 |
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
|
26 |
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
|
27 |
|
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
|
28 |
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
29 |
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE |
|
30 |
|
* USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH |
|
31 |
|
* DAMAGE. |
|
32 |
|
* %End-Header% |
|
33 |
|
*/ |
|
34 |
|
|
|
35 |
|
#include "config.h" |
|
36 |
|
|
|
37 |
|
#ifdef _WIN32 |
|
38 |
|
#define _WIN32_WINNT 0x0500 |
|
39 |
|
#include <windows.h> |
|
40 |
|
#define UUID MYUUID |
|
41 |
|
#endif |
|
42 |
|
#include <stdio.h> |
|
43 |
|
#ifdef HAVE_UNISTD_H |
|
44 |
|
#include <unistd.h> |
|
45 |
|
#endif |
|
46 |
|
#ifdef HAVE_STDLIB_H |
|
47 |
|
#include <stdlib.h> |
|
48 |
|
#endif |
|
49 |
|
#include <string.h> |
|
50 |
|
#include <fcntl.h> |
|
51 |
|
#include <errno.h> |
|
52 |
|
#include <limits.h> |
|
53 |
|
#include <sys/types.h> |
|
54 |
|
#ifdef HAVE_SYS_TIME_H |
|
55 |
|
#include <sys/time.h> |
|
56 |
|
#endif |
|
57 |
|
#include <sys/stat.h> |
|
58 |
|
#ifdef HAVE_SYS_FILE_H |
|
59 |
|
#include <sys/file.h> |
|
60 |
|
#endif |
|
61 |
|
#ifdef HAVE_SYS_IOCTL_H |
|
62 |
|
#include <sys/ioctl.h> |
|
63 |
|
#endif |
|
64 |
|
#ifdef HAVE_SYS_SOCKET_H |
|
65 |
|
#include <sys/socket.h> |
|
66 |
|
#endif |
|
67 |
|
#ifdef HAVE_SYS_UN_H |
|
68 |
|
#include <sys/un.h> |
|
69 |
|
#endif |
|
70 |
|
#ifdef HAVE_SYS_SOCKIO_H |
|
71 |
|
#include <sys/sockio.h> |
|
72 |
|
#endif |
|
73 |
|
#ifdef HAVE_NET_IF_H |
|
74 |
|
#include <net/if.h> |
|
75 |
|
#endif |
|
76 |
|
#ifdef HAVE_NETINET_IN_H |
|
77 |
|
#include <netinet/in.h> |
|
78 |
|
#endif |
|
79 |
|
#ifdef HAVE_NET_IF_DL_H |
|
80 |
|
#include <net/if_dl.h> |
|
81 |
|
#endif |
|
82 |
|
#if defined(__linux__) && defined(HAVE_SYS_SYSCALL_H) |
|
83 |
|
#include <sys/syscall.h> |
|
84 |
|
#endif |
|
85 |
|
|
|
86 |
|
#include "namespace.h" |
|
87 |
|
#include "all-io.h" |
|
88 |
|
#include "uuidP.h" |
|
89 |
|
#include "uuidd.h" |
|
90 |
|
#include "randutils.h" |
|
91 |
|
#include "strutils.h" |
|
92 |
|
#include "c.h" |
|
93 |
|
|
|
94 |
|
#ifdef HAVE_TLS |
|
95 |
|
#define THREAD_LOCAL static __thread |
|
96 |
|
#else |
|
97 |
|
#define THREAD_LOCAL static |
|
98 |
|
#endif |
|
99 |
|
|
|
100 |
|
#ifdef _WIN32 |
|
101 |
|
static void gettimeofday (struct timeval *tv, void *dummy) |
|
102 |
|
{ |
|
103 |
|
FILETIME ftime; |
|
104 |
|
uint64_t n; |
|
105 |
|
|
|
106 |
|
GetSystemTimeAsFileTime (&ftime); |
|
107 |
|
n = (((uint64_t) ftime.dwHighDateTime << 32) |
|
108 |
|
+ (uint64_t) ftime.dwLowDateTime); |
|
109 |
|
if (n) { |
|
110 |
|
n /= 10; |
|
111 |
|
n -= ((369 * 365 + 89) * (uint64_t) 86400) * 1000000; |
|
112 |
|
} |
|
113 |
|
|
|
114 |
|
tv->tv_sec = n / 1000000; |
|
115 |
|
tv->tv_usec = n % 1000000; |
|
116 |
|
} |
|
117 |
|
|
|
118 |
|
static int getuid (void) |
|
119 |
|
{ |
|
120 |
|
return 1; |
|
121 |
|
} |
|
122 |
|
#endif |
|
123 |
|
|
|
124 |
|
/* |
|
125 |
|
* Get the ethernet hardware address, if we can find it... |
|
126 |
|
* |
|
127 |
|
* XXX for a windows version, probably should use GetAdaptersInfo: |
|
128 |
|
* http://www.codeguru.com/cpp/i-n/network/networkinformation/article.php/c5451 |
|
129 |
|
* commenting out get_node_id just to get gen_uuid to compile under windows |
|
130 |
|
* is not the right way to go! |
|
131 |
|
*/ |
|
132 |
|
static int get_node_id(unsigned char *node_id) |
|
133 |
|
{ |
|
134 |
|
#ifdef HAVE_NET_IF_H |
|
135 |
|
int sd; |
|
136 |
|
struct ifreq ifr, *ifrp; |
|
137 |
|
struct ifconf ifc; |
|
138 |
|
char buf[1024]; |
|
139 |
|
int n, i; |
|
140 |
|
unsigned char *a; |
|
141 |
|
#ifdef HAVE_NET_IF_DL_H |
|
142 |
|
struct sockaddr_dl *sdlp; |
|
143 |
|
#endif |
|
144 |
|
|
|
145 |
|
/* |
|
146 |
|
* BSD 4.4 defines the size of an ifreq to be |
|
147 |
|
* max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len |
|
148 |
|
* However, under earlier systems, sa_len isn't present, so the size is |
|
149 |
|
* just sizeof(struct ifreq) |
|
150 |
|
*/ |
|
151 |
|
#ifdef HAVE_SA_LEN |
|
152 |
|
#define ifreq_size(i) max(sizeof(struct ifreq),\ |
|
153 |
|
sizeof((i).ifr_name)+(i).ifr_addr.sa_len) |
|
154 |
|
#else |
|
155 |
|
#define ifreq_size(i) sizeof(struct ifreq) |
|
156 |
|
#endif /* HAVE_SA_LEN */ |
|
157 |
|
|
|
158 |
|
sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); |
|
159 |
|
if (sd < 0) { |
|
160 |
|
return -1; |
|
161 |
|
} |
|
162 |
|
memset(buf, 0, sizeof(buf)); |
|
163 |
|
ifc.ifc_len = sizeof(buf); |
|
164 |
|
ifc.ifc_buf = buf; |
|
165 |
|
if (ioctl (sd, SIOCGIFCONF, (char *)&ifc) < 0) { |
|
166 |
|
close(sd); |
|
167 |
|
return -1; |
|
168 |
|
} |
|
169 |
|
n = ifc.ifc_len; |
|
170 |
|
for (i = 0; i < n; i+= ifreq_size(*ifrp) ) { |
|
171 |
|
ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i); |
|
172 |
|
strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ); |
|
173 |
|
#ifdef SIOCGIFHWADDR |
|
174 |
|
if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0) |
|
175 |
|
continue; |
|
176 |
|
a = (unsigned char *) &ifr.ifr_hwaddr.sa_data; |
|
177 |
|
#else |
|
178 |
|
#ifdef SIOCGENADDR |
|
179 |
|
if (ioctl(sd, SIOCGENADDR, &ifr) < 0) |
|
180 |
|
continue; |
|
181 |
|
a = (unsigned char *) ifr.ifr_enaddr; |
|
182 |
|
#else |
|
183 |
|
#ifdef HAVE_NET_IF_DL_H |
|
184 |
|
sdlp = (struct sockaddr_dl *) &ifrp->ifr_addr; |
|
185 |
|
if ((sdlp->sdl_family != AF_LINK) || (sdlp->sdl_alen != 6)) |
|
186 |
|
continue; |
|
187 |
|
a = (unsigned char *) &sdlp->sdl_data[sdlp->sdl_nlen]; |
|
188 |
|
#else |
|
189 |
|
/* |
|
190 |
|
* XXX we don't have a way of getting the hardware |
|
191 |
|
* address |
|
192 |
|
*/ |
|
193 |
|
close(sd); |
|
194 |
|
return 0; |
|
195 |
|
#endif /* HAVE_NET_IF_DL_H */ |
|
196 |
|
#endif /* SIOCGENADDR */ |
|
197 |
|
#endif /* SIOCGIFHWADDR */ |
|
198 |
|
if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5]) |
|
199 |
|
continue; |
|
200 |
|
if (node_id) { |
|
201 |
|
memcpy(node_id, a, 6); |
|
202 |
|
close(sd); |
|
203 |
|
return 1; |
|
204 |
|
} |
|
205 |
|
} |
|
206 |
|
close(sd); |
|
207 |
|
#endif |
|
208 |
|
return 0; |
|
209 |
|
} |
|
210 |
|
|
|
211 |
|
/* Assume that the gettimeofday() has microsecond granularity */ |
|
212 |
|
#define MAX_ADJUSTMENT 10 |
|
213 |
|
|
|
214 |
|
/* |
|
215 |
|
* Get clock from global sequence clock counter. |
|
216 |
|
* |
|
217 |
|
* Return -1 if the clock counter could not be opened/locked (in this case |
|
218 |
|
* pseudorandom value is returned in @ret_clock_seq), otherwise return 0. |
|
219 |
|
*/ |
|
220 |
|
static int get_clock(uint32_t *clock_high, uint32_t *clock_low, |
|
221 |
|
uint16_t *ret_clock_seq, int *num) |
|
222 |
|
{ |
|
223 |
|
THREAD_LOCAL int adjustment = 0; |
|
224 |
|
THREAD_LOCAL struct timeval last = {0, 0}; |
|
225 |
|
THREAD_LOCAL int state_fd = -2; |
|
226 |
|
THREAD_LOCAL FILE *state_f; |
|
227 |
|
THREAD_LOCAL uint16_t clock_seq; |
|
228 |
|
struct timeval tv; |
|
229 |
|
uint64_t clock_reg; |
|
230 |
|
mode_t save_umask; |
|
231 |
|
int len; |
|
232 |
|
int ret = 0; |
|
233 |
|
|
|
234 |
|
if (state_fd == -1) |
|
235 |
|
ret = -1; |
|
236 |
|
|
|
237 |
|
if (state_fd == -2) { |
|
238 |
|
save_umask = umask(0); |
|
239 |
|
state_fd = open(LIBUUID_CLOCK_FILE, O_RDWR|O_CREAT|O_CLOEXEC, 0660); |
|
240 |
|
(void) umask(save_umask); |
|
241 |
|
if (state_fd != -1) { |
|
242 |
|
state_f = fdopen(state_fd, "r+" UL_CLOEXECSTR); |
|
243 |
|
if (!state_f) { |
|
244 |
|
close(state_fd); |
|
245 |
|
state_fd = -1; |
|
246 |
|
ret = -1; |
|
247 |
|
} |
|
248 |
|
} |
|
249 |
|
else |
|
250 |
|
ret = -1; |
|
251 |
|
} |
|
252 |
|
if (state_fd >= 0) { |
|
253 |
|
rewind(state_f); |
|
254 |
|
while (flock(state_fd, LOCK_EX) < 0) { |
|
255 |
|
if ((errno == EAGAIN) || (errno == EINTR)) |
|
256 |
|
continue; |
|
257 |
|
fclose(state_f); |
|
258 |
|
close(state_fd); |
|
259 |
|
state_fd = -1; |
|
260 |
|
ret = -1; |
|
261 |
|
break; |
|
262 |
|
} |
|
263 |
|
} |
|
264 |
|
if (state_fd >= 0) { |
|
265 |
|
unsigned int cl; |
|
266 |
|
unsigned long tv1, tv2; |
|
267 |
|
int a; |
|
268 |
|
|
|
269 |
|
if (fscanf(state_f, "clock: %04x tv: %lu %lu adj: %d\n", |
|
270 |
|
&cl, &tv1, &tv2, &a) == 4) { |
|
271 |
|
clock_seq = cl & 0x3FFF; |
|
272 |
|
last.tv_sec = tv1; |
|
273 |
|
last.tv_usec = tv2; |
|
274 |
|
adjustment = a; |
|
275 |
|
} |
|
276 |
|
} |
|
277 |
|
|
|
278 |
|
if ((last.tv_sec == 0) && (last.tv_usec == 0)) { |
|
279 |
|
random_get_bytes(&clock_seq, sizeof(clock_seq)); |
|
280 |
|
clock_seq &= 0x3FFF; |
|
281 |
|
gettimeofday(&last, NULL); |
|
282 |
|
last.tv_sec--; |
|
283 |
|
} |
|
284 |
|
|
|
285 |
|
try_again: |
|
286 |
|
gettimeofday(&tv, NULL); |
|
287 |
|
if ((tv.tv_sec < last.tv_sec) || |
|
288 |
|
((tv.tv_sec == last.tv_sec) && |
|
289 |
|
(tv.tv_usec < last.tv_usec))) { |
|
290 |
|
clock_seq = (clock_seq+1) & 0x3FFF; |
|
291 |
|
adjustment = 0; |
|
292 |
|
last = tv; |
|
293 |
|
} else if ((tv.tv_sec == last.tv_sec) && |
|
294 |
|
(tv.tv_usec == last.tv_usec)) { |
|
295 |
|
if (adjustment >= MAX_ADJUSTMENT) |
|
296 |
|
goto try_again; |
|
297 |
|
adjustment++; |
|
298 |
|
} else { |
|
299 |
|
adjustment = 0; |
|
300 |
|
last = tv; |
|
301 |
|
} |
|
302 |
|
|
|
303 |
|
clock_reg = tv.tv_usec*10 + adjustment; |
|
304 |
|
clock_reg += ((uint64_t) tv.tv_sec)*10000000; |
|
305 |
|
clock_reg += (((uint64_t) 0x01B21DD2) << 32) + 0x13814000; |
|
306 |
|
|
|
307 |
|
if (num && (*num > 1)) { |
|
308 |
|
adjustment += *num - 1; |
|
309 |
|
last.tv_usec += adjustment / 10; |
|
310 |
|
adjustment = adjustment % 10; |
|
311 |
|
last.tv_sec += last.tv_usec / 1000000; |
|
312 |
|
last.tv_usec = last.tv_usec % 1000000; |
|
313 |
|
} |
|
314 |
|
|
|
315 |
|
if (state_fd >= 0) { |
|
316 |
|
rewind(state_f); |
|
317 |
|
len = fprintf(state_f, |
|
318 |
|
"clock: %04x tv: %016ld %08ld adj: %08d\n", |
|
319 |
|
clock_seq, (long)last.tv_sec, (long)last.tv_usec, adjustment); |
|
320 |
|
fflush(state_f); |
|
321 |
|
if (ftruncate(state_fd, len) < 0) { |
|
322 |
|
fprintf(state_f, " \n"); |
|
323 |
|
fflush(state_f); |
|
324 |
|
} |
|
325 |
|
rewind(state_f); |
|
326 |
|
flock(state_fd, LOCK_UN); |
|
327 |
|
} |
|
328 |
|
|
|
329 |
|
*clock_high = clock_reg >> 32; |
|
330 |
|
*clock_low = clock_reg; |
|
331 |
|
*ret_clock_seq = clock_seq; |
|
332 |
|
return ret; |
|
333 |
|
} |
|
334 |
|
|
|
335 |
|
#if defined(HAVE_UUIDD) && defined(HAVE_SYS_UN_H) |
|
336 |
|
|
|
337 |
|
/* |
|
338 |
|
* Try using the uuidd daemon to generate the UUID |
|
339 |
|
* |
|
340 |
|
* Returns 0 on success, non-zero on failure. |
|
341 |
|
*/ |
|
342 |
|
static int get_uuid_via_daemon(int op, uuid_t out, int *num) |
|
343 |
|
{ |
|
344 |
|
char op_buf[64]; |
|
345 |
|
int op_len; |
|
346 |
|
int s; |
|
347 |
|
ssize_t ret; |
|
348 |
|
int32_t reply_len = 0, expected = 16; |
|
349 |
|
struct sockaddr_un srv_addr; |
|
350 |
|
|
|
351 |
|
if (sizeof(UUIDD_SOCKET_PATH) > sizeof(srv_addr.sun_path)) |
|
352 |
|
return -1; |
|
353 |
|
|
|
354 |
|
if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) |
|
355 |
|
return -1; |
|
356 |
|
|
|
357 |
|
srv_addr.sun_family = AF_UNIX; |
|
358 |
|
xstrncpy(srv_addr.sun_path, UUIDD_SOCKET_PATH, sizeof(srv_addr.sun_path)); |
|
359 |
|
|
|
360 |
|
if (connect(s, (const struct sockaddr *) &srv_addr, |
|
361 |
|
sizeof(struct sockaddr_un)) < 0) |
|
362 |
|
goto fail; |
|
363 |
|
|
|
364 |
|
op_buf[0] = op; |
|
365 |
|
op_len = 1; |
|
366 |
|
if (op == UUIDD_OP_BULK_TIME_UUID) { |
|
367 |
|
memcpy(op_buf+1, num, sizeof(*num)); |
|
368 |
|
op_len += sizeof(*num); |
|
369 |
|
expected += sizeof(*num); |
|
370 |
|
} |
|
371 |
|
|
|
372 |
|
ret = write(s, op_buf, op_len); |
|
373 |
|
if (ret < 1) |
|
374 |
|
goto fail; |
|
375 |
|
|
|
376 |
|
ret = read_all(s, (char *) &reply_len, sizeof(reply_len)); |
|
377 |
|
if (ret < 0) |
|
378 |
|
goto fail; |
|
379 |
|
|
|
380 |
|
if (reply_len != expected) |
|
381 |
|
goto fail; |
|
382 |
|
|
|
383 |
|
ret = read_all(s, op_buf, reply_len); |
|
384 |
|
|
|
385 |
|
if (op == UUIDD_OP_BULK_TIME_UUID) |
|
386 |
|
memcpy(op_buf+16, num, sizeof(int)); |
|
387 |
|
|
|
388 |
|
memcpy(out, op_buf, 16); |
|
389 |
|
|
|
390 |
|
close(s); |
|
391 |
|
return ((ret == expected) ? 0 : -1); |
|
392 |
|
|
|
393 |
|
fail: |
|
394 |
|
close(s); |
|
395 |
|
return -1; |
|
396 |
|
} |
|
397 |
|
|
|
398 |
|
#else /* !defined(HAVE_UUIDD) && defined(HAVE_SYS_UN_H) */ |
|
399 |
|
static int get_uuid_via_daemon(int op __attribute__((__unused__)), |
|
400 |
|
uuid_t out __attribute__((__unused__)), |
|
401 |
|
int *num __attribute__((__unused__))) |
|
402 |
|
{ |
|
403 |
|
return -1; |
|
404 |
|
} |
|
405 |
|
#endif |
|
406 |
|
|
|
407 |
|
int __uuid_generate_time(uuid_t out, int *num) |
|
408 |
|
{ |
|
409 |
|
static unsigned char node_id[6]; |
|
410 |
|
static int has_init = 0; |
|
411 |
|
struct uuid uu; |
|
412 |
|
uint32_t clock_mid; |
|
413 |
|
int ret; |
|
414 |
|
|
|
415 |
|
if (!has_init) { |
|
416 |
|
if (get_node_id(node_id) <= 0) { |
|
417 |
|
random_get_bytes(node_id, 6); |
|
418 |
|
/* |
|
419 |
|
* Set multicast bit, to prevent conflicts |
|
420 |
|
* with IEEE 802 addresses obtained from |
|
421 |
|
* network cards |
|
422 |
|
*/ |
|
423 |
|
node_id[0] |= 0x01; |
|
424 |
|
} |
|
425 |
|
has_init = 1; |
|
426 |
|
} |
|
427 |
|
ret = get_clock(&clock_mid, &uu.time_low, &uu.clock_seq, num); |
|
428 |
|
uu.clock_seq |= 0x8000; |
|
429 |
|
uu.time_mid = (uint16_t) clock_mid; |
|
430 |
|
uu.time_hi_and_version = ((clock_mid >> 16) & 0x0FFF) | 0x1000; |
|
431 |
|
memcpy(uu.node, node_id, 6); |
|
432 |
|
uuid_pack(&uu, out); |
|
433 |
|
return ret; |
|
434 |
|
} |
|
435 |
|
|
|
436 |
|
/* |
|
437 |
|
* Generate time-based UUID and store it to @out |
|
438 |
|
* |
|
439 |
|
* Tries to guarantee uniqueness of the generated UUIDs by obtaining them from the uuidd daemon, |
|
440 |
|
* or, if uuidd is not usable, by using the global clock state counter (see get_clock()). |
|
441 |
|
* If neither of these is possible (e.g. because of insufficient permissions), it generates |
|
442 |
|
* the UUID anyway, but returns -1. Otherwise, returns 0. |
|
443 |
|
*/ |
|
444 |
|
static int uuid_generate_time_generic(uuid_t out) { |
|
445 |
|
#ifdef HAVE_TLS |
|
446 |
|
THREAD_LOCAL int num = 0; |
|
447 |
|
THREAD_LOCAL struct uuid uu; |
|
448 |
|
THREAD_LOCAL time_t last_time = 0; |
|
449 |
|
time_t now; |
|
450 |
|
|
|
451 |
|
if (num > 0) { |
|
452 |
|
now = time(NULL); |
|
453 |
|
if (now > last_time+1) |
|
454 |
|
num = 0; |
|
455 |
|
} |
|
456 |
|
if (num <= 0) { |
|
457 |
|
num = 1000; |
|
458 |
|
if (get_uuid_via_daemon(UUIDD_OP_BULK_TIME_UUID, |
|
459 |
|
out, &num) == 0) { |
|
460 |
|
last_time = time(NULL); |
|
461 |
|
uuid_unpack(out, &uu); |
|
462 |
|
num--; |
|
463 |
|
return 0; |
|
464 |
|
} |
|
465 |
|
num = 0; |
|
466 |
|
} |
|
467 |
|
if (num > 0) { |
|
468 |
|
uu.time_low++; |
|
469 |
|
if (uu.time_low == 0) { |
|
470 |
|
uu.time_mid++; |
|
471 |
|
if (uu.time_mid == 0) |
|
472 |
|
uu.time_hi_and_version++; |
|
473 |
|
} |
|
474 |
|
num--; |
|
475 |
|
uuid_pack(&uu, out); |
|
476 |
|
return 0; |
|
477 |
|
} |
|
478 |
|
#else |
|
479 |
|
if (get_uuid_via_daemon(UUIDD_OP_TIME_UUID, out, 0) == 0) |
|
480 |
|
return 0; |
|
481 |
|
#endif |
|
482 |
|
|
|
483 |
|
return __uuid_generate_time(out, NULL); |
|
484 |
|
} |
|
485 |
|
|
|
486 |
|
/* |
|
487 |
|
* Generate time-based UUID and store it to @out. |
|
488 |
|
* |
|
489 |
|
* Discards return value from uuid_generate_time_generic() |
|
490 |
|
*/ |
|
491 |
|
void uuid_generate_time(uuid_t out) |
|
492 |
|
{ |
|
493 |
|
(void)uuid_generate_time_generic(out); |
|
494 |
|
} |
|
495 |
|
|
|
496 |
|
|
|
497 |
|
int uuid_generate_time_safe(uuid_t out) |
|
498 |
|
{ |
|
499 |
|
return uuid_generate_time_generic(out); |
|
500 |
|
} |
|
501 |
|
|
|
502 |
|
|
|
503 |
|
void __uuid_generate_random(uuid_t out, int *num) |
|
504 |
|
{ |
|
505 |
|
uuid_t buf; |
|
506 |
|
struct uuid uu; |
|
507 |
|
int i, n; |
|
508 |
|
|
|
509 |
|
if (!num || !*num) |
|
510 |
|
n = 1; |
|
511 |
|
else |
|
512 |
|
n = *num; |
|
513 |
|
|
|
514 |
|
for (i = 0; i < n; i++) { |
|
515 |
|
random_get_bytes(buf, sizeof(buf)); |
|
516 |
|
uuid_unpack(buf, &uu); |
|
517 |
|
|
|
518 |
|
uu.clock_seq = (uu.clock_seq & 0x3FFF) | 0x8000; |
|
519 |
|
uu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) |
|
520 |
|
| 0x4000; |
|
521 |
|
uuid_pack(&uu, out); |
|
522 |
|
out += sizeof(uuid_t); |
|
523 |
|
} |
|
524 |
|
} |
|
525 |
|
|
|
526 |
|
void uuid_generate_random(uuid_t out) |
|
527 |
|
{ |
|
528 |
|
int num = 1; |
|
529 |
|
/* No real reason to use the daemon for random uuid's -- yet */ |
|
530 |
|
|
|
531 |
|
__uuid_generate_random(out, &num); |
|
532 |
|
} |
|
533 |
|
|
|
534 |
|
/* |
|
535 |
|
* Check whether good random source (/dev/random or /dev/urandom) |
|
536 |
|
* is available. |
|
537 |
|
*/ |
|
538 |
|
static int have_random_source(void) |
|
539 |
|
{ |
|
540 |
|
struct stat s; |
|
541 |
|
|
|
542 |
|
return (!stat("/dev/random", &s) || !stat("/dev/urandom", &s)); |
|
543 |
|
} |
|
544 |
|
|
|
545 |
|
|
|
546 |
|
/* |
|
547 |
|
* This is the generic front-end to uuid_generate_random and |
|
548 |
|
* uuid_generate_time. It uses uuid_generate_random only if |
|
549 |
|
* /dev/urandom is available, since otherwise we won't have |
|
550 |
|
* high-quality randomness. |
|
551 |
|
*/ |
|
552 |
|
void uuid_generate(uuid_t out) |
|
553 |
|
{ |
|
554 |
|
if (have_random_source()) |
|
555 |
|
uuid_generate_random(out); |
|
556 |
|
else |
|
557 |
|
uuid_generate_time(out); |
|
558 |
|
} |
File src/utils/c.h added (mode: 100644) (index 0000000..a5162b9) |
|
1 |
|
/* |
|
2 |
|
* Fundamental C definitions. |
|
3 |
|
*/ |
|
4 |
|
|
|
5 |
|
#ifndef UTIL_LINUX_C_H |
|
6 |
|
#define UTIL_LINUX_C_H |
|
7 |
|
|
|
8 |
|
#include <limits.h> |
|
9 |
|
#include <stddef.h> |
|
10 |
|
#include <stdint.h> |
|
11 |
|
#include <stdio.h> |
|
12 |
|
#include <unistd.h> |
|
13 |
|
#include <stdarg.h> |
|
14 |
|
#include <stdlib.h> |
|
15 |
|
#include <string.h> |
|
16 |
|
#include <errno.h> |
|
17 |
|
|
|
18 |
|
#include <assert.h> |
|
19 |
|
|
|
20 |
|
#ifdef HAVE_ERR_H |
|
21 |
|
# include <err.h> |
|
22 |
|
#endif |
|
23 |
|
|
|
24 |
|
#ifdef HAVE_SYS_SYSMACROS_H |
|
25 |
|
# include <sys/sysmacros.h> /* for major, minor */ |
|
26 |
|
#endif |
|
27 |
|
|
|
28 |
|
#ifndef LOGIN_NAME_MAX |
|
29 |
|
# define LOGIN_NAME_MAX 256 |
|
30 |
|
#endif |
|
31 |
|
|
|
32 |
|
/* |
|
33 |
|
* Compiler-specific stuff |
|
34 |
|
*/ |
|
35 |
|
#ifndef __GNUC_PREREQ |
|
36 |
|
# if defined __GNUC__ && defined __GNUC_MINOR__ |
|
37 |
|
# define __GNUC_PREREQ(maj, min) \ |
|
38 |
|
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) |
|
39 |
|
# else |
|
40 |
|
# define __GNUC_PREREQ(maj, min) 0 |
|
41 |
|
# endif |
|
42 |
|
#endif |
|
43 |
|
|
|
44 |
|
#ifdef __GNUC__ |
|
45 |
|
|
|
46 |
|
/* &a[0] degrades to a pointer: a different type from an array */ |
|
47 |
|
# define __must_be_array(a) \ |
|
48 |
|
UL_BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(__typeof__(a), __typeof__(&a[0]))) |
|
49 |
|
|
|
50 |
|
# define ignore_result(x) __extension__ ({ \ |
|
51 |
|
__typeof__(x) __dummy __attribute__((__unused__)) = (x); (void) __dummy; \ |
|
52 |
|
}) |
|
53 |
|
|
|
54 |
|
#else /* !__GNUC__ */ |
|
55 |
|
# define __must_be_array(a) 0 |
|
56 |
|
# define __attribute__(_arg_) |
|
57 |
|
# define ignore_result(x) ((void) (x)) |
|
58 |
|
#endif /* !__GNUC__ */ |
|
59 |
|
|
|
60 |
|
/* |
|
61 |
|
* Function attributes |
|
62 |
|
*/ |
|
63 |
|
#ifndef __ul_alloc_size |
|
64 |
|
# if __GNUC_PREREQ (4, 3) |
|
65 |
|
# define __ul_alloc_size(s) __attribute__((alloc_size(s), warn_unused_result)) |
|
66 |
|
# else |
|
67 |
|
# define __ul_alloc_size(s) |
|
68 |
|
# endif |
|
69 |
|
#endif |
|
70 |
|
|
|
71 |
|
#ifndef __ul_calloc_size |
|
72 |
|
# if __GNUC_PREREQ (4, 3) |
|
73 |
|
# define __ul_calloc_size(n, s) __attribute__((alloc_size(n, s), warn_unused_result)) |
|
74 |
|
# else |
|
75 |
|
# define __ul_calloc_size(n, s) |
|
76 |
|
# endif |
|
77 |
|
#endif |
|
78 |
|
|
|
79 |
|
/* |
|
80 |
|
* Force a compilation error if condition is true, but also produce a |
|
81 |
|
* result (of value 0 and type size_t), so the expression can be used |
|
82 |
|
* e.g. in a structure initializer (or wherever else comma expressions |
|
83 |
|
* aren't permitted). |
|
84 |
|
*/ |
|
85 |
|
#define UL_BUILD_BUG_ON_ZERO(e) __extension__ (sizeof(struct { int:-!!(e); })) |
|
86 |
|
#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) |
|
87 |
|
|
|
88 |
|
#ifndef ARRAY_SIZE |
|
89 |
|
# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) |
|
90 |
|
#endif |
|
91 |
|
|
|
92 |
|
#ifndef PATH_MAX |
|
93 |
|
# define PATH_MAX 4096 |
|
94 |
|
#endif |
|
95 |
|
|
|
96 |
|
#ifndef TRUE |
|
97 |
|
# define TRUE 1 |
|
98 |
|
#endif |
|
99 |
|
|
|
100 |
|
#ifndef FALSE |
|
101 |
|
# define FALSE 0 |
|
102 |
|
#endif |
|
103 |
|
|
|
104 |
|
#ifndef min |
|
105 |
|
# define min(x, y) __extension__ ({ \ |
|
106 |
|
__typeof__(x) _min1 = (x); \ |
|
107 |
|
__typeof__(y) _min2 = (y); \ |
|
108 |
|
(void) (&_min1 == &_min2); \ |
|
109 |
|
_min1 < _min2 ? _min1 : _min2; }) |
|
110 |
|
#endif |
|
111 |
|
|
|
112 |
|
#ifndef max |
|
113 |
|
# define max(x, y) __extension__ ({ \ |
|
114 |
|
__typeof__(x) _max1 = (x); \ |
|
115 |
|
__typeof__(y) _max2 = (y); \ |
|
116 |
|
(void) (&_max1 == &_max2); \ |
|
117 |
|
_max1 > _max2 ? _max1 : _max2; }) |
|
118 |
|
#endif |
|
119 |
|
|
|
120 |
|
#ifndef cmp_numbers |
|
121 |
|
# define cmp_numbers(x, y) __extension__ ({ \ |
|
122 |
|
__typeof__(x) _a = (x); \ |
|
123 |
|
__typeof__(y) _b = (y); \ |
|
124 |
|
(void) (&_a == &_b); \ |
|
125 |
|
_a == _b ? 0 : _a > _b ? 1 : -1; }) |
|
126 |
|
#endif |
|
127 |
|
|
|
128 |
|
#ifndef offsetof |
|
129 |
|
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) |
|
130 |
|
#endif |
|
131 |
|
|
|
132 |
|
#ifndef container_of |
|
133 |
|
#define container_of(ptr, type, member) __extension__ ({ \ |
|
134 |
|
const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \ |
|
135 |
|
(type *)( (char *)__mptr - offsetof(type,member) );}) |
|
136 |
|
#endif |
|
137 |
|
|
|
138 |
|
#ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME |
|
139 |
|
# ifdef HAVE___PROGNAME |
|
140 |
|
extern char *__progname; |
|
141 |
|
# define program_invocation_short_name __progname |
|
142 |
|
# else |
|
143 |
|
# ifdef HAVE_GETEXECNAME |
|
144 |
|
# define program_invocation_short_name \ |
|
145 |
|
prog_inv_sh_nm_from_file(getexecname(), 0) |
|
146 |
|
# else |
|
147 |
|
# define program_invocation_short_name \ |
|
148 |
|
prog_inv_sh_nm_from_file(__FILE__, 1) |
|
149 |
|
# endif |
|
150 |
|
static char prog_inv_sh_nm_buf[256]; |
|
151 |
|
static inline char * |
|
152 |
|
prog_inv_sh_nm_from_file(char *f, char stripext) |
|
153 |
|
{ |
|
154 |
|
char *t; |
|
155 |
|
|
|
156 |
|
if ((t = strrchr(f, '/')) != NULL) |
|
157 |
|
t++; |
|
158 |
|
else |
|
159 |
|
t = f; |
|
160 |
|
|
|
161 |
|
strncpy(prog_inv_sh_nm_buf, t, sizeof(prog_inv_sh_nm_buf) - 1); |
|
162 |
|
prog_inv_sh_nm_buf[sizeof(prog_inv_sh_nm_buf) - 1] = '\0'; |
|
163 |
|
|
|
164 |
|
if (stripext && (t = strrchr(prog_inv_sh_nm_buf, '.')) != NULL) |
|
165 |
|
*t = '\0'; |
|
166 |
|
|
|
167 |
|
return prog_inv_sh_nm_buf; |
|
168 |
|
} |
|
169 |
|
# endif |
|
170 |
|
#endif |
|
171 |
|
|
|
172 |
|
|
|
173 |
|
#ifndef HAVE_ERR_H |
|
174 |
|
static inline void |
|
175 |
|
errmsg(char doexit, int excode, char adderr, const char *fmt, ...) |
|
176 |
|
{ |
|
177 |
|
fprintf(stderr, "%s: ", program_invocation_short_name); |
|
178 |
|
if (fmt != NULL) { |
|
179 |
|
va_list argp; |
|
180 |
|
va_start(argp, fmt); |
|
181 |
|
vfprintf(stderr, fmt, argp); |
|
182 |
|
va_end(argp); |
|
183 |
|
if (adderr) |
|
184 |
|
fprintf(stderr, ": "); |
|
185 |
|
} |
|
186 |
|
if (adderr) |
|
187 |
|
fprintf(stderr, "%m"); |
|
188 |
|
fprintf(stderr, "\n"); |
|
189 |
|
if (doexit) |
|
190 |
|
exit(excode); |
|
191 |
|
} |
|
192 |
|
|
|
193 |
|
#ifndef HAVE_ERR |
|
194 |
|
# define err(E, FMT...) errmsg(1, E, 1, FMT) |
|
195 |
|
#endif |
|
196 |
|
|
|
197 |
|
#ifndef HAVE_ERRX |
|
198 |
|
# define errx(E, FMT...) errmsg(1, E, 0, FMT) |
|
199 |
|
#endif |
|
200 |
|
|
|
201 |
|
#ifndef HAVE_WARN |
|
202 |
|
# define warn(FMT...) errmsg(0, 0, 1, FMT) |
|
203 |
|
#endif |
|
204 |
|
|
|
205 |
|
#ifndef HAVE_WARNX |
|
206 |
|
# define warnx(FMT...) errmsg(0, 0, 0, FMT) |
|
207 |
|
#endif |
|
208 |
|
#endif /* !HAVE_ERR_H */ |
|
209 |
|
|
|
210 |
|
|
|
211 |
|
/* Don't use inline function to avoid '#include "nls.h"' in c.h |
|
212 |
|
*/ |
|
213 |
|
#define errtryhelp(eval) __extension__ ({ \ |
|
214 |
|
fprintf(stderr, _("Try '%s --help' for more information.\n"), \ |
|
215 |
|
program_invocation_short_name); \ |
|
216 |
|
exit(eval); \ |
|
217 |
|
}) |
|
218 |
|
|
|
219 |
|
#define errtryh(eval) __extension__ ({ \ |
|
220 |
|
fprintf(stderr, _("Try '%s -h' for more information.\n"), \ |
|
221 |
|
program_invocation_short_name); \ |
|
222 |
|
exit(eval); \ |
|
223 |
|
}) |
|
224 |
|
|
|
225 |
|
|
|
226 |
|
static inline __attribute__((const)) int is_power_of_2(unsigned long num) |
|
227 |
|
{ |
|
228 |
|
return (num != 0 && ((num & (num - 1)) == 0)); |
|
229 |
|
} |
|
230 |
|
|
|
231 |
|
#ifndef HAVE_LOFF_T |
|
232 |
|
typedef int64_t loff_t; |
|
233 |
|
#endif |
|
234 |
|
|
|
235 |
|
#if !defined(HAVE_DIRFD) && (!defined(HAVE_DECL_DIRFD) || HAVE_DECL_DIRFD == 0) && defined(HAVE_DIR_DD_FD) |
|
236 |
|
#include <sys/types.h> |
|
237 |
|
#include <dirent.h> |
|
238 |
|
static inline int dirfd(DIR *d) |
|
239 |
|
{ |
|
240 |
|
return d->dd_fd; |
|
241 |
|
} |
|
242 |
|
#endif |
|
243 |
|
|
|
244 |
|
/* |
|
245 |
|
* Fallback defines for old versions of glibc |
|
246 |
|
*/ |
|
247 |
|
#include <fcntl.h> |
|
248 |
|
|
|
249 |
|
#ifdef O_CLOEXEC |
|
250 |
|
#define UL_CLOEXECSTR "e" |
|
251 |
|
#else |
|
252 |
|
#define UL_CLOEXECSTR "" |
|
253 |
|
#endif |
|
254 |
|
|
|
255 |
|
#ifndef O_CLOEXEC |
|
256 |
|
#define O_CLOEXEC 0 |
|
257 |
|
#endif |
|
258 |
|
|
|
259 |
|
#ifdef __FreeBSD_kernel__ |
|
260 |
|
#ifndef F_DUPFD_CLOEXEC |
|
261 |
|
#define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ |
|
262 |
|
#endif |
|
263 |
|
#endif |
|
264 |
|
|
|
265 |
|
|
|
266 |
|
#ifndef AI_ADDRCONFIG |
|
267 |
|
#define AI_ADDRCONFIG 0x0020 |
|
268 |
|
#endif |
|
269 |
|
|
|
270 |
|
#ifndef IUTF8 |
|
271 |
|
#define IUTF8 0040000 |
|
272 |
|
#endif |
|
273 |
|
|
|
274 |
|
/* |
|
275 |
|
* MAXHOSTNAMELEN replacement |
|
276 |
|
*/ |
|
277 |
|
static inline size_t get_hostname_max(void) |
|
278 |
|
{ |
|
279 |
|
long len = sysconf(_SC_HOST_NAME_MAX); |
|
280 |
|
|
|
281 |
|
if (0 < len) |
|
282 |
|
return len; |
|
283 |
|
|
|
284 |
|
#ifdef MAXHOSTNAMELEN |
|
285 |
|
return MAXHOSTNAMELEN; |
|
286 |
|
#elif HOST_NAME_MAX |
|
287 |
|
return HOST_NAME_MAX; |
|
288 |
|
#endif |
|
289 |
|
return 64; |
|
290 |
|
} |
|
291 |
|
|
|
292 |
|
/* |
|
293 |
|
* The usleep function was marked obsolete in POSIX.1-2001 and was removed |
|
294 |
|
* in POSIX.1-2008. It was replaced with nanosleep() that provides more |
|
295 |
|
* advantages (like no interaction with signals and other timer functions). |
|
296 |
|
*/ |
|
297 |
|
#include <time.h> |
|
298 |
|
|
|
299 |
|
static inline int xusleep(useconds_t usec) |
|
300 |
|
{ |
|
301 |
|
#ifdef HAVE_NANOSLEEP |
|
302 |
|
struct timespec waittime = { |
|
303 |
|
.tv_sec = usec / 1000000L, |
|
304 |
|
.tv_nsec = (usec % 1000000L) * 1000 |
|
305 |
|
}; |
|
306 |
|
return nanosleep(&waittime, NULL); |
|
307 |
|
#elif defined(HAVE_USLEEP) |
|
308 |
|
return usleep(usec); |
|
309 |
|
#else |
|
310 |
|
# error "System with usleep() or nanosleep() required!" |
|
311 |
|
#endif |
|
312 |
|
} |
|
313 |
|
|
|
314 |
|
/* |
|
315 |
|
* Constant strings for usage() functions. For more info see |
|
316 |
|
* Documentation/howto-usage-function.txt and disk-utils/delpart.c |
|
317 |
|
*/ |
|
318 |
|
#define USAGE_HEADER _("\nUsage:\n") |
|
319 |
|
#define USAGE_OPTIONS _("\nOptions:\n") |
|
320 |
|
#define USAGE_SEPARATOR "\n" |
|
321 |
|
#define USAGE_HELP _(" -h, --help display this help and exit\n") |
|
322 |
|
#define USAGE_VERSION _(" -V, --version output version information and exit\n") |
|
323 |
|
#define USAGE_MAN_TAIL(_man) _("\nFor more details see %s.\n"), _man |
|
324 |
|
|
|
325 |
|
#define UTIL_LINUX_VERSION _("%s from %s\n"), program_invocation_short_name, PACKAGE_STRING |
|
326 |
|
|
|
327 |
|
/* |
|
328 |
|
* scanf modifiers for "strings allocation" |
|
329 |
|
*/ |
|
330 |
|
#ifdef HAVE_SCANF_MS_MODIFIER |
|
331 |
|
#define UL_SCNsA "%ms" |
|
332 |
|
#elif defined(HAVE_SCANF_AS_MODIFIER) |
|
333 |
|
#define UL_SCNsA "%as" |
|
334 |
|
#endif |
|
335 |
|
|
|
336 |
|
/* |
|
337 |
|
* seek stuff |
|
338 |
|
*/ |
|
339 |
|
#ifndef SEEK_DATA |
|
340 |
|
# define SEEK_DATA 3 |
|
341 |
|
#endif |
|
342 |
|
#ifndef SEEK_HOLE |
|
343 |
|
# define SEEK_HOLE 4 |
|
344 |
|
#endif |
|
345 |
|
|
|
346 |
|
|
|
347 |
|
/* |
|
348 |
|
* Macros to convert #define'itions to strings, for example |
|
349 |
|
* #define XYXXY 42 |
|
350 |
|
* printf ("%s=%s\n", stringify(XYXXY), stringify_value(XYXXY)); |
|
351 |
|
*/ |
|
352 |
|
#define stringify_value(s) stringify(s) |
|
353 |
|
#define stringify(s) #s |
|
354 |
|
|
|
355 |
|
/* |
|
356 |
|
* UL_ASAN_BLACKLIST is a macro to tell AddressSanitizer (a compile-time |
|
357 |
|
* instrumentation shipped with Clang and GCC) to not instrument the |
|
358 |
|
* annotated function. Furthermore, it will prevent the compiler from |
|
359 |
|
* inlining the function because inlining currently breaks the blacklisting |
|
360 |
|
* mechanism of AddressSanitizer. |
|
361 |
|
*/ |
|
362 |
|
#if defined(__has_feature) |
|
363 |
|
# if __has_feature(address_sanitizer) |
|
364 |
|
# define UL_ASAN_BLACKLIST __attribute__((noinline)) __attribute__((no_sanitize_memory)) __attribute__((no_sanitize_address)) |
|
365 |
|
# else |
|
366 |
|
# define UL_ASAN_BLACKLIST /* nothing */ |
|
367 |
|
# endif |
|
368 |
|
#else |
|
369 |
|
# define UL_ASAN_BLACKLIST /* nothing */ |
|
370 |
|
#endif |
|
371 |
|
|
|
372 |
|
|
|
373 |
|
|
|
374 |
|
/* |
|
375 |
|
* Note that sysconf(_SC_GETPW_R_SIZE_MAX) returns *initial* suggested size for |
|
376 |
|
* pwd buffer and in some cases it is not large enough. See POSIX and |
|
377 |
|
* getpwnam_r man page for more details. |
|
378 |
|
*/ |
|
379 |
|
#define UL_GETPW_BUFSIZ (16 * 1024) |
|
380 |
|
|
|
381 |
|
/* |
|
382 |
|
* Darwin or other BSDs may only have MAP_ANON. To get it on Darwin we must |
|
383 |
|
* define _DARWIN_C_SOURCE before including sys/mman.h. We do this in config.h. |
|
384 |
|
*/ |
|
385 |
|
#if !defined MAP_ANONYMOUS && defined MAP_ANON |
|
386 |
|
# define MAP_ANONYMOUS (MAP_ANON) |
|
387 |
|
#endif |
|
388 |
|
|
|
389 |
|
#endif /* UTIL_LINUX_C_H */ |
File src/utils/strutils.h added (mode: 100644) (index 0000000..28c1b5e) |
|
1 |
|
#ifndef UTIL_LINUX_STRUTILS |
|
2 |
|
#define UTIL_LINUX_STRUTILS |
|
3 |
|
|
|
4 |
|
#include <stdlib.h> |
|
5 |
|
#include <inttypes.h> |
|
6 |
|
#include <string.h> |
|
7 |
|
#include <sys/types.h> |
|
8 |
|
#include <ctype.h> |
|
9 |
|
#include <stdio.h> |
|
10 |
|
#include <errno.h> |
|
11 |
|
|
|
12 |
|
/* default strtoxx_or_err() exit code */ |
|
13 |
|
#ifndef STRTOXX_EXIT_CODE |
|
14 |
|
# define STRTOXX_EXIT_CODE EXIT_FAILURE |
|
15 |
|
#endif |
|
16 |
|
|
|
17 |
|
|
|
18 |
|
extern int parse_size(const char *str, uintmax_t *res, int *power); |
|
19 |
|
extern int strtosize(const char *str, uintmax_t *res); |
|
20 |
|
extern uintmax_t strtosize_or_err(const char *str, const char *errmesg); |
|
21 |
|
|
|
22 |
|
extern int16_t strtos16_or_err(const char *str, const char *errmesg); |
|
23 |
|
extern uint16_t strtou16_or_err(const char *str, const char *errmesg); |
|
24 |
|
extern uint16_t strtox16_or_err(const char *str, const char *errmesg); |
|
25 |
|
|
|
26 |
|
extern int32_t strtos32_or_err(const char *str, const char *errmesg); |
|
27 |
|
extern uint32_t strtou32_or_err(const char *str, const char *errmesg); |
|
28 |
|
extern uint32_t strtox32_or_err(const char *str, const char *errmesg); |
|
29 |
|
|
|
30 |
|
extern int64_t strtos64_or_err(const char *str, const char *errmesg); |
|
31 |
|
extern uint64_t strtou64_or_err(const char *str, const char *errmesg); |
|
32 |
|
extern uint64_t strtox64_or_err(const char *str, const char *errmesg); |
|
33 |
|
|
|
34 |
|
extern double strtod_or_err(const char *str, const char *errmesg); |
|
35 |
|
|
|
36 |
|
extern long strtol_or_err(const char *str, const char *errmesg); |
|
37 |
|
extern unsigned long strtoul_or_err(const char *str, const char *errmesg); |
|
38 |
|
|
|
39 |
|
extern void strtotimeval_or_err(const char *str, struct timeval *tv, |
|
40 |
|
const char *errmesg); |
|
41 |
|
|
|
42 |
|
extern int isdigit_strend(const char *str, const char **end); |
|
43 |
|
#define isdigit_string(_s) isdigit_strend(_s, NULL) |
|
44 |
|
|
|
45 |
|
extern int isxdigit_strend(const char *str, const char **end); |
|
46 |
|
#define isxdigit_string(_s) isxdigit_strend(_s, NULL) |
|
47 |
|
|
|
48 |
|
|
|
49 |
|
extern int parse_switch(const char *arg, const char *errmesg, ...); |
|
50 |
|
|
|
51 |
|
#ifndef HAVE_MEMPCPY |
|
52 |
|
extern void *mempcpy(void *restrict dest, const void *restrict src, size_t n); |
|
53 |
|
#endif |
|
54 |
|
#ifndef HAVE_STRNLEN |
|
55 |
|
extern size_t strnlen(const char *s, size_t maxlen); |
|
56 |
|
#endif |
|
57 |
|
#ifndef HAVE_STRNDUP |
|
58 |
|
extern char *strndup(const char *s, size_t n); |
|
59 |
|
#endif |
|
60 |
|
#ifndef HAVE_STRNCHR |
|
61 |
|
extern char *strnchr(const char *s, size_t maxlen, int c); |
|
62 |
|
#endif |
|
63 |
|
|
|
64 |
|
/* caller guarantees n > 0 */ |
|
65 |
|
static inline void xstrncpy(char *dest, const char *src, size_t n) |
|
66 |
|
{ |
|
67 |
|
strncpy(dest, src, n-1); |
|
68 |
|
dest[n-1] = 0; |
|
69 |
|
} |
|
70 |
|
|
|
71 |
|
static inline int strdup_to_offset(void *stru, size_t offset, const char *str) |
|
72 |
|
{ |
|
73 |
|
char *n = NULL; |
|
74 |
|
char **o; |
|
75 |
|
|
|
76 |
|
if (!stru) |
|
77 |
|
return -EINVAL; |
|
78 |
|
|
|
79 |
|
o = (char **) ((char *) stru + offset); |
|
80 |
|
if (str) { |
|
81 |
|
n = strdup(str); |
|
82 |
|
if (!n) |
|
83 |
|
return -ENOMEM; |
|
84 |
|
} |
|
85 |
|
|
|
86 |
|
free(*o); |
|
87 |
|
*o = n; |
|
88 |
|
return 0; |
|
89 |
|
} |
|
90 |
|
|
|
91 |
|
#define strdup_to_struct_member(_s, _m, _str) \ |
|
92 |
|
strdup_to_offset((void *) _s, offsetof(__typeof__(*(_s)), _m), _str) |
|
93 |
|
|
|
94 |
|
extern void xstrmode(mode_t mode, char *str); |
|
95 |
|
|
|
96 |
|
/* Options for size_to_human_string() */ |
|
97 |
|
enum |
|
98 |
|
{ |
|
99 |
|
SIZE_SUFFIX_1LETTER = 0, |
|
100 |
|
SIZE_SUFFIX_3LETTER = 1, |
|
101 |
|
SIZE_SUFFIX_SPACE = 2 |
|
102 |
|
}; |
|
103 |
|
|
|
104 |
|
extern char *size_to_human_string(int options, uint64_t bytes); |
|
105 |
|
|
|
106 |
|
extern int string_to_idarray(const char *list, int ary[], size_t arysz, |
|
107 |
|
int (name2id)(const char *, size_t)); |
|
108 |
|
extern int string_add_to_idarray(const char *list, int ary[], |
|
109 |
|
size_t arysz, size_t *ary_pos, |
|
110 |
|
int (name2id)(const char *, size_t)); |
|
111 |
|
|
|
112 |
|
extern int string_to_bitarray(const char *list, char *ary, |
|
113 |
|
int (*name2bit)(const char *, size_t)); |
|
114 |
|
|
|
115 |
|
extern int string_to_bitmask(const char *list, |
|
116 |
|
unsigned long *mask, |
|
117 |
|
long (*name2flag)(const char *, size_t)); |
|
118 |
|
extern int parse_range(const char *str, int *lower, int *upper, int def); |
|
119 |
|
|
|
120 |
|
extern int streq_paths(const char *a, const char *b); |
|
121 |
|
|
|
122 |
|
/* |
|
123 |
|
* Match string beginning. |
|
124 |
|
*/ |
|
125 |
|
static inline const char *startswith(const char *s, const char *prefix) |
|
126 |
|
{ |
|
127 |
|
size_t sz = prefix ? strlen(prefix) : 0; |
|
128 |
|
|
|
129 |
|
if (s && sz && strncmp(s, prefix, sz) == 0) |
|
130 |
|
return s + sz; |
|
131 |
|
return NULL; |
|
132 |
|
} |
|
133 |
|
|
|
134 |
|
/* |
|
135 |
|
* Case insensitive match string beginning. |
|
136 |
|
*/ |
|
137 |
|
static inline const char *startswith_no_case(const char *s, const char *prefix) |
|
138 |
|
{ |
|
139 |
|
size_t sz = prefix ? strlen(prefix) : 0; |
|
140 |
|
|
|
141 |
|
if (s && sz && strncasecmp(s, prefix, sz) == 0) |
|
142 |
|
return s + sz; |
|
143 |
|
return NULL; |
|
144 |
|
} |
|
145 |
|
|
|
146 |
|
/* |
|
147 |
|
* Match string ending. |
|
148 |
|
*/ |
|
149 |
|
static inline const char *endswith(const char *s, const char *postfix) |
|
150 |
|
{ |
|
151 |
|
size_t sl = s ? strlen(s) : 0; |
|
152 |
|
size_t pl = postfix ? strlen(postfix) : 0; |
|
153 |
|
|
|
154 |
|
if (pl == 0) |
|
155 |
|
return (char *)s + sl; |
|
156 |
|
if (sl < pl) |
|
157 |
|
return NULL; |
|
158 |
|
if (memcmp(s + sl - pl, postfix, pl) != 0) |
|
159 |
|
return NULL; |
|
160 |
|
return (char *)s + sl - pl; |
|
161 |
|
} |
|
162 |
|
|
|
163 |
|
/* |
|
164 |
|
* Skip leading white space. |
|
165 |
|
*/ |
|
166 |
|
static inline const char *skip_space(const char *p) |
|
167 |
|
{ |
|
168 |
|
while (isspace(*p)) |
|
169 |
|
++p; |
|
170 |
|
return p; |
|
171 |
|
} |
|
172 |
|
|
|
173 |
|
static inline const char *skip_blank(const char *p) |
|
174 |
|
{ |
|
175 |
|
while (isblank(*p)) |
|
176 |
|
++p; |
|
177 |
|
return p; |
|
178 |
|
} |
|
179 |
|
|
|
180 |
|
|
|
181 |
|
/* Removes whitespace from the right-hand side of a string (trailing |
|
182 |
|
* whitespace). |
|
183 |
|
* |
|
184 |
|
* Returns size of the new string (without \0). |
|
185 |
|
*/ |
|
186 |
|
static inline size_t rtrim_whitespace(unsigned char *str) |
|
187 |
|
{ |
|
188 |
|
size_t i; |
|
189 |
|
|
|
190 |
|
if (!str) |
|
191 |
|
return 0; |
|
192 |
|
i = strlen((char *) str); |
|
193 |
|
while (i) { |
|
194 |
|
i--; |
|
195 |
|
if (!isspace(str[i])) { |
|
196 |
|
i++; |
|
197 |
|
break; |
|
198 |
|
} |
|
199 |
|
} |
|
200 |
|
str[i] = '\0'; |
|
201 |
|
return i; |
|
202 |
|
} |
|
203 |
|
|
|
204 |
|
/* Removes whitespace from the left-hand side of a string. |
|
205 |
|
* |
|
206 |
|
* Returns size of the new string (without \0). |
|
207 |
|
*/ |
|
208 |
|
static inline size_t ltrim_whitespace(unsigned char *str) |
|
209 |
|
{ |
|
210 |
|
size_t len; |
|
211 |
|
unsigned char *p; |
|
212 |
|
|
|
213 |
|
if (!str) |
|
214 |
|
return 0; |
|
215 |
|
for (p = str; *p && isspace(*p); p++); |
|
216 |
|
|
|
217 |
|
len = strlen((char *) p); |
|
218 |
|
|
|
219 |
|
if (len && p > str) |
|
220 |
|
memmove(str, p, len + 1); |
|
221 |
|
|
|
222 |
|
return len; |
|
223 |
|
} |
|
224 |
|
|
|
225 |
|
extern char *strnappend(const char *s, const char *suffix, size_t b); |
|
226 |
|
extern char *strappend(const char *s, const char *suffix); |
|
227 |
|
extern char *strfappend(const char *s, const char *format, ...) |
|
228 |
|
__attribute__ ((__format__ (__printf__, 2, 0))); |
|
229 |
|
extern const char *split(const char **state, size_t *l, const char *separator, int quoted); |
|
230 |
|
|
|
231 |
|
extern int skip_fline(FILE *fp); |
|
232 |
|
|
|
233 |
|
#endif |
File src/uuid.h added (mode: 100644) (index 0000000..30bd4c0) |
|
1 |
|
/* |
|
2 |
|
* Public include file for the UUID library |
|
3 |
|
* |
|
4 |
|
* Copyright (C) 1996, 1997, 1998 Theodore Ts'o. |
|
5 |
|
* |
|
6 |
|
* %Begin-Header% |
|
7 |
|
* Redistribution and use in source and binary forms, with or without |
|
8 |
|
* modification, are permitted provided that the following conditions |
|
9 |
|
* are met: |
|
10 |
|
* 1. Redistributions of source code must retain the above copyright |
|
11 |
|
* notice, and the entire permission notice in its entirety, |
|
12 |
|
* including the disclaimer of warranties. |
|
13 |
|
* 2. Redistributions in binary form must reproduce the above copyright |
|
14 |
|
* notice, this list of conditions and the following disclaimer in the |
|
15 |
|
* documentation and/or other materials provided with the distribution. |
|
16 |
|
* 3. The name of the author may not be used to endorse or promote |
|
17 |
|
* products derived from this software without specific prior |
|
18 |
|
* written permission. |
|
19 |
|
* |
|
20 |
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
|
21 |
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
|
22 |
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF |
|
23 |
|
* WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE |
|
24 |
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
25 |
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
|
26 |
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
|
27 |
|
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
|
28 |
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
29 |
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE |
|
30 |
|
* USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH |
|
31 |
|
* DAMAGE. |
|
32 |
|
* %End-Header% |
|
33 |
|
*/ |
|
34 |
|
|
|
35 |
|
#ifndef _UUID_UUID_H |
|
36 |
|
#define _UUID_UUID_H |
|
37 |
|
|
|
38 |
|
#include <sys/types.h> |
|
39 |
|
#ifndef _WIN32 |
|
40 |
|
#include <sys/time.h> |
|
41 |
|
#endif |
|
42 |
|
#include <time.h> |
|
43 |
|
|
|
44 |
|
typedef unsigned char uuid_t[16]; |
|
45 |
|
|
|
46 |
|
/* UUID Variant definitions */ |
|
47 |
|
#define UUID_VARIANT_NCS 0 |
|
48 |
|
#define UUID_VARIANT_DCE 1 |
|
49 |
|
#define UUID_VARIANT_MICROSOFT 2 |
|
50 |
|
#define UUID_VARIANT_OTHER 3 |
|
51 |
|
|
|
52 |
|
/* UUID Type definitions */ |
|
53 |
|
#define UUID_TYPE_DCE_TIME 1 |
|
54 |
|
#define UUID_TYPE_DCE_RANDOM 4 |
|
55 |
|
|
|
56 |
|
/* Allow UUID constants to be defined */ |
|
57 |
|
#ifdef __GNUC__ |
|
58 |
|
#define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \ |
|
59 |
|
static const uuid_t name __attribute__ ((unused)) = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15} |
|
60 |
|
#else |
|
61 |
|
#define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \ |
|
62 |
|
static const uuid_t name = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15} |
|
63 |
|
#endif |
|
64 |
|
|
|
65 |
|
#ifdef __cplusplus |
|
66 |
|
extern "C" { |
|
67 |
|
#endif |
|
68 |
|
|
|
69 |
|
/* clear.c */ |
|
70 |
|
extern void uuid_clear(uuid_t uu); |
|
71 |
|
|
|
72 |
|
/* compare.c */ |
|
73 |
|
extern int uuid_compare(const uuid_t uu1, const uuid_t uu2); |
|
74 |
|
|
|
75 |
|
/* copy.c */ |
|
76 |
|
extern void uuid_copy(uuid_t dst, const uuid_t src); |
|
77 |
|
|
|
78 |
|
/* gen_uuid.c */ |
|
79 |
|
extern void uuid_generate(uuid_t out); |
|
80 |
|
extern void uuid_generate_random(uuid_t out); |
|
81 |
|
extern void uuid_generate_time(uuid_t out); |
|
82 |
|
extern int uuid_generate_time_safe(uuid_t out); |
|
83 |
|
|
|
84 |
|
/* isnull.c */ |
|
85 |
|
extern int uuid_is_null(const uuid_t uu); |
|
86 |
|
|
|
87 |
|
/* parse.c */ |
|
88 |
|
extern int uuid_parse(const char *in, uuid_t uu); |
|
89 |
|
|
|
90 |
|
/* unparse.c */ |
|
91 |
|
extern void uuid_unparse(const uuid_t uu, char *out); |
|
92 |
|
extern void uuid_unparse_lower(const uuid_t uu, char *out); |
|
93 |
|
extern void uuid_unparse_upper(const uuid_t uu, char *out); |
|
94 |
|
|
|
95 |
|
/* uuid_time.c */ |
|
96 |
|
extern time_t uuid_time(const uuid_t uu, struct timeval *ret_tv); |
|
97 |
|
extern int uuid_type(const uuid_t uu); |
|
98 |
|
extern int uuid_variant(const uuid_t uu); |
|
99 |
|
|
|
100 |
|
#ifdef __cplusplus |
|
101 |
|
} |
|
102 |
|
#endif |
|
103 |
|
|
|
104 |
|
#endif /* _UUID_UUID_H */ |