Compare commits

..

No commits in common. "main" and "0.8.3" have entirely different histories.
main ... 0.8.3

391 changed files with 4200 additions and 12645 deletions

7
.gitignore vendored
View File

@ -1,5 +1,4 @@
ChangeLog
*~
*.pc
*.la
*.lo
@ -8,10 +7,6 @@ ChangeLog
*.a
*.log
*.trs
*.gcda
*.gcno
*.sym
*.map
.dirstamp
.deps/
.libs/
@ -22,6 +17,6 @@ autom4te.cache/
build-aux/
configure
config.*
format.ld
libtool
m4/
stamp-h1

View File

@ -1,54 +0,0 @@
.vpath-tests:
script:
- ./autogen
- mkdir -p build-tree
- cd build-tree
- ../configure
- make check
.unit-tests:
script:
- ./autogen && ./configure
- make check
.unit-tests-asan:
script:
- ./autogen && ./configure --enable-sanitize
- make check
.coverage:
script:
- ./autogen && ./configure --disable-static
- make check CFLAGS="--coverage -O0 -ggdb" LDFLAGS="--coverage -O0 -ggdb"
- gcovr -s -e test/
coverage: /^TOTAL.*\s+(\d+\%)$/
.debian:
image: debian:latest
stage: test
before_script:
- apt-get update -qq
- apt-get install -qq -y --no-install-recommends
git gcc make autoconf automake libtool libmd-dev gcovr
.alpine:
image: alpine:latest
stage: test
before_script:
- apk add --no-cache git gcc make autoconf automake libtool
bsd-compat-headers linux-headers libmd-dev musl-dev gcovr
vpath-tests:debian:
extends: [.debian, .vpath-tests]
unit-tests:debian:
extends: [.debian, .unit-tests-asan]
coverage:debian:
extends: [.debian, .coverage]
unit-tests:alpine:
extends: [.alpine, .unit-tests]
coverage:alpine:
extends: [.alpine, .coverage]

391
COPYING
View File

@ -3,72 +3,126 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Files:
*
Copyright:
Copyright © 2004-2024 Guillem Jover <guillem@hadrons.org>
Copyright © 2004-2006, 2008-2015 Guillem Jover <guillem@hadrons.org>
License: BSD-3-clause
Files:
man/arc4random.3
man/tree.3
Copyright:
Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
All rights reserved.
License: BSD-4-clause-Niels-Provos
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by Niels Provos.
4. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Files:
man/getprogname.3
Copyright:
Copyright © 2001 Christopher G. Demetriou
All rights reserved.
License: BSD-4-clause-Christopher-G-Demetriou
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed for the
NetBSD Project. See http://www.netbsd.org/ for
information about NetBSD.
4. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Files:
include/bsd/err.h
include/bsd/stdlib.h
include/bsd/sys/param.h
include/bsd/unistd.h
src/bsd_getopt.c
src/err.c
src/fgetln.c
src/progname.c
Copyright:
Copyright © 2005, 2008-2012, 2019 Guillem Jover <guillem@hadrons.org>
Copyright © 2005, 2008-2012 Guillem Jover <guillem@hadrons.org>
Copyright © 2005 Hector Garcia Alvarez
Copyright © 2005 Aurelien Jarno
Copyright © 2006 Robert Millan
Copyright © 2018 Facebook, Inc.
License: BSD-3-clause
Files:
include/bsd/netinet/ip_icmp.h
include/bsd/sys/bitstring.h
include/bsd/sys/queue.h
include/bsd/sys/time.h
include/bsd/timeconv.h
include/bsd/vis.h
man/bitstring.3bsd
man/errc.3bsd
man/explicit_bzero.3bsd
man/fgetln.3bsd
man/fgetwln.3bsd
man/fpurge.3bsd
man/bitstring.3
man/explicit_bzero.3
man/fgetln.3
man/fgetwln.3
man/funopen.3bsd
man/getbsize.3bsd
man/heapsort.3bsd
man/nlist.3bsd
man/pwcache.3bsd
man/getbsize.3
man/heapsort.3
man/nlist.3
man/queue.3bsd
man/radixsort.3bsd
man/reallocarray.3bsd
man/reallocf.3bsd
man/setmode.3bsd
man/strmode.3bsd
man/strnstr.3bsd
man/strtoi.3bsd
man/strtou.3bsd
man/unvis.3bsd
man/vis.3bsd
man/wcslcpy.3bsd
man/radixsort.3
man/reallocarray.3
man/reallocf.3
man/setmode.3
man/strmode.3
man/strnstr.3
man/unvis.3
man/vis.3
man/wcslcpy.3
src/getbsize.c
src/heapsort.c
src/merge.c
src/nlist.c
src/pwcache.c
src/radixsort.c
src/setmode.c
src/strmode.c
src/strnstr.c
src/strtoi.c
src/strtou.c
src/unvis.c
src/vis.c
Copyright:
Copyright © 1980, 1982, 1986, 1989-1994
The Regents of the University of California. All rights reserved.
Copyright © 1992 Keith Muller.
Copyright © 2001 Mike Barcroft <mike@FreeBSD.org>
.
Some code is derived from software contributed to Berkeley by
@ -96,33 +150,6 @@ Copyright:
Co. or Unix System Laboratories, Inc. and are reproduced herein with
the permission of UNIX System Laboratories, Inc.
License: BSD-3-clause-Regents
Files:
src/vis.c
Copyright:
Copyright © 1989, 1993
The Regents of the University of California. All rights reserved.
.
Copyright © 1999, 2005 The NetBSD Foundation, Inc.
All rights reserved.
License: BSD-3-clause-Regents and BSD-2-clause-NetBSD
Files:
include/bsd/libutil.h
Copyright:
Copyright © 1996 Peter Wemm <peter@FreeBSD.org>.
All rights reserved.
Copyright © 2002 Networks Associates Technology, Inc.
All rights reserved.
License: BSD-3-clause-author
Files:
man/timeradd.3bsd
Copyright:
Copyright © 2009 Jukka Ruohonen <jruohonen@iki.fi>
Copyright © 1999 Kelly Yancey <kbyanc@posi.net>
All rights reserved.
License: BSD-3-clause-John-Birrell
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
@ -131,11 +158,11 @@ License: BSD-3-clause-John-Birrell
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the author nor the names of any co-contributors
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
@ -148,7 +175,39 @@ License: BSD-3-clause-John-Birrell
SUCH DAMAGE.
Files:
man/setproctitle.3bsd
include/bsd/libutil.h
Copyright:
Copyright © 1996 Peter Wemm <peter@FreeBSD.org>.
All rights reserved.
Copyright © 2002 Networks Associates Technology, Inc.
All rights reserved.
License: BSD-3-clause-Peter-Wemm
Redistribution and use in source and binary forms, with or without
modification, is permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote
products derived from this software without specific prior written
permission.
.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Files:
man/setproctitle.3
Copyright:
Copyright © 1995 Peter Wemm <peter@FreeBSD.org>
All rights reserved.
@ -171,27 +230,16 @@ License: BSD-5-clause-Peter-Wemm
Files:
include/bsd/stringlist.h
man/arc4random.3bsd
man/fmtcheck.3bsd
man/humanize_number.3bsd
man/stringlist.3bsd
man/timeval.3bsd
man/fmtcheck.3
man/humanize_number.3
man/stringlist.3
src/fmtcheck.c
src/humanize_number.c
src/stringlist.c
src/strtonum.c
Copyright:
Copyright © 1994, 1997-2000, 2002, 2008, 2010, 2014
The NetBSD Foundation, Inc.
Copyright © 2013 John-Mark Gurney <jmg@FreeBSD.org>
Copyright © 1994, 1997-2000, 2002, 2008 The NetBSD Foundation, Inc.
All rights reserved.
.
Copyright © 2014 The NetBSD Foundation, Inc.
All rights reserved.
.
Some code was derived from software contributed to The NetBSD Foundation
by Taylor R. Campbell.
.
Some code was contributed to The NetBSD Foundation by Allen Briggs.
.
Some code was contributed to The NetBSD Foundation by Luke Mewburn.
@ -206,20 +254,38 @@ Copyright:
.
Some code is derived from software contributed to The NetBSD Foundation
by Christos Zoulas.
.
Some code is derived from software contributed to The NetBSD Foundation
by Jukka Ruohonen.
License: BSD-2-clause-NetBSD
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
.
THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Files:
include/bsd/sys/endian.h
man/byteorder.3bsd
man/closefrom.3bsd
man/expand_number.3bsd
man/flopen.3bsd
man/getpeereid.3bsd
man/pidfile.3bsd
man/expand_number.3
man/closefrom.3
man/flopen.3
man/getpeereid.3
man/pidfile.3
src/expand_number.c
src/hash/sha512.h
src/hash/sha512c.c
src/pidfile.c
src/reallocf.c
src/timeconv.c
@ -236,9 +302,6 @@ Copyright:
Copyright © 2002 Thomas Moestl <tmm@FreeBSD.org>
All rights reserved.
.
Copyright © 2002 Mike Barcroft <mike@FreeBSD.org>
All rights reserved.
.
Copyright © 2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>
All rights reserved.
.
@ -253,6 +316,7 @@ Copyright:
All rights reserved.
.
Copyright © 2009 Advanced Computing Technologies LLC
Written by: John H. Baldwin <jhb@FreeBSD.org>
All rights reserved.
.
Copyright © 2011 Guillem Jover <guillem@hadrons.org>
@ -261,7 +325,7 @@ License: BSD-2-clause
Files:
src/flopen.c
Copyright:
Copyright © 2007-2009 Dag-Erling Coïdan Smørgrav
Copyright © 2007 Dag-Erling Coïdan Smørgrav
All rights reserved.
License: BSD-2-clause-verbatim
Redistribution and use in source and binary forms, with or without
@ -288,8 +352,7 @@ License: BSD-2-clause-verbatim
Files:
include/bsd/sys/tree.h
man/fparseln.3bsd
man/tree.3bsd
man/fparseln.3
src/fparseln.c
Copyright:
Copyright © 1997 Christos Zoulas.
@ -298,19 +361,36 @@ Copyright:
Copyright © 2002 Niels Provos <provos@citi.umich.edu>
All rights reserved.
License: BSD-2-clause-author
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Files:
include/bsd/readpassphrase.h
man/readpassphrase.3bsd
man/strlcpy.3bsd
man/strtonum.3bsd
man/readpassphrase.3
man/strlcpy.3
man/strtonum.3
src/arc4random.c
src/arc4random_linux.h
src/arc4random_openbsd.h
src/arc4random_uniform.c
src/arc4random_unix.h
src/arc4random_win.h
src/closefrom.c
src/freezero.c
src/getentropy_aix.c
src/getentropy_bsd.c
src/getentropy_hpux.c
@ -318,33 +398,28 @@ Files:
src/getentropy_linux.c
src/getentropy_osx.c
src/getentropy_solaris.c
src/getentropy_win.c
src/readpassphrase.c
src/reallocarray.c
src/recallocarray.c
src/strlcat.c
src/strlcpy.c
test/explicit_bzero.c
test/strtonum.c
src/strtonum.c
Copyright:
Copyright © 2004 Ted Unangst and Todd Miller
All rights reserved.
.
Copyright © 1996 David Mazieres <dm@uun.org>
Copyright © 1998, 2000-2002, 2004-2005, 2007, 2010, 2012-2015
Copyright © 1998, 2000-2002, 2004-2005, 2007, 2010, 2012-2014
Todd C. Miller <Todd.Miller@courtesan.com>
Copyright © 2004 Ted Unangst
Copyright © 2004 Otto Moerbeek <otto@drijf.net>
Copyright © 2008 Damien Miller <djm@openbsd.org>
Copyright © 2008, 2010-2011, 2016-2017 Otto Moerbeek <otto@drijf.net>
Copyright © 2008 Otto Moerbeek <otto@drijf.net>
Copyright © 2013 Markus Friedl <markus@openbsd.org>
Copyright © 2014 Bob Beck <beck@obtuse.com>
Copyright © 2014 Brent Cook <bcook@openbsd.org>
Copyright © 2014 Pawel Jakub Dawidek <pjd@FreeBSD.org>
Copyright © 2014 Theo de Raadt <deraadt@openbsd.org>
Copyright © 2014 Google Inc.
Copyright © 2015 Michael Felt <aixtools@gmail.com>
Copyright © 2015, 2022 Guillem Jover <guillem@hadrons.org>
Copyright © 2015 Guillem Jover <guillem@hadrons.org>
License: ISC
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@ -401,6 +476,17 @@ License: Expat
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
Files:
include/bsd/md5.h
src/hash/md5.c
Copyright:
None
License: public-domain-Colin-Plumb
This code implements the MD5 message-digest algorithm.
The algorithm is due to Ron Rivest. This code was
written by Colin Plumb in 1993, no copyright is claimed.
This code is in the public domain; do with it what you wish.
Files:
src/explicit_bzero.c
src/chacha_private.h
@ -411,6 +497,8 @@ License: public-domain
Files:
man/mdX.3bsd
src/hash/md5hl.c
src/hash/helper.c
Copyright:
None
License: Beerware
@ -419,56 +507,6 @@ License: Beerware
can do whatever you want with this stuff. If we meet some day, and you think
this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
License: BSD-3-clause-Regents
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
License: BSD-3-clause-author
Redistribution and use in source and binary forms, with or without
modification, is permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote
products derived from this software without specific prior written
permission.
.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
License: BSD-3-clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -492,49 +530,6 @@ License: BSD-3-clause
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License: BSD-2-clause-NetBSD
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
.
THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
License: BSD-2-clause-author
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License: BSD-2-clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions

View File

@ -1,18 +1,13 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = \
include \
man \
src \
test \
# EOL
SUBDIRS = include man src test
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = \
autogen \
get-version \
# EOL
$(nil)
dist-hook:
echo $(VERSION) >$(distdir)/.dist-version

44
README
View File

@ -5,10 +5,6 @@ and lacking on others like GNU systems, thus making it easier to port
projects with strong BSD origins, without needing to embed the same
code over and over again on each project.
A BSD compatible message-digest library is required, on systems where
this is not provided by its libc or libmd libraries, the canonical
implementation to use is <https://www.hadrons.org/software/libmd/>.
Releases
--------
@ -31,44 +27,10 @@ The mail address is:
Source Repository
-----------------
The primary repository can be browsed at:
The master repository can be browsed at:
<https://gitlab.freedesktop.org/libbsd/libbsd>
<https://cgit.freedesktop.org/libbsd>
and cloned from:
<https://gitlab.freedesktop.org/libbsd/libbsd.git>
Building from git source
------------------------
To prepare the libbsd source tree from git before starting the build process
some required software needs to be installed:
GNU autoconf >= 2.67
GNU automake >= 1.9
GNU libtool >= 2.0
After installing the needed software, and running the following command on
the git tree:
$ ./autogen
the source should be roughly equivalent to the distributed tar source.
Building from tar source
------------------------
The minimum software required to configure and build dpkg from a tarball is:
C89 compiler
make
The following software might be required depending on the system:
libmd (whenever the libc does not provide the needed digest functions)
The build process is done by running the usual «./configure; make». To
see all available configuration options please run «./configure --help».
<https://anongit.freedesktop.org/git/libbsd>

