summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* openpty: provide a stub on mingwEric Blake2011-11-092-1/+21
| | | | | | | | | | | | | | | | | | | | | On mingw, the compiler complained that 'struct termios' and 'struct winsize' were declared in the function prototype, then failed to compile due to missing TCSAFLUSH. Since we can't emulate ptys on mingw, it's better to just make this module be a stub that compiles but gracefully fails. This patch assumes that the only portable way to use openpty() is with the fourth and fifth arguments being NULL ('struct termios' cannot be portably initialized in a standard-compliant manner except by open(O_TTY_INIT)/tcgetattr(), and 'struct winsize' is not standardized); for now, applications that want to alter termios settings still have the burden of conditional compilation to avoid the missing tcgetattr() on mingw. * lib/pty.in.h (includes): Provide forward declarations. * lib/openpty.c (openpty) [mingw]: Provide ENOSYS stub. Signed-off-by: Eric Blake <eblake@redhat.com>
* raise: fix mingw handling of SIGPIPEEric Blake2011-11-091-0/+1
| | | | | | | | | | | | | | | When compiling for mingw, I see: CC sigprocmask.lo sigprocmask.c: In function '_gl_raise_SIGPIPE': sigprocmask.c:349:1: warning: control reaches end of non-void function which means that raise(SIGPIPE) would be using an uninitialized value as its return. * lib/sigprocmask.c (_gl_raise_SIGPIPE): Provide a return value. Signed-off-by: Eric Blake <eblake@redhat.com>
* openat: Conditionalize dependencies.Bruno Haible2011-11-081-4/+4
| | | | | * lib/openat.c: Reduce the scope of some #includes. * modules/openat (Depends-on): Add conditions.
* grantpt: fix typoEric Blake2011-11-071-1/+1
| | | | | | * lib/stdlib.in.h (grantpt): Check correct function. Signed-off-by: Eric Blake <eblake@redhat.com>
* copysignl: Fix result for zero argument on HP-UX 11 with HP C.Bruno Haible2011-11-061-0/+34
| | | | | | | * lib/copysignl.c (compute_minus_zerol) [HP-UX]: New function. (minus_zerol) [HP-UX]: New macro. (unary_minus) [HP-UX]: New function. (copysignl) [HP-UX]: Use unary_minus function.
* New module 'fmal'.Bruno Haible2011-11-062-0/+64
| | | | | | | | | | | | | * lib/math.in.h (fmal): New declaration. * lib/fmal.c: New file. * m4/fmal.m4: New file. * m4/math_h.m4 (gl_MATH_H): Test whethern fmal is declared. (gl_MATH_H_DEFAULTS): Initialize GNULIB_FMAL, HAVE_FMAL, REPLACE_FMAL. * modules/math (Makefile.am): Substitute GNULIB_FMAL, HAVE_FMAL, REPLACE_FMAL. * modules/fmal: New file. * doc/posix-functions/fmal.texi: Mention the new module and the various bugs.
* New module 'fmaf'.Bruno Haible2011-11-062-0/+43
| | | | | | | | | | | | | * lib/math.in.h (fmaf): New declaration. * lib/fmaf.c: New file. * m4/fmaf.m4: New file. * m4/math_h.m4 (gl_MATH_H): Test whethern fmaf is declared. (gl_MATH_H_DEFAULTS): Initialize GNULIB_FMAF, HAVE_FMAF, REPLACE_FMAF. * modules/math (Makefile.am): Substitute GNULIB_FMAF, HAVE_FMAF, REPLACE_FMAF. * modules/fmaf: New file. * doc/posix-functions/fmaf.texi: Mention the new module and the various bugs.
* New module 'fma'.Bruno Haible2011-11-062-0/+920
| | | | | | | | | | | | | | * lib/math.in.h (fma): New declaration. * lib/fma.c: New file. * m4/fma.m4: New file. * m4/fegetround.m4: New file. * m4/math_h.m4 (gl_MATH_H): Test whethern fma is declared. (gl_MATH_H_DEFAULTS): Initialize GNULIB_FMA, HAVE_FMA, REPLACE_FMA. * modules/math (Makefile.am): Substitute GNULIB_FMA, HAVE_FMA, REPLACE_FMA. * modules/fma: New file. * doc/posix-functions/fma.texi: Mention the new module and the various bugs.
* openat: Include <stdbool.h>.Bruno Haible2011-11-051-0/+1
| | | | * lib/openat.c: Include <stdbool.h>.
* openat: remove direct dependency on direntPaul Eggert2011-11-041-1/+0
| | | | | | | * lib/openat.h: Don't include <dirent.h>; it's no longer needed, and hasn't been needed ever since fdopendir was split into its own module on 2009-08-31. * modules/openat (Depends-on): Remove dirent.
* at-func*.c: fix commentsJim Meyering2011-11-042-2/+2
| | | | | * lib/at-func2.c: Correct/improve first-line comment. * lib/at-func.c: Correct grammar in first-line comment.
* closedir: Avoid warning on mingw.Bruno Haible2011-11-041-0/+4
| | | | * lib/closedir.c: Include <unistd.h>.
* New module 'fstatat', split off from module 'openat'.Bruno Haible2011-11-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | * lib/openat.h (statat, lstatat): Enable only if GNULIB_FSTATAT is defined. * m4/fstatat.m4: New file. extracted from m4/openat.m4. * m4/openat.m4 (gl_FUNC_OPENAT): Don't set GNULIB_FSTATAT. Don't invoke gl_FUNC_FSTATAT. (gl_FUNC_FSTATAT): Moved to m4/fstatat.m4. * modules/fstatat: New file, extracted from modules/openat. * modules/openat (Files): Remove lib/fstatat.c. (Depends-on): Remove lstat. (configure.ac): Remove AC_LIBOBJ of fstatat. * modules/fstatat-tests: New file, extracted from modules/openat-tests. * modules/openat-tests (Files): Remove tests/test-fstatat.c, tests/test-lstat.h, tests/test-stat.h. (Depends-on): Remove getcwd-lgpl. (Makefile.am): Remove rules for test-fstatat. * doc/posix-functions/fstatat.texi: Mention module 'fstatat' instead of module 'openat'. * NEWS: Mention the change. * modules/getcwd (Depends-on): Add fstatat. * modules/linkat (Depends-on): Likewise. * modules/mkfifoat-tests (Depends-on): Likewise. * modules/utimensat (Depends-on): Add fstatat. Remove openat.
* New module 'fchmodat', split off from module 'openat'.Bruno Haible2011-11-021-0/+4
| | | | | | | | | | | | | | | | | * lib/openat.h (chmodat, lchmodat): Enable only if GNULIB_FCHMODAT is defined. * m4/fchmodat.m4: New file, extracted from m4/openat.m4. * m4/openat.m4 (gl_FUNC_OPENAT): Don't set GNULIB_FCHMODAT. Don't test for fchmodat, lchmod. Don't set HAVE_FCHMODAT. * modules/fchmodat: New file, extracted from modules/openat. * modules/openat (Files): Remove lib/fchmodat.c. (configure.ac): Remove AC_LIBOBJ of fchmodat. * modules/fchmodat-tests: New file, extracted from modules/openat-tests. * modules/openat-tests (Files): Remove tests/test-fchmodat.c. (Makefile.am): Remove rules for test-fchmodat. * doc/posix-functions/fchmodat.texi: Mention module 'fchmodat' instead of module 'openat'. * NEWS: Mention the change.
* putenv: indent #definition of "environ" to placate cppiJim Meyering2011-11-021-1/+1
| | | | * lib/putenv.c (environ): Make indentation reflect cpp nesting.
* alignof: Avoid collision with stdalign module.Bruno Haible2011-11-011-8/+6
| | | | | | * lib/alignof.h (alignof): Remove macro. * NEWS: Mention the change. Reported by Paul Eggert.
* New module 'fchownat', split off from module 'openat'.Bruno Haible2011-11-011-0/+5
| | | | | | | | | | | | | | | | | | | | | | | * lib/openat.h (chownat, lchownat): Enable only if GNULIB_FCHOWNAT is defined. * m4/fchownat.m4: New file, extracted from m4/openat.m4. * m4/openat.m4 (gl_FUNC_OPENAT): Don't set GNULIB_FCHOWNAT. Don't invoke gl_FUNC_FCHOWNAT. (gl_FUNC_FCHOWNAT_DEREF_BUG, gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG, gl_FUNC_FCHOWNAT): Moved to m4/fchownat.m4. * modules/fchownat: New file, extracted from modules/openat. * modules/openat (Files): Remove lib/fchownat.c. (Depends-on): Remove lchown. (configure.ac): Remove AC_LIBOBJ of fchownat. * modules/fchownat-tests: New file, extracted from modules/openat-tests. * modules/openat-tests (Files): Remove tests/test-fchownat.c, tests/test-chown.h, tests/test-lchown.h, tests/nap.h. (Depends-on): Remove mgetgroups, usleep, stat-time. (configure.ac): Remove test for getegid. (Makefile.am): Remove rules for test-fchownat. * doc/posix-functions/fchownat.texi: Mention module 'fchownat' instead of module 'openat'. * NEWS: Mention the change.
* stdalign: port better to MSVC and to Sun C 5.11Paul Eggert2011-10-311-2/+6
| | | | | | | | | | | | | | | | | | | | | I think these problems were reported by Bruno Haible, in email that I've unfortunately misplaced. * doc/posix-headers/stdalign.texi (stdalign.h): Document more shortcomings of MSVC and of Sun C 5.11. * lib/stdalign.in.h (_Alignas): Omit bogus extra parenthesis around __declspec arg. * modules/stdalign-tests (Files): Add tests/macros.h. * tests/test-stdalign.c: Do not include <stdlib.h>; no longer needed. Include macros.h, for ASSERT. (DECLARE_ALIGNED): Remove. (TEST_ALIGNMENT): Define to 16 if alignment is supported (more likely to catch bug), and to 1 if not (simplifies the rest of the code). (CHECK_STATIC): Always declare the alignment test vars; that's simpler. (CHECK_AUTO): Remove. (CHECK_ALIGNED): Check only the alignment of the static vars, since auto var alignment isn't supported by Sun C 5.11. (CHECK_TYPES): Remove. All uses replaced by inline code, so that ASSERT failures are easier to diagnose.
* ffsl, ffsll: Avoid compilation error due to 'restrict'.Bruno Haible2011-10-311-0/+3
| | | | | * lib/ffsl.h: Include <config.h>. Suggested by Tom G. Christensen <tgc@jupiterrise.com>.
* Adjust to Bruno's comments.Paul Eggert2011-10-271-10/+34
|
* sys_socket: use stdalign, not alignofPaul Eggert2011-10-271-1/+1
| | | | | * lib/sys_socket.in.h: Include <stdalign.h> instead of <alignof.h>. * modules/sys_socket (Depends-on): Depend on stdalign, not alignof.
* crypto libraries: use stdalignPaul Eggert2011-10-275-22/+15
| | | | | | | | | | | | * lib/md4.c, lib/md5.c, lib/sha1.c, lib/sha256.c, lib/sha512.c: Include <stdalign.h> and <stdint.h>. Do not include <stddef.h>. Do not include <stdlib.h> twice, in md4.c. (UNALIGNED_P): Simplify by using alignof. Use uintptr_t, not size_t, because we are accessing a pointer's bit-pattern, not a size. * modules/crypto/gc-md4 (Depends-on): Add stdalign. * modules/crypto/gc-md5, modules/crypto/gc-sha1, modules/crypto/md4: * modules/crypto/md5, modules/crypto/sha1, modules/crypto/sha256: * modules/crypto/sha512: Likewise.
* argp: use stdalignPaul Eggert2011-10-271-1/+1
| | | | | | * lib/argp-parse.c: Include <stdalign.h>. (alignof): Remove. * modules/argp (Depends-on): Add stdalign.
* stdalign: new modulePaul Eggert2011-10-271-0/+61
| | | | | | | * doc/posix-headers/stdalign.texi, lib/stdalign.in.h, m4/stdalign.m4: * modules/stdalign: New files. * MODULES.html.sh (c1x_core_properties): Add stdalign. * doc/gnulib.texi (Header File Substitutes): Add stdalign.
* utimensat: Work around problem on Linux/hppa.Bruno Haible2011-10-271-0/+15
| | | | | | * lib/utimensat.c (rpl_utimensat) [Linux/hppa]: Reject invalid tv_nsec values. * doc/posix-functions/utimensat.texi: Mention the problem on Linux/hppa.
* fts: close parent dir FD before returning from post-traversal fts_readJim Meyering2011-10-241-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | The problem: the fts-using "mkdir -p A/B; rm -rf A" would attempt to unlink A, even though an FD open on A remained. This is suboptimal (holding a file descriptor open longer than needed), but otherwise not a problem on Unix-like kernels. However, on Cygwin with certain Novell file systems, (see http://cygwin.com/ml/cygwin/2011-10/msg00365.html), that represents a real problem: it causes the removal of A to fail with e.g., "rm: cannot remove `A': Device or resource busy" fts visits each directory twice and keeps a cache (fts_fd_ring) of directory file descriptors. After completing the final, FTS_DP, visit of a directory, RESTORE_INITIAL_CWD intended to clear the FD cache, but then proceeded to add a new FD to it via the subsequent FCHDIR (which calls cwd_advance_fd and i_ring_push). Before, the final file descriptor would be closed only via fts_close's call to fd_ring_clear. Now, it is usually closed earlier, via the final FTS_DP-returning fts_read call. * lib/fts.c (restore_initial_cwd): New function, converted from the macro. Call fd_ring_clear *after* FCHDIR, not before it. Update callers. Reported by Franz Sirl via the above URL, with analysis by Eric Blake in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/28739
* errno, strerror-override: Support for MSVC 10.Bruno Haible2011-10-224-81/+219
| | | | | | | | | | | | | | | | | | | * lib/errno.in.h (GNULIB_defined_ETXTBSY): Remove macro. (ENOMSG, EIDRM, ENOLINK, EPROTO, EBADMSG, EOVERFLOW, ENOTSUP, ENETRESET, ECONNABORTED, ECANCELED, EINPROGRESS, EALREADY, ENOTSOCK, EDESTADDRREQ, EMSGSIZE, EPROTOTYPE, ENOPROTOOPT, EPROTONOSUPPORT, EOPNOTSUPP, EAFNOSUPPORT, EADDRINUSE, EADDRNOTAVAIL, ENETDOWN, ENETUNREACH, ECONNRESET, ENOBUFS, EISCONN, ENOTCONN, ETIMEDOUT, ECONNREFUSED, ELOOP, EHOSTUNREACH, EWOULDBLOCK, ETXTBSY) [Win32]: Assign values compatible with MSVC 10. (ENODATA, ENOSR, ENOSTR, ENOTRECOVERABLE, EOWNERDEAD, ETIME, EOTHER): New macros. (GNULIB_defined_EWINSOCK): New macro. * lib/strerror-override.c (strerror_override): Update accordingly. * lib/strerror-override.h: Likewise. * lib/w32sock.h (set_winsock_errno): Map those WSA* values that are no longer equal to the corresponding errno value. Reported by Michael Goffioul <michael.goffioul@gmail.com>.
* isfinite, isinf, isnan, signbit: Don't define as a macro in C++.Bruno Haible2011-10-221-2/+69
| | | | | | | | | | | | | * lib/math.in.h (_GL_MATH_CXX_REAL_FLOATING_DECL_1, _GL_MATH_CXX_REAL_FLOATING_DECL_2): nEW MACROS. (isfinite, isinf, isnan, signbit): In C++, define as overloaded functions, not as a macro. * tests/test-math-c++.cc (REAL_FLOATING_CHECK, OVERLOADED_CHECK): New macros. (isfinite, isinf, isnan, signbit): Check overloaded functions and absence of macro. Suggested by Eric Blake. Reported by Michael Goffioul <michael.goffioul@gmail.com>.
* openpty, posix_openpt: Remove code duplication.Bruno Haible2011-10-212-35/+31
| | | | | | | * lib/posix_openpt.c: Add comments about platforms, from lib/openpty.c. * lib/openpty.c: Include <stdlib.h>. (openpty): Use posix_openpt on all platforms except IRIX. * modules/openpty (Depends-on): Add posix_openpt. Add conditions.
* unlockpt: Detect invalid argument.Bruno Haible2011-10-211-0/+3
| | | | | | * lib/unlockpt.c: Include <fcntl.h>. (unlockpt): Check whether fd is valid, using fcntl(). * modules/unlockpt (Depends-on): Add fcntl-h.
* openpty: Avoid compilation error on AIX 6.1.Bruno Haible2011-10-211-0/+3
| | | | * lib/pty.in.h [AIX]: Include <sys/ioctl.h>, for 'struct winsize'.
* posix_openpt: Support for OpenBSD.Bruno Haible2011-10-202-6/+46
| | | | | | | | * lib/posix_openpt.c [OpenBSD]: Include <sys/ioctl.h>, <sys/tty.h>. (posix_openpt) [OpenBSD]: New code. * lib/grantpt.c: Include <fcntl.h>. (grantpt) [OpenBSD]: Only test whether fd is valid, nothing else. * modules/grantpt (Depends-on): Add fcntl-h.
* openpty: Update comments.Bruno Haible2011-10-201-0/+1
| | | | * lib/openpty.c: Add comments about Minix.
* posix_openpt: remove spurious #endifJim Meyering2011-10-191-2/+0
| | | | * lib/posix_openpt.c (posix_openpt): Remove spurious #endif.
* posix_openpt: Fix compilation error.Bruno Haible2011-10-191-1/+1
| | | | | | * lib/posix_openpt.c (posix_openpt): Renamed from posix_openpty. * doc/posix-functions/posix_openpt.texi: Mention ENOENT error code. Mention the openpty module as an alternative.
* Support for old NeXTstep 3.3 gcc.Daniel Richard G2011-10-196-6/+6
| | | | | | | | | | | * lib/gettext.h (_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS): Write 'defined __STRICT_ANSI__', not '__STRICT_ANSI__'. * lib/math.in.h (_GL_NUM_UINT_WORDS etc.): Likewise. * lib/spawn.in.h (_Restrict_arr_): Likewise. * lib/regex.h (_Restrict_arr_): Likewise. * lib/regex_internal.h (re_token_t): Likewise. * lib/regexec.c (check_node_accept_bytes): Likewise. * tests/test-printf-posix.c (func1, func2, func3, func4): Likewise.
* posix_openpt: new moduleEric Blake2011-10-182-0/+66
| | | | | | | | | | | | | | * modules/posix_openpt: New module. * m4/posix_openpt.m4: New file. * lib/posix_openpt.c: Likewise. * m4/stdlib_h.m4 (gl_STDLIB_H): Check for decl. (gl_STDLIB_H_DEFAULTS): Set defaults. * modules/stdlib (Makefile.am): Substitute macros. * lib/stdlib.in.h (posix_openpt): Declare. * MODULES.html.sh (systems lacking POSIX:2008): Document it. * doc/posix-functions/posix_openpt.texi (posix_openpt): Likewise. * modules/posix_openpt-tests: New test module. * tests/test-posix_openpt.c: New test.
* xstrtoll: Fix compilation failure.Bruno Haible2011-10-151-0/+13
| | | | | | | | * lib/xstrtol.c (ULLONG_MAX, LLONG_MAX, LLONG_MIN): New macros, taken from lib/strtol.c. * doc/posix-headers/limits.texi: Mention missing numerical limits on some platforms. Reported by Tom G. Christensen <tgc@jupiterrise.com>.
* vasnprintf: Optimize bit search operation.Bruno Haible2011-10-151-22/+51
| | | | | | | | | | | | | | | * lib/vasnprintf.c (divide): Use optimizations from integer_length.c. * m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF): Require gl_DOUBLE_EXPONENT_LOCATION. * modules/vasnprintf (Files): Add m4/exponentd.m4. * modules/unistdio/u8-vasnprintf (Files): Likewise. * modules/unistdio/u8-u8-vasnprintf (Files): Likewise. * modules/unistdio/u16-vasnprintf (Files): Likewise. * modules/unistdio/u16-u16-vasnprintf (Files): Likewise. * modules/unistdio/u32-vasnprintf (Files): Likewise. * modules/unistdio/u32-u32-vasnprintf (Files): Likewise. * modules/unistdio/ulc-vasnprintf (Files): Likewise. * m4/isnand.m4 (gl_PREREQ_ISNAND): Use AC_REQUIRE.
* vasnprintf: Fix comments.Bruno Haible2011-10-151-4/+4
| | | | * lib/vasnprintf.c (decode_long_double, decode_double): Fix comments.
* New module 'integer_length_ll'.Bruno Haible2011-10-151-0/+20
| | | | | * lib/integer_length_ll.c: New file. * modules/integer_length_ll: New file.
* New module 'integer_length_l'.Bruno Haible2011-10-151-0/+81
| | | | | * lib/integer_length_l.c: New file. * modules/integer_length_l: New file.
* New module 'integer_length'.Bruno Haible2011-10-152-0/+190
| | | | | | * lib/integer_length.h: New file. * lib/integer_length.c: New file. * modules/integer_length: New file.
* ffsl: Optimize on 64-bit platforms.Bruno Haible2011-10-151-22/+19
| | | | | * lib/ffsl.h (FUNC): Omit a test from the last loop round. Do loop unrolling.
* ffsl: Optimize on 32-bit platforms.Bruno Haible2011-10-141-11/+27
| | | | | * lib/ffsl.h (FUNC): If TYPE has the same representation as 'int', just use ffs() without a loop.
* ffsl, ffsll: Optimize for GCC.Bruno Haible2011-10-143-0/+6
| | | | | | * lib/ffsl.h (FUNC): Use GCC_BUILTIN if defined. * lib/ffsl.c (GCC_BUILTIN): New macro. * lib/ffsll.c (GCC_BUILTIN): Likewise.
* ffs, bcopy, memset: Support symbol renaming via config.h.Bruno Haible2011-10-133-0/+7
| | | | | | * lib/ffs.c: Include <config.h>. * lib/bcopy.c: Likewise. * lib/memset.c: Likewise.
* atanl: Simplify for platforms where 'long double' == 'double'.Bruno Haible2011-10-111-0/+12
| | | | | | | | * lib/atanl.c (atanl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New alternative implementation. * m4/atanl.m4 (gl_FUNC_ATANL): Require gl_LONG_DOUBLE_VS_DOUBLE. Determine ATANL_LIBM according to HAVE_SAME_LONG_DOUBLE_AS_DOUBLE. * modules/atanl (Depends-on): Add atan. Update conditions.
* acosl: Simplify for platforms where 'long double' == 'double'.Bruno Haible2011-10-111-0/+12
| | | | | | | | * lib/acosl.c (acosl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New alternative implementation. * m4/acosl.m4 (gl_FUNC_ACOSL): Require gl_LONG_DOUBLE_VS_DOUBLE. Determine ACOSL_LIBM according to HAVE_SAME_LONG_DOUBLE_AS_DOUBLE. * modules/acosl (Depends-on): Add acos. Update conditions.
* asinl: Simplify for platforms where 'long double' == 'double'.Bruno Haible2011-10-111-0/+12
| | | | | | | | * lib/asinl.c (asinl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New alternative implementation. * m4/asinl.m4 (gl_FUNC_ASINL): Require gl_LONG_DOUBLE_VS_DOUBLE. Determine ASINL_LIBM according to HAVE_SAME_LONG_DOUBLE_AS_DOUBLE. * modules/asinl (Depends-on): Add asin. Update conditions.