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.
This commit is contained in:
Guillem Jover 2024-02-11 23:55:40 +01:00
parent 27503a1066
commit be4aced4c5
6 changed files with 732 additions and 121 deletions

View File

@ -41,85 +41,212 @@ LIBBSD_LINKER_VERSION_SCRIPT
is_windows=no is_windows=no
abi_accmode=unknown
abi_arc4random=unknown abi_arc4random=unknown
abi_arc4random_stir=unknown
abi_bsd_getopt=unknown abi_bsd_getopt=unknown
abi_closefrom=unknown
abi_err=unknown abi_err=unknown
abi_errc=unknown abi_errc=unknown
abi_expand_number=unknown
abi_explicit_bzero=unknown
abi_fgetln=unknown
abi_flopen=unknown
abi_fmtcheck=unknown
abi_fpurge=unknown abi_fpurge=unknown
abi_freezero=unknown
abi_funopen=unknown abi_funopen=unknown
abi_getbsize=unknown
abi_getpeereid=unknown
abi_humanize_number=unknown
abi_id_from_name=unknown
abi_inet_net_pton=unknown
abi_md5=unknown abi_md5=unknown
abi_name_from_id=unknown abi_name_from_id=unknown
abi_nlist=unknown abi_nlist=unknown
abi_pidfile=unknown
abi_proctitle=unknown
abi_progname=unknown abi_progname=unknown
abi_readpassphrase=unknown
abi_reallocarray=unknown
abi_reallocf=unknown
abi_recallocarray=unknown
abi_stringlist=unknown
abi_sort=unknown
abi_strl=unknown abi_strl=unknown
abi_strmode=unknown abi_strmode=unknown
abi_strnstr=unknown
abi_strtonum=unknown
abi_strtox=unknown
abi_timeconv=unknown
abi_vis=unknown
abi_wcsl=unknown abi_wcsl=unknown
AS_CASE([$host_os], AS_CASE([$host_os],
[*-gnu*], [ [*-gnu*], [
# DROP: On glibc >= 2.36, parts the arc4random() API got added. abi_accmode=yes
# DROP: On glibc >= 2.36.
#abi_arc4random=no #abi_arc4random=no
abi_arc4random=yes abi_arc4random=yes
abi_arc4random_stir=yes
abi_bsd_getopt=yes abi_bsd_getopt=yes
# DROP: On glibc >= 2.34.
#abi_closefrom=no
abi_closefrom=yes
abi_err=no abi_err=no
abi_errc=yes abi_errc=yes
abi_expand_number=yes
# DROP: On glibc >= 2.25.
#abi_explicit_bzero=no
abi_explicit_bzero=yes
abi_fgetln=yes
abi_flopen=yes
abi_fmtcheck=yes
abi_fpurge=yes abi_fpurge=yes
abi_freezero=yes
abi_funopen=yes abi_funopen=yes
abi_getbsize=yes
abi_getpeereid=yes
abi_humanize_number=yes
abi_id_from_name=yes
# DROP: On glibc.
#abi_inet_net_pton=no
abi_inet_net_pton=yes
# DROP: On libmd. # DROP: On libmd.
#abi_md5=no #abi_md5=no
abi_md5=yes abi_md5=yes
abi_name_from_id=yes abi_name_from_id=yes
abi_nlist=yes abi_nlist=yes
abi_pidfile=yes
abi_proctitle=yes
abi_progname=yes abi_progname=yes
abi_readpassphrase=yes
# DROP: On glibc >= 2.26.
#abi_reallocarray=no
abi_reallocarray=yes
abi_reallocf=yes
abi_recallocarray=yes
abi_stringlist=yes
abi_sort=yes
# DROP: On glibc >= 2.38. # DROP: On glibc >= 2.38.
#abi_strl=no #abi_strl=no
abi_strl=yes abi_strl=yes
abi_strmode=yes abi_strmode=yes
abi_strnstr=yes
abi_strtonum=yes
abi_strtox=yes
abi_timeconv=yes
# DROP: On libmd.
abi_transparent_libmd=yes
abi_vis=yes
abi_wcsl=yes abi_wcsl=yes
], ],
[*-musl*], [ [*-musl*], [
abi_accmode=yes
abi_arc4random=yes abi_arc4random=yes
abi_arc4random_stir=yes
# DROP: On musl >= 0.9.7, optreset got implemented. # DROP: On musl >= 0.9.7, optreset got implemented.
#abi_bsd_getopt=no #abi_bsd_getopt=no
abi_bsd_getopt=yes abi_bsd_getopt=yes
abi_closefrom=yes
abi_err=no abi_err=no
abi_errc=yes abi_errc=yes
abi_expand_number=yes
# DROP: On musl >= 1.1.20.
#abi_explicit_bzero=no
abi_explicit_bzero=yes
# DROP: On musl >= 0.9.4.
#abi_fgetln=no
abi_fgetln=yes
abi_flopen=yes
abi_fmtcheck=yes
abi_fpurge=yes abi_fpurge=yes
abi_freezero=yes
# On musl >= 1.1.19, fopencookie() got implemented, and because we were # On musl >= 1.1.19, fopencookie() got implemented, and because we were
# checking for its presence to decide whether to build funopen(), it got # checking for its presence to decide whether to build funopen(), it got
# included in builds even when previously it had not been included, which # included in builds even when previously it had not been included, which
# is partially an ABI issue, but given that disabling it now would be # is partially an ABI issue, but given that disabling it now would be
# worse, we'll ignore this as this is only a problem with downgrades. And # worse, we'll ignore this as this is only a problem with downgrades. And
# enable it explicitly # enable it explicitly
#abi_funopen=no
abi_funopen=yes abi_funopen=yes
abi_getbsize=yes
abi_getpeereid=yes
abi_humanize_number=yes
abi_id_from_name=yes
abi_inet_net_pton=yes
# DROP: On libmd. # DROP: On libmd.
#abi_md5=no #abi_md5=no
abi_md5=yes abi_md5=yes
abi_name_from_id=yes abi_name_from_id=yes
abi_nlist=yes abi_nlist=yes
abi_pidfile=yes
abi_proctitle=yes
abi_progname=yes abi_progname=yes
abi_readpassphrase=yes
# DROP: On musl >= 1.2.2.
#abi_reallocarray=no
abi_reallocarray=yes
abi_reallocf=ues
abi_recallocarray=yes
abi_stringlist=yes
abi_sort=yes
# DROP: On musl >= 0.5.0, strlcpy() and strlcat() were already implemented. # DROP: On musl >= 0.5.0, strlcpy() and strlcat() were already implemented.
#abi_strl=no #abi_strl=no
abi_strl=yes abi_strl=yes
abi_strmode=yes abi_strmode=yes
abi_strnstr=yes
abi_strtonum=yes
abi_strtox=yes
abi_timeconv=yes
# DROP: On libmd.
abi_transparent_libmd=yes
abi_vis=yes
abi_wcsl=yes abi_wcsl=yes
], ],
[darwin*], [ [darwin*], [
# On macOS these are provided by the system, and libbsd has never built abi_accmode=no
# there, so we can avoid providing these with no ABI breakage.
abi_arc4random=no abi_arc4random=no
abi_arc4random_stir=no
abi_bsd_getopt=no abi_bsd_getopt=no
abi_closefrom=yes
abi_err=no abi_err=no
abi_errc=no abi_errc=no
abi_expand_number=yes
abi_explicit_bzero=yes
abi_fgetln=no
abi_flopen=yes
abi_fmtcheck=no
abi_fpurge=no abi_fpurge=no
abi_freezero=yes
abi_funopen=no abi_funopen=no
abi_getbsize=yes
abi_getpeereid=no
abi_humanize_number=yes
abi_id_from_name=yes
abi_inet_net_pton=no
# On libmd.
abi_md5=no abi_md5=no
abi_name_from_id=no abi_name_from_id=no
abi_nlist=no abi_nlist=no
abi_pidfile=yes
abi_proctitle=yes
abi_progname=no abi_progname=no
abi_readpassphrase=no
abi_reallocarray=yes
abi_reallocf=no
abi_recallocarray=yes
abi_stringlist=no
abi_sort=no
abi_strl=no abi_strl=no
abi_strmode=no abi_strmode=no
abi_strnstr=no
abi_strtonum=no
abi_strtox=yes
abi_timeconv=no
# On libmd.
abi_transparent_libmd=no abi_transparent_libmd=no
abi_vis=no
abi_wcsl=no abi_wcsl=no
], ],
[mingw*], [ [mingw*], [
@ -127,6 +254,13 @@ AS_CASE([$host_os],
], ],
) )
# Handle artificial ABI selections that are combinations of others.
AS_IF([test "$abi_name_from_id" = "yes" || test "$abi_id_from_name" = "yes"], [
abi_pwcache=yes
], [
abi_pwcache=no
])
AM_CONDITIONAL([OS_WINDOWS], [test "x$is_windows" = "xyes"]) AM_CONDITIONAL([OS_WINDOWS], [test "x$is_windows" = "xyes"])
# Checks for programs. # Checks for programs.
@ -308,19 +442,47 @@ AC_CHECK_FUNCS([\
AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xyes"]) AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xyes"])
# ABI selection # ABI selection
LIBBSD_SELECT_ABI([accmode], [setmode()/getmode()])
LIBBSD_SELECT_ABI([arc4random], [arc4random() API]) LIBBSD_SELECT_ABI([arc4random], [arc4random() API])
LIBBSD_SELECT_ABI([arc4random_stir], [arc4random_stir()/arc4random_addrandom()])
LIBBSD_SELECT_ABI([bsd_getopt], [BSD getopt()]) LIBBSD_SELECT_ABI([bsd_getopt], [BSD getopt()])
LIBBSD_SELECT_ABI([closefrom], [closefrom()])
LIBBSD_SELECT_ABI([err], [err API]) LIBBSD_SELECT_ABI([err], [err API])
LIBBSD_SELECT_ABI([errc], [errc API]) LIBBSD_SELECT_ABI([errc], [errc API])
LIBBSD_SELECT_ABI([expand_number], [expand_number()])
LIBBSD_SELECT_ABI([explicit_bzero], [explicit_bzero()])
LIBBSD_SELECT_ABI([fgetln], [fgetln/fgetwln()])
LIBBSD_SELECT_ABI([flopen], [flopen()/flopenat()])
LIBBSD_SELECT_ABI([fmtcheck], [fmtcheck()])
LIBBSD_SELECT_ABI([fpurge], [fpurge()]) LIBBSD_SELECT_ABI([fpurge], [fpurge()])
LIBBSD_SELECT_ABI([freezero], [freezero()])
LIBBSD_SELECT_ABI([funopen], [funopen()]) LIBBSD_SELECT_ABI([funopen], [funopen()])
LIBBSD_SELECT_ABI([getbsize], [getbsize()])
LIBBSD_SELECT_ABI([getpeereid], [getpeereid()])
LIBBSD_SELECT_ABI([humanize_number], [humanize_number()/dehumanize_number()])
LIBBSD_SELECT_ABI([id_from_name], [uid_from_user()/gid_from_user()])
LIBBSD_SELECT_ABI([inet_net_pton], [inet_net_pton()])
LIBBSD_SELECT_ABI([md5], [MD5 digest functions]) LIBBSD_SELECT_ABI([md5], [MD5 digest functions])
LIBBSD_SELECT_ABI([name_from_id], [user_from_uid()/group_from_gid()]) LIBBSD_SELECT_ABI([name_from_id], [user_from_uid()/group_from_gid()])
LIBBSD_SELECT_ABI([nlist], [nlist()]) LIBBSD_SELECT_ABI([nlist], [nlist()])
LIBBSD_SELECT_ABI([pidfile], [pidfile API])
LIBBSD_SELECT_ABI([proctitle], [setproctitle() API])
LIBBSD_SELECT_ABI([progname], [setprogname()/getprogname()]) LIBBSD_SELECT_ABI([progname], [setprogname()/getprogname()])
LIBBSD_SELECT_ABI([pwcache], [password cache API])
LIBBSD_SELECT_ABI([readpassphrase], [readpassphrase()])
LIBBSD_SELECT_ABI([reallocarray], [reallocarray()])
LIBBSD_SELECT_ABI([reallocf], [reallocf()])
LIBBSD_SELECT_ABI([recallocarray], [recallocarray()])
LIBBSD_SELECT_ABI([stringlist], [stringlist sl_*() API])
LIBBSD_SELECT_ABI([sort], [BSD sort functions])
LIBBSD_SELECT_ABI([strl], [strlcpy()/strlcat()]) LIBBSD_SELECT_ABI([strl], [strlcpy()/strlcat()])
LIBBSD_SELECT_ABI([strmode], [strmode()]) LIBBSD_SELECT_ABI([strmode], [strmode()])
LIBBSD_SELECT_ABI([strnstr], [strnstr()])
LIBBSD_SELECT_ABI([strtonum], [strtonum()])
LIBBSD_SELECT_ABI([strtox], [strtoi()/strtou()])
LIBBSD_SELECT_ABI([timeconv], [timeconf.h API])
LIBBSD_SELECT_ABI([transparent_libmd], [transparent libmd support]) LIBBSD_SELECT_ABI([transparent_libmd], [transparent libmd support])
LIBBSD_SELECT_ABI([vis], [vis API])
LIBBSD_SELECT_ABI([wcsl], [wcslcpy()/wcslcat()]) LIBBSD_SELECT_ABI([wcsl], [wcslcpy()/wcslcat()])
AS_IF([test "x$abi_funopen" = "xno" && \ AS_IF([test "x$abi_funopen" = "xno" && \

View File

@ -12,23 +12,27 @@ nobase_include_HEADERS = \
bsd/netinet/ip_icmp.h \ bsd/netinet/ip_icmp.h \
bsd/bitstring.h \ bsd/bitstring.h \
bsd/bsd.h \ bsd/bsd.h \
bsd/err.h \
bsd/getopt.h \
bsd/grp.h \
bsd/inttypes.h \ bsd/inttypes.h \
bsd/libutil.h \ bsd/libutil.h \
bsd/pwd.h \
bsd/readpassphrase.h \
bsd/stdio.h \ bsd/stdio.h \
bsd/stdlib.h \ bsd/stdlib.h \
bsd/string.h \ bsd/string.h \
bsd/stringlist.h \
bsd/timeconv.h \
bsd/unistd.h \ bsd/unistd.h \
bsd/vis.h \
bsd/wchar.h \ bsd/wchar.h \
# EOL # EOL
if ABI_ERR
nobase_include_HEADERS += \
bsd/err.h \
# EOL
endif
if ABI_BSD_GETOPT
nobase_include_HEADERS += \
bsd/getopt.h \
# EOL
endif
if ABI_MD5 if ABI_MD5
nobase_include_HEADERS += \ nobase_include_HEADERS += \
bsd/md5.h \ bsd/md5.h \
@ -40,3 +44,34 @@ nobase_include_HEADERS += \
bsd/nlist.h \ bsd/nlist.h \
# EOL # EOL
endif endif
if ABI_READPASSPHRASE
nobase_include_HEADERS += \
bsd/readpassphrase.h \
# EOL
endif
if ABI_PWCACHE
nobase_include_HEADERS += \
bsd/grp.h \
bsd/pwd.h \
# EOL
endif
if ABI_STRINGLIST
nobase_include_HEADERS += \
bsd/stringlist.h \
# EOL
endif
if ABI_TIMECONV
nobase_include_HEADERS += \
bsd/timeconv.h \
# EOL
endif
if ABI_VIS
nobase_include_HEADERS += \
bsd/vis.h \
# EOL
endif

View File

@ -143,11 +143,6 @@ dist_man_MANS = \
TAILQ_SWAP.3bsd \ TAILQ_SWAP.3bsd \
TIMESPEC_TO_TIMEVAL.3bsd \ TIMESPEC_TO_TIMEVAL.3bsd \
TIMEVAL_TO_TIMESPEC.3bsd \ TIMEVAL_TO_TIMESPEC.3bsd \
arc4random.3bsd \
arc4random_addrandom.3bsd \
arc4random_buf.3bsd \
arc4random_stir.3bsd \
arc4random_uniform.3bsd \
be16dec.3bsd \ be16dec.3bsd \
be16enc.3bsd \ be16enc.3bsd \
be32dec.3bsd \ be32dec.3bsd \
@ -166,21 +161,6 @@ dist_man_MANS = \
bitstr_size.3bsd \ bitstr_size.3bsd \
bitstring.3bsd \ bitstring.3bsd \
byteorder.3bsd \ byteorder.3bsd \
closefrom.3bsd \
dehumanize_number.3bsd \
expand_number.3bsd \
explicit_bzero.3bsd \
fgetln.3bsd \
fgetwln.3bsd \
flopen.3bsd \
fmtcheck.3bsd \
fparseln.3bsd \
freezero.3bsd \
getbsize.3bsd \
getmode.3bsd \
getpeereid.3bsd \
heapsort.3bsd \
humanize_number.3bsd \
le16dec.3bsd \ le16dec.3bsd \
le16enc.3bsd \ le16enc.3bsd \
le32dec.3bsd \ le32dec.3bsd \
@ -188,38 +168,7 @@ dist_man_MANS = \
le64dec.3bsd \ le64dec.3bsd \
le64enc.3bsd \ le64enc.3bsd \
libbsd.7 \ libbsd.7 \
mergesort.3bsd \
pidfile.3bsd \
pidfile_close.3bsd \
pidfile_open.3bsd \
pidfile_remove.3bsd \
pidfile_write.3bsd \
pwcache.3bsd \
queue.3bsd \ queue.3bsd \
radixsort.3bsd \
readpassphrase.3bsd \
reallocarray.3bsd \
reallocf.3bsd \
recallocarray.3bsd \
setmode.3bsd \
setproctitle.3bsd \
setproctitle_init.3bsd \
sl_add.3bsd \
sl_delete.3bsd \
sl_find.3bsd \
sl_free.3bsd \
sl_init.3bsd \
sradixsort.3bsd \
stringlist.3bsd \
strnstr.3bsd \
strnunvis.3bsd \
strnvis.3bsd \
strtoi.3bsd \
strtonum.3bsd \
strtou.3bsd \
strunvis.3bsd \
strvis.3bsd \
strvisx.3bsd \
timeradd.3bsd \ timeradd.3bsd \
timerclear.3bsd \ timerclear.3bsd \
timercmp.3bsd \ timercmp.3bsd \
@ -233,28 +182,106 @@ dist_man_MANS = \
timespecsub.3bsd \ timespecsub.3bsd \
timeval.3bsd \ timeval.3bsd \
tree.3bsd \ tree.3bsd \
unvis.3bsd \
vis.3bsd \
# EOL # EOL
if ABI_ACCMODE
dist_man_MANS += \
getmode.3bsd \
setmode.3bsd \
# EOL
endif
if ABI_ARC4RANDOM
dist_man_MANS += \
arc4random.3bsd \
arc4random_addrandom.3bsd \
arc4random_buf.3bsd \
arc4random_stir.3bsd \
arc4random_uniform.3bsd \
# EOL
endif
if ABI_CLOSEFROM
dist_man_MANS += \
closefrom.3bsd \
# EOL
endif
if ABI_ERRC if ABI_ERRC
dist_man_MANS += \ dist_man_MANS += \
errc.3bsd \ errc.3bsd \
# EOL # EOL
endif endif
if ABI_EXPAND_NUMBER
dist_man_MANS += \
expand_number.3bsd \
# EOL
endif
if ABI_EXPLICIT_BZERO
dist_man_MANS += \
explicit_bzero.3bsd \
# EOL
endif
if ABI_FGETLN
dist_man_MANS += \
fgetln.3bsd \
fgetwln.3bsd \
fparseln.3bsd \
# EOL
endif
if ABI_FLOPEN
dist_man_MANS += \
flopen.3bsd \
# EOL
endif
if ABI_FMTCHECK
dist_man_MANS += \
fmtcheck.3bsd \
# EOL
endif
if ABI_FPURGE if ABI_FPURGE
dist_man_MANS += \ dist_man_MANS += \
fpurge.3bsd \ fpurge.3bsd \
# EOL # EOL
endif endif
if ABI_FREEZERO
dist_man_MANS += \
freezero.3bsd \
# EOL
endif
if ABI_FUNOPEN if ABI_FUNOPEN
dist_man_MANS += \ dist_man_MANS += \
funopen.3bsd \ funopen.3bsd \
# EOL # EOL
endif endif
if ABI_GETBSIZE
dist_man_MANS += \
getbsize.3bsd \
# EOL
endif
if ABI_GETPEEREID
dist_man_MANS += \
getpeereid.3bsd \
# EOL
endif
if ABI_HUMANIZE_NUMBER
dist_man_MANS += \
dehumanize_number.3bsd \
humanize_number.3bsd \
# EOL
endif
if ABI_MD5 if ABI_MD5
dist_man_MANS += \ dist_man_MANS += \
md5.3bsd \ md5.3bsd \
@ -267,6 +294,23 @@ dist_man_MANS += \
# EOL # EOL
endif endif
if ABI_PIDFILE
dist_man_MANS += \
pidfile.3bsd \
pidfile_close.3bsd \
pidfile_open.3bsd \
pidfile_remove.3bsd \
pidfile_write.3bsd \
# EOL
endif
if ABI_PROCTITLE
dist_man_MANS += \
setproctitle.3bsd \
setproctitle_init.3bsd \
# EOL
endif
if ABI_PROGNAME if ABI_PROGNAME
dist_man_MANS += \ dist_man_MANS += \
getprogname.3bsd \ getprogname.3bsd \
@ -274,7 +318,9 @@ dist_man_MANS += \
# EOL # EOL
endif endif
if ABI_PWCACHE
dist_man_MANS += \ dist_man_MANS += \
pwcache.3bsd \
gid_from_group.3bsd \ gid_from_group.3bsd \
uid_from_user.3bsd \ uid_from_user.3bsd \
# EOL # EOL
@ -285,6 +331,51 @@ dist_man_MANS += \
user_from_uid.3bsd \ user_from_uid.3bsd \
# EOL # EOL
endif endif
endif
if ABI_READPASSPHRASE
dist_man_MANS += \
readpassphrase.3bsd \
# EOL
endif
if ABI_REALLOCARRAY
dist_man_MANS += \
reallocarray.3bsd \
# EOL
endif
if ABI_REALLOCF
dist_man_MANS += \
reallocf.3bsd \
# EOL
endif
if ABI_RECALLOCARRAY
dist_man_MANS += \
recallocarray.3bsd \
# EOL
endif
if ABI_SORT
dist_man_MANS += \
heapsort.3bsd \
mergesort.3bsd \
radixsort.3bsd \
sradixsort.3bsd \
# EOL
endif
if ABI_STRINGLIST
dist_man_MANS += \
sl_add.3bsd \
sl_delete.3bsd \
sl_find.3bsd \
sl_free.3bsd \
sl_init.3bsd \
stringlist.3bsd \
# EOL
endif
if ABI_STRL if ABI_STRL
dist_man_MANS += \ dist_man_MANS += \
@ -299,6 +390,37 @@ dist_man_MANS += \
# EOL # EOL
endif endif
if ABI_STRNSTR
dist_man_MANS += \
strnstr.3bsd \
# EOL
endif
if ABI_STRTOX
dist_man_MANS += \
strtoi.3bsd \
strtou.3bsd \
# EOL
endif
if ABI_STRTONUM
dist_man_MANS += \
strtonum.3bsd \
# EOL
endif
if ABI_VIS
dist_man_MANS += \
strnunvis.3bsd \
strnvis.3bsd \
strunvis.3bsd \
strvis.3bsd \
strvisx.3bsd \
unvis.3bsd \
vis.3bsd \
# EOL
endif
if ABI_WCSL if ABI_WCSL
dist_man_MANS += \ dist_man_MANS += \
wcslcat.3bsd \ wcslcat.3bsd \

View File

@ -76,43 +76,16 @@ EXTRA_libbsd_la_DEPENDENCIES += \
# EOL # EOL
endif endif
libbsd_la_SOURCES = \ libbsd_la_SOURCES = \
closefrom.c \
dehumanize_number.c \
expand_number.c \
explicit_bzero.c \
fgetln.c \
fgetwln.c \
flopen.c \
fmtcheck.c \
fparseln.c \
freezero.c \
getbsize.c \
getpeereid.c \
heapsort.c \
humanize_number.c \
inet_net_pton.c \
local-elf.h \ local-elf.h \
local-link.h \ local-link.h \
merge.c \
pidfile.c \
pwcache.c \
radixsort.c \
readpassphrase.c \
reallocarray.c \
reallocf.c \
recallocarray.c \
setmode.c \
setproctitle.c \
stringlist.c \
strnstr.c \
strtoi.c \
strtonum.c \
strtou.c \
timeconv.c \
unvis.c \
vis.c \
# EOL # EOL
if ABI_ACCMODE
libbsd_la_SOURCES += \
setmode.c \
# EOL
endif
if ABI_ARC4RANDOM if ABI_ARC4RANDOM
if !HAVE_GETENTROPY if !HAVE_GETENTROPY
libbsd_la_SOURCES += \ libbsd_la_SOURCES += \
@ -136,6 +109,12 @@ libbsd_la_SOURCES += \
# EOL # EOL
endif endif
if ABI_CLOSEFROM
libbsd_la_SOURCES += \
closefrom.c \
# EOL
endif
if ABI_ERR if ABI_ERR
libbsd_la_SOURCES += \ libbsd_la_SOURCES += \
err.c \ err.c \
@ -148,18 +127,81 @@ libbsd_la_SOURCES += \
# EOL # EOL
endif endif
if ABI_EXPAND_NUMBER
libbsd_la_SOURCES += \
expand_number.c \
# EOL
endif
if ABI_EXPLICIT_BZERO
libbsd_la_SOURCES += \
explicit_bzero.c \
# EOL
endif
if ABI_FGETLN
libbsd_la_SOURCES += \
fgetln.c \
fgetwln.c \
fparseln.c \
# EOL
endif
if ABI_FLOPEN
libbsd_la_SOURCES += \
flopen.c \
# EOL
endif
if ABI_FMTCHECK
libbsd_la_SOURCES += \
fmtcheck.c \
# EOL
endif
if ABI_FPURGE if ABI_FPURGE
libbsd_la_SOURCES += \ libbsd_la_SOURCES += \
fpurge.c \ fpurge.c \
# EOL # EOL
endif endif
if ABI_FREEZERO
libbsd_la_SOURCES += \
freezero.c \
# EOL
endif
if ABI_FUNOPEN if ABI_FUNOPEN
libbsd_la_SOURCES += \ libbsd_la_SOURCES += \
funopen.c \ funopen.c \
# EOL # EOL
endif endif
if ABI_GETBSIZE
libbsd_la_SOURCES += \
getbsize.c \
# EOL
endif
if ABI_GETPEEREID
libbsd_la_SOURCES += \
getpeereid.c \
# EOL
endif
if ABI_HUMANIZE_NUMBER
libbsd_la_SOURCES += \
dehumanize_number.c \
humanize_number.c \
# EOL
endif
if ABI_INET_NET_PTON
libbsd_la_SOURCES += \
inet_net_pton.c \
# EOL
endif
if ABI_MD5 if ABI_MD5
libbsd_la_SOURCES += \ libbsd_la_SOURCES += \
md5.c \ md5.c \
@ -172,12 +214,68 @@ libbsd_la_SOURCES += \
# EOL # EOL
endif endif
if ABI_PIDFILE
libbsd_la_SOURCES += \
pidfile.c \
# EOL
endif
if ABI_PROCTITLE
libbsd_la_SOURCES += \
setproctitle.c \
# EOL
endif
if ABI_PROGNAME if ABI_PROGNAME
libbsd_la_SOURCES += \ libbsd_la_SOURCES += \
progname.c \ progname.c \
# EOL # EOL
endif endif
if ABI_PWCACHE
libbsd_la_SOURCES += \
pwcache.c \
# EOL
endif
if ABI_READPASSPHRASE
libbsd_la_SOURCES += \
readpassphrase.c \
# EOL
endif
if ABI_REALLOCARRAY
libbsd_la_SOURCES += \
reallocarray.c \
# EOL
endif
if ABI_REALLOCF
libbsd_la_SOURCES += \
reallocf.c \
# EOL
endif
if ABI_RECALLOCARRAY
libbsd_la_SOURCES += \
recallocarray.c \
# EOL
endif
if ABI_SORT
libbsd_la_SOURCES += \
heapsort.c \
merge.c \
radixsort.c \
# EOL
endif
if ABI_STRINGLIST
libbsd_la_SOURCES += \
stringlist.c \
# EOL
endif
if ABI_STRL if ABI_STRL
libbsd_la_SOURCES += \ libbsd_la_SOURCES += \
strlcat.c \ strlcat.c \
@ -191,6 +289,38 @@ libbsd_la_SOURCES += \
# EOL # EOL
endif endif
if ABI_STRNSTR
libbsd_la_SOURCES += \
strnstr.c \
# EOL
endif
if ABI_STRTONUM
libbsd_la_SOURCES += \
strtonum.c \
# EOL
endif
if ABI_STRTOX
libbsd_la_SOURCES += \
strtoi.c \
strtou.c \
# EOL
endif
if ABI_TIMECONV
libbsd_la_SOURCES += \
timeconv.c \
# EOL
endif
if ABI_VIS
libbsd_la_SOURCES += \
unvis.c \
vis.c \
# EOL
endif
if ABI_WCSL if ABI_WCSL
libbsd_la_SOURCES += \ libbsd_la_SOURCES += \
wcslcat.c \ wcslcat.c \

View File

@ -2,44 +2,71 @@
LIBBSD_0.0 { LIBBSD_0.0 {
global: global:
#if LIBBSD_ABI_ARC4RANDOM
arc4random; arc4random;
#endif
#if LIBBSD_ABI_ARC4RANDOM_STIR
arc4random_stir; arc4random_stir;
arc4random_addrandom; arc4random_addrandom;
#endif
#if LIBBSD_ABI_BSD_GETOPT
bsd_getopt; bsd_getopt;
optreset; optreset;
#endif
#if LIBBSD_ABI_ERRC
errc; errc;
warnc; warnc;
verrc; verrc;
vwarnc; vwarnc;
#endif
#if LIBBSD_ABI_FGETLN
fgetln; fgetln;
#endif
#if LIBBSD_ABI_FMTCHECK
fmtcheck; fmtcheck;
#endif
#if LIBBSD_ABI_SORT
heapsort; heapsort;
#endif
#if LIBBSD_ABI_HUMANIZE_NUMBER
humanize_number; humanize_number;
#endif
/* XXX: Already provided by glibc, remove. */ #if LIBBSD_ABI_INET_NET_PTON
inet_net_pton; inet_net_pton;
#endif
#if LIBBSD_ABI_PROGNAME
getprogname; getprogname;
setprogname; setprogname;
#endif
#if LIBBSD_ABI_STRL
strlcpy; strlcpy;
strlcat; strlcat;
#endif
#if LIBBSD_ABI_ACCMODE
setmode; setmode;
getmode; getmode;
#endif
#if LIBBSD_ABI_VIS
vis; vis;
strvis; strvis;
strvisx; strvisx;
unvis; unvis;
strunvis; strunvis;
strunvisx; strunvisx;
#endif
/* The following functions are provided via the system libc or libmd #if LIBBSD_ABI_MD5
* implementations. */
MD5Init; MD5Init;
MD5Update; MD5Update;
MD5Pad; MD5Pad;
@ -49,89 +76,138 @@ LIBBSD_0.0 {
MD5File; MD5File;
MD5FileChunk; MD5FileChunk;
MD5Data; MD5Data;
#endif
local: local:
*; *;
}; };
LIBBSD_0.1 { LIBBSD_0.1 {
#if LIBBSD_ABI_STRMODE
strmode; strmode;
#endif
#if LIBBSD_ABI_NLIST
/* Private symbol, but libkvm uses it. */ /* Private symbol, but libkvm uses it. */
__fdnlist; __fdnlist;
nlist; nlist;
#endif
} LIBBSD_0.0; } LIBBSD_0.0;
LIBBSD_0.2 { LIBBSD_0.2 {
#if LIBBSD_ABI_STRTONUM
strtonum; strtonum;
#endif
#if LIBBSD_ABI_VIS
strnvis; strnvis;
strnunvis; strnunvis;
#endif
#if LIBBSD_ABI_HUMANIZE_NUMBER
dehumanize_number; dehumanize_number;
#endif
#if LIBBSD_ABI_READPASSPHRASE
readpassphrase; readpassphrase;
#endif
#if LIBBSD_ABI_FLOPEN
flopen; flopen;
#endif
#if LIBBSD_ABI_PIDFILE
pidfile_open; pidfile_open;
pidfile_write; pidfile_write;
pidfile_close; pidfile_close;
pidfile_remove; pidfile_remove;
#endif
#if LIBBSD_ABI_ARC4RANDOM
arc4random_buf; arc4random_buf;
arc4random_uniform; arc4random_uniform;
#endif
} LIBBSD_0.1; } LIBBSD_0.1;
LIBBSD_0.3 { LIBBSD_0.3 {
#if LIBBSD_ABI_REALLOCF
reallocf; reallocf;
getpeereid; #endif
#if LIBBSD_ABI_GETPEEREID
getpeereid;
#endif
#if LIBBSD_ABI_SORT
mergesort; mergesort;
radixsort; radixsort;
sradixsort; sradixsort;
#endif
#if LIBBSD_ABI_FPURGE
fpurge; fpurge;
#endif
} LIBBSD_0.2; } LIBBSD_0.2;
LIBBSD_0.4 { LIBBSD_0.4 {
#if LIBBSD_ABI_CLOSEFROM
closefrom; closefrom;
#endif
#if LIBBSD_ABI_EXPAND_NUMBER
expand_number; expand_number;
#endif
} LIBBSD_0.3; } LIBBSD_0.3;
LIBBSD_0.5 { LIBBSD_0.5 {
#if LIBBSD_ABI_FGETLN
fgetwln; fgetwln;
fparseln; fparseln;
#endif
#if LIBBSD_ABI_PROCTITLE
/* Introduced in 0.2 as a stub, implemented in 0.5. */ /* Introduced in 0.2 as a stub, implemented in 0.5. */
setproctitle; setproctitle;
#endif
#if LIBBSD_ABI_STRNSTR
strnstr; strnstr;
#endif
#if LIBBSD_ABI_WCSL
wcslcat; wcslcat;
wcslcpy; wcslcpy;
#endif
} LIBBSD_0.4; } LIBBSD_0.4;
LIBBSD_0.6 { LIBBSD_0.6 {
#if LIBBSD_ABI_PROCTITLE
/* Exported to cope with the constructor+dlopen+threads mess. */ /* Exported to cope with the constructor+dlopen+threads mess. */
setproctitle_init; setproctitle_init;
#endif
} LIBBSD_0.5; } LIBBSD_0.5;
LIBBSD_0.7 { LIBBSD_0.7 {
#if LIBBSD_ABI_GETBSIZE
getbsize; getbsize;
#endif
/* This symbol might not be present on some specific systems, such #if LIBBSD_ABI_FUNOPEN
* as musl based ones. It might need to be removed on SOVERSION bump,
* as it cannot be portabily implemented everywhere. */
funopen; funopen;
#endif
#if LIBBSD_ABI_REALLOCARRAY
reallocarray; reallocarray;
#endif
#if LIBBSD_ABI_STRINGLIST
sl_init; sl_init;
sl_add; sl_add;
sl_free; sl_free;
sl_find; sl_find;
#endif
#if LIBBSD_ABI_TIMECONV
_time32_to_time; _time32_to_time;
_time_to_time32; _time_to_time32;
_time64_to_time; _time64_to_time;
@ -140,20 +216,30 @@ LIBBSD_0.7 {
_long_to_time; _long_to_time;
_time_to_int; _time_to_int;
_int_to_time; _int_to_time;
#endif
} LIBBSD_0.6; } LIBBSD_0.6;
LIBBSD_0.8 { LIBBSD_0.8 {
#if LIBBSD_ABI_EXPLICIT_BZERO
explicit_bzero; explicit_bzero;
#endif
} LIBBSD_0.7; } LIBBSD_0.7;
LIBBSD_0.9 { LIBBSD_0.9 {
#if LIBBSD_ABI_FLOPEN
flopenat; flopenat;
#endif
#if LIBBSD_ABI_PIDFILE
pidfile_fileno; pidfile_fileno;
#endif
#if LIBBSD_ABI_STRTOX
strtoi; strtoi;
strtou; strtou;
#endif
#if LIBBSD_ABI_VIS
nvis; nvis;
snvis; snvis;
stravis; stravis;
@ -165,19 +251,21 @@ LIBBSD_0.9 {
strsvis; strsvis;
strsvisx; strsvisx;
svis; svis;
#endif
} LIBBSD_0.8; } LIBBSD_0.8;
LIBBSD_0.9.1 { LIBBSD_0.9.1 {
#if LIBBSD_ABI_VIS
/* The strnvis() and strnunvis() symbols changed prototype to match /* The strnvis() and strnunvis() symbols changed prototype to match
* the NetBSD implementation. Provided as versioned nodes in 0.9.1, and * the NetBSD implementation. Provided as versioned nodes in 0.9.1, and
* exposed here explicitly so that we can redirect at compile-time. */ * exposed here explicitly so that we can redirect at compile-time. */
strnvis_netbsd; strnvis_netbsd;
strnunvis_netbsd; strnunvis_netbsd;
#endif
} LIBBSD_0.9; } LIBBSD_0.9;
LIBBSD_0.10.0 { LIBBSD_0.10.0 {
/* These BSD extensions are available on GNU systems, but not on other #if LIBBSD_ABI_ERR
* systems such as Windows or musl libc based ones. */
vwarn; vwarn;
vwarnx; vwarnx;
warn; warn;
@ -186,16 +274,28 @@ LIBBSD_0.10.0 {
verrx; verrx;
err; err;
errx; errx;
#endif
} LIBBSD_0.9.1; } LIBBSD_0.9.1;
LIBBSD_0.11.0 { LIBBSD_0.11.0 {
#if LIBBSD_ABI_VIS
strnvisx; strnvisx;
#endif
#if LIBBSD_ABI_RECALLOCARRAY
recallocarray; recallocarray;
freezero; #endif
#if LIBBSD_ABI_FREEZERO
freezero;
#endif
#if LIBBSD_ABI_ID_FROM_NAME
gid_from_group; gid_from_group;
group_from_gid;
uid_from_user; uid_from_user;
#endif
#if LIBBSD_ABI_NAME_FROM_ID
user_from_uid; user_from_uid;
group_from_gid;
#endif
} LIBBSD_0.10.0; } LIBBSD_0.10.0;

View File

@ -33,22 +33,15 @@ check_SCRIPTS = \
check_PROGRAMS = \ check_PROGRAMS = \
overlay \ overlay \
bzero \
closefrom \
endian \ endian \
explicit_bzero \
humanize \
fgetln \
fparseln \
proctitle-init \
pwcache \
setmode \
strnstr \
strtonum \
vis \
vis-openbsd \
# EOL # EOL
if ABI_ACCMODE
check_PROGRAMS += \
setmode \
# EOL
endif
if ABI_ARC4RANDOM if ABI_ARC4RANDOM
if HAVE_LIBTESTU01 if HAVE_LIBTESTU01
check_PROGRAMS += arc4random check_PROGRAMS += arc4random
@ -57,6 +50,25 @@ arc4random_LDADD = $(LDADD) $(TESTU01_LIBS)
endif endif
endif endif
if ABI_CLOSEFROM
check_PROGRAMS += \
closefrom \
# EOL
endif
if ABI_EXPLICIT_BZERO
check_PROGRAMS += \
bzero \
explicit_bzero \
# EOL
endif
if ABI_FGETLN
check_PROGRAMS += \
fgetln \
fparseln \
# EOL
fgetln_SOURCES = \ fgetln_SOURCES = \
test-stream.c \ test-stream.c \
test-stream.h \ test-stream.h \
@ -70,6 +82,21 @@ fparseln_SOURCES = \
test-stream.h \ test-stream.h \
fparseln.c \ fparseln.c \
# EOL # EOL
endif
if ABI_FPURGE
check_PROGRAMS += fpurge
endif
if ABI_FUNOPEN
check_PROGRAMS += funopen
endif
if ABI_HUMANIZE_NUMBER
check_PROGRAMS += \
humanize \
# EOL
endif
if ABI_FPURGE if ABI_FPURGE
check_PROGRAMS += fpurge check_PROGRAMS += fpurge
@ -92,6 +119,15 @@ if ABI_NLIST
check_PROGRAMS += nlist check_PROGRAMS += nlist
endif endif
if ABI_PROGNAME
check_PROGRAMS += progname
endif
if ABI_PROCTITLE
check_PROGRAMS += \
proctitle-init \
# EOL
proctitle_init_SOURCES = \ proctitle_init_SOURCES = \
proctitle.c \ proctitle.c \
# EOL # EOL
@ -107,6 +143,13 @@ proctitle_LDFLAGS = \
$(top_builddir)/src/libbsd.la \ $(top_builddir)/src/libbsd.la \
# EOL # EOL
endif endif
endif
if ABI_PWCACHE
check_PROGRAMS += \
pwcache \
# EOL
endif
if ABI_PROGNAME if ABI_PROGNAME
check_PROGRAMS += progname check_PROGRAMS += progname
@ -120,4 +163,23 @@ if ABI_STRMODE
check_PROGRAMS += strmode check_PROGRAMS += strmode
endif endif
if ABI_STRNSTR
check_PROGRAMS += \
strnstr \
# EOL
endif
if ABI_STRTONUM
check_PROGRAMS += \
strtonum \
# EOL
endif
if ABI_VIS
check_PROGRAMS += \
vis \
vis-openbsd \
# EOL
endif
TESTS = $(check_SCRIPTS) $(check_PROGRAMS) TESTS = $(check_SCRIPTS) $(check_PROGRAMS)