Commit Graph

6178 Commits

Author SHA1 Message Date
Lennart Poettering
515e1e6d35 macro: move PTR_TO_SIZE() macros to fundamental 2024-06-26 16:01:20 +02:00
Lennart Poettering
ba81c365f8 macro: also move FOREACH_ARRAY()/FOREACH_ELEMENT() to fundamental
This is also very useful in EFI code.
2024-06-26 16:01:06 +02:00
Lennart Poettering
72b1809bbc macro: move sizeof_field() macro into src/fundamental/
Let's make this macro available for our EFI code too.
2024-06-26 16:00:43 +02:00
Yu Watanabe
c8210d98a4 terminal-util: several cleanups for ColorMode
- introduce or rename usual enum values _MAX and _INVALID,
- introduce and use string table lookup functions,
- split out implementation of get_color_mode() to _impl(),
- add tests for get_color_mode().
2024-06-24 17:57:07 +09:00
Yu Watanabe
5f0b72e53b terminal-util: merge COLOR_ON with COLOR_24BIT
Currently, we assume that there is no restriction on coloring when
COLOR_24BIT. Let's merge the two values.

Follow-up for a5efbf468c.
2024-06-24 17:57:07 +09:00
Yu Watanabe
6eabe9f2ff terminal-util: use colon as separator for specifying color
Then, terminal will safely ignore unsupported features, like colored
underline.

Fixes a regression caused by 891abc9cf1.
Fixes https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1074073.
Fixes #33449.
2024-06-24 17:57:07 +09:00
Yu Watanabe
de732ade09 Merge pull request #33034 from yuwata/update-kernel-headers
basic/linux: update kernel headers from v6.10-rc3
2024-06-20 03:53:16 +09:00
Yu Watanabe
3176c78e68 Merge pull request #32868 from keszybz/more-whomification
Fix confusion between killer and prey
2024-06-20 02:59:14 +09:00
Yu Watanabe
0b37761936 missing: drop BCACHEFS_SUPER_MAGIC as it is now defined in linux/magic.h 2024-06-20 02:35:35 +09:00
Yu Watanabe
0cced2948f basic/linux: update kernel headers from v6.10-rc3
This also
- merges basic/linux and shared/linux,
- moves BPF_JUMP_A() to basic/missing_bpf.h,
- copies from usrspace kernel headers directory generated by 'make headers',
  rather than copying from kernel tree,
- copies const.h into our tree to reduce change in ethtool.h,
- copies auto_fs.h into our tree to reduce change in auto_dev-ioctl.h.
2024-06-20 02:35:35 +09:00
Zbigniew Jędrzejewski-Szmek
ff3f29537c various: move ptr indicator to return value 2024-06-19 16:37:12 +02:00
Zbigniew Jędrzejewski-Szmek
bfd5a0687f various: move const ptr indicator to return value 2024-06-19 16:28:28 +02:00
Yu Watanabe
f2d2aa0934 strv: replace always-true condition with assertion
Follow-up for aca093018c.
Fixes CID#1547105.
2024-06-18 21:09:04 +01:00
Luca Boccassi
5d42acada4 Merge pull request #33376 from yuwata/strv_sort_uniq
strv: introduce strv_sort_uniq()
2024-06-18 00:22:19 +01:00
Luca Boccassi
05c0671ce8 Merge pull request #33377 from yuwata/strbuf-cleanups
strbuf: several cleanups
2024-06-17 20:08:22 +01:00
Luca Boccassi
656b0f5031 Merge pull request #32559 from poettering/varlink-comments
varlink: add nice commenting to our varlink IDL data
2024-06-17 18:53:11 +01:00
Mike Yuan
f3d7ceb5c5 Merge pull request #32872 from YHNdnzj/pidref-inode
pidref: record pidfd inode number in PidRef struct
2024-06-17 18:47:44 +02:00
Yu Watanabe
e367b42664 tree-wide: replace strv_sort() + strv_uniq() -> strv_sort_uniq() 2024-06-18 00:37:50 +09:00
Yu Watanabe
6548aef1cd strbuf: use _cleanup_ attribute at one more place 2024-06-18 00:26:15 +09:00
Yu Watanabe
c616e30e9c strbuf: several cleanups
- use FOREACH_ARRAY(),
- add one missing assertion,
- reduce indentation.
2024-06-18 00:26:15 +09:00
Yu Watanabe
7b12b86450 strbuf: use CMP() macro
strbuf_child_entry.c is uint8_t, so using CMP() is safer.

This also adds missing assertions.
2024-06-18 00:26:15 +09:00
Yu Watanabe
3dc546ad75 strv: introduce strv_sort_uniq()
We often call strv_sort() and strv_uniq(). If a strv is already sorted.
uniquifying can be faster.

