platform/upstream/systemd.git
10 years agobus: rework how we attach fds to event loops
Lennart Poettering [Fri, 13 Dec 2013 04:12:46 +0000 (05:12 +0100)]
bus: rework how we attach fds to event loops

When trying a couple of addresses one after the other, make sure to
reattach the fds to the event loop.

10 years agoevent: add ability to change fd of an active event source
Lennart Poettering [Fri, 13 Dec 2013 04:13:59 +0000 (05:13 +0100)]
event: add ability to change fd of an active event source

10 years agoevent: allow to query userdata and watchdog state
Lennart Poettering [Fri, 13 Dec 2013 03:14:25 +0000 (04:14 +0100)]
event: allow to query userdata and watchdog state

10 years agoman: add another nspawn example
Zbigniew Jędrzejewski-Szmek [Fri, 13 Dec 2013 04:14:48 +0000 (23:14 -0500)]
man: add another nspawn example

Taken from https://bugs.freedesktop.org/show_bug.cgi?id=68369.

10 years agoevent: when unreffing an event source from its own handler, detach fd from epoll
Lennart Poettering [Fri, 13 Dec 2013 03:03:30 +0000 (04:03 +0100)]
event: when unreffing an event source from its own handler, detach fd from epoll

The pattern of unreffing an IO event source and then closing its fd is
frequently seen in even source callbacks. Previously this likely
resultet in us removing the fd from the epoll after it was closed which
is problematic, since while we were dispatching we always kept an extra
reference to event source objects because we might still need it later.

10 years agoevent: be more conservative when returning errors from event handler callbacks
Lennart Poettering [Fri, 13 Dec 2013 02:30:42 +0000 (03:30 +0100)]
event: be more conservative when returning errors from event handler callbacks

We really should return errors from event handlers if we have a
continous problem and don't know any other solution.

10 years agogit: update .gitignore
Lennart Poettering [Fri, 13 Dec 2013 01:43:35 +0000 (02:43 +0100)]
git: update .gitignore

10 years agonamespace: include boot id in private tmp directories
Lennart Poettering [Fri, 13 Dec 2013 01:05:04 +0000 (02:05 +0100)]
namespace: include boot id in private tmp directories

This way it is easy to only exclude directories from the current boot
from automatic clean up in /var/tmp.

Also, pick a longer name for the directories so that are globs in
tmp.conf can be simpler yet equally accurate.

10 years agoevent: rework sd-event exit logic
Lennart Poettering [Thu, 12 Dec 2013 21:21:25 +0000 (22:21 +0100)]
event: rework sd-event exit logic

With this change a failing event source handler will not cause the
entire event loop to fail. Instead, we just disable the specific event
source, log a message at debug level and go on.

This also introduces a new concept of "exit code" which can be stored in
the event loop and is returned by sd_event_loop(). We also rename "quit"
to "exit" everywhere else.

Altogether this should make things more robus and keep errors local
while still providing a way to return event loop errors in a clear way.

10 years agobus: fix make check
Lennart Poettering [Thu, 12 Dec 2013 21:18:09 +0000 (22:18 +0100)]
bus: fix make check

10 years agobus: properly parse NameOwnerChanged messages when caller explicitly wants to match...
Lennart Poettering [Thu, 12 Dec 2013 21:17:38 +0000 (22:17 +0100)]
bus: properly parse NameOwnerChanged messages when caller explicitly wants to match against names coming/going

10 years agoman: update sd_bus_request_name() man page
Lennart Poettering [Thu, 12 Dec 2013 21:01:40 +0000 (22:01 +0100)]
man: update sd_bus_request_name() man page

10 years agobus: make sure exit-on-idle logic works on kdbus systems that do not generate NameLost
Lennart Poettering [Thu, 12 Dec 2013 20:25:47 +0000 (21:25 +0100)]
bus: make sure exit-on-idle logic works on kdbus systems that do not generate NameLost

10 years agobus: fix parsing of matches against empty strings
Lennart Poettering [Thu, 12 Dec 2013 20:25:31 +0000 (21:25 +0100)]
bus: fix parsing of matches against empty strings

