Mercurial > hg > octave-shane > gnulib-hg
annotate modules/byteswap @ 17388:3c592b4deb04
utimensat-tests, etc.: try to fix some races
Problem reported by Bernhard Voelker in
<http://lists.gnu.org/archive/html/bug-gnulib/2013-04/msg00071.html>.
I don't know whether this patch fixes that race condition, but it
fixes *some* race conditions, so it should be a win.
* modules/chown-tests (Depends-on):
* modules/fchownat-tests (Depends-on):
* modules/fdutimensat-tests (Depends-on):
* modules/futimens-tests (Depends-on):
* modules/lchown-tests (Depends-on):
* modules/stat-time-tests (Depends-on):
* modules/utimens-tests (Depends-on):
* modules/utimensat-tests (Depends-on):
Depend on nanosleep, not usleep.
* modules/chown-tests (test_chown_LDADD):
* modules/lchown-tests (test_lchown_LDADD):
* modules/stat-time-tests (test_stat_time_LDADD):
New macro.
* modules/fchownat-tests (test_fchownat_LDADD):
* modules/fdutimensat-tests (test_fdutimensat_LDADD):
* modules/futimens-tests (test_futimens_LDADD):
* modules/utimens-tests (test_utimens_LDADD):
* modules/utimensat-tests (test_utimensat_LDADD):
Add $(LIB_NANOSLEEP).
* modules/stat-time-tests (Files): Add tests/nap.h.
* tests/nap.h: Include <limits.h>, for INT_MAX.
(lt_mtime): Remove.
(diff_timespec): New function.
(get_stat): Rename from get_mtime. All callers changed.
(nap_works): Determine the needed delay by inspecting the
file system's timestamp jumps; this should be more reliable.
Look at both mtime and ctime, and take the maximum of the two jumps.
(nap_works, guess_delay):
Return a nanosecond cound, not a microsecond count.
All callers changed.
(nap_works, nap): Use nanosleep, not usleep. Check for nanosleep
failure.
(nap): Multiply the guess by 1.125, to accommodate the case where
the file system's clock is a bit slower than nanosleep's clock.
* tests/test-stat-time.c (BASE): New macro.
Include nap.h.
(nap): Remove; nap.h now defines this. This removes a duplicate
implementation of 'nap'.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Tue, 30 Apr 2013 23:14:19 -0700 |
parents | 662ae53d8d37 |
children | 6758fa38915e |
rev | line source |
---|---|
5810 | 1 Description: |
2 Swap bytes of 16, 32 and 64 bit values. | |
3 | |
4 Files: | |
9245
de761f780257
Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
7497
diff
changeset
|
5 lib/byteswap.in.h |
5810 | 6 m4/byteswap.m4 |
7 | |
8 Depends-on: | |
9 | |
10 configure.ac: | |
11 gl_BYTESWAP | |
12 | |
13 Makefile.am: | |
14 BUILT_SOURCES += $(BYTESWAP_H) | |
15 | |
6001
322a0918d54a
* modules/alloca-opt (Makefile.am): Remove explicit dependency on
Paul Eggert <eggert@cs.ucla.edu>
parents:
5810
diff
changeset
|
16 # We need the following in order to create <byteswap.h> when the system |
5810 | 17 # doesn't have one. |
14528
662ae53d8d37
Remove leftover generated .h files after config.status changed.
Bruno Haible <bruno@clisp.org>
parents:
14273
diff
changeset
|
18 if GL_GENERATE_BYTESWAP_H |
662ae53d8d37
Remove leftover generated .h files after config.status changed.
Bruno Haible <bruno@clisp.org>
parents:
14273
diff
changeset
|
19 byteswap.h: byteswap.in.h $(top_builddir)/config.status |
11868
67c2b22aff08
annotate automake snippets with $(AM_V_GEN) and $(AM_V_at)
Jim Meyering <meyering@redhat.com>
parents:
11858
diff
changeset
|
20 $(AM_V_GEN)rm -f $@-t $@ && \ |
7421
8bace4b08db5
Mark generated files as "DO NOT EDIT".
Bruno Haible <bruno@clisp.org>
parents:
7274
diff
changeset
|
21 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ |
9245
de761f780257
Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
7497
diff
changeset
|
22 cat $(srcdir)/byteswap.in.h; \ |
11868
67c2b22aff08
annotate automake snippets with $(AM_V_GEN) and $(AM_V_at)
Jim Meyering <meyering@redhat.com>
parents:
11858
diff
changeset
|
23 } > $@-t && \ |
7274
9ff9e0f3d681
Don't make generated files read-only. That would bother too many
Jim Meyering <jim@meyering.net>
parents:
7268
diff
changeset
|
24 mv -f $@-t $@ |
14528
662ae53d8d37
Remove leftover generated .h files after config.status changed.
Bruno Haible <bruno@clisp.org>
parents:
14273
diff
changeset
|
25 else |
662ae53d8d37
Remove leftover generated .h files after config.status changed.
Bruno Haible <bruno@clisp.org>
parents:
14273
diff
changeset
|
26 byteswap.h: $(top_builddir)/config.status |
662ae53d8d37
Remove leftover generated .h files after config.status changed.
Bruno Haible <bruno@clisp.org>
parents:
14273
diff
changeset
|
27 rm -f $@ |
662ae53d8d37
Remove leftover generated .h files after config.status changed.
Bruno Haible <bruno@clisp.org>
parents:
14273
diff
changeset
|
28 endif |
5810 | 29 MOSTLYCLEANFILES += byteswap.h byteswap.h-t |
30 | |
31 Include: | |
32 <byteswap.h> | |
33 | |
34 License: | |
9757
1c1c832cb7f3
Re-license byteswap to LGPLv2+.
Simon Josefsson <simon@josefsson.org>
parents:
9245
diff
changeset
|
35 LGPLv2+ |
5810 | 36 |
37 Maintainer: | |
38 Oskar Liljeblad |