summaryrefslogtreecommitdiff
path: root/src/locale/localectl.c
AgeCommit message (Collapse)AuthorFilesLines
2015-09-29bus-util: rename bus_open_transport() to bus_connect_transport()Lennart Poettering1-1/+1
In sd-bus, the sd_bus_open_xyz() family of calls allocates a new bus, while sd_bus_default_xyz() family tries to reuse the thread's default bus. bus_open_transport() sometimes internally uses the former, sometimes the latter family, but suggests it only calls the former via its name. Hence, let's avoid this confusion, and generically rename the call to bus_connect_transport(). Similar for all related calls. And while we are at it, also change cgls + cgtop to do direct systemd connections where possible, since all they do is talk to systemd itself.
2015-09-29util: introduce common version() implementation and use it everywhereLennart Poettering1-14/+12
This also allows us to drop build.h from a ton of files, hence do so. Since we touched the #includes of those files, let's order them properly according to CODING_STYLE.
2015-09-07basic: rework virtualization detection APILennart Poettering1-1/+1
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-08-06tree-wide: fix indentationThomas Hindoe Paaboel Andersen1-3/+3
2015-07-03sd-bus: introduce new sd_bus_flush_close_unref() callLennart Poettering1-1/+1
sd_bus_flush_close_unref() is a call that simply combines sd_bus_flush() (which writes all unwritten messages out) + sd_bus_close() (which terminates the connection, releasing all unread messages) + sd_bus_unref() (which frees the connection). The combination of this call is used pretty frequently in systemd tools right before exiting, and should also be relevant for most external clients, and is hence useful to cover in a call of its own. Previously the combination of the three calls was already done in the _cleanup_bus_close_unref_ macro, but this was only available internally. Also see #327
2015-06-14tree-wide: fix memory leaks in users of bus_map_all_properties()David Herrmann1-13/+22
If you use bus_map_all_properties(), you must be aware that it might touch output variables even though it may fail. This is, because we parse many different bus-properties and cannot tell how to clean them up, in case we fail deep down in the parser. Fix all callers of bus_map_all_properties() to correctly cleanup any context structures at all times.
2015-05-11treewide: Correct typos and spell plural of bus consistentTorstein Husebø1-2/+2
2015-02-23remove unused includesThomas Hindoe Paaboel Andersen1-6/+0
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-24sd-bus: rename sd_bus_open_system_container() to sd_bus_open_system_machine()Lennart Poettering1-1/+1
Pretty much everywhere else we use the generic term "machine" when referring to containers in API, so let's do though in sd-bus too. In particular, since the concept of a "container" exists in sd-bus too, but as part of the marshalling system.
2014-12-11localectl,man: make it obvious that set-*-keymaps sets both keymapsZbigniew Jędrzejewski-Szmek1-2/+2
https://bugs.freedesktop.org/show_bug.cgi?id=85411
2014-11-28treewide: another round of simplificationsMichal Schmidt1-4/+2
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 Schmidt1-1/+1
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: yet more log_*_errno + return simplificationsMichal Schmidt1-8/+4
Using: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg; print;' $f done And a couple of manual whitespace fixups.
2014-11-28treewide: drop unnecessary trailing \n in log_*() callsMichal Schmidt1-2/+2
2014-11-28treewide: no need to negate errno for log_*_errno()Michal Schmidt1-5/+5
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt1-5/+5
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-11-04localectl: fix localectl set-x11-keymap syntax descriptionJan Synacek1-1/+1
This complements the fix in: commit cd4c6fb12598435fe24431f1dd616f9582f0e3bd Author: Jan Synacek <jsynacek@redhat.com> Date: Mon Oct 20 12:43:39 2014 +0200 man: fix localectl set-x11-keymap syntax description
2014-10-02localectl: always print warnings with log_warning() instead of printf()Lennart Poettering1-5/+4
They really should got to stderr, not stdout.
2014-10-02localectl: count locale variables from 0, instead of VARIABLE_LANGLennart Poettering1-2/+2
That way the we make our code safe regarding reordering of the variables in the enum.
2014-09-25localectl: print warning when there are options given on kernel cmdlineMichal Sekletar1-0/+50
2014-09-15hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt1-1/+1
It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
2014-08-04bus: always explicitly close bus from main programsLennart Poettering1-1/+1
Since b5eca3a2059f9399d1dc52cbcf9698674c4b1cf0 we don't attempt to GC busses anymore when unsent messages remain that keep their reference, when they otherwise are not referenced anymore. This means that if we explicitly want connections to go away, we need to close them. With this change we will no do so explicitly wherver we connect to the bus from a main program (and thus know when the bus connection should go away), or when we create a private bus connection, that really should go away after our use. This fixes connection leaks in the NSS and PAM modules.
2014-08-03Unify parse_argv styleZbigniew Jędrzejewski-Szmek1-9/+6
getopt is usually good at printing out a nice error message when commandline options are invalid. It distinguishes between an unknown option and a known option with a missing arg. It is better to let it do its job and not use opterr=0 unless we actually want to suppress messages. So remove opterr=0 in the few places where it wasn't really useful. When an error in options is encountered, we should not print a lengthy help() and overwhelm the user, when we know precisely what is wrong with the commandline. In addition, since help() prints to stdout, it should not be used except when requested with -h or --help. Also, simplify things here and there.
2014-07-07shared: make timezone and locale enumeration and validation genericLennart Poettering1-178/+6
This way we can reuse it other code thatn just localectl/localed + timedatectl/timedated.
2014-02-20api: in constructor function calls, always put the returned object pointer ↵Lennart Poettering1-2/+4
first (or second) Previously the returned object of constructor functions where sometimes returned as last, sometimes as first and sometimes as second parameter. Let's clean this up a bit. Here are the new rules: 1. The object the new object is derived from is put first, if there is any 2. The object we are creating will be returned in the next arguments 3. This is followed by any additional arguments Rationale: For functions that operate on an object we always put that object first. Constructors should probably not be too different in this regard. Also, if the additional parameters might want to use varargs which suggests to put them last. Note that this new scheme only applies to constructor functions, not to all other functions. We do give a lot of freedom for those. Note that this commit only changes the order of the new functions we added, for old ones we accept the wrong order and leave it like that.
2014-02-14localectl: log error if bus_map_all_properties() failsDjalal Harouni1-1/+3
2013-12-06Get rid of our reimplementation of basenameZbigniew Jędrzejewski-Szmek1-1/+1
The only problem is that libgen.h #defines basename to point to it's own broken implementation instead of the GNU one. This can be fixed by #undefining basename.
2013-11-18localed: match converted keymaps before legacyZbigniew Jędrzejewski-Szmek1-4/+4
Before, X11 keymap fr-pc105-oss would be converted to fr, even though fr-oss exists. Now, if /usr/lib/kbd/keymaps/xkb/<layout>[-<variant>].map[.gz] exists, <layout>[-<variant>] will be used as the console keymap, falling back to the legacy mappings otherwise. % sudo localectl set-x11-keymap pl pc105 % localectl System Locale: LANG=en_US.UTF-8 VC Keymap: pl (was pl2 before) X11 Layout: pl X11 Model: pc105 % sudo localectl set-x11-keymap fr pc105 oss % localectl System Locale: LANG=en_US.UTF-8 VC Keymap: fr-oss (was fr before) X11 Layout: fr X11 Model: pc105 X11 Variant: oss % sudo localectl set-x11-keymap fr pc105 % localectl System Locale: LANG=en_US.UTF-8 VC Keymap: fr X11 Layout: fr X11 Model: pc105 % sudo localectl set-x11-keymap gb % localectl System Locale: LANG=en_US.UTF-8 VC Keymap: gb (was uk before) X11 Layout: gb
2013-11-18remove unused variablesThomas Hindoe Paaboel Andersen1-3/+0
2013-11-12bus: rename sd_bus_send_with_reply_and_block() to sd_bus_call()Lennart Poettering1-1/+1
The call is one of the most important ones we expose, where we place major emphasis on. We should make sure to give it a short, memorable name.
2013-11-08localectl: port over to bus_log_create_error()Lennart Poettering1-3/+3
2013-11-07clients: try to follow roughly the same order in --help texts for common optionsLennart Poettering1-2/+2
2013-11-07polkit: don't spawn local client if we access a remote systemLennart Poettering1-0/+3
2013-11-06clients: unify how we invoke getopt_long()Lennart Poettering1-5/+3
Among other things this makes sure we always expose a --version command and show it in the help texts.
2013-11-06clients: various simplificationsLennart Poettering1-9/+3
2013-11-05bus: update bus_map_all_properties()Kay Sievers1-10/+11
2013-11-02bus: use internal helper to read org.freedesktop.DBus.Properties::GetAll ↵Kay Sievers1-112/+17
variables
2013-10-31localectl: always print error message when an operation failsLennart Poettering1-5/+16
2013-10-30localectl: remove unused 'P' argThomas Hindoe Paaboel Andersen1-1/+1
2013-10-30localectl: port to libsystemd-busKay Sievers1-188/+154
2013-08-01Add /usr/share/keymaps to localectl supported locations.Michał Górny1-0/+1
This is the standard upstream location where kbd installs keymaps.
2013-06-09Allow for the use of @ in remote host callsDaniel Wallace1-2/+3
Without this you have to use %40 with the -H flag because dbus doesn't like the @ sign being unescaped.
2013-05-23Fix --no-ask-passwordJan Janssen1-4/+8
POSIX_ME_HARDER mode is disabled for localectl. It doesn't make much sense in case of localectl, and there's little reason for localectl to behave specially.
2013-05-21man: Document missing optionsJan Janssen1-0/+1
2013-04-24Add set_consume which always takes ownershipZbigniew Jędrzejewski-Szmek1-15/+7
Freeing in error path is the common pattern with set_put().
2013-04-18move _cleanup_ attribute in front of the typeHarald Hoyer1-3/+3
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-15localectl: read X11 keymaps from the correct fileLennart Poettering1-1/+1
As reported by Sergey Udaltsov.
2013-04-10localctl: skip locale entries with non-UTF8 namesLennart Poettering1-0/+4
glibc should place these in the locale archive. For now, let's just skip them from our output, since they are aliases anyway. https://bugs.freedesktop.org/show_bug.cgi?id=63389
2013-04-05Use initalization instead of explicit zeroingZbigniew Jędrzejewski-Szmek1-2/+1
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-05localectl: add support for listing X11 keymap informationLennart Poettering1-18/+130