]> git.ipfire.org Git - thirdparty/libbsd.git/log
thirdparty/libbsd.git
5 years agoman: Fix typo
Sebastian [Sun, 10 Mar 2019 10:03:12 +0000 (10:03 +0000)] 
man: Fix typo

Closes: !5
Signed-off-by: Guillem Jover <guillem@hadrons.org>
5 years agoman: Fix typos
Guillem Jover [Wed, 31 Jul 2019 01:49:24 +0000 (03:49 +0200)] 
man: Fix typos

Signed-off-by: Guillem Jover <guillem@hadrons.org>
5 years agoman: Replace references to a.out(5) with elf(5)
Guillem Jover [Wed, 31 Jul 2019 01:02:38 +0000 (03:02 +0200)] 
man: Replace references to a.out(5) with elf(5)

The a.out(5) support in nlist(3) got removed some time ago, and
there is now only elf(5) support.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
5 years agoman: Define doc-operating-system-NetBSD string variables
Guillem Jover [Thu, 13 Jun 2019 21:43:57 +0000 (23:43 +0200)] 
man: Define doc-operating-system-NetBSD string variables

This way we do not depend on the installed groff being new enough.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
5 years agoman: Use major.minor version for .Nx macros
Guillem Jover [Thu, 13 Jun 2019 21:42:49 +0000 (23:42 +0200)] 
man: Use major.minor version for .Nx macros

The macro only recognizes this version form, and not just major alone.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
5 years agoman: Add doc-str-Lb-libbsd aliases for str-Lb-libbsd
Guillem Jover [Thu, 13 Jun 2019 21:36:09 +0000 (23:36 +0200)] 
man: Add doc-str-Lb-libbsd aliases for str-Lb-libbsd

groff(1) has changed the internal layout for the .Lb doc strings, but to
preserve backwards compatibility we cannot simply rename them, we need
to create new aliases so that these will work with old and new macros.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
5 years agoUpdate TODO
Guillem Jover [Wed, 31 Jul 2019 00:58:01 +0000 (02:58 +0200)] 
Update TODO

Signed-off-by: Guillem Jover <guillem@hadrons.org>
5 years agoProvide a <sys/param.h> with MIN() and MAX()
Aaron Dierking [Thu, 14 Jun 2018 18:38:32 +0000 (11:38 -0700)] 
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>
5 years agobuild: Disable CRT warnings on Windows
Aaron Dierking [Thu, 14 Jun 2018 18:38:33 +0000 (11:38 -0700)] 
build: Disable CRT warnings on Windows

These warnings are not helpful for libbsd.

[guillem@hadrons.org:
 - Rename WINDOWS conditional to OS_WINDOWS.
 - Add a nil terminator to the AM_CPPFLAGS. ]

Signed-off-by: Guillem Jover <guillem@hadrons.org>
5 years agobuild: Detect Windows/MinGW at configure time
Aaron Dierking [Thu, 14 Jun 2018 18:38:32 +0000 (11:38 -0700)] 
build: Detect Windows/MinGW at configure time

Extend the host OS checks to define an OS_WINDOWS automake conditional if
the host is MinGW-like. This will be useful for future Windows-specific
build tweaks.

[guillem@hadrons.org:
 - Rename WINDOWS conditional to OS_WINDOWS. ]

Signed-off-by: Guillem Jover <guillem@hadrons.org>
5 years agobuild: Support platforms without symbol versioning
Guillem Jover [Tue, 6 Aug 2019 17:14:29 +0000 (19:14 +0200)] 
build: Support platforms without symbol versioning

The .symver directive is ELF-specific. On non-ELF platforms, work around
this with __attribute__((__alias__)) for the default symbol, and ignore
the variant versioned symbols.

Based-on-patch-by: Aaron Dierking <aarond@fb.com>
Signed-off-by: Guillem Jover <guillem@hadrons.org>
5 years agobuild: Abstract symbol versioning via new libbsd_symver_* macros
Guillem Jover [Tue, 6 Aug 2019 16:51:45 +0000 (18:51 +0200)] 
build: Abstract symbol versioning via new libbsd_symver_* macros

This makes it more obvious what they are doing. It will make it easier
to make these directives more portable, as they are really ELF specific.

