summaryrefslogtreecommitdiffstats
path: root/src/import (follow)
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: port various bits over to open_parent()Lennart Poettering2018-07-231-5/+2
|
* pull: initialize libgcrypt before calling any functions provided by libgcryptYu Watanabe2018-07-131-0/+3
| | | | | | | This fixes the following warning: ``` systemd-pull[4065]: Libgcrypt warning: missing initialization - please fix the application ```
* import: drop unnecessary conditionYu Watanabe2018-06-251-2/+1
|
* Drop my copyright headersZbigniew Jędrzejewski-Szmek2018-06-141-2/+0
| | | | | | | perl -i -0pe 's/\s*Copyright © .... Zbigniew Jędrzejewski.*?\n/\n/gms' man/*xml git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/(#\n)?# +Copyright © [0-9, -]+ Zbigniew Jędrzejewski.*?\n//gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s*\/\*\*\*\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*?\s*\*\*\*\/\s*/\n\n/gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*//gms'
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-06-141-1/+1
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-1429-99/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-1429-58/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* Add macro for checking if some flags are setZbigniew Jędrzejewski-Szmek2018-06-041-1/+1
| | | | | | | | | This way we don't need to repeat the argument twice. I didn't replace all instances. I think it's better to leave out: - asserts - comparisons like x & y == x, which are mathematically equivalent, but here we aren't checking if flags are set, but if the argument fits in the flags.
* tree-wide: make use of memory_startswith() at various placesLennart Poettering2018-05-301-9/+4
|
* machine-image: rework error handlingLennart Poettering2018-05-243-20/+20
| | | | | | | | | | | Let's rework error handling a bit in image_find() and friends: when we can't find an image, return -ENOENT rather than 0. That's better as before we violated the usual rule in our codebase that return parameters are initialized when the return value is >= 0 and otherwise not touched. This also makes enumeration and validation a bit more strict: we'll only accept ".raw" as suffix for regular files, and filter out this suffix handling on directories/subvolumes, where it makes no sense.
* machine-image: introduce two different classes of imagesLennart Poettering2018-05-243-6/+6
| | | | | | | | | | This distuingishes two different classes of images, one for the purpose of npsawn-like containers, i.e. "machines", and one for portable services. This distinction is mostly about search paths. We look for machine images in /var/lib/machines and for portable images in /var/lib/portables.
* Rename ratelimit_test to ratelimit_belowZbigniew Jędrzejewski-Szmek2018-05-134-4/+4
| | | | | | | | | | | | When I see "test", I have to think three times what the return value means. With "below" this is immediately clear. ratelimit_below(&limit) sounds almost like English and is imho immediately obvious. (I also considered ratelimit_ok, but this strongly implies that being under the limit is somehow better. Most of the times this is true, but then we use the ratelimit to detect triple-c-a-d, and "ok" doesn't fit so well there.) C.f. a1bcaa07.
* importd: ensure we don't mishandle a NULL stringLennart Poettering2018-04-121-1/+1
|
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-0630-390/+0
| | | | | | | | | | 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.
* tree-wide: use TAKE_PTR() and TAKE_FD() macrosYu Watanabe2018-04-0510-22/+11
|
* macro: introduce new TAKE_FD() macroLennart Poettering2018-03-225-23/+9
| | | | | | | This is similar to TAKE_PTR() but operates on file descriptors, and thus assigns -1 to the fd parameter after returning it. Removes 60 lines from our codebase. Pretty good too I think.
* macro: introduce TAKE_PTR() macroLennart Poettering2018-03-222-4/+2
| | | | | | | | | | | | | | | | This macro will read a pointer of any type, return it, and set the pointer to NULL. This is useful as an explicit concept of passing ownership of a memory area between pointers. This takes inspiration from Rust: https://doc.rust-lang.org/std/option/enum.Option.html#method.take and was suggested by Alan Jenkins (@sourcejedi). It drops ~160 lines of code from our codebase, which makes me like it. Also, I think it clarifies passing of ownership, and thus helps readability a bit (at least for the initiated who know the new macro)
* tree-wide: port various places over to use new rearrange_stdio()Lennart Poettering2018-03-023-99/+11
|
* stat-util: unify code that checks whether something is a regular fileLennart Poettering2018-02-201-2/+4
| | | | | | Let's add a common implementation for regular file checks, that are careful to return the right error code (EISDIR/EISLNK/EBADFD) when we are encountering a wrong file node.
* meson: drop unnecessary "transformation" of policy filesZbigniew Jędrzejewski-Szmek2018-02-162-6/+1
| | | | | Those files don't contain any @variables@, so the configuration step was just copying them to build/. Let's avoid that, and fix their suffixes while at it.
* Gettextize policy filesGunnar Hjalmarsson2018-02-162-12/+10
| | | | | | | * Don't merge translations into the files * Add gettext-domain="systemd" to description and message Closes #8162, replaces #8118.
* locale-util: add freelocale() cleanup helperLennart Poettering2018-01-161-2/+2
|
* Merge pull request #7855 from poettering/log-h-includesZbigniew Jędrzejewski-Szmek2018-01-154-0/+4
|\ | | | | log.h #include cleanups
| * log: minimize includes in log.hLennart Poettering2018-01-114-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | log.h really should only include the bare minimum of other headers, as it is really pulled into pretty much everything else and already in itself one of the most basic pieces of code we have. Let's hence drop inclusion of: 1. sd-id128.h because it's entirely unneeded in current log.h 2. errno.h, dito. 3. sys/signalfd.h which we can replace by a simple struct forward declaration 4. process-util.h which was needed for getpid_cached() which we now hide in a funciton log_emergency_level() instead, which nicely abstracts the details away. 5. sys/socket.h which was needed for struct iovec, but a simple struct forward declaration suffices for that too. Ultimately this actually makes our source tree larger (since users of the functionality above must now include it themselves, log.h won't do that for them), but I think it helps to untangle our web of includes a tiny bit. (Background: I'd like to isolate the generic bits of src/basic/ enough so that we can do a git submodule import into casync for it)
* | support LZMA concatenated filesMatthew Thode2018-01-111-1/+1
|/ | | | | | | | The xz format supports concatenated files, images are sometimes created and shipped with it to increase compression. https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1742744 is the source bug for this issue.
* tree-wide: make name requesting asynchronous in all our servicesLennart Poettering2018-01-051-2/+2
| | | | | This optimizes service startup a bit, and makes it less prone to deadlocks.
* tree-wide: use EXIT_SUCCESS when comparing child process exit statusesLennart Poettering2018-01-042-2/+2
| | | | | | | | When we check the exit status of a subprocess, let's compare it with EXIT_SUCCESS rather than 0 when looking for success. This clarifies in code what kind of variable we are looking at and what we are doing.
* process-util: rework wait_for_terminate_and_warn() to take a flags parameterLennart Poettering2018-01-043-3/+3
| | | | | | | | | | | | | This renames wait_for_terminate_and_warn() to wait_for_terminate_and_check(), and adds a flags parameter, that controls how much to log: there's one flag that means we log about abnormal stuff, and another one that controls whether we log about non-zero exit codes. Finally, there's a shortcut flag value for logging in both cases, as that's what we usually use. All callers are accordingly updated. At three occasions duplicate logging is removed, i.e. where the old function was called but logged in the caller, too.
* process-util: add another fork_safe() flag for enabling LOG_ERR/LOG_WARN loggingLennart Poettering2018-01-042-6/+6
|
* tree-wide: introduce new safe_fork() helper and port everything overLennart Poettering2017-12-253-34/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new safe_fork() wrapper around fork() and makes use of it everywhere. The new wrapper does a couple of things we previously did manually and separately in a safer, more correct and automatic way: 1. Optionally resets signal handlers/mask in the child 2. Sets a name on all processes we fork off right after forking off (and the patch assigns useful names for all processes we fork off now, following a systematic naming scheme: always enclosed in () – in order to indicate that these are not proper, exec()ed processes, but only forked off children, and if the process is long-running with only our own code, without execve()'ing something else, it gets am "sd-" prefix.) 3. Optionally closes all file descriptors in the child 4. Optionally sets a PR_SET_DEATHSIG to SIGTERM in the child, in a safe way so that the parent dying before this happens being handled safely. 5. Optionally reopens the logs 6. Optionally connects stdin/stdout/stderr to /dev/null 7. Debug logs about the forked off processes.
* Remove NULL as last parameter to strjoinDaniel Lockyer2017-11-241-2/+2
|
* Replace free and reassignment with free_and_replaceDaniel Lockyer2017-11-242-6/+2
|
* Merge pull request #7198 from poettering/stdin-stdoutLennart Poettering2017-11-192-30/+18
|\ | | | | Add StandardInput=data, StandardInput=file:... and more
| * fd-util: add new helper move_fd() and make use of itLennart Poettering2017-11-172-30/+18
| | | | | | | | | | | | | | We are using the same pattern at various places: call dup2() on an fd, and close the old fd, usually in combination with some O_CLOEXEC fiddling. Let's add a little helper for this, and port a few obvious cases over.
* | Add license headers and SPDX identifiers to meson.build filesZbigniew Jędrzejewski-Szmek2017-11-191-0/+17
| | | | | | | | | | | | | | So far I avoided adding license headers to meson files, but they are pretty big and important and should carry license headers like everything else. I added my own copyright, even though other people modified those files too. But this is mostly symbolic, so I hope that's OK.
* | Add SPDX license headers to various assorted filesZbigniew Jędrzejewski-Szmek2017-11-193-0/+6
| |
* | Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-1929-0/+29
|/ | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* po: add a copy of polkit its rulesZbigniew Jędrzejewski-Szmek2017-11-141-0/+1
| | | | | It's just a few lines, but this way we avoid a dependency on polkit, and can use meson's i18n stuff on older distros.
* i18n: drop intltool use, use meson's merge_file directlyZbigniew Jędrzejewski-Szmek2017-11-132-8/+8
| | | | | | | | | | | | | | | | | | This didn't work during the initial conversion to meson, but should now. A sufficiently new polkit is also required, for the .its rules files. Note that https://github.com/mesonbuild/meson/blob/master/docs/markdown/i18n-module.md says that 'install' argument was added in meson 0.43.0. If this is accurate, warnigs might be generated with older mesons. Fedora has 0.43.0 across the board, but other distros probably don't, but I guess that a warning is prefereable to having to update do latest meson. The advantages are: - one less dependency (intltool) - using the generic implementation instead of our open-coded calls - we don't need to use the fake "_" prefixes in XML Replaces #1609, fixes #7300.
* importd: remove IN_SET to avoid ambiguityZbigniew Jędrzejewski-Szmek2017-11-011-1/+1
| | | | | | | | clang warns: ../src/import/importd.c:254:70: warning: 'break' is bound to current loop, GCC binds it to the enclosing loop [-Wgcc-compat] while ((e < t->log_message + t->log_message_size) && IN_SET(*e, 0, '\n')) ^ Let's just play it safe and not use IN_SET here.
* fix includesMatija Skala2017-10-301-0/+1
| | | | | | sys/wait.h is needed for WEXITED macro poll.h is more portable than sys/poll.h
* Merge pull request #6974 from keszybz/clean-up-definesLennart Poettering2017-10-041-1/+1
|\ | | | | Clean up define definitions
| * build-sys: use #if Y instead of #ifdef Y everywhereZbigniew Jędrzejewski-Szmek2017-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | tree-wide: use IN_SET macro (#6977)Yu Watanabe2017-10-044-5/+4
|/
* tree-wide: use `!IN_SET(..)` for `a != b && a != c && …`Andreas Rammhold2017-10-022-7/+7
| | | | | | The included cocci was used to generate the changes. Thanks to @flo-wer for pointing this case out.
* tree-wide: use IN_SET where possibleAndreas Rammhold2017-10-022-6/+4
| | | | | In addition to the changes from #6933 this handles cases that could be matched with the included cocci file.
* build-sys: drop gitignore patterns for in-tree buildsZbigniew Jędrzejewski-Szmek2017-07-181-1/+0
| | | | ... and other autotools-generated files.
* build-sys: drop automake supportZbigniew Jędrzejewski-Szmek2017-07-181-1/+0
| | | | | v2: - also mention m4
* importd: log more information when renaming filesLennart Poettering2017-06-262-3/+3
|
* import: remove misplaced assert()Lennart Poettering2017-06-262-5/+7
| | | | | | | | We shouldn't assume the final path for the settings file is already known, it unlikely is unless we already downloaded the image once. Also add some commenting to explain the code surrounding the assert a bit. Fixes: #6188