summaryrefslogtreecommitdiff
path: root/src/basic/fileio.h
Commit message (Collapse)AuthorAge
* fileio: add parse_env_filev() that is like parse_env_file() but takes a va_listLennart Poettering2018-08-24
|
* fileio: accept FILE* in addition to path in parse_env_file()Lennart Poettering2018-08-24
| | | | | | | Most our other parsing functions do this, let's do this here too, internally we accept that anyway. Also, the closely related load_env_file() and load_env_file_pairs() also do this, so let's be systematic.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* Prep v236 : Add missing SPDX-License-Identifier (2/9) src/basicSven Eden2018-03-26
|
* sysctl: disable buffer while writing to /procTiago Salem Herrmann2017-12-12
| | | | | | | | fputs() writes only first 2048 bytes and fails to write to /proc when values are larger than that. This patch adds a new flag to WriteStringFileFlags that make it possible to disable the buffer under specific cases.
* fileio: document why fileio-label.c and fileio.c are two different modulesLennart Poettering2017-11-27
|
* build-sys: use #if Y instead of #ifdef Y everywhereZbigniew Jędrzejewski-Szmek2017-11-23
| | | | | | | | | | | | | | | The advantage is that is the name is mispellt, cpp will warn us. $ git grep -Ee "conf.set\('(HAVE|ENABLE)_" -l|xargs sed -r -i "s/conf.set\('(HAVE|ENABLE)_/conf.set10('\1_/" $ git grep -Ee '#ifn?def (HAVE|ENABLE)' -l|xargs sed -r -i 's/#ifdef (HAVE|ENABLE)/#if \1/; s/#ifndef (HAVE|ENABLE)/#if ! \1/;' $ git grep -Ee 'if.*defined\(HAVE' -l|xargs sed -i -r 's/defined\((HAVE_[A-Z0-9_]*)\)/\1/g' $ git grep -Ee 'if.*defined\(ENABLE' -l|xargs sed -i -r 's/defined\((ENABLE_[A-Z0-9_]*)\)/\1/g' + manual changes to meson.build squash! build-sys: use #if Y instead of #ifdef Y everywhere v2: - fix incorrect setting of HAVE_LIBIDN2
* fileio: return 0 from read_one_line_file on successZbigniew Jędrzejewski-Szmek2017-11-22
| | | | Fixup for f4b51a2d09. Suggested by Evgeny Vereshchagin.
* fileio: make write_string_stream() accept flags parameterLennart Poettering2017-09-22
| | | | | | Let's make write_string_stream() and write_string_file() more alike, and pass the same flag set so that we can remove a number of boolean parameters.
* Add abstraction model for BPF programsDaniel Mack2017-11-20
| | | | | This object takes a number of bpf_insn members and wraps them together with the in-kernel reference id. Will be needed by the firewall code.
* v235: Added missing updatesSven Eden2017-11-19
|
* fileio: make write_string_stream() accept flags parameterLennart Poettering2017-09-22
| | | | | | Let's make write_string_stream() and write_string_file() more alike, and pass the same flag set so that we can remove a number of boolean parameters.
* fileio: add new helper call read_line() as bounded getline() replacementLennart Poettering2017-09-25
| | | | | | | read_line() is much like getline(), and returns a line read from a FILE*, of arbitrary sizes. In contrast to gets() it will grow the buffer dynamically, and in contrast to getline() it will place a user-specified boundary on the line.
* Prep v235: Apply pending upstream updates in src/basic [1/4]Sven Eden2017-08-30
|
* "Don't fear the fsync()"Alan Jenkins2017-08-29
| | | | | | | | | | | | | | | | | | | | | For files which are vital to boot 1. Avoid opening any window where power loss will zero them out or worse. I know app developers all coded to the ext3 implementation, but the only formal documentation we have says we're broken if we actually rely on it. E.g. * `man mount`, search for `auto_da_alloc`. * http://www.linux-mtd.infradead.org/faq/ubifs.html#L_atomic_change * https://thunk.org/tytso/blog/2009/03/15/dont-fear-the-fsync/ 2. If we tell the kernel we're interested in writing them to disk, it will tell us if that fails. So at minimum, this means we play our part in notifying the user about errors. I refactored error-handling in `udevadm-hwdb` a little. It turns out I did exactly the same as had already been done in the `elogind-hwdb` version, i.e. commit d702dcd.
* basic/fileio: extend atomic file writing with timestamp settingZbigniew Jędrzejewski-Szmek2017-07-25
| | | | There should be no functional change.
* Prep v233.2: Mask unneeded functions and definitions in src/basicSven Eden2017-07-18
|
* Prep v233: Add missing updates from upstream in src/basicSven Eden2017-07-17
|
* Prep v233: Unmask now needed functions in src/basicSven Eden2017-07-17
|
* core/manager: split out creation of serialization fd out to a helperZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | There is a slight change in behaviour: the user manager for root will create a temporary file in /run/elogind, not /tmp. I don't think this matters, but simplifies implementation.
* util-lib: add easy helpers for temporary directories that rmdir()ed via ↵Lennart Poettering2017-07-17
| | | | | | | | | | | | | | | | _cleanup_ This adds mkdtemp_malloc() that is a combination of mkdtemp() plus strdup(). It initializes its return paremeter only if the temporary directory could be created successfully, so that the parameter is exactly non-NULL when the directory exists. rmdir_and_free() and rmdir_and_freep() are also added, and the latter may be used inside of _cleanup_ for such a directory string variable, to automatically rmdir() the directory if it is non-NULL when the scope exits. rmdir_and_free() is similar to the existing rm_rf_and_free() however, is only removes a single directory and does not operate recursively.
* basic: add new merge_env_file functionRay Strode2017-07-17
| | | | | | | | | | | | merge_env_file is a new function, that's like load_env_file, but takes a pre-existing environment as an input argument. New environment entries are merged. Variable expansion is performed. Falling back to the process environment is supported (when a flag is set). Alternatively this could be implemented as passing an additional fallback environment array, but later on we're adding another flag to allow braceless expansion, and the two flags can be combined in one arg, so there's less stuff to pass around.
* fileio: simplify mkostemp_safe() (#4090)Topi Miettinen2017-07-05
| | | | | | | According to its manual page, flags given to mkostemp(3) shouldn't include O_RDWR, O_CREAT or O_EXCL flags as these are always included. Beyond those, the only flag that all callers (except a few tests where it probably doesn't matter) use is O_CLOEXEC, so set that unconditionally.
* Prep v231: Apply missing fixes from upstream (1/6) src/basicSven Eden2017-06-16
|
* Prep v230: Apply missing upstream fixes and updates (2/8) src/basic.Sven Eden2017-06-16
|
* Prep v229: Mask more unused functions in src/basicSven Eden2017-05-18
|
* Prep v229: Add missing fixes from upstream [1/6] src/basicSven Eden2017-05-17
|
* tree-wide: remove Emacs lines from all filesDaniel Mack2017-05-17
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* Prep v228: Full diff to master revealed more functions that are unused.Sven Eden2017-04-26
|
* Prep v228: Condense elogind source masks (1/5)Sven Eden2017-04-26
| | | | | | | | | | | | Although having a two line mask like /// UNNEEDED by elogind #if 0 it is much more easier to read (and patch!) if those two lines were condense into a one-line mask start like #if 0 /// UNNEEDED by elogind
* Prep v228: Substitute declaration masks (1/4)Sven Eden2017-04-26
| | | | | | | | | | | | | | | | | Although it looks very ugly, substitute all declaration masks of the form: // UNNEEDED type foo(...); with: /// UNNEEDED by elogind #if 0 type foo(...); #endif // 0 to make future merging of upstream pathes easier, as the relevant lines themselves are not changed any more.
* Prep v228: Add remaining updates from upstream (2/3)Sven Eden2017-04-26
| | | | | Apply remaining fixes and the performed move of utility functions into their own foo-util.[hc] files on libbasic.
* [1/5] Apply missing fixes from upstreamSven Eden2017-03-29
|
* Prep v224: Major cleanup of unneeded functions and some source files.Sven Eden2017-03-14
|
* Prep v221: Update and clean up build system to sync with upstreamSven Eden2017-03-14
This commit replays the moving around of source files that have been done between systemd-219 and systemd-221. Further the Makefile.am is synchronized with the upstream version and then "re-cleaned". A lot of functions, that are not used anywhere in elogind have been coated into #if 0/#endif directives to further shorten the list of dependencies. All unneeded files have been removed.