Commit Graph

67 Commits

Author SHA1 Message Date
Han Pengfei
44cceee67e pthread: add pthread_{getname_np,setname_npp}
- These two functions imported for Linux/BSD compability.

Signed-off-by: Han Pengfei <pengphei@qq.com>
Change-Id: I3e9cada26f1ed043bfaed83e8185dcfff3bd71e2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5746
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-10-18 16:30:54 +00:00
Augustin Cavalier
045f7a5f3a headers/bsd: Rewrite link_elf.h.
Include only the APIs we are (shortly) going to actually support.

The other structures and functions declared in this file were
never supported nor used anywhere in Haiku's tree.
2022-06-28 13:07:53 -04:00
Augustin Cavalier
0afb8a1b49 Move fts.h and functions from libroot to libbsd.
These are BSD extensions, not POSIX functions. They were needed
in libroot by the previous versions of the ftw/nftw implementations,
but the musl versions do not need them, and so we can move them to
libbsd.

This is a minor ABI break, but hopefully whatever was using them
in libroot also links to libbsd. If not, that's an easy enough fix.
(These were only added to libroot in 2013.)
2022-06-09 16:30:40 -04:00
Augustin Cavalier
7ec1bedeed features.h: Define _DEFAULT_SOURCE when _GNU_SOURCE is defined.
As suggested by PulkoMandy. This was done before my commits yesterday,
but those just reverted patches that had only been in since May,
so it's not clear how much this is actually needed. Nonetheless
it seems like the more correct thing to do.
2021-11-17 13:55:50 -05:00
Augustin Cavalier
68a13ed5c3 features.h: Clean up ISOC11 definitions.
* Do not define it merely when _GNU_SOURCE is defined, that is not needed.
 * Scale back __cplusplus check to 201103L, just like the BSDs do.
2021-11-16 15:11:44 -05:00
Zoltán Mizsei
144f45a030 features.h: enable ISOC11 definitions for _GNU_SOURCE and C++17
this is needed for GCC to build after the aligned_alloc introduction

Change-Id: Ieae32a050cc000561107c4a07cf10c912a196152
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3896
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-05-04 05:25:52 +00:00
Jérôme Duval
0db785d66c features.h: undef before define
Change-Id: Iba98e3a8352801345acefe963917471992f70281
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3606
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-07 09:14:57 +00:00
Adrien Destugues
db7dcab7b1 asprintf should be available if _GNU_SOURCE is defined
As documented in the Linux manpage:
https://man7.org/linux/man-pages/man3/asprintf.3.html
Change-Id: I855b3310ae9111ddf48c13c26b9eb496c200accb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3554
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2020-12-28 23:09:21 +00:00
Jérôme Duval
b05d6f0af0 POSIX: asprintf and vasprintf are BSD/GNU extensions
fix #16259

Change-Id: Ia16bb6e1944b87b25d1a940bbdaaf6e236db1abf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3381
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-11-07 08:49:34 +00:00
Jérôme Duval
6878792ae4 C11: add aligned_alloc()
Change-Id: If648c0e27ed946874d393e8e33a4548b70c8ecdb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3377
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-11-04 21:01:42 +00:00
CodeforEvolution
5c32512076 GNU Compatibility: Implement qsort_r
This is a version of the qsort function allowing you to pass a "cookie" to the function.

Change-Id: I60c645213b9c9590e38b112634fcac1d7969b6d9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2449
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-18 06:25:20 +00:00
Augustin Cavalier
4639c4e898 headers: Add exp10 declarations to gnu/math.h.
These are GNU extensions so they need to be behind _GNU_SOURCE.

Fixes #16371.
2020-07-07 20:48:58 -04:00
Kacper Kasper
827f75a766 Add missing include in bsd/sys/link_elf.h
* Doesn't build without it.

Change-Id: Ia8671f1545fee6684278e688d0a16a1147e78842
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1866
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-09-18 03:40:47 +00:00
Augustin Cavalier
47a21c5c89 s/Haiku License/MIT License/g.
They are the same thing.
2019-08-30 18:16:02 -04:00
Adrien Destugues
4950607607 Add a features.h to auto enable _DEFAULT_SOURCE
Unless __STRICT_ANSI__ is defined (as it is when running the compiler in
--std=c89 or --std=c99, but not when running it without any specific
args), we can enable these by default and behave like most other
systems. I don't know why no one has done this yet despite suggesting it
multiple times and people prefer to #define _BSD_SOURCE manually
everywhere.

Remove all places in our Jamfiles and sources where it had been defined.
_DEFAULT_SOURCE is now enabled by default for all sources of Haiku, since we
let the compiler use GNU extensions (no strict C standard specified on
command line)

Use _DEFAULT_SOURCE as the define name to match current versions of
glibc. Enable it if _BSD_SOURCE is #defined in compiler flags, for
backward compatibility.

