Commit Graph

802 Commits

Author SHA1 Message Date
Jérôme Duval
fbdac8d61e headers: Don't define static_assert for C23 and C++
Change-Id: I1e67b09b2a310de5cf41c4eef9af46f78b4e9de0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8586
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-11-21 19:26:51 +00:00
PulkoMandy
344ded80d4 ioctl: Document in Haiku book and in comments
- Convert libroot from a page to a group, so that it can list the
  included file and functions in the generated book (like the kits)
- Add unistd.dox and move the relevant part of ioctl details there
- Make sure to use C89-compatible comments only in POSIX headers

Change-Id: I8f0412e4c75de6f48018a0436909f8b0076342a4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6369
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
2024-11-18 17:12:04 +00:00
Augustin Cavalier
e4efb705e4 libroot: Add parentheses around third argument of ioctl.
So that the cast applies to the right part in case an expression
is passed.
2024-11-11 13:39:25 -05:00
Augustin Cavalier
bbb069a1a7 libroot: Use use variable argument count macro for ioctl.
Based on X512's original change, but with more modifications:

 * Don't use _ in macro parameter names to appease GCC 2.

 * Get rid of ioctl_args struct. We don't need it anymore,
   and just adding parameters of the same types has the
   exact same ABI on x86 and x86_64, so this doesn't break
   any existing compiled code.

 * Add (void*) cast to third parameter.

 * Enable for _KERNEL_MODE also.

Change-Id: Id4ad8b85f54836fd26dc6278226954d0a081d5f0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8533
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-11-11 18:29:58 +00:00
X512
4bfc14b6c7 libroot: add posix_devctl() from POSIX.1-2024
Change-Id: I2ae748b2febcdeca0256e9033119dcf9988ccc74
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8556
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2024-11-10 20:08:54 +00:00
Augustin Cavalier
14744074dd Revert "unistd.h: Add cast to (void*) for first argument in C mode."
This reverts commit c4497fa258.

Breaks 2-argument ioctl, it seems.
2024-11-05 22:03:58 -05:00
Jérôme Duval
7190c0f117 libroot: add tcgetwinsize() and tcsetwinsize() for POSIX.1/2024
Change-Id: I46c0b7b5b9c8e7c74278a6e10e9b83142db21d94
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8520
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-11-04 17:55:40 +00:00
Jérôme Duval
7a4e12b7b8 libroot: add ptsname_r for POSIX.1/2024
Change-Id: I9996ff998b2b52a65a101cf7075a3ffb37220962
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8519
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-11-04 17:55:40 +00:00
Jérôme Duval
8b5cc9cf52 libroot: move memmem for POSIX.1/2024
Change-Id: I1b051586c993cd0e3d43abaa22a3722699f7134e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8517
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-11-04 17:55:40 +00:00
Jérôme Duval
6beff0d163 kernel/libnetwork: add accept4() from POSIX.1/2024
* add SOCK_NONBLOCK and SOCK_CLOEXEC
* also extends the type parameter on socketpair() and socket()

Change-Id: I73570d5bfb57c2da00c1086149c9f07547ba61ce
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8515
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-11-04 17:55:40 +00:00
Jérôme Duval
966076b273 kernel/libroot: add dup3() from POSIX.1-2024
this adds a parameter to the dup2 syscall. Adjust strace.

Change-Id: Icc2d0e054365865d38e5d596843a47c95100ca59
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8514
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-11-04 17:55:40 +00:00
Jérôme Duval
11cd4af6e1 kernel/libroot: add pipe2() from POSIX.1-2024
this adds a parameter to the create_pipe syscall. Adjust strace.

Change-Id: I83e9f039eb28c862458654b66c03e2e21a258822
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8513
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-11-04 17:55:40 +00:00
Jérôme Duval
30179dd326 libroot: add reallocarray() from POSIX.1-2024
Change-Id: I75d469ad9a01eb221ca607830589a7794eff71e8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8512
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-11-04 17:55:40 +00:00
Augustin Cavalier
7ee61327ce sys/select.h: Cleanup.
* Always declare FD_SET rather than conditionally. This matches
   the behavior of the glibc, musl, FreeBSD headers.

 * Simplify comments.

 * Leave the custom FD_SETSIZE possibility in place for now. Neither
   glibc nor musl permit this, but FreeBSD still does.