Prompted by https://github.com/systemd/systemd/pull/33012#discussion_r1636633627.
2024-06-18 00:22:33 +09:00
Luca Boccassi
9981bc210a Merge pull request #33355 from YHNdnzj/shutdown-cad
shutdown: re-enable CAD handling in kernel at start, several other cleanups
2024-06-17 09:19:08 +01:00
Lennart Poettering
aca093018c strv: add new helper strv_rebreak_lines() with a simple line breaking algorithm 2024-06-17 09:20:21 +02:00
Lennart Poettering
9632f8b465 utf8: export utf8_char_console_width() 2024-06-17 09:20:21 +02:00
Mike Yuan
e2b812c804 string-util: introduce string_is_safe_ascii helper 2024-06-16 19:07:35 +02:00
Mike Yuan
4d06bf5922 basic/utf8: modernize ascii_is_valid_n, make ascii_is_valid static inline 2024-06-16 19:07:35 +02:00
Mike Yuan
7ff7161044 basic/utf8: modernize utf8_is_valid_n a bit 2024-06-16 19:07:34 +02:00
Luca Boccassi
2a00e92598 Merge pull request #33352 from YHNdnzj/freeconp-void
Trivial follow-ups for recent PRs
2024-06-15 19:57:13 +01:00
Mike Yuan
c1bf0571c0 string-util: modernize first_word a bit 2024-06-15 19:19:39 +02:00
Lennart Poettering
4d6222b6a4 random-util: add crypto_random_bytes_allocate_iovec()
Just a simple helper that allocates some memory, initializes it
randomly, and places this in a struct iovec.
2024-06-15 12:43:37 +01:00
Mike Yuan
c89d1e425a missing_loop: add missing assertions for fallback values 2024-06-15 13:05:50 +02:00
Mike Yuan
609bc3ae16 Merge pull request #33037 from keszybz/dlopen-open-code-definitions
Make dlopen macros more explicit and drop mac_selinux_free()
2024-06-15 12:49:59 +02:00
Lennart Poettering
bba55185de utf8: let utf8_console_width() handle NULL strings somewhat reasonably 2024-06-15 00:46:42 +01:00
Luca Boccassi
78fb0ca46d Merge pull request #33325 from poettering/vsock-ret-optional
socket-util: make return parameter for socket_address_parse_vsock() o…
2024-06-15 00:45:28 +01:00
Raphaël Mélotte
56ab1c5449 src/basic/missing_loop.h: fix missing LOOP_SET_BLOCK_SIZE
Builds with kernels headers < 4.14 fail with:

../src/shared/loop-util.c: In function ‘loop_configure_fallback’:
../src/shared/loop-util.c:237:31: error: ‘LOOP_SET_BLOCK_SIZE’ undeclared (first use in this function); did you mean ‘LOOP_SET_DIRECT_IO’?
                 if (ioctl(fd, LOOP_SET_BLOCK_SIZE, (unsigned long) c->block_size) < 0)
                               ^~~~~~~~~~~~~~~~~~~
                               LOOP_SET_DIRECT_IO

Fixes: https://github.com/systemd/systemd/issues/33341

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
2024-06-15 00:01:44 +01:00
Lennart Poettering
c29778a100 fs-util: add simple open_mkdir() wrapper 2024-06-14 23:50:59 +01:00
Lennart Poettering
b22635083a string-util: make sure strrepa() doesn't doubly evaluate expressions 2024-06-14 23:50:03 +01:00
Lennart Poettering
dc163cd40b fileio: add new helper write_base64_file_at() which encodes a binary object into base64 and writes it to a file 2024-06-14 22:50:33 +01:00
Lennart Poettering
b4aaba2bb0 utf8: assume tabs are 8 characters wide when written to console 2024-06-14 21:17:20 +01:00
Mike Yuan
15930d5d9f pidref: record pidfd inode number in PidRef struct
Besides internal comparisons, the inode number of pidfds
might be interesting directly to users, too. In the future
this field should also be exposed, so that it can serve as
a unique identifier of a process (but only for display,
as there's no method to map this back to a pid or pidfd).
2024-06-14 16:59:13 +02:00
Mike Yuan
1b6239632d pidref: introduce pidfd_inode_ids_supported helper
Also, correct the comment about pidfs (added in kernel 6.9
rather than 6.8).

Co-authored-by: Lennart Poettering <lennart@poettering.net>
2024-06-14 16:46:03 +02:00
Lennart Poettering
432977a0a4 iovec-util: add exported constant empty but valid (i.e. non-NULL) iovec
Also, make sure the NUL byte iovec becomes an exported constant too.

This is better than the previous situation where this was a macro
resolving to a compount expression, since the lifetime of the expression
is limited to its invoking scope. By turning this into a proper variable
the lifetime becomes unbounded, which makes it easier to use in various
scenarios, such as "if" blocks.
2024-06-14 12:42:07 +01:00
Lennart Poettering
59c8110ac6 socket-util: make return parameter for socket_address_parse_vsock() optional 2024-06-14 11:12:56 +02:00
Mike Yuan
0160a1dbbc io-util: move fputs_with_newline to fileio
Follow-up for cdf6f34a2f

We already have other fputs()-like helpers in fileio rather than
io-util. While at it, switch the order of params.
2024-06-13 15:56:02 +01:00
Lennart Poettering
cdf6f34a2f io-util: add new helper fputs_with_newline() 2024-06-13 09:33:13 +02:00
Zbigniew Jędrzejewski-Szmek
5c672e90a6 basic/dlfcn-util: deobfuscate macro definitions
When looking at how dlopen for various libs is implemented, I found that the
macros hide too much. I find it much easier to see what is going on if 'extern'
and '= NULL' are written explicitly. After all, we don't hide those for other
definitions, e.g. our style guide says that static variables should be
initialized with '= NULL'. With that change, it's much more obvious what is
a variable declaration and what is a variable initialization.
2024-06-12 15:21:15 +02:00
Luca Boccassi
aa6d1f16e8 Merge pull request #33284 from yuwata/hwdb-optimize
hwdb: improve performance
2024-06-12 14:02:25 +01:00
Yu Watanabe
21f51d877f Merge pull request #32961 from YHNdnzj/starttime-main
core/service: try to query for new main process's starttime
2024-06-12 19:12:37 +09:00
Yu Watanabe
707890d4ff Merge pull request #33074 from keszybz/bpf-fd-handling
Small cleanups in bpf code
2024-06-12 18:44:30 +09:00