5 years agobuild: Use __register_atfork() only if really available
Guillem Jover [Tue, 6 Aug 2019 21:16:42 +0000 (23:16 +0200)] 
build: Use __register_atfork() only if really available

This is a glibc-specific symbol that has no public declaration. But is
being used by the OpenBSD and this implementation as a hack to avoid
having to link against the pthread library. This interface is at least
included in LSB 5.0 [L], and using pthread_atfork() is otherwise
problematic anyway [P].

 [L] <https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib---register-atfork.html>
 [P] <http://austingroupbugs.net/view.php?id=851>

One problem is that we were using it whenever __GLIBC__ is defined,
which is supposed to be defined only on an actual glibc, but uClibc
defines that macro, but it does not provide the symbol on its noMMU
variant.

We add a new configure check that will try to link a program that uses
that symbol to make sure it is present.

Closes: !2
Reported-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
5 years agobuild: Fix check for clock_gettime() within librt
Guillem Jover [Tue, 6 Aug 2019 21:11:50 +0000 (23:11 +0200)] 
build: Fix check for clock_gettime() within librt

The check was always setting the libraries to link to include -lrt,
as the success case includes the builtin one. Handle the various
values.

7 years agoCorrect Clang feature detection
Aaron Dierking [Thu, 14 Jun 2018 18:38:31 +0000 (11:38 -0700)] 
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>
7 years agoProtect C language extensions with two leading and trailing underscores
Guillem Jover [Sun, 17 Jun 2018 22:36:44 +0000 (00:36 +0200)] 
Protect C language extensions with two leading and trailing underscores

This should make their usage safer against user macros.

7 years agoGuard non-portable forwarded includes
Aaron Dierking [Thu, 14 Jun 2018 18:38:32 +0000 (11:38 -0700)] 
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>
7 years agoWindows support for inet_net_pton()
Aaron Dierking [Thu, 14 Jun 2018 18:38:32 +0000 (11:38 -0700)] 
Windows support for inet_net_pton()

Signed-off-by: Guillem Jover <guillem@hadrons.org>
7 years agoWindows support for HASHFileChunk()
Aaron Dierking [Thu, 14 Jun 2018 18:38:32 +0000 (11:38 -0700)] 
Windows support for HASHFileChunk()

<io.h> provides the necessary file I/O functions.

[guillem@hadrons.org: Move include before <hashinc>. ]

Signed-off-by: Guillem Jover <guillem@hadrons.org>
7 years agoDon't require <grp.h>
Aaron Dierking [Thu, 14 Jun 2018 18:38:32 +0000 (11:38 -0700)] 
Don't require <grp.h>

This is only used in the overlay test and Windows does not provide it.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
7 years agoOnly define S_ISTXT if S_ISVTX is defined
Aaron Dierking [Thu, 14 Jun 2018 18:38:32 +0000 (11:38 -0700)] 
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>
7 years agoUse CHAR_BIT instead of NBBY in strnvis()
Aaron Dierking [Thu, 14 Jun 2018 18:38:31 +0000 (11:38 -0700)] 
Use CHAR_BIT instead of NBBY in strnvis()

<sys/param.h> is not available on Windows.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
7 years agoReplace reintroduced legacy u_* type usage in strnvis() and strnunvis()
Aaron Dierking [Thu, 14 Jun 2018 18:38:31 +0000 (11:38 -0700)] 
Replace reintroduced legacy u_* type usage in strnvis() and strnunvis()

This fixes a regression caused by 2d7de18. These types are not available
on all systems.

Fixes: commit 2d7de186e9cb19a756c0630ee85cb3f2d29b3484
Signed-off-by: Guillem Jover <guillem@hadrons.org>
7 years agoRemove dead code in vis
Guillem Jover [Fri, 8 Jun 2018 22:08:14 +0000 (00:08 +0200)] 
Remove dead code in vis

The loop only executes while len > 0, and the trinary operator in the
function argument is checking against len >= 1 which will always be
true.

Warned-by: coverity
7 years agoFix vis family of functions to not leak
Guillem Jover [Wed, 6 Jun 2018 03:41:34 +0000 (05:41 +0200)] 
Fix vis family of functions to not leak

The code uses an internal helper function to avoid code repetition. But
to get there, the function takes a pointer to a pointer, so that the few
functions that require returning an allocated buffer can get hold of it
this way.

