Commit graph

13053 commits

Author SHA1 Message Date
Tom Gundersen 92fe133abf networkd: fix several Address entries in [Network] section 2013-11-28 17:17:04 +01:00
David Herrmann 2a16a986ce event: allow EPOLLET as event flag
EPOLLET enables edge-triggered mode (see epoll(7) for more). For most
use-cases, level-triggered is just fine, but for master-TTYs we need
edge-triggered to catch EPOLLHUP. master-TTYs signal EPOLLHUP if no client
is connected, but a client may connect some time later (same happens
during vhangup(2)).

However, epoll doesn't allow masking EPOLLHUP so it's signaled constantly.
To avoid this, edge-triggered mode is needed.
2013-11-28 15:16:49 +01:00
David Herrmann 90a18413f8 logind: mute/restore VT on behalf of session controllers
If a session process calls TakeControl(), we now put the VT into
KD_GRAPHICS+K_OFF mode. This way, the new session controller can solely
rely on the logind-dbus API to manage the session.

Once the controller exits or calls ReleaseControl(), we restore the VT. We
also restore it, if we lost a controller during crash/restart (but only if
there really *was* a controller previously).

Note that we also must put the VT into VT_PROCESS mode. We want VT_AUTO
semantics, but VT_AUTO+KD_GRAPHICS actually disables *all* VT switches
(who came up with that great idea?). Hence, we set VT_PROCESS for logind
but acknowledge *all* requests immediately.

If a compositor wants custom VT setups, they can still get this by *first*
calling TakeControl() and afterwards setting up the VT. logind doesn't
touch the VT during controller runtime, only during setup/teardown. This
is actually what weston already does.
2013-11-28 15:16:49 +01:00
David Herrmann 6d33772f9a logind: restore session-controller after crash
We now save the unique bus-name of a session-controller as CONTROLLER=%s
in the session files. This allows us to restore the controller after a
crash or restart.

Note that we test whether the name is still valid (dbus guarantees that
the name is unique as long as the machine is up and running). If it is,
we know that the controller still exists and can safely restore it. Our
dbus-name-tracking guarantees that we're notified once it exits.

Also note that session-devices are *not* restored. We have no way to know
which devices where used before the crash. We could store all these on
disk, too, or mark them via udev. However, this seems to be rather
cumbersome. Instead, we expect controllers to listen for NewSession
signals for their own session. This is sent on session_load() and they can
then re-request all devices.

The only race I could find is if logind crashes, then the session
controller tries calling ReleaseControl() (which will fail as logind is
down) but keeps the bus-connection valid for other independent requests.
If logind is restarted, it will restore the old controller and thus block
the session.
However, this seems unlikely for several reasons:
 - The ReleaseControl() call must occur exactly in the timespan where
   logind is dead.
 - A process which calls ReleaseControl() usually closes the
   bus-connection afterwards. Especially if ReleaseControl() fails, the
   process should notice that something is wrong and close the bus.
 - A process calling ReleaseControl() usually exits afterwards. There may
   be any cleanup pending, but other than that, usual compositors exit.
 - If a session-controller calls ReleaseControl(), a session is usually
   considered closing. There is no known use-case where we hand-over
   session-control in a single session. So we don't care whether the
   controller is locked afterwards.

So this seems negligible.
2013-11-28 15:16:49 +01:00
David Herrmann d1107170f9 logind: ignore failing close() on session-devices
Unfortunately, close() on a revoked/removed character-device fails with
ENODEV. I tried tracking this down in the kernel, but couldn't figure out
were exactly it comes from. However, can be easily reproduced with:
  fd = open("/dev/input/event0", O_RDWR);
  ioctl(fd, EVIOCREVOKE, 0);
  r = close(fd);
A second close on @fd would return EBADF so the close is actually valid.

We simply ignore close() errors for all session-devices as their access
may be revoked asynchronously, or the device might get unplugged.
We use close_nointr() in case anyone ever looks at the return value (or
anyone runs "grep 'close(' -r src/" to find broken close() calls).

Fixes:
  systemd-logind[31992]: Assertion 'close_nointr(fd) == 0' failed at src/shared/util.c:185, function close_nointr_nofail(). Aborting.
