Commit graph

1696 commits

Author SHA1 Message Date
Lennart Poettering 875c2e220e journald: if available pull audit messages from the kernel into journal logs 2014-11-03 21:51:28 +01:00
Tom Gundersen cda391c3f9 libsystemd-networkd: introduce sd-pppoe library
This library negotiates a PPPoE channel. It handles the discovery stage and
leaves the session stage to the kernel. A further PPP library is needed to
actually set up a PPP unit (negotatie LCP, IPCP and do authentication), so in
isolation this is not yet very useful.

The test program has two modes:

  # ./test-pppoe

will create a veth tunnel in a new network namespace, start pppoe-server on one
end and this client library on the other. The pppd server will time out as no
LCP is performed, and the client will then shut down gracefully.

  # ./test-pppoe eth0

will run the client on eth0 (or any other netdev), and requires a PPPoE server
to be reachable on the local link.
2014-11-01 22:31:40 +01:00
Tom Gundersen f089257d7b shared: add helpers for unaligend BE read/write 2014-11-01 15:36:29 +01:00
Ronny Chevalier 641d1f99b8 tests: add test-copy 2014-10-31 10:57:22 +01:00
Ronny Chevalier 2b89a96060 tests: add test-locale-util 2014-10-31 10:57:21 +01:00
Zbigniew Jędrzejewski-Szmek 7358dc029a Convert the rest to sd_bus_errnomap
I tried to preserve most errno values, but in some cases they were
inconsistent (different errno values for the same error name) or just
mismatched.
2014-10-30 20:38:28 -04:00
Zbigniew Jędrzejewski-Szmek 4a0a74179f bus: add sd_bus_errnomap section
This allows custom "name" ↔ errno mappings to be registered.
Tables from all compilation units are concatenated.
2014-10-30 20:31:48 -04:00
Michal Schmidt 2ea8c08306 tools: add gdb command to dump hashmap information
$ sudo gdb -p 1
...
(gdb) source gdb-sd_dump_hashmaps.py
(gdb) sd_dump_hashmaps
  ... lists allocated hashmaps ...
(gdb) sd_dump_hashmaps 1
  ... lists allocated hashmaps, their DIB histograms and contiguous
      blocks statistics ...
2014-10-30 19:50:51 +01:00
Michal Schmidt 89439d4fc0 hashmap: rewrite the implementation
This is a rewrite of the hashmap implementation. Its advantage is lower
memory usage.

It uses open addressing (entries are stored in an array, as opposed to
linked lists). Hash collisions are resolved with linear probing and
Robin Hood displacement policy. See the references in hashmap.c.

Some fun empirical findings about hashmap usage in systemd on my laptop:
  - 98 % of allocated hashmaps are Sets.
  - Sets contain 78 % of all entries, plain Hashmaps 17 %, and
    OrderedHashmaps 5 %.
  - 60 % of allocated hashmaps contain only 1 entry.
  - 90 % of allocated hashmaps contain 5 or fewer entries.
  - 75 % of all entries are in hashmaps that use trivial_hash_ops.

Clearly it makes sense to:
  - store entries in distinct entry types. Especially for Sets - their
    entries are the most numerous and they require the least information
    to store an entry.
  - have a way to store small numbers of entries directly in the hashmap
    structs, and only allocate the usual entry arrays when the direct
    storage is full.

The implementation has an optional debugging feature (enabled by
defining the ENABLE_HASHMAP_DEBUG macro), where it:
  - tracks all allocated hashmaps in a linked list so that one can
    easily find them in gdb,
  - tracks which function/line allocated a given hashmap, and
  - checks for invalid mixing of hashmap iteration and modification.

Since entries are not allocated one-by-one anymore, mempools are not
used for entries. Originally I meant to drop mempools entirely, but it's
still worth it to use them for the hashmap structs. My testing indicates
that it makes loading of units about 5 % faster (a test with 10000 units
where more than 200000 hashmaps are allocated - pure malloc: 449±4 ms,
mempools: 427±7 ms).

