Commit Graph

696 Commits

Author SHA1 Message Date
Guillem Jover
08188f3c13 build: Install err.h if either of the err or errc modules are built
Both modules expose their functions in err.h, so we need to install it
whenever any of them is being built.

Reported-by: Alejandro Colomar <alx@kernel.org>
2024-02-28 04:37:44 +01:00
Guillem Jover
644062da40 Release libbsd 0.12.0 2024-02-27 05:52:53 +01:00
Guillem Jover
32d18dcf47 Add explicit time32 and time64 support
Handle the three potential system scenarios:

 - system time_t is time64
 - system time_t is time32 and supports time64
 - system time_t is time32 and does not support time64

Add the explicit time32 and time64 functions when necessary and map
them accordingly for each of these cases.
2024-02-27 05:47:50 +01:00
Guillem Jover
605614d642 build: Add support for AIX 2024-02-25 04:19:24 +01:00
Guillem Jover
ec7f5ee984 Add vasprintf() and asprintf() functions missing on AIX
These functions are used by code in the library, even though these
functions started as GNU extensions, they are present in all BSDs,
so we expose them as part of our interface on AIX.
2024-02-25 04:18:51 +01:00
Guillem Jover
5392f0c1a4 build: Add support for Solaris 2024-02-25 04:18:01 +01:00
Guillem Jover
be4aced4c5 build: Make almost all exposed interfaces use the new ABI selection
Explicitly select what to include as part of the target ABI, instead of
letting autoconfiguration potentially break ABI if the system grows
functionality provided by the library.

Make almost all the library selectable per target. Do not install manual
pages for interfaces not included in the library. Control inclusion of
symbols in map file via pre-processor macros, and move the comments
describing the ABI selection to configure.ac.

For now the header files are included as is and filtered through
pre-processor conditionals. Eventually they might get switched to be
autogenerated at build time.
2024-02-25 03:50:40 +01:00
Guillem Jover
27503a1066 build: Rework ABI selection logic
Add a new LIBBSD_SELECT_ABI m4 macro, and use it to setup the ABI
interfaces to expose and the various variables and conditionals
to be used by the build system.

Switch to set the initial values to unknown and then set every one
of the selections explicitly by supported target.

Update comments for rationale for things to DROP, or for why some
selections are enabled.
2024-02-25 03:49:15 +01:00
Guillem Jover
99739877be build: Rename ABI selection variables from need_ to abi_
This should make the purpose of these variables more clear.
2024-02-25 03:47:54 +01:00
Guillem Jover
0bdbc0787e build: Revert accidental testing aid change
This was accidentally included in the commit, but should have only been
used during development.

Fixes: commit de124dcafa
Changelog: silent
2024-02-21 02:29:15 +01:00
Guillem Jover
de124dcafa build: Make digest function checks conditional on their use
The digest function checks where unconditionally requiring the functions
to exist or they would error out. But these functions are not required
on all systems, they depend on the ABI to be exposed.
2024-02-21 02:25:24 +01:00
Guillem Jover
1d28729514 build: Move ABI selection at the top of configure.ac
Merge the existing host_os block for the OS detection with the ABI
selection one, as these are related. This way we will be able to make
some of the latter checks conditional on the selected ABI.
2024-02-21 02:25:21 +01:00
Guillem Jover
a81d0b7113 build: Sort variables and their contents in automake files
This should make it easier to add new entries, and find them afterwards.
2024-02-21 02:09:48 +01:00
Guillem Jover
c8e5338a7c build: Rename LIBBSD_ABI to SOVERSION
This matches the semantics of the variable, and makes it independent of
the project, just as the package variables.
2024-02-21 02:09:48 +01:00
Guillem Jover
b6d6da4cd4 build: Refactor function checks into a new libbsd-funcs.m4 file
These are complex enough to clutter the main configure.ac. Move them
into their own file.
2024-02-21 02:09:48 +01:00
Guillem Jover
f8cb9d8b28 build: Remove space before shell redirection
This makes it more clear what the redirection applies to.
2024-02-21 02:09:17 +01:00
Guillem Jover
154624ab45 build: Add support for silent rules for the libbsd.map generation
The new rule was introduced w/o silent rule support.

Fixes: commit 19e06407eb
2024-02-21 02:07:38 +01:00
Guillem Jover
9fab225f26 Split errc family of functions from err ones
On most systems the err family of functions is already present, but are
missing the errc family of functions, which are also present on some
other systems. Splitting them into separate files will make it easer to
conditionally include one or the other.
2024-02-18 14:02:32 +01:00
Guillem Jover
461f10ac57 Sync strtoi()/strtou() implementations from NetBSD
These contain the fixes to the error handling logic.

