summaryrefslogtreecommitdiff
path: root/modules
Commit message (Collapse)AuthorAgeFilesLines
* getrandom: do not depend on ‘open’ on mingwPaul Eggert2020-06-283-6/+9
| | | | | | | | | | | | | Similarly for at-internal, getloadavg. These modules do not call the ‘open’ function when they are compiled on mingw. On mingw, this avoids having to compile open.c when building Emacs, which does its own thing with ‘open’. * modules/at-internal, modules/getloadavg, modules/getrandom: (Depends-on): Don’t depend on ‘open’ on mingw. (Depends-on): Require AC_CANONICAL_HOST, for host_os. * modules/getloadavg (Depends-on): Depend on intprops, open, stdbool, stdlib only if compiling getloadavg.c.
* fatal-signal: Make multithread-safe.Bruno Haible2020-06-271-0/+1
| | | | | | | | | * lib/fatal-signal.c: Include glthread/lock.h. (at_fatal_signal_lock): New variable. (at_fatal_signal): Use it. (fatal_signals_block_lock, fatal_signals_block_counter): New variables. (block_fatal_signals, unblock_fatal_signals): Use them. * modules/fatal-signal (Depends-on): Add lock.
* getloadavg: don’t depend on fopen-gnuPaul Eggert2020-06-271-1/+0
| | | | | | | | This is for Emacs, which does not need fopen-gnu for anything else, and which would need it only on a NetBSD platform where getloadavg does not work (does that even happen?). * lib/getloadavg.c (getloadavg) [__NetBSD__]: Use open, not fopen. * modules/getloadavg (Depends-on): Remove fopen-gnu.
* tempname et al.: Fix link errors on MSVC (regression from 2020-05-31).Bruno Haible2020-06-2712-0/+32
| | | | | | | | | | | | | | | | | * modules/tempname (Link): New section. * modules/mkdtemp (Link): Likewise. * modules/clean-temp (Link): Likewise. * modules/mkstemp (Link): Likewise. * modules/stdlib-safer (Link): Likewise. * modules/mkstemps (Link): Likewise. * modules/mkostemp (Link): Likewise. * modules/mkostemps (Link): Likewise. * modules/tmpfile (Link): Likewise. * modules/tmpfile-safer (Link): Likewise. * modules/javacomp (Link): Add $(LIB_GETRANDOM). * modules/argv-iter-tests (Makefile.am): Link test-argv-iter with $(LIB_GETRANDOM). * NEWS: Mention the changes.
* fopen-gnu: Simplify code.Bruno Haible2020-06-271-0/+1
| | | | | | | * lib/fopen.c: Include <stdbool.h>. (rpl_fopen): Use a single variable open_flags instead of open_flags_standard and open_flags_gnu. Make open_flags_gnu a bool. * modules/fopen (Depends-on): Add stdbool.
* filenamecat-lgpl: Set errno upon failure.Bruno Haible2020-06-271-0/+1
| | | | | | * lib/filenamecat-lgpl.c (mfile_name_concat): Document the failure return convention. * modules/filenamecat-lgpl (Depends-on): Add malloc-posix.
* copy-file: Shrink dependencies.Bruno Haible2020-06-261-1/+2
| | | | | * modules/copy-file (Depends-on): Remove acl. Add acl-permissions, qcopy-acl.
* c-dtoastr, c-ldtoastr: new modulesMarc Nieper-Wißkirchen2020-06-254-0/+90
| | | | | | | | | | | | | | | | | These modules provide the same functionality as the modules dtoastr and ldtoastr except for the formatting taking place in the C locale. * MODULES.html.sh: Add c-dtoastr and c-ldtoastr. * lib/c-dtoastr.c, lib/c-ldtoastr.c: New files. * lib/ftoastr.c: Prefix exported functions when the macro C_LOCALE is defined. Use c_snprintf and c_strtod/c_strtold instead of snprintf and strtod/strtold whhen the macro C_LOCALE is defined. * lib/ftoastr.h: Add prototypes for c_dtoastr and c_ldtoastr. * modules/c-dtoastr, modules/c-dtoastr-tests, modules/c-ldtoastr, modules/c-ldtoastr-tests: New files. * tests/test-c-dtoastr.c, tests/test-c-dtoastr.sh, tests-c-ldtoastr.c tests-c-ldtoastr.sh: New files.
* tempname: use getrandom, not getentropyPaul Eggert2020-06-011-1/+1
| | | | | | | This removes a dependency, as getentropy depends on getrandom. * lib/tempname.c: Include sys/random.h instead of unistd.h. (RANDOM_BITS) [!_LIBC]: Use getrandom, not getentropy. * modules/tempname (Depends-on): Depend on getrandom, not getentropy.
* tempname: merge from glibc and coreutilsPaul Eggert2020-05-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Also, merge in Gnulib’s more-recent methods of making it easier to share between Gnulib and glibc, and fix a few randomness glitches. * lib/tempname.c: Include libc-config.h, not config.h, if !_LIBC. (__set_errno): Remove; libc-config.h does that for us. Do not include <sys/time.h>. (__secure_getenv) [_LIBC]: New macro. (__try_tempname, __getpid, __gettimeofday) [!_LIBC]: Remove macros. (RANDOM_BITS): Rewrite. (RANDOM_VALUE_MAX, BASE_62_DIGITS, BASE_62_POWER): New macros. (random_value): New typedef. (try_file, try_dir, try_nocreate): Move up. (gen_tempname_len, try_tempname_len): New functions. (gen_tempname_len): Use a constant array rather than a switch. (try_tempname_len): Don’t assume string length fits in int. Generalize use of RANDOM_BITS. If _LIBC, don’t assume RANDOM_BITS has enough entropy (it’s a bit short). (__gen_tempname): Rewrite in terms of gen_tempname_len. (__try_tempname): Rewrite in terms of try_tempname_len. * lib/tempname.h (gen_tempname_len, try_tempname_len): New decls. * modules/tempname (Depends-on): Remove gettimeofday, sys_time. Add getentropy, libc-config.
* getentropy: Work around a macOS and Solaris problem.Bruno Haible2020-05-311-0/+1
| | | | | | | | | | | | * lib/unistd.in.h: Include <sys/random.h>, when needed for the 'getentropy' module. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize UNISTD_H_HAVE_SYS_RANDOM_H. * m4/sys_random_h.m4 (gl_HEADER_SYS_RANDOM): Set UNISTD_H_HAVE_SYS_RANDOM_H. * modules/unistd (Makefile.am): Substitute UNISTD_H_HAVE_SYS_RANDOM_H. * doc/glibc-functions/getentropy.texi: Document the macOS and Solaris problem. List more platforms.
* fnmatch: merge from glibcPaul Eggert2020-05-311-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, merge in Gnulib’s more-recent methods of making it easier to share between Gnulib and glibc. * lib/fnmatch.c: Reorder includes to match glibc better. Include libc-config.h instead of config.h. Include alloca.h only if _LIBC || HAVE_ALLOCA. Do not include "../locale/elem-hash.h" if _LIBC. Define macros for btowc, etc. if _LIBC. All uses simplified. Define FALLTHROUGH if _LIBC, instead of including attribute.h. Include intprops.h, since glibc has it now. (SIZE_MAX): Remove; use (size_t) -1 instead. Omit the "Comment out all this code" ifdef, since Gnulib has never really needed it. (STREQ): Remove; no longer used. (__libc_use_alloca, alloca, alloca_account): Define as needed if !_LIBC. (ISWCTYPE): Remove; all uses replaced by iswctype. (HANDLE_MULTIBYTE): Remove. All uses removed by assuming true. (internal_function): Remove. All uses removed. (STRUCT): New macro. (WIDE_CHAR_VERSION): Define to 0 instead of leaving undefined. (WMEMCMP): New macro. (FINDIDX): Define if _LIBC, and include <locale/weight.h> and <locale/weightwc.h>. (fnmatch): Prefer __glibc_likely and __glibc_unlikely to __builtin_expect. Check for integer overflow more systematically. Account for alloca storage better when recursive. Use strnlen instead of strlen for efficiency. * lib/fnmatch_loop.c: Include stdint.h if _LIBC, for int32_t etc. (struct STRUCT): New type. (FCT, EXT): New ENDS and ALLOCA_USED args. All callers changed. (FCT): Prefer __glibc_unlikely to __builtin_expect. Simplify by assuming WIDE_CHAR_SUPPORT. Copy _LIBC code from glibc without worrying Gnulib compatibility. Cast cold to UCHAR to avoid signedness warning. (END): Check for invalid pattern. (EXT): Improve alloca/malloc checking (taken from glibc), and improve it some more by using intprops.h and checking for integer overflow and using bool for booleans. * lib/libc-config.h (compat_symbol): New macro. (versioned_symbol): Make it ‘extern int dummy’ so that it’s acceptable to non-GCC when a trailing semicolon is added. * modules/fnmatch (Depends-on): Add alloca-opt, intprops, libc-config, strnlen. Remove alloca.
* getrandom: Add support for native Windows.Bruno Haible2020-05-315-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | * lib/getrandom.c: Include <errno.h>, <windows.h>, <bcrypt.h>, <wincrypt.h>. (CRYPT_VERIFY_CONTEXT): New macro. (LoadLibrary, CryptAcquireContext): Redirect to the variant with suffix 'A'. (GetProcAddress): New macro. (BCryptGenRandomFuncType): New type. (BCryptGenRandomFunc, initialized): New variables. (initialize): New function. (getrandom): On native Windows, use <bcrypt.h> API when available, and <wincrypt.h> API as fallback. * m4/getrandom.m4 (gl_FUNC_GETRANDOM): Set LIB_GETRANDOM. * modules/getrandom (Link): New section. * modules/getentropy (Link): Likewise. * modules/getrandom-tests (Makefile.am): Link test-getrandom against $(LIB_GETRANDOM). * modules/getentropy-tests (Makefile.am): Link test-getentropy against $(LIB_GETRANDOM). * modules/sys_random-c++-tests (Makefile.am): Link test-sys_random-c++ against $(LIB_GETRANDOM). * doc/glibc-functions/getrandom.texi: Mention the native Windows support.
* getrandom: Simplify the determination of the random number devices.Bruno Haible2020-05-311-1/+0
| | | | | | | | | Suggested by Paul Eggert in <https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00383.html>. * lib/getrandom.c (NAME_OF_RANDOM_DEVICE, NAME_OF_NONCE_DEVICE): New macros. * modules/getrandom (Depends-on): Remove crypto/gc-random.
* wmemchr: Relicense under LGPLv2+.Bruno Haible2020-05-311-1/+1
| | | | * modules/wmemchr (License): Set to LGPLv2+.
* wmempcpy: New module.Bruno Haible2020-05-313-1/+30
| | | | | | | | | | | | | | | | | 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.
* getrandom: Override incompatible system function on Solaris 11.Bruno Haible2020-05-302-4/+5
| | | | | | | | | | | | | | | | * 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: Add C++ tests.Bruno Haible2020-05-302-0/+19
| | | | | | * tests/test-sys_random-c++.cc: New file. * modules/sys_random-c++-tests: New file. * modules/sys_random-tests (Depends-on): Depend on it.
* sys_random: Add tests.Bruno Haible2020-05-301-0/+10
| | | | | * tests/test-sys_random.c: New file. * modules/sys_random-tests: New file.
* sys_random: New module.Bruno Haible2020-05-302-15/+53
| | | | | | | | | | | | | | | * 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-2/+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.
* getrandom: Add tests.Bruno Haible2020-05-301-0/+12
| | | | | * tests/test-getrandom.c: New file. * modules/getrandom-tests: New file.
* crypto/gc-random: Fix typo in last commit.Bruno Haible2020-05-302-2/+2
|
* crypto/gc-random: Fix link error on MSVC.Bruno Haible2020-05-302-1/+4
| | | | | | | * m4/gc-random.m4 (gl_GC_RANDOM): Set LIB_GC_RAMDOM. * modules/crypto/gc-random (Link): New section. * modules/crypto/gc-tests (Makefile.am): Link test-gc against $(LIB_GC_RAMDOM).
* physmem: Fix compilation errors on MSVC.Bruno Haible2020-05-301-0/+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-0/+6
| | | | | | | | | | * 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>.
* fts: Make more robust in multithreaded applications.Bruno Haible2020-05-281-0/+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-0/+1
| | | | | | | * 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-0/+1
| | | | | | * 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-0/+1
| | | | | | * lib/vma-iter.c (rof_open, vma_iterate): Pass an O_CLOEXEC flag to open(). * modules/vma-iter (Depends-on): Add 'open'.
* pagealign_alloc: Make more robust in multithreaded applications.Bruno Haible2020-05-281-0/+1
| | | | | | * lib/pagealign_alloc.c (pagealign_alloc): Pass an O_CLOEXEC flag to open(). * modules/pagealign_alloc (Depends-on): Add 'open'.
* mountlist: Make more robust in multithreaded applications.Bruno Haible2020-05-281-0/+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-0/+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-0/+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-0/+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-0/+1
| | | | | | * 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-0/+1
| | | | | * 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-0/+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-0/+1
| | | | | * lib/gc-gnulib.c (randomize): Pass an O_CLOEXEC flag to open(). * modules/crypto/gc (Depends-on): Add 'open'.
* javacomp: Make more robust in multithreaded applications.Bruno Haible2020-05-271-0/+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-0/+1
| | | | | | * 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-0/+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-0/+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-0/+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-0/+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-0/+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-0/+1
| | | | | | * 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-271-0/+1
| | | | | | | | | | * 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-271-0/+1
| | | | | | | | | | | * 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.
* read-file: make use of fopen-gnuDaiki Ueno2020-05-261-0/+1
| | | | | | * lib/read-file.c (read_file): Pass an 'e' flag to fopen. (read_binary_file): Likewise. * modules/read-file (Depends-on): Add fopen-gnu.