summaryrefslogtreecommitdiff
path: root/src/journal-remote/journal-upload.c
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: simplify x ? x : y to x ?: y where applicableFrantisek Sumsal2023-03-181-1/+1
|
* conf: replace config_parse_many_nulstr() with config_parse_config_file()Franck Bui2023-03-141-8/+3
| | | | | | | | | | | | | | | | | All daemons use a similar scheme to read their main config files and theirs drop-ins. The main config files are always stored in /etc/systemd directory and it's easy enough to construct the name of the drop-in directories based on the name of the main config file. Hence the new helper does that internally, which allows to reduce and simplify the args passed previously to config_parse_many_nulstr(). Besides the overall code simplification it results: 16 files changed, 87 insertions(+), 159 deletions(-) it allows to identify clearly the locations in the code where configuration files are parsed.
* tree-wide: use unlink_and_freep() moreoverLennart Poettering2023-02-231-4/+3
|
* 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.
* basic: move version() to build.h+cZbigniew Jędrzejewski-Szmek2022-11-081-1/+1
|
* tree-wide: use ASSERT_PTR moreDavid Tardon2022-09-131-12/+5
|
* Move path_simplify_and_warn() to new shared/parse-helpers.cZbigniew Jędrzejewski-Szmek2022-04-071-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a high-level function, and it belongs in libsystemd-shared. This way we don't end up linking a separate copy into various binaries. It would even end up in libsystemd, where it is not needed. (Maybe it'd be removed in some optimization phase, but it's better to not rely on that.) $ grep -l -r -a 'path is not absolute%s' build/ build/libnss_systemd.so.2 build/pam_systemd_home.so build/test-dlopen build/src/basic/libbasic.a.p/path-util.c.o build/src/basic/libbasic.a build/src/shared/libsystemd-shared-249.so build/test-bus-error build/libnss_mymachines.so.2 build/pam_systemd.so build/libnss_resolve.so.2 build/libnss_myhostname.so.2 build/libsystemd.so.0.32.0 build/libudev.so.1.7.2 $ grep -l -r -a 'path is not absolute%s' build/ build/src/shared/libsystemd-shared-251.a.p/parse-helpers.c.o build/src/shared/libsystemd-shared-251.a build/src/shared/libsystemd-shared-251.so No functional change.
* tree-wide: add a space after if, switch, for, and whileYu Watanabe2022-04-011-1/+1
|
* conf-parser: merge config_parse_string() and config_parse_safe_string()Yu Watanabe2022-03-101-5/+5
| | | | | This also makes unsafe strings escaped when logged. Otherwise, journalctl may not show the log message unless '--all' is specified.
* tree-wide: use config_parse_safe_string() at various placesLennart Poettering2022-02-091-1/+1
|
* alloc-util: add strdupa_safe() + strndupa_safe() and use it everywhereLennart Poettering2021-10-141-1/+1
| | | | | | | | | | | | | Let's define two helpers strdupa_safe() + strndupa_safe() which do the same as their non-safe counterparts, except that they abort if called with allocations larger than ALLOCA_MAX. This should ensure that all our alloca() based allocations are subject to this limit. afaics glibc offers three alloca() based APIs: alloca() itself, strndupa() + strdupa(). With this we have now replacements for all of them, that take the limit into account.
* variuos: add missing includesZbigniew Jędrzejewski-Szmek2021-09-221-0/+1
|
* tree-wide: mark set-but-not-used variables as unused to make LLVM happyFrantisek Sumsal2021-09-151-1/+1
| | | | | | | | | | | | | | LLVM 13 introduced `-Wunused-but-set-variable` diagnostic flag, which trips over some intentionally set-but-not-used variables or variables attached to cleanup handlers with side effects (`_cleanup_umask_`, `_cleanup_(notify_on_cleanup)`, `_cleanup_(restore_sigsetp)`, etc.): ``` ../src/basic/process-util.c:1257:46: error: variable 'saved_ssp' set but not used [-Werror,-Wunused-but-set-variable] _cleanup_(restore_sigsetp) sigset_t *saved_ssp = NULL; ^ 1 error generated. ```
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-031-1/+1
| | | | | | | | | | | | | | | | | In general we almost never hit those asserts in production code, so users see them very rarely, if ever. But either way, we just need something that users can pass to the developers. We have quite a few of those asserts, and some have fairly nice messages, but many are like "WTF?" or "???" or "unexpected something". The error that is printed includes the file location, and function name. In almost all functions there's at most one assert, so the function name alone is enough to identify the failure for a developer. So we don't get much extra from the message, and we might just as well drop them. Dropping them makes our code a tiny bit smaller, and most importantly, improves development experience by making it easy to insert such an assert in the code without thinking how to phrase the argument.
* Add a network timeout option to journal-uploadJayanth Ananthapadmanaban2021-06-141-4/+12
|
* Wider range of options for selecting entries for systemd-journal-gatewaydSamuel BF2021-05-101-1/+1
| | | | | Introducing --user, --system, --merge and --file flags, like for journalctl and systemd-journal-upload.
* meson: simplify the BUILD_MODE conditionalZbigniew Jędrzejewski-Szmek2021-04-141-1/+1
| | | | | | | Using a enum is all nice and generic, but at this point it seems unlikely that we'll add further build modes. But having an enum means that we need to include the header file with the enumeration whenerever the conditional is used. I want to use the conditional in log.h, which makes it hard to avoid circular imports.
* journal-upload: use _cleanup_ for curl_slistDavid Tardon2021-03-181-8/+6
|
* journal-upload: make the curl_slist cleanup actually workDavid Tardon2021-03-181-5/+7
| | | | If h is NULL, it is pointless to call curl_slist_free_all() on it...
* journal-upload: cleanup CURL* on errorDavid Tardon2021-03-181-2/+4
|
* journal-remote: convert to parse_boolean_argument() and fix type confusionZbigniew Jędrzejewski-Szmek2021-02-171-12/+7
| | | | | | | | | We were passing a reference to 'int arg_seal' to config_parse_bool(), which expects a 'bool *'. Luckily, this would work, because 'bool' is smaller than 'int', so config_parse_bool() would set the least-significant byte of arg_seal. At least I think so. But let's use consistent types ;) Also, modernize style a bit and don't use integers in boolean context.
* Add comma in structured initialization in a few placesZbigniew Jędrzejewski-Szmek2021-02-101-1/+1
| | | | It just looks nicer…
* log: make tools also read the kernel command line when run as a serviceYu Watanabe2021-02-011-1/+1
| | | | | | | | This effectively reverts 41d1f469cf10f5f3e9cb4f4853ace9b0cfe5beae. Before this, e.g., `networkctl reload` invoked by `systemctl reload systemd-networkd.service` does not produce debugging logs even if systemd.log-level=debug is set. This fixes the issue.
* tree-wide: Drop custom formatting for print() help messagesDaan De Meyer2021-01-311-4/+3
| | | | | | | | | | | | I think this formatting was originally used because it simplified adding new options to the help messages. However, these days, most tools their help message end with "\nSee the %s for details.\n" so the final line almost never has to be edited which eliminates the benefit of the custom formatting used for printf() help messages. Let's make things more consistent and use the same formatting for printf() help messages that we use everywhere else. Prompted by https://github.com/systemd/systemd/pull/18355#discussion_r567241580
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* various daemons: emit Stopping... notification before destructing the ↵Zbigniew Jędrzejewski-Szmek2020-07-021-1/+1
| | | | | | | | manager object This is mostly cosmetic, but let's reorder the destructors so that we do the final sd_notify() call before we run the destructor for the manager object.
* log: introduce log_parse_environment_cli() and log_setup_cli()Filipe Brandenburger2020-06-241-1/+1
| | | | | | | | | | | | | | | | Presently, CLI utilities such as systemctl will check whether they have a tty attached or not to decide whether to parse /proc/cmdline or EFI variable SystemdOptions looking for systemd.log_* entries. But this check will be misleading if these tools are being launched by a daemon, such as a monitoring daemon or automation service that runs in background. Make log handling of CLI tools uniform by never checking /proc/cmdline or EFI variables to determine the logging level. Furthermore, introduce a new log_setup_cli() shortcut to set up common options used by most command-line utilities.
* conf-parser: return mtime in config_parse() and friendsLennart Poettering2020-06-021-5/+10
| | | | | | | | | | | | | This is a follow-up for 9f83091e3cceb646a66fa9df89de6d9a77c21d86. Instead of reading the mtime off the configuration files after reading, let's do so before reading, but with the fd we read the data from. This is not only cleaner (as it allows us to save one stat()), but also has the benefit that we'll detect changes that happen while we read the files. This also reworks unit file drop-ins to use the common code for determining drop-in mtime, instead of reading system clock for that.
* journalctl,elsewhere: make sure --file=foo fails with sane error msg if foo ↵Lennart Poettering2020-05-191-1/+1
| | | | | | | | | | | | | is not readable It annoyed me for quite a while that running "journalctl --file=…" on a file that is not readable failed with a "File not found" error instead of a permission error. Let's fix that. We make this work by using the GLOB_NOCHECK flag for glob() which means that files are not accessible will be returned in the array as they are instead of being filtered away. This then means that our later attemps to open the files will fail cleanly with a good error message.
* Support journal-upload HTTPS without key and certificateCiprian Hacman2020-04-161-6/+47
|
* journal: properly mark two definitions that are deprecated with GCC ↵Lennart Poettering2020-01-311-2/+6
| | | | attributes for that
* tree-wide: (void)ify a few unlink() and rmdir()Lennart Poettering2019-03-271-1/+1
| | | | | | Let's be helpful to static analyzers which care about whether we knowingly ignore return values. We do in these cases, since they are usually part of error paths.
* meson: generate version tag from gitZbigniew Jędrzejewski-Szmek2018-12-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | $ build/systemctl --version systemd 239-3555-g6178cbb5b5 +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid $ git tag v240 -m 'v240' $ ninja -C build ninja: Entering directory `build' [76/76] Linking target fuzz-unit-file. $ build/systemctl --version systemd 240 +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid This is very useful during development, because a precise version string is embedded in the build product and displayed during boot, so we don't have to guess answers for questions like "did I just boot the latest version or the one from before?". This change creates an overhead for "noop" builds. On my laptop, 'ninja -C build' that does nothing goes from 0.1 to 0.5 s. It would be nice to avoid this, but I think that <1 s is still acceptable. Fixes #7183. PACKAGE_VERSION is renamed to GIT_VERSION, to make it obvious that this is the more dynamically changing version string. Why save to a file? It would be easy to generate the version tag using run_command(), but we want to go through a file so that stuff gets rebuilt when this file changes. If we just defined an variable in meson, ninja wouldn't know it needs to rebuild things.
* Remove use of PACKAGE_STRINGZbigniew Jędrzejewski-Szmek2018-12-191-1/+1
| | | | | | | PACKAGE_VERSION is more explicit, and also, we don't pretend that changing the project name in meson.build has any real effect. "systemd" is embedded in a thousand different places, so let's just use the hardcoded string consistently. This is mostly in preparation for future changes.
* journal-upload: define main through macroYu Watanabe2018-12-081-29/+24
|
* journal-upload: use _cleanup_ attribute to clear uploaderYu Watanabe2018-12-081-3/+1
|
* util-lib: split out env file parsing code into env-file.cLennart Poettering2018-12-021-0/+1
| | | | | | It's quite complex, let's split this out. No code changes, just some file rearranging.
* util-lib: split out all temporary file related calls into tmpfiles-util.cLennart Poettering2018-12-021-0/+1
| | | | | | | | This splits out a bunch of functions from fileio.c that have to do with temporary files. Simply to make the header files a bit shorter, and to group things more nicely. No code changes, just some rearranging of source files.
* journal-upload: use static initializationLennart Poettering2018-11-261-2/+3
|
* tree-wide: port various places over to STARTSWITH_SET()Lennart Poettering2018-11-261-1/+3
|
* Also drop a few more unnecessary uses of synthethic errnoZbigniew Jędrzejewski-Szmek2018-11-221-2/+1
|
* coccinelle: make use of SYNTHETIC_ERRNOZbigniew Jędrzejewski-Szmek2018-11-221-76/+63
| | | | | | | | | | | Ideally, coccinelle would strip unnecessary braces too. But I do not see any option in coccinelle for this, so instead, I edited the patch text using search&replace to remove the braces. Unfortunately this is not fully automatic, in particular it didn't deal well with if-else-if-else blocks and ifdefs, so there is an increased likelikehood be some bugs in such spots. I also removed part of the patch that coccinelle generated for udev, where we returns -1 for failure. This should be fixed independently.
* Split out pretty-print.c and move pager.c and main-func.h to shared/Zbigniew Jędrzejewski-Szmek2018-11-201-1/+1
| | | | | This is high-level functionality, and fits better in shared/ (which is for our executables), than in basic/ (which is also for libraries).
* fileio: automatically add NULL sentinel to parse_env_file()Lennart Poettering2018-11-141-4/+1
| | | | Let's modernize things a bit.
* fileio: drop "newline" parameter for env file parsersLennart Poettering2018-11-141-1/+1
| | | | | | | Now that we don't (mis-)use the env file parser to parse kernel command lines there's no need anymore to override the used newline character set. Let's hence drop the argument and just "\n\r" always. This nicely simplifies our code.
* tree-wide: uniformly bump RLIMIT_NOFILE in all our tools that access the journalLennart Poettering2018-10-161-0/+4
| | | | | | This makes use of rlimit_nofile_bump() in all tools that access the journal. In some cases this replaces older code to achieve this, and others we add it in where it was missing.
* journal-upload: check for overflowLennart Poettering2018-10-131-11/+11
| | | | CID 1394386
* journal-upload: fix off-by-one in assert()Zbigniew Jędrzejewski-Szmek2018-09-251-1/+1
| | | | CID #1394386.
* tree-wide: add clickable man page link to all --help textsLennart Poettering2018-08-201-4/+16
| | | | | | | | | | This is a bit like the info link in most of GNU's --help texts, but we don't do info but man pages, and we make them properly clickable on terminal supporting that, because awesome. I think it's generally advisable to link up our (brief) --help texts and our (more comprehensive) man pages a bit, so this should be an easy and straight-forward way to do it.
* Drop my copyright headersZbigniew Jędrzejewski-Szmek2018-06-141-3/+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'