2024-11-01 23:29:22 -04:00
Augustin Cavalier
8bacd281ba sys/param.h: Cleanup.
* Minor tweaks to POSIX sys/param.h for style.

 * Don't redefine alignment macros in BSD sys/param.h even conditionally.
   And add a few more macros from the real BSD sys/param.h, for convenience.
   (Most of these are also declared in musl and glibc's sys/param.h)
2024-10-14 13:53:54 -04:00
Augustin Cavalier
e5f515c322 sys/select.h: Remove howmany() macros.
These aren't defined or used in this header under glibc or musl,
and after the previous commit, aren't needed in the kernel either.
2024-10-14 13:53:52 -04:00
Augustin Cavalier
8f383fa10e ftw.h: Remove unneeded #include <features.h>. 2024-10-14 13:53:48 -04:00
Augustin Cavalier
90dca2bc8e headers: Change most remaining include guards to _DEFAULT_SOURCE.
We automatically enable _DEFAULT_SOURCE if _GNU_SOURCE is defined.
Rather than having even more optional methods undefined unless
_GNU_SOURCE manually is, just change all remaining guarts to
use _DEFAULT_SOURCE instead.

Fixes #19095.

Change-Id: I5c7baf40b7fb37913e24279589fc1ae706448a45
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8330
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-09-19 16:43:31 +00:00
Jérôme Duval
6533131daf posix: dladdr was introduced in POSIX-2024, but with Dl_info_t
instead of Dl_info

Change-Id: Id2fe6d4b094c57ea49260c5765206c5e4bac5a63
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8274
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-09-11 14:02:22 +00:00
Augustin Cavalier
c4497fa258 unistd.h: Add cast to (void*) for first argument in C mode.
Otherwise things that pass integers could error out.
Spotted by Clang.
2024-08-24 01:44:42 -04:00
Jérôme Duval
4169a972ee POSIX: move getentropy(2) from libbsd
Specified in POSIX.1-2024
https://www.austingroupbugs.net/view.php?id=1134
Change-Id: Ie715a102aa6f7764bc639e0a1874a6c7f7d81019
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7846
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-16 16:09:00 +00:00
Jérôme Duval
3bf4cdb73b network/ping: update to freebsd-current
* our ip modules don't support connect()/send(). Just use sendto().
* ping6 disappears, ping supports -4 or -6 to force IPv4 or IPv6

Change-Id: I1e982e354cc75d3a314c5bbbfffa0373e8f4d9af
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7427
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-02-26 14:06:29 +00:00
Dan Gohman
b8caef6915 Change AT_FDCWD from -1 to -100.
Change the value of `AT_FDCWD` from -1 to -100. Either value should work,
since the Haiku implementation currently interprets any negative value as
`AT_FDCWD`, however -100 is preferable to -1 since -1 is used for error
return values.

fixes #18809

Change-Id: I53f273dd595c39ea9e4576b90adbbf7f555107cf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7423
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-02-26 14:04:27 +00:00
Adrien Destugues
8d27b645e7 features.h: fix build when BSD headers are not in include path
In our C library we try to provide a "clean" POSIX/ISO-C set of include
files that strictly conforming applications can use. However, we also
want to provide some extensions that are commonly available in BSD or
GNU systems.

These are normally provided in a separate directory
(headers/compatibility/bsd) and additionally guarded by compiler defines
that can either be explicitly set, or enabled by default if the language
standard (selected from the compiler command line) is one with GNU
extensions (this is the default for GCC). This is controlled by a header
file called features.h.

However, for some headers it is not so simple to split the GNU
extensions apart from the other parts of the file, because it's not just
extra functions, but additional flags and defines.

So, we need the "features.h" mechanism to be available even in the base
set of headers, but not enable anything if the BSD headers are not in
the search path. The simplest way to achieve this is to have an empty
features.h in the base set of headers, that can then be overriden by the
one in headers/compatibility/bsd if needed.

Fixes #18732

Change-Id: Ia54d1206c2fba378ae276ed4232aee8443180afb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7287
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-01-03 17:11:56 +00:00
PulkoMandy
dbe86e4638 regex.h: use _DEFAULT_SOURCE
This file was imported from glibx and uses __USE_GNU as defined by
glibc(s features.h. Our implementation of features.h is simpler, just
defining _DEFAULT_SOURCE directly and that's what we use in other
headers.

As a result, using GNU extensions to regex.h required defining __USE_GNU
directly in applications (for example in TraX).

Fixes #11818

Change-Id: I11e4cf2e88c330cf58083852c4b33aedb8a3a9ea
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7238
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2023-12-30 18:09:57 +00:00
François Revol
71522c937e net: Rename IFT_TUN to IFT_TUNNEL as on BSD
We already use their value, let's use the name too.

Change-Id: I5afbd69923ae3b5e702dfb935a709c3069de5365
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7146
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: François Revol <revol@free.fr>
2023-12-10 19:50:48 +00:00
Augustin Cavalier
b6c24e6b40 network: Overhaul TUN/TAP subsystem.
* Rename the "tun" network device to "tunnel". FreeBSD calls theirs
   "tuntap" but speaks of both TUN and TAP devices as interfaces for
   tunnels. The other BSDs seem to do likewise.

 * Fold the "tun" driver into the "tunnel" network device. The
   network device now publishes entries in devfs when interfaces
   are created, and unpublishes them when interfaces are destroyed.

   This removes the need for the driver and device to communicate
   through a file descriptor, and thus allows the receive queue
   to be totally eliminated, massively simplifying that logic.

 * Use standard net-stack FIFOs instead of TCP BufferQueue, which is
   specialized to TCP's needs in far too many ways. Thanks to the
   previous commit adding support for interrupting semaphore waits,
   we can use the FIFO wait mechanisms, too.

 * Restructure the TAP logic, and generate MAC addresses more like
   Linux does.

 * Actually set type = IFT_TUN, and use the "loopback" frame handler
   instead of the "ethernet" frame handler. This allows significant
   cleanup of the header handling logic.

 * In TUN mode, reject packets that don't look like IP packets.

 * Delete "tunconfig"; it was mostly stubs and is now unnecessary.

TUN mode tested and confirmed as working by kallisti5 with OpenVPN.
TAP mode partially tested, but not yet confirmed as working.

Fixes #18673.

Change-Id: Ibd803139474e8db556a4f567901da15ee4083621
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7143
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2023-11-30 20:44:44 +00:00
Augustin Cavalier
15a3f4c540 libroot: Add stpncpy.
Imported from musl.

It is in POSIX.1-2017.
2023-11-28 20:37:15 -05:00
Trung Nguyen
ea2870c839 headers: Define static_assert for C11
Defines the `static_assert` macro in `assert.h` as required by
the C11 standard.

Change-Id: Ic25dc99537f995404b7b4280b72c6000a293a1df
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6916
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Niels Sascha Reedijk <niels.reedijk@gmail.com>
2023-09-04 05:58:31 +00:00
Augustin Cavalier
efdfb84038 signal.h: Look for _DEFAULT_SOURCE not __USE_GNU for sighandler_t.
Our features.h does not define __USE_GNU, and so applications trying
to use this GNU-ism would have to define it for themselves, even if
_GNU_SOURCE had already been specified.
2023-08-30 17:31:31 -04:00
Augustin Cavalier
b24cc7ca75 pthread: Use 1 for PTHREAD_BARRIER_SERIAL_THREAD.
pthread_barrier_wait can return errors, which on Haiku are negative
and so -1 is an error condition, it should not be reused for a magic
constant.

This breaks ABI. However, until the recent fixes, barriers were so broken
that I doubt any application was using them seriously (Mesa, for instance,
has them disabled.)

Change-Id: Ica23921de012a33e9e7aded816bb1347bd157b31
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6517
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: X512 <danger_mail@list.ru>
2023-06-07 15:12:11 +00:00
Augustin Cavalier
605bd3f09d termios.h: Undefine/remove some unimplemented BeOS extensions.
We did not ever implement these, it seems, and so they are just
cluttering up the global namespace.

Change-Id: Ib37c3a31663525a18268c9bfe326bfba9afbc794
2023-05-22 18:20:17 -04:00
Trung Nguyen
b197dcbafa tty: Implement exclusive mode
Implemented exclusive mode on Haiku and added the related `ioctl`
operations (`TIOCEXCL` and `TIOCNXCL`).

Change-Id: Iaa201ea20eec0e45d02dd5db9ba6aa35fd27dfb2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6387
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
2023-05-13 00:41:16 +00:00
Trung Nguyen
d97ad7c4dc termios: New ioctl: TIOCOUTQ
Change-Id: I86f2a7b007137e22cf7d6fc8ad6675ff5de267d4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6386
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
2023-05-11 02:57:36 +00:00
Trung Nguyen
568b8f9395 headers/posix: Add TIOCM_RNG as a synonym for TIOCM_RI
dotnet uses it.

Change-Id: Ie5658263a0fd9c0aa833cc468ddcafe08116a30d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6385
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
2023-05-11 02:55:38 +00:00
Augustin Cavalier
69929490eb locale_t.h: Add missing newline at end of file.
Fixes #18369.
2023-04-25 12:38:37 -04:00
Augustin Cavalier
d9e8ef7f66 threads.h: Fix value of ONCE_FLAG_INIT.
Fixes #18348.
2023-04-10 11:50:33 -04:00
Augustin Cavalier
fcd82d3dc3 math.h: Change definition of FP_ILOGB0 to match the specification.
See #18351 for details on the specifications.

This is the same thing NetBSD does. BeOS R5 defined these values
differently than we did even before this commit, and it does not
seem to have caused problems then, so this should be fine.

While technically an ABI break, in practice these values are not
always differentiated on other platforms, and it appears musl's
code triggers divide-by-zero exceptions on purpose before it
returns this value, anyway.

Fixes #18351.
2023-04-08 12:30:15 -04:00
Augustin Cavalier
0f67b2ac2e uchar.h: Add missing include of stdint.h.
Fixes #17040.
2023-04-08 12:30:14 -04:00
David Karoly
60b19d7eac kernel/arm: implement signals, fork, restart syscall
Change-Id: I24219b83d90710ef719190183ba6f069f82dae61
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6198
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-03-20 17:28:20 +00:00
Augustin Cavalier
79bc16ba6e Rewrite <netdb.h> and drop a lot of non-standard stuff.
While the BSDs and glibc seem to have various _r functions,
they all return int for errors instead of a pointer, making ours
exactly backwards of theirs for error reporting and thus useless.
So, remove them from the header entirely. They are left in
for ABI backwards compatibility for the time being.

A few constants not used by anything in the tree (i.e. not actually
implemented by libnetwork/netresolv) were also dropped. Some deprecated
or non-standard functions were placed behind _DEFAULT_SOURCE or deleted
entirely.

The header itself is now organized approximately as the BSDs do,
although with various Haiku-isms instead of BSD-isms where appropriate.
2023-02-27 22:51:17 -05:00
Augustin Cavalier
6d36f6bfad netdb: Drop definitions for getipnodeby...
We do not actually export them, or even have source for them in-tree.
2023-02-27 21:11:49 -05:00
Semion Dimov
d53856a1b6 Added missing posixoptions and sysconf constants according POSIX.1-2017 standard
Change-Id: I2721ea4f2c3dbe0ef6a11c3a61da6034b4a7fd48
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4371
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2022-12-23 01:57:05 +00:00
PulkoMandy
32a71a00aa stdint.h: fix definition of UINT8_MAX, UINT16_MAX, UINT8_C and UINT16_C
C99 chapter 7.18.2, Limits of specified-width integer types:

"This expression shall have the same type as would an expression that is
an object of the corresponding type according to the integer promotions."

C99 chapter 6.3.1.1:

"If an int can represent all values of the original type, the value is
converted to an int; otherwise, it is converted to an unsigned int.
These are called the integer promotions."

Therefore, UINT8_MAX, UINT16_MAX, UINT8_C and UINT16_C should be signed.

This prevents building WebKit with -Werror.

Change-Id: Ib2a2c15acc2c761cccf8caa016c7ff163e3fdc0d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5806
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-11-08 16:11:40 +00:00
Jérôme Duval
c95c18768b POSIX: wchar.h and wctype.h don't need the locale.h but locale_t.h
* missed in hrev56270.
* mentioned on IRC: <dwa> please ask them if wchar.h isn't meant to include locale_t.h instead of locale.h

Change-Id: Ia9b7553480430c2fefb4a3659ad525322152582b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5797
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-11-02 14:09:08 +00:00
Jérôme Duval
799ab823bb libroot: Add support for C11 Threads missing parts (except gcc2).
The respective files can be found in the FreeBSD source tree at:
- lib/libstdthreads/call_once.c
- lib/libstdthreads/cnd.c
- lib/libstdthreads/mtx.c
- lib/libstdthreads/threads.h
- lib/libstdthreads/tss.c

Missing is support for PTHREAD_DESTRUCTOR_ITERATIONS.

Change-Id: I7a6c79954f36195eadd1351d308c21a001192232
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5675
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-09-19 19:45:45 +00:00
Trung Nguyen
d338200e2b libs/posix: Implemented new locale functions
Implemented the missing POSIX functions in <locale.h>:
newlocale, duplocale, uselocale, and freelocale, and also
provided missing type definitions for <locale.h>.

Implemented missing POSIX locale-based function variants.

Modified LocaleBackend so that it could support thread-local
locales.

Some glibc-like locale-related variables supporting
ctype and printf family of functions have also been updated
to reflect the thread-local variables present in the latest
glibc sources.

As there have been some modifications to global symbols
in libroot, libroot_stubs.c has been regenerated.

Bug: #17168
Change-Id: Ibf296c58c47d42d1d1dfb2ce64042442f2679431
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5351
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2022-07-11 16:30:16 +00:00
Augustin Cavalier
44fa45df3a net/if: Drop ifmediareq and just use the regular ifreq for SIOCGIFMEDIA.
This was introduced into the main API in 2010 (d72ede75fb),
but was actually only fully used for the past month (c2a9a890f3)
when SIOCGIFMEDIA was supported for all *BSD drivers and not just WiFi.
Most userland consumers of this structure did not use it correctly,
as was the case in #17770, and only worked because in the fallback case
the network stack just treated it as if it were an ifreq.

Nothing actually used the ifm_count/ifm_ulist (though tentative APIs
were exposed for it) as noted by previous commits; and the fact that
Haiku's IFM_* declarations are so spartan makes most of the returned
values unintelligible to userland without using FreeBSD compat headers.

If, in the future, we decide to implement ifmedia listing and selection
properly, that should likely be done with separate ioctls instead of
having multi-function ones like this.

This is technically an ABI break, but in practice it should not matter:
ifmediareq::ifm_current aligns with ifreq::ifr_media, so the things
that used this structure like our in-tree code did will continue to work.
Until this past May, the only other field that was usually set was
ifm_active, but in the absence of setting ifm_status all non-Haiku
consumers should ignore it completely.

The only consumer of this ioctl that I know of out of the tree,
wpa_supplicant, still works after these changes.
2022-06-13 22:31:33 -04:00
Augustin Cavalier
3b4737b9e5 headers: Remove bsd_mem.h.
This is a holdover from BeOS. All the functions in here we declare
in other headers, so this is not needed.
2022-06-09 18:31:08 -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