summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* fflush: also replace fclose when fixing fflushEric Blake2011-05-021-2/+8
| | | | | | | | | | | | | | | | | | | | This fixes the fclose failures detected in the previous patch, but only when the GPL fflush module is also in use. That is because the need for behavior of resetting seekable input streams is much less common, and the fix more complex. The LGPLv2+ test for fclose() in isolation is relaxed to pass if fflush is not being replaced to cater to input streams. * modules/fflush (Depends-on): Add fclose. * m4/fflush.m4 (gl_FUNC_FFLUSH): Also replace fclose. * lib/fclose.c (rpl_fclose): Don't cause spurious failures on memstreams with no backing fd. * doc/posix-functions/fclose.texi (fclose): Document the use of fflush module to fix the bug. * tests/test-fclose.c (main): Relax test when fclose is used in isolation. Signed-off-by: Eric Blake <eblake@redhat.com>
* fclose: reduce dependenciesEric Blake2011-05-021-2/+4
| | | | | | | | | | | | In an LGPLv2+ project, the last change to fclose dragged in inappropriate modules. * modules/fclose (Depends-on): Switch from fflush/fseeko to simpler lseek. * lib/fclose.c (rpl_fclose): Likewise. Reported by Simon Josefsson. Signed-off-by: Eric Blake <eblake@redhat.com>
* Revert "netdb: Fix invalid C syntax." commit from 2011-04-30.Bruno Haible2011-05-011-1/+1
|
* fclose: don't fail on non-seekable input streamEric Blake2011-04-301-1/+5
| | | | | | | | | | | | On mingw, for a project that uses both sockets and streams, then fclose(stdin) when getting input from a terminal or pipe was spuriously failing. * modules/fclose (Depends-on): Add freading, fflush, fseeko. * lib/fclose.c (rpl_fclose): Skip fflush for non-seekable input, since fflush is allowed to fail in that case. Signed-off-by: Eric Blake <eblake@redhat.com>
* dup3: cleanupBruno Haible2011-04-301-14/+0
| | | | * lib/dup3.c: Remove old code, leftover from 2009-12-16.
* netdb: Make it work in C++ mode.Bruno Haible2011-04-301-10/+38
| | | | | | | | | | | * lib/netdb.in.h (struct addrinfo): In C++, define as a C struct. (getaddrinfo, freeaddrinfo, getnameinfo): Use macros from c++defs module. * m4/netdb_h.m4 (gl_NETDB_MODULE_INDICATOR): Invoke gl_MODULE_INDICATOR_FOR_TESTS. * modules/netdb-tests (Depends-on): Add netdb-c++-tests. * modules/netdb-c++-tests: New file. * tests/test-netdb-c++.cc: New file.
* passfd: Add comments.Bruno Haible2011-04-301-0/+6
| | | | * lib/passfd.c: Add comments about platforms.
* sys_uio: Make <sys/uio.h> self-contained.Bruno Haible2011-04-301-0/+3
| | | | | * lib/sys_uio.in.h: Include <sys/types.h> before <sys/uio.h>. * doc/posix-headers/sys_uio.texi: Mention the OpenBSD problem.
* sys_socket: Ensure 'struct iovec' definition.Bruno Haible2011-04-301-3/+6
| | | | | | * lib/sys_socket.in.h: Include <sys/uio.h> also on platforms that have <sys/socket.h>. * doc/posix-headers/sys_socket.texi: Mention the OpenBSD problem.
* sys_uio: Protect definition of 'struct iovec'.Bruno Haible2011-04-301-0/+12
| | | | | * lib/sys_uio.in.h (struct iovec): Avoid redefinition. In C++, define it as a C struct.
* netdb: Fix invalid C syntax.Bruno Haible2011-04-301-1/+1
| | | | * lib/netdb.in.h (AI_ADDRCONFIG): Fix comment syntax.
* quotearg: avoid uninitialized variable useEric Blake2011-04-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Coverity correctly deduced: Error: UNINIT: m4-1.4.16/lib/quotearg.c:171: var_decl: Declaring variable "o" without initializer. m4-1.4.16/lib/quotearg.c:175: uninit_use: Using uninitialized value "o": field "o".right_quote is uninitialized. When custom_quoting_style was introduced in commit 12247f77, this method was not updated, and any caller that passed the new enum value to any of the existing quotearg_*style functions could trigger a crash from the uninitialized memory. That was already documented as unspecified behavior, though, so changing to an abort makes it easier to spot bad code that passes the wrong enum value, rather than waiting for the eventual bad memory dereference later on. Most callers of quotearg_*style were using quoting_style_args and quoting_style_vals to map strings to particular enum values, and custom_quoting_style is (intentionally) not covered by these arrays, so the pre-patch bug/post-patch abort are not possible with those callers. * lib/quotearg.c (quoting_options_from_style): Initialize remaining fields, and ensure that custom styles are only used via quoting_options rather than quoting_style. Signed-off-by: Eric Blake <eblake@redhat.com>
* netdb: fix gai_strerror replacementsBruno Haible2011-04-291-0/+2
| | | | | * lib/netdb.in.h: Add _GL_FUNCDECL_RPL definitions. * modules/netdb: Substitute it.
* getaddrinfo: fix gai_strerror signatureEric Blake2011-04-282-4/+32
| | | | | | | | | | | | | | | | | | | | Several platforms declare gai_strerror to return char* rather than const char*. Worse, on mingw, if UNICODE is defined, it is defined to return WCHAR*, which means the result is in unicode but an application expecting bytes for characters will only see a one-byte answer. * m4/getaddrinfo.m4 (gl_GETADDRINFO): Detect broken signatures, and work around mingw with UNICODE defined. (gl_PREREQ_GETADDRINFO): Drop redundant decl check. * m4/netdb_h.m4 (gl_NETDB_H_DEFAULTS): Add witness. * modules/netdb (Makefile.am): Substitute it. * lib/netdb.in.h (gai_strerror): Declare replacement. * lib/gai_strerror.c (rpl_gai_strerror): Fix signature. * doc/posix-functions/gai_strerror.texi (gai_strerror): Document the fix. Signed-off-by: Eric Blake <eblake@redhat.com>
* getsockopt: avoid compiler warningEric Blake2011-04-281-1/+2
| | | | | | | | | | | | | | | | getsockopt.c: In function 'rpl_getsockopt': getsockopt.c:51:7: warning: passing argument 4 of 'getsockopt' from incompatible pointer type c:\dev\msys_setup\mingw\bin\../lib/gcc/mingw32/4.5.0/../../../../include/winsock2.h:543:32: note: expected 'char *' but argument is of type 'int *' A simple cast works around the mingw signature lameness. If only they had picked void* instead of char*, like POSIX says... * lib/getsockopt.c (rpl_getsockopt): Add a cast for mingw. Reported by Matthias Bolte. Signed-off-by: Eric Blake <eblake@redhat.com>
* hash, mgetgroups: drop xalloc dependencyEric Blake2011-04-284-13/+41
| | | | | | | | | | | | | | | | | | | | | Rely on the new xalloc-oversized module to avoid requiring xalloc-die for functions documented as returning NULL on potential allocation overflow. * lib/hash.c (includes): Adjust includes. * lib/mgetgroups.c (includes): Likewise. (xgetgroups): Move... * lib/xgetgroups.c: ...to new file. * modules/xgetgroups: New file, split from... * modules/mgetgroups: ...here. (Depends-on): Add xalloc-oversized. * modules/hash (Depends-on): Likewise. * modules/hash-tests (Depends-on): Drop xalloc. (test_hash_LDADD): Drop unused library. * tests/test-hash.c (main): Break xalloc dependency. (includes): Drop unused include. Signed-off-by: Eric Blake <eblake@redhat.com>
* xalloc-oversized: new moduleEric Blake2011-04-282-16/+39
| | | | | | | | | | | | | | | Due to inline functions, mere inclusion of xalloc.h can result in a link dependency on xalloc_die() on some platforms. However, there are several modules that want to use just xalloc_oversized in order to short-circuit the potential to call xalloc_die. Splitting the macro into a new header and module makes this easy. * modules/xalloc-oversized: New module. * modules/xalloc (Depends-on): Add it. * lib/xalloc.h (xalloc_oversized): Move... * lib/xalloc-oversized.h: ...into new file. Signed-off-by: Eric Blake <eblake@redhat.com>
* utimecmp: drop dependency on xmallocEric Blake2011-04-281-17/+41
| | | | | | | | | | | utimecmp's only use of malloc was for a cache; we can always bypass the cache in low memory, and thus avoid dragging in xalloc-die. * lib/utimecmp.c (utimecmp): Work even if hash table cache fails due to memory pressure. * modules/utimecmp (Depends-on): Drop xalloc. Signed-off-by: Eric Blake <eblake@redhat.com>
* getcwd: fix mingw bugsEric Blake2011-04-271-1/+1
| | | | | | | | | | | | | | | | On mingw, getcwd(NULL,1) succeeds, even though glibc documents that with a non-zero size, the allocation will not exceed that many bytes. On mingw, getcwd has the wrong signature. However, we don't have to check for this if anything else triggers the replacement. Also, fix a type bug that crept into the original getcwd-lgpl commit. * m4/getcwd.m4 (gl_FUNC_GETCWD_NULL): Detect one mingw bug. * doc/posix-functions/getcwd.texi (getcwd): Document the problems. * lib/getcwd-lgpl.c (rpl_getcwd): Fix return type. Signed-off-by: Eric Blake <eblake@redhat.com>
* Typo in comment.Bruno Haible2011-04-281-1/+1
|
* mkstemps: Ensure declaration on MacOS X 10.5.Bruno Haible2011-04-281-1/+2
| | | | | | * lib/stdlib.in.h: Include <unistd.h> when mkstemps is requested. * doc/glibc-functions/mkstemps.texi: Document header file problem on MacOS X.
* clean-temp: Clarify what it does.Bruno Haible2011-04-271-2/+6
| | | | | | | | | * lib/clean-temp.h: Add more comments. * doc/posix-functions/mkstemp.texi: Tweak reference to 'clean-temp' module. * doc/glibc-functions/mkostemp.texi: Mention 'clean-temp' here too. * doc/glibc-functions/mkstemps.texi: Likewise. * doc/glibc-functions/mkostemps.texi: Likewise.
* fchdir: avoid extra chdir and fix testEric Blake2011-04-271-35/+19
| | | | | | | | | | | | | | | | | | On Linux, with a forced ac_cv_func_fchdir=no, the test failed because dup2 was not replaced, all because the shell variable ac_cv_func_dup2 had not been set yet. Meanwhile, computing the canonical pathname of a directory on mingw was rather expensive -- multiple chdir()! -- but nothing cared whether the name was canonical, just that it was absolute. * modules/fchdir (Depends-on): Add dosname, filenamecat-lgpl, getcwd-lgpl. * lib/fchdir.c (get_name): Any absolute name will do; it does not have to be canonical. * m4/dup2.m4 (gl_REPLACE_DUP2): Ensure dup2 is replaced. Signed-off-by: Eric Blake <eblake@redhat.com>
* save-cwd: reduce default dependencyEric Blake2011-04-271-1/+2
| | | | | | | | | | | | | | | | | | | | | save-cwd generally needs only a working fchdir or a working getcwd(NULL,0). If you are not worried about directories whose absolute name is longer than PATH_MAX, then reducing the default dependencies reduces the bulk for this module. However, there are cases where neither function works on Linux (an unreadable but searchable directory can be opened by O_SEARCH, except that Linux doesn't implement that yet; and Linux getcwd() has issues with long absolute names which glibc does not work around but which the full-blown getcwd module does). So someone desiring a truly robust solution needs to import the 'getcwd' module at the same time as 'save-cwd'. * modules/save-cwd (Depends-on): Use getcwd-lgpl. * lib/save-cwd.c: Update comments. * NEWS: Document the semantic change. Signed-off-by: Eric Blake <eblake@redhat.com>
* getcwd-lgpl: new moduleEric Blake2011-04-271-0/+118
| | | | | | | | | | | | | | | | | For programs that aren't worried about being invoked from an current working directory longer than PATH_MAX (perhaps because the program always does chdir to a sane location first), the getcwd module is overkill, given that all modern portability targets have a getcwd that works on short names. * modules/getcwd-lgpl: New module. * lib/getcwd-lgpl.c: New file. * doc/posix-functions/getcwd.texi (getcwd): Document it. * MODULES.html.sh (lacking POSIX:2008): Likewise. * modules/getcwd (configure.ac): Set C witness. * m4/getcwd.m4 (gl_FUNC_GETCWD_LGPL): New macro. Signed-off-by: Eric Blake <eblake@redhat.com>
* passfd: avoid compiler warningEric Blake2011-04-271-4/+4
| | | | | | | | | Detected on Fedora 13 with -Wshadow. * lib/passfd.c (sendfd, recvfd): Avoid shadowing names. Reported by Laine Stump. Signed-off-by: Eric Blake <eblake@redhat.com>
* mkstemp: mention clean-temp moduleReuben Thomas2011-04-271-1/+5
| | | | | | | * lib/mkstemp.c: Add comment. * doc/posix-functions/mkstemp.texi (mkstemp): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
* strtoimax, strtoumax: simplify, port to HP-UX 11.00 64-bitPaul Eggert2011-04-261-0/+2
| | | | | | | | | | | | This supports apps that need pointers to strtoimax and strtoumax, and ports to HP-UX 11.00 64.bit, which has macros that expand to nonexistent functions. See <http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00241.html> et seq. * lib/inttypes.in.h (strtoimax, strtoumax): #undef before declaring. * m4/strtoimax.m4 (gl_FUNC_STRTOIMAX): Don't check whether it's a macro. * m4/strtoumax.m4 (gl_FUNC_STRTOUMAX): Likewise.
* Revert "use _GL_ATTRIBUTE_CONST and _GL_ATTRIBUTE_PURE"Jim Meyering2011-04-2527-252/+36
| | | | | This reverts commit 349d7fe0e307d59d508b3579317ee8d4eacfeb9c. Revert accidentally-pushed patch. Not yet ready.
* use _GL_ATTRIBUTE_CONST and _GL_ATTRIBUTE_PUREJim Meyering2011-04-2527-36/+252
|
* strtol: remove dependency on wcharPaul Eggert2011-04-221-2/+1
| | | | | * lib/strtol.c: Include <wchar.h> only if USE_WIDE_CHAR is defined. * modules/strtol (Depends-on): Remove wchar.
* passfd: speed up configure and drop unused codeEric Blake2011-04-211-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Ultimately, it would be nice to provide a sendmsg and recvmsg module, and have those provide a replacement struct msghdr and silently convert msg_accrights into the replacement struct's msg_control, when targeting older BSD. But until that point in time, this is a nice cleanup. SCM_RIGHTS really only works on Unix sockets; however, there is nothing in passfd.c that needs to be hard-coded to this (rather, the hard-coding of the address family is done externally when the socket or socketpair is created). * m4/afunix.m4 (gl_SOCKET_AFUNIX): Rename... * m4/passfd.m4 (gl_PASSFD): ...to something more fitting of its use. Drop test for setting unused HAVE_UNIXSOCKET_SCM_RIGHTS. Instead of probing at configure for unix_scm_rights_bsd44_way, instead probe for CMSG_FIRSTHDR at compile time. Simplify BSD 4.3 check to a struct member probe. * lib/passfd.c (includes): Nothing here requires <sys/un.h>. (sendfd, recvfd): Update preprocessor checks. * modules/passfd (Files): Reflect rename, and drop unused file. (Depends-on): Drop unused dependency. Signed-off-by: Eric Blake <eblake@redhat.com>
* passfd: allow compilation on mingwEric Blake2011-04-212-14/+44
| | | | | | | | | | | | | | | | | | | | | | The passfd module now skips on mingw, rather than failing to compile. It may be nice to add a sendmsg and recvmsg module in the future, but for now passfd is the only client that cares. * modules/sys_socket (Depends-on): Add sys_uio. * lib/sys_socket.in.h [!@HAVE_SYS_SOCKET_H@]: Use it for struct iovec and a minimal struct msghdr. * tests/test-sys_socket.c (main): Enhance test. * m4/afunix.m4 (gl_SOCKET_AFUNIX): Detect recvmsg/sendmsg. * lib/passfd.c (include): Drop <sys/uio.h>; <sys/sockets.h> is guaranteed to provide what we need. (sendmsg, recvmsg): Declare fallbacks if we lack sendmsg. * modules/passfd-tests (Depends-on): Add sys_wait. * tests/test-passfd.c (main): Skip test on mingw, for now. * doc/posix-headers/sys_socket.texi (sys/socket.h): Document the partial 'struct msghdr' implementation. Signed-off-by: Eric Blake <eblake@redhat.com>
* sys_uio: new moduleEric Blake2011-04-211-0/+49
| | | | | | | | | | | | | | | For now, just provide the types used by sys/socket. We could add readv() and writev() later, if desired. * modules/sys_uio: New module. * modules/sys_uio-tests: Likewise. * lib/sys_uio.in.h: New file. * m4/sys_uio_h.m4: Likewise. * tests/test-sys_uio.c: Likewise. * doc/posix-headers/sys_uio.texi (sys/uio.h): Document it. * MODULES.html.sh (systems lacking POSIX:2008): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
* ioctl: Remove link dependency on native Windows.Bruno Haible2011-04-196-123/+221
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/fd-hook.h: Renamed from lib/close-hook.h. (gl_close_fn, gl_ioctl_fn): New types. (struct fd_hook): Renamed from struct close_hook. Change type of private_close_fn field. Add private_ioctl_fn field. (close_hook_fn): Add parameter for primary close method. (execute_close_hooks, execute_all_close_hooks): Likewise. (ioctl_hook_fn): New type. (execute_ioctl_hooks, execute_all_ioctl_hooks): New declarations. (register_fd_hook): Renamed from register_close_hook. Add ioctl_hook argument. (unregister_fd_hook): Renamed from unregister_close_hook. * lib/fd-hook.c: Renamed from lib/close-hook.c. Don't include <unistd.h>. (close): Remove undef. (anchor): Update. (execute_close_hooks): Add argument for primary close method. (execute_all_close_hooks): Likewise. (execute_ioctl_hooks, execute_all_ioctl_hooks): New functions. (register_fd_hook): Renamed from register_close_hook. Add ioctl_hook argument. Allow each argument to be NULL. (unregister_fd_hook): Renamed from unregister_close_hook. * lib/close.c (rpl_close): Pass 'close' function pointer to execute_all_close_hooks. * lib/ioctl.c: Include <errno.h>, fd-hook.h. (primary_ioctl): New function. (ioctl): Don't call ioctlsocket here. Instead, call execute_all_ioctl_hooks. * lib/sockets.c (close_fd_maybe_socket): Add argument for primary close method. (ioctl_fd_maybe_socket): New function, with code from lib/ioctl.c. (fd_sockets_hook): Renamed from close_sockets_hook. (gl_sockets_startup, gl_sockets_cleanup): Update. * modules/fd-hook: Renamed from modules/close-hook. Update. * modules/close (Depends-on): Add fd-hook, remove close-hook. * modules/sockets (Depends-on): Likewise. * modules/ioctl (Depends-on): Add fd-hook. * tests/test-nonblocking.c (main): Use GNULIB_TEST_SOCKET, not GNULIB_SOCKET.
* pipe2: Simplify code.Bruno Haible2011-04-171-14/+8
| | | | * lib/pipe2.c (pipe2): Reduce code duplication.
* nonblocking: Add comment.Bruno Haible2011-04-171-0/+3
| | | | * lib/fcntl.in.h (O_NONBLOCK): Add comment.
* strchrnul: Tweak last commit.Bruno Haible2011-04-161-4/+3
| | | | | | | | | * doc/glibc-functions/strchrnul.texi: Add more details about Cygwin bug. * lib/string.in.h (strchrnul): Use same arguments in _GL_FUNCDECL_RPL as in _GL_FUNCDECL_SYS. * m4/strchrnul.m4 (gl_FUNC_STRCHRNUL): Invoke gl_PREREQ_STRCHRNUL after AC_LIBOBJ. When cross-compiling, say "guessing yes" not "yes".
* strchrnul: work around cygwin bugEric Blake2011-04-151-2/+14
| | | | | | | | | | | | | A misplaced * means that cygwin 1.7.9 dereferences NULL rather than returning the location of the trailing NUL byte. * doc/glibc-functions/strchrnul.texi (strchrnul): Document bug. * m4/strchrnul.m4 (gl_FUNC_STRCHRNUL): Detect it. * m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): New witness. * modules/string (Makefile.am): Substitute it. * lib/string.in.h (strchrnul): Use it. Signed-off-by: Eric Blake <eblake@redhat.com>
* Support non-blocking pipe I/O in read() on native Windows.Bruno Haible2011-04-154-6/+423
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/unistd.in.h: Include <sys/types.h> also for 'read'. (read): New declaration. * lib/read.c: New file. * lib/stdio.in.h (_GL_ATTRIBUTE_FORMAT_SCANF, _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM): New macros. (fgetc, fgets, fread, fscanf, getc, getchar, gets, scanf, vfscanf, vscanf): New declarations. * lib/stdio-read.c: New file. * m4/read.m4: New file. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_READ, REPLACE_READ. * m4/stdio_h.m4 (gl_STDIO_H): Set GNULIB_FGETC, GNULIB_FGETS, GNULIB_FREAD, GNULIB_FSCANF, GNULIB_GETC, GNULIB_GETCHAR, GNULIB_GETS, GNULIB_SCANF, GNULIB_VFSCANF, GNULIB_VSCANF. In non-blocking I/O is desired and needs workarounds, set REPLACE_STDIO_READ_FUNCS. (gl_STDIO_H_DEFAULTS): Initialize GNULIB_FGETC, GNULIB_FGETS, GNULIB_FREAD, GNULIB_FSCANF, GNULIB_GETC, GNULIB_GETCHAR, GNULIB_GETS, GNULIB_SCANF, GNULIB_VFSCANF, GNULIB_VSCANF, REPLACE_STDIO_READ_FUNCS. * modules/read: New file. * modules/nonblocking (Files): Add lib/stdio-read.c. * modules/unistd (Makefile.am): Substitute GNULIB_READ, REPLACE_READ. * modules/stdio (Makefile.am): Substitute GNULIB_FGETC, GNULIB_FGETS, GNULIB_FREAD, GNULIB_FSCANF, GNULIB_GETC, GNULIB_GETCHAR, GNULIB_GETS, GNULIB_SCANF, GNULIB_VFSCANF, GNULIB_VSCANF, REPLACE_STDIO_READ_FUNCS. * modules/pread (Depends-on): Add read. * modules/safe-read (Depends-on): Likewise. * tests/test-stdio-c++.cc (fgetc, fgets, fread, fscanf, getc, getchar, gets, scanf, vfscanf, vscanf): Verify signatures. * doc/posix-functions/read.texi: Mention 'nonblocking' module and problem with non-blocking pipes. * doc/posix-functions/fgetc.texi: Likewise. * doc/posix-functions/fgets.texi: Likewise. * doc/posix-functions/fread.texi: Likewise. * doc/posix-functions/fscanf.texi: Likewise. * doc/posix-functions/getc.texi: Likewise. * doc/posix-functions/getchar.texi: Likewise. * doc/posix-functions/gets.texi: Likewise. * doc/posix-functions/scanf.texi: Likewise. * doc/posix-functions/vfscanf.texi: Likewise. * doc/posix-functions/vscanf.texi: Likewise.
* Support non-blocking pipe I/O in write() on native Windows.Bruno Haible2011-04-141-27/+66
| | | | | | | * lib/write.c (rpl_write): Split a write request that failed merely because the byte count was larger than the pipe buffer's size. * doc/posix-functions/write.texi: Mention the problem with large byte counts.
* wchar: Ensure that wchar_t gets defined on uClibc.Bruno Haible2011-04-141-1/+5
| | | | | * lib/wchar.in.h: On uClibc, include <stddef.h>. Reported by Giuseppe Scrivano <gscrivano@gnu.org>.
* Support non-blocking pipe I/O in write() on native Windows.Bruno Haible2011-04-134-34/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/unistd.in.h (write): Enable replacement also if GNULIB_UNISTD_H_NONBLOCKING is 1. * lib/write.c: Enable replacement also if GNULIB_NONBLOCKING. (rpl_write): When failing to write on a non-blocking pipe, change errno from ENOSPC to EAGAIN. * lib/stdio.in.h (fprintf, fputc, fputs, fwrite, printf, putc, putchar, puts, vfprintf, vprintf): Enable replacement also if GNULIB_STDIO_H_NONBLOCKING is 1. * lib/stdio-write.c: Enable replacements also if GNULIB_NONBLOCKING. (CLEAR_ERRNO, HANDLE_ENOSPC): New macros. (CLEAR_LastError, HANDLE_ERROR_NO_DATA): New macros, extracted from CALL_WITH_SIGPIPE_EMULATION. (CALL_WITH_SIGPIPE_EMULATION): Use them. * m4/nonblocking.m4: New file. * m4/write.m4 (gl_FUNC_WRITE): Enable REPLACE_WRITE also if required for non-blocking I/O support. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_UNISTD_H_NONBLOCKING. * m4/stdio_h.m4 (gl_STDIO_H): Enable REPLACE_STDIO_WRITE_FUNCS also if required for non-blocking I/O support. (gl_STDIO_H_DEFAULTS): Initialize GNULIB_STDIO_H_NONBLOCKING. * modules/nonblocking (Files): Add m4/nonblocking.m4, lib/stdio-write.c, m4/asm-underscore.m4. (Depends-on): Add stdio, unistd. (configure.ac): Invoke gl_NONBLOCKING_IO. Define GNULIB_NONBLOCKING. Set GNULIB_STDIO_H_NONBLOCKING, GNULIB_UNISTD_H_NONBLOCKING. * modules/unistd (Makefile.am): Substitute GNULIB_UNISTD_H_NONBLOCKING. * modules/stdio (Makefile.am): Substitute GNULIB_STDIO_H_NONBLOCKING. * doc/posix-functions/fprintf.texi: Mention 'nonblocking' module and problem with non-blocking pipes. * doc/posix-functions/fputc.texi: Likewise. * doc/posix-functions/fputs.texi: Likewise. * doc/posix-functions/fwrite.texi: Likewise. * doc/posix-functions/printf.texi: Likewise. * doc/posix-functions/putc.texi: Likewise. * doc/posix-functions/putchar.texi: Likewise. * doc/posix-functions/puts.texi: Likewise. * doc/posix-functions/vfprintf.texi: Likewise. * doc/posix-functions/vprintf.texi: Likewise. * doc/posix-functions/write.texi: Likewise.
* maint: remove doubled word: s/it it/it/Jim Meyering2011-04-111-1/+1
| | | | * lib/stat-time.h (get_stat_birthtime): s/it it/it/
* maint: remove doubled words in comments, e.g., s/a a/a/Jim Meyering2011-04-101-1/+1
| | | | | * lib/strptime.c (day_of_the_week): s/the the/the/ * tests/test-chown.h (test_chown): s/a a/a/
* maint: fix "the the" in commentJim Meyering2011-04-091-1/+1
| | | | * lib/count-one-bits.h: s/the the/the/
* maint: change "can not" to "cannot"Jim Meyering2011-04-091-1/+1
| | | | | | | | | But do not change the occurrences in maintain.texi or in build-aux/po/Makefile.in.in, which I presume comes from gettext. * doc/gnulib-tool.texi: s/can not/cannot/ * doc/posix-functions/accept.texi (accept): Likewise. * doc/posix-functions/socket.texi (socket): Likewise. * lib/mbrtowc.c: Likewise.
* careadlinkat: Guard against misuse of careadlinkatcwd.Bruno Haible2011-04-091-4/+8
| | | | | * lib/careadlinkat.c: Include <stdlib.h>. (careadlinkatcwd): Check that the fd argument is as expected.
* careadlinkat: Use common coding style.Bruno Haible2011-04-091-2/+2
| | | | * lib/careadlinkat.c: Move gnulib includes after system includes.
* careadlinkat: Clarify specification.Bruno Haible2011-04-092-3/+11
| | | | | | * lib/careadlinkat.h (careadlinkat): Clarify preadlinkat argument. (careadlinkatcwd): Add comment. * lib/careadlinkat.c (careadlinkat): Clarify preadlinkat argument.