10 years agoscan-build: silence some warnings
Thomas Hindoe Paaboel Andersen [Thu, 12 Dec 2013 22:08:47 +0000 (23:08 +0100)]
scan-build: silence some warnings

test-fileio/test-strv:
Use the streq_ptr to make build-scan not worry about passing in a null
to a nonnull function.

test-dhcp-option:
Prevent a theoretical null pointer dereference

10 years agobus: fix rewind logic
Lennart Poettering [Thu, 12 Dec 2013 19:43:37 +0000 (20:43 +0100)]
bus: fix rewind logic

10 years agoservice: process watchdog timeouts with lowest priority
Lennart Poettering [Thu, 12 Dec 2013 19:16:06 +0000 (20:16 +0100)]
service: process watchdog timeouts with lowest priority

10 years agobus: remove explicit activator-specific flags, the kdbus supports it now
Kay Sievers [Thu, 12 Dec 2013 19:26:48 +0000 (20:26 +0100)]
bus: remove explicit activator-specific flags, the kdbus supports it now

10 years agobus: update kdbus.h
Kay Sievers [Thu, 12 Dec 2013 19:19:12 +0000 (20:19 +0100)]
bus: update kdbus.h

10 years agobus: always pass valid timeout to kdbus
Lennart Poettering [Thu, 12 Dec 2013 19:00:19 +0000 (20:00 +0100)]
bus: always pass valid timeout to kdbus

10 years agobus: enforce endianess and marshalling for messages we send
Lennart Poettering [Thu, 12 Dec 2013 18:58:46 +0000 (19:58 +0100)]
bus: enforce endianess and marshalling for messages we send

10 years agotimedatectl: work with old timedated
Shawn Landden [Thu, 12 Dec 2013 18:00:03 +0000 (10:00 -0800)]
timedatectl: work with old timedated

Which does have TimeUSec. Should we specifically check for this method
instead of assuming time=0 means it doesn't exist?

Before:
shawn@debian-T61:~/git/systemd$ ./timedatectl
      Local time: Wed 1969-12-31 16:00:00 PST
  Universal time: Thu 1970-01-01 00:00:00 UTC
        RTC time: n/a
        Timezone: America/Los_Angeles (PST, -0800)
     NTP enabled: n/a
NTP synchronized: no
 RTC in local TZ: no
      DST active: no
 Last DST change: DST ended at
                  Sun 1969-10-26 01:59:59 PDT
                  Sun 1969-10-26 01:00:00 PST
 Next DST change: DST begins (the clock jumps one hour forward) at
                  Sun 1970-04-26 01:59:59 PST
                  Sun 1970-04-26 03:00:00 PDT

After:
shawn@debian-T61:~/git/systemd$ ./timedatectl
      Local time: Wed 2013-12-11 14:03:21 PST
  Universal time: Wed 2013-12-11 22:03:21 UTC
        RTC time: n/a
        Timezone: America/Los_Angeles (PST, -0800)
     NTP enabled: n/a
NTP synchronized: no
 RTC in local TZ: no
      DST active: no
 Last DST change: DST ended at
                  Sun 2013-11-03 01:59:59 PDT
                  Sun 2013-11-03 01:00:00 PST
 Next DST change: DST begins (the clock jumps one hour forward) at
                  Sun 2014-03-09 01:59:59 PST
                  Sun 2014-03-09 03:00:00 PDT

10 years agobuild-sys: use internal library for dhcp client tests
Zbigniew Jędrzejewski-Szmek [Thu, 12 Dec 2013 16:42:45 +0000 (11:42 -0500)]
build-sys: use internal library for dhcp client tests

Also clean up AM_CFLAGS in a few places.

10 years agodhcp: Add function to free DHCP client data
Patrik Flykt [Mon, 9 Dec 2013 21:43:32 +0000 (23:43 +0200)]
dhcp: Add function to free DHCP client data

10 years agodhcp: Add notification callback
Patrik Flykt [Mon, 9 Dec 2013 21:43:31 +0000 (23:43 +0200)]
dhcp: Add notification callback

Define a notification callback and events for stopping and client
lease expiry. Add functions to fetch IP parameters from a lease.

