Commit graph

106 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 670b110c3b journald: fix space limits reporting
Reporting of the free space was bogus, since the remaining space
was compared with the maximum allowed, instead of the current
use being compared with the maximum allowed. Simplify and fix
by reporting limits directly at the point where they are calculated.

Also, assign a UUID to the message.
2013-06-24 21:06:06 -04:00
Lennart Poettering 1021b21bc6 login: add an api to determine the slice a PID is located in to libsystemd-login 2013-06-21 01:46:27 +02:00
Lennart Poettering 9444b1f20e logind: add infrastructure to keep track of machines, and move to slices
- This changes all logind cgroup objects to use slice objects rather
  than fixed croup locations.

- logind can now collect minimal information about running
  VMs/containers. As fixed cgroup locations can no longer be used we
  need an entity that keeps track of machine cgroups in whatever slice
  they might be located. Since logind already keeps track of users,
  sessions and seats this is a trivial addition.

- nspawn will now register with logind and pass various bits of metadata
  along. A new option "--slice=" has been added to place the container
  in a specific slice.

- loginctl gained commands to list, introspect and terminate machines.

- user.slice and machine.slice will now be pulled in by logind.service,
  since only logind.service requires this slice.
2013-06-20 03:49:59 +02:00
Zbigniew Jędrzejewski-Szmek 5302ebe15f journal: add sd_journal_open_files
This allows the caller to explicitly specify which journal files
should be opened. The same functionality could be achieved before
by creating a directory and playing around with symlinks. It
is useful to debug stuff and explore the journal, and has been
requested before.

Waiting is supported, the journal will notice modifications on
the files supplied when opening the journal, but will not add
any new files.
2013-06-10 10:10:07 -04:00
Zbigniew Jędrzejewski-Szmek a688baa8b7 journal: add ability to filter by current user
This is the just the library part.

SD_JOURNAL_CURRENT_USER flags is added to sd_j_open(), to open
files from current user.

SD_JOURNAL_SYSTEM_ONLY is renamed to SD_JOURNAL_SYSTEM,
and changed to mean to (also) open system files. This way various
flags can be combined, which gives them nicer semantics, especially
if other ones are added later.

Backwards compatibility is kept, because SD_JOURNAL_SYSTEM_ONLY
is equivalent to SD_JOURNAL_SYSTEM if used alone, and before there
we no other flags.
2013-06-10 10:10:06 -04:00
Lennart Poettering 264ad849a4 bus: add APIs for negotiating what is attached to messages 2013-05-17 04:26:27 +02:00
Lennart Poettering eb01ba5de1 bus: synthesize timeout message errors instead of returning error codes 2013-05-16 21:14:56 +02:00
Lennart Poettering 453a0c2946 bus: add support for adding memfds into message payload 2013-05-15 19:45:45 +02:00
Lennart Poettering ddeb424198 bus: add new API for kdbus memfd functionality 2013-05-10 14:37:05 +02:00
Lennart Poettering f8e013f8bf bus: add sd_bus_message_append_string_space() for zero-copy string appending 2013-05-10 03:38:11 +02:00
Lennart Poettering b3af9646f8 bus: add API for appending/reading fixed arrays 2013-05-09 20:01:21 +02:00
Lennart Poettering 8973790ee6 cryptsetup: warn if /etc/crypttab is world-readable 2013-04-30 08:36:01 -03:00
Lennart Poettering aa96c6cb44 id128: when taking user input for a 128bit ID, validate syntax
Also, always accept both our simple hexdump syntax and UUID syntax.
2013-04-30 08:36:01 -03:00
Zbigniew Jędrzejewski-Szmek e4d2bfdd73 Add printf attributes in exported headers
gcc (and other compilers) sometimes generate spurious warnings, and
thus users of public headers must be able to disable warnings.

Printf format attributes can be disabled by setting
    #define _sd_printf_attr_
before including the header file.

Also, add similar logic for sentinel attribute:
    #define _sd_sentinel_attr_