Here are some memory usage numbers, taken on my laptop with a more or
less normal Fedora setup after booting with SELinux disabled (SELinux
increases systemd's memory usage significantly):

systemd (PID 1)                            Original   New    Change
dirty memory (from pmap -x 1) [KiB]            2152  1264     -41 %
total heap allocations (from gdb-heap) [KiB]   1623   756     -53 %
2014-10-30 19:50:51 +01:00
Lennart Poettering a09abc4ae0 memfd: rename memfd.h to memfd-util.h to avoid any confusion with any libc provided headers 2014-10-30 18:32:37 +01:00
Kay Sievers 941a643569 build-sys: do not use "label" functions in libsystemd_shared 2014-10-28 18:46:53 +01:00
Lennart Poettering cfc59d713d build-sys: bump library versions in preparation for 217 release 2014-10-28 15:29:36 +01:00
Timofey Titovets 3769415e65 login: remove multi-seat-x 2014-10-28 02:24:46 +01:00
Michal Schmidt b3dcf58e28 shared: split mempool implementation from hashmaps 2014-10-23 17:38:02 +02:00
Michal Schmidt 32a4456cc2 test: generate tests for OrderedHashmap from Hashmap tests
test-hashmap-ordered.c is generated from test-hashmap-plain.c simply by
substituting "ordered_hashmap" for "hashmap" etc.

In the cases where tests rely on the order of entries, a distinction
between plain and ordered hashmaps is made using the ORDERED macro,
which is defined only for test-hashmap-ordered.c.
2014-10-23 17:38:02 +02:00
Zbigniew Jędrzejewski-Szmek c7e4a7bece missing: remove fanotify
It was only used in readahead.
2014-10-17 08:55:42 -04:00
Tom Gundersen 2355af60dc consoled: add a unit file
The unit file is statically enabled, but still requires --enable-terminal
to actually get installed.
2014-10-04 13:19:18 +02:00
Tom Gundersen 10595afb4c consoled: move from /bin to /lib/systemd
This should not normally be run manually, but rather through systemd.
2014-10-04 13:18:47 +02:00
Tom Gundersen c71202228f systemd-bus-proxyd: distribute the .in file also for the user version 2014-10-04 13:15:59 +02:00
Zbigniew Jędrzejewski-Szmek f45d32872c build-sys: fix make distcheck 2014-10-03 22:08:32 -04:00
David Herrmann ce7b9f50c3 console: add user console daemon
This adds a first draft of systemd-consoled. This is still missing a lot
of features and does some rather primitive rendering. However, it shows
the direction this code is going and serves as basis for further testing.

The systemd-consoled binary should be run as `systemd --user' unit. It
automatically picks up any session marked as Desktop=SYSTEMD-CONSOLE.
Therefore, you can use any login-manager you want (ranging from /bin/login
to gdm) to create sessions for systemd-consoled. However, the sessions
managers must be prepared to set the Desktop= variable properly.

The user-session is called `systemd-console', only the daemon providing
the terminal environment is called `systemd-consoled' (mind the 'd').

So far, only a single terminal session is provided on each opened
user-session. However, we support multiple user-sessions (even across
multiple seats) just fine. In the future, the workspace logic will get
extended so you can have multiple terminal sessions in a single
user-session for easier access.

Note that this is still experimental! Instructions on how to run it will
follow shortly.
2014-10-03 16:07:14 +02:00
David Herrmann a30f142513 terminal: add term.h header for library users
Like all the other parts of libsystemd-terminal, split API of
term-internal.h into term.h so we can use it from systemd-consoled.
2014-10-02 08:40:43 +02:00
David Herrmann 056e86ee7f terminal: move unifont-map to datadir
Lets avoid putting stuff into /usr/shared/unifont/, but keep it in
/usr/share/systemd/. Upstream lacks interest in this, so don't bother for
now.
2014-10-02 08:40:43 +02:00
David Herrmann c2977e5cb8 terminal: move unifont-internal.h to unifont.h
All the definitions are for outside users, so drop the -internal suffix.
Internal definitions are in unifont-def.h and unifont.c, no need to share
those.
2014-10-02 08:40:43 +02:00
Zbigniew Jędrzejewski-Szmek 647f68249f tests: add tests for {hashmap,set}_steal_first
Just to make sure that coverity is wrong.
2014-10-01 09:34:05 -04:00
Piotr Drąg d6740361f2 catalog: add Polish translation 2014-09-27 19:14:18 -04:00
Emil Renner Berthing 37161c5148 make utmp/wtmp support configurable
This adds --disable-utmp option to configure. If it is used, all
utmp-related functionality, including querying runlevel support,
is removed.
2014-09-26 07:48:35 -04:00
Zbigniew Jędrzejewski-Szmek 440c61c500 Revert "only build and install systemd-bus-proxyd if --enable-kdbus"
This reverts commit ef99aec4d2.

systemd-stdio-bridge is used on non-kdbus systems.
2014-09-25 19:02:42 -04:00
Gustavo Sverzut Barbieri 2f88c8583a do not install factory/etc/pam.d if --disable-pam 2014-09-25 18:19:04 -04:00
Zbigniew Jędrzejewski-Szmek 0b094b10b4 build-sys: do not distribute make-man-rules.py
It was added to EXTRA_DIST in 3c3e5f4276,
but this script only makes sense for developers.
2014-09-25 18:19:04 -04:00
Gustavo Sverzut Barbieri ef99aec4d2 only build and install systemd-bus-proxyd if --enable-kdbus 2014-09-25 18:19:04 -04:00
Daniel Buch d6bc8348d5 readahead: wipe out readahead 2014-09-25 16:39:18 +02:00
Daniel Mack 20725d929f bus-policy: add test utility
Add some test files and routines for dbus policy checking.
2014-09-20 18:47:45 +02:00
David Herrmann 810626a80d terminal: add systemd-modeset debugging tool
The systemd-modeset tool is meant to debug grdev issues. It simply
displays morphing colors on any found display. This is pretty handy to
look for tearing in the backends and debug hotplug issues.

Note that this tool requires systemd-logind to be compiled from git
(there're important fixes that haven't been released, yet).
2014-09-19 14:48:54 +02:00
David Herrmann f22e0bce37 terminal: add grdev DRM backend
The grdev-drm backend manages DRM cards for grdev. Any DRM card with
DUMB_BUFFER support can be used. So far, our policy is to configure all
available connectors, but keep pipes inactive as long as users don't
enable the displays on top.

We hard-code double-buffering so far, but can easily support
single-buffering or n-buffering. We also require XRGB8888 as format as
this is required to be supported by all DRM drivers and it is what VTs
use. This allows us to switch from VTs to grdev via page-flips instead of
deep modesets.

There is still a lot room for improvements in this backend, but it works
smoothly so far so more enhanced features can be added later.
2014-09-19 14:13:06 +02:00
David Herrmann 650c544427 terminal: add graphics interface
The grdev layer provides graphics-device access via the
libsystemd-terminal library. It will be used by all terminal helpers to
actually access display hardware.

Like idev, the grdev layer is built around session objects. On each
session object you add/remove graphics devices as they appear and vanish.
Any device type can be supported via specific card-backends. The exported
grdev API hides any device details.

Graphics devices are represented by "cards". Those are hidden in the
session and any pipe-configuration is automatically applied. Out of those,
we configure displays which are then exported to the API user. Displays
are meant as lowest hardware entity available outside of grdev. The
underlying pipe configuration is fully hidden and not accessible from the
outside. The grdev tiling layer allows almost arbitrary setups out of
multiple pipes, but so far we only use a small subset of this. More will
follow.

A grdev-display is meant to represent real connected displays/monitors.
The upper level screen arrangements are user policy and not controlled by
grdev. Applications are free to apply any policy they want.

Real card-backends will follow in later patches.
2014-09-19 14:05:52 +02:00
Michal Schmidt f44541bc93 build: colorize gcc only if on tty
Rather than forcing gcc to always produce colorized error messages
whether on tty or not, enable automatic colorization by ensuring
GCC_COLORS is set to a non-empty string.

Doing it this way removes the need for workarounds in ~/.emacs or
~/.vimrc for "M-x compile" or ":make", respectively, to work.
2014-09-15 16:08:50 +02:00
Ivan Shapovalov 72ba9f04f9 build-sys: make hibernation support configure option also handle hybrid-sleep; fix indentation 2014-09-09 15:03:49 +02:00
Daniel Mack bb7dd0b04a bus: add kdbus endpoint types
Add types to describe endpoints and associated policy entries,
and add a BusEndpoint instace to ExecContext.
2014-09-08 11:06:45 +02:00
Daniel Mack 5369c77d2e bus: factor out bus policy items
In order to re-use the policy definitions, factor them out into their own
files.
2014-09-08 11:06:45 +02:00
Lennart Poettering 782c265292 hibernate-resume: let's move all hibernate-resume tools into the same directory
They are closely related, so let's move them together, and clean up the
.c file naming while we are at it.
2014-09-04 21:42:52 +02:00
Michael Biebl 36e46fe9b6 build: don't install busname units and target if kdbus support is disabled 2014-09-04 16:19:32 +02:00
Umut Tezduyar Lindskog 4df5c00b6e build-sys: configure option to disable hibernation 2014-09-03 19:40:51 +02:00
Zbigniew Jędrzejewski-Szmek 9c0804278b units: m4 is not needed for rescue.service 2014-08-31 00:00:06 -04:00
Kay Sievers be2ea723b1 udev: remove userspace firmware loading support 2014-08-30 11:34:20 +02:00
Harald Hoyer 5a4bf02ff5 use the switch_root function in shutdown
removes code duplication

also move switch-root to shared
2014-08-28 15:25:15 +02:00
David Herrmann 8e9371905c terminal: add systemd-evcat input debugging tool
Like systemd-subterm, this new systemd-evcat tool should only be used to
debug libsystemd-terminal. systemd-evcat attaches to the running session
and pushes all evdev devices attached to the current session into an
idev-session. All events of the created idev-devices are then printed to
stdout for input-event debugging.
2014-08-27 18:42:29 +02:00
David Herrmann e06cc7b074 terminal: add xkb-based keyboard devices to idev
The idev-keyboard object provides keyboard devices to the idev interface.
It uses libxkbcommon to provide proper keymap support.

So far, the keyboard implementation is pretty straightforward with one
keyboard device per matching evdev element. We feed everything into the
system keymap and provide proper high-level keyboard events to the
application. Compose-features and IM need to be added later.
2014-08-27 18:42:28 +02:00
David Herrmann c93e5a62ff terminal: add evdev elements to idev
The evdev-element provides linux evdev interfaces as idev-elements. This
way, all real input hardware devices on linux can be used with the idev
interface.

We use libevdev to interface with the kernel. It's a simple wrapper
library around the kernel evdev API that takes care to resync devices
after kernel-queue overflows, which is a rather non-trivial task.
Furthermore, it's a well tested interface used by all other major input
users (Xorg, weston, libinput, ...).
Last but not least, it provides nice keycode to keyname lookup tables (and
vice versa), which is really nice for debugging input problems.
2014-08-27 18:42:28 +02:00
David Herrmann e202fa31fb terminal: add input interface
The idev-interface provides input drivers for all libsystemd-terminal
based applications. It is split into 4 main objects:
    idev_context: The context object tracks global state of the input
                  interface. This will include data like system-keymaps,
                  xkb contexts and more.
    idev_session: A session serves as controller for a set of devices.
                  Each session on an idev-context is independent of each
                  other. The session is also the main notification object.
                  All events raised via idev are reported through the
                  session interface. Apart of that, the session is a
                  pretty dumb object that just contains devices.
    idev_element: Elements provide real hardware in the idev stack. For
                  each hardware device, one element is added. Elements
                  have no knowledge of higher-level device types, they
                  only provide raw input data to the upper levels. For
                  example, each evdev device is represented by a different
                  element in an idev session.
     idev_device: Devices are objects that the application deals with. An
                  application is usually not interested in elements (and
                  those are hidden to applications), instead, they want
                  high-level input devices like keyboard, touchpads, mice
                  and more. Device are the high-level interface provided
                  by idev. Each device might be fed by a set of elements.
                  Elements drive the device. If elements are removed,
                  devices are destroyed. If elements are added, suitable
                  devices are created.

Applications should monitor the system for sessions and hardware devices.
For each session they want to operate on, they create an idev_session
object and add hardware to that object. The idev interface requires the
application to monitor the system (preferably via sysview_*, but not
required) for hardware devices. Whenever hardware is added to the idev
session, new devices *might* be created. The relationship between hardware
and high-level idev-devices is hidden in the idev-session and not exposed.

Internally, the idev elements and devices are virtual objects. Each real
hardware and device type inherits those virtual objects and provides real
elements and devices. Those types will be added in follow-up commits.

Data flow from hardware to the application is done via idev_*_feed()
functions. Data flow from applications to hardware is done via
idev_*_feedback() functions. Feedback is usually used for LEDs, FF and
similar operations.
2014-08-27 18:42:28 +02:00