Commit Graph
49 Commits
Author SHA1 Message Date
Matt Fleming 4dcbfbb1ad process-util: Add support SCHED_EXT scheduling policy
Allow CPUSchedulingPolicy to be set to "ext". SCHED_EXT is a new
scheduling policy in Linux v6.12 that allows processes to be scheduled
using custom BPF schedulers instead of the default in-kernel ones.

Selectively setting the SCHED_EXT policy is useful for systems running
in "partial mode" where not all processes are run using a custom
scheduler.

Fallback to SCHED_OTHER and print an error message for systems where
SCHED_EXT isn't available.
2025-12-20 18:31:55 +01:00
Luca Boccassi 28c5929e90 Update syscalls table
ninja -C build update-syscall-tables update-syscall-header
2025-12-17 13:33:26 +00:00
Luca Boccassi e20e9d2968 include: update kernel headers from v6.19~rc1 2025-12-16 11:43:29 +00:00
Yu Watanabe 53f5aa3fd2 musl: introduce wrappers for getopt() and getopt_long()
musl's getopt_long() behaves something different in handling optional arguments:
```
$ journalctl _PID=1 _COMM=systemd --since 19:19:01 -n all --follow
Failed to add match 'all': Invalid argument
```
This introduces getopt_long_fix() that reorders the passed arguments to make
getopt_long() provided by musl works as what we expect.

Also, musl's getopt() always behaves POSIXLY_CORRECT mode, and stops parsing
arguments when a non-option string found. Let's always use getopt_long().
2025-12-05 11:01:09 +01:00
Yu Watanabe 26b2085d54 include: update kernel headers from v6.18 2025-12-04 11:10:03 +00:00
Yu Watanabe 69646ac0e2 include: fix typo
Follow-up for ec32732043.
2025-12-04 07:50:26 +09:00
Luca Boccassi 2ded1c5a6e syscalls: add 'pragma export' to script that generates header
Otherwise it gets lost every time the header is regenerated

Follow-up for 3111327ca4
2025-11-26 01:15:33 +00:00
Daan De Meyer 87fbd33372 clang-tidy: Fix all remaining misc-include-cleaner violations
- Remove unused includes
- Add common false positive headers to misc-include-cleaner.IgnoreHeaders
- Add IWYU pragma keep for uncommon false positive headers
2025-11-22 10:19:41 +01:00
Yu Watanabe bd3fc5c539 Revert "musl: utmpx: add several missing definitions"
This reverts commit 3ae7d8fd87.

