1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 08:26:52 +03:00
Commit Graph

280 Commits

Author SHA1 Message Date
Lennart Poettering
84f6181c2a clients: various simplifications 2013-11-06 17:32:51 +01:00
Kay Sievers
9f6eb1cd58 bus: update bus_map_all_properties() 2013-11-05 02:57:49 +01:00
Kay Sievers
ffc06c3513 bus: use internal helper to read org.freedesktop.DBus.Properties::GetAll variables 2013-11-02 01:48:22 +01:00
Thomas Hindoe Paaboel Andersen
0068027e86 timedatectl: remove unused variable 2013-10-31 22:02:29 +01:00
Lennart Poettering
ebd495b0a1 Revert "timedated: support --enable-split-usr"
This reverts commit 36f9f99556.

The ntp unit information is only needed by timedated which runs in late
boot only, where all disks are around. Hence there's no point in
allowing them to be located in the rootprefix.
2013-10-31 11:20:33 +01:00
Lennart Poettering
e1636421f4 localectl: always print error message when an operation fails 2013-10-31 03:14:37 +01:00
Kay Sievers
7f35b7bc4a timedatectl: do not print the time zone for the rtc time 2013-10-31 03:05:14 +01:00
Lennart Poettering
e5609878d8 timedatectl: assorted simplifications 2013-10-31 03:02:49 +01:00
Kay Sievers
2f6a590705 timedatectl: get time values from the service instead of the client
This allow querying the RTC time from the unprivileged timedatectl.
2013-10-31 02:33:23 +01:00
Thomas Hindoe Paaboel Andersen
a281d9c785 timedatectl: port to sd-bus 2013-10-30 21:13:46 +01:00
Dave Reisner
36f9f99556 timedated: support --enable-split-usr 2013-10-30 11:06:43 -04:00
Lennart Poettering
88e262b667 timedate: handle more nicely if something or somebody keeps open /dev/rtc and thus blocks out everybody else
chrony is appears to keep the RTC open continuously these days which is
a bad idea, and /dev/rtc is a single-user device, which is a bad idea
too. Together both bad ideas mean that nobody else can access the RTC
anymore. That's something to fix, but in the meantime we should handle
this more gracefully.
2013-10-29 19:34:59 +01:00
Kay Sievers
9bcbce4201 bus: avoid 'bool' storage when retrieving 'b' from the message
Just use an unsigned int as a bool type to avoid issues in the public
message reading API; sizeof(bool) == 1, but the code copies 4 bytes at
the pointers destination.
2013-10-22 03:35:45 +02:00
Lennart Poettering
abc5fe7250 bus: automatically flush bus queue when we exit the event loop
This way, we do not have to call it manually
2013-10-18 01:43:55 +02:00
Lennart Poettering
7e9cf16c20 timedated: disable debug logging 2013-10-18 00:49:01 +02:00
Lennart Poettering
03cc26dda4 timedated: expose time and NTP sync flag via the bus
This way, timedatectl can be run over the network and determine all
properties correctly from the server rather than the client.
2013-10-17 01:03:39 +02:00
Lennart Poettering
6fc60278a9 timedate: expose RTC time
Since access to the RTC is privileged expose the current RTC time as bus
property so that unprivileged clients can read it.
2013-10-16 17:01:26 +02:00
Lennart Poettering
40ca29a137 timedated: use libsystemd-bus instead of libdbus for bus communication
Among other things this also adds a few things necessary for the change:

- Considerably more powerful error returning APIs in libsystemd-bus

- Adapter for connecting an sd_bus to an sd_event

- As I reworked the PolicyKit logic to the new library I also made it
  asynchronous, so that PolicyKit requests of one user cannot block out
  another user anymore.

- We always use the macro names for common bus error. That way it is
  harder to mistype them since the compiler will notice
2013-10-16 06:15:02 +02:00
Jason St. John
e9dd9f9547 man: improve grammar and word formatting in numerous man pages
Use proper grammar, word usage, adjective hyphenation, commas,
capitalization, spelling, etc.

To improve readability, some run-on sentences or sentence fragments were
revised.