before including the header file disables the attribute.
2013-04-25 21:50:48 -04:00
Lennart Poettering e10375f2c0 login: allow watching virtual machines with sd_get_machine_names() 2013-04-24 19:02:13 -03:00
Lennart Poettering a20affe2f0 login: add new call sd_get_machine_names() to get a list of current virtual machines and containers 2013-04-24 19:02:13 -03:00
Lennart Poettering 7066618570 bus: add cal to determine machine id of an owner of a service 2013-04-23 16:00:32 -03:00
Lennart Poettering 102ea8e4f2 bus: parse capability kdbus meta data of messages 2013-04-23 00:14:30 -03:00
Lennart Poettering 120f919e70 bus: parse audit metadata from kdbus messages 2013-04-22 23:38:38 -03:00
Lennart Poettering bc7f3beb30 bus: parse owner uid from cgroup path, too 2013-04-22 23:27:38 -03:00
Harald Hoyer cd34b3c667 journal: add one more level on top with AND
When using "-p" and "-b" in combination with "-u", the output is not
what you would expect. The reason is the sd_journal_add_disjunction()
call in add_matches_for_unit() and add_matches_for_user_unit(), which
adds two ORs without taking the other conditions to every OR.

Adding another level on top with AND and sd_journal_add_conjunction()
solves the problem.

Output before:

$ journalctl -o short-monotonic -ab -p 0 -u sshd.service

-- Reboot --
[    3.216305] lenovo systemd[1]: Starting OpenSSH server daemon...
-- Reboot --
[    3.168666] lenovo systemd[1]: Starting OpenSSH server daemon...
[    3.169639] lenovo systemd[1]: Started OpenSSH server daemon.
[36285.635389] lenovo systemd[1]: Stopped OpenSSH server daemon.
-- Reboot --
[   10.838657] lenovo systemd[1]: Starting OpenSSH server daemon...
[   10.913698] lenovo systemd[1]: Started OpenSSH server daemon.
[ 6881.035183] lenovo systemd[1]: Stopped OpenSSH server daemon.
-- Reboot --
[    6.636228] lenovo systemd[1]: Starting OpenSSH server daemon...
[    6.662573] lenovo systemd[1]: Started OpenSSH server daemon.
[    6.681148] lenovo sshd[397]: Server listening on 0.0.0.0 port 22.
[    6.681379] lenovo sshd[397]: Server listening on :: port 22.

As we see, the output is from _every_ boot and priority 0 is not taken
into account.

Output after patch:

$ journalctl -o short-monotonic -ab -p 0 -u sshd.service
-- Logs begin at Sun 2013-02-24 20:54:44 CET, end at Tue 2013-03-19 14:58:21 CET. --

Increasing the priority:

$ journalctl -o short-monotonic -ab -p 6 -u sshd.service
-- Logs begin at Sun 2013-02-24 20:54:44 CET, end at Tue 2013-03-19 14:59:12 CET. --
[    6.636228] lenovo systemd[1]: Starting OpenSSH server daemon...
[    6.662573] lenovo systemd[1]: Started OpenSSH server daemon.
[    6.681148] lenovo sshd[397]: Server listening on 0.0.0.0 port 22.
[    6.681379] lenovo sshd[397]: Server listening on :: port 22.
2013-04-17 09:15:23 +02:00
Zbigniew Jędrzejewski-Szmek e7ecdfc15c sd-messages.h: add new bootchart message id 2013-04-17 00:09:16 -04:00
Zbigniew Jędrzejewski-Szmek e8e581bf25 Report about syntax errors with metadata
The information about the unit for which files are being parsed
is passed all the way down. This way messages land in the journal
with proper UNIT=... or USER_UNIT=... attribution.

'systemctl status' and 'journalctl -u' not displaying those messages
has been a source of confusion for users, since the journal entry for
a misspelt setting was often logged quite a bit earlier than the
failure to start a unit.

Based-on-a-patch-by: Oleksii Shevchuk <alxchk@gmail.com>
2013-04-17 00:09:16 -04:00
Lennart Poettering d8d3d8a781 bus: parse unit/user unit/session from cgroup path 2013-04-16 04:54:46 +02:00
Lennart Poettering 7027ff61a3 nspawn: introduce the new /machine/ tree in the cgroup tree and move containers there
Containers will now carry a label (normally derived from the root
directory name, but configurable by the user), and the container's root
cgroup is /machine/<label>. This label is called "machine name", and can
cover both containers and VMs (as soon as libvirt also makes use of
/machine/).

