Commit Graph

709 Commits

Author SHA1 Message Date
Guillem Jover
6777eb62b8 pwcache: Do not declare uidtb and gidtb when not used
When the system provides implementations for user_from_uid() or
group_from_gid() we are not using these variables, so better not declare
them.

Fixes: commit 21d12b0211
2023-09-05 03:02:20 +02:00
Guillem Jover
d4e0cdc916 fgetln: Include <stdio.h> after <sys/*>
The <sys/*> headers tend to define things that might be used by other
headers, so while they should be self-contained, it is better to simply
include them first.
2023-09-05 03:02:20 +02:00
Guillem Jover
f41d6c12aa build: Refactor GNU .init_array support check into a new m4 function 2023-09-05 03:02:12 +02:00
Guillem Jover
30b48ed9ea build: Refactor linker script detection into a new m4 function 2023-07-29 20:11:53 +02:00
Guillem Jover
d0d8d0197f build: Do not provide prototypes for arc4random() on Solaris
These functions are provided by the system.
2023-07-29 20:11:53 +02:00
Guillem Jover
cf61ebb845 build: Do not build the progname module if it is not needed
This was made conditional, but the code part was accidentally left
untouched due to having ported it locally to use __progname, which
caused build failures on the stock repo.

Fixes: commit 046621d7967e7a0f08ae988bcf7e4cd1b6cf204c
2023-07-29 20:11:53 +02:00
Guillem Jover
73b25a8f87 build: Sort entries alphabetically 2023-04-29 03:53:52 +02:00
Guillem Jover
5434ba169b build: Conditionalize wcslcpy() and wcslcat() functions on macOS
These functions are provided by the system libc.
2023-04-29 03:52:49 +02:00
Guillem Jover
dc1bd1a2cb build: Conditionalize only id-from-name functions not the entire pwcache
On macOS the name-from-id functions are present, but not the
id-from-name ones, so we want to provide those instead of suppressing
the entire file.
2023-04-29 03:52:42 +02:00
Guillem Jover
edc746ea7b build: Conditionalize getprogname()/setprogname on macOS
These functions are provided by the system libc, so there is no need for
us to provide them.
2023-04-22 22:47:33 +02:00
Guillem Jover
8f998d1d20 progname: Include <procinfo.h> if available
We need this header on AIX. Missed transplanting the code from the AIX
porting system.

Fixes: commit 9fa06763a1
2023-04-22 22:42:30 +02:00
Guillem Jover
d08163b4fe build: Check whether we need libperfstat on AIX
The getentropy() implementation makes use of this library on AIX.
2023-04-22 19:30:15 +02:00
Guillem Jover
1186cf8822 build: Annotate droppable functions for musl on next SOVERSION bump
These are already provided by the musl libc, and can thus be dropped on
the next SOVERSION bump.
2023-04-22 19:30:15 +02:00
Guillem Jover
6385ccc977 build: Conditionalize bsd_getopt() on macOS
The system library provides a getopt() with BSD semantics.
2023-04-22 19:30:05 +02:00
Guillem Jover
c12068179c Move the version script comments before the symbols
When generating the .sym export file from the .map file, we are not
stripping these comments that are part of the same line as the symbol,
which causes ld(1) implementations to error out. Moving them before
the symbols avoids the need to strip them, as we are only keeping
actual symbol lines.
2023-04-21 05:20:27 +02:00
Guillem Jover
9fa06763a1 Port getprogname() to AIX
Get the program name from the COMM field from the proc filesystem.

We could use instead the information from the psinfo binary file under
/proc, but that seems to have a shorter string limit.
2023-04-21 05:20:27 +02:00
Guillem Jover
92337b15a2 Make getprogname() porting mandatory
Although the function is documented as possibly returning NULL if it
cannot find a known source of information, we should still at least
attempt to port it to any supported system, and otherwise explicitly
mark it as not implementable for such systems if that was to be the
case.
2023-04-21 05:20:27 +02:00
Guillem Jover
90b7f3aeba test: Do not use /dev/null as compiler output file
Some ld(1) implementations, such as the one on AIX, do not support using
/dev/null as the output filename for the compiled object.

Use an actual filename that we will then clean up.
2023-04-18 01:09:05 +02:00
Guillem Jover
426bf45278 build: Add generated *.sym files to .gitignore 2023-04-18 01:09:05 +02:00
Guillem Jover
21d12b0211 build: On macOS do not build functions provided by the system
We have never built before on macOS, so we can exclude all the functions
that are currently provided in the system.

Closes: #1
Closes: !3
2023-04-17 04:12:42 +02:00
Guillem Jover
bc65806ce2 build: Select whether to include funopen() in the build system
This makes sure we include it when expected, alongside the man pages,
and the test cases, and do not accidentally break the ABI if the system
starts providing such interface.
2023-04-17 04:12:42 +02:00
Guillem Jover
8b7a4d9d3b build: Move Windows OS detection to the OS features section
This was placed here to make use of the same AS_CASE, but it does not
really fit with the section. Move it to the more appropriate place, and
detangle the AS_CASE.
2023-04-17 04:12:42 +02:00
Guillem Jover
ccbfd1c241 build: Remove __MUSL__ definition from configure
We stopped relying on this macro when we turned the funopen() cpp error
into a warning in commit e50896286c.
2023-04-17 04:12:42 +02:00
Guillem Jover
e0976d7e90 build: Add a new libbsd_strong_alias() macro and switch users to it
We had several cases of code needing a strong alias, so we switch those
to use the new macro. This covers systems that support the alias
attribute and others such as macOS where we need to use assembler
directives to add the alias as the attribute is not supported.
2023-04-17 04:12:42 +02:00
Guillem Jover
49c7dd1ca4 build: Only emit link warnings for ELF objects 2023-04-17 04:12:42 +02:00
Guillem Jover
8622767a8a build: Use an export symbols file if there is no version script support
We generate the symbol list from the version script to avoid repeating
ourselves and potentially getting the lists out-of-sync.
2023-04-17 04:12:42 +02:00
Guillem Jover
8f61036467 build: Add -no-undefined libtool flag
We have no need for undefined symbols, so we can let the shared
library build even on systems without support for undefined symbols.
2023-04-17 04:12:42 +02:00
Guillem Jover
ae7942ba6d build: Do not override the default DEPENDENCIES for libbsd
Extend it instead via EXTRA_*_DEPENDENCIES, to make sure that we
preserve the builtin library dependencies generated from LIBADD.
2023-04-17 04:12:42 +02:00
Guillem Jover
a5faf17090 Only use <stdio_ext.h> if present 2023-04-17 04:12:42 +02:00
Guillem Jover
06e8a1b29b Define _NSIG if it is not defined by the system
At least on macOS this macro is not defined.
2023-04-17 04:12:42 +02:00
Guillem Jover
44824aca3c Declare environ if the system does not do so
The environ variable is supposed to be defined by the code using it, but
on glibc-based systems it will get defined if we request it, by including
<unistd.h> and defining _GNU_SOURCE.
2023-04-17 04:12:42 +02:00
Guillem Jover
1fb6c3f4ce Use lockf() when flock() is not available
On Solaris flock() is not available, and we should use instead lockf()
or fcntl().
2023-04-17 04:12:42 +02:00
Guillem Jover
fe16f3863e test: Use open_memstream() only if available
On Solaris this function is not yet available.
2023-04-17 04:12:42 +02:00
Guillem Jover
7c652a94ea test: Do not hardcode root:root user and group names
On some systems the root group is named wheel, and there is no root
group.
2023-04-17 04:12:42 +02:00
Guillem Jover
ed2eb31da9 test: Fix closefrom() test on macOS
On macOS we do not close the file descriptors, and instead mark them all
as close-on-exec. So checking whether they are not valid does not work.
2023-04-17 04:12:42 +02:00
Guillem Jover
0f8bcdfd92 test: Fix closefrom() test to handle open file descriptor limits
If the system has configured a lower limit (either soft or hard) on the
number of open file descriptors, the test will fail. Make sure to check
whether we have exceeded that limit and adapt the max number of file
descriptors appropriately.
2023-04-17 04:12:42 +02:00
Guillem Jover
07192b31e3 test: Disable blank_stack_side_effects() on non-Hurd systems
This code was added to cope with Hurd specific behavior, but it is
causing flakiness on containers on some Linux systems. Only enable
it where it is currently needed to try to get stability back on CI
systems.

Closes: #14
2023-04-17 04:12:32 +02:00
Guillem Jover
ca3db5e134 build: Do not enable ASAN for musl CI pipelines
musl-libc does not currently support ASAN, so enabling it makes
configure fail to detect libmd as it cannot link to it anymore.
2023-03-29 09:35:27 +02:00
Guillem Jover
ff46386fcb man: Add HISTORY section to arc4random(3bsd) 2023-03-29 02:49:28 +02:00
Guillem Jover
4c6da577a1 man: Switch arc4random(3bsd) man page from OpenBSD to NetBSD
This gets rid of the last BSD-4-clause licensed file in the project.

The man page will probably need to be adapted to the current
implementation, but that can be done piecemeal afterwards.

Closes: #7
2023-03-29 02:48:53 +02:00
Guillem Jover
830dd88a98 doc: Remove written-by attribution
While attribution is important, it is not relevant when tracking the
copyright holders for the work. And in any case it still stays in the
relevant source file.
2023-03-29 02:48:20 +02:00
Guillem Jover
257800a03c build: Add support for sanitizer compiler flags 2023-03-29 02:48:20 +02:00
Guillem Jover
536a7d42fd test: Exempt blank_stack_side_effects() from sanitizer checks
This will mean we cannot use sanitizer support on the Hurd, for which
this function was added to fix the test. But the sanitizer suppression
function attribute is not having any effect, so this is better than
nothing.
2023-03-29 02:47:18 +02:00
Guillem Jover
7ed5de0158 test: Import explicit_bzero() sanitizer support changes from OpenBSD 2023-03-29 02:38:26 +02:00
Guillem Jover
05a802a2c1 test: Fix memory leaks in fpurge test
Warned-by: gcc -fsanitize=leak
2023-03-21 04:13:32 +01:00
Guillem Jover
5962e03c2d man: Fix BSD and glibc versions
The versions used in the BSD macros are unknown, so they emit warnings,
extend or reduce them to use the two digit form. Correct the glibc
version when closefrom(3) got introduced.
2023-03-03 01:35:31 +01:00
Guillem Jover
59a21c7fb8 man: Update STANDARDS and HISTORY sections
Include BSD versions when functions were introduced. Add mention
whether these are BSD extensions.
2023-02-20 00:29:01 +01:00
Callum Farmer
7b4ebd6521 include: Adjust closefrom() per glibc adoption
Added in glibc 2.34
https://sourceware.org/git/?p=glibc.git;a=commit;h=607449506f197cc9514408908f41f22537a47a8c

Signed-off-by: Guillem Jover <guillem@hadrons.org>
2023-02-17 22:29:26 +01:00
Guillem Jover
0dfbe7699e build: Switch to debian:latest Docker image
This should always point to the latest Debian stable images.
2023-02-17 22:29:26 +01:00
Guillem Jover
dec783dce5 build: Fix version script linker support detection
When the linker uses --no-undefined-version either specified by the user
or as the default behavior (such as with newer clang >= 16 releases),
a missing symbol definition will cause a linker error if that symbol is
listed in the version script.
2023-02-13 00:42:02 +01:00