summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* list: fix GCC warningsAkim Demaille2020-05-314-17/+23
| | | | | | | | | | | | | * lib/gl_anytree_list2.h (gl_tree_iterator_free) (gl_tree_next_node, gl_tree_node_nx_set_value) (gl_tree_previous_node, gl_tree_next_node): Mark unused arguments. * lib/gl_anytree_oset.h (gl_tree_iterator_free): Likewise. * lib/gl_anylinked_list2.h (gl_linked_node_value) (gl_linked_node_nx_set_value, gl_linked_iterator_free): Likewise. * lib/gl_anytreehash_list2.h (gl_tree_search_from_to): Avoid using the same variable name in nested scopes.
* list-c++, set-c++, oset-c++, map-c++, omap-c++: Don't fool the compiler.Bruno Haible2020-05-315-6/+50
| | | | | | | | | | | Reported by Akim Demaille in <https://lists.gnu.org/archive/html/bug-bison/2020-05/msg00102.html>. * lib/gl_list.hh (gl_List::iterator::next): Avoid a reinterpret_cast. * lib/gl_set.hh (gl_Set::iterator::next): Likewise. * lib/gl_oset.hh (gl_OSet::iterator::next): Likewise. * lib/gl_map.hh (gl_Map::iterator::next): Likewise. * lib/gl_omap.hh (gl_OMap::iterator::next): Likewise.
* wmempcpy: New module.Bruno Haible2020-05-312-0/+51
| | | | | | | | | | | | | | | | | Reported by Paul Eggert in <https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00387.html>. * lib/wchar.in.h (wmempcpy): New declaration. * lib/wmempcpy.c: New file. * m4/wmempcpy.m4: New file. * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wmempcpy is declared. (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WMEMPCPY, HAVE_WMEMPCPY. * modules/wchar (Makefile.am): Substitute GNULIB_WMEMPCPY, HAVE_WMEMPCPY. * modules/wmempcpy: New file. * tests/test-wchar-c++.cc: Check the signature of wmempcpy. * doc/glibc-functions/wmempcpy.texi: Mention the new module. * modules/mempcpy (Description): Fix typo.
* sys_random: Work around macOS bug.Bruno Haible2020-05-311-0/+8
| | | | | | | | | * m4/sys_random_h.m4 (gl_HEADER_SYS_RANDOM): Include <sys/types.h> and <stdlib.h> before <sys/random.h>. * m4/getrandom.m4 (gl_FUNC_GETRANDOM): Likewise. * lib/sys_random.in.h: On macOS, include <sys/types.h> and <stdlib.h> first. * doc/glibc-headers/sys_random.texi: Mention the macOS problem.
* getrandom: Override incompatible system function on Solaris 11.Bruno Haible2020-05-302-3/+21
| | | | | | | | | | | | | | | | * lib/sys_random.in.h (getrandom): Override if REPLACE_GETRANDOM is 1. * lib/getrandom.c (getrandom): When the system has getrandom, just invoke it. * m4/getrandom.m4 (gl_FUNC_GETRANDOM): Set REPLACE_GETRANDOM if the system's getrandom function's prototype is not the expected one. * m4/sys_random_h.m4 (gl_SYS_RANDOM_H_DEFAULTS): Initialize REPLACE_GETRANDOM. * modules/sys_random (Makefile.am): Substitute REPLACE_GETRANDOM. * modules/getrandom (modules/getrandom): Consider REPLACE_GETRANDOM. * tests/test-getrandom.c (main): Allow error EINVAL as an alternative to EAGAIN. * doc/glibc-functions/getrandom.texi: Mention the new module and the Solaris problem.
* sys_random: New module.Bruno Haible2020-05-301-5/+68
| | | | | | | | | | | | | | | * lib/sys_random.in.h: Use the common idioms for overridable header files. * m4/sys_random_h.m4: New file. * m4/getrandom.m4 (gl_FUNC_GETRANDOM): Require gl_SYS_RANDOM_H_DEFAULTS. * modules/sys_random: New file. * modules/getrandom (Files): Remove lib/sys_random.in.h. (Depends-on): Add sys_random. (configure.ac): Use gl_SYS_RANDOM_MODULE_INDICATOR, not gl_UNISTD_MODULE_INDICATOR. (Makefile.am): Don't generate sys/random.h here. * doc/glibc-headers/sys_random.texi: New file. * doc/gnulib.texi: Include it.
* unistd: Remove conflicting declaration of getrandom().Bruno Haible2020-05-301-18/+0
| | | | | | | | | | * lib/unistd.in.h (getrandom): Remove declaration. * m4/unistd_h.m4 (gl_UNISTD_H): Don't test whether getrandom is declared. (gl_UNISTD_H_DEFAULTS): Don't initialize GNULIB_GETRANDOM, HAVE_GETRANDOM. * modules/unistd (Makefile.am): Don't substitute GNULIB_GETRANDOM, HAVE_GETRANDOM.
* Don't assume that UNICODE is not defined.Bruno Haible2020-05-3039-27/+229
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many Windows API functions are defined differently (redirecting to a function with suffix 'W') if the application defines the macro UNICODE than by default (redirecting to a function with suffix 'A'). * lib/clean-temp.c (OSVERSIONINFO, GetVersionEx): Redirect to the variant with suffix 'A'. * lib/dirent-private.h (WIN32_FIND_DATA): Likewise. * lib/gc-gnulib.c (CryptAcquireContext): Likewise. * lib/getaddrinfo.c (GetModuleHandle): Likewise. * lib/getlogin.c (GetUserName): Likewise. * lib/getlogin_r.c (GetUserName): Likewise. * lib/gettimeofday.c (LoadLibrary): Likewise. * lib/isatty.c (LoadLibrary, QueryFullProcessImageName): Likewise. * lib/link.c (GetModuleHandle, CreateHardLink): Likewise. * lib/localename.c (GetLocaleInfo, EnumSystemLocales): Likewise. * lib/mountlist.c (GetDriveType): Likewise. * lib/nonblocking.c (GetNamedPipeHandleState): Likewise. * lib/opendir.c (WIN32_FIND_DATA, GetFullPathName, FindFirstFile): Likewise. * lib/physmem.c (GetModuleHandle): Likewise. * lib/poll.c (GetModuleHandle, PeekConsoleInput, CreateEvent, PeekMessage, DispatchMessage): Likewise. * lib/progreloc.c (GetModuleFileName): Likewise. * lib/putenv.c (SetEnvironmentVariable): Likewise. * lib/read.c (GetNamedPipeHandleState): Likewise. * lib/readdir.c (FindNextFile): Likewise. * lib/relocatable.c (GetModuleFileName): Likewise. * lib/rename.c (MoveFileEx): Likewise. * lib/rewinddir.c (FindFirstFile): Likewise. * lib/select.c (GetModuleHandle, PeekConsoleInput, CreateEvent, PeekMessage, DispatchMessage): Likewise. * lib/sethostname.c (GetComputerNameEx, SetComputerNameEx): Likewise. * lib/socket.c (WSASocket): Likewise. * lib/stat-w32.c (LoadLibrary, GetFinalPathNameByHandle): Likewise. * lib/stat.c (WIN32_FIND_DATA, CreateFile, FindFirstFile): Likewise. * lib/stdio-read.c (GetNamedPipeHandleState): Likewise. * lib/stdio-write.c (GetNamedPipeHandleState): Likewise. * lib/tmpdir.c (GetTempPath): Likewise. * lib/tmpfile.c (OSVERSIONINFO, GetVersionEx, GetTempPath): Likewise. * lib/uname.c (OSVERSIONINFO, GetVersionEx): Likewise. * lib/utime.c (CreateFile, GetFileAttributes): Likewise. * lib/windows-cond.c (CreateEvent): Likewise. * lib/windows-rwlock.c (CreateEvent): Likewise. * lib/windows-timedmutex.c (CreateEvent): Likewise. * lib/windows-timedrecmutex.c (CreateEvent): Likewise. * lib/windows-timedrwlock.c (CreateEvent): Likewise. * lib/write.c (GetNamedPipeHandleState): Likewise.
* physmem: Fix compilation errors on MSVC.Bruno Haible2020-05-301-1/+1
| | | | | * lib/physmem.c (PFN_MS_EX): Use BOOL, not WINBOOL. * modules/physmem (Depends-on): Add unistd.
* fnmatch: Rely on more gnulib modules.Bruno Haible2020-05-301-57/+23
| | | | | | | | | | * modules/fnmatch (Depends-on): Add btowc, isblank, iswctype, wmemchr, wmempcpy, mempcpy. * lib/fnmatch.c: Assume that HAVE_WCTYPE_H, HAVE_BTOWC, HAVE_ISWCTYPE, HAVE_WMEMCHR, HAVE_WMEMPCPY, HAVE_ISBLANK, HAVE_DECL_ISBLANK, HAVE_MEMPCPY are all 1. * m4/fnmatch.m4 (gl_PREREQ_FNMATCH): Don't test for btowc, isblank, iswctype, mempcpy, wmemchr, wmemcpy, wmempcpy, <wctype.h>.
* Avoid dynamic lookup of Windows API functions when possible.Bruno Haible2020-05-292-4/+44
| | | | | | | | | | * lib/getaddrinfo.c (GetProcAddress, getaddrinfo_func, freeaddrinfo_func, getnameinfo_func, getaddrinfo_ptr, freeaddrinfo_ptr, getnameinfo_ptr): Don't define in a build for Windows XP or higher. (use_win32_p): Define differently. * lib/link.c (GetProcAddress, CreateHardLinkFuncType, CreateHardLinkFunc, initialized, initialize): Don't define in a build for Windows XP or higher.
* read-file: disable buffering if RF_SENSITIVE is setDaiki Ueno2020-05-291-2/+8
| | | | | | | * lib/read-file.c (read_file): Call setvbuf if RF_SENSITIVE. Suggested by Glenn Strauss. (fread_file): Suggest calling setvbuf before calling this function. Suggested by Bruno Haible.
* Fix compilation error on native Windows (regression from 2020-05-28).Bruno Haible2020-05-293-0/+14
| | | | | | | | | | | Reported by Daiki Ueno. * lib/gettimeofday.c (GetSystemTimePreciseAsFileTimeFunc): Define as macro when not using dynamic loading. * lib/isatty.c (GetNamedPipeClientProcessIdFunc, QueryFullProcessImageNameFunc): Likewise. * lib/stat-w32.c (GetFileInformationByHandleExFunc, GetFinalPathNameByHandleFunc): Likewise.
* Avoid dynamic loading of Windows API functions when possible.Bruno Haible2020-05-293-10/+28
| | | | | | | | | | | | | | | | | Reported by Steve Lhomme <robux4@ycbcr.xyz> in <https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00182.html>. * lib/gettimeofday.c (GetProcAddress, GetSystemTimePreciseAsFileTimeFuncType, GetSystemTimePreciseAsFileTimeFunc, initialized, initialize): Don't define in a build for Windows 8 or higher. * lib/isatty.c (GetProcAddress, GetNamedPipeClientProcessIdFuncType, GetNamedPipeClientProcessIdFunc, QueryFullProcessImageNameFuncType, QueryFullProcessImageNameFunc, initialized, initialize): Don't define in a build for Windows Vista or higher. * lib/stat-w32.c (GetProcAddress, GetFileInformationByHandleExFuncType, GetFileInformationByHandleExFunc, GetFinalPathNameByHandleFuncType, GetFinalPathNameByHandleFunc, initialized, initialize): Likewise.
* Fix build errors due to read-file changes (regression from 2020-05-27).Bruno Haible2020-05-281-2/+2
| | | | | | | | | * lib/git-merge-changelog.c (read_changelog_file): Update read_file invocation. * tests/test-sameacls.c (main): Likewise. * tests/test-pipe-filter-gi1.c (main): Call read_file instead of read_binary_file. * tests/test-pipe-filter-ii1.c (main): Likewise.
* fts: Make more robust in multithreaded applications.Bruno Haible2020-05-281-1/+1
| | | | | * lib/fts.c (fts_open): Pass an O_CLOEXEC flag to open(). * modules/fts (Depends-on): Add 'open'.
* relocatable-prog: Make more robust in multithreaded applications.Bruno Haible2020-05-281-4/+9
| | | | | | | * lib/progreloc.c (O_CLOEXEC): Define fallback to 0 when use from module relocatable-prog-wrapper. (find_executable): Pass an O_CLOEXEC flag to open(). * modules/relocatable-prog (Depends-on): Add 'open'.
* getloadavg: Make more robust in multithreaded applications.Bruno Haible2020-05-281-19/+3
| | | | | | * lib/getloadavg.c (getloadavg): Pass an O_CLOEXEC flag to open(). Simplify use of O_CLOEXEC. * modules/getloadavg (Depends-on): Add 'open'.
* vma-iter: Make more robust in multithreaded applications.Bruno Haible2020-05-281-8/+8
| | | | | | * lib/vma-iter.c (rof_open, vma_iterate): Pass an O_CLOEXEC flag to open(). * modules/vma-iter (Depends-on): Add 'open'.
* truncate: Make more robust in multithreaded applications.Bruno Haible2020-05-281-2/+2
| | | | * lib/truncate.c (truncate): Pass an O_CLOEXEC flag to open().
* pagealign_alloc: Make more robust in multithreaded applications.Bruno Haible2020-05-281-1/+1
| | | | | | * lib/pagealign_alloc.c (pagealign_alloc): Pass an O_CLOEXEC flag to open(). * modules/pagealign_alloc (Depends-on): Add 'open'.
* openat: Make more robust in multithreaded applications.Bruno Haible2020-05-281-1/+1
| | | | * lib/openat.c (openat_needs_fchdir): Pass an O_CLOEXEC flag to open().
* at-internal: Make more robust in multithreaded applications.Bruno Haible2020-05-281-2/+3
| | | | | * lib/openat-proc.c (openat_proc_name): Pass an O_CLOEXEC flag to open().
* mountlist: Make more robust in multithreaded applications.Bruno Haible2020-05-281-1/+1
| | | | | | * lib/mountlist.c (read_file_system_list): Pass an O_CLOEXEC flag to open(). * modules/mountlist (Depends-on): Add 'open'.
* login_tty: Make more robust in multithreaded applications.Bruno Haible2020-05-281-1/+1
| | | | | * lib/login_tty.c (login_tty): Pass an O_CLOEXEC flag to open(). * modules/login_tty (Depends-on): Add 'open'.
* javacomp: Make more robust in multithreaded applications.Bruno Haible2020-05-281-1/+1
| | | | | | * lib/javacomp.c (get_classfile_version): Pass an O_CLOEXEC flag to open(). * modules/javacomp (Depends-on): Add 'open'.
* getprogname: Make more robust in multithreaded applications.Bruno Haible2020-05-281-1/+1
| | | | | * lib/getprogname.c (getprogname): Pass an O_CLOEXEC flag to open(). * modules/getprogname (Depends-on): Add 'open'.
* get_progname_of: Make more robust in multithreaded applications.Bruno Haible2020-05-281-4/+4
| | | | | | * lib/get_progname_of.c (get_progname_of): Pass an O_CLOEXEC flag to open(). * modules/get_progname_of (Depends-on): Add 'open'.
* get_ppid_of: Make more robust in multithreaded applications.Bruno Haible2020-05-281-5/+5
| | | | | * lib/get_ppid_of.c (get_ppid_of): Pass an O_CLOEXEC flag to open(). * modules/get_ppid_of (Depends-on): Add 'open'.
* get-rusage-as: Make more robust in multithreaded applications.Bruno Haible2020-05-281-1/+1
| | | | | | * lib/get-rusage-as.c (get_rusage_as_via_setrlimit): Pass an O_CLOEXEC flag to open(). * modules/get-rusage-as (Depends-on): Add 'open'.
* crypto/gc: Make more robust in multithreaded applications.Bruno Haible2020-05-281-1/+1
| | | | | * lib/gc-gnulib.c (randomize): Pass an O_CLOEXEC flag to open(). * modules/crypto/gc (Depends-on): Add 'open'.
* copy-file: Make more robust in multithreaded applications.Bruno Haible2020-05-281-2/+4
| | | | | * lib/copy-file.c (qcopy_file_preserving): Pass an O_CLOEXEC flag to open().
* chown: Make more robust in multithreaded applications.Bruno Haible2020-05-281-1/+1
| | | | * lib/chown.c (rpl_chown): Pass an O_CLOEXEC flag to open().
* fopen-gnu: make 'b' flag can be used with 'e' on WindowsDaiki Ueno2020-05-281-0/+4
| | | | | | | * lib/fopen.c (rpl_fopen): Pass O_BINARY to open, if a 'b' flag is specified on Windows. * tests/test-fopen-gnu.c (DATA): New define. (main): Add test for reading binary files with an 'e' flag.
* Don't assume that UNICODE is not defined.Bruno Haible2020-05-283-4/+4
| | | | | | | | | | | | Some Windows types, such as TCHAR, LPTSTR, LPCTSTR, are defined differently if the application defines the macro UNICODE. Reported by Steve Lhomme <robux4@ycbcr.xyz> in <https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00184.html>. * lib/link.c (CreateHardLinkFuncType): Use LPCSTR, not LPCTSTR. * lib/localename.c (enum_locales_fn): Use LPSTR, not LPTSTR. * lib/stat-w32.c (GetFinalPathNameByHandleFuncType): Likewise.
* Improve pattern for defining _WIN32_WINNT.Bruno Haible2020-05-283-25/+31
| | | | | | | | | | | | | | Newer versions of the Windows API may not only add, but also remove API functions. Therefore, when the user is e.g. building for Windows 10, we should not set _WIN32_WINNT to e.g. Windows 8, as this may enable the use of APIs that were present in Windows 8 but removed in Windows 10. Suggested by Steve Lhomme <robux4@ycbcr.xyz> in <https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00318.html>. * lib/ftruncate.c (_WIN32_WINNT): Don't set to a smaller value. * lib/sethostname.c (_WIN32_WINNT): Likewise. * lib/stat-w32.c (_WIN32_WINNT): Likewise.
* javacomp: Make more robust in multithreaded applications.Bruno Haible2020-05-271-1/+1
| | | | | * lib/javacomp.c (write_temp_file): Pass an 'e' flag to fopen_temp. * modules/javacomp (Depends-on): Add fopen-gnu.
* mountlist: Make more robust in multithreaded applications.Bruno Haible2020-05-271-5/+5
| | | | | | * lib/mountlist.c (setmntent, read_file_system_list): Pass an 'e' flag to fopen. * modules/mountlist (Depends-on): Add fopen-gnu.
* sethostname: Make more robust in multithreaded applications.Bruno Haible2020-05-271-1/+1
| | | | | * lib/sethostname.c (sethostname): Pass an 'e' flag to fopen. * modules/sethostname (Depends-on): Add fopen-gnu.
* readutmp: Make more robust in multithreaded applications.Bruno Haible2020-05-271-1/+1
| | | | | * lib/readutmp.c (read_utmp): Pass an 'e' flag to fopen. * modules/readutmp (Depends-on): Add fopen-gnu.
* getpass: Make more robust in multithreaded applications.Bruno Haible2020-05-271-1/+1
| | | | | * lib/getpass.c (getpass): Pass an 'e' flag to fopen. * modules/getpass (Depends-on): Add fopen-gnu.
* getloadavg: Make more robust in multithreaded applications.Bruno Haible2020-05-271-1/+1
| | | | | * lib/getloadavg.c (getloadavg): Pass an 'e' flag to fopen. * modules/getloadavg (Depends-on): Add fopen-gnu.
* exclude: Make more robust in multithreaded applications.Bruno Haible2020-05-271-1/+1
| | | | | * lib/exclude.c (add_exclude_file): Pass an 'e' flag to fopen. * modules/exclude (Depends-on): Add fopen-gnu.
* bitset: Make more robust in multithreaded applications.Bruno Haible2020-05-271-2/+2
| | | | | | * lib/bitset/stats.c (bitset_stats_read, bitset_stats_write): Pass an 'e' flag to fopen. * modules/bitset (Depends-on): Add fopen-gnu.
* read-file: add RF_SENSITIVE flagDaiki Ueno2020-05-272-7/+53
| | | | | | | | | | * lib/read-file.h (RF_SENSITIVE): New define. * lib/read-file.c (fread_file, read_file): Take into account of RF_SENSITIVE flag. * modules/read-file (Depends-on): Add explicit_bzero. This adds an alternative behavior of those functions to explicitly clear the internal memory block when it becomes unused. This is useful for reading sensitive information from a file.
* read-file: add flags to modify reading behaviorDaiki Ueno2020-05-272-32/+18
| | | | | | | | | | | * lib/read-file.h (RF_BINARY): New define. (fread_file, read_file): Take FLAGS argument. (read_binary_file): Remove. * lib/read-file.c (internal_read_file): Merge into ... (read_file): ... here. * modules/read-file-tests (Files): Add "tests/macros.h". * tests/test-read-file.c (main): Refactor using ASSERT macro. * NEWS: Mention this change.
* count-one-bits: Fix MSVC specific code.Bruno Haible2020-05-261-32/+53
| | | | | | | | | | | Reported by Gisle Vanem <gisle.vanem@gmail.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00309.html>. * lib/count-one-bits.h (COUNT_ONE_BITS_GENERIC): Don't define if we're using GCC. [_MSC_VER]: Use correct syntax for #pragma intrinsic. (__popcnt64): In 32-bit mode, define as an inline function. (COUNT_ONE_BITS): Rename first argument to GCC_BUILTIN.
* argz: Avoid name clashes through argz.h.Bruno Haible2020-05-261-63/+33
| | | | | | | | | Reported by Gisle Vanem <gisle.vanem@gmail.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00308.html>. * lib/argz.h: Don't use __ prefixed identifiers. (const): Remove definition. (argz_next): Remove inline definitions.
* read-file: make use of fopen-gnuDaiki Ueno2020-05-261-2/+2
| | | | | | * lib/read-file.c (read_file): Pass an 'e' flag to fopen. (read_binary_file): Likewise. * modules/read-file (Depends-on): Add fopen-gnu.
* getentropy, getrandom: new modulesPaul Eggert2020-05-254-0/+146
| | | | | | | | | | | | | | | | | * MODULES.html.sh (func_all_modules): * lib/unistd.in.h (getentropy, getrandom): * m4/unistd_h.m4 (gl_UNISTD_H, gl_UNISTD_H_DEFAULTS): * modules/unistd (unistd.h): Add support for getentropy, getrandom. * doc/glibc-functions/getentropy.texi (getentropy): * doc/glibc-functions/getrandom.texi (getrandom): These are now fixed on some platforms. * lib/getentropy.c, lib/getrandom.c, lib/sys_random.in.h: * m4/getentropy.m4, m4/getrandom.m4: * modules/getentropy, modules/getentropy-tests: * modules/getrandom, modules/getrandom-tests: * tests/test-getentropy.c, tests/test-getrandom.c: New files.