10 years agodhcp: Compute expire, T1 and T2 timers
Patrik Flykt [Mon, 9 Dec 2013 21:43:30 +0000 (23:43 +0200)]
dhcp: Compute expire, T1 and T2 timers

Compute the default T1 and T2 timer values if they were not set by
the DHCP server. Verify that the values are reasonable.

10 years agodhcp: Process DHCP Ack/Nak message
Patrik Flykt [Mon, 9 Dec 2013 21:43:29 +0000 (23:43 +0200)]
dhcp: Process DHCP Ack/Nak message

Process a DHCP Ack/Nak in much the same way as an DHCP Offer. Factor
out header verification and process options sent. Add notification
functionality with discrete values for the outcome of the DHCP Ack/
Nak processing.

10 years agodhcp: Add maximum message size option
Patrik Flykt [Mon, 9 Dec 2013 21:43:28 +0000 (23:43 +0200)]
dhcp: Add maximum message size option

Add maximum message size option to keep some DHCP server implementations
from sending too big messages. See ConnMan commit
0c5c862749c05193cf4c513628328c6db02b5222.

10 years agodhcp: Send DHCP Request to acquire an IP address
Patrik Flykt [Mon, 9 Dec 2013 21:43:27 +0000 (23:43 +0200)]
dhcp: Send DHCP Request to acquire an IP address

Create and send a DHCP Request message reusing already existing parts
of the code. This causes factoring out IP and UDP header creation and
moving next timeout calculation to be done every time in the timer
callback function independent of DHCP state. Also add an exponential
part to the timer calculation, bail out if there are errors while
resending the DHCP message for the sixth or more times.

10 years agodhcp: Handle received DHCP Offer message
Patrik Flykt [Mon, 9 Dec 2013 21:43:26 +0000 (23:43 +0200)]
dhcp: Handle received DHCP Offer message

Create a function for handling the full IP, UDP and DHCP packet
and tie it to the main loop. Verify IP and UDP headers and checksum.
Creat a new lease structure with using the values supplied in the
DHCP message. Free the lease structure when client is stopped.

Split out socket handling into a creation and a sending part. As a
result modify the test code.

10 years agodhcp: Add timeout and main loop support
Patrik Flykt [Mon, 9 Dec 2013 21:43:25 +0000 (23:43 +0200)]
dhcp: Add timeout and main loop support

Require a main loop to be set when creating a DHCP client. Set up
a timer to resend DHCP Discover messages and add a 0-2 second
delay to the timeout value. Move to state Selecting after successful
sending of a Discover message.

10 years agobuild: Add dependency on libsystemd-bus needed for main loop
Patrik Flykt [Mon, 9 Dec 2013 21:43:24 +0000 (23:43 +0200)]
build: Add dependency on libsystemd-bus needed for main loop

10 years agodhcp: Add function to stop the DHCP client
Patrik Flykt [Mon, 9 Dec 2013 21:43:23 +0000 (23:43 +0200)]
dhcp: Add function to stop the DHCP client

The client is stopped and brought back to its initial state.

10 years agodhcp: Support seconds elapsed since start of DHCP negotiation
Patrik Flykt [Mon, 9 Dec 2013 21:43:22 +0000 (23:43 +0200)]
dhcp: Support seconds elapsed since start of DHCP negotiation

It was noticed by Grant Erickson in ConnMan commit
95e15c09350acf58d4707056ae2614570883ef66 that:

   "Certain DHCP servers, such as that implemented in Mac OS X
    (< 10.7) for its "Internet Sharing" feature, refuse to issue
    a DHCP lease to clients that have not set a non-zero value
    in their DISCOVER or REQUEST packets."

10 years agodhcp: Add test for discover DHCP packet creation
Patrik Flykt [Mon, 9 Dec 2013 21:43:21 +0000 (23:43 +0200)]
dhcp: Add test for discover DHCP packet creation

Set a fake MAC address and emulate raw packet sending. When the buffer
containing the Discover message is received, check selected IP and
UDP headers and compute IP header and UDP message checksums. Also
send the DHCP message for option parsing and expect a successful
outcome.

10 years agobuild: Add libsystemd-dhcp
Patrik Flykt [Mon, 9 Dec 2013 21:43:20 +0000 (23:43 +0200)]
build: Add libsystemd-dhcp