11
TODO
View File

@ -1,14 +1,3 @@
* Migrate portable functions from GNU/kFreeBSD's libfreebsd.
* Add more functions used by ported packages (check openssh).
* Add more unit tests.
* Add missing man pages.
- bsd_getopt.
- timeconv?
* Add a README.import file.
* Update man pages:
- Document when each interface was added on every BSD, and libbsd.
* Handle LFS properly. By default the library emits LFS objects, but might
be used by non-LFS objects. We should either provide foo and foo64
functions and appropriate mappings on _FILE_OFFSET_BITS=64,
_LARGEFILE_SOURCE and _LARGEFILE64_SOURCE. Or error out when the off_t
used by the code including us does not match a 64-bit type.

View File

@ -2,26 +2,21 @@
AC_PREREQ([2.67])
AC_INIT([libbsd], m4_esyscmd([./get-version]), [libbsd@lists.freedesktop.org])
AC_CONFIG_SRCDIR([src/strlcpy.c])
AC_CONFIG_SRCDIR([src/fgetln.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE(
[1.11]
[-Wall]
[foreign]
[nostdinc]
[subdir-objects]
[no-dist-gzip dist-xz]
)
AM_SILENT_RULES([yes])
AM_INIT_AUTOMAKE([1.9 foreign nostdinc subdir-objects no-dist-gzip dist-xz])
SOVERSION_MAJOR=0
SOVERSION_MINOR=12
SOVERSION_PATCH=2
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
[AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
SOVERSION="$SOVERSION_MAJOR:$SOVERSION_MINOR:$SOVERSION_PATCH"
AC_SUBST([SOVERSION])
LIBBSD_ABI_MAJOR=0
LIBBSD_ABI_MINOR=8
LIBBSD_ABI_PATCH=3
LIBBSD_ABI="$LIBBSD_ABI_MAJOR:$LIBBSD_ABI_MINOR:$LIBBSD_ABI_PATCH"
AC_SUBST([LIBBSD_ABI])
# Check and store if we got user supplied variables
user_CFLAGS=${CFLAGS-unset}
@ -29,601 +24,134 @@ user_CFLAGS=${CFLAGS-unset}
# Checks for operating system services and capabilities.
AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
LIBBSD_SYS_TIME64
AM_PROG_AR
LT_INIT
LIBBSD_LINKER_VERSION_SCRIPT
## Select library ABI to expose.
#
# The systems have DROP comments for interfaces that could be dropped on
# the next SOVERSION bump.
is_windows=no
api_time_macros=unknown
abi_accmode=unknown
abi_arc4random=unknown
abi_arc4random_stir=unknown
abi_asprintf=unknown
abi_bsd_getopt=unknown
abi_closefrom=unknown
abi_err=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_freezero=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_name_from_id=unknown
abi_nlist=unknown
abi_pidfile=unknown
abi_proctitle=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_strmode=unknown
abi_strnstr=unknown
abi_strtonum=unknown
abi_strtox=unknown
abi_timeconv=unknown
abi_vis=unknown
abi_wcsl=unknown
AS_CASE([$host_os],
[*-gnu* | gnu*], [
api_time_macros=no
abi_accmode=yes
# DROP: On glibc >= 2.36.
#abi_arc4random=no
abi_arc4random=yes
abi_arc4random_stir=yes
abi_asprintf=no
abi_bsd_getopt=yes
# DROP: On glibc >= 2.34.
#abi_closefrom=no
abi_closefrom=yes
abi_err=no
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_freezero=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.
#abi_md5=no
abi_md5=yes
abi_name_from_id=yes
abi_nlist=yes
abi_pidfile=yes
abi_proctitle=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.
#abi_strl=no
abi_strl=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
],
[*-musl*], [
api_time_macros=no
abi_accmode=yes
abi_arc4random=yes
abi_arc4random_stir=yes
abi_asprintf=no
# DROP: On musl >= 0.9.7, optreset got implemented.
#abi_bsd_getopt=no
abi_bsd_getopt=yes
abi_closefrom=yes
abi_err=no
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_freezero=yes
# 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
# 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
# enable it explicitly
#abi_funopen=no
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.
#abi_md5=no
abi_md5=yes
abi_name_from_id=yes
abi_nlist=yes
abi_pidfile=yes
abi_proctitle=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.
#abi_strl=no
abi_strl=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
],
[darwin*], [
api_time_macros=no
abi_accmode=no
abi_arc4random=no
abi_arc4random_stir=no
abi_asprintf=no
abi_bsd_getopt=no
abi_closefrom=yes
abi_err=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_freezero=yes
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_name_from_id=no
abi_nlist=no
abi_pidfile=yes
abi_proctitle=yes
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_strmode=no
abi_strnstr=no
abi_strtonum=no
abi_strtox=yes
abi_timeconv=no
# On libmd.
abi_transparent_libmd=no
abi_vis=no
abi_wcsl=no
],
[solaris2*], [
api_time_macros=yes
abi_accmode=yes
abi_arc4random=no
abi_arc4random_stir=no
abi_asprintf=no
abi_bsd_getopt=yes
abi_closefrom=no
abi_err=no
abi_errc=yes
abi_expand_number=yes
abi_explicit_bzero=yes
abi_fgetln=yes
abi_flopen=yes
abi_fmtcheck=no
abi_fpurge=yes
abi_freezero=yes
abi_funopen=no
abi_getbsize=yes
abi_getpeereid=yes
abi_humanize_number=yes
abi_id_from_name=yes
abi_inet_net_pton=yes
# On libmd.
abi_md5=no
abi_name_from_id=yes
abi_nlist=no
abi_pidfile=yes
abi_proctitle=yes
abi_progname=no
abi_readpassphrase=yes
abi_reallocarray=yes
abi_reallocf=no
abi_recallocarray=yes
abi_stringlist=yes
abi_sort=yes
abi_strl=no
abi_strmode=yes
abi_strnstr=no
abi_strtonum=no
abi_strtox=yes
abi_timeconv=yes
# On libmd.
abi_transparent_libmd=no
abi_vis=yes
abi_wcsl=yes
],
[aix*], [
api_time_macros=yes
abi_accmode=yes
abi_arc4random=yes
abi_arc4random_stir=yes
abi_asprintf=yes
abi_bsd_getopt=yes
abi_closefrom=yes
abi_err=yes
abi_errc=yes
abi_expand_number=yes
abi_explicit_bzero=yes
abi_fgetln=yes
abi_flopen=yes
abi_fmtcheck=yes
abi_fpurge=no
abi_freezero=yes
abi_funopen=no
abi_getbsize=yes
abi_getpeereid=yes
abi_humanize_number=yes
abi_id_from_name=yes
abi_inet_net_pton=no
# On libmd.
abi_md5=no
abi_name_from_id=yes
abi_nlist=no
abi_pidfile=yes
abi_proctitle=yes
abi_progname=yes
abi_readpassphrase=yes
abi_reallocarray=yes
abi_reallocf=yes
abi_recallocarray=yes
abi_stringlist=yes
abi_sort=yes
abi_strl=yes
abi_strmode=yes
abi_strnstr=yes
abi_strtonum=yes
abi_strtox=yes
abi_timeconv=yes
# On libmd.
abi_transparent_libmd=no
abi_vis=yes
abi_wcsl=yes
],
[mingw*], [
is_windows=yes
],
)
# 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
])
AS_IF([test "$abi_err" = "yes" || test "$abi_errc" = "yes"], [
abi_err_h=yes
], [
abi_err_h=no
])
AM_CONDITIONAL([OS_WINDOWS], [test "x$is_windows" = "xyes"])
# Checks for programs.
AC_CHECK_TOOL([OBJDUMP], [objdump])
AC_PROG_CC
AC_PROG_SED
AC_PROG_INSTALL
AC_PROG_LN_S
# Set default compiler variables
AS_IF([test "$user_CFLAGS" = unset], [
LIBBSD_CHECK_COMPILER_FLAG([-Wall])
LIBBSD_CHECK_COMPILER_FLAG([-Wextra])
LIBBSD_CHECK_COMPILER_FLAG([-Wbad-function-cast])
LIBBSD_CHECK_COMPILER_FLAG([-Wc99-c11-compat])
LIBBSD_CHECK_COMPILER_FLAG([-Wcast-align])
LIBBSD_CHECK_COMPILER_FLAG([-Wdeclaration-after-statement])
LIBBSD_CHECK_COMPILER_FLAG([-Wdocumentation])
LIBBSD_CHECK_COMPILER_FLAG([-Wduplicated-branches])
LIBBSD_CHECK_COMPILER_FLAG([-Wduplicated-cond])
LIBBSD_CHECK_COMPILER_FLAG([-Wformat -Wformat-security])
LIBBSD_CHECK_COMPILER_FLAG([-Wformat=2])
LIBBSD_CHECK_COMPILER_FLAG([-Winit-self])
LIBBSD_CHECK_COMPILER_FLAG([-Wlogical-not-parentheses])
LIBBSD_CHECK_COMPILER_FLAG([-Wlogical-op])
LIBBSD_CHECK_COMPILER_FLAG([-Wmissing-declarations])
LIBBSD_CHECK_COMPILER_FLAG([-Wmissing-format-attribute])
LIBBSD_CHECK_COMPILER_FLAG([-Wmissing-prototypes])
LIBBSD_CHECK_COMPILER_FLAG([-Wnested-externs])
LIBBSD_CHECK_COMPILER_FLAG([-Wno-missing-field-initializers])
LIBBSD_CHECK_COMPILER_FLAG([-Wno-nonnull-compare])
LIBBSD_CHECK_COMPILER_FLAG([-Wno-tautological-constant-out-of-range-compare])
LIBBSD_CHECK_COMPILER_FLAG([-Wno-unused-parameter])
LIBBSD_CHECK_COMPILER_FLAG([-Wnull-dereference])
LIBBSD_CHECK_COMPILER_FLAG([-Wold-style-definition])
LIBBSD_CHECK_COMPILER_FLAG([-Wpointer-arith])
LIBBSD_CHECK_COMPILER_FLAG([-Wregister])
LIBBSD_CHECK_COMPILER_FLAG([-Wrestrict])
LIBBSD_CHECK_COMPILER_FLAG([-Wshadow])
LIBBSD_CHECK_COMPILER_FLAG([-Wshift-negative-value])
LIBBSD_CHECK_COMPILER_FLAG([-Wsizeof-array-argument])
LIBBSD_CHECK_COMPILER_FLAG([-Wstrict-prototypes])
LIBBSD_CHECK_COMPILER_FLAG([-Wswitch-bool])
LIBBSD_CHECK_COMPILER_FLAG([-Wvla])
LIBBSD_CHECK_COMPILER_FLAG([-Wwrite-strings])
CFLAGS="$CFLAGS $LIBBSD_COMPILER_FLAGS"
AC_ARG_ENABLE([sanitize],
[AS_HELP_STRING([--enable-sanitize], [enable compiler sanitizer support])],
[
LIBBSD_COMPILER_FLAGS=''
LIBBSD_CHECK_COMPILER_FLAG([-fsanitize=address])
LIBBSD_CHECK_COMPILER_FLAG([-fsanitize=leak])
LIBBSD_CHECK_COMPILER_FLAG([-fsanitize=undefined])
CFLAGS="$CFLAGS $LIBBSD_COMPILER_FLAGS"
LDFLAGS="$LDFLAGS $LIBBSD_COMPILER_FLAGS"
])
])
if test "$user_CFLAGS" = unset && test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-variable -Wno-unused-parameter"
fi
# Checks for libraries.
AC_CHECK_LIB([testu01], [unif01_CreateExternGenBits],
[TESTU01_LIBS="-ltestu01"])
[TESTU01_LIBS="-ltestu01"])
AC_SUBST([TESTU01_LIBS])
AM_CONDITIONAL([HAVE_LIBTESTU01],
[test "x$ac_cv_lib_testu01_unif01_CreateExternGenBits" = "xyes"])
saved_LIBS="$LIBS"
AS_IF([test "$abi_md5" = "yes"], [
AC_SEARCH_LIBS([MD5Update], [md], [
AS_IF([test "x$ac_cv_search_MD5Update" != "xnone required"], [
MD5_LIBS="$MD5_LIBS $ac_cv_search_MD5Update"
abi_transparent_libmd=yes
])
], [
AC_MSG_ERROR([cannot find required MD5 functions in libc or libmd])
])
])
AS_IF([test "$abi_arc4random" = "yes"], [
AC_CHECK_FUNCS([getentropy])
AS_IF([test "$ac_cv_func_getentropy" != "yes"], [
AC_SEARCH_LIBS([SHA512Update], [md], [
AS_IF([test "x$ac_cv_search_SHA512Update" != "xnone required"], [
LIBBSD_LIBS="$SHA512_LIBS $ac_cv_search_SHA512Update"
])
], [
AC_MSG_ERROR([cannot find required SHA-2 functions in libc or libmd])
])
])
])
LIBS="$saved_LIBS"
[test "x$ac_cv_lib_testu01_unif01_CreateExternGenBits" = "xyes"])
# In old glibc versions (< 2.17) clock_gettime() is in librt.
AS_CASE([$host_os],
[*-gnu*], [
# In old glibc versions (< 2.17) clock_gettime() is in librt.
[*-gnu], [
saved_LIBS="$LIBS"
AC_SEARCH_LIBS([clock_gettime], [rt], [
AS_IF([test "x$ac_cv_search_clock_gettime" != "xnone required"], [
LIBBSD_LIBS="$LIBBSD_LIBS $ac_cv_search_clock_gettime"
])
])
AC_SEARCH_LIBS([clock_gettime], [rt], [CLOCK_GETTIME_LIBS="-lrt"])
AC_SUBST([CLOCK_GETTIME_LIBS])
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.
AC_CHECK_HEADERS([\
sys/ndir.h \
sys/dir.h \
ndir.h \
dirent.h \
pwd.h \
grp.h \
stdio_ext.h \
procinfo.h \
])
AC_CHECK_HEADERS([sys/ndir.h sys/dir.h ndir.h dirent.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_UID_T
AC_C_INLINE
AC_C_TYPEOF
AC_TYPE_INT64_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_UID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_CHECK_DECL([F_CLOSEM], [
AC_DEFINE([HAVE_FCNTL_CLOSEM], [1],
[Define to 1 if you have fcntl(F_CLOSEM)])
], [], [[
#include <limits.h>
#include <fcntl.h>
]])
AC_CHECK_DECL([F_CLOSEM],
[AC_DEFINE([HAVE_FCNTL_CLOSEM], [1],
[Define to 1 if you have fcntl(F_CLOSEM)])],
[],
[#include <limits.h>
#include <fcntl.h>])
AC_CHECK_DECLS([environ], [], [], [[
#include <unistd.h>
]])
LIBBSD_HAS_GNU_INIT_ARRAY
AC_CACHE_CHECK(
[for GNU .init_array section support],
[libbsd_cv_gnu_init_array_support],
[AC_RUN_IFELSE(
[AC_LANG_SOURCE(
[[
static int rc = 1;
static void init(int argc) { if (argc == 1) rc = 0; }
void (*init_func)(int argc) __attribute__((section(".init_array"))) = init;
int main() { return rc; }
]]
)],
[libbsd_cv_gnu_init_array_support=yes],
[libbsd_cv_gnu_init_array_support=no],
[AC_PREPROC_IFELSE(
[AC_LANG_SOURCE(
[[
/* Look for a known libc that supports .init_array with the GNU extension
* to pass main() arguments to the init functions. */
#include <stdlib.h>
#if defined __GLIBC_PREREQ
# if __GLIBC_PREREQ(2, 4)
/* glibc supports GNU .init_array since 2.4. */
# else
# error glibc does not support GNU .init_array
# endif
#else
/*
* Basic SysV ABI .init_array support, init functions do not get arguments:
* - Bionic since its inception.
* - uClibc since 0.9.29.
*/
# error unknown whether libc supports GNU .init_array
#endif
]]
)],
[libbsd_cv_gnu_init_array_support=yes],
[libbsd_cv_gnu_init_array_support=no])
]
)]
)
AM_CONDITIONAL([BUILD_LIBBSD_CTOR],
[test "$libbsd_cv_gnu_init_array_support" = yes])
# Checks for library functions.
LIBBSD_CHECK_PROGNAME
LIBBSD_CHECK_REGISTER_ATFORK
AC_MSG_CHECKING([for program_invocation_short_name])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <errno.h>]],
[[const char *p = program_invocation_short_name;]])],
[AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
[Define to 1 if you have program_invocation_short_name])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
AC_CHECK_FUNCS([\
vasprintf \
asprintf \
clearenv \
dirfd \
flock \
fopencookie \
__fpurge \
funopen \
getauxval \
getentropy \
getexecname \
getline \
open_memstream \
pstat_getproc \
sysconf \
uid_from_user \
gid_from_group \
user_from_uid \
group_from_gid \
])
AC_MSG_CHECKING([for __progname])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[]],
[[extern char *__progname;
const char *p = __progname;]])],
[AC_DEFINE([HAVE___PROGNAME], [1], [Define to 1 if you have __progname])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xyes"])
# API selection
LIBBSD_SELECT_API([time_macros], [time struct conversion macros])
# ABI selection
LIBBSD_SELECT_ABI([accmode], [setmode()/getmode()])
LIBBSD_SELECT_ABI([arc4random], [arc4random() API])
LIBBSD_SELECT_ABI([arc4random_stir], [arc4random_stir()/arc4random_addrandom()])
LIBBSD_SELECT_ABI([asprintf], [vasprintf()/asprintf()])
LIBBSD_SELECT_ABI([bsd_getopt], [BSD getopt()])
LIBBSD_SELECT_ABI([closefrom], [closefrom()])
LIBBSD_SELECT_ABI([err_h], [err.h header])
LIBBSD_SELECT_ABI([err], [err 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([freezero], [freezero()])
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([name_from_id], [user_from_uid()/group_from_gid()])
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([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([strmode], [strmode()])
LIBBSD_SELECT_ABI([strnstr], [strnstr()])
LIBBSD_SELECT_ABI([strtonum], [strtonum()])
LIBBSD_SELECT_ABI([strtox], [strtoi()/strtou()])
LIBBSD_SELECT_ABI([timeconv], [timeconv.h API])
LIBBSD_SELECT_ABI([transparent_libmd], [transparent libmd support])
LIBBSD_SELECT_ABI([vis], [vis API])
LIBBSD_SELECT_ABI([wcsl], [wcslcpy()/wcslcat()])
AS_IF([test "x$abi_funopen" = "xno" && \
test "x$ac_cv_func_funopen" != "xyes" && \
test "x$ac_cv_func_fopencookie" = "xyes"], [
AC_MSG_WARN([[can implement funopen() now based on newly added fopencooke(), report upstream]])
])
AC_SUBST([MD5_LIBS])
AC_SUBST([LIBBSD_LIBS])
AC_CHECK_FUNCS([clearenv dirfd fopencookie __fpurge \
getauxval getentropy getexecname getline \
pstat_getproc sysconf])
AM_CONDITIONAL(HAVE_GETENTROPY, [test "x$ac_cv_func_getentropy" = "xtrue"])
AC_CONFIG_FILES([
Makefile
include/Makefile
man/Makefile
src/Makefile
src/libbsd.pc
src/libbsd-ctor.pc
src/libbsd-overlay.pc
test/Makefile
Makefile
include/Makefile
man/Makefile
src/Makefile
src/libbsd.pc
src/libbsd-ctor.pc
src/libbsd-overlay.pc
test/Makefile
])
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT

View File

@ -4,85 +4,24 @@ nobase_include_HEADERS = \
bsd/sys/bitstring.h \
bsd/sys/cdefs.h \
bsd/sys/endian.h \
bsd/sys/param.h \
bsd/sys/poll.h \
bsd/sys/queue.h \
bsd/sys/time.h \
bsd/sys/tree.h \
bsd/netinet/ip_icmp.h \
bsd/bitstring.h \
bsd/bsd.h \
bsd/inttypes.h \
bsd/err.h \
bsd/getopt.h \
bsd/libutil.h \
bsd/md5.h \
bsd/nlist.h \
bsd/readpassphrase.h \
bsd/stdio.h \
bsd/stdlib.h \
bsd/string.h \
bsd/unistd.h \
bsd/wchar.h \
# EOL
if ABI_ERR_H
nobase_include_HEADERS += \
bsd/err.h \
# EOL
endif
if ABI_BSD_GETOPT
nobase_include_HEADERS += \
bsd/getopt.h \
# EOL
endif
if ABI_MD5
nobase_include_HEADERS += \
bsd/md5.h \
# EOL
endif
if ABI_NLIST
nobase_include_HEADERS += \
bsd/nlist.h \
# EOL
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/unistd.h \
bsd/vis.h \
# EOL
endif
do_header_subst = $(AM_V_GEN) $(SED) \
-e 's:^//\(.define LIBBSD_SYS_TIME_BITS\).*:\1 $(LIBBSD_SYS_TIME_BITS):' \
-e 's:^//\(.define LIBBSD_SYS_HAS_TIME64\).*:\1 $(LIBBSD_SYS_HAS_TIME64):' \
# EOL
install-data-hook:
$(do_header_subst) <$(DESTDIR)$(includedir)/bsd/sys/cdefs.h \
>$(DESTDIR)$(includedir)/bsd/sys/cdefs.h.new
mv $(DESTDIR)$(includedir)/bsd/sys/cdefs.h.new \
$(DESTDIR)$(includedir)/bsd/sys/cdefs.h
bsd/wchar.h \
$(nil)

View File

@ -26,56 +26,31 @@
*/
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#if __has_include_next(<err.h>)
#include_next <err.h>
#else
#define LIBBSD_NEED_ERR_H_FUNCS
#endif
#else
#include <bsd/sys/cdefs.h>
#if __has_include(<err.h>)
#include <err.h>
#else
#define LIBBSD_NEED_ERR_H_FUNCS
#endif
#endif
#ifndef LIBBSD_ERR_H
#define LIBBSD_ERR_H
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#else
#include <bsd/sys/cdefs.h>
#endif
#include <stdarg.h>
__BEGIN_DECLS
void vwarnc(int code, const char *format, va_list ap)
__printflike(2, 0);
void warnc(int code, const char *format, ...)
__printflike(2, 3);
void verrc(int status, int code, const char *format, va_list ap)
__printflike(3, 0) __dead2;
void vwarnc(int code, const char *format, va_list ap)
__printflike(2, 0);
void errc(int status, int code, const char *format, ...)
__printflike(3, 4) __dead2;
#ifdef LIBBSD_NEED_ERR_H_FUNCS
void vwarn(const char *format, va_list ap)
__printflike(1, 0);
void vwarnx(const char *format, va_list ap)
__printflike(1, 0);
void warn(const char *format, ...)
__printflike(1, 2);
void warnx(const char *format, ...)
__printflike(1, 2);
void verr(int status, const char *format, va_list ap)
__printflike(2, 0) __dead2;
void verrx(int status, const char *format, va_list ap)
__printflike(2, 0) __dead2;
void err(int status, const char *format, ...)
__printflike(2, 3) __dead2;
void errx(int status, const char *format, ...)
__printflike(2, 3) __dead2;
#endif
__printflike(3, 4);
void verrc(int status, int code, const char *format, va_list ap)
__printflike(3, 0);
__END_DECLS
#endif

View File

@ -25,15 +25,9 @@
*/
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#if __has_include_next(<getopt.h>)
#include_next <getopt.h>
#endif
#include <unistd.h>
#else
#include <bsd/sys/cdefs.h>
#if __has_include(<getopt.h>)
#include <getopt.h>
#endif
#include <bsd/unistd.h>
#endif

View File

@ -1,53 +0,0 @@
/*
* Copyright © 2021 Guillem Jover <guillem@hadrons.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#if __has_include_next(<grp.h>)
#include_next <grp.h>
#endif
#else
#include <bsd/sys/cdefs.h>
#if __has_include(<grp.h>)
#include <grp.h>
#endif
#endif
#ifndef LIBBSD_GRP_H
#define LIBBSD_GRP_H
#define _GR_BUF_LEN (1024 + 200 * sizeof(char *))
__BEGIN_DECLS
int
gid_from_group(const char *, gid_t *);
#ifndef __APPLE__
const char *
group_from_gid(gid_t, int);
#endif
__END_DECLS
#endif

View File

@ -1,49 +0,0 @@
/*
* Copyright © 2018 Guillem Jover <guillem@hadrons.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef LIBBSD_OVERLAY
#include_next <inttypes.h>
#else
#include <inttypes.h>
#endif
#ifndef LIBBSD_INTTYPES_H
#define LIBBSD_INTTYPES_H
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#else
#include <bsd/sys/cdefs.h>
#endif
__BEGIN_DECLS
intmax_t strtoi(const char *__restrict nptr, char **__restrict endptr,
int base, intmax_t lo, intmax_t hi, int *rstatus);
uintmax_t strtou(const char *__restrict nptr, char **__restrict endptr,
int base, uintmax_t lo, uintmax_t hi, int *rstatus);
__END_DECLS
#endif

View File

@ -36,19 +36,22 @@
* $FreeBSD: src/lib/libutil/libutil.h,v 1.47 2008/04/23 00:49:12 scf Exp $
*/
#ifndef LIBBSD_LIBUTIL_H
#define LIBBSD_LIBUTIL_H
#ifndef _LIBUTIL_H_
#define _LIBUTIL_H_
#ifdef LIBBSD_OVERLAY
#include <features.h>
#include <sys/cdefs.h>
#else
#include <bsd/sys/cdefs.h>
#endif
#include <sys/types.h>
#include <stdint.h>
#include <stdio.h>
struct pidfh;
/* for pidfile.c */
struct pidfh {
int pf_fd;
char *pf_path;
dev_t pf_dev;
ino_t pf_ino;
};
__BEGIN_DECLS
int humanize_number(char *buf, size_t len, int64_t bytes,
@ -56,10 +59,8 @@ int humanize_number(char *buf, size_t len, int64_t bytes,
int expand_number(const char *_buf, uint64_t *_num);
int flopen(const char *_path, int _flags, ...);
int flopenat(int dirfd, const char *path, int flags, ...);
struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr);
int pidfile_fileno(const struct pidfh *pfh);
int pidfile_write(struct pidfh *pfh);
int pidfile_close(struct pidfh *pfh);
int pidfile_remove(struct pidfh *pfh);
@ -67,16 +68,14 @@ int pidfile_remove(struct pidfh *pfh);
char *fparseln(FILE *, size_t *, size_t *, const char[3], int);
__END_DECLS
/* Values for humanize_number(3)'s flags parameter. */
#define HN_DECIMAL 0x01
#define HN_NOSPACE 0x02
#define HN_B 0x04
#define HN_DIVISOR_1000 0x08
#define HN_IEC_PREFIXES 0x10
/* humanize_number(3) */
#define HN_DECIMAL 0x01
#define HN_NOSPACE 0x02
#define HN_B 0x04
#define HN_DIVISOR_1000 0x08
/* Values for humanize_number(3)'s scale parameter. */
#define HN_GETSCALE 0x10
#define HN_AUTOSCALE 0x20
#define HN_GETSCALE 0x10
#define HN_AUTOSCALE 0x20
/*
* fparseln() specific operation flags.
@ -87,4 +86,4 @@ __END_DECLS
#define FPARSELN_UNESCREST 0x08
#define FPARSELN_UNESCALL 0x0f
#endif /* !LIBBSD_LIBUTIL_H */
#endif /* !_LIBUTIL_H_ */

View File

@ -1,33 +1,54 @@
/* $OpenBSD: md5.h,v 1.16 2004/06/22 01:57:30 jfb Exp $ */
/*
* Copyright © 2021 Guillem Jover <guillem@hadrons.org>
* This code implements the MD5 message-digest algorithm.
* The algorithm is due to Ron Rivest. This code was
* written by Colin Plumb in 1993, no copyright is claimed.
* This code is in the public domain; do with it what you wish.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Equivalent code is available from RSA Data Security, Inc.
* This code has been tested against that, and is equivalent,
* except that you don't need to include two pages of legalese
* with every copy.
*/
#ifndef _AIX
#ifdef LIBBSD_OVERLAY
#include_next <md5.h>
#else
#include <md5.h>
#endif
#endif
#ifndef _MD5_H_
#define _MD5_H_
#include <stdint.h>
#define MD5_BLOCK_LENGTH 64
#define MD5_DIGEST_LENGTH 16
#define MD5_DIGEST_STRING_LENGTH (MD5_DIGEST_LENGTH * 2 + 1)
typedef struct MD5Context {
uint32_t state[4]; /* state */
uint64_t count; /* number of bits, mod 2^64 */
uint8_t buffer[MD5_BLOCK_LENGTH]; /* input buffer */
} MD5_CTX;
#include <sys/cdefs.h>
#include <sys/types.h>
__BEGIN_DECLS
void MD5Init(MD5_CTX *);
void MD5Update(MD5_CTX *, const uint8_t *, size_t)
__attribute__((__bounded__(__string__,2,3)));
void MD5Pad(MD5_CTX *);
void MD5Final(uint8_t [MD5_DIGEST_LENGTH], MD5_CTX *)
__attribute__((__bounded__(__minbytes__,1,MD5_DIGEST_LENGTH)));
void MD5Transform(uint32_t [4], const uint8_t [MD5_BLOCK_LENGTH])
__attribute__((__bounded__(__minbytes__,1,4)))
__attribute__((__bounded__(__minbytes__,2,MD5_BLOCK_LENGTH)));
char *MD5End(MD5_CTX *, char *)
__attribute__((__bounded__(__minbytes__,2,MD5_DIGEST_STRING_LENGTH)));
char *MD5File(const char *, char *)
__attribute__((__bounded__(__minbytes__,2,MD5_DIGEST_STRING_LENGTH)));
char *MD5FileChunk(const char *, char *, off_t, off_t)
__attribute__((__bounded__(__minbytes__,2,MD5_DIGEST_STRING_LENGTH)));
char *MD5Data(const uint8_t *, size_t, char *)
__attribute__((__bounded__(__string__,1,2)))
__attribute__((__bounded__(__minbytes__,3,MD5_DIGEST_STRING_LENGTH)));
__END_DECLS
#endif /* _MD5_H_ */

View File

@ -30,10 +30,10 @@
* $FreeBSD: src/sys/netinet/ip_icmp.h,v 1.22 2004/04/07 20:46:13 imp Exp $
*/
#ifndef LIBBSD_NETINET_IP_ICMP_H
#define LIBBSD_NETINET_IP_ICMP_H
#ifndef _NETINET_IP_ICMP_H_
#define _NETINET_IP_ICMP_H_
#include <sys/types.h> /* uint32_t */
#include <sys/types.h> /* u_int32_t, u_char */
#include <netinet/in.h> /* in_addr */
#include <netinet/in_systm.h> /* n_short */
#include <netinet/ip.h> /* idi_ip */
@ -47,19 +47,19 @@
* Internal of an ICMP Router Advertisement
*/
struct icmp_ra_addr {
uint32_t ira_addr;
uint32_t ira_preference;
u_int32_t ira_addr;
u_int32_t ira_preference;
};
/*
* Structure of an icmp header.
*/
struct icmp {
unsigned char icmp_type; /* type of message, see below */
unsigned char icmp_code; /* type sub code */
unsigned short icmp_cksum; /* ones complement cksum of struct */
u_char icmp_type; /* type of message, see below */
u_char icmp_code; /* type sub code */
u_short icmp_cksum; /* ones complement cksum of struct */
union {
unsigned char ih_pptr; /* ICMP_PARAMPROB */
u_char ih_pptr; /* ICMP_PARAMPROB */
struct in_addr ih_gwaddr; /* ICMP_REDIRECT */
struct ih_idseq {
n_short icd_id;
@ -74,9 +74,9 @@ struct icmp {
} ih_pmtu;
struct ih_rtradv {
unsigned char irt_num_addrs;
unsigned char irt_wpa;
uint16_t irt_lifetime;
u_char irt_num_addrs;
u_char irt_wpa;
u_int16_t irt_lifetime;
} ih_rtradv;
} icmp_hun;
#define icmp_pptr icmp_hun.ih_pptr
@ -100,7 +100,7 @@ struct icmp {
/* options and then 64 bits of data */
} id_ip;
struct icmp_ra_addr id_radv;
uint32_t id_mask;
u_int32_t id_mask;
char id_data[1];
} icmp_dun;
#define icmp_otime icmp_dun.id_ts.its_otime

View File

@ -27,73 +27,8 @@
#ifndef LIBBSD_NLIST_H
#define LIBBSD_NLIST_H
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#else
#include <bsd/sys/cdefs.h>
#endif
struct nlist {
union {
char *n_name;
union {
char *n_name;
struct n_list *n_next;
long n_strx;
} n_un;
};
unsigned char n_type;
char n_other;
short n_desc;
unsigned long n_value;
};
#define n_hash n_desc /* used internally by ld(1); XXX */
/*
* Defines for n_type.
*/
#define N_UNDF 0x00 /* Undefined */
#define N_ABS 0x02 /* Absolute address */
#define N_TEXT 0x04 /* Text segment */
#define N_DATA 0x06 /* Data segment */
#define N_BSS 0x08 /* Bss segment */
#define N_INDR 0x0a /* Alias definition */
#define N_SIZE 0x0c /* Pseudo type, defines a symbol's size */
#define N_COMM 0x12 /* Common reference */
/* GNU extensions */
#define N_SETA 0x14 /* Absolute set element symbol */
#define N_SETT 0x16 /* Text set element symbol */
#define N_SETD 0x18 /* Data set element symbol */
#define N_SETB 0x1a /* Bss set element symbol */
#define N_SETV 0x1c /* Set vector symbol */
/* end GNU extensions */
#define N_FN 0x1e /* File name (N_EXT on) */
#define N_WARN 0x1e /* Warning message (N_EXT off) */
#define N_EXT 0x01 /* External (global) bit, OR'ed in */
#define N_TYPE 0x1e /* Mask for all the type bits */
#define N_STAB 0xe0 /* Mask for debugger symbols -- stab(5) */
#define N_NAME(p) ((p)->n_un.n_name)
/*
* Defines for n_other. It contains the ".type" (AUX) field in the least
* significant 4 bits, and the binding (for weak symbols) in the most
* significant 4 bits.
*/
#define N_AUX(p) ((p)->n_other & 0xf)
#define N_BIND(p) (((unsigned int)(p)->n_other >> 4) & 0xf)
#define N_OTHER(r, v) (((unsigned int)(r) << 4) | ((v) & 0xf))
#define AUX_OBJECT 1 /* Data object */
#define AUX_FUNC 2 /* Function */
/*#define BIND_LOCAL 0 Not used */
/*#define BIND_GLOBAL 1 Not used */
#define BIND_WEAK 2 /* Weak binding */
#define N_FORMAT "%08x" /* namelist value format; XXX */
#include <a.out.h>
__BEGIN_DECLS
extern int nlist(const char *filename, struct nlist *list);

View File

@ -1,53 +0,0 @@
/*
* Copyright © 2021 Guillem Jover <guillem@hadrons.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#if __has_include_next(<pwd.h>)
#include_next <pwd.h>
#endif
#else
#include <bsd/sys/cdefs.h>
#if __has_include(<pwd.h>)
#include <pwd.h>
#endif
#endif
#ifndef LIBBSD_PWD_H
#define LIBBSD_PWD_H
#define _PW_BUF_LEN 1024 /* length of getpw*_r buffer */
__BEGIN_DECLS
int
uid_from_user(const char *, uid_t *);
#ifndef __APPLE__
const char *
user_from_uid(uid_t, int);
#endif
__END_DECLS
#endif

View File

@ -20,8 +20,8 @@
* Materiel Command, USAF, under agreement number F39502-99-1-0512.
*/
#ifndef LIBBSD_READPASSPHRASE_H
#define LIBBSD_READPASSPHRASE_H
#ifndef _READPASSPHRASE_H_
#define _READPASSPHRASE_H_
#define RPP_ECHO_OFF 0x00 /* Turn off echo (default). */
#define RPP_ECHO_ON 0x01 /* Leave echo on. */
@ -31,15 +31,11 @@
#define RPP_SEVENBIT 0x10 /* Strip the high bit from input. */
#define RPP_STDIN 0x20 /* Read from stdin, not /dev/tty */
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#else
#include <bsd/sys/cdefs.h>
#endif
#include <sys/types.h>
__BEGIN_DECLS
char * readpassphrase(const char *, char *, size_t, int);
__END_DECLS
#endif /* !LIBBSD_READPASSPHRASE_H */
#endif /* !_READPASSPHRASE_H_ */

View File

@ -1,5 +1,5 @@
/*
* Copyright © 2004-2024 Guillem Jover <guillem@hadrons.org>
* Copyright © 2004-2005, 2009, 2011-2013 Guillem Jover <guillem@hadrons.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -38,32 +38,18 @@
#ifndef LIBBSD_STDIO_H
#define LIBBSD_STDIO_H
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#else
#include <bsd/sys/cdefs.h>
#endif
#include <sys/types.h>
#if defined(_AIX)
#include <stdarg.h>
#endif
__BEGIN_DECLS
#if defined(_AIX)
int asprintf(char **strp, char const *fmt, ...)
__printflike(2, 3);
int vasprintf(char **strp, char const *fmt, va_list args)
__printflike(2, 0);
#endif
const char *fmtcheck(const char *, const char *);
/* XXX: The function requires cooperation from the system libc to store the
* line buffer in the FILE struct itself. */
char *fgetln(FILE *fp, size_t *lenp)
LIBBSD_DEPRECATED("This functions cannot be safely ported, "
"use getline(3) instead, as it is supported "
"by GNU and POSIX.1-2008.");
__attribute__((deprecated("This functions cannot be safely ported, "
"use getline(3) instead, as it is supported "
"by GNU and POSIX.1-2008.")));
/*
* Note: We diverge from the FreeBSD, OpenBSD and DragonFlyBSD declarations,

View File

@ -42,35 +42,23 @@
#ifndef LIBBSD_STDLIB_H
#define LIBBSD_STDLIB_H
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#else
#include <bsd/sys/cdefs.h>
#endif
#include <sys/stat.h>
#include <stdint.h>
__BEGIN_DECLS
#if !defined(__APPLE__) && !defined(__sun)
#if !defined(__GLIBC__) || \
!__GLIBC_PREREQ(2, 36) || \
!defined(_DEFAULT_SOURCE)
uint32_t arc4random(void);
void arc4random_stir(void);
void arc4random_addrandom(u_char *dat, int datlen);
void arc4random_buf(void *_buf, size_t n);
uint32_t arc4random_uniform(uint32_t upper_bound);
#endif
void arc4random_stir(void);
void arc4random_addrandom(unsigned char *dat, int datlen);
#endif
int dehumanize_number(const char *str, int64_t *size);
#if !defined(__APPLE__)
const char *getprogname(void);
void setprogname(const char *);
#endif
int heapsort(void *, size_t, size_t, int (*)(const void *, const void *));
int heapsort (void *, size_t, size_t, int (*)(const void *, const void *));
int mergesort(void *base, size_t nmemb, size_t size,
int (*cmp)(const void *, const void *));
int radixsort(const unsigned char **base, int nmemb,
@ -79,14 +67,7 @@ int sradixsort(const unsigned char **base, int nmemb,
const unsigned char *table, unsigned endbyte);
void *reallocf(void *ptr, size_t size);
#if !defined(__GLIBC__) || \
!__GLIBC_PREREQ(2, 26) || \
(__GLIBC_PREREQ(2, 26) && !__GLIBC_PREREQ(2, 29) && !defined(_GNU_SOURCE)) || \
(__GLIBC_PREREQ(2, 29) && !defined(_DEFAULT_SOURCE))
void *reallocarray(void *ptr, size_t nmemb, size_t size);
#endif
void *recallocarray(void *ptr, size_t oldnmemb, size_t nmemb, size_t size);
void freezero(void *ptr, size_t size);
long long strtonum(const char *nptr, long long minval, long long maxval,
const char **errstr);

View File

@ -33,29 +33,16 @@
#ifndef LIBBSD_STRING_H
#define LIBBSD_STRING_H
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#else
#include <bsd/sys/cdefs.h>
#endif
#include <sys/types.h>
__BEGIN_DECLS
#if !defined(__APPLE__) && \
(!defined(__GLIBC__) || !__GLIBC_PREREQ(2, 38) || !defined(_DEFAULT_SOURCE))
size_t strlcpy(char *dst, const char *src, size_t siz);
size_t strlcat(char *dst, const char *src, size_t siz);
#endif
char *strnstr(const char *str, const char *find, size_t str_len);
#ifndef __APPLE__
void strmode(mode_t mode, char *str);
#endif
#if !defined(__GLIBC__) || \
!__GLIBC_PREREQ(2, 25) || \
!defined(_DEFAULT_SOURCE)
void explicit_bzero(void *buf, size_t len);
#endif
__END_DECLS
#endif

View File

@ -29,14 +29,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LIBBSD_STRINGLIST_H
#define LIBBSD_STRINGLIST_H
#ifdef LIBBSD_OVERLAY
#ifndef _STRINGLIST_H
#define _STRINGLIST_H
#include <sys/cdefs.h>
#else
#include <bsd/sys/cdefs.h>
#endif
#include <sys/types.h>
/*
@ -56,4 +51,4 @@ char *sl_find(StringList *, const char *);
int sl_delete(StringList *, const char *, int);
__END_DECLS
#endif /* LIBBSD_STRINGLIST_H */
#endif /* _STRINGLIST_H */

View File

@ -32,8 +32,8 @@
* $FreeBSD$
*/
#ifndef LIBBSD_SYS_BITSTRING_H
#define LIBBSD_SYS_BITSTRING_H
#ifndef _SYS_BITSTRING_H_
#define _SYS_BITSTRING_H_
typedef unsigned char bitstr_t;
@ -143,4 +143,4 @@ typedef unsigned char bitstr_t;
*(value) = _value; \
} while (0)
#endif /* !LIBBSD_SYS_BITSTRING_H */
#endif /* !_SYS_BITSTRING_H_ */

View File

@ -24,58 +24,15 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __has_include
#define __has_include(x) 1
#endif
#ifndef __has_include_next
#define __has_include_next(x) 1
#endif
#ifndef __has_attribute
#define __has_attribute(x) 0
#endif
/* Clang expands this to 1 if an identifier is *not* reserved. */
#ifndef __is_identifier
#define __is_identifier(x) 1
#endif
#ifndef __has_builtin
#define __has_builtin(x) !__is_identifier(x)
#endif
#ifdef LIBBSD_OVERLAY
/*
* Some libc implementations do not have a <sys/cdefs.h>, in particular
* musl, try to handle this gracefully.
*/
#if __has_include_next(<sys/cdefs.h>)
#include_next <sys/cdefs.h>
#endif
#else
#if __has_include(<sys/cdefs.h>)
#include <sys/cdefs.h>
#endif
#endif
#ifndef LIBBSD_SYS_CDEFS_H
#define LIBBSD_SYS_CDEFS_H
#ifndef __BEGIN_DECLS
#ifdef __cplusplus
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS }
#else
#define __BEGIN_DECLS
#define __END_DECLS
#endif
#endif
/*
* On non-glibc based systems, we cannot unconditionally use the
* __GLIBC_PREREQ macro as it gets expanded before evaluation.
*/
#ifndef __GLIBC_PREREQ
#define __GLIBC_PREREQ(maj, min) 0
#endif
/*
* Some kFreeBSD headers expect those macros to be set for sanity checks.
*/
@ -86,41 +43,14 @@
#define _SYS_CDEFS_H
#endif
/* Define the ABI for the current system. */
//#define LIBBSD_SYS_TIME_BITS 0
//#define LIBBSD_SYS_HAS_TIME64 0
#define LIBBSD_CONCAT(x, y) x ## y
#define LIBBSD_STRING(x) #x
#ifdef __GNUC__
#define LIBBSD_GCC_VERSION (__GNUC__ << 8 | __GNUC_MINOR__)
#else
#define LIBBSD_GCC_VERSION 0
#endif
#if LIBBSD_GCC_VERSION >= 0x0300 || __has_attribute(__unused__)
# define LIBBSD_UNUSED __attribute__((__unused__))
#else
# define LIBBSD_UNUSED
#endif
#if LIBBSD_GCC_VERSION >= 0x0405 || __has_attribute(__deprecated__)
#define LIBBSD_DEPRECATED(x) __attribute__((__deprecated__(x)))
#elif LIBBSD_GCC_VERSION >= 0x0301
#define LIBBSD_DEPRECATED(x) __attribute__((__deprecated__))
#else
#define LIBBSD_DEPRECATED(x)
#endif
#if LIBBSD_GCC_VERSION >= 0x0200 || defined(__clang__)
#define LIBBSD_REDIRECT(name, proto, alias) name proto __asm__(LIBBSD_ASMNAME(#alias))
#endif
#define LIBBSD_ASMNAME(cname) LIBBSD_ASMNAME_PREFIX(__USER_LABEL_PREFIX__, cname)
#define LIBBSD_ASMNAME_PREFIX(prefix, cname) LIBBSD_STRING(prefix) cname
#ifndef __dead2
# if LIBBSD_GCC_VERSION >= 0x0207 || __has_attribute(__noreturn__)
# if LIBBSD_GCC_VERSION >= 0x0207
# define __dead2 __attribute__((__noreturn__))
# else
# define __dead2
@ -128,7 +58,7 @@
#endif
#ifndef __pure2
# if LIBBSD_GCC_VERSION >= 0x0207 || __has_attribute(__const__)
# if LIBBSD_GCC_VERSION >= 0x0207
# define __pure2 __attribute__((__const__))
# else
# define __pure2
@ -136,7 +66,7 @@
#endif
#ifndef __packed
# if LIBBSD_GCC_VERSION >= 0x0207 || __has_attribute(__packed__)
# if LIBBSD_GCC_VERSION >= 0x0207
# define __packed __attribute__((__packed__))
# else
# define __packed
@ -144,7 +74,7 @@
#endif
#ifndef __aligned
# if LIBBSD_GCC_VERSION >= 0x0207 || __has_attribute(__aligned__)
# if LIBBSD_GCC_VERSION >= 0x0207
# define __aligned(x) __attribute__((__aligned__(x)))
# else
# define __aligned(x)
@ -156,20 +86,24 @@
* Disable for now. */
#if 0
#ifndef __unused
# define __unused LIBBSD_UNUSED
# if LIBBSD_GCC_VERSION >= 0x0300
# define __unused __attribute__((unused))
# else
# define __unused
# endif
#endif
#endif
#ifndef __printflike
# if LIBBSD_GCC_VERSION >= 0x0300 || __has_attribute(__format__)
# define __printflike(x, y) __attribute((__format__(__printf__, (x), (y))))
# if LIBBSD_GCC_VERSION >= 0x0300
# define __printflike(x, y) __attribute((format(printf, (x), (y))))
# else
# define __printflike(x, y)
# endif
#endif
#ifndef __nonnull
# if LIBBSD_GCC_VERSION >= 0x0302 || __has_attribute(__nonnull__)
# if LIBBSD_GCC_VERSION >= 0x0302
# define __nonnull(x) __attribute__((__nonnull__(x)))
# else
# define __nonnull(x)
@ -180,26 +114,20 @@
# define __bounded__(x, y, z)
#endif
/*
* Return the number of elements in a statically-allocated array,
* __x.
*/
#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0]))
/*
* We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
* require it.
*/
#ifndef __offsetof
# if LIBBSD_GCC_VERSION >= 0x0401 || __has_builtin(__builtin_offsetof)
# if LIBBSD_GCC_VERSION >= 0x0401
# define __offsetof(type, field) __builtin_offsetof(type, field)
# else
# ifndef __cplusplus
# define __offsetof(type, field) \
((size_t)(uintptr_t)((const volatile void *)&((type *)0)->field))
((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->field))
# else
# define __offsetof(type, field) \
(__offsetof__ (reinterpret_cast <size_t> \
(__offsetof__ (reinterpret_cast <__size_t> \
(&reinterpret_cast <const volatile char &> \
(static_cast<type *> (0)->field))))
# endif
@ -216,9 +144,9 @@
* compatible with member m.
*/
#ifndef __containerof
# if LIBBSD_GCC_VERSION >= 0x0301 || !__is_identifier(__typeof__)
# if LIBBSD_GCC_VERSION >= 0x0301
# define __containerof(x, s, m) ({ \
const volatile __typeof__(((s *)0)->m) *__x = (x); \
const volatile __typeof(((s *)0)->m) *__x = (x); \
__DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m)); \
})
# else
@ -252,15 +180,15 @@
#endif
#ifndef __DECONST
#define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
#define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var))
#endif
#ifndef __DEVOLATILE
#define __DEVOLATILE(type, var) ((type)(uintptr_t)(volatile void *)(var))
#define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var))
#endif
#ifndef __DEQUALIFY
#define __DEQUALIFY(type, var) ((type)(uintptr_t)(const volatile void *)(var))
#define __DEQUALIFY(type, var) ((type)(__uintptr_t)(const volatile void *)(var))
#endif
#endif

View File

@ -27,16 +27,10 @@
*/
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#if __has_include_next(<endian.h>)
#include_next <endian.h>
#endif
#else
#include <bsd/sys/cdefs.h>
#if __has_include(<endian.h>)
#include <endian.h>
#endif
#endif
#ifndef LIBBSD_SYS_ENDIAN_H
#define LIBBSD_SYS_ENDIAN_H

View File

@ -1,49 +0,0 @@
/*
* Copyright © 2018 Facebook, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#if __has_include_next(<sys/param.h>)
#include_next <sys/param.h>
#endif
#else
#include <bsd/sys/cdefs.h>
#if __has_include(<sys/param.h>)
#include <sys/param.h>
#endif
#endif
#ifndef LIBBSD_SYS_PARAM_H
#define LIBBSD_SYS_PARAM_H
#ifndef MIN
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#endif
#ifndef MAX
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#endif
#endif

View File

@ -1,6 +1,4 @@
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
@ -12,7 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -32,14 +30,10 @@
* $FreeBSD$
*/
#ifndef LIBBSD_SYS_QUEUE_H
#define LIBBSD_SYS_QUEUE_H
#ifndef _SYS_QUEUE_H_
#define _SYS_QUEUE_H_
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#else
#include <bsd/sys/cdefs.h>
#endif
/*
* This file defines four types of data structures: singly-linked lists,
@ -82,25 +76,17 @@
*
* For details on the use of these macros, see the queue(3) manual page.
*
* Below is a summary of implemented functions where:
* + means the macro is available
* - means the macro is not available
* s means the macro is available but is slow (runs in O(n) time)
*
* SLIST LIST STAILQ TAILQ
* _HEAD + + + +
* _CLASS_HEAD + + + +
* _HEAD_INITIALIZER + + + +
* _ENTRY + + + +
* _CLASS_ENTRY + + + +
* _INIT + + + +
* _EMPTY + + + +
* _END + + + +
* _FIRST + + + +
* _NEXT + + + +
* _PREV - + - +
* _LAST - - + +
* _LAST_FAST - - - +
* _FOREACH + + + +
* _FOREACH_FROM + + + +
* _FOREACH_SAFE + + + +
@ -113,20 +99,14 @@
* _INSERT_BEFORE - + - +
* _INSERT_AFTER + + + +
* _INSERT_TAIL - - + +
* _CONCAT s s + +
* _CONCAT - - + +
* _REMOVE_AFTER + - + -
* _REMOVE_HEAD + - + -
* _REMOVE s + s +
* _REMOVE + + + +
* _SWAP + + + +
*
*/
#ifdef QUEUE_MACRO_DEBUG
#warn Use QUEUE_MACRO_DEBUG_TRACE and/or QUEUE_MACRO_DEBUG_TRASH
#define QUEUE_MACRO_DEBUG_TRACE
#define QUEUE_MACRO_DEBUG_TRASH
#endif
#ifdef QUEUE_MACRO_DEBUG_TRACE
/* Store the last 2 places the queue element or head was altered */
struct qm_trace {
unsigned long lastline;
@ -136,7 +116,9 @@ struct qm_trace {
};
#define TRACEBUF struct qm_trace trace;
#define TRACEBUF_INITIALIZER { __LINE__, 0, __FILE__, NULL } ,
#define TRACEBUF_INITIALIZER { __FILE__, __LINE__, NULL, 0 } ,
#define TRASHIT(x) do {(x) = (void *)-1;} while (0)
#define QMD_SAVELINK(name, link) void **name = (void *)&(link)
#define QMD_TRACE_HEAD(head) do { \
(head)->trace.prevline = (head)->trace.lastline; \
@ -152,31 +134,14 @@ struct qm_trace {
(elem)->trace.lastfile = __FILE__; \
} while (0)
#else /* !QUEUE_MACRO_DEBUG_TRACE */
#else
#define QMD_TRACE_ELEM(elem)
#define QMD_TRACE_HEAD(head)
#define QMD_SAVELINK(name, link)
#define TRACEBUF
#define TRACEBUF_INITIALIZER
#endif /* QUEUE_MACRO_DEBUG_TRACE */
#ifdef QUEUE_MACRO_DEBUG_TRASH
#define QMD_SAVELINK(name, link) void **name = (void *)&(link)
#define TRASHIT(x) do {(x) = (void *)-1;} while (0)
#define QMD_IS_TRASHED(x) ((x) == (void *)(intptr_t)-1)
#else /* !QUEUE_MACRO_DEBUG_TRASH */
#define QMD_SAVELINK(name, link)
#define TRASHIT(x)
#define QMD_IS_TRASHED(x) 0
#endif /* QUEUE_MACRO_DEBUG_TRASH */
#ifdef __cplusplus
/*
* In C++ there can be structure lists and class lists:
*/
#define QUEUE_TYPEOF(type) type
#else
#define QUEUE_TYPEOF(type) struct type
#endif
#endif /* QUEUE_MACRO_DEBUG */
/*
* Singly-linked List declarations.
@ -186,11 +151,6 @@ struct name { \
struct type *slh_first; /* first element */ \
}
#define SLIST_CLASS_HEAD(name, type) \
struct name { \
class type *slh_first; /* first element */ \
}
#define SLIST_HEAD_INITIALIZER(head) \
{ NULL }
@ -199,37 +159,9 @@ struct { \
struct type *sle_next; /* next element */ \
}
#define SLIST_CLASS_ENTRY(type) \
struct { \
class type *sle_next; /* next element */ \
}
/*
* Singly-linked List functions.
*/
#if (defined(_KERNEL) && defined(INVARIANTS))
#define QMD_SLIST_CHECK_PREVPTR(prevp, elm) do { \
if (*(prevp) != (elm)) \
panic("Bad prevptr *(%p) == %p != %p", \
(prevp), *(prevp), (elm)); \
} while (0)
#else
#define QMD_SLIST_CHECK_PREVPTR(prevp, elm)
#endif
#define SLIST_CONCAT(head1, head2, type, field) do { \
QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head1); \
if (curelm == NULL) { \
if ((SLIST_FIRST(head1) = SLIST_FIRST(head2)) != NULL) \
SLIST_INIT(head2); \
} else if (SLIST_FIRST(head2) != NULL) { \
while (SLIST_NEXT(curelm, field) != NULL) \
curelm = SLIST_NEXT(curelm, field); \
SLIST_NEXT(curelm, field) = SLIST_FIRST(head2); \
SLIST_INIT(head2); \
} \
} while (0)
#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
#define SLIST_FIRST(head) ((head)->slh_first)
@ -281,7 +213,7 @@ struct { \
SLIST_REMOVE_HEAD((head), field); \
} \
else { \
QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head); \
struct type *curelm = SLIST_FIRST((head)); \
while (SLIST_NEXT(curelm, field) != (elm)) \
curelm = SLIST_NEXT(curelm, field); \
SLIST_REMOVE_AFTER(curelm, field); \
@ -298,20 +230,12 @@ struct { \
SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \
} while (0)
#define SLIST_REMOVE_PREVPTR(prevp, elm, field) do { \
QMD_SLIST_CHECK_PREVPTR(prevp, elm); \
*(prevp) = SLIST_NEXT(elm, field); \
TRASHIT((elm)->field.sle_next); \
} while (0)
#define SLIST_SWAP(head1, head2, type) do { \
QUEUE_TYPEOF(type) *swap_first = SLIST_FIRST(head1); \
struct type *swap_first = SLIST_FIRST(head1); \
SLIST_FIRST(head1) = SLIST_FIRST(head2); \
SLIST_FIRST(head2) = swap_first; \
} while (0)
#define SLIST_END(head) NULL
/*
* Singly-linked Tail queue declarations.
*/
@ -321,12 +245,6 @@ struct name { \
struct type **stqh_last;/* addr of last next element */ \
}
#define STAILQ_CLASS_HEAD(name, type) \
struct name { \
class type *stqh_first; /* first element */ \
class type **stqh_last; /* addr of last next element */ \
}
#define STAILQ_HEAD_INITIALIZER(head) \
{ NULL, &(head).stqh_first }
@ -335,11 +253,6 @@ struct { \
struct type *stqe_next; /* next element */ \
}
#define STAILQ_CLASS_ENTRY(type) \
struct { \
class type *stqe_next; /* next element */ \
}
/*
* Singly-linked Tail queue functions.
*/
@ -398,10 +311,9 @@ struct { \
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
} while (0)
#define STAILQ_LAST(head, type, field) \
(STAILQ_EMPTY((head)) ? NULL : \
__containerof((head)->stqh_last, \
QUEUE_TYPEOF(type), field.stqe_next))
#define STAILQ_LAST(head, type, field) \
(STAILQ_EMPTY((head)) ? NULL : \
__containerof((head)->stqh_last, struct type, field.stqe_next))
#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
@ -411,7 +323,7 @@ struct { \
STAILQ_REMOVE_HEAD((head), field); \
} \
else { \
QUEUE_TYPEOF(type) *curelm = STAILQ_FIRST(head); \
struct type *curelm = STAILQ_FIRST((head)); \
while (STAILQ_NEXT(curelm, field) != (elm)) \
curelm = STAILQ_NEXT(curelm, field); \
STAILQ_REMOVE_AFTER(head, curelm, field); \
@ -432,8 +344,8 @@ struct { \
} while (0)
#define STAILQ_SWAP(head1, head2, type) do { \
QUEUE_TYPEOF(type) *swap_first = STAILQ_FIRST(head1); \
QUEUE_TYPEOF(type) **swap_last = (head1)->stqh_last; \
struct type *swap_first = STAILQ_FIRST(head1); \
struct type **swap_last = (head1)->stqh_last; \
STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \
(head1)->stqh_last = (head2)->stqh_last; \
STAILQ_FIRST(head2) = swap_first; \
@ -444,8 +356,6 @@ struct { \
(head2)->stqh_last = &STAILQ_FIRST(head2); \
} while (0)
#define STAILQ_END(head) NULL
/*
* List declarations.
@ -455,11 +365,6 @@ struct name { \
struct type *lh_first; /* first element */ \
}
#define LIST_CLASS_HEAD(name, type) \
struct name { \
class type *lh_first; /* first element */ \
}
#define LIST_HEAD_INITIALIZER(head) \
{ NULL }
@ -469,23 +374,11 @@ struct { \
struct type **le_prev; /* address of previous next element */ \
}
#define LIST_CLASS_ENTRY(type) \
struct { \
class type *le_next; /* next element */ \
class type **le_prev; /* address of previous next element */ \
}
/*
* List functions.
*/
#if (defined(_KERNEL) && defined(INVARIANTS))
/*
* QMD_LIST_CHECK_HEAD(LIST_HEAD *head, LIST_ENTRY NAME)
*
* If the list is non-empty, validates that the first element of the list
* points back at 'head.'
*/
#define QMD_LIST_CHECK_HEAD(head, field) do { \
if (LIST_FIRST((head)) != NULL && \
LIST_FIRST((head))->field.le_prev != \
@ -493,12 +386,6 @@ struct { \
panic("Bad list head %p first->prev != head", (head)); \
} while (0)
/*
* QMD_LIST_CHECK_NEXT(TYPE *elm, LIST_ENTRY NAME)
*
* If an element follows 'elm' in the list, validates that the next element
* points back at 'elm.'
*/
#define QMD_LIST_CHECK_NEXT(elm, field) do { \
if (LIST_NEXT((elm), field) != NULL && \
LIST_NEXT((elm), field)->field.le_prev != \
@ -506,11 +393,6 @@ struct { \
panic("Bad link elm %p next->prev != elm", (elm)); \
} while (0)
/*
* QMD_LIST_CHECK_PREV(TYPE *elm, LIST_ENTRY NAME)
*
* Validates that the previous element (or head of the list) points to 'elm.'
*/
#define QMD_LIST_CHECK_PREV(elm, field) do { \
if (*(elm)->field.le_prev != (elm)) \
panic("Bad link elm %p prev->next != elm", (elm)); \
@ -521,23 +403,6 @@ struct { \
#define QMD_LIST_CHECK_PREV(elm, field)
#endif /* (_KERNEL && INVARIANTS) */
#define LIST_CONCAT(head1, head2, type, field) do { \
QUEUE_TYPEOF(type) *curelm = LIST_FIRST(head1); \
if (curelm == NULL) { \
if ((LIST_FIRST(head1) = LIST_FIRST(head2)) != NULL) { \
LIST_FIRST(head2)->field.le_prev = \
&LIST_FIRST((head1)); \
LIST_INIT(head2); \
} \
} else if (LIST_FIRST(head2) != NULL) { \
while (LIST_NEXT(curelm, field) != NULL) \
curelm = LIST_NEXT(curelm, field); \
LIST_NEXT(curelm, field) = LIST_FIRST(head2); \
LIST_FIRST(head2)->field.le_prev = &LIST_NEXT(curelm, field); \
LIST_INIT(head2); \
} \
} while (0)
#define LIST_EMPTY(head) ((head)->lh_first == NULL)
#define LIST_FIRST(head) ((head)->lh_first)
@ -593,10 +458,9 @@ struct { \
#define LIST_NEXT(elm, field) ((elm)->field.le_next)
#define LIST_PREV(elm, head, type, field) \
((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL : \
__containerof((elm)->field.le_prev, \
QUEUE_TYPEOF(type), field.le_next))
#define LIST_PREV(elm, head, type, field) \
((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL : \
__containerof((elm)->field.le_prev, struct type, field.le_next))
#define LIST_REMOVE(elm, field) do { \
QMD_SAVELINK(oldnext, (elm)->field.le_next); \
@ -612,7 +476,7 @@ struct { \
} while (0)
#define LIST_SWAP(head1, head2, type, field) do { \
QUEUE_TYPEOF(type) *swap_tmp = LIST_FIRST(head1); \
struct type *swap_tmp = LIST_FIRST((head1)); \
LIST_FIRST((head1)) = LIST_FIRST((head2)); \
LIST_FIRST((head2)) = swap_tmp; \
if ((swap_tmp = LIST_FIRST((head1))) != NULL) \
@ -621,8 +485,6 @@ struct { \
swap_tmp->field.le_prev = &LIST_FIRST((head2)); \
} while (0)
#define LIST_END(head) NULL
/*
* Tail queue declarations.
*/
@ -633,13 +495,6 @@ struct name { \
TRACEBUF \
}
#define TAILQ_CLASS_HEAD(name, type) \
struct name { \
class type *tqh_first; /* first element */ \
class type **tqh_last; /* addr of last next element */ \
TRACEBUF \
}
#define TAILQ_HEAD_INITIALIZER(head) \
{ NULL, &(head).tqh_first, TRACEBUF_INITIALIZER }
@ -650,23 +505,10 @@ struct { \
TRACEBUF \
}
#define TAILQ_CLASS_ENTRY(type) \
struct { \
class type *tqe_next; /* next element */ \
class type **tqe_prev; /* address of previous next element */ \
TRACEBUF \
}
/*
* Tail queue functions.
*/
#if (defined(_KERNEL) && defined(INVARIANTS))
/*
* QMD_TAILQ_CHECK_HEAD(TAILQ_HEAD *head, TAILQ_ENTRY NAME)
*
* If the tailq is non-empty, validates that the first element of the tailq
* points back at 'head.'
*/
#define QMD_TAILQ_CHECK_HEAD(head, field) do { \
if (!TAILQ_EMPTY(head) && \
TAILQ_FIRST((head))->field.tqe_prev != \
@ -674,22 +516,11 @@ struct { \
panic("Bad tailq head %p first->prev != head", (head)); \
} while (0)
/*
* QMD_TAILQ_CHECK_TAIL(TAILQ_HEAD *head, TAILQ_ENTRY NAME)
*
* Validates that the tail of the tailq is a pointer to pointer to NULL.
*/
#define QMD_TAILQ_CHECK_TAIL(head, field) do { \
if (*(head)->tqh_last != NULL) \
panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); \
} while (0)
/*
* QMD_TAILQ_CHECK_NEXT(TYPE *elm, TAILQ_ENTRY NAME)
*
* If an element follows 'elm' in the tailq, validates that the next element
* points back at 'elm.'
*/
#define QMD_TAILQ_CHECK_NEXT(elm, field) do { \
if (TAILQ_NEXT((elm), field) != NULL && \
TAILQ_NEXT((elm), field)->field.tqe_prev != \
@ -697,11 +528,6 @@ struct { \
panic("Bad link elm %p next->prev != elm", (elm)); \
} while (0)
/*
* QMD_TAILQ_CHECK_PREV(TYPE *elm, TAILQ_ENTRY NAME)
*
* Validates that the previous element (or head of the tailq) points to 'elm.'
*/
#define QMD_TAILQ_CHECK_PREV(elm, field) do { \
if (*(elm)->field.tqe_prev != (elm)) \
panic("Bad link elm %p prev->next != elm", (elm)); \
@ -786,7 +612,7 @@ struct { \
TAILQ_NEXT((listelm), field) = (elm); \
(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \
QMD_TRACE_ELEM(&(elm)->field); \
QMD_TRACE_ELEM(&(listelm)->field); \
QMD_TRACE_ELEM(&listelm->field); \
} while (0)
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
@ -796,7 +622,7 @@ struct { \
*(listelm)->field.tqe_prev = (elm); \
(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \
QMD_TRACE_ELEM(&(elm)->field); \
QMD_TRACE_ELEM(&(listelm)->field); \
QMD_TRACE_ELEM(&listelm->field); \
} while (0)
#define TAILQ_INSERT_HEAD(head, elm, field) do { \
@ -825,25 +651,11 @@ struct { \
#define TAILQ_LAST(head, headname) \
(*(((struct headname *)((head)->tqh_last))->tqh_last))
/*
* The FAST function is fast in that it causes no data access other
* then the access to the head. The standard LAST function above
* will cause a data access of both the element you want and
* the previous element. FAST is very useful for instances when
* you may want to prefetch the last data element.
*/
#define TAILQ_LAST_FAST(head, type, field) \
(TAILQ_EMPTY(head) ? NULL : __containerof((head)->tqh_last, QUEUE_TYPEOF(type), field.tqe_next))
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
#define TAILQ_PREV(elm, headname, field) \
(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
#define TAILQ_PREV_FAST(elm, head, type, field) \
((elm)->field.tqe_prev == &(head)->tqh_first ? NULL : \
__containerof((elm)->field.tqe_prev, QUEUE_TYPEOF(type), field.tqe_next))
#define TAILQ_REMOVE(head, elm, field) do { \
QMD_SAVELINK(oldnext, (elm)->field.tqe_next); \
QMD_SAVELINK(oldprev, (elm)->field.tqe_prev); \
@ -863,8 +675,8 @@ struct { \
} while (0)
#define TAILQ_SWAP(head1, head2, type, field) do { \
QUEUE_TYPEOF(type) *swap_first = (head1)->tqh_first; \
QUEUE_TYPEOF(type) **swap_last = (head1)->tqh_last; \
struct type *swap_first = (head1)->tqh_first; \
struct type **swap_last = (head1)->tqh_last; \
(head1)->tqh_first = (head2)->tqh_first; \
(head1)->tqh_last = (head2)->tqh_last; \
(head2)->tqh_first = swap_first; \
@ -879,6 +691,4 @@ struct { \
(head2)->tqh_last = &(head2)->tqh_first; \
} while (0)
#define TAILQ_END(head) NULL
#endif /* !LIBBSD_SYS_QUEUE_H */
#endif /* !_SYS_QUEUE_H_ */

View File

@ -1,144 +0,0 @@
/* $OpenBSD: time.h,v 1.36 2016/09/12 19:41:20 guenther Exp $ */
/* $NetBSD: time.h,v 1.18 1996/04/23 10:29:33 mycroft Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)time.h 8.2 (Berkeley) 7/10/94
*/
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#if __has_include_next(<sys/time.h>)
#include_next <sys/time.h>
#endif
#else
#include <bsd/sys/cdefs.h>
#if __has_include(<sys/time.h>)
#include <sys/time.h>
#endif
#endif
#ifndef LIBBSD_SYS_TIME_H
#define LIBBSD_SYS_TIME_H
#ifndef TIMEVAL_TO_TIMESPEC
#define TIMEVAL_TO_TIMESPEC(tv, ts) { \
(ts)->tv_sec = (tv)->tv_sec; \
(ts)->tv_nsec = (tv)->tv_usec * 1000; \
}
#endif
#ifndef TIMESPEC_TO_TIMEVAL
#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
(tv)->tv_sec = (ts)->tv_sec; \
(tv)->tv_usec = (ts)->tv_nsec / 1000; \
}
#endif
/* Operations on timevals. */
#ifndef timerclear
#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
#endif
#ifndef timerisset
#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
#endif
#ifndef timercmp
#define timercmp(tvp, uvp, cmp) \
(((tvp)->tv_sec == (uvp)->tv_sec) ? \
((tvp)->tv_usec cmp (uvp)->tv_usec) : \
((tvp)->tv_sec cmp (uvp)->tv_sec))
#endif
#ifndef timeradd
#define timeradd(tvp, uvp, vvp) \
do { \
(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
(vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
if ((vvp)->tv_usec >= 1000000) { \
(vvp)->tv_sec++; \
(vvp)->tv_usec -= 1000000; \
} \
} while (0)
#endif
#ifndef timersub
#define timersub(tvp, uvp, vvp) \
do { \
(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
if ((vvp)->tv_usec < 0) { \
(vvp)->tv_sec--; \
(vvp)->tv_usec += 1000000; \
} \
} while (0)
#endif
/* Operations on timespecs. */
#ifndef timespecclear
#define timespecclear(tsp) (tsp)->tv_sec = (tsp)->tv_nsec = 0
#endif
#ifndef timespecisset
#define timespecisset(tsp) ((tsp)->tv_sec || (tsp)->tv_nsec)
#endif
#ifndef timespeccmp
#define timespeccmp(tsp, usp, cmp) \
(((tsp)->tv_sec == (usp)->tv_sec) ? \
((tsp)->tv_nsec cmp (usp)->tv_nsec) : \
((tsp)->tv_sec cmp (usp)->tv_sec))
#endif
#ifndef timespecadd
#define timespecadd(tsp, usp, vsp) \
do { \
(vsp)->tv_sec = (tsp)->tv_sec + (usp)->tv_sec; \
(vsp)->tv_nsec = (tsp)->tv_nsec + (usp)->tv_nsec; \
if ((vsp)->tv_nsec >= 1000000000L) { \
(vsp)->tv_sec++; \
(vsp)->tv_nsec -= 1000000000L; \
} \
} while (0)
#endif
#ifndef timespecsub
#define timespecsub(tsp, usp, vsp) \
do { \
(vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \
(vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \
if ((vsp)->tv_nsec < 0) { \
(vsp)->tv_sec--; \
(vsp)->tv_nsec += 1000000000L; \
} \
} while (0)
#endif
#endif

View File

@ -27,14 +27,10 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LIBBSD_SYS_TREE_H
#define LIBBSD_SYS_TREE_H
#ifndef _SYS_TREE_H_
#define _SYS_TREE_H_
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#else
#include <bsd/sys/cdefs.h>
#endif
/*
* This file defines data structures for different types of trees:
@ -385,7 +381,7 @@ struct { \
#define RB_PROTOTYPE(name, type, field, cmp) \
RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
#define RB_PROTOTYPE_STATIC(name, type, field, cmp) \
RB_PROTOTYPE_INTERNAL(name, type, field, cmp, LIBBSD_UNUSED static)
RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static)
#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \
attr void name##_RB_INSERT_COLOR(struct name *, struct type *); \
attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\
@ -404,7 +400,7 @@ attr struct type *name##_RB_MINMAX(struct name *, int); \
#define RB_GENERATE(name, type, field, cmp) \
RB_GENERATE_INTERNAL(name, type, field, cmp,)
#define RB_GENERATE_STATIC(name, type, field, cmp) \
RB_GENERATE_INTERNAL(name, type, field, cmp, LIBBSD_UNUSED static)
RB_GENERATE_INTERNAL(name, type, field, cmp, __unused static)
#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \
attr void \
name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \
@ -766,4 +762,4 @@ name##_RB_MINMAX(struct name *head, int val) \
((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \
(x) = (y))
#endif /* LIBBSD_SYS_TREE_H */
#endif /* _SYS_TREE_H_ */

View File

@ -38,14 +38,10 @@
* $FreeBSD$
*/
#ifndef LIBBSD_TIMECONV_H
#define LIBBSD_TIMECONV_H
#ifndef _TIMECONV_H_
#define _TIMECONV_H_
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#else
#include <bsd/sys/cdefs.h>
#endif
#include <stdint.h>
#include <time.h>
@ -58,17 +54,4 @@ time_t _long_to_time(long tlong);
int _time_to_int(time_t t);
time_t _int_to_time(int tint);
#if LIBBSD_SYS_TIME_BITS == 32 && LIBBSD_SYS_HAS_TIME64
#if defined _TIME_BITS && _TIME_BITS == 64
time_t LIBBSD_REDIRECT(_time32_to_time, (int32_t t32), _time32_to_time_time64);
int32_t LIBBSD_REDIRECT(_time_to_time32, (time_t t), _time_to_time32_time64);
time_t LIBBSD_REDIRECT(_time64_to_time, (int64_t t64), _time64_to_time_time64);
int64_t LIBBSD_REDIRECT(_time_to_time64, (time_t t), _time_to_time64_time64);
long LIBBSD_REDIRECT(_time_to_long, (time_t t), _time_to_long_time64);
time_t LIBBSD_REDIRECT(_long_to_time, (long tlong), _long_to_time_time64);
int LIBBSD_REDIRECT(_time_to_int, (time_t t), _time_to_int_time64);
time_t LIBBSD_REDIRECT(_int_to_time, (int tint), _int_to_time_time64);
#endif
#endif
#endif /* LIBBSD_TIMECONV_H */
#endif /* _TIMECONV_H_ */

View File

@ -26,28 +26,26 @@
*/
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#if __has_include_next(<unistd.h>)
#include_next <unistd.h>
#endif
#else
#include <bsd/sys/cdefs.h>
#if __has_include(<unistd.h>)
#include <unistd.h>
#endif
#endif
#ifndef LIBBSD_UNISTD_H
#define LIBBSD_UNISTD_H
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#else
#include <bsd/sys/cdefs.h>
#endif
#include <sys/stat.h>
#if !defined(S_ISTXT) && defined(S_ISVTX)
#ifndef S_ISTXT
#define S_ISTXT S_ISVTX
#endif
__BEGIN_DECLS
#if !defined(__APPLE__)
extern int optreset;
#ifdef LIBBSD_OVERLAY
@ -56,16 +54,11 @@ 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);
#if !defined(__GLIBC__) || \
!__GLIBC_PREREQ(2, 34) || \
!defined(_DEFAULT_SOURCE)
void closefrom(int lowfd);
#endif
/* Compatibility with sendmail implementations. */
#define initsetproctitle(c, a, e) setproctitle_init((c), (a), (e))

View File

@ -1,5 +1,3 @@
/* $NetBSD: vis.h,v 1.25 2017/04/23 01:57:36 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@ -29,44 +27,36 @@
* SUCH DAMAGE.
*
* @(#)vis.h 8.1 (Berkeley) 6/2/93
* $FreeBSD: src/include/vis.h,v 1.11 2003/10/30 10:40:49 phk Exp $
*/
#ifndef LIBBSD_VIS_H
#define LIBBSD_VIS_H
#ifndef _VIS_H_
#define _VIS_H_
#include <sys/types.h>
/*
* to select alternate encoding format
*/
#define VIS_OCTAL 0x0001 /* use octal \ddd format */
#define VIS_CSTYLE 0x0002 /* use \[nrft0..] where appropriate */
#define VIS_OCTAL 0x01 /* use octal \ddd format */
#define VIS_CSTYLE 0x02 /* use \[nrft0..] where appropriate */
/*
* to alter set of characters encoded (default is to encode all
* non-graphic except space, tab, and newline).
*/
#define VIS_SP 0x0004 /* also encode space */
#define VIS_TAB 0x0008 /* also encode tab */
#define VIS_NL 0x0010 /* also encode newline */
#define VIS_SP 0x04 /* also encode space */
#define VIS_TAB 0x08 /* also encode tab */
#define VIS_NL 0x10 /* also encode newline */
#define VIS_WHITE (VIS_SP | VIS_TAB | VIS_NL)
#define VIS_SAFE 0x0020 /* only encode "unsafe" characters */
#define VIS_DQ 0x8000 /* also encode double quotes */
#define VIS_SAFE 0x20 /* only encode "unsafe" characters */
/*
* other
*/
#define VIS_NOSLASH 0x0040 /* inhibit printing '\' */
#define VIS_HTTP1808 0x0080 /* http-style escape % hex hex */
#define VIS_HTTPSTYLE 0x0080 /* http-style escape % hex hex */
#define VIS_MIMESTYLE 0x0100 /* mime-style escape = HEX HEX */
#define VIS_HTTP1866 0x0200 /* http-style &#num; or &string; */
#define VIS_NOESCAPE 0x0400 /* don't decode `\' */
#define _VIS_END 0x0800 /* for unvis */
#define VIS_GLOB 0x1000 /* encode glob(3) magic characters */
#define VIS_SHELL 0x2000 /* encode shell special characters [not glob] */
#define VIS_META (VIS_WHITE | VIS_GLOB | VIS_SHELL)
#define VIS_NOLOCALE 0x4000 /* encode using the C locale */
#define VIS_NOSLASH 0x40 /* inhibit printing '\' */
#define VIS_HTTPSTYLE 0x80 /* http-style escape % HEX HEX */
#define VIS_GLOB 0x100 /* encode glob(3) magics */
/*
* unvis return codes
@ -80,77 +70,19 @@
/*
* unvis flags
*/
#define UNVIS_END _VIS_END /* no more characters */
#define UNVIS_END 1 /* no more characters */
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#else
#include <bsd/sys/cdefs.h>
#endif
/*
* NetBSD added an strnvis and unfortunately made it incompatible with the
* existing one in OpenBSD and Freedesktop's libbsd (the former having existed
* for over ten years). Despite this incompatibility being reported during
* development (see http://gnats.netbsd.org/44977) they still shipped it.
* Even more unfortunately FreeBSD and later macOS picked up this incompatible
* implementation.
*
* Provide both implementations and default for now on the historical one to
* avoid breakage, we will switch to the NetBSD one in libbsd 0.10.0 or so.
* Define LIBBSD_NETBSD_VIS to switch to the NetBSD one now.
* Define LIBBSD_OPENBSD_VIS to keep using the OpenBSD one.
*/
#if defined(LIBBSD_OPENBSD_VIS)
#undef LIBBSD_NETBSD_VIS
#elif !defined(LIBBSD_NETBSD_VIS)
#warning "NetBSD added incompatible strnvis() and strnunvis(), please see <bsd/vis.h> for more detils."
#endif
__BEGIN_DECLS
char *vis(char *, int, int, int);
char *nvis(char *, size_t, int, int, int);
char *svis(char *, int, int, int, const char *);
char *snvis(char *, size_t, int, int, int, const char *);
int strvis(char *, const char *, int);
int stravis(char **, const char *, int);
#ifdef LIBBSD_NETBSD_VIS
/* NetBSD prototype. */
int LIBBSD_REDIRECT(strnvis, (char *, size_t, const char *, int),
strnvis_netbsd);
#else
/* OpenBSD prototype (current default). */
int strnvis(char *, const char *, size_t, int);
#endif
int strsvis(char *, const char *, int, const char *);
int strsnvis(char *, size_t, const char *, int, const char *);
int strvisx(char *, const char *, size_t, int);
int strnvisx(char *, size_t, const char *, size_t, int);
int strenvisx(char *, size_t, const char *, size_t, int, int *);
int strsvisx(char *, const char *, size_t, int, const char *);
int strsnvisx(char *, size_t, const char *, size_t, int, const char *);
int strsenvisx(char *, size_t, const char *, size_t , int, const char *,
int *);
int strnvis(char *, const char *, size_t, int);
int strunvis(char *, const char *);
#ifdef LIBBSD_NETBSD_VIS
/* NetBSD prototype. */
int LIBBSD_REDIRECT(strnunvis, (char *, size_t, const char *),
strnunvis_netbsd);
#else
/* OpenBSD prototype (current default). */
ssize_t strnunvis(char *, const char *, size_t);
#endif
int strunvisx(char *, const char *, int);
int strnunvisx(char *, size_t, const char *, int);
ssize_t strnunvis(char *, const char *, size_t);
int unvis(char *, int, int *, int);
__END_DECLS
#endif /* !LIBBSD_VIS_H */
#endif /* !_VIS_H_ */

View File

@ -40,20 +40,14 @@
#define LIBBSD_WCHAR_H
#include <stddef.h>
#ifdef LIBBSD_OVERLAY
#include <sys/cdefs.h>
#else
#include <bsd/sys/cdefs.h>
#endif
#include <sys/types.h>
__BEGIN_DECLS
wchar_t *fgetwln(FILE *stream, size_t *len);
#if !defined(__APPLE__)
size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size);
size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t size);
#endif
__END_DECLS
#endif

2
m4/.gitignore vendored
View File

@ -1,2 +0,0 @@
*.m4
!libbsd*.m4

View File

@ -1,104 +0,0 @@
# Copyright © 2021 Guillem Jover <guillem@hadrons.org>
# LIBBSD_CHECK_COMPILER_FLAG
# --------------------------
AC_DEFUN([LIBBSD_CHECK_COMPILER_FLAG], [
AS_VAR_PUSHDEF([libbsd_varname_cache], [libbsd_cv_cflags_$1])
AC_CACHE_CHECK([whether $CC accepts $1], [libbsd_varname_cache], [
m4_define([libbsd_check_flag], m4_bpatsubst([$1], [^-Wno-], [-W]))
AS_VAR_COPY([libbsd_save_CFLAGS], [CFLAGS])
AS_VAR_SET([CFLAGS], ["-Werror libbsd_check_flag"])
AC_COMPILE_IFELSE([
AC_LANG_SOURCE([[]])
], [
AS_VAR_SET([libbsd_varname_cache], [yes])
], [
AS_VAR_SET([libbsd_varname_cache], [no])
])
AS_VAR_COPY([CFLAGS], [libbsd_save_CFLAGS])
])
AS_VAR_IF([libbsd_varname_cache], [yes], [
AS_VAR_APPEND([LIBBSD_COMPILER_FLAGS], [" $1"])
])
AS_VAR_POPDEF([libbsd_varname_cache])
])
# LIBBSD_HAS_GNU_INIT_ARRAY
# -------------------------
AC_DEFUN([LIBBSD_HAS_GNU_INIT_ARRAY], [
AC_CACHE_CHECK([for GNU .init_array section support],
[libbsd_cv_gnu_init_array_support], [
AC_RUN_IFELSE([
AC_LANG_SOURCE([[
static int rc = 1;
static void init(int argc) { if (argc == 1) rc = 0; }
void (*init_func)(int argc) __attribute__((__section__(".init_array"), __used__)) = init;
int main() { return rc; }
]])
], [
libbsd_cv_gnu_init_array_support=yes
], [
libbsd_cv_gnu_init_array_support=no
], [
AC_PREPROC_IFELSE([
AC_LANG_SOURCE([[
/* Look for a known libc that supports .init_array with the GNU extension
* to pass main() arguments to the init functions. */
#include <stdlib.h>
#if defined __GLIBC_PREREQ
# if __GLIBC_PREREQ(2, 4)
/* glibc supports GNU .init_array since 2.4. */
# else
# error glibc does not support GNU .init_array
# endif
#else
/*
* Basic SysV ABI .init_array support, init functions do not get arguments:
* - Bionic since its inception.
* - uClibc since 0.9.29.
*/
# error unknown whether libc supports GNU .init_array
#endif
]])
], [
libbsd_cv_gnu_init_array_support=yes
], [
libbsd_cv_gnu_init_array_support=no
])
])
])
AM_CONDITIONAL([BUILD_LIBBSD_CTOR],
[test "$libbsd_cv_gnu_init_array_support" = yes])
])
# LIBBSD_SELECT_API(name, desc)
# -----------------
AC_DEFUN([LIBBSD_SELECT_API], [
AS_IF([test -z "$AS_TR_SH([api_$1])"], [
AC_MSG_ERROR([missing API selection for $1])
], [test "$AS_TR_SH([api_$1])" = "unknown"], [
AC_MSG_ERROR([unknown ABI selection for $1])
], [test "$AS_TR_SH([api_$1])" = "yes"], [
AC_DEFINE(AS_TR_CPP([LIBBSD_API_$1]), [1], [Provide API for $2])
], [
AC_DEFINE(AS_TR_CPP([LIBBSD_API_$1]), [0])
])
AM_CONDITIONAL(AS_TR_CPP([API_$1]),
[test "x$AS_TR_SH([api_$1])" = "xyes"])
])
# LIBBSD_SELECT_ABI(name, desc)
# -----------------
AC_DEFUN([LIBBSD_SELECT_ABI], [
AS_IF([test -z "$AS_TR_SH([abi_$1])"], [
AC_MSG_ERROR([missing ABI selection for $1])
], [test "$AS_TR_SH([abi_$1])" = "unknown"], [
AC_MSG_ERROR([unknown ABI selection for $1])
], [test "$AS_TR_SH([abi_$1])" = "yes"], [
AC_DEFINE(AS_TR_CPP([LIBBSD_ABI_$1]), [1], [Provide ABI for $2])
], [
AC_DEFINE(AS_TR_CPP([LIBBSD_ABI_$1]), [0])
])
AM_CONDITIONAL(AS_TR_CPP([ABI_$1]),
[test "x$AS_TR_SH([abi_$1])" = "xyes"])
])

View File

@ -1,57 +0,0 @@
# Copyright © 2011-2024 Guillem Jover <guillem@hadrons.org>
# LIBBSD_CHECK_PROGNAME
# ---------------------
AC_DEFUN([LIBBSD_CHECK_PROGNAME], [
AC_MSG_CHECKING([for program_invocation_short_name])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#include <errno.h>
]], [[
const char *p = program_invocation_short_name;
]])
], [
AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
[Define to 1 if you have program_invocation_short_name])
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
AC_MSG_CHECKING([for __progname])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#include <stdio.h>
extern char *__progname;
]], [[
printf("%s", __progname);
]])
], [
AC_DEFINE([HAVE___PROGNAME], [1], [Define to 1 if you have __progname])
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
])
# LIBBSD_CHECK_REGISTER_ATFORK
# ----------------------------
AC_DEFUN([LIBBSD_CHECK_REGISTER_ATFORK], [
AC_MSG_CHECKING([for __register_atfork])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#include <stddef.h>
extern void *__dso_handle;
extern int __register_atfork(void (*)(void), void(*)(void), void (*)(void), void *);
]], [[
__register_atfork(NULL, NULL, NULL, __dso_handle);
]])
], [
AC_DEFINE([HAVE___REGISTER_ATFORK], [1],
[Define to 1 if you have __register_atfork])
AC_MSG_RESULT([yes])
], [
LIBBSD_LIBS="$LIBBSD_LIBS -pthread"
AC_MSG_RESULT([no])
])
])

