|
304a1f83
|
2024-01-08T23:37:43
|
|
doc: Use macOS to refer to the operating system
This is the correct spelling, instead of capitalizing it.
|
|
df116b55
|
2024-01-07T17:43:12
|
|
Adjust strlcpy() and strlcat() per glibc adoption
These functions were added in glibc 2.38, in anticipation of POSIX
adopting them too.
Closes: #26
|
|
d0d8d019
|
2023-07-27T13:51:36
|
|
build: Do not provide prototypes for arc4random() on Solaris
These functions are provided by the system.
|
|
5434ba16
|
2023-04-23T02:05:04
|
|
build: Conditionalize wcslcpy() and wcslcat() functions on macOS
These functions are provided by the system libc.
|
|
edc746ea
|
2023-04-22T22:47:10
|
|
build: Conditionalize getprogname()/setprogname on macOS
These functions are provided by the system libc, so there is no need for
us to provide them.
|
|
6385ccc9
|
2023-04-18T03:58:24
|
|
build: Conditionalize bsd_getopt() on macOS
The system library provides a getopt() with BSD semantics.
|
|
21d12b02
|
2023-04-04T23:59:05
|
|
build: On macOS do not build functions provided by the system
We have never built before on macOS, so we can exclude all the functions
that are currently provided in the system.
Closes: #1
Closes: !3
|
|
7b4ebd65
|
2023-02-16T21:26:05
|
|
include: Adjust closefrom() per glibc adoption
Added in glibc 2.34
https://sourceware.org/git/?p=glibc.git;a=commit;h=607449506f197cc9514408908f41f22537a47a8c
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
fe21244b
|
2022-12-20T22:47:02
|
|
include: Use __has_builtin to detect __builtin_offsetof support
The __has_builtin operator is more specific and is supported by GCC
and Clang, while __is_identifier() is less specific and only supported
by Clang, so we should prefer the former whenever it is available, and
only fallback to use the latter when the former is missing and the
latter.
|
|
03fccd15
|
2022-10-05T12:08:31
|
|
include: Adjust reallocarray() per glibc adoption
On glibc 2.29 reallocarray() was moved to _DEFAULT_SOURCE.
Closes: !20
Based-on-patch-by: Callum Farmer <gmbr3@opensuse.org>
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
6b6e686b
|
2022-10-05T12:08:31
|
|
include: Adjust arc4random() per glibc adoption
Some arc4random functions were added in glibc 2.36.
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
da1f45ac
|
2022-10-03T16:09:18
|
|
include: explicit_bzero() requires _DEFAULT_SOURCE
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
2f9eddc2
|
2022-10-05T02:05:46
|
|
include: Simplify glibc version dependent macro handling
We test once whether __GLIBC__ is not defined, so we do not need to test
whether it is on the OR branch afterwards. We decouple the glibc version
restriction check from the _*_SOURCE variable, as that contains an
implicit opposite version check.
|
|
1c3ff616
|
2021-02-09T02:46:49
|
|
Use uintptr_t and size_t instead of __-prefixed types in <sys/cdefs.h>
The __-prefixed types cannot be assumed to be defined. Use the standard
types instead.
Closes: #6
|
|
46760262
|
2021-02-07T20:47:00
|
|
Update <sys/queue.h> from FreeBSD
This brings <sys/queue.h> to the most up-to-date version from FreeBSD,
incorporating 18 commits from the past 5 years (2015-02-24 - 2021-01-25):
$ git log --oneline 9090a24aed70..8d55837dc133 sys/sys/queue.h share/man/man3/queue.3
Only minimal changes compared to the FreeBSD version have been applied
(queue.3 -> queue.3bsd, _LIBBSD_ prefix).
[guillem@hadrons.org: Remove reference to kernel mode in man page. ]
Closes: !12
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
233cab9d
|
2021-02-06T23:28:42
|
|
Add support for new LIBBSD_VIS_OPENBSD selection macro
This will make it possible to explicitly select the OpenBSD vis
implementation (the current default) for code of OpenBSD origins.
|
|
847e682f
|
2021-02-07T00:09:30
|
|
Use libmd hashing function implementations instead of embedding our own
This splits the implementation responsibilities, and reduces embedded
code copies, which was one of the driving points with this project to
start with, so it's nice to give a good example.
|
|
37a9b56c
|
2021-02-06T23:43:12
|
|
Import pwcache module from OpenBSD
|
|
01f0d1ea
|
2020-12-31T12:46:03
|
|
Add recallocarray() and freezero() from OpenBSD
Add recallocarray(), introduced in OpenBSD 6.1, and freezero(),
introduced in OpenBSD 6.2. The former is imported as-is from OpenBSD,
while the latter is the non-malloc-internal branch of the same code (and
also the OpenSSH portable variant).
Both of these originated in OpenBSD, but have also been implemented by
IllumOS, cf. https://www.illumos.org/issues/8546
Documentation for these functions is in malloc(3) upstream, the relevant
parts of which were previously imported in reallocarray(3bsd). Update
reallocarray(3bsd) with the changes that were introduced since, and add
the relevant bits for recallocarray() and freezero(), plus aliases.
[guillem@hadrons.org: Update copyright in COPYING. ]
Closes: !10
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
8c5a83d6
|
2020-09-20T03:32:57
|
|
Fix coding style
|
|
5745ca03
|
2019-08-06T15:49:41
|
|
err: Add err(), warn(), errx() and warnx() familiy of functions
Some systems such as Windows or musl-libc based ones do not have these
BSD extensions. In addition libbsd itself is making use of the warnx()
functions, so we better provide these interfaces in case they are
missing.
|
|
9628798d
|
2019-08-06T15:37:43
|
|
err: Rewrite warnc() and errc() family functions to be standalone
Do not depend on the system vwarn() and verr() functions to implement
the *c() variants, as the system might actually lack any of the <err.h>
BSD extensions.
|
|
f34a5f71
|
2019-08-06T15:29:54
|
|
err: Mark error functions as non-returning with __dead2
|
|
61d378f5
|
2019-02-03T00:11:15
|
|
Re-allow direct use of nlist.n_name in <nlist.h>
Commit e8d340de ("Remove a.out support from nlist()") introduced a copy
of the definition of nlist from a.out.h. However, as well as having
n_name inside n_un, on the various BSDs n_name could also be accessed
as a direct member of nlist, and this is made use of by FreeBSD's
usr.bin/netstat/main.c. Thus we should also add the same enclosing
anonymous union.
[guillem@hadrons.org:
- Add a minimal unit test. ]
Closes: !4
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
48033408
|
2018-06-14T11:38:32
|
|
Provide a <sys/param.h> with MIN() and MAX()
Windows doesn't provide <sys/param.h>. Several libbsd sources require it
for MIN(), and these are useful non-system-specific macros anyway.
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
7cfa2d45
|
2018-06-14T11:38:31
|
|
Correct Clang feature detection
Clang's __GNUC__ and __GNUC_MINOR__ definitions are not reliable and may
not be defined at all when targeting the MSVC ABI. Use feature-checking
macros when possible or check for __clang__.
[guillem@hadrons.org: Update for __ protected keyword change. ]
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
574c7a13
|
2018-06-18T00:36:44
|
|
Protect C language extensions with two leading and trailing underscores
This should make their usage safer against user macros.
|
|
c2d9d840
|
2018-06-14T11:38:32
|
|
Guard non-portable forwarded includes
These headers are not available on Windows. <bsd/sys/cdefs.h> ensures
that __has_include() and __has_include_next() are defined.
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
3d9c6c08
|
2018-06-14T11:38:32
|
|
Only define S_ISTXT if S_ISVTX is defined
Windows doesn't provide S_ISVTX. Prefer not defining it rather than
defining it to something invalid.
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
e4e15ed2
|
2018-05-22T13:50:44
|
|
Fix strnvis() and strnunvis() NetBSD ABI break
The NetBSD implementations have different prototypes to the ones coming
from OpenBSD, which will break builds, and have caused segfaults at
run-time. We provide now both interfaces with different prototypes as
different version nodes allow selecting them at compile-time, defaulting
for now to the OpenBSD one to avoid build-time breakage, while emitting
a compile-time warning. Later on, in 0.10.0, we will be switching the
compile-time default to the NetBSD version.
Ref: http://gnats.netbsd.org/44977
Fixes: https://bugs.debian.org/899282
|
|
bf697b90
|
2018-05-22T15:43:48
|
|
Add symbol redirection support
We need this to be able to select different version symbols at
compile-time.
|
|
e13b1a33
|
2018-05-21T00:20:49
|
|
Import strtoi() and strtou() functions from NetBSD
|
|
2d7de186
|
2018-05-21T03:09:05
|
|
Update vis/unvis modules from NetBSD
|
|
e3979d1a
|
2018-05-20T19:22:16
|
|
Update humanize_number() from FreeBSD
Implements HN_IEC_PREFIXES.
|
|
facbddb6
|
2018-05-20T19:18:18
|
|
Update pidfile module from FreeBSD
Use EINVAL instead of EDOOFUS. Add a missing synopsis for
pidfile_fileno() in the man page. Move the definition of struct pidfh
from libutil.h into pidfile.c following upstream change.
|
|
993828d8
|
2018-05-21T01:11:46
|
|
Add flopenat() function from FreeBSD
|
|
30b4d507
|
2018-05-21T03:00:47
|
|
Add __arraycount() macro from NetBSD
|
|
1f8a3f7b
|
2018-03-06T01:39:45
|
|
Fix function declaration protection for glibc already providing them
On non-glibc based systems we cannot unconditionally use the
__GLIBC_PREREQ macro as it gets expanded before evaluation. Instead,
if it is undefined, define it to 0.
We should also always declare these functions on non-glibc based
systems. And on systems with a new enough glibc, which provides these
functions, we should still provide the declarations if _GNU_SOURCE
is *not* defined.
Reported-by: Jörg Krause <joerg.krause@embedded.rocks>
|
|
b20272f5
|
2018-03-06T01:42:52
|
|
Remove <features.h> inclusion from <bsd/libutil.h>
This is a non-portable header, and we should not assume it is present.
Let the first system header pull it in if needed.
|
|
11ec8f1e
|
2018-03-06T01:41:35
|
|
Handle systems missing <sys/cdefs.h>
This is a non-portable header, and we cannot expect it to be provided by
the system libc (e.g. musl). We just need and rely on declaration that
we have defined ourselves in our own <bsd/sys/cdefs.h>. So we switch to
only ever assume that.
Fixes: https://bugs.freedesktop.org/105281
|
|
9afc7100
|
2017-12-03T16:46:19
|
|
Fix <sys/cdefs.h> for gcc with no __has_include or __has_include_next support
Fixes: https://bugs.freedesktop.org/103396
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
22fbd623
|
2017-09-02T19:55:50
|
|
Handle several functions now being provided by glibc
We mention that these are now superseded by the glibc implementations,
make the headers cope with already declared functions on glibc-based
systems, and document this in the man pages.
|
|
0071b979
|
2017-06-05T05:43:26
|
|
Import <sys/time.h> for some of its macros
Fixes: https://bugs.freedesktop.org/94320
|
|
ec5d9a68
|
2017-06-14T02:44:37
|
|
Namespace header inclusion protection macros
Use LIBBSD_, and remove trailing underscores.
|
|
e8d340de
|
2017-06-05T05:30:27
|
|
Remove a.out support from nlist()
Some libc libraries do not have an <a.out.h> header. And a.out as an
executable format is very much obsolete on pretty much all currently
supported systems, even if they might still support loading such
objects.
Remove the a.out support to increase portability.
|
|
07c76b66
|
2017-06-05T06:17:27
|
|
Do not use legacy BSD u_* types
Some systems do not have these types available, and they are simply
convenience aliases. Instead use the expanded versions which are more
portable.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=101192
|
|
e4475738
|
2017-01-20T02:20:12
|
|
Try <linux/a.out.h> if <a.out.h> is not present
At least musl ships the former but not the latter.
|
|
db7470b0
|
2017-01-10T04:27:25
|
|
Gracefully handle lack of system <sys/cdefs.h>
This is the case on musl.
Fixes: https://bugs.debian.org/810589
|
|
337e6202
|
2017-01-10T04:24:35
|
|
Support GCC deprecated attribute for GCC older than 4.5
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=99190
Based-on-patch-by: Eric Smith <brouhaha@fedoraproject.org>
|
|
cdf998a0
|
2015-12-14T00:44:47
|
|
Turn <bsd/bsd.h> inert when using LIBBSD_OVERLAY
Also print a warning stating this fact.
|
|
2c77ad59
|
2015-12-14T00:37:34
|
|
Add missing include to <md5.h>
The header was not self-contained, it was missing definitions for some
types included in <sys/types.h>.
|
|
48ac79b1
|
2015-12-12T14:27:12
|
|
Use the non-overlayed libbsd headers when we need our own definitions
|
|
6bcb1312
|
2015-12-07T02:45:52
|
|
Relicense my contribution to BSD-2-clause
This avoids having two licenses on the same file.
|
|
45443583
|
2015-09-23T19:37:37
|
|
Add explicit_bzero() function from OpenBSD
|
|
c7e01e98
|
2014-11-01T00:22:28
|
|
Sync queue(3) from FreeBSD
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=85147
|
|
ee26e59e
|
2015-09-23T05:50:52
|
|
Mark functions handling format strings with __printflike
|
|
151bc71d
|
2015-09-22T16:22:56
|
|
Add compile and link-time deprecation warnings for fgetln()
Although the current implementation in libbsd is probably one of the
safest ones around, it still poses some problems when used with many
file streams. This function has now a replacement, that is both more
standard and portable. Ask users to switch to getline(3) instead.
|
|
32671144
|
2014-11-01T00:21:30
|
|
Add __offsetof, __rangeof and __containerof to sys/cdefs.h
Import and adapt from FreeBSD.
|
|
0e4e3ab2
|
2014-11-01T00:20:23
|
|
Add __DECONST, __DEVOLATILE and __DEQUALIFY macros to sys/cdefs.h
Import from FreeBSD.
|
|
02b55488
|
2014-08-12T12:32:34
|
|
Use stdint integer types instead of BSD legacy ones
|
|
63783511
|
2014-08-10T12:34:44
|
|
Fix arc4random() and arc4random_stir() prototypes
These two functions accept no arguments. The prototypes should reflect
this. This change lets the compiler warn about certain (admittedly
silly) mistakes.
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
faa005cb
|
2014-06-27T02:05:11
|
|
Add reallocarray() function from OpenBSD
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
36aca8c0
|
2014-06-26T21:43:55
|
|
Add stringlist module from NetBSD
|
|
e8f93003
|
2014-06-26T21:32:11
|
|
Add getbsize() function
Import code from DragonFlyBSD and man page from FreeBSD.
|
|
8d16c3df
|
2013-10-11T05:43:42
|
|
Add timeconv module from FreeBSD
Inline license information from FreeBSD root dir COPYRIGHT file.
|
|
f41fdcf1
|
2013-10-21T05:07:56
|
|
Add funopen() function
This is a wrapper over the glibc fopencookie() function.
We diverge from the FreeBSD, OpenBSD and DragonFlyBSD declarations,
because seekfn() there wrongly uses fpos_t, assuming it's an integral
type, and any code using that on a system where fpos_t is a struct
(such as GNU-based systems or NetBSD) will fail to build. In which case,
as the code has to be modified anyway, we might just as well use the
correct declaration.
|
|
86cbff38
|
2013-10-11T05:11:42
|
|
Handle glibc partial header inclusions
The glibc headers use selective inclusions through the __need_NAME
mechanism to avoid circular dependencies.
The problem is that if we are being overlaid, and have been requested
a partial inclusion, when we pass control to the system header, then
we might miss definitions needed by our own header, resulting in build
failures.
Workaround that by catching current partial requests, and skip the
current inclusion.
|
|
c5b95902
|
2013-07-11T12:25:54
|
|
Move setproctitle() automatic initialization to its own library
The automatic initialization cannot be part of the main shared library,
because there is no thread-safe way to change the environ global
variable. This is not a problem if the initializaion happens just at
program load time, but becomes one if the shared library is directly or
indirectly dlopen()ed during the execution of the program, which could
have either kept references to the old environ or could change it in
some other thread. This has been observed for example on systems using
Samba NSS modules.
To avoid any other possible fallout, the constructor is split into a
new static library that needs to be linked explicitly into programs
using setproctitle(). As an additional safety measure the pkg-config
linker flags will mark the program as not allowing to be dlopen()ed
so that we avoid the problem described above.
Reported-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=66679
|
|
a97ce513
|
2012-11-23T21:19:45
|
|
Add new fgetwln() function
Man page taken from FreeBSD.
|
|
ee0489eb
|
2012-08-07T08:44:30
|
|
Add new fparseln() function
Taken from NetBSD.
[guillem@hadrons.org:
- Import from NetBSD instead of FreeBSD to get a 3-clause BSD license,
instead of a 4-clause one.
- Define compatibility macros.
- Change library from libc to libbsd and header in man page.
- Add copyright information to COPYING.
- Add symbol to map file. ]
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
1be0bdb2
|
2012-11-25T21:13:38
|
|
Add new strnstr() function
Taken from FreeBSD.
|
|
ff0d700d
|
2012-11-23T17:16:43
|
|
Add new wcslcat() and wcslcpy() functions
Taken from FreeBSD.
|
|
e7f39760
|
2012-03-23T10:31:42
|
|
Add email address to my name
|
|
e37293a1
|
2012-01-12T18:16:55
|
|
Add <bitstring.h> for compatibility with NetBSD and OpenBSD
|
|
4eab0cc3
|
2012-01-03T05:29:36
|
|
Add inline endian encoding/decoding functions
Taken from FreeBSD.
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
866f73af
|
2012-01-03T05:39:22
|
|
Move overlay inclusions outside of header protection
Glibc tends to include standard headers with special definitions
that make few declarations or macros visible, this stomps over the
overlay #include_next <> logic.
Based-on-patch-by: Robert Millan <rmh@debian.org>
|
|
0b96e1a2
|
2012-01-03T07:32:53
|
|
Remove deprecated compatibility includes in headers
|
|
109cafb3
|
2012-01-03T07:32:37
|
|
Remove deprecated headers
|
|
f71d8e05
|
2012-03-21T04:10:37
|
|
Remove bogus deprecation warning from <getopt.h>
|
|
64348583
|
2011-12-31T04:30:48
|
|
Add new expand_number() function
Taken from FreeBSD.
[guillem@hadrons.org:
- Include <stdint.h> in <bsd/libutil.h>. ]
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
943939d0
|
2011-12-31T08:39:44
|
|
Add new closefrom() function
Code taken from sudo, man page from FreeBSD.
|
|
059f89ca
|
2011-07-05T20:59:04
|
|
Add missing semicolon to bsd_getopt() declaration
Accidentally lost in commit 4a6303ba3b64504ab0077b9cfebd2a4b918d531d.
|
|
4a6303ba
|
2011-06-08T02:10:38
|
|
Constify bsd_getopt(3) arguments
This matches the standard declaration for getopt(3).
|
|
b891772a
|
2011-05-29T02:49:14
|
|
Remove blank lines at EOF
|
|
b0eb1997
|
2011-05-28T11:40:36
|
|
Move bsd_getopt() from <bsd/getopt.h> to <bsd/unistd.h>
Deprecate <bsd/getopt.h>.
|
|
0bf3d391
|
2011-05-28T10:39:54
|
|
Include the correct deprecated headeres when using the overlay
|
|
200eeb12
|
2011-05-27T21:58:20
|
|
Add LIBBSD_DISABLE_DEPRECATED to deprecated headers
When enabled this will make the inclusion of deprecated headers a
fatal error so that it's easier to spot.
|
|
755d86be
|
2011-05-27T21:39:14
|
|
Rename LIBBSD_CLEAN_INCLUDES to LIBBSD_DISABLE_DEPRECATED
|
|
a7dd4457
|
2011-05-27T21:13:18
|
|
Add new <bsd/sys/poll.h> header
|
|
fbd62297
|
2011-05-27T22:11:28
|
|
Condense and clarify header deprecation warnings
Mention the possibility of using libbsd-overlay.pc.
|
|
cd4996ce
|
2011-05-27T21:23:18
|
|
Namespace header protector in <bsd/sys/cdefs.h> with LIBBSD_SYS_
|
|
8be40010
|
2011-05-27T20:37:10
|
|
Add new <bsd/sys/endian.h> header
|
|
e1f2a6f8
|
2011-05-25T21:27:58
|
|
Add new __packed, __aligned and __nonnull attributes
|
|
87dd203c
|
2011-05-25T21:27:12
|
|
Define __dead2 and __pure2 to actual gcc attributes if possible
|
|
de206287
|
2011-05-25T21:25:54
|
|
Define <sys/cdefs.h> attributes conditional to the supported gcc version
|
|
71e5db4c
|
2011-05-25T21:02:40
|
|
Define _SYS_CDEFS_H and _SYS_CDEFS_H after including <sys/cdefs.h>
This makes sure the “standard” inclusion protectors are in place, as at
least some FreeBSD kernel headers expect these to be defined to do some
sanity checks.
|
|
9d042171
|
2011-05-25T07:38:36
|
|
Map getopt to bsd_getopt if we are using the overlay
This will ensure the code can safely and correctly use optreset
transparently.
|
|
17a9a847
|
2011-05-25T07:36:19
|
|
Rename transparent support to overlay
This affects the pkg-config file now named libbsd-overlay.pc, and the
macro to use the overlay LIBBSD_OVERLAY.
|
|
28585a58
|
2011-05-14T17:58:08
|
|
Add fpurge function
|
|
b36c59c0
|
2011-02-23T12:39:58
|
|
Conditionalize <time.h> inclusion from <bsd/bsd.h>
This was added long time ago to fix some software which was implicitly
depending on the header through some other header, and to avoid having
to modify such software. Conditionalize it on LIBBSD_CLEAN_INCLUDES,
so that buildability can be tested for its future removal.
|