10 years agodhcp: Add DHCP discover sending
Patrik Flykt [Mon, 9 Dec 2013 21:43:19 +0000 (23:43 +0200)]
dhcp: Add DHCP discover sending

On starting the client, use the supplied interface mac address and create
a transaction id. Puzzle together an IP/UDP/DHCP Discover message, compute
checksums and send it out as a raw packet.

Create an additional function that constructs default options common to
all DHCP messages.

Set the DHCP Client ID option as noticed by Grant Erickson in ConnMan
commit b18d9798b3a0ae46ed87d6d2be8d5a474bf3ab1e:

   "Some Internet gateways and Wi-Fi access points are unhappy when the
    DHCPv4 client-id option (61) is missing and will refuse to issue a
    DHCP lease."

10 years agodhcp: Add function for sending a raw packet
Patrik Flykt [Mon, 9 Dec 2013 21:43:18 +0000 (23:43 +0200)]
dhcp: Add function for sending a raw packet

Open a packet socket, create a link level header, send packet and
close socket. Adding it to a separate file makes testing of the
DHCP sending much easier, as the test program can supply any socket
to the DHCP client code.

10 years agoshared: Add struct sockaddr_ll to sockaddr_union
Patrik Flykt [Mon, 9 Dec 2013 21:43:17 +0000 (23:43 +0200)]
shared: Add struct sockaddr_ll to sockaddr_union

10 years agodhcp: Add test function for computing checksum
Patrik Flykt [Mon, 9 Dec 2013 21:43:16 +0000 (23:43 +0200)]
dhcp: Add test function for computing checksum

10 years agodhcp: Add option append tests
Patrik Flykt [Mon, 9 Dec 2013 21:43:15 +0000 (23:43 +0200)]
dhcp: Add option append tests

Add checks for invalid lengths and parameters when using the option
appending function. Add also checks for adding options, see to it
that the resulting array is identical to the array of options added.

10 years agodhcp: Add tests for DHCP options, file and sname fields
Patrik Flykt [Mon, 9 Dec 2013 21:43:14 +0000 (23:43 +0200)]
dhcp: Add tests for DHCP options, file and sname fields

Add a structure describing the DHCP file, sname and trailing options
fields. Create a messge holding these fields and call the internal
option parsing function.

In the test callback function verify that only regular options are
passed and figure out which part of the DHCP message is the one that
is being processed. As the test program knows the full contents of
the test options in the test structure, skip all non-regular fields
and verify that the option provided to the callback indeed is the
one expected. Check also if non-regular option fields are to be
ignored in the end of the option field as the callback is not called
again and the final check when the whole message has been processed
needs to be successful.

Add a boolean flag for pretty-printing, anticipate there will be a
nice option to toggle it in the future.

10 years agobuild: Add DHCP option test
Patrik Flykt [Mon, 9 Dec 2013 21:43:13 +0000 (23:43 +0200)]
build: Add DHCP option test

10 years agodhcp: Add buffer length and invalid cookie tests for DHCP options
Patrik Flykt [Mon, 9 Dec 2013 21:43:12 +0000 (23:43 +0200)]
dhcp: Add buffer length and invalid cookie tests for DHCP options

Create an initial simple test program for these two cases.

10 years agodhcp: Add option appending and parsing
Patrik Flykt [Mon, 9 Dec 2013 21:43:11 +0000 (23:43 +0200)]
dhcp: Add option appending and parsing

Add functions to append and parse DHCP options. Not all options
are passed to the callback function, the ones not exposed are
pad, end, message type and overload. If indicated by the overload
option, file and sname fields will be examined for more options.

The option functions are internal to DHCP, add a new header files
for interal function prototypes.

10 years agobuild: Add initial build support
Patrik Flykt [Mon, 9 Dec 2013 21:43:10 +0000 (23:43 +0200)]
build: Add initial build support

The client test program is the only one to be built so far.

10 years agodhcp: Add test for DHCP client initialization and parameter setting
Patrik Flykt [Mon, 9 Dec 2013 21:43:09 +0000 (23:43 +0200)]
dhcp: Add test for DHCP client initialization and parameter setting

