summaryrefslogtreecommitdiffstats
path: root/src/udev (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* fd-uitl: rename PIPE_EBADF → EBADF_PAIR, and add EBADF_TRIPLETLennart Poettering2023-10-262-2/+2
| | | | | | | | We use it for more than just pipe() arrays. For example also for socketpair(). Hence let's give it a generic name. Also add EBADF_TRIPLET to mirror this for things like stdin/stdout/stderr arrays, which we use a bunch of times.
* udev: strdupa() → strdupa_safe()Frantisek Sumsal2023-10-251-1/+1
|
* io-util: split out "struct iovec" related calls into their own .c/.h filesLennart Poettering2023-10-202-2/+2
| | | | | | | | | This is preparation for #28891, which adds a bunch more helpers around "struct iovec", at which point this really deserves its own .c/.h file. The idea is that we sooner or later can consider "struct iovec" as an entirely generic mechanism to reference some binary blob, and is the go-to type for this purpose whenever we need one.
* fuzz: unify logging setupFrantisek Sumsal2023-10-193-8/+3
| | | | | | | | | | Make sure we don't log anything when running in "fuzzing" mode. Also, when at it, unify the setup logic into a helper, pretty similar to the test_setup_logging() one. Addresses: - https://github.com/systemd/systemd/pull/29558#pullrequestreview-1676060607 - https://github.com/systemd/systemd/pull/29558#discussion_r1358940663
* meson: add build option for install path of main config filesFranck Bui2023-10-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows distros to install configuration file templates in /usr/lib/systemd for example. Currently we install "empty" config files in /etc/systemd/. They serve two purposes: - The file contains commented-out values that show the default settings. - It is easier to edit the right file if it is already there, the user doesn't have to type in the path correctly, and the basic file structure is already in place so it's easier to edit. Things that have happened since this approach was put in place: - We started supporting drop-ins for config files, and drop-ins are the recommended way to create local configuration overrides. - We have systemd-analyze cat-config which takes care of iterating over all possible locations (/etc, /run, /usr, /usr/local) and figuring out the right file. - Because of the first two points, systemd-analyze cat-config is much better, because it takes care of finding all the drop-ins and figuring out the precedence. Looking at files manually is still possible of course, but not very convenient. The disadvantages of the current approach with "empty" files in /etc: - We clutter up /etc so it's harder to see what the local configuration actually is. - If a user edits the file, package updates will not override the file (e.g. systemd.rpm uses %config(noreplace). This means that the "documented defaults" will become stale over time, if the user ever edits the main config file. Thus, I think that it's reasonable to: - Install the main config file to /usr/lib so that it serves as reference for syntax and option names and default values and is properly updated on package upgrades. - Recommend to users to always use drop-ins for configuration and systemd-analyze cat-config to view the documentation. This setting makes this change opt-in. Fixes #18420. [zjs: add more text to the description]
* Merge pull request #29242 from fbuihuu/update-main-config-file-headersZbigniew Jędrzejewski-Szmek2023-10-171-2/+5
|\ | | | | config files: update their header to reflect that they can be install…
| * config files: update their header to reflect that they can be installed in /usrFranck Bui2023-09-211-2/+5
| | | | | | | | Follow-up for c76f2fb0e59340222ce21f85c17d384c114db9de.
* | udev: Enable filtering the output of udevadm info --export-dbDaan De Meyer2023-10-161-30/+206
| | | | | | | | | | | | | | | | | | | | Let's support the same filtering options that we also support in udevadm trigger in udevadm info to filter the devices produced by --export-db. One difference is that all properties specified by --propery-match= have to be satisfied in udevadm info unlike udevadm trigger where just one of them has to be satisfied.
* | Add --json switch to udevadm infoDaan De Meyer2023-10-161-4/+78
| | | | | | | | | | This allows getting the udevadm info --export-db and query "all" output as JSON.
* | cgroup-util: drop "controller" argument from various cgroup helper callsLennart Poettering2023-10-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | systemd's own cgroup hierarchy is special to us, we use it to actually manage processes. Because of that many calls tha apply to cgroups are only ever called with the SYSTEMD_CGROUP_CONTROLLER as controller argument. Let's hence remove the argument altogether. This in particular touches the kill and xattr routines. This changes no behaviour, we just drop an argument that is always set to the same value anyway. This is preparation to eventually getting rid of the cgroupvs1, because on cgroupvs2 the cgroup paths do not change for different controllers, there's only a single hierarchy there.
* | Merge pull request #29403 from ↵Daan De Meyer2023-10-042-3/+15
|\ \ | | | | | | | | | | | | yuwata/journal-decouple-journald-and-journal-remote journal: drop ManagedJournalFile and decouple journald and journal-remote
| * | test: split test-tables into threeYu Watanabe2023-10-022-3/+15
| | | | | | | | | | | | | | | Let's drop dependency to libjournal_core and libudevd_core from test-tables.
* | | udevadm: avoid side-effect in assert()NRK2023-10-021-2/+2
|/ / | | | | | | | | this was found when trying to use __builtin_assume() with clang: https://github.com/systemd/systemd/pull/29409#issuecomment-1743575402
* | Merge pull request #29193 from keszybz/path-util-adjustmentDaan De Meyer2023-09-291-5/+4
|\ \ | | | | | | Make unit mangling follow paths
| * | tree-wide: add path_simplify_alloc() and use itZbigniew Jędrzejewski-Szmek2023-09-221-5/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | path_simplify_full()/path_simplify() are changed to allow a NULL path, for which a NULL is returned. Generally, callers have already asserted before that the argument is nonnull. This way path_simplify_full()/path_simplify() and path_simplify_alloc() behave consistently. In sd-device.c, logging in device_set_syspath() is intentionally dropped: other branches don't log. In mount-tool.c, logging in parse_argv() is changed to log the user-specified value, not the simplified string. In an error message, we should show the actual argument we got, not some transformed version.
* | udev: raise RLIMIT_NOFILE as high as we canLennart Poettering2023-09-261-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | We might need a lot of fds on large systems, hence raise RLIMIT_NOFILE to what the service manager allows us, which is quite a lot these days. udev already sets FORK_RLIMIT_NOFILE_SAFE when forking of chilren, thus ensuring that forked off processes get their RLIMIT_NOFILE soft limit reset to 1K for compat with crappy old select(). Replaces: #29298 Fixes: #28583
* | scsi_serial: convert from nanosleep() to usleep_safe()Lennart Poettering2023-09-201-5/+2
|/
* Revert "tree-wide: Mount file descriptors via /proc/<pid>/fd"Lennart Poettering2023-09-081-2/+1
|
* io-util: introduce loop_write_full that takes a timeoutMike Yuan2023-09-071-1/+1
| | | | | Also drop do_poll as the use case is covered by timeout.
* tree-wide: Always include <net/if.h> before related linux headersDaan De Meyer2023-08-141-1/+2
| | | | | Otherwise, we get redefinition errors if <net/if.h> is included later on by another header.
* meson: drop unnecessary dependency on libidnYu Watanabe2023-08-121-1/+0
|
* udev-builtin-net_id: use strjoin() if possibleYu Watanabe2023-08-101-5/+6
| | | | | Addresses the post-merge comment https://github.com/systemd/systemd/pull/28623#pullrequestreview-1571307466.
* udev-builtin-net_id: add more debugging logsYu Watanabe2023-08-101-29/+33
|
* udev-builtin-net_id: introduce get_first_syspath_component() helper functionYu Watanabe2023-08-101-39/+46
| | | | | Obtaining a component from syspath is a common pattern. Let's split out the pattern. No functional change, just refactoring.
* udev-builtin-net_id: introduce get_matching_parent() helper functionYu Watanabe2023-08-101-71/+55
| | | | | The pattern is common in many naming scheme. Let's split out the pattern. No functional change, just refactoring.
* udev-builtin-net_id: fix potential invalid memory accessYu Watanabe2023-08-091-6/+2
| | | | | | Follow-up for 28141620d963c0c490d409d6ec6ff5f143357124. Addresses post-merge review in #28269.
* proc-cmdline: make proc_cmdline_get_bool() take flagsYu Watanabe2023-08-091-1/+1
| | | | | | All other command line parsers takes flags. Let's make proc_cmdline_get_bool() also take flags. Though, currently, no flag is set by the caller.
* meson: use install_emptydir() and drop meson-make-symlink.shYu Watanabe2023-08-081-5/+3
| | | | | | The script is mostly equivalent to 'mkdir -p' and 'ln -sfr'. Let's replace it with install_emptydir() builtin function and inline meson call.
* udev: allow to set the maximum number of worker process to 0Yu Watanabe2023-08-051-1/+4
| | | | In that case, the maximum is calculated based on the system resources.
* udev: split out manager_set_default_children_max()Yu Watanabe2023-08-052-20/+29
|
* meson: also merge declarations of fuzzers with other executablesYu Watanabe2023-08-031-28/+20
|
* meson: merge declarations of normal and test executablesYu Watanabe2023-08-031-62/+53
|
* test: rename udev-rule-runner -> test-udev-rule-runnerYu Watanabe2023-08-032-0/+195
| | | | | | | | | | This partially revert 0454cf05d38d289474ca65c1917d414b2958f6b5. The executable actually does not work with itself, but needs to be combined with test-udev.py. But, even so, the executable is for testing. In the next commit, test and normal executables are declared in the same way, and naming of the executable becomes essential to classify them. Let's rename the executable and prefix with 'test-'.
* meson: use template to declare udev pluginsYu Watanabe2023-08-031-33/+49
|
* meson: introduce HAVE_DMI flagYu Watanabe2023-08-031-2/+1
| | | | | The condition is used at several places. Let's introduce a simple flag for that.
* Merge pull request #28623 from yuwata/udev-builtin-net_id-cleanupsLuca Boccassi2023-08-011-208/+169
|\ | | | | udev: several cleanups for net_id builtin (part 4)
| * udev-builtin-net_id: first parse USB or BCMA identifier, then parse PCI ↵Yu Watanabe2023-08-011-131/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | properties Previously, we first generate names based on the PCI slot and ACPI onboard index, and then append an identifier based on USB or BCMA bus if it exists in between the PCI bus and the interface. However, if there exists USB or BCMA bus, the name based on the ACPI onboard index is not used. So, let's invert the order; first generate USB or BCMA identifier if the bus exists, then prepend the name with the PCI slot identifier. With this change, we can drop Names struct, and each naming logic becomes self-consistent.
| * udev-builtin-net_id: split out names_pci_onboard_label() from dev_pci_onboard()Yu Watanabe2023-08-011-17/+32
| | | | | | | | | | | | Then call it only when it is necessary. The label is used only when the interface is directly connected to the PCI bus, and it does not have the SR-IOV feature (or the naming based on SR-IOV is disabled).
| * udev-builtin-net_id: drop redundant copy of BCMA identifier in names_bcma()Yu Watanabe2023-08-011-21/+13
| | | | | | | | | | | | | | Then, this makes names based on the BCMA and PCI identifiers in names_bcma(). No functional change, just refactoring.
| * udev-builtin-net_id: split out get_bcma_specifier() from names_bcma()Yu Watanabe2023-08-011-17/+37
| | | | | | | | | | | | | | | | This contains redundant copy of BCMA identifier, but that will be dropped in the next commit. No functional change, just refactoring and preparation for later commits.
| * udev-builtin-net_id: drop redundant copy of USB identifier in names_usb()Yu Watanabe2023-08-011-36/+28
| | | | | | | | | | | | | | This makes the names based on the USB identifier (and possibly with PCI specifier) built in names_usb() No functional change, just refactoring.
| * udeb-builtin-net_id: split out get_usb_specifier() from names_usb()Yu Watanabe2023-08-011-40/+59
| | | | | | | | | | | | | | | | This contains redundant copy of USB identifier, but that will be dropped in the next commit. No functional change, just refactoring and preparation for later commits.
* | Merge pull request #28620 from yuwata/meson-use-template-part5Daan De Meyer2023-08-011-0/+21
|\ \ | |/ |/| meson: use template to declare executables (part 5)
| * meson: move declarations of socket-proxy, udevadm, quotacheck, and shutdownYu Watanabe2023-08-011-0/+21
| |
* | udev-builtin-net_id: fix potential buffer overflowYu Watanabe2023-08-011-2/+2
| |
* | udev-builtin-net_id: various coding style cleanupsYu Watanabe2023-08-011-5/+6
| |
* | udev-builtin-net_id: introduce device_is_stacked() helper functionYu Watanabe2023-08-011-23/+8
| | | | | | | | | | Then, we can drop LinkInfo struct. No functional change, just refactoring.
* | udev-builtin-net_id: drop unused argumentsYu Watanabe2023-08-011-11/+8
|/
* udev-builtin-net_id: split-out pci_get_onboard_index() from dev_pci_onboard()Yu Watanabe2023-08-011-25/+32
| | | | | | | | | | This also changes the onboard index type to unsigned, as it is at most 2^16 - 1. Hence, unsigned is enough. Then, we can use device_get_sysattr_unsigned() helper function. This also drops mostly redundant debugging logs. The index will be logged later anyway.
* udev-builtin-net_id: split-out get_pci_slot_specifiers()Yu Watanabe2023-08-011-38/+54
| | | | | | Then, we can replace multiple strpcpyf() with single snprintf_ok(). No functional change, just refactoring.