summaryrefslogtreecommitdiffstats
path: root/src/import (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* importd: trivial modernizationsLennart Poettering2024-03-016-18/+17
|
* importd: switch to pidrefLennart Poettering2024-03-011-13/+20
|
* curl-util: fix downloads from file:// URLsLennart Poettering2024-03-012-7/+32
| | | | | | | | | if we try to open file:// URLs that don't exist, we'll not get IO/timer events about it, hence it is not sufficient to check for completion in these events. Let's add a defer event, to deal with that. Also, curl_multi_info_read() is a queue, make sure to handle all events that might be queued.
* signal-util: imply sentinel -1 in sigprocmask_many() + sigset_add_many() ↵Lennart Poettering2024-02-233-4/+4
| | | | args list
* importd: port importd over to new invoke_callout_binary() APILennart Poettering2024-02-211-2/+5
|
* tree-wide: replace FOREACH_POINTER with FOREACH_ARGUMENTMike Yuan2024-01-243-19/+19
| | | | | The latter is more generic and while being compatible with the former.
* importd: use Type=notifyMike Yuan2024-01-091-13/+12
|
* hexdecoct: make unbase64mem and unhexmem always use SIZE_MAXMike Yuan2024-01-081-1/+1
|
* bus-polkit: port polkit_registry to use value destructors in hash_opsLennart Poettering2024-01-031-1/+1
|
* tree-wide: drop space between variable and an increment/decrementYu Watanabe2023-12-241-1/+1
|
* polkit: simplify bus_verify_polkit_async() + drop auth-by-cap dbus featureLennart Poettering2023-12-211-24/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This simplifies bus_verify_polkit_async() and related calls quite a bit: 1. This removes any support for authentication-by-Linux-capability. This is ultimately a kdbus leftover: with classic AF_UNIX transports we cannot authenticate by capabilities securely (because we cannot acquire it from the peer without races), hence we never actually did. Since the necessary kernel work didn't materialize in the last 10y, and is unlikely to be added, let's just kill this context. We cannot quite remove the caps stuff from sd-bus for API compat, but for our polkit logic let's kill it. 2. The "good_uid" and "interactive" params are only necessary in very few cases, hence let's move them to a new call bus_verify_polkit_async_full() and make bus_verify_polkit_async() a wrapper around it without those two parameters. This also fixes a bunch of wrong uses of the "interactive" bool. The bool makes no sense today as the ALLOW_INTERACTIVE_AUTHORIZATION field in the D-Bus message header replaces it fully. We only need it to implement method calls we introduced prior to that header field becoming available in D-Bus. And it should only be used on such old method calls, and otherwise always be set to false. This does not change behaviour in any way. Just simplifies stuff. Fixes: #21586
* import: append % to X_IMPORT_PROGRESS=Frantisek Sumsal2023-11-257-7/+7
| | | | | | | | | | | | | | | | Since we parse it on the other side via parse_percent() which requires that, otherwise we get an error: [ 8.133131] testsuite-13.sh[649]: + machinectl import-raw /tmp/container.raw container-raw [ 8.175035] machinectl[1143]: Enqueued transfer job 1. Press C-c to continue download in background. [ 8.182130] machinectl[1143]: Importing '/tmp/container.raw', saving as 'container-raw'. [ 8.182377] systemd-importd[1144]: Got invalid percent value '0', ignoring. [ 8.182451] machinectl[1143]: Imported 0%. [ 8.282669] systemd-importd[1144]: Got invalid percent value '40', ignoring. [ 8.282746] machinectl[1143]: Imported 40%. [ 8.366448] machinectl[1143]: Wrote 64.0M. [ 8.366519] machinectl[1143]: Operation completed successfully. [ 8.366617] machinectl[1143]: Exiting.
* test: always call test_setup_logging()Yu Watanabe2023-11-171-0/+3
|
* process-util: add new FORK_DEATHSIG_SIGKILL flag, rename FORK_DEATHSIG → ↵Lennart Poettering2023-11-023-4/+4
| | | | | | | | | | | | | | | | | | FORK_DEATHSIG_SIGTERM Sometimes it makes sense to hard kill a client if we die. Let's hence add a third FORK_DEATHSIG flag for this purpose: FORK_DEATHSIG_SIGKILL. To make things less confusing this also renames FORK_DEATHSIG to FORK_DEATHSIG_SIGTERM to make clear it sends SIGTERM. We already had FORK_DEATHSIG_SIGINT, hence this makes things nicely symmetric. A bunch of users are switched over for FORK_DEATHSIG_SIGKILL where we know it's safe to abort things abruptly. This should make some kernel cases more robust, since we cannot get confused by signal masks or such. While we are at it, also fix a bunch of bugs where we didn't take FORK_DEATHSIG_SIGINT into account in safe_fork()
* fd-uitl: rename PIPE_EBADF → EBADF_PAIR, and add EBADF_TRIPLETLennart Poettering2023-10-263-4/+4
| | | | | | | | 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.
* tree-wide: check if return value of lseek() and friends is negativeYu Watanabe2023-10-193-4/+4
| | | | | | | | | We usually check return value of syscalls or glibc functions by it is negative or not, something like that `if (stat(path, &st) < 0)`. Let's also use the same style for lseek() and friends even the type of their return value is off_t. Note, fseeko() returns int, instead of off_t.
* export: use highlighting in --helpZbigniew Jędrzejewski-Szmek2023-09-141-8/+13
|
* io-util: introduce loop_write_full that takes a timeoutMike Yuan2023-09-074-5/+5
| | | | | Also drop do_poll as the use case is covered by timeout.
* copy: Add support for creating subvolumes to copy_tree_at()Daan De Meyer2023-08-141-1/+1
| | | | | | | The subvolumes set is a set of source inodes similar to how the denylist hashmap contains source inodes as keys. It indicates directories in the source tree that should become subvolumes in the target tree.
* btrfs-util: Move subvolume creation to basic/btrfs.hDaan De Meyer2023-08-142-2/+2
| | | | Also make btrfs_subvol_make() an openat style function.
* meson: merge declarations of normal and test executablesYu Watanabe2023-08-031-12/+9
|
* meson: move declarations of machined and friendsYu Watanabe2023-08-011-14/+77
|
* Drop split-usr and unmerged-usr supportLuca Boccassi2023-07-281-1/+1
| | | | | | | | | | As previously announced, execute order 66: https://lists.freedesktop.org/archives/systemd-devel/2022-September/048352.html The meson options split-usr, rootlibdir and rootprefix become no-ops that print a warning if they are set to anything other than the default values. We can remove them in a future release.
* tree-wide: fix typos reported by Fossies Codespell reportYu Watanabe2023-07-121-2/+2
|
* btrfs-util: Add btrfs_subvol_snapshot_at()Daan De Meyer2023-06-063-7/+7
|
* copy: Merge copy_directory() and copy_directory_fd() into copy_directory_at()Daan De Meyer2023-06-061-3/+3
| | | | | Let's merge these two into a single function that can handle both variants and more.
* copy: rename reflink_full() -> reflink_range()Yu Watanabe2023-04-281-1/+1
| | | | | | | | | | | | The commit b640e274a7c363a2b6394c9dce5671d9404d2e2a introduced reflink() and reflink_full(). We usually name function xyz_full() for fully parameterized version of xyz(), and xyz() is typically a inline alias of xyz_full(). But in this case, reflink() and reflink_full() call different ioctl(). Moreover, reflink_full() does partial reflink, while reflink() does full file reflink. That's super confusing. Let's rename reflink_full() to reflink_range(), the new name is consistent with ioctl name, and should be fine.
* copy: Introduce reflink() and reflink_full()Daan De Meyer2023-04-283-4/+4
| | | | | | The kernel has had filesystem independent reflink ioctls for a while now, let's try to use them and fall back to the btrfs specific ones if they're not supported.
* import: use truncate_nl() where appropriateLennart Poettering2023-03-241-3/+2
|
* tree-wide: port various places to find_line_startswith()Lennart Poettering2023-03-241-8/+3
|
* copy: Move chattr arguments to full function signaturesDaan De Meyer2023-03-212-2/+0
| | | | | These are almost never used, so let's move them to the _full() functions signatures.
* meson: Introduce userspace depJan Janssen2023-03-101-1/+2
| | | | This will help in a later commit to separate userspace from EFI builds.
* importd: hook up memory pressure, SIGRTMIN-18 (and in fact SIGINT + SIGTERM)Lennart Poettering2023-03-011-2/+19
|
* Merge pull request #26203 from medhefgo/mesonYu Watanabe2023-02-221-5/+9
|\ | | | | meson: Use dicts for test/fuzzer definitions
| * meson: Use dicts for test definitionsJan Janssen2023-02-211-5/+9
| | | | | | | | | | | | | | Although this slightly more verbose it makes it much easier to reason about. The code that produces the tests heavily benefits from this. Test lists are also now sorted by test name.
* | tree-wide: use FORK_REARRANGE_STDIO and FORK_CLOSE_ALL_FDSYu Watanabe2023-02-203-39/+17
|/
* copy: Make copy_xattr() more genericDaan De Meyer2023-02-143-3/+3
| | | | | Let's make copy_xattr() a little more generic in preparation for copying symlink xattrs.
* tree-wide: set FORK_RLIMIT_NOFILE_SAFE flagYu Watanabe2023-02-071-4/+1
| | | | No functional changes, just refactoring.
* importd: Always specify file unpacked by tarArsen Arsenović2023-01-311-1/+2
| | | | | | | | | | | | | | | Despite popular belief, the default file extracted by GNU tar is not stdin. It is the value of the TAPE environment variable, falling back on a compile-time constant. On my system, the default value is /dev/full, which causes tar to just spin forever due to --ignore-zeros. Always specifying this flag is the safe thing to do. ~$ tar --show-defaults --format=gnu -f/dev/full -b20 --quoting-style=escape --rmt-command=/usr/sbin/grmt See also: ``(tar)defaults'', available via Info viewers, and in HTML form at: https://www.gnu.org/s/tar/manual/html_node/defaults.html
* meson: Do not include headers in source listsJan Janssen2023-01-241-14/+4
| | | | | | Meson+ninja+compiler do this for us and are better at it. https://mesonbuild.com/FAQ.html#do-i-need-to-add-my-headers-to-the-sources-list-like-in-autotools
* import: use CURLOPT_PROTOCOLS_STR with libcurl >= 7.85.0Frantisek Sumsal2023-01-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | CURLOPT_PROTOCOLS [0] was deprecated in libcurl 7.85.0 with CURLOPT_PROTOCOLS_STR [1] as a replacement, causing build warnings/errors: ../build/src/import/curl-util.c: In function ‘curl_glue_make’: ../build/src/import/curl-util.c:255:9: error: ‘CURLOPT_PROTOCOLS’ is deprecated: since 7.85.0. Use CURLOPT_PROTOCOLS_STR [-Werror=deprecated-declarations] 255 | if (curl_easy_setopt(c, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS|CURLPROTO_FILE) != CURLE_OK) | ^~ In file included from ../build/src/import/curl-util.h:4, from ../build/src/import/curl-util.c:6: /usr/include/curl/curl.h:1749:3: note: declared here 1749 | CURLOPTDEPRECATED(CURLOPT_PROTOCOLS, CURLOPTTYPE_LONG, 181, | ^~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Since there's no grace period between the two symbols, let's resort to a light if-def-ery to resolve this. [0] https://curl.se/libcurl/c/CURLOPT_PROTOCOLS.html [1] https://curl.se/libcurl/c/CURLOPT_PROTOCOLS_STR.html
* import: use CURLINFO_SCHEME instead of CURLINFO_PROTOCOLFrantisek Sumsal2023-01-091-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | CURLINFO_PROTOCOL has been deprecated in curl 7.85.0 causing compilation warnings/errors: ../build/src/import/pull-job.c: In function ‘pull_job_curl_on_finished’: ../build/src/import/pull-job.c:142:9: error: ‘CURLINFO_PROTOCOL’ is deprecated: since 7.85.0. Use CURLINFO_SCHEME [-Werror=deprecated-declarations] 142 | code = curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol); | ^~~~ In file included from ../build/src/import/curl-util.h:4, from ../build/src/import/pull-job.h:6, from ../build/src/import/pull-common.h:7, from ../build/src/import/pull-job.c:16: /usr/include/curl/curl.h:2896:3: note: declared here 2896 | CURLINFO_PROTOCOL CURL_DEPRECATED(7.85.0, "Use CURLINFO_SCHEME") | ^~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Since both CURLINFO_SCHEME and CURLINFO_PROTOCOL were introduced in the same curl version (7.52.0 [0][1]) we don't have to worry about backwards compatibility. [0] https://curl.se/libcurl/c/CURLINFO_SCHEME.html [1] https://curl.se/libcurl/c/CURLINFO_PROTOCOL.html
* tree-wide: use -EBADF moreYu Watanabe2022-12-202-4/+4
|
* tree-wide: introduce PIPE_EBADF macroYu Watanabe2022-12-203-4/+4
|
* tree-wide: use -EBADF also in pipe initializersZbigniew Jędrzejewski-Szmek2022-12-193-4/+4
| | | | In some places, initialization is dropped when unnecesary.
* tree-wide: use -EBADF for fd initializationZbigniew Jędrzejewski-Szmek2022-12-1911-25/+25
| | | | | | | | | | | | | | | | -1 was used everywhere, but -EBADF or -EBADFD started being used in various places. Let's make things consistent in the new style. Note that there are two candidates: EBADF 9 Bad file descriptor EBADFD 77 File descriptor in bad state Since we're initializating the fd, we're just assigning a value that means "no fd yet", so it's just a bad file descriptor, and the first errno fits better. If instead we had a valid file descriptor that became invalid because of some operation or state change, the other errno would fit better. In some places, initialization is dropped if unnecessary.
* import: wire up SYSTEMD_IMPORT_BTRFS_{SUBVOL,QUOTA} to importdIvan Shapovalov2022-12-031-4/+36
| | | | | | | | | | | Btrfs quotas are actually being enabled in systemd-importd via setup_machine_directory(), not in systemd-{import,pull} where those environment variables are checked. Therefore, also check them in systemd-importd and avoid enabling quotas if requested by the user. Fixes: #18421 Fixes: #15903 Fixes: #24387
* tree-wide: make constant ratelimit compound actually constLennart Poettering2022-11-221-1/+1
| | | | | | The compiler should recognize that these are constant expressions, but let's better make this explicit, so that the linker can safely share the initializations all over the place.
* copy: Support passing a deny list of files/directories to not copyDaan De Meyer2022-11-101-1/+1
|
* Rename def.h to constants.hZbigniew Jędrzejewski-Szmek2022-11-081-1/+1
| | | | | | The name "def.h" originates from before the rule of "no needless abbreviations" was established. Let's rename the file to clarify that it contains a collection of various semi-related constants.