10 years agodhcp: Add DHCP client initialization
Patrik Flykt [Mon, 9 Dec 2013 21:43:08 +0000 (23:43 +0200)]
dhcp: Add DHCP client initialization

Provide functionality for initializing a DHCP client struct, setting
interface index, last used address and additional options to request.
On initialization the most useful options are added by default.

10 years agodhcp: Add DHCP protocol structures and initial defines
Patrik Flykt [Mon, 9 Dec 2013 21:43:07 +0000 (23:43 +0200)]
dhcp: Add DHCP protocol structures and initial defines

Create a new directory to host DHCP components.

10 years agolog: protect errno when we use assert_return()
Lennart Poettering [Thu, 12 Dec 2013 14:58:49 +0000 (15:58 +0100)]
log: protect errno when we use assert_return()

10 years agocore: suppress gcc warnings on selinux-less systems
Lennart Poettering [Thu, 12 Dec 2013 14:58:31 +0000 (15:58 +0100)]
core: suppress gcc warnings on selinux-less systems

10 years agoupdate TODO
Lennart Poettering [Thu, 12 Dec 2013 14:58:13 +0000 (15:58 +0100)]
update TODO

10 years agoshared: add missing include
Marc-Antoine Perennou [Thu, 12 Dec 2013 04:56:13 +0000 (13:56 +0900)]
shared: add missing include

Needed for socketpair, recv

10 years agobus: add SD_BUS_NAME_REPLACE_EXISTING to all activatable services, fix one flags...
Kay Sievers [Thu, 12 Dec 2013 05:23:38 +0000 (06:23 +0100)]
bus: add SD_BUS_NAME_REPLACE_EXISTING to all activatable services, fix one flags conversion

10 years agobus: instead of exposing the dbus1 flags when acquiring a name use our own that are...
Lennart Poettering [Thu, 12 Dec 2013 04:55:58 +0000 (05:55 +0100)]
bus: instead of exposing the dbus1 flags when acquiring a name use our own that are closer to kdbus

This turns around DO_NOT_QUEUE into QUEUE which implies a more useful
default. (And negative options are awful anyway.)

10 years agobus: properly return an error when we detect a method call timeout
Lennart Poettering [Thu, 12 Dec 2013 04:29:56 +0000 (05:29 +0100)]
bus: properly return an error when we detect a method call timeout

10 years agocore: fix bus registration on daemon reexec
Lennart Poettering [Thu, 12 Dec 2013 04:23:22 +0000 (05:23 +0100)]
core: fix bus registration on daemon reexec

10 years agonspawn: complain and continue if machine has same id
Zbigniew Jędrzejewski-Szmek [Thu, 12 Dec 2013 03:00:33 +0000 (22:00 -0500)]
nspawn: complain and continue if machine has same id

If --link-journal=host or --link-journal=guest is used, this totally
cannot work and we exit with an error. If however --link-journal=auto
or --link-journal=no is used, just display a warning.

Having the same machine id can happen if booting from the same
filesystem as the host. Since other things mostly function correctly,
let's allow that.

https://bugs.freedesktop.org/show_bug.cgi?id=68369

10 years agoDo not log all assert_return failures
Zbigniew Jędrzejewski-Szmek [Thu, 12 Dec 2013 01:34:19 +0000 (20:34 -0500)]
Do not log all assert_return failures

% build/journalctl help
Assertion 'match_is_valid(data, size)' failed at ../src/journal/sd-journal.c:227, function sd_journal_add_match(). Ignoring.

Callers cannot be expect to check all arguments always.

10 years agojournal: pipe journalctl help output into a pager
Djalal Harouni [Wed, 11 Dec 2013 23:22:48 +0000 (00:22 +0100)]
journal: pipe journalctl help output into a pager

journalctl help output might run off the screen, so be consistent
as other systemd tools do and pipe it into a pager.

10 years agoman: mention SYSTEMD_USER_WANTS
Zbigniew Jędrzejewski-Szmek [Sun, 8 Dec 2013 15:38:33 +0000 (10:38 -0500)]
man: mention SYSTEMD_USER_WANTS

Also split into paragraphs for easier reading and make a few minor
corrections.

