summaryrefslogtreecommitdiff
path: root/src/vconsole/vconsole-setup.c
AgeCommit message (Collapse)Author
2015-10-27util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering
2015-10-27util-lib: move more locale-related calls to locale-util.[ch]Lennart Poettering
2015-10-26util-lib: split out IO related calls to io-util.[ch]Lennart Poettering
2015-10-25util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering
There are more than enough to deserve their own .c file, hence move them over.
2015-10-24util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering
string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
2015-09-07basic: rework virtualization detection APILennart Poettering
Introduce a proper enum, and don't pass around string ids anymore. This simplifies things quite a bit, and makes virtualization detection more similar to architecture detection.
2015-07-06tree-wide: fix write_string_file() user that should not create filesDaniel Mack
The latest consolidation cleanup of write_string_file() revealed some users of that helper which should have used write_string_file_no_create() in the past but didn't. Basically, all existing users that write to files in /sys and /proc should not expect to write to a file which is not yet existant.
2015-07-06fileio: consolidate write_string_file*()Daniel Mack
Merge write_string_file(), write_string_file_no_create() and write_string_file_atomic() into write_string_file() and provide a flags mask that allows combinations of atomic writing, newline appending and automatic file creation. Change all users accordingly.
2015-06-10tree-wide: whenever we fork off a foreign child process reset signal ↵Lennart Poettering
mask/handlers Also, when the child is potentially long-running make sure to set a death signal. Also, ignore the result of the reset operations explicitly by casting them to (void).
2015-04-11shared: add terminal-util.[ch]Ronny Chevalier
2015-04-10shared: add process-util.[ch]Ronny Chevalier
2015-04-09vconsole: some modernizations, indentation fixesLennart Poettering
2015-04-09vconsole: stick to kernel-style function error handlingLennart Poettering
This undoes part of 8931278c8a9ef7b60f6b6963486a9e9febb20a0d. We really should stick to kernel-style "int" return values from functions, and not covnert success into boolean returns.
2015-03-15vconsole-setup: check error of child processLucas De Marchi
If we don't check the error of the child process, systemd-vconsole-setup would exit with 0 even if it could not really setup the console. For a simple test, move loadkeys elsewhere and execute systemd-vconsole-setup: [root@localhost ~]# strace -f -e execve /usr/lib/systemd/systemd-vconsole-setup execve("/usr/lib/systemd/systemd-vconsole-setup", ["/usr/lib/systemd/systemd-vconsol"...], [/* 15 vars */]) = 0 Process 171 attached [pid 171] execve("/usr/bin/loadkeys", ["/usr/bin/loadkeys", "-q", "-C", "/dev/tty0", "br-abnt2"], [/* 15 vars */]) = -1 ENOENT (No such file or directory) [pid 171] +++ exited with 1 +++ --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=171, si_uid=0, si_status=1, si_utime=0, si_stime=0} --- +++ exited with 0 +++ Note that loadkeys returned 1 while systemd-vconsole-setup return 0. Since the font and keyboard setup are already serialized, refactor the code a little bit so the functions do the wait by themselves. One change in behavior in this patch is that we don't return early, but we do try to setup the keyboard even if the font load failed.
2015-02-23remove unused includesThomas Hindoe Paaboel Andersen
This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
2014-12-09treewide: sanitize loop_writeZbigniew Jędrzejewski-Szmek
loop_write() didn't follow the usual systemd rules and returned status partially in errno and required extensive checks from callers. Some of the callers dealt with this properly, but many did not, treating partial writes as successful. Simplify things by conforming to usual rules.
2014-11-29delta: diff returns 1 when files differ, ignore thisZbigniew Jędrzejewski-Szmek
https://bugs.debian/org/771397
2014-11-28treewide: another round of simplificationsMichal Schmidt
Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
2014-11-28treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
2014-11-28treewide: no need to negate errno for log_*_errno()Michal Schmidt
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt
As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
2014-09-30vconsole: silence coverityThomas Hindoe Paaboel Andersen
Let's silence coverity here too. There is not much to do if the ioctls to copy the fonts and character maps should fail.
2014-07-07vconsole-setup: fix inverted error messagesZbigniew Jędrzejewski-Szmek
Introduced in abee28c56d. Pointed-out-by: Werner Fink <werner@suse.de>
2014-07-06vconsole-setup: run setfont before loadkeysZbigniew Jędrzejewski-Szmek
https://bugs.freedesktop.org/show_bug.cgi?id=80685
2014-06-23vconsole: also copy character maps (not just fonts) from vt1 to vt2, vt3, ...Carl Schaefer
https://bugs.freedesktop.org/show_bug.cgi?id=78796
2014-03-18util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering
safe_close() automatically becomes a NOP when a negative fd is passed, and returns -1 unconditionally. This makes it easy to write lines like this: fd = safe_close(fd); Which will close an fd if it is open, and reset the fd variable correctly. By making use of this new scheme we can drop a > 200 lines of code that was required to test for non-negative fds or to reset the closed fd variable afterwards.
2013-04-18move _cleanup_ attribute in front of the typeHarald Hoyer
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-05Use initalization instead of explicit zeroingZbigniew Jędrzejewski-Szmek
Before, we would initialize many fields twice: first by filling the structure with zeros, and then a second time with the real values. We can let the compiler do the job for us, avoiding one copy. A downside of this patch is that text gets slightly bigger. This is because all zero() calls are effectively inlined: $ size build/.libs/systemd text data bss dec hex filename before 897737 107300 2560 1007597 f5fed build/.libs/systemd after 897873 107300 2560 1007733 f6075 build/.libs/systemd … actually less than 1‰. A few asserts that the parameter is not null had to be removed. I don't think this changes much, because first, it is quite unlikely for the assert to fail, and second, an immediate SEGV is almost as good as an assert.
2013-04-05vconsole-setup: fix vconsole.conf vs. cmdline overriding logicMichal Schmidt
Skipping the parsing of /etc/vconsole.conf just because some values were already assigned from the cmdline never made sense. And by the way, commit f73141d changed the return values of parse_env_file() - it now gives 0 on success. Which means in current HEAD /etc/vconsole.conf overrides the cmdline, which is the reverse of what's expected. We need to parse /etc/vconsole.conf first and then let vconsole.* overrides from cmdline take effect. The behaviour is documented in vconsole.conf(5). https://bugzilla.redhat.com/show_bug.cgi?id=948750
2013-04-03util: rename write_one_line_file() to write_string_file()Lennart Poettering
You can write much more than just one line with this call (and we frequently do), so let's correct the naming.
2013-03-31ModernizationZbigniew Jędrzejewski-Szmek
Use _cleanup_ and wrap lines to ~80 chars and such.
2013-02-14honor SELinux labels, when creating and writing config filesHarald Hoyer
Also split out some fileio functions to fileio.c and provide a SELinux aware pendant in fileio-label.c see https://bugzilla.redhat.com/show_bug.cgi?id=881577
2013-02-09vconsole-setup: don't set the kbd mode to unicode if is is currently in ↵Lennart Poettering
raw/off mode Let's not confuse X11
2013-01-15vconsole: use /dev/vcsa1-15 to check for allocated VTsKay Sievers
2013-01-15vconsole: copy font to tty1-15Kay Sievers
2013-01-15vconsole: upload font to /dev/tty1 and copy it to all allocated VTsKay Sievers
2013-01-04core: drop support for old per-distro configuration files for console, ↵Lennart Poettering
hostname, locale, timezone This simplifies the upstream system code quite a bit. If downstream distributions want to maintain compatibility with their old configuration files, they are welcome to do so, but need to maintain this as patches downstream. The burden needs to be on the distributions to maintain differences here. Our suggestion however is to just convert the old configuration files on upgrade, as multiple distributions already do.
2012-11-03drop Arch Linux support for reading /etc/rc.confDave Reisner
2012-11-03vconsole: remove Frugalware legacy file supportMiklos Vajna
2012-11-02util: add is_locale_utf8()Michal Schmidt
journalctl and vconsole-setup both implement utf8 locale detection. Let's have a common function for it. The next patch will add another use.
2012-10-24remove Fedora hostname, locale, vconsole legacy file supportKay Sievers
2012-10-03 vconsole: default to the kernel compiled-in keymapTom Gundersen
No longer override the default kernel keymap if nothing is specified in vconsole.conf. The default should be to do nothing (i.e., use what is already in the kernel) unless the distro/admin has explicitly requested it.
2012-10-03vconsole: default to the kernel compiled-in fontTom Gundersen
No longer override the default kernel font if nothing is specified in vconsole.conf. The default kernel font[0] provides ISO-8859-1 and box characters. Users of Arabic, Cyrilic or Hebrew must set a different font manually as these character sets were provided by the old default font [1], but are not any longer. Rationale: * it is counter-intuitive that an empty vconsole.conf file is different from adding FONT=""; * the version of the default font shipped with Arch (which is the upstream one) behaves very badly during early boot[2] (which should admittedly be fixed in the font itself); * the kernel already supplies a default font, it seems reasonable to use that unless anything else is specified; * This also avoids a needless slow call to setfont; and * We don't want to work around problems in the kernel (in case the compiled-in font is not acceptable for whatever reason). [0]: <https://dev.archlinux.org/~tomegun/kernel.bdf> [1]: <https://dev.archlinux.org/~tomegun/latarcyrheb.bdf> [2]: <http://i.imgur.com/J2tM4.jpg>
2012-07-26log.h: new log_oom() -> int -ENOMEM, use itShawn Landden
also a number of minor fixups and bug fixes: spelling, oom errors that didn't print errors, not properly forwarding error codes, few more consistency issues, et cetera
2012-07-09MeeGo: Remove build support for MeeGo distribution.Auke Kok
The MeeGo distribution is still a supported distribution, but will probably not see an updated version of systemd anymore. Most of the development is focussing on Tizen now, and the generic support for building --with-distro=other is more than adequate enough. This patch removes the support as a custom configuration build target in systemd. People who are still building this for the MeeGo distribution should build as "other" distro.
2012-06-19vconsole-setup: enable utf-8 mode explicitlyTom Gundersen
Rather than assuming the console is in utf-8 mode if nothing else is specified, be a bit more robust and enable it explicitly. This fixes a regression compared with Arch's initscripts when not using a framebuffer as the old VGA console would not be in utf-8 mode by default. Furthermore, this would allow vconsole-setup to be used after boot to change the vconsole into utf-8 mode in case it has been set to non-utf-8 mode for whatever reason. I.e, the following would leave the console in utf-8 mode as expected: # export LANG=en_US.ISO-8859-1 # /usr/lib/systemd/systemd-vconsole-setup # export LANG=en_US.UTF-8 # /usr/lib/systemd/systemd-vconsole-setup Reported-by: Xyne <xyne@archlinx.ca> Reported-by: Thomas Bächler <thomas@archlinux.org> Cc: Dave Reisner <dreisner@archlinux.org>
2012-05-03vconsole: fix some error messagesLennart Poettering
2012-05-03vconsole: fix error messagesLennart Poettering
https://bugs.freedesktop.org/show_bug.cgi?id=49192
2012-04-12relicense to LGPLv2.1 (with exceptions)Lennart Poettering
We finally got the OK from all contributors with non-trivial commits to relicense systemd from GPL2+ to LGPL2.1+. Some udev bits continue to be GPL2+ for now, but we are looking into relicensing them too, to allow free copy/paste of all code within systemd. The bits that used to be MIT continue to be MIT. The big benefit of the relicensing is that closed source code may now link against libsystemd-login.so and friends.
2011-12-31build-sys: make readahead and vconsole optionalLennart Poettering