View File

@ -1,61 +0,0 @@
# Copyright © 2024 Guillem Jover <guillem@hadrons.org>
# LIBBSD_SYS_TIME64
# -----------------
# Check for availability of time64 support.
AC_DEFUN([LIBBSD_SYS_TIME64], [
# Check the default time_t size.
AC_CHECK_SIZEOF([time_t], [], [[
#undef _TIME_BITS
#include <time.h>
]])
AS_IF([test $ac_cv_sizeof_time_t -eq 8], [
libbsd_sys_time_bits=64
], [
libbsd_sys_time_bits=32
])
AC_DEFINE_UNQUOTED([LIBBSD_SYS_TIME_BITS], [$libbsd_sys_time_bits],
[The number of bits for the default system time_t ABI])
AC_SUBST([LIBBSD_SYS_TIME_BITS], [$libbsd_sys_time_bits])
AS_UNSET([ac_cv_sizeof_time_t])
AM_CONDITIONAL([LIBBSD_SYS_IS_TIME32], [test "$libbsd_sys_time_bits" -eq 32])
# Check the whether the system supports 64-bit time_t.
AC_CHECK_SIZEOF([time_t], [], [[
#define _FILE_OFFSET_BITS 64
#define _TIME_BITS 64
#include <time.h>
]])
AS_IF([test $ac_cv_sizeof_time_t -eq 8], [
libbsd_sys_has_time64=1
], [
libbsd_sys_has_time64=0
])
AC_DEFINE_UNQUOTED([LIBBSD_SYS_HAS_TIME64], [$libbsd_sys_has_time64],
[Enable if the system supports 64-bit time_t])
AC_SUBST([LIBBSD_SYS_HAS_TIME64], [$libbsd_sys_has_time64])
AM_CONDITIONAL([LIBBSD_SYS_HAS_TIME64], [test "$libbsd_sys_has_time64" -eq 1])
AS_IF([test "$libbsd_sys_time_bits" -eq 32 && \
test "$libbsd_sys_has_time64" -eq 1], [
abi_time64=yes
], [
abi_time64=no
])
LIBBSD_SELECT_ABI([time64], [explicit time64 time_t support])
AC_CHECK_SIZEOF([off_t], [], [[
#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
]])
AS_IF([test $ac_cv_sizeof_off_t = 8], [
libbsd_sys_has_lfs=1
], [
libbsd_sys_has_lfs=0
])
AS_IF([test $libbsd_sys_has_lfs -eq 1 && \
test $libbsd_sys_time_bits -eq 32 && \
test $ac_cv_sizeof_time_t -eq 8], [
AC_DEFINE([_TIME_BITS], [64], [Enable 64-bit time_t support])
])
])

