libbsd: Branch 'main' - 8 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sat Apr 22 17:59:53 UTC 2023
.gitignore | 1 +
configure.ac | 18 ++++++++++++++++++
include/bsd/unistd.h | 2 ++
src/Makefile.am | 7 ++++++-
src/libbsd.map | 6 ++++--
src/progname.c | 10 ++++++++++
test/headers-overlay.sh | 3 ++-
test/headers-system.sh | 3 ++-
8 files changed, 45 insertions(+), 5 deletions(-)
New commits:
commit d08163b4fe4e74f02b74a1fb69484b00950a149f
Author: Guillem Jover <guillem at hadrons.org>
Date: Tue Apr 18 03:56:16 2023 +0200
build: Check whether we need libperfstat on AIX
The getentropy() implementation makes use of this library on AIX.
diff --git a/configure.ac b/configure.ac
index 93e3b36..db33043 100644
--- a/configure.ac
+++ b/configure.ac
@@ -159,6 +159,15 @@ AS_CASE([$host_os],
])
LIBS="$saved_LIBS"
],
+ [aix*], [
+ saved_LIBS="$LIBS"
+ AC_SEARCH_LIBS([perfstat_cpu_total], [perfstat], [
+ AS_IF([test "x$ac_cv_search_perfstat_cpu_total" != "xnone required"], [
+ LIBBSD_LIBS="$LIBBSD_LIBS $ac_cv_search_perfstat_cpu_total"
+ ])
+ ])
+ LIBS="$saved_LIBS"
+ ],
)
# Checks for header files.
commit 1186cf8822752dfadaf57a78f6b6bb5446f86006
Author: Guillem Jover <guillem at hadrons.org>
Date: Tue Apr 18 03:59:17 2023 +0200
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.
diff --git a/configure.ac b/configure.ac
index c759d4e..93e3b36 100644
--- a/configure.ac
+++ b/configure.ac
@@ -319,6 +319,12 @@ need_fpurge=yes
need_funopen=yes
AS_CASE([$host_os],
[*-musl*], [
+ # On musl >= 0.5.0, strlcpy() and strlcat() were already implemented,
+ # so these can then be dropped on the next SOVERSION bump.
+ #need_strl=no
+ # On musl >= 0.9.7, optreset got implemented, so bsd_getopt() can then
+ # be dropped on the next SOVERSION bump.
+ #need_bsd_getopt=no
# On musl >= 1.1.19, fopencookie() got implemented, and because we were
# checking for its presence to decide whether to build funopen(), it got
# included in builds even when previously it had not been included, which
commit 6385ccc97778f85a61fef503d7661ec6f4e41446
Author: Guillem Jover <guillem at hadrons.org>
Date: Tue Apr 18 03:58:24 2023 +0200
build: Conditionalize bsd_getopt() on macOS
The system library provides a getopt() with BSD semantics.
diff --git a/configure.ac b/configure.ac
index d6446a0..c759d4e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -309,6 +309,7 @@ AC_CHECK_FUNCS([\
])
need_arc4random=yes
+need_bsd_getopt=yes
need_md5=yes
need_nlist=yes
need_strl=yes
@@ -330,6 +331,7 @@ AS_CASE([$host_os],
# On macOS these are provided by the system, and libbsd has never built
# there, so we can avoid providing these with no ABI breakage.
need_arc4random=no
+ need_bsd_getopt=no
need_transparent_libmd=no
need_md5=no
need_nlist=no
@@ -345,6 +347,7 @@ AS_CASE([$host_os],
AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xyes"])
AM_CONDITIONAL([NEED_ARC4RANDOM], [test "x$need_arc4random" = "xyes"])
+AM_CONDITIONAL([NEED_BSD_GETOPT], [test "x$need_bsd_getopt" = "xyes"])
AM_CONDITIONAL([NEED_TRANSPARENT_LIBMD], [test "x$need_transparent_libmd" = "xyes"])
AM_CONDITIONAL([NEED_MD5], [test "x$need_md5" = "xyes"])
AM_CONDITIONAL([NEED_NLIST], [test "x$need_nlist" = "xyes"])
diff --git a/include/bsd/unistd.h b/include/bsd/unistd.h
index 20b0993..f246ac5 100644
--- a/include/bsd/unistd.h
+++ b/include/bsd/unistd.h
@@ -47,6 +47,7 @@
#endif
__BEGIN_DECLS
+#if !defined(__APPLE__)
extern int optreset;
#ifdef LIBBSD_OVERLAY
@@ -55,6 +56,7 @@ extern int optreset;
#endif
int bsd_getopt(int argc, char * const argv[], const char *shortopts);
+#endif
mode_t getmode(const void *set, mode_t mode);
void *setmode(const char *mode_str);
diff --git a/src/Makefile.am b/src/Makefile.am
index c02561e..3e26159 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -75,7 +75,6 @@ EXTRA_libbsd_la_DEPENDENCIES += \
# EOL
endif
libbsd_la_SOURCES = \
- bsd_getopt.c \
closefrom.c \
dehumanize_number.c \
err.c \
@@ -116,6 +115,12 @@ libbsd_la_SOURCES = \
wcslcpy.c \
# EOL
+if NEED_BSD_GETOPT
+libbsd_la_SOURCES += \
+ bsd_getopt.c \
+ # EOL
+endif
+
if NEED_ARC4RANDOM
if !HAVE_GETENTROPY
libbsd_la_SOURCES += \
commit c12068179c252911af95368933605b2cfc5da2d2
Author: Guillem Jover <guillem at hadrons.org>
Date: Tue Apr 18 00:47:12 2023 +0200
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.
diff --git a/src/libbsd.map b/src/libbsd.map
index fb2888f..6c61235 100644
--- a/src/libbsd.map
+++ b/src/libbsd.map
@@ -17,7 +17,8 @@ LIBBSD_0.0 {
heapsort;
humanize_number;
- inet_net_pton; /* XXX: Already provided by glibc, remove. */
+ /* XXX: Already provided by glibc, remove. */
+ inet_net_pton;
getprogname;
setprogname;
@@ -54,7 +55,8 @@ LIBBSD_0.0 {
LIBBSD_0.1 {
strmode;
- __fdnlist; /* Private symbol, but libkvm uses it. */
+ /* Private symbol, but libkvm uses it. */
+ __fdnlist;
nlist;
} LIBBSD_0.0;
commit 9fa06763a1afe0946a3a20e5bbdba72885cbade5
Author: Guillem Jover <guillem at hadrons.org>
Date: Tue Apr 18 00:44:49 2023 +0200
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.
diff --git a/src/progname.c b/src/progname.c
index b62ecd4..56d91ec 100644
--- a/src/progname.c
+++ b/src/progname.c
@@ -62,6 +62,14 @@ getprogname(void)
/* getexecname(3) returns an absolute pathname, normalize it. */
if (__progname == NULL)
setprogname(getexecname());
+#elif defined(_AIX)
+ if (__progname == NULL) {
+ struct procentry64 procs;
+ pid_t pid = getpid ();
+
+ if (getprocs64(&procs, sizeof procs, NULL, 0, &pid, 1) > 0)
+ __progname = strdup(procs.pi_comm);
+ }
#elif defined(_WIN32)
if (__progname == NULL) {
WCHAR *wpath = NULL;
commit 92337b15a2414c5ead6dde55b366687ec464b847
Author: Guillem Jover <guillem at hadrons.org>
Date: Mon Apr 17 23:59:03 2023 +0200
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.
diff --git a/src/progname.c b/src/progname.c
index bebf714..b62ecd4 100644
--- a/src/progname.c
+++ b/src/progname.c
@@ -126,6 +126,8 @@ done:
free(wpath);
free(mbname);
}
+#else
+#error "Function getprogname() needs to be ported."
#endif
return __progname;
commit 90b7f3aeba2805e06181286b442429b136540214
Author: Guillem Jover <guillem at hadrons.org>
Date: Mon Apr 17 23:59:19 2023 +0200
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.
diff --git a/test/headers-overlay.sh b/test/headers-overlay.sh
index be92eff..176623e 100755
--- a/test/headers-overlay.sh
+++ b/test/headers-overlay.sh
@@ -18,8 +18,9 @@ int main() { return 0; }
SOURCE
echo "testing header $inc"
- run $CC -isystem "$incdir" $CPPFLAGS headers-overlay-gen.c -o /dev/null
+ run $CC -isystem "$incdir" $CPPFLAGS headers-overlay-gen.c -o headers-overlay
echo
+ rm -f headers-overlay
rm -f headers-overlay-gen*
done
diff --git a/test/headers-system.sh b/test/headers-system.sh
index 5ff0517..458fbbb 100755
--- a/test/headers-system.sh
+++ b/test/headers-system.sh
@@ -17,8 +17,9 @@ int main() { return 0; }
SOURCE
echo "testing header $inc"
- run $CC -isystem "$incdir" $CPPFLAGS headers-system-gen.c -o /dev/null
+ run $CC -isystem "$incdir" $CPPFLAGS headers-system-gen.c -o headers-system
echo
+ rm -f headers-system
rm -f headers-system-gen.*
done
commit 426bf45278cf3edf228b9aa0e3319e7070fc1b57
Author: Guillem Jover <guillem at hadrons.org>
Date: Tue Apr 18 00:49:09 2023 +0200
build: Add generated *.sym files to .gitignore
diff --git a/.gitignore b/.gitignore
index 4018a03..5c3a5ed 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@ ChangeLog
*.trs
*.gcda
*.gcno
+*.sym
.dirstamp
.deps/
.libs/
More information about the libbsd
mailing list