Change-Id: I6db04da5f6db437723cdfba3478f5094a69d7727
Reviewed-on: https://review.haiku-os.org/c/1633
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2019-07-29 20:26:46 +00:00
Zoltán Mizsei
3ddf0bbc29 BSD: Use elf.h from os/kernel
Platform-dependant defines for Elf_*

Change-Id: Ib86554eb497d20e60ad7c75de4321d5b516ad88c
Reviewed-on: https://review.haiku-os.org/c/1635
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-27 15:19:31 +00:00
Adrien Destugues
58db38ed74 bsd/sys/param.h: add NBBY define
This defines the number of bits in a byte and is used in tnftpd.
Once this is merged, some patches to tnftpd can be removed.

Change-Id: Ie2d0c61ce1371daeeb8549281f4210147fb77197
Reviewed-on: https://review.haiku-os.org/c/1642
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-22 23:43:04 +00:00
Zoltán Mizsei
c6fd6cbba4 Import link.h and link_elf.h from FreeBSD master
Add _D_BSD_SOURCE guarding
Change-Id: I6eefe207b5e7e645cd3aec3b1981aae59793fa98
Reviewed-on: https://review.haiku-os.org/c/1620
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-07-17 22:17:49 +00:00
Jérôme Duval
ba56d0a513 pthread: add pthread_getattr_np.
non standard extension, but widely available to obtain attributes for a thread.
also provides an alias for pthread_getattr_np which is the bsd equivalent.

Change-Id: I26ef8245ed2537186f48c8b8bdf3e42b03e70892
Reviewed-on: https://review.haiku-os.org/c/1172
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-03-08 19:50:45 +00:00
Niels Sascha Reedijk
d7b8d76a78 BSD headers: remove _BSD_SOURCE feature gate for sysexits.h
During the compilation of LLVM version 8, the build failed because it depends
on a constant in this file. In hrev49042 all BSD headers were feature-gated by
_BSD_SOURCE. This is not done (for this file) in glibc and (obviously) not in
BSD's libc.

Since this is not common practise, I would propose removing the feature gate
for this header file, as it would mean that we would have to upstream patches
for ports of other software that depends on the availability of these
constants.

Change-Id: I486f0c2e87eff489ce92d03589a6299ef1be6ca5
Reviewed-on: https://review.haiku-os.org/c/1144
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-03-03 20:49:19 +00:00
Jérôme Duval
f33f4868fe posix_spawn: add posix_spawn_file_actions_add[f]chdir_np.
see http://austingroupbugs.net/view.php?id=1208
and https://sourceware.org/bugzilla/show_bug.cgi?id=17405

* also free paths in posix_spawn_file_actions_destroy().

Change-Id: I8bed848154025bd5a25322bdc4c25aa417f86ec6
Reviewed-on: https://review.haiku-os.org/c/1010
Reviewed-by: Rene Gollent <rene@gollent.com>
2019-02-06 16:39:33 +00:00
Augustin Cavalier
a41ed241d9 headers/compatibility: Re-add missed _BSD_SOURCE guards to vis.h 2018-12-16 21:01:03 -05:00
Augustin Cavalier
324336d1ed libbsd: Update vis and unvis from FreeBSD.
Fixes #11061.
2018-12-16 18:32:55 -05:00
Zoltán Mizsei
c95db88334 sincos, sincof, sincosl declarations in gnu/math.h
Signed-off-by: Zoltán Mizsei <zmizsei@extrowerk.com>

Change-Id: I44b39e8d76dd970e18e285b5d8b9bad715608154
Reviewed-on: https://review.haiku-os.org/715
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2018-11-19 23:14:51 +00:00
Jérôme Duval
546fafa0a1 pty.h: fix typo. 2018-08-26 12:02:52 +02:00
Alexander von Gluck IV
3a747315b2 stdlib: Add common bsd mkstemps function
Change-Id: I8c54f4b42e8b41f9a769b8b53f074a307b1a054c
2018-02-26 21:46:25 +00:00
Leorize
1a59e1d91c gnu: introduce memmem(3)
Implementation imported from OpenBSD