10 years agoservice: actually leave watchdog enabled in the states where it matters
Lennart Poettering [Thu, 12 Dec 2013 02:03:03 +0000 (03:03 +0100)]
service: actually leave watchdog enabled in the states where it matters

10 years agotimedated: make sure GetAll() succeeds in systems lacking /dev/rtc (such as containers)
Lennart Poettering [Thu, 12 Dec 2013 02:00:57 +0000 (03:00 +0100)]
timedated: make sure GetAll() succeeds in systems lacking /dev/rtc (such as containers)

10 years agotest-fileio: replace mktemp with mkstemp to avoid warnings
Thomas Hindoe Paaboel Andersen [Wed, 11 Dec 2013 23:06:30 +0000 (00:06 +0100)]
test-fileio: replace mktemp with mkstemp to avoid warnings

This is a fairly useless thing to do but it makes the compilers
and analyzers shut up about the use of mktemp.

10 years agobus: properly generate NameOwnerChanged messages when we take from/give back to queue...
Lennart Poettering [Thu, 12 Dec 2013 00:42:41 +0000 (01:42 +0100)]
bus: properly generate NameOwnerChanged messages when we take from/give back to queue/starter

10 years agobus: fix order in which we check creds
Lennart Poettering [Thu, 12 Dec 2013 00:39:32 +0000 (01:39 +0100)]
bus: fix order in which we check creds

10 years agoupdate TODO
Lennart Poettering [Thu, 12 Dec 2013 00:39:21 +0000 (01:39 +0100)]
update TODO

10 years agobus: update name listing logic to current kernel interface
Lennart Poettering [Wed, 11 Dec 2013 23:35:23 +0000 (00:35 +0100)]
bus: update name listing logic to current kernel interface

10 years agobus: when checking whether a creds object contains some field, don't use assert_return()
Lennart Poettering [Wed, 11 Dec 2013 23:20:11 +0000 (00:20 +0100)]
bus: when checking whether a creds object contains some field, don't use assert_return()

These are not programming errors, so they shouldn't use assert_return()

10 years agobus: connect directly via kdbus in sd_bus_open_system_container()
Lennart Poettering [Wed, 11 Dec 2013 23:07:49 +0000 (00:07 +0100)]
bus: connect directly via kdbus in sd_bus_open_system_container()

kdbus fortunately exposes the container's busses in the host fs, hence
we can access it directly instead of doing the namespacing dance.

10 years agosd-event: try to move each wakeup to the same spot within every 10s
Lennart Poettering [Wed, 11 Dec 2013 22:41:21 +0000 (23:41 +0100)]
sd-event: try to move each wakeup to the same spot within every 10s

In addition to the same spot within every 1min, every 1s, every 250s

10 years agojournald: make sure the stdout/stderr stream fd is removed from epoll before we close it
Lennart Poettering [Wed, 11 Dec 2013 22:36:59 +0000 (23:36 +0100)]
journald: make sure the stdout/stderr stream fd is removed from epoll before we close it

10 years agounits: don't run readahead done timers in containers
Lennart Poettering [Wed, 11 Dec 2013 22:31:34 +0000 (23:31 +0100)]
units: don't run readahead done timers in containers

We don't run the collector in the container either, hence we don't need
to stop it either.

10 years agojournald: cache cgroup root path, instead of querying it on every incoming log message
Lennart Poettering [Wed, 11 Dec 2013 22:31:07 +0000 (23:31 +0100)]
journald: cache cgroup root path, instead of querying it on every incoming log message

10 years agojournal: when listing logs of a container make sure we don't accidentally show messag...
Lennart Poettering [Wed, 11 Dec 2013 22:10:36 +0000 (23:10 +0100)]
journal: when listing logs of a container make sure we don't accidentally show messages from host too

10 years agojournald: cache hostname, boot_id and machine_id fields instead of generating them...
Lennart Poettering [Wed, 11 Dec 2013 21:55:57 +0000 (22:55 +0100)]
journald: cache hostname, boot_id and machine_id fields instead of generating them fresh for each log entry

10 years agojournal: don't go belly up when an stdout/stderr client terminates the connection
Lennart Poettering [Wed, 11 Dec 2013 21:17:15 +0000 (22:17 +0100)]
journal: don't go belly up when an stdout/stderr client terminates the connection

