1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 11:55:44 +03:00
Commit Graph

11129 Commits

Author SHA1 Message Date
Lennart Poettering
2fa4092c28 util: make time formatting a bit smarter
Instead of outputting "5h 55s 50ms 3us" we'll now output "5h
55.050003s". Also, while outputting the accuracy is configurable.

Basically we now try use "dot notation" for all time values > 1min. For
>= 1s we use 's' as unit, otherwise for >= 1ms we use 'ms' as unit, and
finally 'us'.

This should give reasonably values in most cases.
2013-04-04 02:56:56 +02:00
Lennart Poettering
911963f1a2 update TODO 2013-04-03 23:00:08 +02:00
Lennart Poettering
cb0dac0548 time: add suppot for fractional time specifications
We can now parse "0.5s" as the same as "500ms". In fact, we can parse
"3.45years" correctly, too, and any other unit and fraction length.
2013-04-03 23:00:08 +02:00
Zbigniew Jędrzejewski-Szmek
d3b9e0ff4e build-sys: "link" libsystemd-id128 against libsd-daemon-internal
georgem> libsystemd-id128.so: undefined reference to `sd_listen_fds'

In some toolchains (--as-needed not used or not working), the
toolchain doesn't drop this dependency. It is introduced because
sd-id128.so is linked against sd-shared.la, and some functions therein
use libsystemd-daemon, but libsd-id128 doesn't use any of those
functions.

This results in no change in libsystemd-id128.so when the unused
symbols are properly stripped.
2013-04-03 16:14:29 -04:00
Lennart Poettering
fda2c5d28b hostnamectl: if somebody invokes 'hostnamectl set-hostname' with a valid internet hostname unset the pretty name
If people are unaware or uninterested in the concept of pretty host
names, and simply invoke "hostnamectl set-hostname" for a valid internet
host name, then use this as indication to unset the pretty host name and
only set the static/dynamic one.

This also allows fqdn, hence "hostnamectl set-hostname www.foobar.com"
will just work if people really insist on using fqdns as hostnames.
2013-04-03 22:06:16 +02:00
Lennart Poettering
fec6fc6bae fileio: don't check for errors more often than really necessary 2013-04-03 20:12:57 +02:00
Lennart Poettering
768100efd5 fileio: write proper env var write-out code
This will properly escape all weird chars when writing env var files.
With this in place we can now read and write environment files where the
values contain arbitrary weird chars.

This enables hostnamed and suchlike to finally properly save pretty host
names with backlashes or quotes in them.
2013-04-03 20:12:57 +02:00
Lennart Poettering
f73141d765 shared: rework env file reader
Implement this with a proper state machine, so that newlines and
escaped chars can appear in string assignments. This should bring the
parser much closer to shell.
2013-04-03 20:12:57 +02:00
Lennart Poettering
7f602784de util: rename parse_usec() to parse_sec() sinds the default unit is seconds
Internally we store all time values in usec_t, however parse_usec()
actually was used mostly to parse values in seconds (unless explicit
units were specified to define a different unit). Hence, be clear about
this and name the function about what we pass into it, not what we get
out of it.
2013-04-03 20:12:57 +02: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
Harald Hoyer
b6e8f1f03d core/killall.c: prevent segfault and initialize pids 2013-04-03 15:17:51 +02:00
Zbigniew Jędrzejewski-Szmek
2bfc1edad8 cgtop: add % as key to toggle time/percentage 2013-04-02 15:01:44 -04:00
Umut Tezduyar
1e913bcba3 cgtop: optionally show CPU usage as time and become stdout sensitive 2013-04-02 14:50:14 -04:00
Zbigniew Jędrzejewski-Szmek
7464b33d80 nss-myhostname: do not use _cleanup_
mss-myhostname wasn't working because of underlinking. Instead of
fixing the underlinking, just remove the use of _cleanup_ macros.

It is impolite to use our utility functions in modules designed to be
loaded by others. So cleanup macros which (at some point) call assert
which calls log_assert_failed, should not be used. Revert this part of
commit d73c3269c.
2013-04-02 13:57:32 -04:00
Lennart Poettering
d1148ed10a update TODO 2013-04-02 17:47:59 +02:00
Lennart Poettering
fa70beaabc macro: add macro for precisely determining length of decimal string formatting of a numeric type 2013-04-02 17:47:59 +02:00
Lennart Poettering
5c0aa72a49 util: add a bit of syntactic sugar for saving/restoring errno 2013-04-02 17:47:59 +02:00
Zbigniew Jędrzejewski-Szmek
2875e22b65 Replace s/Dropin/DropIn/ 2013-04-02 10:24:51 -04:00
Oleksii Shevchuk
ae7a7182da Introspect and monitor dropin configuration 2013-04-01 23:43:49 -04:00
Zbigniew Jędrzejewski-Szmek
050fbdb878 shared/cgroup-show: fix leak of "pid" 2013-04-01 23:43:49 -04:00
Zbigniew Jędrzejewski-Szmek
1316013495 systemctl: align all status fields to common column
avahi-daemon.socket - Avahi mDNS/DNS-SD Stack Activation Socket
       Loaded: loaded (/usr/lib/systemd/system/avahi-daemon.socket; enabled)
       Active: active (listening) since Mon 2013-04-01 09:02:44 EDT; 14h ago
 ListenStream: /var/run/avahi-daemon/socket
2013-04-01 23:43:49 -04:00
Oleksii Shevchuk
6741960087 Add Listen* to dbus properties
sockets.socket - Test
	  Loaded: loaded (/home/alxchk/.config/systemd/user/sockets.socket; static)
	  Active: inactive (dead)
	  Listen: Stream: /tmp/stream1
	          Stream: @stream4
	          Stream: [::]:9999
	          Stream: 127.0.0.2:9996
	          Stream: [::1]:9996
	          Datagram: /tmp/stream2
	          Datagram: @stream5
	          Datagram: [::]:9998
	          Datagram: 127.0.0.2:9995
	          Datagram: [::1]:9995
	          SequentialPacket: @stream6
	          SequentialPacket: /tmp/stream3
	          FIFO: /tmp/fifo1
	          Special: /dev/input/event9
	          Netlink: kobject-uevent 0
	          MessageQueue: /msgqueue1

[zj: - minor cleanups,
     - free i.listen,
     - remove sorting, because the order or sockets matters.]
2013-04-01 23:43:48 -04:00
Dr. Tilmann Bubeck
80cfe9e163 Do no isolate in case of emergency or severe problems
This patch changes local-fs.target and systemd-fsck to not use
"isolate" when going into emergency.
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=810722

The motivation is, that when something wents wrong, we should
keep everything as it is, to let the user fix the problem. When
isolating we stop a lot of services and therefore change the
system heavily so that it gets harder for the user to fix.

An example is a crypted partition. When the fsck in a crypted
partition fails, it previously used "emergency/start/isolate"
which stops cryptsetup. Therefore if the user tries to fsck
e.g. /dev/mapper/luks-356c20ae-c7a2-4f1c-ae1d-1d290a91b691
as printed by the failing fsck, then it will not find this
device (because it got closed).

So please apply this patch to let the user see the failing
situation.

Thanks!

[zj: removed dead isolate param from start_target().]

https://bugs.freedesktop.org/show_bug.cgi?id=49463
https://bugzilla.redhat.com/show_bug.cgi?id=810722
2013-04-01 23:43:48 -04:00
Cristian Rodríguez
9607d9470e Always use our own MAX/MIN definitions
code in src/shared/macro.h only defined MAX/MIN in case
they were not defined previously. however the MAX/MIN
macros implemented in glibc are not of the "safe" kind but defined
as:

define MIN(a,b) (((a)<(b))?(a):(b))
define MAX(a,b) (((a)>(b))?(a):(b))

Avoid nasty side effects by using our own versions instead.

Also fix the warnings derived from this change.

[zj: - modify MAX3 macro to fix warning about _a shadowing _a,
     - do bootchart/svg.c too,
     - remove unused MIN3.]
2013-04-01 23:43:48 -04:00
Lennart Poettering
e5ec62c569 update TODO 2013-04-02 01:28:01 +02:00
Lennart Poettering
aaf7eb81be shutdown: correctly wait for processes we killed in the killall spree
Previously we simply counted how many processes we killed and expected
as many waitpid() calls to succeed. That however is incorrect to do.

As we might kill processes that are not our immediate children, and as
there might be left-over processes in the waitpid() queue from earlier
the we might get more ore less waitpid() events that we expect.

Hence: keep precise track of the processes we kill, remove the ones we
get waitpid() for, and after each time we get SIGCHLD check if all
others still exist. We use getpgid() to check if a PID still exists.

This should fix issues with journald not setting journal files offline
correctly on shutdown, because we'd too quickly proceed from SIGTERM to
SIGKILL because some left-over process was in our waitpid() queue.
2013-04-02 01:28:01 +02:00
Thomas Weißschuh
ceca950145 cryptsetup: add RequiresMountsFor for keyfile
This ensures that the keyfile is available during the opening of the encrypted
device.

Also dropped the explicit ordering Before=local-fs.target, as the containers
are ordered implicitly by their content.
2013-04-01 00:37:48 -04:00
Thomas Weißschuh
9ece938a67 cryptsetup: RequiresMountsFor if source is a file
Fixes: https://bugzilla.novell.com/show_bug.cgi?id=730496
       https://bugs.freedesktop.org/show_bug.cgi?id=60821
2013-04-01 00:37:48 -04:00
Zbigniew Jędrzejewski-Szmek
d7607eac63 core/socket: log errors when starting socket for this socket
When showing an error like 'Socket service not loaded', the
error won't show up in the status for the socket, unless it is
marked as SYSTEMD_UNIT=*.socket. Marking it as SYSTEMD_UNIT=*.service,
when the service is non-existent, is not useful.
2013-04-01 00:37:48 -04:00
Oleksii Shevchuk
aa7c3195f2 Add AllowIsolate=yes to snapshots 2013-04-01 00:37:48 -04:00
Lennart Poettering
d51539b182 stdio-bridge: rework stdio bridge to use libsystemd-bus 2013-04-01 03:29:30 +02:00
Lennart Poettering
adee69fa7a bus: always return something in sd_bus_get_timeout() 2013-04-01 03:29:30 +02:00
Lennart Poettering
ea8f194f4b bus: be more careful when determining credential data
As it turns out SCM_CREDENTIALS is not always supported on socketpair(),
so let's also try SO_PEERCRED then.
2013-04-01 03:29:30 +02:00
Lennart Poettering
2b4ac8896b bus: when the first char a server receives isn't the NUL byte immediately fail 2013-04-01 03:29:29 +02:00
Lennart Poettering
8411d2a2b1 bus: ignore the passed UID on EXTERNAL auth if ANONYMOUS is allowed 2013-04-01 03:29:29 +02:00
Lennart Poettering
638866cbea bus: when reading a message from the socket, make sure to note down the size 2013-04-01 03:29:29 +02:00
Lennart Poettering
9ab32f9daa bus: reuse sd_is_socket() call 2013-04-01 03:29:29 +02:00
Lennart Poettering
15d5af8145 bus: fall back to readv/writev if recvmsg/sendmsg don't work 2013-04-01 03:29:29 +02:00
Lennart Poettering
e82c950997 bus: allow two different fds for input/output in sd_bus_set_fd()
This is useful so that we can speak D-Bus over a FIFO pair such as
stdin+stdout.
2013-04-01 03:29:29 +02:00
Zbigniew Jędrzejewski-Szmek
7989e1f2d7 Partially revert e62d8c3944
The ~80 chars per line part wasn't well received.
2013-03-31 19:50:30 -04:00
Zbigniew Jędrzejewski-Szmek
cc1f918dda units/user: default.target must be isolatable
...
Activating default unit: default.target
Default target could not be isolated, starting instead: Operation refused, unit may not be isolated.
2013-03-31 19:43:14 -04:00
Zbigniew Jędrzejewski-Szmek
fff40a51cc activate: do not leak envp on error 2013-03-31 19:01:57 -04:00
Zbigniew Jędrzejewski-Szmek
fb93cf7375 journalctl: reword error message
Sentence seemed to suggest that all three conditions must be true.
2013-03-31 19:01:57 -04:00
Zbigniew Jędrzejewski-Szmek
7f2c1f4dbf tmpfiles: fix obscure leak in error path
The leak was because of the single return in midst of all
'goto finish'es. Using automatic cleanup simplifies things.
2013-03-31 19:01:57 -04:00
Zbigniew Jędrzejewski-Szmek
e62d8c3944 Modernization
Use _cleanup_ and wrap lines to ~80 chars and such.
2013-03-31 14:36:12 -04:00
Zbigniew Jędrzejewski-Szmek
3c8bed4ee0 strbuf: replace quick sort with bubble sort
No need to call the heavy artillery, when the original array
is sorted. Reduces complexity from n² log n to n log n, where
n is the number of items in the array, not very large, but
still.
2013-03-31 14:35:17 -04:00
Zbigniew Jędrzejewski-Szmek
a9c307e5d2 strbuf: fix leak on memory error
Not very likely, but let's fix it for the matter of
principle.
2013-03-31 14:34:24 -04:00
Zbigniew Jędrzejewski-Szmek
522cd7f18b bootchart: fix a potential buffer overrun
If the configured number of samples was close to MAXSAMPLES,
the samples buffer could be overrun:

- by 1, because of off-by-one in the condition (samples > arg_samples_len),
and
- by many in case of an overrun, because the number of samples to
  capture was increased, instead of being decreased.

Simplify things by converting to a normal for-loop.

In store.c: change buffer size from 4095 to 4096. 4095 is a strange
number.
2013-03-31 14:34:08 -04:00
Zbigniew Jędrzejewski-Szmek
4cd5f79d0b bootchart: split out option parsing from main() 2013-03-31 14:33:52 -04:00
Zbigniew Jędrzejewski-Szmek
4b94f3b8f7 journald: check return value of strappend 2013-03-31 14:33:30 -04:00