[zj: remove the space from 'file name', 'host name', and 'time zone'.]
2013-07-02 23:06:22 -04:00
Daniel Wallace
7085053a43 Allow for the use of @ in remote host calls
Without this you have to use %40 with the -H flag because dbus doesn't
like the @ sign being unescaped.
2013-06-09 18:26:41 -04:00
Jan Janssen
546158bc6f Fix --no-ask-password
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-23 00:28:04 -04:00
Jan Janssen
2927b326cc man: Document missing options 2013-05-21 09:23:51 -04:00
Harald Hoyer
7fd1b19bc9 move _cleanup_ attribute in front of the type
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-18 09:11:22 +02:00
Harald Hoyer
7e7d4da229 timedated: fixed NTP enabled: n/a 2013-04-17 08:28:41 +02:00
Zbigniew Jędrzejewski-Szmek
b92bea5d2a Use initalization instead of explicit zeroing
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-05 19:50:57 -04:00
Zbigniew Jędrzejewski-Szmek
d257f05a5f timedated: fix a few memory leaks
Contents of /etc/adjtime and more.
2013-04-04 22:46:19 -04:00
Lennart Poettering
574d5f2dfc util: rename write_one_line_file() to write_string_file()
You can write much more than just one line with this call (and we
frequently do), so let's correct the naming.
2013-04-03 20:12:56 +02:00
Zbigniew Jędrzejewski-Szmek
4dd1de72e8 Remove some dead code
Based on coverity report.
2013-03-31 14:28:36 -04:00
Lennart Poettering
86e7b6e3f6 timedated: extra overflow safety check when doing relative time changes
Ensure clients don't overflow usec_t when doing relative time changes.
This is mostly just paranoia and protection against accidents, after all
clients are already authenticated, and they can se the time to any
value they wish anyway, but better be safe than sorry.

https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1152187/comments/14
2013-03-22 21:38:49 +01:00
Lennart Poettering
1a5613266a timedatectl: show CanNTP field 2013-03-22 21:18:10 +01:00
Colin Walters
c6a818c820 Use bus_maybe_send_reply() where applicable
This is a followup to: commit 1a37b9b904

It will fix denial messages from dbus-daemon between gdm and
systemd-logind on logging into GNOME due to this.

See the previous commit for more details.
2013-03-18 19:59:32 -04:00
Harald Hoyer
1b12a7b589 pager: introduce "jump to end" option
$ journalctl -be

is what you want :)

https://bugzilla.redhat.com/show_bug.cgi?id=867841
2013-03-07 21:16:04 +01:00
Ryan Lortie
6ffe5e37c4 timedated: add CanNTP property
If we can't successfully query any ntpd units, set CanNTP to false.

GNOME wants to use this to grey out the NTP switch in the UI.

https://bugs.freedesktop.org/show_bug.cgi?id=61816
2013-03-06 15:39:37 +01:00
Harald Hoyer
a5c32cff1f honor SELinux labels, when creating and writing config files
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-14 16:19:38 +01:00
Kay Sievers
7850b3b837 shared: conf-files - add root parameter 2013-02-08 10:23:04 +01:00
Thomas Hindoe Paaboel Andersen
7c2d80944a strv: add strv_print
Clearer, and spares the temp variable.
2013-02-07 00:38:09 +01:00
Kay Sievers
99f861310d timedated: remove left-over distribution specific code 2013-01-09 19:14:44 +01:00
Lennart Poettering
bc2708414b build-sys: drop all distribution specfic checks
Yay, we now have a completely generic systemd. No distribution specific checks anymore!
2013-01-04 23:26:21 +01:00
Lennart Poettering
46a2911bf2 core: drop support for old per-distro configuration files for console, 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.
2013-01-04 23:26:20 +01:00
Lennart Poettering
3960015566 polkit: add "imply" rules to a number of polkit actions 2012-12-31 21:24:26 +01:00
Shawn Landden
b779821b8f timedated: do not incorrectly close non-opened dbus connection
Fix the fallowing error when no system dbus available:

