Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | basic/fs-util: move unlink_tempfilep() to tmpfile-util | Mike Yuan | 2024-10-22 | 1 | -2/+0 |
| | |||||
* | ask-password-api: don't accidentally create a dir, when we don't want one | Lennart Poettering | 2024-10-21 | 1 | -0/+2 |
| | | | | | | | | | | | Previously, we were using touch(), which usually works fine, because the path should always refer to an existing directory, in which case it just updates the timestamp. However, if the dir does not exist yet (which shouldn't happen), it would be created as regular file, which is just wrong. Hence, let's instead create the dir as dir if it is missing, and then update its timestamp. | ||||
* | fs-util: Introduce symlinkat_idempotent | Adrian Vovk | 2024-10-18 | 1 | -1/+4 |
| | |||||
* | fs-util: make readlink_malloc() inline | Yu Watanabe | 2024-10-15 | 1 | -2/+4 |
| | |||||
* | fs-util: rename laccess to access_nofollow | Mike Yuan | 2024-10-05 | 1 | -1/+1 |
| | | | | In order to distinguish it from libc function naming. | ||||
* | fs-util: Add XO_NOCOW flag | Daan De Meyer | 2024-07-24 | 1 | -0/+1 |
| | | | | | Let's add a flag for xopenat() that immediately makes a file NOCOW after opening it if it's supported. | ||||
* | fs-util: add simple open_mkdir() wrapper | Lennart Poettering | 2024-06-15 | 1 | -0/+3 |
| | |||||
* | basic: add open_mkdir_at_full() | Christian Göttsche | 2024-04-29 | 1 | -4/+7 |
| | | | | | Add helper for open_mkdir_at() which accepts xopen flags, e.g. to pass XO_LABEL to create the target with the correct security context. | ||||
* | fs-util: add new helper linkat_replace() | Lennart Poettering | 2024-03-14 | 1 | -0/+2 |
| | |||||
* | fs-util: move link_fd() from tmpfile-util.c into generic fs-util.c | Lennart Poettering | 2024-03-14 | 1 | -0/+2 |
| | | | | | It's a generically useful call, let's move it so that we can use it at more places. | ||||
* | fs-util: rename xopenat() -> xopanat_full() | Yu Watanabe | 2024-02-15 | 1 | -2/+8 |
| | |||||
* | fs-util: Add XO_SUBVOLUME flag for xopenat() | Daan De Meyer | 2023-08-14 | 1 | -1/+2 |
| | | | | | When specified, xopenat() will try to create a btrfs subvolume and fall back to creating a regular directory. | ||||
* | fs-util: Add XOpenFlags with XO_LABEL flag to have xopenat() MAC label ↵ | Daan De Meyer | 2023-05-31 | 1 | -2/+6 |
| | | | | files/dirs | ||||
* | fs-util: Add xopenat_lock() | Daan De Meyer | 2023-03-22 | 1 | -0/+3 |
| | | | | open/create a file/directory and lock it using the given lock type. | ||||
* | fs-util: Add open_parent_at() | Daan De Meyer | 2023-03-21 | 1 | -1/+4 |
| | |||||
* | Merge pull request #26784 from DaanDeMeyer/chase-fix | Daan De Meyer | 2023-03-15 | 1 | -0/+2 |
|\ | | | | | Allow creating files and directories with chase_symlinks_open() and further improvements | ||||
| * | fs-util: Add xopenat() | Daan De Meyer | 2023-03-14 | 1 | -0/+2 |
| | | | | | | | | | | xopenat() will create directories if O_DIRECTORY and O_CREAT are specified. Note that this is not an atomic operation. | ||||
* | | fs-util: Drop unlink_noerrno() | Daan De Meyer | 2023-03-15 | 1 | -3/+1 |
|/ | |||||
* | fs-util: Add chown_and_chmod_at() | Daan De Meyer | 2022-11-09 | 1 | -1/+4 |
| | |||||
* | fs-util: add mknodat_atomic() | Lennart Poettering | 2022-09-23 | 1 | -1/+6 |
| | |||||
* | fs-util: make mkfifo_atomic() just a shortcut for mkfifoat_atomic() | Lennart Poettering | 2022-09-23 | 1 | -1/+3 |
| | |||||
* | fs-util: replace symlink_atomic() by symlinkat_atomic() | Lennart Poettering | 2022-09-23 | 1 | -2/+2 |
| | |||||
* | fs-util,label: introduce symlink_atomic_full() and symlink_atomic_full_label() | Yu Watanabe | 2022-09-13 | 1 | -1/+4 |
| | | | | These new functions optionally create symlink of relative path. | ||||
* | fs-util: make touch() an inline function | Lennart Poettering | 2022-08-17 | 1 | -1/+5 |
| | |||||
* | fs-util: add openat_report_new() wrapper around openat() | Lennart Poettering | 2022-03-21 | 1 | -0/+2 |
| | | | | | | This is a wrapper around openat(). It works mostly the same, except for one thing: it race-freely reports whether we just created the indicated file in case O_CREAT is passed without O_EXCL. | ||||
* | fs-util: add new helper open_mkdir_at() | Lennart Poettering | 2021-11-17 | 1 | -0/+2 |
| | |||||
* | tree-wide: use new RET_NERRNO() helper at various places | Lennart Poettering | 2021-11-16 | 1 | -1/+1 |
| | |||||
* | fs-util: add helper that can split CIFS services names | Lennart Poettering | 2021-10-27 | 1 | -0/+2 |
| | |||||
* | basic: spit out chase_symlinks() from fs-util.[ch] → chase-symlinks.[ch] | Lennart Poettering | 2021-10-05 | 1 | -23/+0 |
| | |||||
* | basic: split out inotify-related calls from fs-util.h → inotify-util.h | Lennart Poettering | 2021-10-05 | 1 | -16/+0 |
| | |||||
* | basic: split out sync() family of calls from fs-util.[ch] into new c/h file | Lennart Poettering | 2021-10-05 | 1 | -8/+0 |
| | | | | No changes in code, just some splitting out. | ||||
* | fs-util: add fsync_path_and_parent_at() | Lennart Poettering | 2021-07-08 | 1 | -0/+1 |
| | |||||
* | fs-util: add API for fsync()ing parent dir of path | Lennart Poettering | 2021-07-08 | 1 | -0/+1 |
| | |||||
* | basic,shared: move a bunch of files to src/shared/ | Zbigniew Jędrzejewski-Szmek | 2021-06-24 | 1 | -2/+0 |
| | | | | | | | | | | | | The goal is to move everything that requires selinux or smack away from src/basic/. This means that src/basic/label.[ch] must move, which implies btrfs-util.[ch], copy.[ch], and a bunch of other files which form a cluster of internal use. This is just moving text around, so there should be no functional difference. test-blockdev-util is new, because path_is_encrypted() is moved to blockdev-util.c, and so far we didn't have any tests for code there. | ||||
* | tmpfiles: add '=' action modifier. | Allen Webb | 2021-06-08 | 1 | -0/+2 |
| | | | | | | | | | | | Add the '=' action modifier that instructs tmpfiles.d to check the file type of a path and remove objects that do not match before trying to open or create the path. BUG=chromium:1186405 TEST=./test/test-systemd-tmpfiles.py "$(which systemd-tmpfiles)" Change-Id: If807dc0db427393e9e0047aba640d0d114897c26 | ||||
* | basic: allow copy_rights() to work without mounted /proc | Zbigniew Jędrzejewski-Szmek | 2021-05-24 | 1 | -1/+4 |
| | | | | This will be used in sysusers later on. | ||||
* | journald: Retry if posix_fallocate returned -1 (EINTR) | Igor Zhbanov | 2021-04-21 | 1 | -0/+2 |
| | | | | | | | | | | | | | | | | | | | On some conditions (particularly when mobile CPUs are going to sleep), the posix_fallocate(), which is called when a new journal file is allocated, can return -1 (EINTR). This is counted as a fatal error. So the journald closes both old and journals, and simply throwing away further incoming events, because of no log files open. Introduce posix_fallocate_loop() that restarts the function in the case of EINTR. Also let's make code base more uniform by returning negative values on error. Fix assert in test-sigbus.c that incorrectly counted positive values as success. After changing the function return values, that will actually work. Fixes: #19041 Signed-off-by: Igor Zhbanov <i.zhbanov@omprussia.ru> | ||||
* | tree-wide: coccinelle fixes | Frantisek Sumsal | 2021-03-18 | 1 | -4/+3 |
| | | | | Another batch of fixes (mostly) generated by Coccinelle. | ||||
* | fs-util: rename conservative_rename() -> conservative_renameat() | Yu Watanabe | 2021-01-22 | 1 | -1/+4 |
| | | | | And this introduces conservative_rename() which does not take dirfd. | ||||
* | fs-util/rm-rf: improve remove+free destructors to take and return NULL | Lennart Poettering | 2021-01-19 | 1 | -2/+11 |
| | | | | | | Let#s make these helpers useful even without _cleanup_ logic, to destory arbitary fields: make them OK wiht a NULL pointer as input, and always return one as output. | ||||
* | fs-util: make laccess() macro follow our usual error propagation | Lennart Poettering | 2021-01-15 | 1 | -1/+2 |
| | | | | | | | | | | | | Functions defined by us are supposed to return negative errno-style errors on errors. laccess() is for access() what lstat() is for stat(), but defined by us as a macro. This led to some confusion regarding error handling. Let's return a negative errno code just in case. This means callers can it use either way: like access(), i.e. checking for a negative return value + looking at errno, or like our own code, i.e. using the negative errno code it returns. | ||||
* | fs-util: add conservative_rename() that suppresses unnecessary renames | Lennart Poettering | 2020-12-02 | 1 | -0/+2 |
| | | | | | | | | if the source and destination file match in contents and basic file attributes, don#t rename, but just remove source. This is a simple way to suppress inotify events + mtime changes when atomically updating files. | ||||
* | license: LGPL-2.1+ -> LGPL-2.1-or-later | Yu Watanabe | 2020-11-09 | 1 | -1/+1 |
| | |||||
* | Merge pull request #17172 from keszybz/read-login-defs | Lennart Poettering | 2020-10-02 | 1 | -1/+1 |
|\ | | | | | Read /etc/login.defs | ||||
| * | basic/fileio: add chase_symlinks_and_fopen_unlocked() | Zbigniew Jędrzejewski-Szmek | 2020-10-01 | 1 | -1/+1 |
| | | |||||
* | | fs-util: add new futimens_opath() helper | Lennart Poettering | 2020-09-28 | 1 | -0/+2 |
|/ | | | | futimens() that works for O_PATH fds. | ||||
* | fs-util: drop chmod_and_chown_unsafe() which is unused now | Lennart Poettering | 2020-09-23 | 1 | -1/+0 |
| | |||||
* | fs-util: add stat_warn_permissions() that operates on struct stat instead of fd | Lennart Poettering | 2020-06-02 | 1 | -0/+1 |
| | |||||
* | fs-util: teach unlinkat_deallocate() a simple scheme for overwriting for erasing | Lennart Poettering | 2020-05-19 | 1 | -1/+7 |
| | | | | With that it becomes useful for deleting password files and such. | ||||
* | fs-util: add helper path_is_encrypted() that checks if a file system is ↵ | Lennart Poettering | 2020-05-07 | 1 | -0/+2 |
| | | | | encrypted |