In NetBSD the manual page for strtou.3 is generated from the strtoi.3
manual page applying some substitutions, the problem is that the
cross-references are then lost. We will still keep them separate.

Reported-by: Alejandro Colomar <alx@kernel.org>
2024-02-18 13:57:04 +01:00
Guillem Jover
f050160976 build: Swap symbol and alias arguments order in macros creating aliases
The current order is rather confusing, pass the real symbol first
and the alias we want to create next.
2024-02-18 13:57:03 +01:00
Guillem Jover
19e06407eb build: Generate the map file from the configured ABI
Some linkers require the map file definitions to contain only symbols
that are present on the linked object, either in the map file or in the
sym file we generate from the map file.

This is preparatory work to be able to conditionally include symbols
in the man and sym files depending on the ABI definitions.
2024-02-18 13:54:13 +01:00
Guillem Jover
10920c3084 build: Make name_from_id man pages conditional instead of id_from_name
The code is only making the name_from_id function conditional, and
assumes id_from_name are always to be included, so we need to match
the logic for the man page inclusion.
2024-02-17 05:00:58 +01:00
Guillem Jover
97b0fe84b8 man: Mention that funopen() can be made available on musl
As musl got fopencookie() implemented in 1.1.19, the funopen() function
can also be provided there. Note this in the documentation.
2024-01-09 00:00:06 +01:00
Guillem Jover
e87ae3be19 man: Fix manual page references
When referring to another manual page and their section number, we need
to use Xr instead of Fn, otherwise the section number is interpreted as
a function argument. For functions provided by libbsd itself we should
be using the 3bsd section instead of 3.
2024-01-08 23:47:26 +01:00
Guillem Jover
9275d134e5 man: Add closefrom(), strlcpy() and strlcat() as superseded functions
These were missing from the list of functions provided by some libc
implementation.
2024-01-08 23:39:19 +01:00
Guillem Jover
304a1f831c doc: Use macOS to refer to the operating system
This is the correct spelling, instead of capitalizing it.
2024-01-08 23:37:43 +01:00
Guillem Jover
edddd806df Release libbsd 0.11.8 2024-01-08 02:16:12 +01:00
Guillem Jover
dd0bdb58e0 test: Close all descriptors before initializing them for closefrom()
On macOS, closefrom() only sets the close-on-exec flag, so we cannot
check whether all file descriptors were closed, which means that if
on entry our file descriptor table was filled after the 4th file
descriptor, then we might fail the assertions for the flags for odd
file descriptors which we expect to be closed.

This can easily happen when running the test suite in parallel mode
with «make -j8 check» for example.

Closes: #23
2024-01-08 01:58:54 +01:00
Guillem Jover
0813f3786f build: Check out-of-tree builds in CI
Make sure the out-of-tree builds do not regress.
2024-01-07 20:21:08 +01:00
Guillem Jover
df116b5597 Adjust strlcpy() and strlcat() per glibc adoption
These functions were added in glibc 2.38, in anticipation of POSIX
adopting them too.

Closes: #26
2024-01-07 17:55:40 +01:00
Guillem Jover
ecb44e1655 Do not add a pointer to the NULL constant
Warned-by: cppcheck (nullPointerArithmetic)
2024-01-07 16:45:46 +01:00
Guillem Jover
459b7f7d24 Do not confuse code analyzers with out-of-bounds array access look alike
The code is only getting the address, but we might be performing an
addressing that is out-of-bounds. Avoid it and use the address form
instead.

Warned-by: cppcheck (objectIndex)
2024-01-07 16:45:42 +01:00
Guillem Jover
a44f885cd4 test: Fix short-lived memory leak
Warned-by: cppcheck
2024-01-07 16:45:39 +01:00
Guillem Jover
3f5ca0aae4 build: Add a coverage regex to the CI job
This is needed so that gitlab can know where to extract the coverage
percentage from in the output, to be able to track and report it.
2023-10-28 00:47:26 +02:00
Guillem Jover
9d3e59a01d man: Use VARIANTS instead of ALTERNATIVES in libbsd(7)
Using alternatives seems confusing in this context.
2023-10-10 01:53:32 +02:00
Guillem Jover
f02562d64a man: Markup function references with Xr instead of Fn
These references had man page sections in them, so using Fn meant that
these appeared as function arguments.
2023-10-10 01:52:37 +02:00
Guillem Jover
b7367c9ced build: Add missing dash to macro title bar 2023-09-05 03:02:44 +02:00
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