Commit Graph

489 Commits

Author SHA1 Message Date
Marek Vasut
1f77cdb40a Add NIOS2 support to nlist()
Add support for the NIOS2 soft-core CPU provided by Altera.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Guillem Jover <guillem@hadrons.org>
Cc: Ley Foon Tan <lftan@altera.com>
Cc: Thomas Chou <thomas@wytron.com.tw>
Cc: Walter Goossens <waltergoossens@home.nl>
2015-11-30 23:48:50 +01:00
Guillem Jover
f3b115540c man: Rename funopen.3 to funopen.3bsd to avoid clash with funtools
The funtools project ships a man page with the same, name. And although
it mith probably make more sense to rename the man page there, as BSD
systems will certainly not do so, this is the easiest and fastest way
to avoid a file conflict.
2015-11-30 23:48:50 +01:00
Guillem Jover
877732ef4d test: Check asprintf() return code 2015-11-30 23:48:50 +01:00
Guillem Jover
02bccb0a01 test: Add unit test for strmode() 2015-11-30 23:02:23 +01:00
Guillem Jover
58bef83f41 test: Add unit test for arc4random() 2015-11-30 23:02:23 +01:00
Guillem Jover
6e074a2bdc build: Make git log invocation immune to local configuration 2015-11-30 23:02:23 +01:00
Guillem Jover
0871daf7b0 build: Move hash/helper.c into new libbsd_la_included_sources
Use this variable in EXTRA_DIST and libbsd_la_DEPENDENCIES.
2015-11-30 04:12:02 +01:00
Guillem Jover
02c33d5022 build: Move proctitle_LDFLAGS inside BUILD_LIBBSD_CTOR conditional 2015-11-30 04:10:23 +01:00
Guillem Jover
45443583df Add explicit_bzero() function from OpenBSD 2015-09-24 05:47:58 +02:00
Guillem Jover
8641d8aed7 Make closefrom_procfs() fail when reallocarray() fails 2015-09-24 05:28:58 +02:00
Guillem Jover
0982dcd98b Lock the file streams in fgetln() and fparseln()
The fparseln() function had the NetBSD uppercase macros stubbed out,
so replace them with the actual stdio ones. The fgetln() function was
missing any locking at all.
2015-09-23 07:59:34 +02:00
Guillem Jover
ee26e59e72 Mark functions handling format strings with __printflike 2015-09-23 07:59:34 +02:00
Guillem Jover
151bc71d64 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.
2015-09-23 07:59:34 +02:00
Guillem Jover
41ff37bbcc build: Add support for linker warnings 2015-09-23 07:59:34 +02:00
Guillem Jover
53d989a223 Switch fparseln() implementation from fgetln() to getline() 2015-09-23 07:59:34 +02:00
Guillem Jover
f50b197ea5 test: Add fparseln() unit test 2015-09-23 07:59:34 +02:00
Guillem Jover
54f153414a test: Refactor stream testing functions into a new module 2015-09-23 07:59:34 +02:00
Brent Cook
9688ab26b9 Avoid left shift overflow in reallocarray
Some 64-bit platforms (e.g. Windows 64) have a 32-bit long. So, shifting
1UL 32-bits to the left causes an overflow. This replaces the constant
1UL with (size_t)1 so that we get the correct constant size for the
platform.