2013-11-28 15:16:49 +01:00
David Herrmann 5fd38859b3 bus: add bus_name_has_owner() helper
Small helper to run a synchronous "NameHasOwner" request on the
dbus-daemon.
2013-11-28 15:16:49 +01:00
David Herrmann 3fdb2494c1 login: revert lazy session-activation on non-VT seats
Existing applications like gdm already depend on new sessions to get
immediately activated on seats without VTs. Fixes a bug reported as:
  [systemd-devel] systemd 208:trouble with inactive user sessions at non-seat0 seats

This patch restores the original behavior. We either need to add a new
flag for session-creation or some other heuristic to avoid activating new
sessions in the future.
2013-11-28 10:52:18 +01:00
Zbigniew Jędrzejewski-Szmek f1a1264d13 build-sys: avoid warnings from assert_cc 2013-11-28 03:43:07 -05:00
Zbigniew Jędrzejewski-Szmek d3822b3b07 po: install translations 2013-11-28 03:43:07 -05:00
Sergey Ptashnick 247913054e catalog,po: add Russian translation 2013-11-28 03:43:07 -05:00
Sylvain Plantefeve d69faa0e78 catalog: fix typos in the French translation 2013-11-28 03:01:48 -05:00
Kay Sievers dd971bd2ce bus: update kdbus.h and always subscribe to KDBUS_HELLO_ATTACH_NAMES 2013-11-28 02:26:03 +01:00
Kay Sievers 5acac4c814 automount: log info about triggering process 2013-11-28 01:25:10 +01:00
Kay Sievers 28b99ccdcb core: initialize variable 2013-11-28 01:24:56 +01:00
Tom Gundersen 88e4d1d733 TODO: add sd-rtnl items 2013-11-27 23:15:04 +01:00
Lennart Poettering 8cf030b349 Revert "socket-proxyd: Add --listener option for listener/destination pairs."
This reverts commit adcf4c81c5.

We have a better solution for the problem of making two processes run in
the same namespace, and --listener is not needed hence and should be
dropped.

Conflicts:
	man/systemd-socket-proxyd.xml
2013-11-27 20:55:15 +01:00
Lennart Poettering 76cd584b8d namespace: comment typo fix 2013-11-27 20:31:51 +01:00
Lennart Poettering c99c09a2dc bus: properly handle if we get disconnected during HELLO phase 2013-11-27 20:28:48 +01:00
Lennart Poettering 613b411c94 service: add the ability for units to join other unit's PrivateNetwork= and PrivateTmp= namespaces 2013-11-27 20:28:48 +01:00
Tom Gundersen df41776d66 TODO: add dbus runtime depedency 2013-11-27 16:50:53 +01:00
Patrik Flykt e877666c15 networkd: Initialize variable to NULL
If any number of arguments are given, _cleanup_manager_free_ is used
with unitialized memory causing a crash.
2013-11-27 16:44:54 +01:00
Kay Sievers ff70c61b6f TODO: remove dbus requirement 2013-11-27 13:15:10 +01:00
Lukasz Skalski 4ec181a006 updates for TODO and README
* library support for setns() system call was added to glibc
version 2.14 (setns() call is use in src/machine/machinectl.c
and src/libsystemd-bus-container.c)

* utf8 validation call are already exported (via sd-utf8.c file) -
commit - 369c583b3f
2013-11-27 13:14:24 +01:00
Lennart Poettering 85a428c694 logind: log which process is delaying suspend and not closing locks 2013-11-27 02:39:19 +01:00
Lennart Poettering fbb634117d journald: mention how long we needed to flush to /var in the logs 2013-11-27 02:39:19 +01:00
Lennart Poettering eda4b58b50 journal: simplify pre-allocation logic
let's just do a single fallocate() as far as possible, and don't
distuingish between allocated space and file size.