Change-Id: If2620dc7ed373650bb3dabb0f22c2cd84b9e0ef9
2018-01-17 19:39:18 +00:00
Leorize
0006cc3fbf libs/bsd: add explicit_bzero(3)
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-16 12:54:58 -05:00
Leorize
3d61d20742 libs/bsd: add be64dec(3) and be64enc(3)
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-16 12:54:41 -05:00
Leorize
9a1d046775 libs/bsd: add readpassphrase(3)
Imported from freedesktop libbsd project

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-16 12:54:23 -05:00
Augustin Cavalier
f0cdb09104 headers/bsd: Add sys/queue.h.
Requested in #12617.
2017-12-14 19:07:04 -05:00
Alexander von Gluck IV
1d3d336a97 libbsd: Move lutimes to bsd compat
* Rework be149e8ccf since lutimes isn't posix
2017-11-17 14:27:26 -06:00
Jessica Hamilton
c5e77784a8 compatibility/bsd: add endian.h for BSD extensions. 2017-09-11 07:06:52 +12:00
Alexander von Gluck IV
7e24b659c4 build: Convert to external libedit build package
* Drop lib/edit and matching bsd header
* Convert Debugger to libedit build package
* Should solve problems with libedit consumers
  not defining _BSD_SOURCE
* Progress on #10267
2015-07-04 15:29:05 -05:00
François Revol
b526d04a5b paths.h: add _BSD_SOURCE guard back, also check for _GNU_SOURCE
So things (like m4) expecting paths.h as part of glibc will get
what they want with _GNU_SOURCE.
2015-04-21 01:34:26 +02:00
François Revol
ae65896a9f paths.h: fix some paths
We don't have /sbin so...
2015-04-20 23:33:29 +02:00
François Revol
110600c698 paths.h: remove the _BSD_SOURCE guard
It seems like glibc also has paths.h and m4 fails to bootstrap
without _PATH_BSHELL.

This file really needs some cleanup btw, since most is actually
irrelevant or incorrect for Haiku.
2015-04-20 23:31:20 +02:00
Adrien Destugues
091a80aeed Protect all BSD extensions with _BSD_SOURCE
* Do not define the symbols by default, as they are not in the default
libraries.
* Adjust jamfiles of all code using BSD extensions to define
_BSD_SOURCE.
* This makes Haiku slightly more compliant to standard C/POSIX.
2015-04-16 07:33:06 +02:00
Adrien Destugues
e3468ef600 ifaddrs: add extern "C"
We need this to be callable from C programs. Thanks to Diver for
reporting!
2015-02-26 22:02:37 +01:00
Adrien Destugues
e2fc7cd3c7 Implement getifaddrs.
This is a BSD extension also available in glibc, but is not POSIX.
Fixes #6279.
2015-01-16 13:10:57 +01:00
Jonathan Schleifer
88d550e67e histedit.h: Add missing #include <sys/cdefs.h>
This fixes building openssh on the bootstrap image.

The real problem is that it picks up this file instead of the histedit.h
from libedit, though. But since this include was missing anyway, it
makes sense to fix this file, too.
2014-03-15 04:34:46 +01:00
François Revol
8ea42167a2 Add sysexits.h from FreeBSD r259958
I'd need this for getconf.
2013-12-27 19:16:15 +01:00
Oliver Tappe
73f7af4d6c Drop "protected"-define from bsd-compatibility header
* drop "protected" from bsd-compat header sys/cdefs.h, as that define
  pollutes the global namespace and at least FreeBSD doesn't provide
  it anymore
* remove all uses of that macro from libedit, which seems to be the
  only user in our tree
2012-11-05 09:37:55 +01:00
Axel Dörfler
5fb1d0a640 * Added definitions for n_short, n_long, and n_time as expected on FreeBSD when
including in_systm.h


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42468 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-07-23 15:41:47 +00:00
Scott McCreary
9aed025e4a Updated posix headers to remove commas from copyright line, to match the preferred coding guidelines.
Cleaned up some header style violations, making sure there are two blank lines after the header guards.
This fixes the bsd header part of #2191.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39291 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-11-03 22:04:50 +00:00
Jérôme Duval
1590c69933 * added forkpty() and login_tty() to bsd compatibility, a test for forkpty().
* added a TODO questioning the closing master and slave in openpty() when applying window size fails.
* added TIOCSCTTY as a TTY ioctl code, the caller become controlling TTY. Review comments are welcome.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36105 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-10 13:48:28 +00:00
Bruno G. Albuquerque
7d911b2ad9 - Coding style fixes. Thanks Axel for the heads up.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34097 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-17 16:13:00 +00:00
Bruno G. Albuquerque
ada17216f9 - Added wait3() and wait4() to the bsd compatibility library.
- Untested, but should work (will test it when I get home later today).
- This is my first attempt at adding something for compatibility reasons. Let
  me know if something in wrong.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34091 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-17 15:53:17 +00:00
Ingo Weinhold
8bc24c13ab * Moved termcap.h to headers/libs/termcap/, where it belongs.
* Removed the headers/gnu from the default headers (the Jamfiles needing it
  use it explicitly, now) and moved it under headers/compatibility/.
* Added libgnu.so to the image. Still untested, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32481 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-17 21:13:51 +00:00
Ingo Weinhold
a3c74fcd8c Added a strsep() to our BSD compatibility library.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30022 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-08 10:57:46 +00:00