Import from OpenBSD.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
2015-09-23 07:59:34 +02:00
Guillem Jover
025b44800e Make mergesort setup() static 2015-09-23 07:59:34 +02:00
Guillem Jover
a6a101effa Use ANSI C prototypes 2015-09-23 07:59:34 +02:00
Guillem Jover
32388fe59f Use reallocarray() instead of malloc() or realloc() 2015-09-23 07:59:34 +02:00
Guillem Jover
30e328cbf1 Do not close file descriptors while scanning the /proc filesystem
Closing file descriptors changes the content of the fd directories in
the /proc filesystem, which means readdir() might get very confused.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=85663
2015-09-23 07:59:34 +02:00
Guillem Jover
4cc43915f2 Move procfs based implementation into a new closefrom_procfs() function 2015-09-23 07:59:34 +02:00
Guillem Jover
34df142665 Refactor file descriptor closure into a new closefrom_close() 2015-09-23 07:59:34 +02:00
Guillem Jover
3881c4fc68 Update closefrom() function
Import from sudo. Adapt the build system to detect the required features.
2015-09-23 07:59:34 +02:00
Guillem Jover
3a3d87d730 test: Add closefrom() unit test 2015-09-23 07:59:34 +02:00
Guillem Jover
d62f7d8fac test: Add test case for fpurge(NULL) 2015-09-23 07:59:34 +02:00
Guillem Jover
cfb4d462a9 test: Move and activate fpurge() test case from module to a dedicated file 2015-09-23 07:59:34 +02:00
Guillem Jover
205827a2dd build: Centralize testsuite LDADD setting in a single variable 2015-09-23 07:59:34 +02:00
Guillem Jover
c7e01e9884 Sync queue(3) from FreeBSD
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=85147
2015-09-23 07:59:34 +02:00
Guillem Jover
3267114483 Add __offsetof, __rangeof and __containerof to sys/cdefs.h
Import and adapt from FreeBSD.
2015-09-23 07:59:27 +02:00
Guillem Jover
0e4e3ab269 Add __DECONST, __DEVOLATILE and __DEQUALIFY macros to sys/cdefs.h
Import from FreeBSD.
2015-09-23 07:59:24 +02:00
Guillem Jover
a6fe103c1b Add new man page for reallocarray(3)
Import man page from OpenBSD.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=85622
2015-09-23 07:14:24 +02:00
Guillem Jover
02b55488c5 Use stdint integer types instead of BSD legacy ones 2015-09-23 07:14:21 +02:00
Callum Davies
6378351169 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>
2014-08-12 12:18:13 +02:00
Guillem Jover
e390651b64 Release libbsd 0.7.0 2014-07-29 03:19:15 +02:00
Guillem Jover
e8d3d04177 build: Remove hard requirement for GNU .init_array section support
In case the support is not available, just stop building the
libbsd-ctor.a library, which is a nice to have thing, but should not
have been a hard requirement from the start. This should allow to
build libbsd on non-glibc based systems using another libc.
2014-07-20 02:09:20 +02:00
Benjamin Baier
faa005cb32 Add reallocarray() function from OpenBSD
Signed-off-by: Guillem Jover <guillem@hadrons.org>
2014-07-17 05:13:05 +02:00
Guillem Jover
36aca8c06e Add stringlist module from NetBSD 2014-07-17 05:11:00 +02:00
Guillem Jover
e8f9300355 Add getbsize() function
Import code from DragonFlyBSD and man page from FreeBSD.
2014-07-15 10:57:42 +02:00
Christian Svensson
a88bb8380d Add OpenRISC support to nlist()
Signed-off-by: Guillem Jover <guillem@hadrons.org>
2014-03-06 22:11:27 +01:00
Guillem Jover
8d16c3df67 Add timeconv module from FreeBSD
Inline license information from FreeBSD root dir COPYRIGHT file.
2013-10-21 05:48:30 +02:00
Guillem Jover
f41fdcf186 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.
2013-10-21 05:35:44 +02:00
Guillem Jover
86cbff385a 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.
2013-10-21 05:35:17 +02:00
Guillem Jover
ee04e8de14 build: Set subdir-objects automake option
Bump automake minimal version to 1.9.
2013-10-21 05:33:08 +02:00
Guillem Jover
61b2dbb8f5 Fix dehumanize_number() to correctly detect overflows
Do not allow numbers greated than INT64_MAX and smaller than INT64_MIN.
Clarify the positive sign value by prefixing it with an explicit +.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=66909
2013-10-21 05:29:37 +02:00
Guillem Jover
119417462e Release libbsd 0.6.0 2013-07-14 13:34:07 +02:00
Guillem Jover
948bcf1db8 Warn when setproctitle() gets called before initialization
Try to give a helpful message in case the program is not initializing
the setproctitle() machinery.
2013-07-14 13:34:07 +02:00
Guillem Jover
c5b9590287 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
2013-07-14 13:32:11 +02:00
Guillem Jover
3077d2fffc build: Move version ABI from Makefile to configure.ac
It's easier to find there, and the value can be reused in case we have
to provide another shared library.
2013-07-14 10:27:25 +02:00