This way we can save a syscall for each append, which makes quite some
benefits.
2013-11-27 01:50:36 +01:00
Lennart Poettering d0767ffd08 journal: add a test case for flushing messages out of a series of journal files into a single new one 2013-11-27 01:01:53 +01:00
Lennart Poettering 248c78c79c journal: allow journal_file_copy_entry() to work on non-local files 2013-11-27 00:59:07 +01:00
Lennart Poettering e5462cd80e journal: fix iteration when we go backwards from the beginning of an array chain element 2013-11-27 00:58:39 +01:00
Lennart Poettering f268980d2c journal: optimize bisection logic a bit by caching the last position
This way we can do a quick restart limiting a bit how wildly we need to
jump around during the bisection process.
2013-11-26 20:37:53 +01:00
Lennart Poettering bf807d4dbf journald: keep statistics on how of we hit/miss the mmap cache 2013-11-26 18:58:44 +01:00
Lennart Poettering b8e891e699 journal: make table const 2013-11-26 18:46:03 +01:00
Lennart Poettering a676e66535 journal: when appending to journal file, allocate larger blocks at once 2013-11-26 18:46:03 +01:00
Daniel Buch f5f6d0e255 tree-wide usage of %m specifier instead of strerror(errno)
Also for log_error() except where a specific error is specified

e.g. errno ? strerror(errno) : "Some user specified message"
2013-11-26 21:07:46 +10:00
Tom Gundersen 34a6dc7dca man: networkd - document bridging 2013-11-26 12:10:01 +01:00
Kay Sievers cc3f2093f6 systemctl: fix enable/disable reply handling 2013-11-26 05:19:39 +01:00
Lennart Poettering baae0358f3 pam_systemd: do not set XDG_RUNTIME_DIR if the session's original user is not the same as the newly logged in one
It's better not to set any XDG_RUNTIME_DIR at all rather than one of a
different user. So let's do this.

This changes the bus call parameters of CreateSession(), but that is
explicitly an internal API hence should be fine. Note however, that a
logind restart (the way the RPM postinst scriptlets do it) is necessary
to make things work again.
2013-11-26 05:05:00 +01:00
Lennart Poettering 898d5c9137 nspawn: improve error message when we cannot resolve the root directory argument 2013-11-26 03:50:32 +01:00
Lennart Poettering a7c0e5d714 man: explain the precise syntax and feature set of unit names at the end of the man page, given that it is detail information 2013-11-26 02:26:31 +01:00
Lennart Poettering 4dc5b821ae systemctl: replace the three job mode options by a single --job-mode= option
Also, expose the new "flush" job mode this way.
2013-11-26 02:26:31 +01:00
Lennart Poettering 255baef68a core: add new "flush" job mode to cancel all other jobs when queuing a new job 2013-11-26 02:26:31 +01:00
Lennart Poettering d420282b28 core: replace OnFailureIsolate= setting by a more generic OnFailureJobMode= setting and make use of it where applicable 2013-11-26 02:26:31 +01:00
Tom Gundersen 02b59d57e0 networkd: add bridge support
A bridge is specified in a .netdev file with a section [Bridge]
and at least the entry Name=.

A link may be joined to a bridge if the .network applied to it has
a Bridge= entry giving the name of the bridge in its [Network] section.

We eagerly create all bridges on startup, and links are added to
bridges as soon as they both appear.
2013-11-26 01:32:25 +01:00
Tom Gundersen c166a07055 networkd: minor fixes
In particular, store the ifname, though we should only use it carefully, as
it is not guaranteed to be stable. Using it for logging is fine though.
2013-11-26 01:32:25 +01:00
Tom Gundersen 46fabae6b3 rtnl: add support for IFLA_MASTER 2013-11-26 01:32:25 +01:00
Tom Gundersen 33125ac50b rtnl: add preliminary support for containers
For now, we only support one container type IFLA_LINKINFO, and we
still lack support for parsing the containers again.
2013-11-26 01:32:25 +01:00
Dave Reisner a9bc6d2df1 networkd: use correct printf formatter
uint64_t can be formatted correctly with %ju, rather than casting to
unsigned and potentially losing accuracy.
2013-11-25 18:19:49 -05:00
Yin Kangkai 4ae7885c2c conf-parser: fix memory realloc error
Otherwise there is some memory corruption and undefined behavior,
e.g., in my case systemd-udev was always aborted at the
_cleanup_freep_ around that code blocks.
2013-11-25 23:39:11 +01:00
Lennart Poettering 6301a98cdf core: fix order of parameters in broadcast_signal() 2013-11-25 23:03:03 +01:00
Lennart Poettering 0fc5ab9057 bus: properly return errors to client if invalid parameters are passed to built-in methods 2013-11-25 22:32:18 +01:00