libsystemd-login can be used to query the machine name from a process.

This patch also includes numerous clean-ups for the cgroup code.
2013-04-16 04:41:21 +02:00
Anatol Pomozov ab06eef810 Fix spelling errors using 'codespell' tool 2013-04-15 08:40:05 -04:00
Lennart Poettering 97e1305817 sd-login: add a sd_pid_get_user_unit() call 2013-04-15 14:16:45 +02:00
Lennart Poettering 4a875b6133 kdbus: parse cgroup meta data, too 2013-04-15 01:51:37 +02:00
Lennart Poettering 77930f1120 kdbus: also parse cmdline message attribute 2013-04-14 03:20:23 +02:00
Lennart Poettering 69aec65cf8 kdbus: parse even more kernel meta data fields 2013-04-13 21:53:11 +02:00
Lennart Poettering acb5a3cb20 bus: parse and expose kdbus message timestamps 2013-04-12 01:57:53 +02:00
Lennart Poettering 8323bc1f90 bus: also parse PID starttime out of kdbus message 2013-04-12 01:49:52 +02:00
Lennart Poettering e9a967f9a0 bus: make kdbus work so that we can exchange real messages
We have ignition, we have tremendous fire!
2013-04-12 01:19:32 +02:00
Lennart Poettering 05d0c3e1fd update TODO 2013-04-09 21:31:16 +02:00
Lennart Poettering b6b7d43379 update TODO 2013-04-08 15:23:52 +02:00
Lennart Poettering f10dda3b82 bus: add convenience calls for method replies, too 2013-04-05 14:56:48 +02:00
Lennart Poettering c784c5ce77 bus: use C99 struct construction for error initializers
That way we can allocate an error struct on-the-fly while calling a
function. Nice!
2013-04-05 13:12:11 +02:00
Lennart Poettering 917b5dc707 bus: add convenience functions for constructing and sending method calls/signals in one call 2013-04-05 04:15:39 +02:00
Lennart Poettering 7286037fd4 bus: properly detect and handle if a callback is installed/removed from within a callback 2013-04-05 03:55:58 +02:00
Lennart Poettering 6807947e56 bus: don't allow recursive invocation of sd_bus_process() 2013-04-05 03:15:10 +02:00
Lennart Poettering 39c155ea0d journal: add sd_journal_get_timeout() call to public API
Let's do the wake-up logic on NFS internally, making things simpler for
users.
2013-04-04 20:07:48 +02:00
Lennart Poettering 667c24a6a8 login: add sd_login_monitor_get_timeout() public api call
We don't need this right now, but we should keep our options open, in
case we need more than just an fd for waking up.
2013-04-04 18:31:22 +02:00
Lennart Poettering dace83cbd0 login: add new public API call sd_login_monitor_get_events() to get poll() flags to wait for
We should keep our options open, so that we can watch for POLLOUT later
on if we wish to. CUrrently this call will always return POLLIN however.
2013-04-04 17:38:08 +02:00
Lennart Poettering ee531d949c journal: add public API call sd_journal_get_events()
This function should be used when filling in "struct pollfd"'s .events
field for watching the journal. It will always return POLLIN for now,
but we should keep our options open to change this later on.

This mimics libsystemd-bus' sd_bus_get_events() call with the same
purpose.
2013-04-04 17:22:28 +02:00
Lennart Poettering d1148ed10a update TODO 2013-04-02 17:47:59 +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 a7edaadd78 journal-gatewayd: query PID 1 for virtalization
Since journal-gatewayd is now running unprivileged, and detecting
virtalization requires privileges, query PID1 via D-Bus for the used
virtualization.

This is also the first time we use libsystemd-bus for more than just
testing.

https://bugs.freedesktop.org/show_bug.cgi?id=62173
2013-03-31 18:16:02 +02:00
Michal Sekletar a63c198cc0 shutdown: move attribute packed to the end of the declaration, so it is not ignored 2013-03-13 01:39:11 +01:00
Zbigniew Jędrzejewski-Szmek c485437f50 logind: add MESSAGE_IDs to interesting events 2013-01-27 23:47:18 -05:00
Lennart Poettering c84f5e4a82 login: introduce sd_session_get_tty() 2013-01-15 03:01:35 +01:00