diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dup2.c | 71 | ||||
| -rw-r--r-- | lib/gnulib.mk | 201 | ||||
| -rw-r--r-- | lib/lstat.c | 10 | ||||
| -rw-r--r-- | lib/makefile.w32-in | 8 | ||||
| -rw-r--r-- | lib/pathmax.h | 84 | ||||
| -rw-r--r-- | lib/pthread_sigmask.c | 40 | ||||
| -rw-r--r-- | lib/sha256.c | 2 | ||||
| -rw-r--r-- | lib/sha512.c | 2 | ||||
| -rw-r--r-- | lib/signal.in.h | 39 | ||||
| -rw-r--r-- | lib/sigprocmask.c | 55 | ||||
| -rw-r--r-- | lib/stat.c | 24 | ||||
| -rw-r--r-- | lib/stdint.in.h | 96 | ||||
| -rw-r--r-- | lib/stdio.in.h | 38 | ||||
| -rw-r--r-- | lib/stdlib.in.h | 8 | ||||
| -rw-r--r-- | lib/sys_stat.in.h | 32 | ||||
| -rw-r--r-- | lib/unistd.in.h | 138 |
16 files changed, 609 insertions, 239 deletions
diff --git a/lib/dup2.c b/lib/dup2.c index e00dc7b2e3c..790c98a2e84 100644 --- a/lib/dup2.c +++ b/lib/dup2.c | |||
| @@ -25,21 +25,26 @@ | |||
| 25 | #include <errno.h> | 25 | #include <errno.h> |
| 26 | #include <fcntl.h> | 26 | #include <fcntl.h> |
| 27 | 27 | ||
| 28 | #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ | ||
| 29 | /* Get declarations of the Win32 API functions. */ | ||
| 30 | # define WIN32_LEAN_AND_MEAN | ||
| 31 | # include <windows.h> | ||
| 32 | #endif | ||
| 33 | |||
| 34 | #if HAVE_DUP2 | 28 | #if HAVE_DUP2 |
| 35 | 29 | ||
| 36 | # undef dup2 | 30 | # undef dup2 |
| 37 | 31 | ||
| 38 | int | 32 | # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ |
| 39 | rpl_dup2 (int fd, int desired_fd) | 33 | |
| 34 | /* Get declarations of the Win32 API functions. */ | ||
| 35 | # define WIN32_LEAN_AND_MEAN | ||
| 36 | # include <windows.h> | ||
| 37 | |||
| 38 | # include "msvc-inval.h" | ||
| 39 | |||
| 40 | /* Get _get_osfhandle. */ | ||
| 41 | # include "msvc-nothrow.h" | ||
| 42 | |||
| 43 | static int | ||
| 44 | ms_windows_dup2 (int fd, int desired_fd) | ||
| 40 | { | 45 | { |
| 41 | int result; | 46 | int result; |
| 42 | # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ | 47 | |
| 43 | /* If fd is closed, mingw hangs on dup2 (fd, fd). If fd is open, | 48 | /* If fd is closed, mingw hangs on dup2 (fd, fd). If fd is open, |
| 44 | dup2 (fd, fd) returns 0, but all further attempts to use fd in | 49 | dup2 (fd, fd) returns 0, but all further attempts to use fd in |
| 45 | future dup2 calls will hang. */ | 50 | future dup2 calls will hang. */ |
| @@ -52,6 +57,7 @@ rpl_dup2 (int fd, int desired_fd) | |||
| 52 | } | 57 | } |
| 53 | return fd; | 58 | return fd; |
| 54 | } | 59 | } |
| 60 | |||
| 55 | /* Wine 1.0.1 return 0 when desired_fd is negative but not -1: | 61 | /* Wine 1.0.1 return 0 when desired_fd is negative but not -1: |
| 56 | http://bugs.winehq.org/show_bug.cgi?id=21289 */ | 62 | http://bugs.winehq.org/show_bug.cgi?id=21289 */ |
| 57 | if (desired_fd < 0) | 63 | if (desired_fd < 0) |
| @@ -59,26 +65,45 @@ rpl_dup2 (int fd, int desired_fd) | |||
| 59 | errno = EBADF; | 65 | errno = EBADF; |
| 60 | return -1; | 66 | return -1; |
| 61 | } | 67 | } |
| 62 | # elif !defined __linux__ | 68 | |
| 63 | /* On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC. */ | 69 | TRY_MSVC_INVAL |
| 64 | if (fd == desired_fd) | 70 | { |
| 65 | return fcntl (fd, F_GETFL) == -1 ? -1 : fd; | 71 | result = dup2 (fd, desired_fd); |
| 66 | # endif | 72 | } |
| 67 | result = dup2 (fd, desired_fd); | 73 | CATCH_MSVC_INVAL |
| 68 | # ifdef __linux__ | ||
| 69 | /* Correct a Linux return value. | ||
| 70 | <http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.30.y.git;a=commitdiff;h=2b79bc4f7ebbd5af3c8b867968f9f15602d5f802> | ||
| 71 | */ | ||
| 72 | if (fd == desired_fd && result == (unsigned int) -EBADF) | ||
| 73 | { | 74 | { |
| 74 | errno = EBADF; | 75 | errno = EBADF; |
| 75 | result = -1; | 76 | result = -1; |
| 76 | } | 77 | } |
| 77 | # endif | 78 | DONE_MSVC_INVAL; |
| 79 | |||
| 78 | if (result == 0) | 80 | if (result == 0) |
| 79 | result = desired_fd; | 81 | result = desired_fd; |
| 80 | /* Correct a cygwin 1.5.x errno value. */ | 82 | |
| 81 | else if (result == -1 && errno == EMFILE) | 83 | return result; |
| 84 | } | ||
| 85 | |||
| 86 | # define dup2 ms_windows_dup2 | ||
| 87 | |||
| 88 | # endif | ||
| 89 | |||
| 90 | int | ||
| 91 | rpl_dup2 (int fd, int desired_fd) | ||
| 92 | { | ||
| 93 | int result; | ||
| 94 | |||
| 95 | # ifdef F_GETFL | ||
| 96 | /* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF. | ||
| 97 | On Cygwin 1.5.x, dup2 (1, 1) returns 0. | ||
| 98 | On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC. */ | ||
| 99 | if (fd == desired_fd) | ||
| 100 | return fcntl (fd, F_GETFL) == -1 ? -1 : fd; | ||
| 101 | # endif | ||
| 102 | |||
| 103 | result = dup2 (fd, desired_fd); | ||
| 104 | |||
| 105 | /* Correct an errno value on FreeBSD 6.1 and Cygwin 1.5.x. */ | ||
| 106 | if (result == -1 && errno == EMFILE) | ||
| 82 | errno = EBADF; | 107 | errno = EBADF; |
| 83 | # if REPLACE_FCHDIR | 108 | # if REPLACE_FCHDIR |
| 84 | if (fd != desired_fd && result != -1) | 109 | if (fd != desired_fd && result != -1) |
diff --git a/lib/gnulib.mk b/lib/gnulib.mk index 4341a5d184d..154ae9882da 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk | |||
| @@ -2,14 +2,26 @@ | |||
| 2 | ## Process this file with automake to produce Makefile.in. | 2 | ## Process this file with automake to produce Makefile.in. |
| 3 | # Copyright (C) 2002-2011 Free Software Foundation, Inc. | 3 | # Copyright (C) 2002-2011 Free Software Foundation, Inc. |
| 4 | # | 4 | # |
| 5 | # This file is free software, distributed under the terms of the GNU | 5 | # This file is free software; you can redistribute it and/or modify |
| 6 | # General Public License. As a special exception to the GNU General | 6 | # it under the terms of the GNU General Public License as published by |
| 7 | # Public License, this file may be distributed as part of a program | 7 | # the Free Software Foundation; either version 3 of the License, or |
| 8 | # that contains a configuration script generated by Autoconf, under | 8 | # (at your option) any later version. |
| 9 | # | ||
| 10 | # This file is distributed in the hope that it will be useful, | ||
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | # GNU General Public License for more details. | ||
| 14 | # | ||
| 15 | # You should have received a copy of the GNU General Public License | ||
| 16 | # along with this file. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | # | ||
| 18 | # As a special exception to the GNU General Public License, | ||
| 19 | # this file may be distributed as part of a program that | ||
| 20 | # contains a configuration script generated by Autoconf, under | ||
| 9 | # the same distribution terms as the rest of that program. | 21 | # the same distribution terms as the rest of that program. |
| 10 | # | 22 | # |
| 11 | # Generated by gnulib-tool. | 23 | # Generated by gnulib-tool. |
| 12 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dup2 filemode getloadavg getopt-gnu ignore-value intprops lstat mktime pthread_sigmask readlink socklen stdarg stdio strftime strtoimax strtoumax symlink sys_stat | 24 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dup2 filemode getloadavg getopt-gnu ignore-value intprops lstat mktime pthread_sigmask readlink socklen stdarg stdio strftime strtoimax strtoumax symlink sys_stat |
| 13 | 25 | ||
| 14 | 26 | ||
| 15 | MOSTLYCLEANFILES += core *.stackdump | 27 | MOSTLYCLEANFILES += core *.stackdump |
| @@ -52,54 +64,6 @@ EXTRA_DIST += allocator.h | |||
| 52 | 64 | ||
| 53 | ## end gnulib module allocator | 65 | ## end gnulib module allocator |
| 54 | 66 | ||
| 55 | ## begin gnulib module arg-nonnull | ||
| 56 | |||
| 57 | # The BUILT_SOURCES created by this Makefile snippet are not used via #include | ||
| 58 | # statements but through direct file reference. Therefore this snippet must be | ||
| 59 | # present in all Makefile.am that need it. This is ensured by the applicability | ||
| 60 | # 'all' defined above. | ||
| 61 | |||
| 62 | BUILT_SOURCES += arg-nonnull.h | ||
| 63 | # The arg-nonnull.h that gets inserted into generated .h files is the same as | ||
| 64 | # build-aux/arg-nonnull.h, except that it has the copyright header cut off. | ||
| 65 | arg-nonnull.h: $(top_srcdir)/./arg-nonnull.h | ||
| 66 | $(AM_V_GEN)rm -f $@-t $@ && \ | ||
| 67 | sed -n -e '/GL_ARG_NONNULL/,$$p' \ | ||
| 68 | < $(top_srcdir)/./arg-nonnull.h \ | ||
| 69 | > $@-t && \ | ||
| 70 | mv $@-t $@ | ||
| 71 | MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t | ||
| 72 | |||
| 73 | ARG_NONNULL_H=arg-nonnull.h | ||
| 74 | |||
| 75 | EXTRA_DIST += $(top_srcdir)/./arg-nonnull.h | ||
| 76 | |||
| 77 | ## end gnulib module arg-nonnull | ||
| 78 | |||
| 79 | ## begin gnulib module c++defs | ||
| 80 | |||
| 81 | # The BUILT_SOURCES created by this Makefile snippet are not used via #include | ||
| 82 | # statements but through direct file reference. Therefore this snippet must be | ||
| 83 | # present in all Makefile.am that need it. This is ensured by the applicability | ||
| 84 | # 'all' defined above. | ||
| 85 | |||
| 86 | BUILT_SOURCES += c++defs.h | ||
| 87 | # The c++defs.h that gets inserted into generated .h files is the same as | ||
| 88 | # build-aux/c++defs.h, except that it has the copyright header cut off. | ||
| 89 | c++defs.h: $(top_srcdir)/./c++defs.h | ||
| 90 | $(AM_V_GEN)rm -f $@-t $@ && \ | ||
| 91 | sed -n -e '/_GL_CXXDEFS/,$$p' \ | ||
| 92 | < $(top_srcdir)/./c++defs.h \ | ||
| 93 | > $@-t && \ | ||
| 94 | mv $@-t $@ | ||
| 95 | MOSTLYCLEANFILES += c++defs.h c++defs.h-t | ||
| 96 | |||
| 97 | CXXDEFS_H=c++defs.h | ||
| 98 | |||
| 99 | EXTRA_DIST += $(top_srcdir)/./c++defs.h | ||
| 100 | |||
| 101 | ## end gnulib module c++defs | ||
| 102 | |||
| 103 | ## begin gnulib module careadlinkat | 67 | ## begin gnulib module careadlinkat |
| 104 | 68 | ||
| 105 | libgnu_a_SOURCES += careadlinkat.c | 69 | libgnu_a_SOURCES += careadlinkat.c |
| @@ -294,6 +258,15 @@ EXTRA_libgnu_a_SOURCES += mktime.c | |||
| 294 | 258 | ||
| 295 | ## end gnulib module mktime | 259 | ## end gnulib module mktime |
| 296 | 260 | ||
| 261 | ## begin gnulib module pathmax | ||
| 262 | |||
| 263 | if gl_GNULIB_ENABLED_pathmax | ||
| 264 | |||
| 265 | endif | ||
| 266 | EXTRA_DIST += pathmax.h | ||
| 267 | |||
| 268 | ## end gnulib module pathmax | ||
| 269 | |||
| 297 | ## begin gnulib module pthread_sigmask | 270 | ## begin gnulib module pthread_sigmask |
| 298 | 271 | ||
| 299 | 272 | ||
| @@ -312,7 +285,7 @@ EXTRA_libgnu_a_SOURCES += readlink.c | |||
| 312 | 285 | ||
| 313 | ## end gnulib module readlink | 286 | ## end gnulib module readlink |
| 314 | 287 | ||
| 315 | ## begin gnulib module signal | 288 | ## begin gnulib module signal-h |
| 316 | 289 | ||
| 317 | BUILT_SOURCES += signal.h | 290 | BUILT_SOURCES += signal.h |
| 318 | 291 | ||
| @@ -327,11 +300,13 @@ signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
| 327 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ | 300 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ |
| 328 | -e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \ | 301 | -e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \ |
| 329 | -e 's|@''GNULIB_PTHREAD_SIGMASK''@|$(GNULIB_PTHREAD_SIGMASK)|g' \ | 302 | -e 's|@''GNULIB_PTHREAD_SIGMASK''@|$(GNULIB_PTHREAD_SIGMASK)|g' \ |
| 303 | -e 's|@''GNULIB_RAISE''@|$(GNULIB_RAISE)|g' \ | ||
| 330 | -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GNULIB_SIGNAL_H_SIGPIPE)/g' \ | 304 | -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GNULIB_SIGNAL_H_SIGPIPE)/g' \ |
| 331 | -e 's/@''GNULIB_SIGPROCMASK''@/$(GNULIB_SIGPROCMASK)/g' \ | 305 | -e 's/@''GNULIB_SIGPROCMASK''@/$(GNULIB_SIGPROCMASK)/g' \ |
| 332 | -e 's/@''GNULIB_SIGACTION''@/$(GNULIB_SIGACTION)/g' \ | 306 | -e 's/@''GNULIB_SIGACTION''@/$(GNULIB_SIGACTION)/g' \ |
| 333 | -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \ | 307 | -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \ |
| 334 | -e 's|@''HAVE_PTHREAD_SIGMASK''@|$(HAVE_PTHREAD_SIGMASK)|g' \ | 308 | -e 's|@''HAVE_PTHREAD_SIGMASK''@|$(HAVE_PTHREAD_SIGMASK)|g' \ |
| 309 | -e 's|@''HAVE_RAISE''@|$(HAVE_RAISE)|g' \ | ||
| 335 | -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \ | 310 | -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \ |
| 336 | -e 's|@''HAVE_SIGINFO_T''@|$(HAVE_SIGINFO_T)|g' \ | 311 | -e 's|@''HAVE_SIGINFO_T''@|$(HAVE_SIGINFO_T)|g' \ |
| 337 | -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \ | 312 | -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \ |
| @@ -339,6 +314,7 @@ signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
| 339 | -e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \ | 314 | -e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \ |
| 340 | -e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|g' \ | 315 | -e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|g' \ |
| 341 | -e 's|@''REPLACE_PTHREAD_SIGMASK''@|$(REPLACE_PTHREAD_SIGMASK)|g' \ | 316 | -e 's|@''REPLACE_PTHREAD_SIGMASK''@|$(REPLACE_PTHREAD_SIGMASK)|g' \ |
| 317 | -e 's|@''REPLACE_RAISE''@|$(REPLACE_RAISE)|g' \ | ||
| 342 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ | 318 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ |
| 343 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ | 319 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ |
| 344 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ | 320 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ |
| @@ -349,7 +325,7 @@ MOSTLYCLEANFILES += signal.h signal.h-t | |||
| 349 | 325 | ||
| 350 | EXTRA_DIST += signal.in.h | 326 | EXTRA_DIST += signal.in.h |
| 351 | 327 | ||
| 352 | ## end gnulib module signal | 328 | ## end gnulib module signal-h |
| 353 | 329 | ||
| 354 | ## begin gnulib module sigprocmask | 330 | ## begin gnulib module sigprocmask |
| 355 | 331 | ||
| @@ -362,6 +338,87 @@ EXTRA_libgnu_a_SOURCES += sigprocmask.c | |||
| 362 | 338 | ||
| 363 | ## end gnulib module sigprocmask | 339 | ## end gnulib module sigprocmask |
| 364 | 340 | ||
| 341 | ## begin gnulib module snippet/_Noreturn | ||
| 342 | |||
| 343 | # Because this Makefile snippet defines a variable used by other | ||
| 344 | # gnulib Makefile snippets, it must be present in all Makefile.am that | ||
| 345 | # need it. This is ensured by the applicability 'all' defined above. | ||
| 346 | |||
| 347 | _NORETURN_H=$(top_srcdir)/build-aux/snippet/_Noreturn.h | ||
| 348 | |||
| 349 | EXTRA_DIST += $(top_srcdir)/build-aux/snippet/_Noreturn.h | ||
| 350 | |||
| 351 | ## end gnulib module snippet/_Noreturn | ||
| 352 | |||
| 353 | ## begin gnulib module snippet/arg-nonnull | ||
| 354 | |||
| 355 | # The BUILT_SOURCES created by this Makefile snippet are not used via #include | ||
| 356 | # statements but through direct file reference. Therefore this snippet must be | ||
| 357 | # present in all Makefile.am that need it. This is ensured by the applicability | ||
| 358 | # 'all' defined above. | ||
| 359 | |||
| 360 | BUILT_SOURCES += arg-nonnull.h | ||
| 361 | # The arg-nonnull.h that gets inserted into generated .h files is the same as | ||
| 362 | # build-aux/snippet/arg-nonnull.h, except that it has the copyright header cut | ||
| 363 | # off. | ||
| 364 | arg-nonnull.h: $(top_srcdir)/build-aux/snippet/arg-nonnull.h | ||
| 365 | $(AM_V_GEN)rm -f $@-t $@ && \ | ||
| 366 | sed -n -e '/GL_ARG_NONNULL/,$$p' \ | ||
| 367 | < $(top_srcdir)/build-aux/snippet/arg-nonnull.h \ | ||
| 368 | > $@-t && \ | ||
| 369 | mv $@-t $@ | ||
| 370 | MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t | ||
| 371 | |||
| 372 | ARG_NONNULL_H=arg-nonnull.h | ||
| 373 | |||
| 374 | EXTRA_DIST += $(top_srcdir)/build-aux/snippet/arg-nonnull.h | ||
| 375 | |||
| 376 | ## end gnulib module snippet/arg-nonnull | ||
| 377 | |||
| 378 | ## begin gnulib module snippet/c++defs | ||
| 379 | |||
| 380 | # The BUILT_SOURCES created by this Makefile snippet are not used via #include | ||
| 381 | # statements but through direct file reference. Therefore this snippet must be | ||
| 382 | # present in all Makefile.am that need it. This is ensured by the applicability | ||
| 383 | # 'all' defined above. | ||
| 384 | |||
| 385 | BUILT_SOURCES += c++defs.h | ||
| 386 | # The c++defs.h that gets inserted into generated .h files is the same as | ||
| 387 | # build-aux/snippet/c++defs.h, except that it has the copyright header cut off. | ||
| 388 | c++defs.h: $(top_srcdir)/build-aux/snippet/c++defs.h | ||
| 389 | $(AM_V_GEN)rm -f $@-t $@ && \ | ||
| 390 | sed -n -e '/_GL_CXXDEFS/,$$p' \ | ||
| 391 | < $(top_srcdir)/build-aux/snippet/c++defs.h \ | ||
| 392 | > $@-t && \ | ||
| 393 | mv $@-t $@ | ||
| 394 | MOSTLYCLEANFILES += c++defs.h c++defs.h-t | ||
| 395 | |||
| 396 | CXXDEFS_H=c++defs.h | ||
| 397 | |||
| 398 | EXTRA_DIST += $(top_srcdir)/build-aux/snippet/c++defs.h | ||
| 399 | |||
| 400 | ## end gnulib module snippet/c++defs | ||
| 401 | |||
| 402 | ## begin gnulib module snippet/warn-on-use | ||
| 403 | |||
| 404 | BUILT_SOURCES += warn-on-use.h | ||
| 405 | # The warn-on-use.h that gets inserted into generated .h files is the same as | ||
| 406 | # build-aux/snippet/warn-on-use.h, except that it has the copyright header cut | ||
| 407 | # off. | ||
| 408 | warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h | ||
| 409 | $(AM_V_GEN)rm -f $@-t $@ && \ | ||
| 410 | sed -n -e '/^.ifndef/,$$p' \ | ||
| 411 | < $(top_srcdir)/build-aux/snippet/warn-on-use.h \ | ||
| 412 | > $@-t && \ | ||
| 413 | mv $@-t $@ | ||
| 414 | MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t | ||
| 415 | |||
| 416 | WARN_ON_USE_H=warn-on-use.h | ||
| 417 | |||
| 418 | EXTRA_DIST += $(top_srcdir)/build-aux/snippet/warn-on-use.h | ||
| 419 | |||
| 420 | ## end gnulib module snippet/warn-on-use | ||
| 421 | |||
| 365 | ## begin gnulib module stat | 422 | ## begin gnulib module stat |
| 366 | 423 | ||
| 367 | if gl_GNULIB_ENABLED_stat | 424 | if gl_GNULIB_ENABLED_stat |
| @@ -520,6 +577,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) | |||
| 520 | -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ | 577 | -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ |
| 521 | -e 's/@''GNULIB_DPRINTF''@/$(GNULIB_DPRINTF)/g' \ | 578 | -e 's/@''GNULIB_DPRINTF''@/$(GNULIB_DPRINTF)/g' \ |
| 522 | -e 's/@''GNULIB_FCLOSE''@/$(GNULIB_FCLOSE)/g' \ | 579 | -e 's/@''GNULIB_FCLOSE''@/$(GNULIB_FCLOSE)/g' \ |
| 580 | -e 's/@''GNULIB_FDOPEN''@/$(GNULIB_FDOPEN)/g' \ | ||
| 523 | -e 's/@''GNULIB_FFLUSH''@/$(GNULIB_FFLUSH)/g' \ | 581 | -e 's/@''GNULIB_FFLUSH''@/$(GNULIB_FFLUSH)/g' \ |
| 524 | -e 's/@''GNULIB_FGETC''@/$(GNULIB_FGETC)/g' \ | 582 | -e 's/@''GNULIB_FGETC''@/$(GNULIB_FGETC)/g' \ |
| 525 | -e 's/@''GNULIB_FGETS''@/$(GNULIB_FGETS)/g' \ | 583 | -e 's/@''GNULIB_FGETS''@/$(GNULIB_FGETS)/g' \ |
| @@ -544,6 +602,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) | |||
| 544 | -e 's/@''GNULIB_GETS''@/$(GNULIB_GETS)/g' \ | 602 | -e 's/@''GNULIB_GETS''@/$(GNULIB_GETS)/g' \ |
| 545 | -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \ | 603 | -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \ |
| 546 | -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \ | 604 | -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \ |
| 605 | -e 's/@''GNULIB_PCLOSE''@/$(GNULIB_PCLOSE)/g' \ | ||
| 547 | -e 's/@''GNULIB_PERROR''@/$(GNULIB_PERROR)/g' \ | 606 | -e 's/@''GNULIB_PERROR''@/$(GNULIB_PERROR)/g' \ |
| 548 | -e 's/@''GNULIB_POPEN''@/$(GNULIB_POPEN)/g' \ | 607 | -e 's/@''GNULIB_POPEN''@/$(GNULIB_POPEN)/g' \ |
| 549 | -e 's/@''GNULIB_PRINTF''@/$(GNULIB_PRINTF)/g' \ | 608 | -e 's/@''GNULIB_PRINTF''@/$(GNULIB_PRINTF)/g' \ |
| @@ -582,11 +641,14 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) | |||
| 582 | -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \ | 641 | -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \ |
| 583 | -e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \ | 642 | -e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \ |
| 584 | -e 's|@''HAVE_FTELLO''@|$(HAVE_FTELLO)|g' \ | 643 | -e 's|@''HAVE_FTELLO''@|$(HAVE_FTELLO)|g' \ |
| 644 | -e 's|@''HAVE_PCLOSE''@|$(HAVE_PCLOSE)|g' \ | ||
| 645 | -e 's|@''HAVE_POPEN''@|$(HAVE_POPEN)|g' \ | ||
| 585 | -e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \ | 646 | -e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \ |
| 586 | -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ | 647 | -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ |
| 587 | -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \ | 648 | -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \ |
| 588 | -e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \ | 649 | -e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \ |
| 589 | -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \ | 650 | -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \ |
| 651 | -e 's|@''REPLACE_FDOPEN''@|$(REPLACE_FDOPEN)|g' \ | ||
| 590 | -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \ | 652 | -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \ |
| 591 | -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \ | 653 | -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \ |
| 592 | -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \ | 654 | -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \ |
| @@ -634,7 +696,8 @@ BUILT_SOURCES += stdlib.h | |||
| 634 | 696 | ||
| 635 | # We need the following in order to create <stdlib.h> when the system | 697 | # We need the following in order to create <stdlib.h> when the system |
| 636 | # doesn't have one that works with the given compiler. | 698 | # doesn't have one that works with the given compiler. |
| 637 | stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) | 699 | stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ |
| 700 | $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) | ||
| 638 | $(AM_V_GEN)rm -f $@-t $@ && \ | 701 | $(AM_V_GEN)rm -f $@-t $@ && \ |
| 639 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ | 702 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ |
| 640 | sed -e 's|@''GUARD_PREFIX''@|GL|g' \ | 703 | sed -e 's|@''GUARD_PREFIX''@|GL|g' \ |
| @@ -708,6 +771,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
| 708 | -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ | 771 | -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ |
| 709 | -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ | 772 | -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ |
| 710 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ | 773 | -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ |
| 774 | -e '/definition of _Noreturn/r $(_NORETURN_H)' \ | ||
| 711 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ | 775 | -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ |
| 712 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ | 776 | -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ |
| 713 | } > $@-t && \ | 777 | } > $@-t && \ |
| @@ -791,6 +855,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU | |||
| 791 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ | 855 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ |
| 792 | -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ | 856 | -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ |
| 793 | -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \ | 857 | -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \ |
| 858 | -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \ | ||
| 794 | -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \ | 859 | -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \ |
| 795 | -e 's/@''GNULIB_FUTIMENS''@/$(GNULIB_FUTIMENS)/g' \ | 860 | -e 's/@''GNULIB_FUTIMENS''@/$(GNULIB_FUTIMENS)/g' \ |
| 796 | -e 's/@''GNULIB_LCHMOD''@/$(GNULIB_LCHMOD)/g' \ | 861 | -e 's/@''GNULIB_LCHMOD''@/$(GNULIB_LCHMOD)/g' \ |
| @@ -908,8 +973,10 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
| 908 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | 973 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ |
| 909 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ | 974 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ |
| 910 | -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ | 975 | -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ |
| 976 | -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \ | ||
| 911 | -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \ | 977 | -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \ |
| 912 | -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \ | 978 | -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \ |
| 979 | -e 's/@''GNULIB_DUP''@/$(GNULIB_DUP)/g' \ | ||
| 913 | -e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \ | 980 | -e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \ |
| 914 | -e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \ | 981 | -e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \ |
| 915 | -e 's/@''GNULIB_ENVIRON''@/$(GNULIB_ENVIRON)/g' \ | 982 | -e 's/@''GNULIB_ENVIRON''@/$(GNULIB_ENVIRON)/g' \ |
| @@ -917,6 +984,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
| 917 | -e 's/@''GNULIB_FACCESSAT''@/$(GNULIB_FACCESSAT)/g' \ | 984 | -e 's/@''GNULIB_FACCESSAT''@/$(GNULIB_FACCESSAT)/g' \ |
| 918 | -e 's/@''GNULIB_FCHDIR''@/$(GNULIB_FCHDIR)/g' \ | 985 | -e 's/@''GNULIB_FCHDIR''@/$(GNULIB_FCHDIR)/g' \ |
| 919 | -e 's/@''GNULIB_FCHOWNAT''@/$(GNULIB_FCHOWNAT)/g' \ | 986 | -e 's/@''GNULIB_FCHOWNAT''@/$(GNULIB_FCHOWNAT)/g' \ |
| 987 | -e 's/@''GNULIB_FDATASYNC''@/$(GNULIB_FDATASYNC)/g' \ | ||
| 920 | -e 's/@''GNULIB_FSYNC''@/$(GNULIB_FSYNC)/g' \ | 988 | -e 's/@''GNULIB_FSYNC''@/$(GNULIB_FSYNC)/g' \ |
| 921 | -e 's/@''GNULIB_FTRUNCATE''@/$(GNULIB_FTRUNCATE)/g' \ | 989 | -e 's/@''GNULIB_FTRUNCATE''@/$(GNULIB_FTRUNCATE)/g' \ |
| 922 | -e 's/@''GNULIB_GETCWD''@/$(GNULIB_GETCWD)/g' \ | 990 | -e 's/@''GNULIB_GETCWD''@/$(GNULIB_GETCWD)/g' \ |
| @@ -960,6 +1028,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
| 960 | -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \ | 1028 | -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \ |
| 961 | -e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \ | 1029 | -e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \ |
| 962 | -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \ | 1030 | -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \ |
| 1031 | -e 's|@''HAVE_FDATASYNC''@|$(HAVE_FDATASYNC)|g' \ | ||
| 963 | -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ | 1032 | -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ |
| 964 | -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ | 1033 | -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ |
| 965 | -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ | 1034 | -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ |
| @@ -984,6 +1053,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H | |||
| 984 | -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ | 1053 | -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ |
| 985 | -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ | 1054 | -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ |
| 986 | -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \ | 1055 | -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \ |
| 1056 | -e 's|@''HAVE_DECL_FDATASYNC''@|$(HAVE_DECL_FDATASYNC)|g' \ | ||
| 987 | -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \ | 1057 | -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \ |
| 988 | -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ | 1058 | -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ |
| 989 | -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ | 1059 | -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ |
| @@ -1040,25 +1110,6 @@ EXTRA_DIST += verify.h | |||
| 1040 | 1110 | ||
| 1041 | ## end gnulib module verify | 1111 | ## end gnulib module verify |
| 1042 | 1112 | ||
| 1043 | ## begin gnulib module warn-on-use | ||
| 1044 | |||
| 1045 | BUILT_SOURCES += warn-on-use.h | ||
| 1046 | # The warn-on-use.h that gets inserted into generated .h files is the same as | ||
| 1047 | # build-aux/warn-on-use.h, except that it has the copyright header cut off. | ||
| 1048 | warn-on-use.h: $(top_srcdir)/./warn-on-use.h | ||
| 1049 | $(AM_V_GEN)rm -f $@-t $@ && \ | ||
| 1050 | sed -n -e '/^.ifndef/,$$p' \ | ||
| 1051 | < $(top_srcdir)/./warn-on-use.h \ | ||
| 1052 | > $@-t && \ | ||
| 1053 | mv $@-t $@ | ||
| 1054 | MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t | ||
| 1055 | |||
| 1056 | WARN_ON_USE_H=warn-on-use.h | ||
| 1057 | |||
| 1058 | EXTRA_DIST += $(top_srcdir)/./warn-on-use.h | ||
| 1059 | |||
| 1060 | ## end gnulib module warn-on-use | ||
| 1061 | |||
| 1062 | 1113 | ||
| 1063 | mostlyclean-local: mostlyclean-generic | 1114 | mostlyclean-local: mostlyclean-generic |
| 1064 | @for dir in '' $(MOSTLYCLEANDIRS); do \ | 1115 | @for dir in '' $(MOSTLYCLEANDIRS); do \ |
diff --git a/lib/lstat.c b/lib/lstat.c index b26065ede28..d786288f2b7 100644 --- a/lib/lstat.c +++ b/lib/lstat.c | |||
| @@ -17,6 +17,10 @@ | |||
| 17 | 17 | ||
| 18 | /* written by Jim Meyering */ | 18 | /* written by Jim Meyering */ |
| 19 | 19 | ||
| 20 | /* If the user's config.h happens to include <sys/stat.h>, let it include only | ||
| 21 | the system's <sys/stat.h> here, so that orig_lstat doesn't recurse to | ||
| 22 | rpl_lstat. */ | ||
| 23 | #define __need_system_sys_stat_h | ||
| 20 | #include <config.h> | 24 | #include <config.h> |
| 21 | 25 | ||
| 22 | #if !HAVE_LSTAT | 26 | #if !HAVE_LSTAT |
| @@ -27,7 +31,6 @@ typedef int dummy; | |||
| 27 | #else /* HAVE_LSTAT */ | 31 | #else /* HAVE_LSTAT */ |
| 28 | 32 | ||
| 29 | /* Get the original definition of lstat. It might be defined as a macro. */ | 33 | /* Get the original definition of lstat. It might be defined as a macro. */ |
| 30 | # define __need_system_sys_stat_h | ||
| 31 | # include <sys/types.h> | 34 | # include <sys/types.h> |
| 32 | # include <sys/stat.h> | 35 | # include <sys/stat.h> |
| 33 | # undef __need_system_sys_stat_h | 36 | # undef __need_system_sys_stat_h |
| @@ -39,7 +42,10 @@ orig_lstat (const char *filename, struct stat *buf) | |||
| 39 | } | 42 | } |
| 40 | 43 | ||
| 41 | /* Specification. */ | 44 | /* Specification. */ |
| 42 | # include <sys/stat.h> | 45 | /* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc |
| 46 | eliminates this include because of the preliminary #include <sys/stat.h> | ||
| 47 | above. */ | ||
| 48 | # include "sys/stat.h" | ||
| 43 | 49 | ||
| 44 | # include <string.h> | 50 | # include <string.h> |
| 45 | # include <errno.h> | 51 | # include <errno.h> |
diff --git a/lib/makefile.w32-in b/lib/makefile.w32-in index df7f8e274f0..3600406ac13 100644 --- a/lib/makefile.w32-in +++ b/lib/makefile.w32-in | |||
| @@ -50,7 +50,9 @@ all: stamp_BLD $(ALL) | |||
| 50 | 50 | ||
| 51 | ### TAGS ### | 51 | ### TAGS ### |
| 52 | 52 | ||
| 53 | TAGS: | 53 | FRC: |
| 54 | |||
| 55 | TAGS: FRC | ||
| 54 | ../lib-src/$(BLD)/etags.exe *.c *.h | 56 | ../lib-src/$(BLD)/etags.exe *.c *.h |
| 55 | 57 | ||
| 56 | ### DEPENDENCIES ### | 58 | ### DEPENDENCIES ### |
| @@ -153,6 +155,7 @@ $(BLD)/filemode.$(O) : \ | |||
| 153 | # | 155 | # |
| 154 | $(BLD)/dtoastr.$(O) $(BLD)/getopt.$(O) $(BLD)/getopt1.$(O): stamp_BLD | 156 | $(BLD)/dtoastr.$(O) $(BLD)/getopt.$(O) $(BLD)/getopt1.$(O): stamp_BLD |
| 155 | $(BLD)/strftime.$(O) $(BLD)/time_r.$(O) $(BLD)/md5.$(O): stamp_BLD | 157 | $(BLD)/strftime.$(O) $(BLD)/time_r.$(O) $(BLD)/md5.$(O): stamp_BLD |
| 158 | $(BLD)/sha1.$(O) $(BLD)/sha256.$(O) $(BLD)/sha512.$(O): stamp_BLD | ||
| 156 | $(BLD)/filemode.$(O): stamp_BLD | 159 | $(BLD)/filemode.$(O): stamp_BLD |
| 157 | 160 | ||
| 158 | # | 161 | # |
| @@ -210,10 +213,9 @@ getopt_.h-SH: doit | |||
| 210 | 213 | ||
| 211 | HAVE_GETOPT_H = HAVE_GETOPT_H | 214 | HAVE_GETOPT_H = HAVE_GETOPT_H |
| 212 | INCLUDE_NEXT = include_next | 215 | INCLUDE_NEXT = include_next |
| 213 | PRAGMA_SYSTEM_HEADER = \#pragma GCC system_header | ||
| 214 | PRAGMA_COLUMNS = | 216 | PRAGMA_COLUMNS = |
| 215 | NEXT_GETOPT_H = <getopt.h> | 217 | NEXT_GETOPT_H = <getopt.h> |
| 216 | ARG_NONNULL_H = ../arg-nonnull.h | 218 | ARG_NONNULL_H = ../build-aux/snippet/arg-nonnull.h |
| 217 | 219 | ||
| 218 | getopt_h: | 220 | getopt_h: |
| 219 | - $(DEL) getopt_.h-t getopt_.h | 221 | - $(DEL) getopt_.h-t getopt_.h |
diff --git a/lib/pathmax.h b/lib/pathmax.h new file mode 100644 index 00000000000..c47618a1b6a --- /dev/null +++ b/lib/pathmax.h | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | /* Define PATH_MAX somehow. Requires sys/types.h. | ||
| 2 | Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2011 Free Software | ||
| 3 | Foundation, Inc. | ||
| 4 | |||
| 5 | This program is free software; you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU General Public License as published by | ||
| 7 | the Free Software Foundation; either version 3, or (at your option) | ||
| 8 | any later version. | ||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, | ||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | GNU General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License | ||
| 16 | along with this program; if not, write to the Free Software Foundation, | ||
| 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | ||
| 18 | |||
| 19 | #ifndef _PATHMAX_H | ||
| 20 | # define _PATHMAX_H | ||
| 21 | |||
| 22 | /* POSIX:2008 defines PATH_MAX to be the maximum number of bytes in a filename, | ||
| 23 | including the terminating NUL byte. | ||
| 24 | <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html> | ||
| 25 | PATH_MAX is not defined on systems which have no limit on filename length, | ||
| 26 | such as GNU/Hurd. | ||
| 27 | |||
| 28 | This file does *not* define PATH_MAX always. Programs that use this file | ||
| 29 | can handle the GNU/Hurd case in several ways: | ||
| 30 | - Either with a package-wide handling, or with a per-file handling, | ||
| 31 | - Either through a | ||
| 32 | #ifdef PATH_MAX | ||
| 33 | or through a fallback like | ||
| 34 | #ifndef PATH_MAX | ||
| 35 | # define PATH_MAX 8192 | ||
| 36 | #endif | ||
| 37 | or through a fallback like | ||
| 38 | #ifndef PATH_MAX | ||
| 39 | # define PATH_MAX pathconf ("/", _PC_PATH_MAX) | ||
| 40 | #endif | ||
| 41 | */ | ||
| 42 | |||
| 43 | # include <unistd.h> | ||
| 44 | |||
| 45 | # include <limits.h> | ||
| 46 | |||
| 47 | # ifndef _POSIX_PATH_MAX | ||
| 48 | # define _POSIX_PATH_MAX 256 | ||
| 49 | # endif | ||
| 50 | |||
| 51 | /* Don't include sys/param.h if it already has been. */ | ||
| 52 | # if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN | ||
| 53 | # include <sys/param.h> | ||
| 54 | # endif | ||
| 55 | |||
| 56 | # if !defined PATH_MAX && defined MAXPATHLEN | ||
| 57 | # define PATH_MAX MAXPATHLEN | ||
| 58 | # endif | ||
| 59 | |||
| 60 | # ifdef __hpux | ||
| 61 | /* On HP-UX, PATH_MAX designates the maximum number of bytes in a filename, | ||
| 62 | *not* including the terminating NUL byte, and is set to 1023. | ||
| 63 | Additionally, when _XOPEN_SOURCE is defined to 500 or more, PATH_MAX is | ||
| 64 | not defined at all any more. */ | ||
| 65 | # undef PATH_MAX | ||
| 66 | # define PATH_MAX 1024 | ||
| 67 | # endif | ||
| 68 | |||
| 69 | # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ | ||
| 70 | /* The page "Naming Files, Paths, and Namespaces" on msdn.microsoft.com, | ||
| 71 | section "Maximum Path Length Limitation", | ||
| 72 | <http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx#maxpath> | ||
| 73 | explains that the maximum size of a filename, including the terminating | ||
| 74 | NUL byte, is 260 = 3 + 256 + 1. | ||
| 75 | This is the same value as | ||
| 76 | - FILENAME_MAX in <stdio.h>, | ||
| 77 | - _MAX_PATH in <stdlib.h>, | ||
| 78 | - MAX_PATH in <windef.h>. | ||
| 79 | Undefine the original value, because mingw's <limits.h> gets it wrong. */ | ||
| 80 | # undef PATH_MAX | ||
| 81 | # define PATH_MAX 260 | ||
| 82 | # endif | ||
| 83 | |||
| 84 | #endif /* _PATHMAX_H */ | ||
diff --git a/lib/pthread_sigmask.c b/lib/pthread_sigmask.c index 1f460f13c48..11d549cad41 100644 --- a/lib/pthread_sigmask.c +++ b/lib/pthread_sigmask.c | |||
| @@ -20,10 +20,50 @@ | |||
| 20 | #include <signal.h> | 20 | #include <signal.h> |
| 21 | 21 | ||
| 22 | #include <errno.h> | 22 | #include <errno.h> |
| 23 | #include <stddef.h> | ||
| 24 | |||
| 25 | #if PTHREAD_SIGMASK_UNBLOCK_BUG | ||
| 26 | # include <unistd.h> | ||
| 27 | #endif | ||
| 23 | 28 | ||
| 24 | int | 29 | int |
| 25 | pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask) | 30 | pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask) |
| 31 | #undef pthread_sigmask | ||
| 26 | { | 32 | { |
| 33 | #if HAVE_PTHREAD_SIGMASK | ||
| 34 | int ret = pthread_sigmask (how, new_mask, old_mask); | ||
| 35 | # if PTHREAD_SIGMASK_INEFFECTIVE | ||
| 36 | if (ret == 0) | ||
| 37 | { | ||
| 38 | /* Detect whether pthread_sigmask is currently ineffective. | ||
| 39 | Don't cache the information: libpthread.so could be dynamically | ||
| 40 | loaded after the program started and after pthread_sigmask was | ||
| 41 | called for the first time. */ | ||
| 42 | if (pthread_sigmask (1729, NULL, NULL) == 0) | ||
| 43 | { | ||
| 44 | /* pthread_sigmask is currently ineffective. The program is not | ||
| 45 | linked to -lpthread. So use sigprocmask instead. */ | ||
| 46 | return (sigprocmask (how, new_mask, old_mask) < 0 ? errno : 0); | ||
| 47 | } | ||
| 48 | } | ||
| 49 | # endif | ||
| 50 | # if PTHREAD_SIGMASK_FAILS_WITH_ERRNO | ||
| 51 | if (ret == -1) | ||
| 52 | return errno; | ||
| 53 | # endif | ||
| 54 | # if PTHREAD_SIGMASK_UNBLOCK_BUG | ||
| 55 | if (ret == 0 | ||
| 56 | && new_mask != NULL | ||
| 57 | && (how == SIG_UNBLOCK || how == SIG_SETMASK)) | ||
| 58 | { | ||
| 59 | /* Give the OS the opportunity to raise signals that were pending before | ||
| 60 | the pthread_sigmask call and have now been unblocked. */ | ||
| 61 | usleep (1); | ||
| 62 | } | ||
| 63 | # endif | ||
| 64 | return ret; | ||
| 65 | #else | ||
| 27 | int ret = sigprocmask (how, new_mask, old_mask); | 66 | int ret = sigprocmask (how, new_mask, old_mask); |
| 28 | return (ret < 0 ? errno : 0); | 67 | return (ret < 0 ? errno : 0); |
| 68 | #endif | ||
| 29 | } | 69 | } |
diff --git a/lib/sha256.c b/lib/sha256.c index c125542248b..4dbb5e91291 100644 --- a/lib/sha256.c +++ b/lib/sha256.c | |||
| @@ -51,7 +51,7 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; | |||
| 51 | 51 | ||
| 52 | /* | 52 | /* |
| 53 | Takes a pointer to a 256 bit block of data (eight 32 bit ints) and | 53 | Takes a pointer to a 256 bit block of data (eight 32 bit ints) and |
| 54 | intializes it to the start constants of the SHA256 algorithm. This | 54 | initializes it to the start constants of the SHA256 algorithm. This |
| 55 | must be called before using hash in the call to sha256_hash | 55 | must be called before using hash in the call to sha256_hash |
| 56 | */ | 56 | */ |
| 57 | void | 57 | void |
diff --git a/lib/sha512.c b/lib/sha512.c index c0bed95758f..5c2e3ab9f81 100644 --- a/lib/sha512.c +++ b/lib/sha512.c | |||
| @@ -58,7 +58,7 @@ static const unsigned char fillbuf[128] = { 0x80, 0 /* , 0, 0, ... */ }; | |||
| 58 | 58 | ||
| 59 | /* | 59 | /* |
| 60 | Takes a pointer to a 512 bit block of data (eight 64 bit ints) and | 60 | Takes a pointer to a 512 bit block of data (eight 64 bit ints) and |
| 61 | intializes it to the start constants of the SHA512 algorithm. This | 61 | initializes it to the start constants of the SHA512 algorithm. This |
| 62 | must be called before using hash in the call to sha512_hash | 62 | must be called before using hash in the call to sha512_hash |
| 63 | */ | 63 | */ |
| 64 | void | 64 | void |
diff --git a/lib/signal.in.h b/lib/signal.in.h index 93787f753fa..e18e0b29832 100644 --- a/lib/signal.in.h +++ b/lib/signal.in.h | |||
| @@ -152,9 +152,36 @@ _GL_WARN_ON_USE (pthread_sigmask, "pthread_sigmask is not portable - " | |||
| 152 | #endif | 152 | #endif |
| 153 | 153 | ||
| 154 | 154 | ||
| 155 | #if @GNULIB_RAISE@ | ||
| 156 | # if @REPLACE_RAISE@ | ||
| 157 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 158 | # undef raise | ||
| 159 | # define raise rpl_raise | ||
| 160 | # endif | ||
| 161 | _GL_FUNCDECL_RPL (raise, int, (int sig)); | ||
| 162 | _GL_CXXALIAS_RPL (raise, int, (int sig)); | ||
| 163 | # else | ||
| 164 | # if !@HAVE_RAISE@ | ||
| 165 | _GL_FUNCDECL_SYS (raise, int, (int sig)); | ||
| 166 | # endif | ||
| 167 | _GL_CXXALIAS_SYS (raise, int, (int sig)); | ||
| 168 | # endif | ||
| 169 | _GL_CXXALIASWARN (raise); | ||
| 170 | #elif defined GNULIB_POSIXCHECK | ||
| 171 | # undef raise | ||
| 172 | /* Assume raise is always declared. */ | ||
| 173 | _GL_WARN_ON_USE (raise, "raise can crash on native Windows - " | ||
| 174 | "use gnulib module raise for portability"); | ||
| 175 | #endif | ||
| 176 | |||
| 177 | |||
| 155 | #if @GNULIB_SIGPROCMASK@ | 178 | #if @GNULIB_SIGPROCMASK@ |
| 156 | # if !@HAVE_POSIX_SIGNALBLOCKING@ | 179 | # if !@HAVE_POSIX_SIGNALBLOCKING@ |
| 157 | 180 | ||
| 181 | # ifndef GNULIB_defined_signal_blocking | ||
| 182 | # define GNULIB_defined_signal_blocking 1 | ||
| 183 | # endif | ||
| 184 | |||
| 158 | /* Maximum signal number + 1. */ | 185 | /* Maximum signal number + 1. */ |
| 159 | # ifndef NSIG | 186 | # ifndef NSIG |
| 160 | # define NSIG 32 | 187 | # define NSIG 32 |
| @@ -280,18 +307,10 @@ _GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t, | |||
| 280 | # endif | 307 | # endif |
| 281 | _GL_CXXALIASWARN (signal); | 308 | _GL_CXXALIASWARN (signal); |
| 282 | 309 | ||
| 283 | /* Raise signal SIG. */ | ||
| 284 | # if !@HAVE_POSIX_SIGNALBLOCKING@ && GNULIB_defined_SIGPIPE | 310 | # if !@HAVE_POSIX_SIGNALBLOCKING@ && GNULIB_defined_SIGPIPE |
| 285 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 311 | /* Raise signal SIGPIPE. */ |
| 286 | # undef raise | 312 | _GL_EXTERN_C int _gl_raise_SIGPIPE (void); |
| 287 | # define raise rpl_raise | ||
| 288 | # endif | ||
| 289 | _GL_FUNCDECL_RPL (raise, int, (int sig)); | ||
| 290 | _GL_CXXALIAS_RPL (raise, int, (int sig)); | ||
| 291 | # else | ||
| 292 | _GL_CXXALIAS_SYS (raise, int, (int sig)); | ||
| 293 | # endif | 313 | # endif |
| 294 | _GL_CXXALIASWARN (raise); | ||
| 295 | 314 | ||
| 296 | #elif defined GNULIB_POSIXCHECK | 315 | #elif defined GNULIB_POSIXCHECK |
| 297 | # undef sigaddset | 316 | # undef sigaddset |
diff --git a/lib/sigprocmask.c b/lib/sigprocmask.c index 6780a37b14f..e75c7576cdf 100644 --- a/lib/sigprocmask.c +++ b/lib/sigprocmask.c | |||
| @@ -24,6 +24,10 @@ | |||
| 24 | #include <stdint.h> | 24 | #include <stdint.h> |
| 25 | #include <stdlib.h> | 25 | #include <stdlib.h> |
| 26 | 26 | ||
| 27 | #if HAVE_MSVC_INVALID_PARAMETER_HANDLER | ||
| 28 | # include "msvc-inval.h" | ||
| 29 | #endif | ||
| 30 | |||
| 27 | /* We assume that a platform without POSIX signal blocking functions | 31 | /* We assume that a platform without POSIX signal blocking functions |
| 28 | also does not have the POSIX sigaction() function, only the | 32 | also does not have the POSIX sigaction() function, only the |
| 29 | signal() function. We also assume signal() has SysV semantics, | 33 | signal() function. We also assume signal() has SysV semantics, |
| @@ -58,6 +62,28 @@ | |||
| 58 | 62 | ||
| 59 | typedef void (*handler_t) (int); | 63 | typedef void (*handler_t) (int); |
| 60 | 64 | ||
| 65 | #if HAVE_MSVC_INVALID_PARAMETER_HANDLER | ||
| 66 | static inline handler_t | ||
| 67 | signal_nothrow (int sig, handler_t handler) | ||
| 68 | { | ||
| 69 | handler_t result; | ||
| 70 | |||
| 71 | TRY_MSVC_INVAL | ||
| 72 | { | ||
| 73 | result = signal (sig, handler); | ||
| 74 | } | ||
| 75 | CATCH_MSVC_INVAL | ||
| 76 | { | ||
| 77 | result = SIG_ERR; | ||
| 78 | errno = EINVAL; | ||
| 79 | } | ||
| 80 | DONE_MSVC_INVAL; | ||
| 81 | |||
| 82 | return result; | ||
| 83 | } | ||
| 84 | # define signal signal_nothrow | ||
| 85 | #endif | ||
| 86 | |||
| 61 | /* Handling of gnulib defined signals. */ | 87 | /* Handling of gnulib defined signals. */ |
| 62 | 88 | ||
| 63 | #if GNULIB_defined_SIGPIPE | 89 | #if GNULIB_defined_SIGPIPE |
| @@ -80,6 +106,7 @@ ext_signal (int sig, handler_t handler) | |||
| 80 | return signal (sig, handler); | 106 | return signal (sig, handler); |
| 81 | } | 107 | } |
| 82 | } | 108 | } |
| 109 | # undef signal | ||
| 83 | # define signal ext_signal | 110 | # define signal ext_signal |
| 84 | #endif | 111 | #endif |
| 85 | 112 | ||
| @@ -303,27 +330,19 @@ rpl_signal (int sig, handler_t handler) | |||
| 303 | } | 330 | } |
| 304 | 331 | ||
| 305 | #if GNULIB_defined_SIGPIPE | 332 | #if GNULIB_defined_SIGPIPE |
| 306 | /* Raise the signal SIG. */ | 333 | /* Raise the signal SIGPIPE. */ |
| 307 | int | 334 | int |
| 308 | rpl_raise (int sig) | 335 | _gl_raise_SIGPIPE (void) |
| 309 | # undef raise | ||
| 310 | { | 336 | { |
| 311 | switch (sig) | 337 | if (blocked_set & (1U << SIGPIPE)) |
| 338 | pending_array[SIGPIPE] = 1; | ||
| 339 | else | ||
| 312 | { | 340 | { |
| 313 | case SIGPIPE: | 341 | handler_t handler = SIGPIPE_handler; |
| 314 | if (blocked_set & (1U << sig)) | 342 | if (handler == SIG_DFL) |
| 315 | pending_array[sig] = 1; | 343 | exit (128 + SIGPIPE); |
| 316 | else | 344 | else if (handler != SIG_IGN) |
| 317 | { | 345 | (*handler) (SIGPIPE); |
| 318 | handler_t handler = SIGPIPE_handler; | ||
| 319 | if (handler == SIG_DFL) | ||
| 320 | exit (128 + SIGPIPE); | ||
| 321 | else if (handler != SIG_IGN) | ||
| 322 | (*handler) (sig); | ||
| 323 | } | ||
| 324 | return 0; | ||
| 325 | default: /* System defined signal */ | ||
| 326 | return raise (sig); | ||
| 327 | } | 346 | } |
| 328 | } | 347 | } |
| 329 | #endif | 348 | #endif |
diff --git a/lib/stat.c b/lib/stat.c index f07370dd06b..1397aa93290 100644 --- a/lib/stat.c +++ b/lib/stat.c | |||
| @@ -16,10 +16,13 @@ | |||
| 16 | 16 | ||
| 17 | /* written by Eric Blake */ | 17 | /* written by Eric Blake */ |
| 18 | 18 | ||
| 19 | /* If the user's config.h happens to include <sys/stat.h>, let it include only | ||
| 20 | the system's <sys/stat.h> here, so that orig_stat doesn't recurse to | ||
| 21 | rpl_stat. */ | ||
| 22 | #define __need_system_sys_stat_h | ||
| 19 | #include <config.h> | 23 | #include <config.h> |
| 20 | 24 | ||
| 21 | /* Get the original definition of stat. It might be defined as a macro. */ | 25 | /* Get the original definition of stat. It might be defined as a macro. */ |
| 22 | #define __need_system_sys_stat_h | ||
| 23 | #include <sys/types.h> | 26 | #include <sys/types.h> |
| 24 | #include <sys/stat.h> | 27 | #include <sys/stat.h> |
| 25 | #undef __need_system_sys_stat_h | 28 | #undef __need_system_sys_stat_h |
| @@ -31,7 +34,10 @@ orig_stat (const char *filename, struct stat *buf) | |||
| 31 | } | 34 | } |
| 32 | 35 | ||
| 33 | /* Specification. */ | 36 | /* Specification. */ |
| 34 | #include <sys/stat.h> | 37 | /* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc |
| 38 | eliminates this include because of the preliminary #include <sys/stat.h> | ||
| 39 | above. */ | ||
| 40 | #include "sys/stat.h" | ||
| 35 | 41 | ||
| 36 | #include <errno.h> | 42 | #include <errno.h> |
| 37 | #include <limits.h> | 43 | #include <limits.h> |
| @@ -40,6 +46,15 @@ orig_stat (const char *filename, struct stat *buf) | |||
| 40 | #include "dosname.h" | 46 | #include "dosname.h" |
| 41 | #include "verify.h" | 47 | #include "verify.h" |
| 42 | 48 | ||
| 49 | #if REPLACE_FUNC_STAT_DIR | ||
| 50 | # include "pathmax.h" | ||
| 51 | /* The only known systems where REPLACE_FUNC_STAT_DIR is needed also | ||
| 52 | have a constant PATH_MAX. */ | ||
| 53 | # ifndef PATH_MAX | ||
| 54 | # error "Please port this replacement to your platform" | ||
| 55 | # endif | ||
| 56 | #endif | ||
| 57 | |||
| 43 | /* Store information about NAME into ST. Work around bugs with | 58 | /* Store information about NAME into ST. Work around bugs with |
| 44 | trailing slashes. Mingw has other bugs (such as st_ino always | 59 | trailing slashes. Mingw has other bugs (such as st_ino always |
| 45 | being 0 on success) which this wrapper does not work around. But | 60 | being 0 on success) which this wrapper does not work around. But |
| @@ -64,11 +79,6 @@ rpl_stat (char const *name, struct stat *st) | |||
| 64 | } | 79 | } |
| 65 | #endif /* REPLACE_FUNC_STAT_FILE */ | 80 | #endif /* REPLACE_FUNC_STAT_FILE */ |
| 66 | #if REPLACE_FUNC_STAT_DIR | 81 | #if REPLACE_FUNC_STAT_DIR |
| 67 | /* The only known systems where REPLACE_FUNC_STAT_DIR is needed also | ||
| 68 | have a constant PATH_MAX. */ | ||
| 69 | # ifndef PATH_MAX | ||
| 70 | # error "Please port this replacement to your platform" | ||
| 71 | # endif | ||
| 72 | 82 | ||
| 73 | if (result == -1 && errno == ENOENT) | 83 | if (result == -1 && errno == ENOENT) |
| 74 | { | 84 | { |
diff --git a/lib/stdint.in.h b/lib/stdint.in.h index 09ac138b851..b6d08c754ae 100644 --- a/lib/stdint.in.h +++ b/lib/stdint.in.h | |||
| @@ -270,26 +270,36 @@ typedef unsigned long int gl_uintptr_t; | |||
| 270 | /* Note: These types are compiler dependent. It may be unwise to use them in | 270 | /* Note: These types are compiler dependent. It may be unwise to use them in |
| 271 | public header files. */ | 271 | public header files. */ |
| 272 | 272 | ||
| 273 | #undef intmax_t | 273 | /* If the system defines INTMAX_MAX, assume that intmax_t works, and |
| 274 | #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 | 274 | similarly for UINTMAX_MAX and uintmax_t. This avoids problems with |
| 275 | assuming one type where another is used by the system. */ | ||
| 276 | |||
| 277 | #ifndef INTMAX_MAX | ||
| 278 | # undef INTMAX_C | ||
| 279 | # undef intmax_t | ||
| 280 | # if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 | ||
| 275 | typedef long long int gl_intmax_t; | 281 | typedef long long int gl_intmax_t; |
| 276 | # define intmax_t gl_intmax_t | 282 | # define intmax_t gl_intmax_t |
| 277 | #elif defined GL_INT64_T | 283 | # elif defined GL_INT64_T |
| 278 | # define intmax_t int64_t | 284 | # define intmax_t int64_t |
| 279 | #else | 285 | # else |
| 280 | typedef long int gl_intmax_t; | 286 | typedef long int gl_intmax_t; |
| 281 | # define intmax_t gl_intmax_t | 287 | # define intmax_t gl_intmax_t |
| 288 | # endif | ||
| 282 | #endif | 289 | #endif |
| 283 | 290 | ||
| 284 | #undef uintmax_t | 291 | #ifndef UINTMAX_MAX |
| 285 | #if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 | 292 | # undef UINTMAX_C |
| 293 | # undef uintmax_t | ||
| 294 | # if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 | ||
| 286 | typedef unsigned long long int gl_uintmax_t; | 295 | typedef unsigned long long int gl_uintmax_t; |
| 287 | # define uintmax_t gl_uintmax_t | 296 | # define uintmax_t gl_uintmax_t |
| 288 | #elif defined GL_UINT64_T | 297 | # elif defined GL_UINT64_T |
| 289 | # define uintmax_t uint64_t | 298 | # define uintmax_t uint64_t |
| 290 | #else | 299 | # else |
| 291 | typedef unsigned long int gl_uintmax_t; | 300 | typedef unsigned long int gl_uintmax_t; |
| 292 | # define uintmax_t gl_uintmax_t | 301 | # define uintmax_t gl_uintmax_t |
| 302 | # endif | ||
| 293 | #endif | 303 | #endif |
| 294 | 304 | ||
| 295 | /* Verify that intmax_t and uintmax_t have the same size. Too much code | 305 | /* Verify that intmax_t and uintmax_t have the same size. Too much code |
| @@ -431,21 +441,23 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) | |||
| 431 | 441 | ||
| 432 | /* 7.18.2.5. Limits of greatest-width integer types */ | 442 | /* 7.18.2.5. Limits of greatest-width integer types */ |
| 433 | 443 | ||
| 434 | #undef INTMAX_MIN | 444 | #ifndef INTMAX_MAX |
| 435 | #undef INTMAX_MAX | 445 | # undef INTMAX_MIN |
| 436 | #ifdef INT64_MAX | 446 | # ifdef INT64_MAX |
| 437 | # define INTMAX_MIN INT64_MIN | 447 | # define INTMAX_MIN INT64_MIN |
| 438 | # define INTMAX_MAX INT64_MAX | 448 | # define INTMAX_MAX INT64_MAX |
| 439 | #else | 449 | # else |
| 440 | # define INTMAX_MIN INT32_MIN | 450 | # define INTMAX_MIN INT32_MIN |
| 441 | # define INTMAX_MAX INT32_MAX | 451 | # define INTMAX_MAX INT32_MAX |
| 452 | # endif | ||
| 442 | #endif | 453 | #endif |
| 443 | 454 | ||
| 444 | #undef UINTMAX_MAX | 455 | #ifndef UINTMAX_MAX |
| 445 | #ifdef UINT64_MAX | 456 | # ifdef UINT64_MAX |
| 446 | # define UINTMAX_MAX UINT64_MAX | 457 | # define UINTMAX_MAX UINT64_MAX |
| 447 | #else | 458 | # else |
| 448 | # define UINTMAX_MAX UINT32_MAX | 459 | # define UINTMAX_MAX UINT32_MAX |
| 460 | # endif | ||
| 449 | #endif | 461 | #endif |
| 450 | 462 | ||
| 451 | /* 7.18.3. Limits of other integer types */ | 463 | /* 7.18.3. Limits of other integer types */ |
| @@ -568,22 +580,24 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) | |||
| 568 | 580 | ||
| 569 | /* 7.18.4.2. Macros for greatest-width integer constants */ | 581 | /* 7.18.4.2. Macros for greatest-width integer constants */ |
| 570 | 582 | ||
| 571 | #undef INTMAX_C | 583 | #ifndef INTMAX_C |
| 572 | #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 | 584 | # if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 |
| 573 | # define INTMAX_C(x) x##LL | 585 | # define INTMAX_C(x) x##LL |
| 574 | #elif defined GL_INT64_T | 586 | # elif defined GL_INT64_T |
| 575 | # define INTMAX_C(x) INT64_C(x) | 587 | # define INTMAX_C(x) INT64_C(x) |
| 576 | #else | 588 | # else |
| 577 | # define INTMAX_C(x) x##L | 589 | # define INTMAX_C(x) x##L |
| 590 | # endif | ||
| 578 | #endif | 591 | #endif |
| 579 | 592 | ||
| 580 | #undef UINTMAX_C | 593 | #ifndef UINTMAX_C |
| 581 | #if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 | 594 | # if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 |
| 582 | # define UINTMAX_C(x) x##ULL | 595 | # define UINTMAX_C(x) x##ULL |
| 583 | #elif defined GL_UINT64_T | 596 | # elif defined GL_UINT64_T |
| 584 | # define UINTMAX_C(x) UINT64_C(x) | 597 | # define UINTMAX_C(x) UINT64_C(x) |
| 585 | #else | 598 | # else |
| 586 | # define UINTMAX_C(x) x##UL | 599 | # define UINTMAX_C(x) x##UL |
| 600 | # endif | ||
| 587 | #endif | 601 | #endif |
| 588 | 602 | ||
| 589 | #endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */ | 603 | #endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */ |
diff --git a/lib/stdio.in.h b/lib/stdio.in.h index 473c84ce3e4..ce00af574a8 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h | |||
| @@ -170,6 +170,26 @@ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - " | |||
| 170 | "use gnulib module fclose for portable POSIX compliance"); | 170 | "use gnulib module fclose for portable POSIX compliance"); |
| 171 | #endif | 171 | #endif |
| 172 | 172 | ||
| 173 | #if @GNULIB_FDOPEN@ | ||
| 174 | # if @REPLACE_FDOPEN@ | ||
| 175 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
| 176 | # undef fdopen | ||
| 177 | # define fdopen rpl_fdopen | ||
| 178 | # endif | ||
| 179 | _GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode) | ||
| 180 | _GL_ARG_NONNULL ((2))); | ||
| 181 | _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); | ||
| 182 | # else | ||
| 183 | _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); | ||
| 184 | # endif | ||
| 185 | _GL_CXXALIASWARN (fdopen); | ||
| 186 | #elif defined GNULIB_POSIXCHECK | ||
| 187 | # undef fdopen | ||
| 188 | /* Assume fdopen is always declared. */ | ||
| 189 | _GL_WARN_ON_USE (fdopen, "fdopen on Win32 platforms is not POSIX compatible - " | ||
| 190 | "use gnulib module fdopen for portability"); | ||
| 191 | #endif | ||
| 192 | |||
| 173 | #if @GNULIB_FFLUSH@ | 193 | #if @GNULIB_FFLUSH@ |
| 174 | /* Flush all pending data on STREAM according to POSIX rules. Both | 194 | /* Flush all pending data on STREAM according to POSIX rules. Both |
| 175 | output and seekable input streams are supported. | 195 | output and seekable input streams are supported. |
| @@ -750,6 +770,20 @@ _GL_CXXALIAS_SYS (obstack_vprintf, int, | |||
| 750 | _GL_CXXALIASWARN (obstack_vprintf); | 770 | _GL_CXXALIASWARN (obstack_vprintf); |
| 751 | #endif | 771 | #endif |
| 752 | 772 | ||
| 773 | #if @GNULIB_PCLOSE@ | ||
| 774 | # if !@HAVE_PCLOSE@ | ||
| 775 | _GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); | ||
| 776 | # endif | ||
| 777 | _GL_CXXALIAS_SYS (pclose, int, (FILE *stream)); | ||
| 778 | _GL_CXXALIASWARN (pclose); | ||
| 779 | #elif defined GNULIB_POSIXCHECK | ||
| 780 | # undef pclose | ||
| 781 | # if HAVE_RAW_DECL_PCLOSE | ||
| 782 | _GL_WARN_ON_USE (pclose, "popen is unportable - " | ||
| 783 | "use gnulib module pclose for more portability"); | ||
| 784 | # endif | ||
| 785 | #endif | ||
| 786 | |||
| 753 | #if @GNULIB_PERROR@ | 787 | #if @GNULIB_PERROR@ |
| 754 | /* Print a message to standard error, describing the value of ERRNO, | 788 | /* Print a message to standard error, describing the value of ERRNO, |
| 755 | (if STRING is not NULL and not empty) prefixed with STRING and ": ", | 789 | (if STRING is not NULL and not empty) prefixed with STRING and ": ", |
| @@ -781,6 +815,10 @@ _GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode) | |||
| 781 | _GL_ARG_NONNULL ((1, 2))); | 815 | _GL_ARG_NONNULL ((1, 2))); |
| 782 | _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); | 816 | _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); |
| 783 | # else | 817 | # else |
| 818 | # if !@HAVE_POPEN@ | ||
| 819 | _GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode) | ||
| 820 | _GL_ARG_NONNULL ((1, 2))); | ||
| 821 | # endif | ||
| 784 | _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); | 822 | _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); |
| 785 | # endif | 823 | # endif |
| 786 | _GL_CXXALIASWARN (popen); | 824 | _GL_CXXALIASWARN (popen); |
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 62a2ce920e6..047fac18b83 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h | |||
| @@ -89,11 +89,7 @@ struct random_data | |||
| 89 | # include <unistd.h> | 89 | # include <unistd.h> |
| 90 | #endif | 90 | #endif |
| 91 | 91 | ||
| 92 | #if 3 <= __GNUC__ || __GNUC__ == 2 && 8 <= __GNUC_MINOR__ | 92 | /* The definition of _Noreturn is copied here. */ |
| 93 | # define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) | ||
| 94 | #else | ||
| 95 | # define _GL_ATTRIBUTE_NORETURN | ||
| 96 | #endif | ||
| 97 | 93 | ||
| 98 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | 94 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
| 99 | 95 | ||
| @@ -120,7 +116,7 @@ struct random_data | |||
| 120 | /* Terminate the current process with the given return code, without running | 116 | /* Terminate the current process with the given return code, without running |
| 121 | the 'atexit' handlers. */ | 117 | the 'atexit' handlers. */ |
| 122 | # if !@HAVE__EXIT@ | 118 | # if !@HAVE__EXIT@ |
| 123 | _GL_FUNCDECL_SYS (_Exit, void, (int status) _GL_ATTRIBUTE_NORETURN); | 119 | _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); |
| 124 | # endif | 120 | # endif |
| 125 | _GL_CXXALIAS_SYS (_Exit, void, (int status)); | 121 | _GL_CXXALIAS_SYS (_Exit, void, (int status)); |
| 126 | _GL_CXXALIASWARN (_Exit); | 122 | _GL_CXXALIASWARN (_Exit); |
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h index 5acee705f8a..77a7177ca64 100644 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h | |||
| @@ -55,10 +55,17 @@ | |||
| 55 | /* The definition of _GL_WARN_ON_USE is copied here. */ | 55 | /* The definition of _GL_WARN_ON_USE is copied here. */ |
| 56 | 56 | ||
| 57 | /* Before doing "#define mkdir rpl_mkdir" below, we need to include all | 57 | /* Before doing "#define mkdir rpl_mkdir" below, we need to include all |
| 58 | headers that may declare mkdir(). */ | 58 | headers that may declare mkdir(). Native Windows platforms declare mkdir |
| 59 | in <io.h> and/or <direct.h>, not in <unistd.h>. */ | ||
| 59 | #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ | 60 | #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ |
| 60 | # include <io.h> /* mingw32, mingw64 */ | 61 | # include <io.h> /* mingw32, mingw64 */ |
| 61 | # include <direct.h> /* mingw64 */ | 62 | # include <direct.h> /* mingw64, MSVC 9 */ |
| 63 | #endif | ||
| 64 | |||
| 65 | #ifndef S_IFIFO | ||
| 66 | # ifdef _S_IFIFO | ||
| 67 | # define S_IFIFO _S_IFIFO | ||
| 68 | # endif | ||
| 62 | #endif | 69 | #endif |
| 63 | 70 | ||
| 64 | #ifndef S_IFMT | 71 | #ifndef S_IFMT |
| @@ -312,16 +319,25 @@ _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - " | |||
| 312 | #endif | 319 | #endif |
| 313 | 320 | ||
| 314 | 321 | ||
| 315 | #if @REPLACE_FSTAT@ | 322 | #if @GNULIB_FSTAT@ |
| 316 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 323 | # if @REPLACE_FSTAT@ |
| 317 | # define fstat rpl_fstat | 324 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 318 | # endif | 325 | # undef fstat |
| 326 | # define fstat rpl_fstat | ||
| 327 | # endif | ||
| 319 | _GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2))); | 328 | _GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2))); |
| 320 | _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf)); | 329 | _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf)); |
| 321 | #else | 330 | # else |
| 322 | _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); | 331 | _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); |
| 323 | #endif | 332 | # endif |
| 324 | _GL_CXXALIASWARN (fstat); | 333 | _GL_CXXALIASWARN (fstat); |
| 334 | #elif defined GNULIB_POSIXCHECK | ||
| 335 | # undef fstat | ||
| 336 | # if HAVE_RAW_DECL_FSTAT | ||
| 337 | _GL_WARN_ON_USE (fstat, "fstat has portability problems - " | ||
| 338 | "use gnulib module fstat for portability"); | ||
| 339 | # endif | ||
| 340 | #endif | ||
| 325 | 341 | ||
| 326 | 342 | ||
| 327 | #if @GNULIB_FSTATAT@ | 343 | #if @GNULIB_FSTATAT@ |
diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 769ecf0d43f..77e5675aad2 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h | |||
| @@ -75,17 +75,21 @@ | |||
| 75 | #endif | 75 | #endif |
| 76 | 76 | ||
| 77 | /* mingw fails to declare _exit in <unistd.h>. */ | 77 | /* mingw fails to declare _exit in <unistd.h>. */ |
| 78 | /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */ | 78 | /* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in |
| 79 | <unistd.h>. */ | ||
| 79 | /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */ | 80 | /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */ |
| 80 | /* But avoid namespace pollution on glibc systems. */ | 81 | /* But avoid namespace pollution on glibc systems. */ |
| 81 | #ifndef __GLIBC__ | 82 | #ifndef __GLIBC__ |
| 82 | # include <stdlib.h> | 83 | # include <stdlib.h> |
| 83 | #endif | 84 | #endif |
| 84 | 85 | ||
| 85 | /* mingw declares getcwd in <io.h>, not in <unistd.h>. */ | 86 | /* Native Windows platforms declare chdir, getcwd, rmdir in |
| 86 | #if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \ | 87 | <io.h> and/or <direct.h>, not in <unistd.h>. */ |
| 88 | #if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \ | ||
| 89 | || defined GNULIB_POSIXCHECK) \ | ||
| 87 | && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) | 90 | && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) |
| 88 | # include <io.h> | 91 | # include <io.h> /* mingw32, mingw64 */ |
| 92 | # include <direct.h> /* mingw64, MSVC 9 */ | ||
| 89 | #endif | 93 | #endif |
| 90 | 94 | ||
| 91 | /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>. | 95 | /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>. |
| @@ -97,6 +101,12 @@ | |||
| 97 | # include <netdb.h> | 101 | # include <netdb.h> |
| 98 | #endif | 102 | #endif |
| 99 | 103 | ||
| 104 | /* MSVC defines off_t in <sys/types.h>. */ | ||
| 105 | #if !@HAVE_UNISTD_H@ | ||
| 106 | /* Get off_t. */ | ||
| 107 | # include <sys/types.h> | ||
| 108 | #endif | ||
| 109 | |||
| 100 | #if (@GNULIB_READ@ || @GNULIB_WRITE@ \ | 110 | #if (@GNULIB_READ@ || @GNULIB_WRITE@ \ |
| 101 | || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \ | 111 | || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \ |
| 102 | || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK) | 112 | || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK) |
| @@ -223,12 +233,24 @@ _GL_WARN_ON_USE (access, "the access function is a security risk - " | |||
| 223 | #endif | 233 | #endif |
| 224 | 234 | ||
| 225 | 235 | ||
| 236 | #if @GNULIB_CHDIR@ | ||
| 237 | _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1))); | ||
| 238 | _GL_CXXALIASWARN (chdir); | ||
| 239 | #elif defined GNULIB_POSIXCHECK | ||
| 240 | # undef chdir | ||
| 241 | # if HAVE_RAW_DECL_CHDIR | ||
| 242 | _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - " | ||
| 243 | "use gnulib module chdir for portability"); | ||
| 244 | # endif | ||
| 245 | #endif | ||
| 246 | |||
| 247 | |||
| 226 | #if @GNULIB_CHOWN@ | 248 | #if @GNULIB_CHOWN@ |
| 227 | /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE | 249 | /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE |
| 228 | to GID (if GID is not -1). Follow symbolic links. | 250 | to GID (if GID is not -1). Follow symbolic links. |
| 229 | Return 0 if successful, otherwise -1 and errno set. | 251 | Return 0 if successful, otherwise -1 and errno set. |
| 230 | See the POSIX:2001 specification | 252 | See the POSIX:2008 specification |
| 231 | <http://www.opengroup.org/susv3xsh/chown.html>. */ | 253 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */ |
| 232 | # if @REPLACE_CHOWN@ | 254 | # if @REPLACE_CHOWN@ |
| 233 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 255 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 234 | # undef chown | 256 | # undef chown |
| @@ -279,24 +301,32 @@ _GL_WARN_ON_USE (close, "close does not portably work on sockets - " | |||
| 279 | #endif | 301 | #endif |
| 280 | 302 | ||
| 281 | 303 | ||
| 282 | #if @REPLACE_DUP@ | 304 | #if @GNULIB_DUP@ |
| 283 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 305 | # if @REPLACE_DUP@ |
| 284 | # define dup rpl_dup | 306 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 285 | # endif | 307 | # define dup rpl_dup |
| 308 | # endif | ||
| 286 | _GL_FUNCDECL_RPL (dup, int, (int oldfd)); | 309 | _GL_FUNCDECL_RPL (dup, int, (int oldfd)); |
| 287 | _GL_CXXALIAS_RPL (dup, int, (int oldfd)); | 310 | _GL_CXXALIAS_RPL (dup, int, (int oldfd)); |
| 288 | #else | 311 | # else |
| 289 | _GL_CXXALIAS_SYS (dup, int, (int oldfd)); | 312 | _GL_CXXALIAS_SYS (dup, int, (int oldfd)); |
| 290 | #endif | 313 | # endif |
| 291 | _GL_CXXALIASWARN (dup); | 314 | _GL_CXXALIASWARN (dup); |
| 315 | #elif defined GNULIB_POSIXCHECK | ||
| 316 | # undef dup | ||
| 317 | # if HAVE_RAW_DECL_DUP | ||
| 318 | _GL_WARN_ON_USE (dup, "dup is unportable - " | ||
| 319 | "use gnulib module dup for portability"); | ||
| 320 | # endif | ||
| 321 | #endif | ||
| 292 | 322 | ||
| 293 | 323 | ||
| 294 | #if @GNULIB_DUP2@ | 324 | #if @GNULIB_DUP2@ |
| 295 | /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if | 325 | /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if |
| 296 | NEWFD = OLDFD, otherwise close NEWFD first if it is open. | 326 | NEWFD = OLDFD, otherwise close NEWFD first if it is open. |
| 297 | Return newfd if successful, otherwise -1 and errno set. | 327 | Return newfd if successful, otherwise -1 and errno set. |
| 298 | See the POSIX:2001 specification | 328 | See the POSIX:2008 specification |
| 299 | <http://www.opengroup.org/susv3xsh/dup2.html>. */ | 329 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */ |
| 300 | # if @REPLACE_DUP2@ | 330 | # if @REPLACE_DUP2@ |
| 301 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 331 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 302 | # define dup2 rpl_dup2 | 332 | # define dup2 rpl_dup2 |
| @@ -425,8 +455,8 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - " | |||
| 425 | /* Change the process' current working directory to the directory on which | 455 | /* Change the process' current working directory to the directory on which |
| 426 | the given file descriptor is open. | 456 | the given file descriptor is open. |
| 427 | Return 0 if successful, otherwise -1 and errno set. | 457 | Return 0 if successful, otherwise -1 and errno set. |
| 428 | See the POSIX:2001 specification | 458 | See the POSIX:2008 specification |
| 429 | <http://www.opengroup.org/susv3xsh/fchdir.html>. */ | 459 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */ |
| 430 | # if ! @HAVE_FCHDIR@ | 460 | # if ! @HAVE_FCHDIR@ |
| 431 | _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); | 461 | _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); |
| 432 | 462 | ||
| @@ -483,11 +513,30 @@ _GL_WARN_ON_USE (fchownat, "fchownat is not portable - " | |||
| 483 | #endif | 513 | #endif |
| 484 | 514 | ||
| 485 | 515 | ||
| 486 | #if @GNULIB_FSYNC@ | 516 | #if @GNULIB_FDATASYNC@ |
| 487 | /* Synchronize changes to a file. | 517 | /* Synchronize changes to a file. |
| 488 | Return 0 if successful, otherwise -1 and errno set. | 518 | Return 0 if successful, otherwise -1 and errno set. |
| 489 | See POSIX:2001 specification | 519 | See POSIX:2008 specification |
| 490 | <http://www.opengroup.org/susv3xsh/fsync.html>. */ | 520 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */ |
| 521 | # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@ | ||
| 522 | _GL_FUNCDECL_SYS (fdatasync, int, (int fd)); | ||
| 523 | # endif | ||
| 524 | _GL_CXXALIAS_SYS (fdatasync, int, (int fd)); | ||
| 525 | _GL_CXXALIASWARN (fdatasync); | ||
| 526 | #elif defined GNULIB_POSIXCHECK | ||
| 527 | # undef fdatasync | ||
| 528 | # if HAVE_RAW_DECL_FDATASYNC | ||
| 529 | _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - " | ||
| 530 | "use gnulib module fdatasync for portability"); | ||
| 531 | # endif | ||
| 532 | #endif | ||
| 533 | |||
| 534 | |||
| 535 | #if @GNULIB_FSYNC@ | ||
| 536 | /* Synchronize changes, including metadata, to a file. | ||
| 537 | Return 0 if successful, otherwise -1 and errno set. | ||
| 538 | See POSIX:2008 specification | ||
| 539 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */ | ||
| 491 | # if !@HAVE_FSYNC@ | 540 | # if !@HAVE_FSYNC@ |
| 492 | _GL_FUNCDECL_SYS (fsync, int, (int fd)); | 541 | _GL_FUNCDECL_SYS (fsync, int, (int fd)); |
| 493 | # endif | 542 | # endif |
| @@ -505,8 +554,8 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - " | |||
| 505 | #if @GNULIB_FTRUNCATE@ | 554 | #if @GNULIB_FTRUNCATE@ |
| 506 | /* Change the size of the file to which FD is opened to become equal to LENGTH. | 555 | /* Change the size of the file to which FD is opened to become equal to LENGTH. |
| 507 | Return 0 if successful, otherwise -1 and errno set. | 556 | Return 0 if successful, otherwise -1 and errno set. |
| 508 | See the POSIX:2001 specification | 557 | See the POSIX:2008 specification |
| 509 | <http://www.opengroup.org/susv3xsh/ftruncate.html>. */ | 558 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */ |
| 510 | # if !@HAVE_FTRUNCATE@ | 559 | # if !@HAVE_FTRUNCATE@ |
| 511 | _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); | 560 | _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); |
| 512 | # endif | 561 | # endif |
| @@ -526,8 +575,8 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " | |||
| 526 | of BUF. | 575 | of BUF. |
| 527 | Return BUF if successful, or NULL if the directory couldn't be determined | 576 | Return BUF if successful, or NULL if the directory couldn't be determined |
| 528 | or SIZE was too small. | 577 | or SIZE was too small. |
| 529 | See the POSIX:2001 specification | 578 | See the POSIX:2008 specification |
| 530 | <http://www.opengroup.org/susv3xsh/getcwd.html>. | 579 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>. |
| 531 | Additionally, the gnulib module 'getcwd' guarantees the following GNU | 580 | Additionally, the gnulib module 'getcwd' guarantees the following GNU |
| 532 | extension: If BUF is NULL, an array is allocated with 'malloc'; the array | 581 | extension: If BUF is NULL, an array is allocated with 'malloc'; the array |
| 533 | is SIZE bytes long, unless SIZE == 0, in which case it is as big as | 582 | is SIZE bytes long, unless SIZE == 0, in which case it is as big as |
| @@ -890,8 +939,8 @@ _GL_WARN_ON_USE (group_member, "group_member is unportable - " | |||
| 890 | /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE | 939 | /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE |
| 891 | to GID (if GID is not -1). Do not follow symbolic links. | 940 | to GID (if GID is not -1). Do not follow symbolic links. |
| 892 | Return 0 if successful, otherwise -1 and errno set. | 941 | Return 0 if successful, otherwise -1 and errno set. |
| 893 | See the POSIX:2001 specification | 942 | See the POSIX:2008 specification |
| 894 | <http://www.opengroup.org/susv3xsh/lchown.html>. */ | 943 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */ |
| 895 | # if @REPLACE_LCHOWN@ | 944 | # if @REPLACE_LCHOWN@ |
| 896 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 945 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 897 | # undef lchown | 946 | # undef lchown |
| @@ -920,8 +969,8 @@ _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " | |||
| 920 | #if @GNULIB_LINK@ | 969 | #if @GNULIB_LINK@ |
| 921 | /* Create a new hard link for an existing file. | 970 | /* Create a new hard link for an existing file. |
| 922 | Return 0 if successful, otherwise -1 and errno set. | 971 | Return 0 if successful, otherwise -1 and errno set. |
| 923 | See POSIX:2001 specification | 972 | See POSIX:2008 specification |
| 924 | <http://www.opengroup.org/susv3xsh/link.html>. */ | 973 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */ |
| 925 | # if @REPLACE_LINK@ | 974 | # if @REPLACE_LINK@ |
| 926 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 975 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 927 | # define link rpl_link | 976 | # define link rpl_link |
| @@ -986,8 +1035,8 @@ _GL_WARN_ON_USE (linkat, "linkat is unportable - " | |||
| 986 | #if @GNULIB_LSEEK@ | 1035 | #if @GNULIB_LSEEK@ |
| 987 | /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. | 1036 | /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. |
| 988 | Return the new offset if successful, otherwise -1 and errno set. | 1037 | Return the new offset if successful, otherwise -1 and errno set. |
| 989 | See the POSIX:2001 specification | 1038 | See the POSIX:2008 specification |
| 990 | <http://www.opengroup.org/susv3xsh/lseek.html>. */ | 1039 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */ |
| 991 | # if @REPLACE_LSEEK@ | 1040 | # if @REPLACE_LSEEK@ |
| 992 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1041 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 993 | # define lseek rpl_lseek | 1042 | # define lseek rpl_lseek |
| @@ -1057,8 +1106,9 @@ _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " | |||
| 1057 | #if @GNULIB_PREAD@ | 1106 | #if @GNULIB_PREAD@ |
| 1058 | /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET. | 1107 | /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET. |
| 1059 | Return the number of bytes placed into BUF if successful, otherwise | 1108 | Return the number of bytes placed into BUF if successful, otherwise |
| 1060 | set errno and return -1. 0 indicates EOF. See the POSIX:2001 | 1109 | set errno and return -1. 0 indicates EOF. |
| 1061 | specification <http://www.opengroup.org/susv3xsh/pread.html>. */ | 1110 | See the POSIX:2008 specification |
| 1111 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */ | ||
| 1062 | # if @REPLACE_PREAD@ | 1112 | # if @REPLACE_PREAD@ |
| 1063 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1113 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 1064 | # undef pread | 1114 | # undef pread |
| @@ -1092,8 +1142,8 @@ _GL_WARN_ON_USE (pread, "pread is unportable - " | |||
| 1092 | /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET. | 1142 | /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET. |
| 1093 | Return the number of bytes written if successful, otherwise | 1143 | Return the number of bytes written if successful, otherwise |
| 1094 | set errno and return -1. 0 indicates nothing written. See the | 1144 | set errno and return -1. 0 indicates nothing written. See the |
| 1095 | POSIX:2001 specification | 1145 | POSIX:2008 specification |
| 1096 | <http://www.opengroup.org/susv3xsh/pwrite.html>. */ | 1146 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */ |
| 1097 | # if @REPLACE_PWRITE@ | 1147 | # if @REPLACE_PWRITE@ |
| 1098 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1148 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 1099 | # undef pwrite | 1149 | # undef pwrite |
| @@ -1125,9 +1175,9 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - " | |||
| 1125 | 1175 | ||
| 1126 | #if @GNULIB_READ@ | 1176 | #if @GNULIB_READ@ |
| 1127 | /* Read up to COUNT bytes from file descriptor FD into the buffer starting | 1177 | /* Read up to COUNT bytes from file descriptor FD into the buffer starting |
| 1128 | at BUF. See the POSIX:2001 specification | 1178 | at BUF. See the POSIX:2008 specification |
| 1129 | <http://www.opengroup.org/susv3xsh/read.html>. */ | 1179 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */ |
| 1130 | # if @REPLACE_READ@ && @GNULIB_UNISTD_H_NONBLOCKING@ | 1180 | # if @REPLACE_READ@ |
| 1131 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1181 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 1132 | # undef read | 1182 | # undef read |
| 1133 | # define read rpl_read | 1183 | # define read rpl_read |
| @@ -1149,8 +1199,8 @@ _GL_CXXALIASWARN (read); | |||
| 1149 | /* Read the contents of the symbolic link FILE and place the first BUFSIZE | 1199 | /* Read the contents of the symbolic link FILE and place the first BUFSIZE |
| 1150 | bytes of it into BUF. Return the number of bytes placed into BUF if | 1200 | bytes of it into BUF. Return the number of bytes placed into BUF if |
| 1151 | successful, otherwise -1 and errno set. | 1201 | successful, otherwise -1 and errno set. |
| 1152 | See the POSIX:2001 specification | 1202 | See the POSIX:2008 specification |
| 1153 | <http://www.opengroup.org/susv3xsh/readlink.html>. */ | 1203 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */ |
| 1154 | # if @REPLACE_READLINK@ | 1204 | # if @REPLACE_READLINK@ |
| 1155 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1205 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 1156 | # define readlink rpl_readlink | 1206 | # define readlink rpl_readlink |
| @@ -1221,8 +1271,8 @@ _GL_WARN_ON_USE (rmdir, "rmdir is unportable - " | |||
| 1221 | #if @GNULIB_SLEEP@ | 1271 | #if @GNULIB_SLEEP@ |
| 1222 | /* Pause the execution of the current thread for N seconds. | 1272 | /* Pause the execution of the current thread for N seconds. |
| 1223 | Returns the number of seconds left to sleep. | 1273 | Returns the number of seconds left to sleep. |
| 1224 | See the POSIX:2001 specification | 1274 | See the POSIX:2008 specification |
| 1225 | <http://www.opengroup.org/susv3xsh/sleep.html>. */ | 1275 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */ |
| 1226 | # if @REPLACE_SLEEP@ | 1276 | # if @REPLACE_SLEEP@ |
| 1227 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1277 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 1228 | # undef sleep | 1278 | # undef sleep |
| @@ -1371,7 +1421,7 @@ _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " | |||
| 1371 | /* Pause the execution of the current thread for N microseconds. | 1421 | /* Pause the execution of the current thread for N microseconds. |
| 1372 | Returns 0 on completion, or -1 on range error. | 1422 | Returns 0 on completion, or -1 on range error. |
| 1373 | See the POSIX:2001 specification | 1423 | See the POSIX:2001 specification |
| 1374 | <http://www.opengroup.org/susv3xsh/sleep.html>. */ | 1424 | <http://www.opengroup.org/susv3xsh/usleep.html>. */ |
| 1375 | # if @REPLACE_USLEEP@ | 1425 | # if @REPLACE_USLEEP@ |
| 1376 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1426 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 1377 | # undef usleep | 1427 | # undef usleep |
| @@ -1397,9 +1447,9 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - " | |||
| 1397 | 1447 | ||
| 1398 | #if @GNULIB_WRITE@ | 1448 | #if @GNULIB_WRITE@ |
| 1399 | /* Write up to COUNT bytes starting at BUF to file descriptor FD. | 1449 | /* Write up to COUNT bytes starting at BUF to file descriptor FD. |
| 1400 | See the POSIX:2001 specification | 1450 | See the POSIX:2008 specification |
| 1401 | <http://www.opengroup.org/susv3xsh/write.html>. */ | 1451 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */ |
| 1402 | # if @REPLACE_WRITE@ && (@GNULIB_UNISTD_H_NONBLOCKING@ || @GNULIB_UNISTD_H_SIGPIPE@) | 1452 | # if @REPLACE_WRITE@ |
| 1403 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1453 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 1404 | # undef write | 1454 | # undef write |
| 1405 | # define write rpl_write | 1455 | # define write rpl_write |