View File

@ -1,27 +0,0 @@
# Copyright © 2019, 2022 Guillem Jover <guillem@hadrons.org>
# LIBBSD_LINKER_VERSION_SCRIPT
# ----------------------------
AC_DEFUN([LIBBSD_LINKER_VERSION_SCRIPT], [
AC_CACHE_CHECK([if ld supports --version-script flag],
[libbsd_cv_version_script], [
echo "{ global: symbol; local: *; };" >conftest.map
save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
extern int symbol(void);
int symbol(void) { return 0; }
]], [[
]])
], [
libbsd_cv_version_script=yes
], [
libbsd_cv_version_script=no
])
LDFLAGS="$save_LDFLAGS"
rm -f conftest.map
])
AM_CONDITIONAL([HAVE_LINKER_VERSION_SCRIPT],
[test "x$libbsd_cv_version_script" = "xyes"])
])

1
man/.gitignore vendored
View File

@ -1 +1,2 @@
md5.3
md5.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -2,434 +2,62 @@
EXTRA_DIST = \
mdX.3bsd \
# EOL
$(nil)
CLEANFILES = \
md5.3bsd \
# EOL
$(nil)
SED_MD5_SUBST = -e 's/mdX/md5/g' -e 's/mdY/md4/g' -e 's/MDX/MD5/g'
md5.3bsd: $(srcdir)/mdX.3bsd
$(AM_V_GEN) $(SED) $(SED_MD5_SUBST) $< >$@
$(AM_V_GEN) sed $(SED_MD5_SUBST) $< > $@
dist_man_MANS = \
LIST_CLASS_ENTRY.3bsd \
LIST_CLASS_HEAD.3bsd \
LIST_EMPTY.3bsd \
LIST_ENTRY.3bsd \
LIST_FIRST.3bsd \
LIST_FOREACH.3bsd \
LIST_FOREACH_FROM.3bsd \
LIST_FOREACH_FROM_SAFE.3bsd \
LIST_FOREACH_SAFE.3bsd \
LIST_HEAD.3bsd \
LIST_HEAD_INITIALIZER.3bsd \
LIST_INIT.3bsd \
LIST_INSERT_AFTER.3bsd \
LIST_INSERT_BEFORE.3bsd \
LIST_INSERT_HEAD.3bsd \
LIST_NEXT.3bsd \
LIST_PREV.3bsd \
LIST_REMOVE.3bsd \
LIST_SWAP.3bsd \
RB_EMPTY.3bsd \
RB_ENTRY.3bsd \
RB_FIND.3bsd \
RB_FOREACH.3bsd \
RB_FOREACH_REVERSE.3bsd \
RB_GENERATE.3bsd \
RB_GENERATE_STATIC.3bsd \
RB_HEAD.3bsd \
RB_INIT.3bsd \
RB_INITIALIZER.3bsd \
RB_INSERT.3bsd \
RB_LEFT.3bsd \
RB_MAX.3bsd \
RB_MIN.3bsd \
RB_NEXT.3bsd \
RB_NFIND.3bsd \
RB_PARENT.3bsd \
RB_PREV.3bsd \
RB_PROTOTYPE.3bsd \
RB_PROTOTYPE_STATIC.3bsd \
RB_REMOVE.3bsd \
RB_RIGHT.3bsd \
RB_ROOT.3bsd \
SLIST_CLASS_ENTRY.3bsd \
SLIST_CLASS_HEAD.3bsd \
SLIST_EMPTY.3bsd \
SLIST_ENTRY.3bsd \
SLIST_FIRST.3bsd \
SLIST_FOREACH.3bsd \
SLIST_FOREACH_FROM.3bsd \
SLIST_FOREACH_FROM_SAFE.3bsd \
SLIST_FOREACH_SAFE.3bsd \
SLIST_HEAD.3bsd \
SLIST_HEAD_INITIALIZER.3bsd \
SLIST_INIT.3bsd \
SLIST_INSERT_AFTER.3bsd \
SLIST_INSERT_HEAD.3bsd \
SLIST_NEXT.3bsd \
SLIST_REMOVE.3bsd \
SLIST_REMOVE_AFTER.3bsd \
SLIST_REMOVE_HEAD.3bsd \
SLIST_REMOVE_PREVPTR.3bsd \
SLIST_SWAP.3bsd \
SPLAY_EMPTY.3bsd \
SPLAY_ENTRY.3bsd \
SPLAY_FIND.3bsd \
SPLAY_FOREACH.3bsd \
SPLAY_GENERATE.3bsd \
SPLAY_HEAD.3bsd \
SPLAY_INIT.3bsd \
SPLAY_INITIALIZER.3bsd \
SPLAY_INSERT.3bsd \
SPLAY_LEFT.3bsd \
SPLAY_MAX.3bsd \
SPLAY_MIN.3bsd \
SPLAY_NEXT.3bsd \
SPLAY_PROTOTYPE.3bsd \
SPLAY_REMOVE.3bsd \
SPLAY_RIGHT.3bsd \
SPLAY_ROOT.3bsd \
STAILQ_CLASS_ENTRY.3bsd \
STAILQ_CLASS_HEAD.3bsd \
STAILQ_CONCAT.3bsd \
STAILQ_EMPTY.3bsd \
STAILQ_ENTRY.3bsd \
STAILQ_FIRST.3bsd \
STAILQ_FOREACH.3bsd \
STAILQ_FOREACH_FROM.3bsd \
STAILQ_FOREACH_FROM_SAFE.3bsd \
STAILQ_FOREACH_SAFE.3bsd \
STAILQ_HEAD.3bsd \
STAILQ_HEAD_INITIALIZER.3bsd \
STAILQ_INIT.3bsd \
STAILQ_INSERT_AFTER.3bsd \
STAILQ_INSERT_HEAD.3bsd \
STAILQ_INSERT_TAIL.3bsd \
STAILQ_LAST.3bsd \
STAILQ_NEXT.3bsd \
STAILQ_REMOVE.3bsd \
STAILQ_REMOVE_AFTER.3bsd \
STAILQ_REMOVE_HEAD.3bsd \
STAILQ_SWAP.3bsd \
TAILQ_CLASS_ENTRY.3bsd \
TAILQ_CLASS_HEAD.3bsd \
TAILQ_CONCAT.3bsd \
TAILQ_EMPTY.3bsd \
TAILQ_ENTRY.3bsd \
TAILQ_FIRST.3bsd \
TAILQ_FOREACH.3bsd \
TAILQ_FOREACH_FROM.3bsd \
TAILQ_FOREACH_FROM_SAFE.3bsd \
TAILQ_FOREACH_REVERSE.3bsd \
TAILQ_FOREACH_REVERSE_FROM.3bsd \
TAILQ_FOREACH_REVERSE_FROM_SAFE.3bsd \
TAILQ_FOREACH_REVERSE_SAFE.3bsd \
TAILQ_FOREACH_SAFE.3bsd \
TAILQ_HEAD.3bsd \
TAILQ_HEAD_INITIALIZER.3bsd \
TAILQ_INIT.3bsd \
TAILQ_INSERT_AFTER.3bsd \
TAILQ_INSERT_BEFORE.3bsd \
TAILQ_INSERT_HEAD.3bsd \
TAILQ_INSERT_TAIL.3bsd \
TAILQ_LAST.3bsd \
TAILQ_NEXT.3bsd \
TAILQ_PREV.3bsd \
TAILQ_REMOVE.3bsd \
TAILQ_SWAP.3bsd \
be16dec.3bsd \
be16enc.3bsd \
be32dec.3bsd \
be32enc.3bsd \
be64dec.3bsd \
be64enc.3bsd \
bit_alloc.3bsd \
bit_clear.3bsd \
bit_decl.3bsd \
bit_ffc.3bsd \
bit_ffs.3bsd \
bit_nclear.3bsd \
bit_nset.3bsd \
bit_set.3bsd \
bit_test.3bsd \
bitstr_size.3bsd \
bitstring.3bsd \
byteorder.3bsd \
le16dec.3bsd \
le16enc.3bsd \
le32dec.3bsd \
le32enc.3bsd \
le64dec.3bsd \
le64enc.3bsd \
libbsd.7 \
queue.3bsd \
timeradd.3bsd \
timerclear.3bsd \
timercmp.3bsd \
timerisset.3bsd \
timersub.3bsd \
timespecadd.3bsd \
timespecclear.3bsd \
timespeccmp.3bsd \
timespecisset.3bsd \
timespecsub.3bsd \
tree.3bsd \
# EOL
if API_TIME_MACROS
dist_man_MANS += \
TIMESPEC_TO_TIMEVAL.3bsd \
TIMEVAL_TO_TIMESPEC.3bsd \
# EOL
endif
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
dist_man_MANS += \
errc.3bsd \
verrc.3bsd \
vwarnc.3bsd \
warnc.3bsd \
# EOL
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
dist_man_MANS += \
fpurge.3bsd \
# EOL
endif
if ABI_FREEZERO
dist_man_MANS += \
freezero.3bsd \
# EOL
endif
if ABI_FUNOPEN
dist_man_MANS += \
arc4random.3 \
arc4random_addrandom.3 \
arc4random_buf.3 \
arc4random_stir.3 \
arc4random_uniform.3 \
bitstring.3 \
closefrom.3 \
dehumanize_number.3 \
expand_number.3 \
explicit_bzero.3 \
fgetln.3 \
fgetwln.3 \
flopen.3 \
fmtcheck.3 \
fparseln.3 \
funopen.3bsd \
# EOL
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
dist_man_MANS += \
getbsize.3 \
getmode.3 \
getpeereid.3 \
getprogname.3 \
heapsort.3 \
humanize_number.3 \
md5.3bsd \
# EOL
endif
if ABI_NLIST
dist_man_MANS += \
nlist.3bsd \
# EOL
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
dist_man_MANS += \
getprogname.3bsd \
setprogname.3bsd \
# EOL
endif
if ABI_PWCACHE
dist_man_MANS += \
pwcache.3bsd \
gid_from_group.3bsd \
uid_from_user.3bsd \
# EOL
if ABI_NAME_FROM_ID
dist_man_MANS += \
group_from_gid.3bsd \
user_from_uid.3bsd \
# EOL
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
dist_man_MANS += \
strlcat.3bsd \
strlcpy.3bsd \
# EOL
endif
if ABI_STRMODE
dist_man_MANS += \
strmode.3bsd \
# EOL
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
dist_man_MANS += \
wcslcat.3bsd \
wcslcpy.3bsd \
# EOL
endif
mergesort.3 \
nlist.3 \
pidfile.3 \
queue.3bsd \
radixsort.3 \
readpassphrase.3 \
reallocarray.3 \
reallocf.3 \
setmode.3 \
setproctitle.3 \
setprogname.3 \
sradixsort.3 \
stringlist.3 \
strlcat.3 \
strlcpy.3 \
strnstr.3 \
strmode.3 \
strtonum.3 \
tree.3 \
unvis.3 \
vis.3 \
wcslcat.3 \
wcslcpy.3 \
$(nil)

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/tree.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

View File

@ -1 +0,0 @@
.so man3/queue.3bsd

Some files were not shown because too many files have changed in this diff Show More