The problem is that the user might pass a NULL pointer and trigger an
internal allocation even if the functions are not expected to do so.

Add a new internal helper for non-allocations, that will assert that
condition, and make any other function that requires this behavior call
this one instead.

Warned-by: coverity
7 years agoflopen: Add missing <fcntl.h> include
Baruch Siach [Tue, 5 Jun 2018 16:21:46 +0000 (19:21 +0300)] 
flopen: Add missing <fcntl.h> include

Commit 993828d84ee (Add flopenat() function from FreeBSD) dropped the
fcntl.h header. This breaks the build with musl libc:

flopen.c: In function ‘vflopenat’:
flopen.c:60:14: error: ‘O_CREAT’ undeclared (first use in this function)
  if (flags & O_CREAT) {
              ^~~~~~~

Restore the fcntl.h header include to fix the build.

Fixes: commit 993828d84eed0468c6c15b2818e534e6b134b8e4
Submitted-also-by: parazyd <parazyd@dyne.org>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Guillem Jover <guillem@hadrons.org>
7 years agobuild: Simplify gitlab CI configuration
Guillem Jover [Thu, 31 May 2018 01:59:49 +0000 (03:59 +0200)] 
build: Simplify gitlab CI configuration

Merge all stages so that we do not need to pass artifacts around.
Quiesce «apt install».

7 years agobuild: Install git in gitlab CI configuration
Guillem Jover [Thu, 31 May 2018 01:46:14 +0000 (03:46 +0200)] 
build: Install git in gitlab CI configuration

7 years agobuild: Fix gitlab CI configuration
Guillem Jover [Thu, 31 May 2018 01:34:07 +0000 (03:34 +0200)] 
build: Fix gitlab CI configuration

Run «apt install» in non-interactive mode, and do not install
Recommends. Replace build-essential, which is rather fat, with gcc
and make. Execute autogen instead of autoreconf directly.

7 years agobuild: Add a gitlab CI configuration file
Guillem Jover [Wed, 30 May 2018 23:45:28 +0000 (01:45 +0200)] 
build: Add a gitlab CI configuration file

7 years agoman: Fix comma splice
Jakub Wilk [Tue, 22 May 2018 11:08:56 +0000 (13:08 +0200)] 
man: Fix comma splice

Signed-off-by: Guillem Jover <guillem@hadrons.org>
7 years agoman: Fix name of the function injected by libbsd-ctor
Jakub Wilk [Tue, 22 May 2018 11:08:55 +0000 (13:08 +0200)] 
man: Fix name of the function injected by libbsd-ctor

Signed-off-by: Guillem Jover <guillem@hadrons.org>
7 years agoRelease libbsd 0.9.1 0.9.1
Guillem Jover [Tue, 22 May 2018 14:03:59 +0000 (16:03 +0200)] 
Release libbsd 0.9.1

7 years agoFix strnvis() and strnunvis() NetBSD ABI break
Guillem Jover [Tue, 22 May 2018 11:50:44 +0000 (13:50 +0200)] 
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
7 years agoAdd symbol redirection support
Guillem Jover [Tue, 22 May 2018 13:43:48 +0000 (15:43 +0200)] 
Add symbol redirection support

We need this to be able to select different version symbols at
compile-time.

7 years agoFix COPYING file format
Guillem Jover [Mon, 21 May 2018 20:41:23 +0000 (22:41 +0200)] 
Fix COPYING file format

We cannot refer to a License short-name if that is not on its own
License paragraph. Split several other common License fields into
their own paragraphs to avoid this problem in the future.

7 years agoRelease libbsd 0.9.0 0.9.0
Guillem Jover [Mon, 21 May 2018 02:41:56 +0000 (04:41 +0200)] 
Release libbsd 0.9.0

7 years agoDeprecate fgetwln()
Guillem Jover [Mon, 21 May 2018 01:15:59 +0000 (03:15 +0200)] 
Deprecate fgetwln()

This function has the same problems as fgetln() which is already marked
as deprecated.

7 years agoFix typo in fgetln() linker warning
Guillem Jover [Mon, 21 May 2018 01:10:12 +0000 (03:10 +0200)] 
Fix typo in fgetln() linker warning

7 years agoAdd Windows support for getentropy() and arc4random()
Guillem Jover [Mon, 14 May 2018 22:55:02 +0000 (00:55 +0200)] 
Add Windows support for getentropy() and arc4random()

Import from OpenBSD.

7 years agoSwitch strtonum() implementation from strtoll() to strtoi()
Guillem Jover [Sun, 20 May 2018 22:22:38 +0000 (00:22 +0200)] 
Switch strtonum() implementation from strtoll() to strtoi()

Import from NetBSD.

7 years agoImport strtoi() and strtou() functions from NetBSD
Guillem Jover [Sun, 20 May 2018 22:20:49 +0000 (00:20 +0200)] 
Import strtoi() and strtou() functions from NetBSD

7 years agoUpdate few RCS keyword contents to match BSD originals
Guillem Jover [Sun, 20 May 2018 17:20:33 +0000 (19:20 +0200)] 
Update few RCS keyword contents to match BSD originals

This will slightly reduce the delta, and makes it easier to compare the
sources.

7 years agoUpdate vis/unvis modules from NetBSD
Guillem Jover [Mon, 21 May 2018 01:09:05 +0000 (03:09 +0200)] 
Update vis/unvis modules from NetBSD

7 years agoUpdate readpassphrase() from OpenBSD
Guillem Jover [Sun, 20 May 2018 23:56:33 +0000 (01:56 +0200)] 
Update readpassphrase() from OpenBSD

7 years agoUpdate heapsort() from OpenBSD
Guillem Jover [Sun, 20 May 2018 23:34:17 +0000 (01:34 +0200)] 
Update heapsort() from OpenBSD

7 years agoUpdate fmtcheck() from NetBSD
Guillem Jover [Sun, 20 May 2018 22:31:15 +0000 (00:31 +0200)] 
Update fmtcheck() from NetBSD

7 years agoUpdate humanize_number() from FreeBSD
Guillem Jover [Sun, 20 May 2018 17:22:16 +0000 (19:22 +0200)] 
Update humanize_number() from FreeBSD

Implements HN_IEC_PREFIXES.

7 years agoUpdate pidfile module from FreeBSD
Guillem Jover [Sun, 20 May 2018 17:18:18 +0000 (19:18 +0200)] 
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.

7 years agoUpdate arc4random() headers from OpenBSD
Guillem Jover [Mon, 14 May 2018 22:41:26 +0000 (00:41 +0200)] 
Update arc4random() headers from OpenBSD

Split Linux support into its own header separate from the generic Unix
to fix a Linux-specific issue with clone(). Reset rsp to NULL on failure.

7 years agoUpdate getentropy() code from OpenBSD
Guillem Jover [Mon, 14 May 2018 22:41:26 +0000 (00:41 +0200)] 
Update getentropy() code from OpenBSD

Includes changes to handle the Linux syscall blocking when there is not
enough entropy during boot, by switching it to non-blocking mode and
falling back to the alternative implementations. Man page URL reference
fixes. Build fixes for Mac OS X.

Fixes: https://bugs.debian.org/898088
7 years agoAdd flopenat() function from FreeBSD
Guillem Jover [Sun, 20 May 2018 23:11:46 +0000 (01:11 +0200)] 
Add flopenat() function from FreeBSD

7 years agoAdd __arraycount() macro from NetBSD
Guillem Jover [Mon, 21 May 2018 01:00:47 +0000 (03:00 +0200)] 
Add __arraycount() macro from NetBSD

7 years agoFix build for openrisc with uClibc
Baruch Siach [Tue, 3 Apr 2018 17:10:14 +0000 (20:10 +0300)] 
Fix build for openrisc with uClibc

uClibc defines EM_OR1K instead of EM_OPENRISC for the OpenRISC ELF
e_machine ID. Use EM_OR1K when EM_OPENRISC is not defined.

This fixes the following build failure:

In file included from nlist.c:44:0:
nlist.c: In function ‘__elf_is_okay__’:
local-elf.h:224:23: error: ‘EM_OPENRISC’ undeclared (first use in this function)
 #define ELF_TARG_MACH EM_OPENRISC
                       ^
nlist.c:77:26: note: in expansion of macro ‘ELF_TARG_MACH’
   if (ehdr->e_machine == ELF_TARG_MACH &&
                          ^

Signed-off-by: Guillem Jover <guillem@hadrons.org>
7 years agoFix function declaration protection for glibc already providing them
Guillem Jover [Tue, 6 Mar 2018 00:39:45 +0000 (01:39 +0100)] 
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>
7 years agoRemove <features.h> inclusion from <bsd/libutil.h>
Guillem Jover [Tue, 6 Mar 2018 00:42:52 +0000 (01:42 +0100)] 
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.

7 years agoHandle systems missing <sys/cdefs.h>
Guillem Jover [Tue, 6 Mar 2018 00:41:35 +0000 (01:41 +0100)] 
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
7 years agoprogname: Port to Windows
Guillem Jover [Sun, 4 Mar 2018 23:37:47 +0000 (00:37 +0100)] 
progname: Port to Windows

Define the directory separator depending on the system targetted.

Reported-by: Progyan Bhattacharya <progyanb@acm.org>
7 years agoHandle SPARC V8+ on Sun Studio compiler
Guillem Jover [Sun, 4 Mar 2018 23:02:34 +0000 (00:02 +0100)] 
Handle SPARC V8+ on Sun Studio compiler

7 years agoAdd support for ELF machine EM_SPARC32PLUS
James Clarke [Sun, 4 Mar 2018 22:44:52 +0000 (23:44 +0100)] 
Add support for ELF machine EM_SPARC32PLUS

32-bit SPARC on V8+ uses a different ELF machine type.

Fixes: https://bugs.gentoo.org/634550
Signed-off-by: Guillem Jover <guillem@hadrons.org>
7 years agoRelease libbsd 0.8.7 0.8.7
Guillem Jover [Sat, 13 Jan 2018 15:20:35 +0000 (16:20 +0100)] 
Release libbsd 0.8.7

7 years agotest: Fix nlist(3) unit test on IA64
Jason Duerstock [Sun, 3 Dec 2017 15:50:07 +0000 (16:50 +0100)] 
test: Fix nlist(3) unit test on IA64

On IA64 this is only the case in the ELF binary, but it gets normalized
when loaded at run-time.

Fixes: https://bugs.debian.org/881611
Signed-off-by: Guillem Jover <guillem@hadrons.org>
7 years agoFix <sys/cdefs.h> for gcc with no __has_include or __has_include_next support
Adam Lackorzynski [Sun, 3 Dec 2017 15:46:19 +0000 (16:46 +0100)] 
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>
7 years agoHandle several functions now being provided by glibc
Guillem Jover [Sat, 2 Sep 2017 17:55:50 +0000 (19:55 +0200)] 
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.

7 years agoman: Document on what other BSDs arc4random(3) is present
Guillem Jover [Sat, 5 Aug 2017 11:42:56 +0000 (13:42 +0200)] 
man: Document on what other BSDs arc4random(3) is present

7 years agoRelease libbsd 0.8.6 0.8.6
Guillem Jover [Sun, 16 Jul 2017 23:01:13 +0000 (01:01 +0200)] 
Release libbsd 0.8.6

7 years agoFix handling of non-contiguous argv + envp in setproctitle()
Guillem Jover [Sun, 16 Jul 2017 22:57:07 +0000 (00:57 +0200)] 
Fix handling of non-contiguous argv + envp in setproctitle()

The two arrays might not reference contiguous memory, and assuming they
are does break at least now on GNU/Hurd, which contains an unmapped
memory block between the memory used by the two arrays.

Just check that each element is strictly after the previous one, so that
we know there are no unmapped memory blocks inbetween.

8 years agotest: Fix nlist() unit test on IA64 and PowerPC 64-bit ELFv1
Guillem Jover [Sat, 24 Jun 2017 23:51:30 +0000 (01:51 +0200)] 
test: Fix nlist() unit test on IA64 and PowerPC 64-bit ELFv1

At least on IA64 and PowerPC 64-bit ELFv1, the functions are stored in
the .text sections but they are accessed through a function descriptor
stored in a data section, for example for PowerPC 64-bit ELFv1 that
section is called .opd.

We should take this into account when checking the n_type for the
functions we have requested information from nlist().

Rationale-by: James Clarke <jrtc27@jrtc27.com>
8 years agoRelease libbsd 0.8.5 0.8.5
Guillem Jover [Sat, 24 Jun 2017 14:10:14 +0000 (16:10 +0200)] 
Release libbsd 0.8.5

8 years agoman: Update man page sections in titles and references
Guillem Jover [Fri, 23 Jun 2017 03:59:35 +0000 (05:59 +0200)] 
man: Update man page sections in titles and references

We have moved all man pages to section 3bsd, let's do the same for the
page title, and in all the references for uniformity and to avoid
confusions.

Fixes: https://bugs.freedesktop.org/101545
8 years agoman: Ship and install libbsd(7)
Guillem Jover [Thu, 22 Jun 2017 02:58:09 +0000 (04:58 +0200)] 
man: Ship and install libbsd(7)

Fixes: https://bugs.freedesktop.org/101543
8 years agoFix ELF definitions for MIPS in local-elf.h
James Cowgill [Mon, 19 Jun 2017 19:38:40 +0000 (21:38 +0200)] 
Fix ELF definitions for MIPS in local-elf.h

Add a check for _MIPS_SIM inside the __mips__ #elif to detect mips64el
and use ELFCLASS64 in that case. Note that we can't use defined(__mips64)
here because that is also defined when the n32 ABI is in use, which uses
ELFCLASS32.

Fixes: https://bugs.debian.org/865091
Signed-off-by: Guillem Jover <guillem@hadrons.org>
8 years agoFix ELF definitions for PowerPC in local-elf.h
James Cowgill [Mon, 19 Jun 2017 19:37:14 +0000 (21:37 +0200)] 
Fix ELF definitions for PowerPC in local-elf.h

* ppc64el defines both __powerpc__ and __powerpc64__ but since the
  __powerpc64__ #elif is below the __powerpc__ one, it will never be hit.
* Both assumed that powerpc* was big-endian.

Fixes: https://bugs.debian.org/865091
Signed-off-by: Guillem Jover <guillem@hadrons.org>
8 years agotest: Remove unused variable in nlist() unit test
Guillem Jover [Mon, 19 Jun 2017 19:41:13 +0000 (21:41 +0200)] 
test: Remove unused variable in nlist() unit test

8 years agotest: Handle libtool executable names in getprogname() unit test
Guillem Jover [Mon, 19 Jun 2017 19:32:01 +0000 (21:32 +0200)] 
test: Handle libtool executable names in getprogname() unit test

Sometimes libtool will prefix the test programs with "lt-", we should
handle these and strip the prefix.

Fixes: https://bugs.debian.org/865090
8 years agoRelease libbsd 0.8.4 0.8.4
Guillem Jover [Mon, 19 Jun 2017 01:16:56 +0000 (03:16 +0200)] 
Release libbsd 0.8.4

8 years agoImport <sys/time.h> for some of its macros
Guillem Jover [Mon, 5 Jun 2017 03:43:26 +0000 (05:43 +0200)] 
Import <sys/time.h> for some of its macros

Fixes: https://bugs.freedesktop.org/94320
8 years agotest: Add new strnstr() unit test
Guillem Jover [Sun, 18 Jun 2017 18:30:40 +0000 (20:30 +0200)] 
test: Add new strnstr() unit test

8 years agotest: Add new setprogname() and getprogname() unit test
Guillem Jover [Sun, 18 Jun 2017 18:30:19 +0000 (20:30 +0200)] 
test: Add new setprogname() and getprogname() unit test

8 years agotest: Add new setmode() and getmode() unit test
Guillem Jover [Sun, 18 Jun 2017 18:29:52 +0000 (20:29 +0200)] 
test: Add new setmode() and getmode() unit test

8 years agotest: Add new nlist() unit test
Guillem Jover [Tue, 13 Jun 2017 23:52:12 +0000 (01:52 +0200)] 
test: Add new nlist() unit test

8 years agoRemove RCSID tags
Guillem Jover [Wed, 14 Jun 2017 00:53:35 +0000 (02:53 +0200)] 
Remove RCSID tags

These are obsolete markers, and in some cases they repeat the
information already present in the comment header.

8 years agoUpdate .gitignore for headers generator
Guillem Jover [Wed, 14 Jun 2017 00:45:13 +0000 (02:45 +0200)] 
Update .gitignore for headers generator

8 years agoNamespace header inclusion protection macros
Guillem Jover [Wed, 14 Jun 2017 00:44:37 +0000 (02:44 +0200)] 
Namespace header inclusion protection macros

Use LIBBSD_, and remove trailing underscores.

8 years agoFix broken mmap() usage in nlist() by switching to pread()
Guillem Jover [Tue, 13 Jun 2017 23:49:25 +0000 (01:49 +0200)] 
Fix broken mmap() usage in nlist() by switching to pread()

The offset is not page aligned, which makes mmap() return EINVAL on
Linux. Switch to use pread() which handles unaligned offset and non-page
sized reads, and because we are already loading parts of the executable
by read() calls, so there's not much point in using mmap() anyway.

8 years agoRemove a.out support from nlist()
Guillem Jover [Mon, 5 Jun 2017 03:30:27 +0000 (05:30 +0200)] 
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.

8 years agoMake strlcpy()/strlcat() slightly easier to read
Igor Gnatenko [Mon, 27 Jun 2016 07:21:43 +0000 (09:21 +0200)] 
Make strlcpy()/strlcat() slightly easier to read

Backport new changes from OpenBSD.

[guillem@hadrons.org:
 - Update copyright years in COPYING. ]

References: https://svnweb.freebsd.org/base?view=revision&revision=281135
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Signed-off-by: Guillem Jover <guillem@hadrons.org>
8 years agobuild: Add missing \ at end of line
Guillem Jover [Mon, 19 Jun 2017 01:02:32 +0000 (03:02 +0200)] 
build: Add missing \ at end of line

Fixes: commit 934b7a0ccbdc60313102f153eadc2f46853a505b
8 years agoUpdate TODO
Guillem Jover [Sun, 18 Jun 2017 18:30:51 +0000 (20:30 +0200)] 
Update TODO

8 years agoUpdate TODO
Guillem Jover [Tue, 6 Jun 2017 02:56:49 +0000 (04:56 +0200)] 
Update TODO

8 years agotest: Add unit test for strlcpy() and strlcat()
Guillem Jover [Fri, 9 Jun 2017 03:13:32 +0000 (05:13 +0200)] 
test: Add unit test for strlcpy() and strlcat()

8 years agobuild: Match any glibc and musl ABIs on the host_os AS_CASE
Guillem Jover [Fri, 9 Jun 2017 03:14:24 +0000 (05:14 +0200)] 
build: Match any glibc and musl ABIs on the host_os AS_CASE

Reported-by: Helmut Grohne <helmut@subdivi.de>
8 years agobuild: Quote the arguments to AC_CONDITIONAL
Guillem Jover [Fri, 9 Jun 2017 02:52:45 +0000 (04:52 +0200)] 
build: Quote the arguments to AC_CONDITIONAL

8 years agobuild: Move AC_TYPE_UID_T close to the other AC_TYPE_* checks
Guillem Jover [Fri, 9 Jun 2017 02:52:45 +0000 (04:52 +0200)] 
build: Move AC_TYPE_UID_T close to the other AC_TYPE_* checks

8 years agobuild: Move configure.ac comment into actual AC_CASE
Guillem Jover [Fri, 9 Jun 2017 02:52:45 +0000 (04:52 +0200)] 
build: Move configure.ac comment into actual AC_CASE

8 years agobuild: Use src/strlcpy.c in AC_CONFIG_SRCDIR
Guillem Jover [Wed, 7 Jun 2017 21:09:40 +0000 (23:09 +0200)] 
build: Use src/strlcpy.c in AC_CONFIG_SRCDIR

The src/fgetln.c file contains a function considered obsolete, use one
that is not.

8 years agoman: Use .In intead of .Fd macros for includes
Guillem Jover [Wed, 7 Jun 2017 20:46:07 +0000 (22:46 +0200)] 
man: Use .In intead of .Fd macros for includes

8 years agoman: Add new libbsd(7) library overview man page
Guillem Jover [Mon, 5 Jun 2017 04:33:47 +0000 (06:33 +0200)] 
man: Add new libbsd(7) library overview man page

8 years agoman: Add missing man pages
Guillem Jover [Wed, 7 Jun 2017 03:00:34 +0000 (05:00 +0200)] 
man: Add missing man pages

This adds man pages for byteorder(3), errc(3) and fpurge(3), including
all their aliases.

8 years agoman: Add missing aliases
Guillem Jover [Mon, 5 Jun 2017 04:32:36 +0000 (06:32 +0200)] 
man: Add missing aliases