summaryrefslogtreecommitdiff
path: root/src/vconsole
Commit message (Collapse)AuthorAgeFilesLines
* shared/creds-util: return 0 for missing creds in read_credential_strings_manyZbigniew Jędrzejewski-Szmek2023-04-251-5/+2
| | | | | | | | | | | Realistically, the only thing that the caller can do is ignore failures related to missing credentials. If the caller requires some credentials to be present, they should just check which output variables are not NULL. One of the callers was already doing that, and the other wanted to, but missed -ENOENT. By suppressing -ENOENT and -ENXIO, both callers are simplified. Fixes a warning at boot: systemd-vconsole-setup[221]: Failed to import credentials, ignoring: No such file or directory
* vconsole: introduce context_get_config() helper functionYu Watanabe2023-03-241-14/+34
| | | | And make keyboard_load_and_wait() and font_load_and_wait() take Context.
* vconsole: introduce Context and its helper functionsYu Watanabe2023-03-241-41/+149
| | | | | | | Fixes memleaks introduced by 01771226c202183ff447da712f43d2fad8874484 and ea575e176aac9fa8f430bb30a3e8abd8da767a10 Fixes #26945.
* vconsole: allow setting default keymap through build optionMike Yuan2023-02-151-4/+7
| | | | | | | Allow defining the default keymap to be used by vconsole-setup through a build option. A template vconsole.conf also gets populated by tmpfiles if it doesn't exist.
* vconsole: permit configuration of vconsole settings via credentialsLennart Poettering2023-01-051-3/+15
|
* tree-wide: use -EBADF for fd initializationZbigniew Jędrzejewski-Szmek2022-12-191-4/+4
| | | | | | | | | | | | | | | | -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.
* basic: rename util.h to logarithm.hZbigniew Jędrzejewski-Szmek2022-11-081-1/+0
| | | | | util.h is now about logarithms only, so we can rename it. Many files included util.h for no apparent reason… Those includes are dropped.
* Use https for freedesktop.orgMichael Biebl2022-06-281-1/+1
| | | | grep -l -r http:// | xargs sed -E -i s'#http://(.*).freedesktop.org#https://\1.freedesktop.org#'
* meson: move vconsole rules to rules.d/Zbigniew Jędrzejewski-Szmek2022-05-052-21/+0
|
* meson: also allow setting GIT_VERSION via templatesZbigniew Jędrzejewski-Szmek2022-04-051-1/+1
| | | | | | | | | GIT_VERSION is not available as a config.h variable, because it's rendered into version.h during builds. Let's rework jinja2 rendering to also parse version.h. No functional change, the new variable is so far unused. I guess this will make partial rebuilds a bit slower, but it's useful to be able to use the full version string.
* tree-wide: use new RET_NERRNO() helper at various placesLennart Poettering2021-11-161-11/+3
|
* build: preserve correct mode when generating files via jinja2Christian Brauner2021-11-081-2/+1
| | | | | | | | | When using "capture : true" in custom_target()s the mode of the source file is not preserved when the generated file is not installed and so needs to be tweaked manually. Switch from output capture to creating the target file and copy the permissions from the input file. Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
* meson: use jinja2 in src/vconsoleZbigniew Jędrzejewski-Szmek2021-05-192-9/+9
|
* tree-wide: avoid uninitialized warning on _cleanup_ variablesLuca Boccassi2021-04-141-2/+2
| | | | | | | With some versions of the compiler, the _cleanup_ attr makes it think the variable might be freed/closed when uninitialized, even though it cannot happen. The added cost is small enough to be worth the benefit, and optimized builds will help reduce it even further.
* tree-wide: enable colorized logging for daemons when run in consoleYu Watanabe2021-02-011-1/+1
| | | | It may be useful when debugging daemons.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-093-3/+3
|
* vconsole-setup: downgrade log message when setting font fails on dummy consoleFranck Bui2020-07-201-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit 883eb9be985fd86d9cabe967eeeab91cdd396a81, vconsole-setup might be called again to operate on dummy console where font operations are not supported but where it's still important to have the correct keymap set [0][1]. vconsole-setup is mainly called by udev but can also be run via a dependency of an early service. Both cases might end up calling vconsole-setup on the dummy console. The first case can happen during early boot even on systems that use (instead of the dummy console) a "simple" video console driver supporting font operations (such as vgacon) until a more specific driver (such as i915) takes the console over. While this is happening vgacon is deactivated and temporarly replaced by the dummy console [2]. There are also other cases where systemd-vconsole-setup might be called on dummy console especially during (very) early boot. Indeed systemd-vconsole-setup.service might be pulled in by early interactive services such as 'dracut-cmdline-ask.service` which is run before udev. If that happens on platforms with no grapical HWs (such as embedded ARM) or with dummy console initially installed until a driver takes over (like Xen and xen-fbfront) then setting font will fail. Therefore this patch downgrades the log message emitted when setting font fails to LOG_DEBUG and when font operations is not implemented like it's the case for the dummy console. Fixes: #16406. [0] https://github.com/systemd/systemd/issues/10826 [1] https://bugzilla.redhat.com/show_bug.cgi?id=1652473 [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/vga/vgaarb.c?h=v5.7#n204
* tree-wide: drop stdio.h when stdio-util.h is includedYu Watanabe2019-11-041-1/+0
|
* vconsole-setup: rename toggle_utf8() → toggle_utf8_vc()Lennart Poettering2019-07-181-3/+4
| | | | | Let's make clearer that toggle_utf8_sysfs() is about sysfs, and toggle_utf8_vc() about VC access
* Revert "Move verify_vc_kbmode() to terminal-util.c as vt_verify_kbmode()"Lennart Poettering2019-07-181-3/+20
| | | | This reverts commit bb5ac84d79ac3aef606a4a9eeaafef94a1f199be.
* Revert "Add check to switch VTs only between K_XLATE or K_UNICODE"Lennart Poettering2019-07-181-7/+0
| | | | This reverts commit 13a43c73d8cbac4b65472de04bb88ea1bacdeb89.
* Merge pull request #12378 from rbalint/vt-kbd-reset-checkLennart Poettering2019-05-161-20/+10
|\ | | | | VT kbd reset check
| * Add check to switch VTs only between K_XLATE or K_UNICODEBalint Reczey2019-05-151-0/+7
| | | | | | | | | | | | | | Switching to K_UNICODE from other than L_XLATE can make the keyboard unusable and possibly leak keypresses from X. BugLink: https://launchpad.net/bugs/1803993
| * Move verify_vc_kbmode() to terminal-util.c as vt_verify_kbmode()Balint Reczey2019-04-241-20/+3
| |
* | codespell: fix spelling errorsBen Boeckel2019-04-291-1/+1
|/
* headers: remove unneeded includes from util.hZbigniew Jędrzejewski-Szmek2019-03-271-0/+2
| | | | | This means we need to include many more headers in various files that simply included util.h before, but it seems cleaner to do it this way.
* vconsole-setup: fonts copy will fail if the current terminal is in graphical ↵Franck Bui2018-12-131-4/+18
| | | | | | | | | | mode If the terminal is in graphical mode, the kernel will refuse to copy the fonts and will return -EINVAL. Also having the graphical mode in effect probably indicates that the terminal is in used by another application and we shouldn't interfer in such cases.
* Merge pull request #10935 from poettering/rlimit-nofile-safeZbigniew Jędrzejewski-Szmek2018-12-061-2/+2
|\ | | | | | | Merged by hand to resolve a trivial conflict in TODO.
| * tree-wide: use FORK_RLIMIT_NOFILE_SAFE wherever possibleLennart Poettering2018-12-011-2/+2
| | | | | | | | | | | | | | Similar to the previous commit: in many cases no further fd processing needs to be done in forked of children before execve() or any of its flavours are called. In those case we can use FORK_RLIMIT_NOFILE_SAFE instead.
* | 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.
* vconsole: Don't skip udev call for dummy deviceTim Ruffing2018-11-221-1/+1
| | | | | | | | | | | | | | | | | | | | | Kernel 4.19 supports deferred console takeover [0], i.e., fbcon will take over the console only when the first text is displayed on the console. Before that event, only the dummy console is active. Our currently udev rules call systemd-vconsole on every vtcon except for dummy consoles. Thus the exception for dummy consoles prevents a call to systemd-vconsole when no text is displayed on the console, and as a consequence, the keymap will not be set in that case. This is wrong and leads to issues when keyboard input is expected without text on the console, e.g., when a graphical password prompt is used in the boot process. This reverts commit 6b169c13ecf645a0a341f49b9dc2afb312a74206, which introduced the exception for dummy devices to save unnecessary udev calls. Fixes #10826. [0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=83d83bebf40132e2d55ec58af666713cc76f9764
* log: introduce new helper call log_setup_service()Lennart Poettering2018-11-201-3/+1
| | | | | Let's reduce the common boilerplate and have a single setup function used by all service code to setup logging.
* fileio: automatically add NULL sentinel to parse_env_file()Lennart Poettering2018-11-141-2/+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: replace all remaining uses of parse_env_file() for parsing ↵Lennart Poettering2018-11-141-15/+14
| | | | | | /proc/cmdline Let's always go through the proc-cmdline.c APIs.
* tree-wide: set WRITE_STRING_FILE_DISABLE_BUFFER flag when we write files ↵Yu Watanabe2018-11-061-1/+1
| | | | under /proc or /sys
* tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek2018-06-201-1/+0
| | | | | | | | Fixes #9320. for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms' done
* 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-142-3/+3
| | | | | | 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: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+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.
* fileio: accept FILE* in addition to path in parse_env_file()Lennart Poettering2018-05-241-2/+2
| | | | | | | 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-04-062-26/+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.
* vconsole: minor modernizationsLennart Poettering2018-03-221-13/+20
|
* vconsole-setup: don't concat strv if we don't need to (i.e. not in debug log ↵Lennart Poettering2018-03-221-6/+12
| | | | mode)
* macro: introduce new TAKE_FD() macroLennart Poettering2018-03-221-9/+5
| | | | | | | 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-221-2/+1
| | | | | | | | | | | | | | | | 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)
* coccinelle: similar to reallocarray() let's also systematically use ↵Lennart Poettering2018-03-021-1/+1
| | | | malloc_multiply()
* process-util: rework wait_for_terminate_and_warn() to take a flags parameterLennart Poettering2018-01-041-2/+2
| | | | | | | | | | | | | 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-041-4/+4
|
* vconsole-setup: add some void castsLennart Poettering2018-01-041-2/+2
|