Now utmp support is always disabled when building with musl,
and all definitions are unused in that case. Let's remove it.
2025-11-18 03:06:02 +09:00
Luca Boccassi b186ce49de Chores for RC1 (#39757) 2025-11-17 10:53:15 +00:00
Luca Boccassi 5b81a76313 Update syscalls table
ninja -C build update-syscall-tables update-syscall-header
2025-11-17 08:56:39 +00:00
Yu Watanabe 07e437f569 musl: glob-util: filter out . and .. even if GLOB_ALTDIRFUNC is not supported
musl neither support GLOB_ALTDIRFUNC nor GLOB_BRACE.
Let's make safe_glob() work even when GLOB_ALTDIRFUNC is not supported.
Currently, GLOB_BRACE is simply ignored when it is not supported.
2025-11-17 12:19:22 +09:00
Emil Renner BerthingandYu Watanabe 3bc03c67f0 musl: add fallback parse_printf_format() implementation
musl does not provide parse_printf_format(). Let's introduce a fallback
method.

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
2025-11-17 12:19:22 +09:00
Yu Watanabe 3ae7d8fd87 musl: utmpx: add several missing definitions 2025-11-17 11:27:07 +09:00
Yu Watanabe 384e88a238 musl: stdio: check if stream is writable earlier in fputs() and friends 2025-11-15 05:10:33 +09:00
Yu Watanabe 46ea7c3e32 musl: make strtoll() accept strings start with dot
glibc accepts strings start with '.' and returns 0, but musl refuses
them. Let's accept them, as our code assumes the function accept such
strings.
2025-11-15 03:41:40 +09:00
Yu Watanabe ebb422dd2b musl: introduce GNU specific version of strerror_r()
musl provides XSI compliant strerror_r(), and it is slightly different
from the one by glibc.
Let's introduce a tiny wrapper to convert XSI strerror_r() to GNU one.

The wrapper also patches musl's spurious catchall error message.
2025-11-15 03:37:30 +09:00
Yu Watanabe 69dd6d9420 musl: add several missing statx macros
glibc's sys/stat.h includes linux/stat.h, and we have copy of it from
the latest kernel, hence all new flags are always defined.
However, musl's sys/stat.h does not include linux/stat.h, and moreover,
they conflict with each other, hence we cannot include both header
simultaneously. Let's define missing macros to support musl.
2025-11-14 04:59:03 +09:00
Chen QiandYu Watanabe dd102894e7 musl: add missing FTW_CONTINUE macro
This is to avoid build failures like below for musl.

  test-recurse-dir.c:23:24: error: ‘FTW_CONTINUE’ undeclared

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
2025-11-14 04:59:03 +09:00
Yu Watanabe 8324ef4213 musl: replace netinet/if_ether.h with our own implementation
musl's netinet/if_ether.h conflicts with linux/if_ether.h.
The reimplementation is mostly equivalent with what glibc does.
2025-11-14 04:59:03 +09:00
Yu Watanabe 6400e8dbd9 musl: provide several missing definitions for prctl() 2025-11-14 04:59:03 +09:00
Yu Watanabe 03d0fa4e4f musl: introduce dummy function for gnu_get_libc_version()
As the header gnu/libc-version.h and gnu_get_libc_version() function
are glibc specific, and musl does not provide them.
2025-11-14 04:59:03 +09:00
Yu Watanabe bc610c70af musl: introduce dummy functions for mallinfo(), malloc_info(), and malloc_trim()
These functions are not provided by musl.
2025-11-14 04:59:03 +09:00
Yu Watanabe a2b7bcce27 musl: introduce dummy gshadow header file for userdb
Even 'gshadow' meson option is disabled, src/shared/userdb.c and
src/shared/user-record-nss.c include gshadow.h unconditionally.
Let's introduce dummy header to make them compiled gracefully.
2025-11-14 04:59:03 +09:00
Yu Watanabe 17e343b58b musl: meson: check existence of renameat2()
musl-1.2.5 does not provide renameat2(). Note, it is added by
https://github.com/kraj/musl/commit/05ce67fea99ca09cd4b6625cff7aec9cc222dd5a,
hence hopefully it will be provided by musl-1.2.6 or newer.
2025-11-13 04:44:00 +09:00
Yu Watanabe 907ce9c315 libc: drop unnecessary __THROW attribute
It is for C++, not necessary for us.
2025-11-12 14:17:44 +08:00
Yu Watanabe 208f88def3 include: update struct pidfd_info and relevant constants 2025-10-19 10:01:46 +09:00
Yu Watanabe b31a571849 include: import linux/coredump.h from kernel v6.17.1 2025-10-19 10:01:46 +09:00
Yu Watanabe bb437748da include: update kernel headers from v6.17.1 2025-10-12 22:17:56 +02:00
Zbigniew Jędrzejewski-Szmek ea44302b29 meson: using f-strings in meson
Those were added before 0.61 which is our minimum version.

Dots were dropped from the end of some messages. Most messages did not have the
trailing dot.

0.63 added support for multi-line f-strings. We can't use those yet.
2025-10-03 21:21:52 +02:00
Daan De Meyer 3111327ca4 include: Add missing IWYU pragmas 2025-09-19 12:44:29 +02:00
Luca Boccassi 01caeddbe3 Update syscall numbers
ninja -C build update-syscall-tables update-syscall-header
2025-09-17 09:48:00 +01:00
Luca Boccassi 27a1e162a1 Update syscalls tables
ninja -C build update-syscall-tables update-syscall-header
2025-08-20 13:19:51 +01:00
Yu Watanabe 4dfadc90fd include: update kernel headers from v6.17-rc1 2025-08-11 22:22:16 +09:00
Yu Watanabe 706e622e88 include: update kernel headers from v6.16-rc7
- netfilter changes in v6.16-rc1 were reverted,
- vm_sockets.h now includes sys/socket.h, hence our workaround is not
  necessary anymore.
2025-07-27 23:50:06 +01:00
Luca Boccassi d6a70c1523 syscalls table: add sh (#38338) 2025-07-25 19:23:00 +01:00
Luca Boccassi a50c687b01 syscalls-table: add sh and regenerated table 2025-07-25 17:17:28 +01:00
Zbigniew Jędrzejewski-Szmek 5e405f612e meson: add instructions for adding new arch to syscall.h 2025-07-25 17:53:48 +02:00
Zbigniew Jędrzejewski-Szmek c5dcbd073e meson: use files() not find_program() for helper scripts
We went back and forth between 'prog.sh', files('prog.sh'), and
find_program('prog.sh'). We want to use files() or find_program() so that we
get a good error message if the file is missing. Behaviour of meson changed
over time, and in the past not all forms could be used in all places. For
example 0f4c4f3824 added find_program() in many
places to avoid repeated messages. But it seems that all recent meson versions
work fine with files().

find_program prints silly messages:
  Program tools/make-man-index.py found: YES
       (/home/zbyszek/src/systemd/tools/make-man-index.py)
  Program tools/meson-render-jinja2.py found: YES
       (/home/zbyszek/src/systemd/tools/meson-render-jinja2.py)
  ...
We know that those files will be found, they are part of the git checkout.
With files() this is gone and the meson output is easier to read.
2025-07-25 14:04:17 +02:00
Zbigniew Jędrzejewski-Szmek 8aedfd979f tools: make all .py program files executable
All those files are standalone programs that can be executed directly.
Some .py files were marked executable, others weren't, probably accidentally.
Mark them all as executable in preparation for subsequent changes.
2025-07-25 12:33:13 +02:00
Yu Watanabe 2b69797b6d Include more headers explicitly (#38169)
Similar to the recent change like
4f18ff2e29.
2025-07-11 20:21:33 +09:00
Yu Watanabe 2bdabb167b basic: rename cap-list.c -> capability-list.c
This also renames relevant files in the same way.

Addresses https://github.com/systemd/systemd/pull/37904#discussion_r2191950396
2025-07-11 18:33:43 +09:00
Yu Watanabe 0c443a8800 tree-wide: include asm/sgidefs.h to make _MIPS_SIM_ABI32 and friends defined
The header provides _MIPS_SIM_ABI32 and friends. Glibc indirectly includes
the header through sys/syscall.h or unistd.h, but let's explicitly include
the header where we use _MIPS_SIM_ABI32 and friends.
2025-07-11 17:26:28 +09:00
Yu Watanabe c35606b272 include: use unit8_t for uuid
To emphasize it is an array of bytes.
This also align variables.
No functional changes. Just refactoring.
2025-07-11 13:05:46 +09:00
Yu Watanabe 3fc2a44043 include: move trivial kernel header wrappers to src/include/override/ 2025-07-11 13:05:46 +09:00
Yu Watanabe 543a48b653 libc-wrapper: introduce a tiny libc wrapper
Then, move syscall definitions to the wrapper, and prototypes are moved
to relevant headers.

This also adds checks for add_key() and request_key(), as one day
glibc may be going to add some of them separatedly.

The check for fspick in meson.build is dropped, as it is currently
unused in our code.

This also moves
- basic/missing_bpf.h -> include/override/linux/bpf.h,
- basic/missing_keyctl.h -> include/override/linux/keyctl.h.
2025-07-11 13:05:46 +09:00
Yu Watanabe da522c9921 basic: move basic/missing_syscall_defs.h -> include/override/sys/syscall.h
This also moves syscall tables and generators to the same directory.

Note, inclusion of asm/sgidefs.h is dropped, as it is already included
by unistd.h and sys/syscall.h.
2025-07-11 13:05:46 +09:00
Yu Watanabe 2b912d2066 tree-wide: several cleanups for generating symbol lists and gperf files
- pass our system include directories to make generators use our libc
  wrappers and latest kernel headers,
- include relevant headers in generated gperf file,
- use files() rather than find_program(), as the result of
  find_program() cannot be passed to 'input' of custom_target(),
- move generate-bpf-delegate-configs.py to src/core/, as it is only used
  by libcore.
2025-07-11 13:05:42 +09:00
Yu Watanabe 1a60b97524 include: move libc header wrappers to src/include/override/, and kernel headers to src/include/uapi/
Preparation for later changes.
2025-07-11 12:44:26 +09:00