Failed to get system D-Bus connection: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
process 14920: arguments to dbus_connection_close() were incorrect, assertion "connection != NULL" failed in file ../../dbus/dbus-connection.c line 2889.
This is normally a bug in some application using the D-Bus library.
process 14920: arguments to dbus_connection_unref() were incorrect, assertion "connection != NULL" failed in file ../../dbus/dbus-connection.c line 2776.
This is normally a bug in some application using the D-Bus library.
2012-12-03 01:56:42 +01:00
Lennart Poettering
3062c15117 timedatectl: improve english language DST change texts a bit 2012-11-23 21:38:42 +01:00
Lennart Poettering
bd5ce8e9fc timedatectl: show both current actual timezone name and UTC distance in TImezone field 2012-11-23 16:33:39 +01:00
Lennart Poettering
2af32104c4 timedatctl: bring manual strftime in sync with format_timestamp() 2012-11-23 16:29:35 +01:00
Kay Sievers
279858059d timedatectl: replace ",' with ':' 2012-11-22 18:50:55 +01:00
Kay Sievers
324dfd5c32 timedatectl: shorten output to print single < 80 char line 2012-11-22 18:47:25 +01:00
Zbigniew Jędrzejewski-Szmek
fea05a40ff timedatectl: break line to not exceed 80 columns 2012-11-14 22:49:29 +01:00
Dave Reisner
a9cdc94f7f enable localization for common *ctl commands 2012-11-12 14:16:07 -05:00
Kay Sievers
2311eb2ff0 timedatectl: properly print 30 minutes DST transitions 2012-11-11 16:55:25 +01:00
Kay Sievers
e2fd5e5ba2 timedatectl: show "DST active: n/a" if no DST data is available 2012-11-02 05:45:02 -10:00
Kay Sievers
f18ca9dcde timedatectl: explain everything nobody wants to know about DST 2012-11-02 03:45:07 +01:00
Lennart Poettering
857a493d55 set: introduce strv_sort() 2012-10-19 04:53:45 +02:00
Lennart Poettering
7591abd480 timedatectl,hostnamectl: rework --help text 2012-10-19 04:51:53 +02:00
Lennart Poettering
c978343015 timedatectl: rename --fix-system to --adjust-system-clock
Quite long to read but hopefully less misleading.
2012-10-17 22:52:21 +02:00
Dave Reisner
f75cb30bf9 timedatectl: ensure n_zones is initialized 2012-10-17 15:44:59 -04:00
Lennart Poettering
599659860c timedatectl: properly initialize struct before decoding bus messages 2012-10-17 21:25:43 +02:00
Lennart Poettering
6d0274f115 timedatectl: introduce new command line client for timedated
Much like logind has a client in loginctl, and journald in journalctl
introduce timedatectl, to change the system time (incl. RTC), timezones
and related settings.
2012-10-17 21:25:42 +02:00
Zbigniew Jędrzejewski-Szmek
1ca6783f5e log: introduce a macro to format message id
The MESSAGE_ID=... stanza will appear in countless number of places.
It is just too long to write it out in full each time.

Incidentally, this also fixes a typo of MESSSAGE is three places.
2012-10-13 14:26:30 +02:00
Lennart Poettering
462ff40e65 timedated: /etc/sysconfig/clock is dead on Fedora, remove it 2012-09-20 20:51:18 +02:00
Lennart Poettering
c68df23956 timedated: unregister the right bus service
https://bugzilla.redhat.com/show_bug.cgi?id=858771
2012-09-19 19:09:22 +02:00
Kay Sievers
72edcff5db hwclock: always set the kernel's timezone
Properly tell the kernel at bootup, and any later time zone changes,
the actual system time zone.

Things like the kernel's FAT filesystem driver needs the actual time
zone to calculate the proper local time to use for the on-disk time
stamps.

https://bugzilla.redhat.com/show_bug.cgi?id=802198
2012-09-17 16:56:26 +02:00
Lennart Poettering
e19a21a879 timedated: make /etc/timezone a Debian-only thing 2012-09-14 20:20:29 +02:00
Lennart Poettering
424a19f8a2 timedate: assorted improvements
- Make writing/reading of /etc/timezone dependendent of HAVE_SYSV_COMPAT

- Introduce symlink_atomic() after all, and use it

- Use relative symlink for /etc/localtime
2012-09-14 20:02:52 +02:00
Shawn Landden
92c4ef2d35 timedated: gather timezone from /etc/localtime sym target
/etc/localtime -> /usr/share/zoneinfo/...

or

/etc/localtime -> ../usr/share/zoneinfo/...

(note, ../usr is not the same if /etc is a symlink, as this isn't
using canonicalize_file_name())

keep other method for now, consider dropping later.

Supporting relative links here are problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only supports absolute symlinks
"/usr/share/zoneinfo/" and relative symlinks starting with
"../usr/share/zoneinfo/"