10 years agojournal: add ability to browse journals of running OS containers
Lennart Poettering [Wed, 11 Dec 2013 21:04:03 +0000 (22:04 +0100)]
journal: add ability to browse journals of running OS containers

This adds the new library call sd_journal_open_container() and a new
"-M" switch to journalctl. Particular care is taken that journalctl's
"-b" switch resolves to the current boot ID of the container, not the
host.

10 years agoservice: clean up watchdog logic a bit
Lennart Poettering [Wed, 11 Dec 2013 19:49:43 +0000 (20:49 +0100)]
service: clean up watchdog logic a bit

10 years agojournald: port to sd-event and enable watchdog support
Lennart Poettering [Wed, 11 Dec 2013 19:13:44 +0000 (20:13 +0100)]
journald: port to sd-event and enable watchdog support

10 years agoman: explain in more detail how SYSTEMD_READY= influences SYSTEMD_WANTS= in udev...
Lennart Poettering [Wed, 11 Dec 2013 17:38:51 +0000 (18:38 +0100)]
man: explain in more detail how SYSTEMD_READY= influences SYSTEMD_WANTS= in udev rules

https://bugzilla.redhat.com/show_bug.cgi?id=1026860

10 years agoevent: hook up sd-event with the service watchdog logic
Lennart Poettering [Wed, 11 Dec 2013 17:14:52 +0000 (18:14 +0100)]
event: hook up sd-event with the service watchdog logic

Adds a new call sd_event_set_watchdog() that can be used to hook up the
event loop with the watchdog supervision logic of systemd. If enabled
and $WATCHDOG_USEC is set the event loop will ping the invoking systemd
daemon right after coming back from epoll_wait() but not more often than
$WATCHDOG_USEC/4. The epoll_wait() will sleep no longer than
$WATCHDOG_USEC/4*3, to make sure the service manager is called in time.

This means that setting WatchdogSec= in a .service file and calling
sd_event_set_watchdog() in your daemon is enough to hook it up with the
watchdog logic.

10 years agoevent: when handling SIGCHLD of a child process only reap after dispatching event...
Lennart Poettering [Wed, 11 Dec 2013 03:50:35 +0000 (03:50 +0000)]
event: when handling SIGCHLD of a child process only reap after dispatching event source

That way the even source callback is run with the zombie process still
around so that it can access /proc/$PID/ and similar, and so that it can
be sure that the PID has not been reused yet.

10 years agobus: kdbus - skip only STARTER and IN_QUEUE names for NameOwnerChanged
Kay Sievers [Wed, 11 Dec 2013 04:30:46 +0000 (05:30 +0100)]
bus: kdbus - skip only STARTER and IN_QUEUE names for NameOwnerChanged

10 years agoactivate: clean up inherited descriptors
Zbigniew Jędrzejewski-Szmek [Wed, 11 Dec 2013 02:52:11 +0000 (21:52 -0500)]
activate: clean up inherited descriptors

> [simon@troela server]$ /usr/lib/systemd/systemd-activate -l 9000 main.js
> Assertion 'fd == 3 + count' failed at src/activate/activate.c:115,
> function open_sockets(). Aborting.
> Aborted (core dumped)

> after a bit debuging i found the problem:
> slim appears to leak an fd into all of its children:
> stat /proc/14004/fd/3  (14004 is the pid a random process in my session)
>  File: '/proc/14004/fd/3' -> '/var/log/slim.log'

systemd-activate should be robust against the shell (or anything else) leaking
descriptors. Now everything except stdin/stdout/stderr and received sockets
will be closed.

10 years agoUpdate README with test/ requirements
Zbigniew Jędrzejewski-Szmek [Wed, 11 Dec 2013 01:27:14 +0000 (20:27 -0500)]
Update README with test/ requirements

10 years agojournald: malloc less when streaming messages
Zbigniew Jędrzejewski-Szmek [Tue, 10 Dec 2013 11:17:01 +0000 (06:17 -0500)]
journald: malloc less when streaming messages

