Thomas Weißschuh
3edd5365f9
tools/nolibc: move prctl() to sys/prctl.h
...
This is the location regular userspace expects this definition.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250515-nolibc-sys-v1-3-74f82eea3b59@weissschuh.net
2025-05-21 15:32:19 +02:00
Thomas Weißschuh
6e7c805a93
tools/nolibc: move mount() to sys/mount.h
...
This is the location regular userspace expects this definition.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250515-nolibc-sys-v1-2-74f82eea3b59@weissschuh.net
2025-05-21 15:32:18 +02:00
Thomas Weißschuh
7281be5831
tools/nolibc: move ioctl() to sys/ioctl.h
...
This is the location regular userspace expects this definition.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250515-nolibc-sys-v1-1-74f82eea3b59@weissschuh.net
2025-05-21 15:32:16 +02:00
Thomas Weißschuh
5930393032
tools/nolibc: implement wait() in terms of waitpid()
...
Newer architectures like riscv 32-bit are missing sys_wait4().
Make use of the fact that wait(&status) is defined to be equivalent to
waitpid(-1, status, 0) to implement it on all architectures.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-15-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
2025-05-21 15:32:16 +02:00
Thomas Weißschuh
5e7392dc82
tools/nolibc: fall back to sys_clock_gettime() in gettimeofday()
...
Newer architectures (like riscv32) do not implement sys_gettimeofday().
In those cases fall back to sys_clock_gettime().
While that does not support the timezone argument of sys_gettimeofday(),
specifying this argument invokes undefined behaviour, so it's safe to ignore.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-14-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
2025-05-21 15:32:15 +02:00
Thomas Weißschuh
a009a0c6fa
tools/nolibc: add fopen()
...
This is used in various selftests and will be handy when integrating
those with nolibc.
Only the standard POSIX modes are supported.
No extensions nor the (noop) "b" from ISO C are accepted.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-13-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
2025-05-21 15:32:14 +02:00
Thomas Weißschuh
256dc7339d
tools/nolibc: add namespace functionality
...
This is used in various selftests and will be handy when integrating
those with nolibc.
Not all configurations support namespaces, so skip the tests where
necessary. Also if the tests are running without privileges.
Enable the namespace configuration for those architectures where it is not
enabled by default.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-12-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
2025-05-21 15:32:12 +02:00
Thomas Weißschuh
7ff3c71a47
tools/nolibc: add difftime()
...
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-11-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
2025-05-21 15:32:12 +02:00
Thomas Weißschuh
da69cfb17b
tools/nolibc: add timerfd functionality
...
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-10-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
2025-05-21 15:32:10 +02:00
Thomas Weißschuh
fa7bf84486
tools/nolibc: add timer functions
...
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-9-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
2025-05-21 15:32:09 +02:00
Thomas Weißschuh
50647213e1
tools/nolibc: add clock_getres(), clock_gettime() and clock_settime()
...
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-8-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
2025-05-21 15:32:07 +02:00
Thomas Weißschuh
1e10b8534f
tools/nolibc: add support for access() and faccessat()
...
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-7-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
2025-05-21 15:32:06 +02:00
Thomas Weißschuh
bf5e8a78be
tools/nolibc: add abs() and friends
...
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-6-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
2025-05-21 15:32:05 +02:00
Thomas Weißschuh
801f020b5f
tools/nolibc: add getrandom()
...
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-5-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
2025-05-21 15:32:04 +02:00
Thomas Weißschuh
55175d8659
tools/nolibc: add mremap()
...
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-4-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
2025-05-21 15:32:03 +02:00
Thomas Weißschuh
2337d39f72
tools/nolibc: add more stat() variants
...
Add fstat(), fstatat() and lstat(). All of them use the existing implementation
based on statx().
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-3-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
2025-05-21 15:32:02 +02:00
Thomas Weißschuh
7a7cd445d9
tools/nolibc: add %m printf format
...
The %m format can be used to format the current errno.
It is non-standard but supported by other commonly used libcs like glibc and
musl, so applications do rely on them.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-2-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
2025-05-21 15:32:01 +02:00
Thomas Weißschuh
05b6b2a9ef
tools/nolibc: add strstr()
...
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-1-3c043eeab06c@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
2025-05-21 15:32:00 +02:00
Thomas Weißschuh
1f421ddf49
tools/nolibc: use poll-related definitions from UAPI headers
...
The UAPI headers already provide definitions for these symbols.
Using them makes the code shorter, more robust and compatible with
applications using linux/poll.h directly.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250430-poll-v1-2-44b5ceabdeee@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
2025-05-21 15:32:00 +02:00
Thomas Weißschuh
dc2c656e1f
tools/nolibc: move poll() to poll.h
...
This is the location regular userspace expects the definition.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250430-poll-v1-1-44b5ceabdeee@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
2025-05-21 15:31:58 +02:00
Daniel Palmer
66a4f9bb1e
tools/nolibc: Add m68k support
...
Add nolibc support for m68k. Should be helpful for nommu where
linking libc can bloat even hello world to the point where you get
an OOM just trying to load it.
Signed-off-by: Daniel Palmer <daniel@thingy.jp >
Link: https://lore.kernel.org/r/20250426224738.284874-1-daniel@0x0f.com
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net >
2025-05-21 15:31:54 +02:00
Thomas Weißschuh
3785289f97
tools/nolibc: include nolibc.h early from all header files
...
Inclusion of any nolibc header file should also bring all other headers.
On the other hand it should also be possible to include any nolibc header
files
in any order.
Currently this is implemented by including the catch-all nolibc.h after the
headers own definitions.
This is problematic if one nolibc header depends on another one.
The first header has to include the other one before defining any symbols.
That in turn will include the rest of nolibc while the current header has
not defined anything yet. If any other part of nolibc depends on
definitions from the current header, errors are encountered.
This is already the case today. Effectively nolibc can only be included in
the order of nolibc.h.
Restructure the way "nolibc.h" is included.
Move it to the beginning of the header files and before the include guards.
Now any header will behave exactly like "nolibc.h" while the include
guards prevent any duplicate definitions.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250424-nolibc-header-check-v1-2-011576b6ed6f@linutronix.de
2025-05-21 15:31:50 +02:00
Thomas Weißschuh
a6a054c8ad
tools/nolibc: add target to check header usability
...
Each nolibc header should be valid for inclusion irrespective of any
special ordering requirements.
Add a new make target, based on the old kbuild "make header_check" target
to validate this requirement.
For now the check fails, but the following commits will fix the issues.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
Link: https://lore.kernel.org/r/20250424-nolibc-header-check-v1-1-011576b6ed6f@linutronix.de
2025-05-21 15:31:49 +02:00
Sebastian Andrzej Siewior
4140e2b31b
tools headers: Synchronize prctl.h ABI header
...
The prctl.h ABI header was slightly updated during the development of
the interface. In particular the "immutable" parameter became a bit in
the option argument.
Synchronize prctl.h ABI header again and make use of the definition in
the testsuite and "perf bench futex".
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de >
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Reviewed-by: André Almeida <andrealmeid@igalia.com >
Link: https://lore.kernel.org/r/20250517151455.1065363-5-bigeasy@linutronix.de
2025-05-21 13:57:41 +02:00
Arnaldo Carvalho de Melo
e48b92f9e1
tools headers: Synchronize linux/bits.h with the kernel sources
...
To pick up the changes in this cset:
0312e94abe ("treewide: fix typo 'unsigned __init128' -> 'unsigned __int128'")
This addresses these perf build warnings:
Warning: Kernel ABI header differences:
diff -u tools/include/linux/bits.h include/linux/bits.h
This required picking the const_true() define in linux/compiler.h as a
prep patch as that macro is used in the new linux/bits.h
Please see tools/include/uapi/README for further details.
Acked-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr >
Acked-by: Yury Norov [NVIDIA] <yury.norov@gmail.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: James Clark <james.clark@linaro.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lore.kernel.org/r/20250519214126.1652491-8-acme@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2025-05-20 12:57:19 -03:00
Arnaldo Carvalho de Melo
e6428c3492
tools headers compiler: Pick the const_true() define from the kernel sources
...
The sync of include/linux/bits.h with the kernel sources will make use
of this define, so add it to the tools/include/linux/compiler. variant
used to build tools/ living code.
Acked-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr >
Acked-by: Yury Norov [NVIDIA] <yury.norov@gmail.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: James Clark <james.clark@linaro.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lore.kernel.org/r/20250519214126.1652491-7-acme@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2025-05-20 12:57:19 -03:00
Arnaldo Carvalho de Melo
fa7a1e8d2d
tools headers: Synchronize uapi/linux/bits.h with the kernel sources
...
To pick up the changes in this cset:
1e7933a575 ("uapi: Revert "bitops: avoid integer overflow in GENMASK(_ULL)"")
This addresses this perf build warning:
Warning: Kernel ABI header differences:
diff -u tools/include/uapi/linux/bits.h include/uapi/linux/bits.h
Please see tools/include/uapi/README for further details.
Acked-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr >
Acked-by: Yury Norov [NVIDIA] <yury.norov@gmail.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: I Hsin Cheng <richard120310@gmail.com >
Cc: Ian Rogers <irogers@google.com >
Cc: James Clark <james.clark@linaro.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lore.kernel.org/r/20250519214126.1652491-6-acme@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2025-05-20 12:57:19 -03:00
Arnaldo Carvalho de Melo
83dcc12fa5
tools headers: Sync the linux/unaligned.h copy with the kernel sources
...
To pick up the changes in:
acea994327 ("vdso: Address variable shadowing in macros")
Addressing this perf tools build warning:
Warning: Kernel ABI header differences:
diff -u tools/include/linux/unaligned.h include/linux/unaligned.h
Please see tools/include/uapi/README for further details.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: James Clark <james.clark@linaro.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peng Jiang <jiang.peng9@zte.com.cn >
Cc: Thomas Gleixner <tglx@linutronix.de >
Link: https://lore.kernel.org/r/20250519214126.1652491-5-acme@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2025-05-20 12:57:18 -03:00
Stanislav Fomichev
8802087d20
net: devmem: TCP tx netlink api
...
Add bind-tx netlink call to attach dmabuf for TX; queue is not
required, only ifindex and dmabuf fd for attachment.
Signed-off-by: Stanislav Fomichev <sdf@fomichev.me >
Signed-off-by: Mina Almasry <almasrymina@google.com >
Link: https://patch.msgid.link/20250508004830.4100853-4-almasrymina@google.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com >
2025-05-13 11:12:48 +02:00
Amir Goldstein
c6d9775c20
selftests/fs/mount-notify: build with tools include dir
...
Copy the fanotify uapi header files to the tools include dir
and define __kernel_fsid_t to decouple dependency with headers_install
and then remove the redundant re-definitions of fanotify macros.
Reviewed-by: John Hubbard <jhubbard@nvidia.com >
Signed-off-by: Amir Goldstein <amir73il@gmail.com >
Link: https://lore.kernel.org/20250509133240.529330-6-amir73il@gmail.com
Reviewed-by: Christian Brauner <brauner@kernel.org >
Signed-off-by: Christian Brauner <brauner@kernel.org >
2025-05-12 11:40:12 +02:00
Amir Goldstein
b13fb4ee46
selftests/fs/statmount: build with tools include dir
...
Copy the required headers files (mount.h, nsfs.h) to the tools
include dir and define the statmount/listmount syscall numbers
to decouple dependency with headers_install for the common cases.
Reviewed-by: John Hubbard <jhubbard@nvidia.com >
Signed-off-by: Amir Goldstein <amir73il@gmail.com >
Link: https://lore.kernel.org/20250509133240.529330-3-amir73il@gmail.com
Reviewed-by: Christian Brauner <brauner@kernel.org >
Signed-off-by: Christian Brauner <brauner@kernel.org >
2025-05-12 11:40:12 +02:00
Andrei Vagin
267bee0cd8
tools headers UAPI: sync linux/fs.h with the kernel sources
...
Required for a new PAGEMAP_SCAN test to verify guard region reporting.
Link: https://lkml.kernel.org/r/20250324065328.107678-3-avagin@google.com
Signed-off-by: Andrei Vagin <avagin@gmail.com >
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com >
Cc: David Hildenbrand <david@redhat.com >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Shuah Khan <shuah@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2025-05-11 17:48:16 -07:00
Jiri Olsa
8231533340
bpf: Add support to retrieve ref_ctr_offset for uprobe perf link
...
Adding support to retrieve ref_ctr_offset for uprobe perf link,
which got somehow omitted from the initial uprobe link info changes.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Signed-off-by: Andrii Nakryiko <andrii@kernel.org >
Acked-by: Yafang Shao <laoar.shao@gmail.com >
Link: https://lore.kernel.org/bpf/20250509153539.779599-2-jolsa@kernel.org
2025-05-09 13:01:07 -07:00
Paul Chaignon
f5c79ffdc2
bpf: Clarify handling of mark and tstamp by redirect_peer
...
When switching network namespaces with the bpf_redirect_peer helper, the
skb->mark and skb->tstamp fields are not zeroed out like they can be on
a typical netns switch. This patch clarifies that in the helper
description.
Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com >
Acked-by: Daniel Borkmann <daniel@iogearbox.net >
Acked-by: Martin KaFai Lau <martin.lau@kernel.org >
Link: https://patch.msgid.link/ccc86af26d43c5c0b776bcba2601b7479c0d46d0.1746460653.git.paul.chaignon@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org >
2025-05-07 18:16:33 -07:00
Sebastian Andrzej Siewior
f25051dce9
tools headers: Synchronize prctl.h ABI header
...
Synchronize prctl.h with current uapi version after adding
PR_FUTEX_HASH.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de >
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Link: https://lore.kernel.org/r/20250416162921.513656-19-bigeasy@linutronix.de
2025-05-03 12:02:09 +02:00
Thomas Weißschuh
e90ce42e81
tools/nolibc: implement width padding in printf()
...
printf can pad each argument to a certain width.
Implement this for compatibility with the kselftest harness.
Currently only padding with spaces is supported.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
2025-04-22 10:59:06 +02:00
Thomas Weißschuh
ed45d24cf2
tools/nolibc: add snprintf() and friends
...
Add more of the printf() functions.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
2025-04-22 10:59:04 +02:00
Thomas Weißschuh
9f4a2e28bc
tools/nolibc: allow limiting of printf destination size
...
snprintf() allows limiting the output buffer, while still returning the
number of all bytes that would have been written.
Implement the limitation logic in preparation for snprintf().
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
2025-04-22 10:59:03 +02:00
Thomas Weißschuh
f7b3eeffd4
tools/nolibc: allow different write callbacks in printf
...
Decouple the formatting logic from the writing logic to later enable
writing straight to a buffer in sprintf().
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
2025-04-22 10:59:02 +02:00
Thomas Weißschuh
bae3cd708e
tools/nolibc: add getopt()
...
Introduce a getopt() implementation based on the one from musl.
The only deviations are adaption to the kernel coding style and nolibc
infrastructure and removal of multi-byte support.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
2025-04-22 10:59:00 +02:00
Thomas Weißschuh
5197b7b87c
tools/nolibc: add dprintf() and vdprintf()
...
dprintf() and vdprintf() are printf() variants printing directly into a
filedescriptor. As FILE in nolibc is based directly on filedescriptors,
the implementation is trivial.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
2025-04-22 10:58:22 +02:00
Thomas Weißschuh
0c89abf5ab
tools/nolibc: implement waitpid() in terms of waitid()
...
The old wait4() syscall used by waitpid() before is not available everywhere.
Switch to the waitid() syscall which is the new replacement.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
2025-04-22 10:58:18 +02:00
Thomas Weißschuh
67fe525e34
tools/nolibc: add setpgrp()
...
setpgrp() is defined to be identical to setpgid(0, 0).
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
2025-04-22 10:56:27 +02:00
Thomas Weißschuh
7b11531ed1
tools/nolibc: add _exit()
...
_exit() is the faster variant of exit(), skipping all cleanup actions.
As nolibc does not perform any cleanup anyways, the implementation is
trivial.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
2025-04-22 10:56:27 +02:00
Thomas Weißschuh
9b070d97d9
tools/nolibc: add tolower() and toupper()
...
The kselftest harness uses these functions.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
2025-04-22 10:56:26 +02:00
Thomas Weißschuh
4de88a88bc
tools/nolibc: use ppoll_time64 if available
...
riscv32 does not have any of the older poll systemcalls.
Use ppoll_time64 instead.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
2025-04-22 10:56:25 +02:00
Thomas Weißschuh
248ddc80b1
tools/nolibc: use pselect6_time64 if available
...
riscv32 does not have any of the older select systemcalls.
Use pselect6_time64 instead.
poll() is also used to implement sleep().
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
2025-04-22 10:56:25 +02:00
Thomas Weißschuh
e5407c0820
tools/nolibc: use intmax definitions from compiler
...
The printf format checking in the compiler uses the intmax types from
the compiler, not libc. This can lead to compiler errors.
Instead use the types already provided by the compiler.
Example issue with clang 19 for arm64:
nolibc-test.c:30:2: error: format specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'uintmax_t' (aka 'unsigned long long') [-Werror,-Wformat]
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
2025-04-22 10:56:24 +02:00
Thomas Weißschuh
4c99fbc6a0
tools/nolibc: handle intmax_t/uintmax_t in printf
...
In nolibc intmax_t and uintmax_t are always the same as
(unsigned) long long/uint64_t as 128bit numbers are not supported.
Even libcs that do support 128bit numbers often fix intmax_t to 64bit
as it is used in ABIs and any change would break those.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de >
Acked-by: Willy Tarreau <w@1wt.eu >
2025-04-22 10:56:23 +02:00
Alexei Starovoitov
5709be4c35
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf after rc3
...
Cross-merge bpf and other fixes after downstream PRs.
No conflicts.
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
2025-04-21 08:04:38 -07:00