>From TODO (kay sievers):
* kill /etc/timezone handling entirely? What does it provide?
  - /etc/localtime carries the same information already:
      $ ls -l /etc/localtime; cat /etc/timezone
      lrwxrwxrwx 1 root root 33 Jul 27 09:55 /etc/localtime -> /usr/share/zoneinfo/Europe/Berlin
      Europe/Berlin
  - systemd enforces /usr to be available at bootup, so we can
    enforce the use of the symlink
2012-09-14 19:27:44 +02:00
Lennart Poettering
877d54e9b0 journal: generate structured journal messages for a number of events 2012-09-03 18:59:04 -07:00
Shawn Landden
0d0f0c50d3 log.h: new log_oom() -> int -ENOMEM, use it
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-26 11:48:26 +02:00
Shawn Landden
669241a076 use "Out of memory." consistantly (or with "\n")
glibc/glib both use "out of memory" consistantly so maybe we should
consider that instead of this.

Eliminates one string out of a number of binaries. Also fixes extra newline
in udev/scsi_id
2012-07-25 11:23:57 +02:00
Lennart Poettering
f6c13ce47e timedate: uniq'ify ntp units list 2012-07-03 15:37:04 +02:00
Lennart Poettering
b32d167503 timedated: replace ntp-units file with an ntp-units.d drop-in dir
To be considered by timedated for NTP a package simply has to drop in
/usr/lib/systemd/ntp-units.d/foobar.list and write one or more unit
names into it. The first one listed is the one that is enabled.
2012-07-03 02:02:13 +02:00
Lennart Poettering
2b2e9df876 timedate: fix ntp-units comment 2012-07-02 11:43:02 +02:00
Lennart Poettering
ac7019f33f timedated: replace systemd-timedated-ntp.target logic with simpler scheme
The previous systemd-timedated-ntp.target was suffering by the problem
that NTP implementations enabled via the machanism could not be disabled
the obvious way on the "systemctl disable" command line. Replace
systemd-timedated-ntp.target by a list of implementations we try in
turn. The list is encoded in $pkgdatadir/ntp-units.
2012-07-02 10:43:56 +02:00
Kay Sievers
bbc98d3256 util: split-out hwclock.[ch] 2012-05-08 01:57:17 +02:00
Lennart Poettering
e2875c4693 timedated: introduce systemd-timedated-ntp.target which is controlled by timedated's NTP setting
We shouldn't hardcode the name of the NTP implementation in the
timedated mechanism, especially since Fedora currently switched from NTP
to chrony.

This patch introduces a new target that is enabled/disabled instead of
the actual NTP implementation. The various NTP implementations should
then add .wants/ symlinks to their services and BindTo back to the
target, so that their implementations are started/stopped jointly with
the target.

https://bugzilla.redhat.com/show_bug.cgi?id=815748
2012-04-25 16:49:02 +02:00
Lennart Poettering
5430f7f2bc relicense to LGPLv2.1 (with exceptions)
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.
2012-04-12 00:24:39 +02:00
Lennart Poettering
2aa4c31529 timedate: don't fail if NTP is not installed
https://bugzilla.redhat.com/show_bug.cgi?id=790260
2012-02-15 00:05:31 +01:00
Lennart Poettering
89f134406a logind: introduce CanReboot/CanPowerOff bus calls 2012-02-11 00:13:10 +01:00
Kay Sievers
131a4dcfd4 login: move seat udev rules to login subdir 2012-01-22 18:32:13 +01:00
Michal Schmidt
d200735e13 dbus: more efficient implementation of properties
The way the various properties[] arrays are initialized is inefficient:
 - only the .data members change at runtime, yet the whole arrays of
   properties with all the fields are constructed on the stack one by
   one by the code.
 - there's duplication, eg. the properties of "org.freedesktop.systemd1.Unit"
   are repeated in several unit types.

Fix it by moving the information about properties into static const
sections. Instead of storing the .data directly in the property, store
a constant offset from a run-time base.
The small arrays of struct BusBoundProperties bind together the constant
information with the right runtime information (the base pointer).

On my system the code shrinks by 60 KB, data increases by 10 KB.
2012-01-16 13:34:42 +01:00
Lennart Poettering
2f9dec073b build-sys: add stub makefiles to subdirs 2012-01-05 16:29:21 +01:00
Kay Sievers
4668191d02 timedated: move sources to subdirectory 2011-12-31 06:40:48 +01:00