10 years agoptyfwd: Don't set the output prop of stdin, nor the input props of stdout.
Luke Shumaker [Sat, 23 Nov 2013 09:57:43 +0000 (04:57 -0500)]
ptyfwd: Don't set the output prop of stdin, nor the input props of stdout.

It was calling cfmakeraw(3) on the properties for STDIN_FILENO; cfmakeraw
sets both input and output properties.  If (and only if) stdin and stdout
are the same device is this correct.  Otherwise, we must change only the
input properties of stdin, and only the output properties of stdout.

10 years agoptyfwd: Set the size of the PTY base on the size of stdout, not stdin.
Luke Shumaker [Sat, 23 Nov 2013 09:57:42 +0000 (04:57 -0500)]
ptyfwd: Set the size of the PTY base on the size of stdout, not stdin.

10 years agocore: fix Unit.SetProperties argument parsing
David Herrmann [Mon, 2 Dec 2013 22:26:55 +0000 (23:26 +0100)]
core: fix Unit.SetProperties argument parsing

SetProperties has signature "ba(sv)", but the bus_unit_set_properties()
helper already does a enter_container('a', "sv") so we have to skip it in
bus_unit_method_set_properties().

10 years agobus: do not dispatch incoming method calls that are broacasted to vtables
Lennart Poettering [Tue, 10 Dec 2013 23:11:10 +0000 (23:11 +0000)]
bus: do not dispatch incoming method calls that are broacasted to vtables

10 years agobus: don't generate assert warnings when we detach a detached bus from an event
Lennart Poettering [Tue, 10 Dec 2013 23:06:50 +0000 (23:06 +0000)]
bus: don't generate assert warnings when we detach a detached bus from an event

10 years agoupdate TODO
Lennart Poettering [Tue, 10 Dec 2013 22:50:19 +0000 (22:50 +0000)]
update TODO

10 years agocore: epoll and signalfd has been moved into sd event loop
Shawn Landden [Mon, 9 Dec 2013 22:08:59 +0000 (14:08 -0800)]
core: epoll and signalfd has been moved into sd event loop

10 years agofix scan-build issues
Thomas Hindoe Paaboel Andersen [Tue, 10 Dec 2013 21:30:46 +0000 (22:30 +0100)]
fix scan-build issues

The static analyzer scan-build had a few issues with analysing
parts of systemd.

gpt-auto-generator.c:
scan-build could not find blkid.h. Whether it should be blkid.h or
blkid/blkid.h seems to depend on the version used. We already use
blkid/blkid.h in udev-builtin-blkid.c so it seems safe to use that
here too.

Makefile.am:
Moved some -D's from CFLAGS to CPPFLAGS. I also simplified them a
bit and got rid of a left over DBUS_CFLAGS.

test-cgroup-mask.c/test-sched-prio.c
A variable was added to store the replaced TEST_DIR. When wrapped
in an assert_se TEST_DIR was not replaced in the logged error.
While not an issue introduced in this patch we might as well fix
it up while we are here.

10 years agobus: generate debug messages when we cannot deliver messages via kdbus
Lennart Poettering [Tue, 10 Dec 2013 20:38:51 +0000 (20:38 +0000)]
bus: generate debug messages when we cannot deliver messages via kdbus

10 years agobus: when we _unref() a NULL pointer, don't use assert_return()
Lennart Poettering [Tue, 10 Dec 2013 20:38:04 +0000 (20:38 +0000)]
bus: when we _unref() a NULL pointer, don't use assert_return()

We support unreffing NULL pointers just fine and we shouldn't pay the
_unlikely_() price for it, not get a debug message if we do, hence let's
not use assert_return() here.

10 years agobus: Add bus_kernel_monitor function
Lukasz Skalski [Tue, 3 Dec 2013 14:17:55 +0000 (15:17 +0100)]
bus: Add bus_kernel_monitor function

10 years agohashmap: make gcc shut up on old glibcs that lack getauxval()
Lennart Poettering [Tue, 10 Dec 2013 19:52:16 +0000 (19:52 +0000)]
hashmap: make gcc shut up on old glibcs that lack getauxval()

10 years agojournald: use a bit more cleanup magic!
Lennart Poettering [Tue, 10 Dec 2013 19:51:47 +0000 (19:51 +0000)]
journald: use a bit more cleanup magic!