1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 01:27:11 +03:00
Commit Graph

12344 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
b47d419c25 Modernization
Fixes minor leak in error path in device.c.
2013-10-13 17:56:54 -04:00
Zbigniew Jędrzejewski-Szmek
7ff7394d9e Never call qsort on potentially NULL arrays
This extends 62678ded 'efi: never call qsort on potentially
NULL arrays' to all other places where qsort is used and it
is not obvious that the count is non-zero.
2013-10-13 17:56:54 -04:00
Zbigniew Jędrzejewski-Szmek
fb13164629 unicode: treat cute symbol block as fullwidth
UNICODE standards only talk about fullwidth characters for East
Asian scripts. But it seems that all those symbols are fullwidth
too.
2013-10-13 17:56:54 -04:00
Shawn Landden
35d811f521 test: test for ellipsize 2013-10-13 17:56:54 -04:00
Shawn Landden
f405e86de3 util, utf8: make ellipsize take multi-byte characters into account
rename old versions to ascii_*

Do not take into account zerowidth characters, but do consider double-wide characters.
Import needed utf8 helper code from glib.

v3: rebase ontop of utf8 restructuring work

[zj: tweak the algorithm a bit, move new code to separate file]
2013-10-13 17:56:54 -04:00
Dave Reisner
14a9283eb3 udevadm.xml: document --resolve-names option for test
And remove documentation of the --subsystem flag which doesn't actually
exist.
2013-10-13 17:42:51 -04:00
Lennart Poettering
4be391639f bus: properly implement logic for generating InterfacesAdded/InterfacesRemoved signals of ObjectManager 2013-10-11 23:23:46 +02:00
Lennart Poettering
92db139e34 bus: in GetManagedObjects() only return each object once. 2013-10-11 23:21:22 +02:00
Lennart Poettering
92e189e572 bus: unify code to find parents of an object path with 2013-10-11 23:20:54 +02:00
Lennart Poettering
8e4e652b92 bus: properly generate GetAll reply 2013-10-11 23:19:40 +02:00
Lennart Poettering
55736ed0c7 bus: add sd_bus_message_append_strv() to easily add a NULL terminated string array to a message 2013-10-11 23:02:47 +02:00
Lennart Poettering
f11ca85a89 bus: make sure introspection can be generated correctly with NULL method signatures 2013-10-11 23:01:35 +02:00
Lennart Poettering
dfa927250e bus: beef up parameter checking in vtable handling 2013-10-11 21:27:59 +02:00
Lennart Poettering
f69dc9a3d1 bus: beef up parameter checking of convenience calls 2013-10-11 20:49:19 +02:00
Lennart Poettering
77a874a3fb bus: don't rely on gccisms/c11 in public header files.
One day sd-bus.h should become a public header file. We generally try to
be conservative in language features we use in public headers (much
unlike in private code), hence don't make use of anonymous unions in
structs for the vtable definitions.
2013-10-11 20:32:16 +02:00
Lennart Poettering
992c052c34 bus: split up overly long sd-bus.c into three files 2013-10-11 20:18:10 +02:00
Lennart Poettering
9db7635521 bus: if a a Set() vtable callback of a writable is left NULL, try to do the right thing automatically 2013-10-11 20:03:19 +02:00
Lennart Poettering
43a43f5016 bus: automatically do a NOP reply when a NULL callback is specified for a method in a vtable
Also, allow specifiying NULL as signature in vtables equivalent to ""
for empty parameter lists.
2013-10-11 20:03:19 +02:00
Bastien Nocera
1a0464230c Add support for saving/restoring keyboard backlights
Piggy-backing on the display backlight code, this saves and restores
keyboard backlights on supported devices.

The detection code matches that of UPower:
http://cgit.freedesktop.org/upower/tree/src/up-kbd-backlight.c#n173

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

[tomegun: also work for devices named "{smc,samsung,asus}::kbd_backlight"]
2013-10-11 12:52:36 +02:00
Kay Sievers
f6f2ad9b9c udev: usb_id - remove obsoleted bInterfaceSubClass == 5 match
bInterfaceSubClass == 5 is not a "floppy"; just identify the obsolete
QIC-157 interface as "generic".
2013-10-11 11:23:34 +02:00
Kay Sievers
9a4e038c15 smack: minimize ifdef use, and move all labeling to smack-util.c 2013-10-11 10:16:41 +02:00
Lennart Poettering
adcdb37476 bus: when NULL is specified as property callback, automatically handle serialization on Get() 2013-10-11 06:10:15 +02:00
Lennart Poettering
62b5c2aec1 bus: make PropertiesChanged emission work 2013-10-11 05:22:00 +02:00
Lennart Poettering
90d184b234 bus: decorate API calls with gcc attributes where appropriate 2013-10-11 05:21:08 +02:00
Lennart Poettering
5a037827f6 bus: allow specifying NULL as type string when we want to construct messages with no payload 2013-10-11 05:20:24 +02:00
Lennart Poettering
5d12cc3e28 bus: make GetManagedObjects() work 2013-10-11 04:52:38 +02:00
Lennart Poettering
46e8c8257f event: add apis to query the timestamp of the event currently processed 2013-10-11 04:36:02 +02:00
Lennart Poettering
305f78bff3 event: move all library calls over to new assert_return() macro 2013-10-11 02:11:30 +02:00
Lennart Poettering
4bee801296 event: add sd_event_source_get_child_pid() call to query the PID of a child event source 2013-10-11 01:33:25 +02:00
Lennart Poettering
baf7628332 event: rename the "mute" field of event sources to "enabled"
In addition, the states "UNMUTED" and "MUTED" become "ON" and "OFF".

This has the benefit that a possible value of this field is not
identical to its name, thus minimizing confusion.
2013-10-11 01:08:15 +02:00
Lennart Poettering
da7e457c5b event: implement quit handlers
Quit handlers are executed when an event loop is terminated via
sd_event_request_quit(). They are in a way atexit() handlers that are
executed in a well-defined environment, time and thread: from the event
loop thread when the event loop finishes.
2013-10-11 00:49:11 +02:00
Lennart Poettering
18387b5983 macro: add new assert_return() macro for early parameter checking in functions
For the library functions we expose we currently repeatedly use checks
like the following:

if (!value_is_ok(parameter1))
        return -EINVAL;
if (!value_is_ok(parameter2))
        return -EINVAL;

And so on. Let's turn this into a macro:

assert_return(value_is_ok(parameter1), -EINVAL);
assert_return(value_is_ok(paramater2), -EINVAL);

This makes our code a bit shorter and simpler, and also allows us to add
a _unlikely_() around the check.
2013-10-11 00:45:47 +02:00
Lennart Poettering
eaa3cbef3b event: refuse operation if the caller tries to reuse an event loop after a fork() 2013-10-10 21:37:50 +02:00
Lennart Poettering
c2ba3ad660 event: add timer accuracy/coalescing logic
In order to improve energy consumption we should minimize our wake-ups
when handling timers.  Hence, for each timer take an accuracy value and
schedule the actual wake-up time somewhere between the specified time
and the specified timer plus the accuracy.

The specified time of timer event sources hence becomes the time the
handler is called the *earliest*, and the specified time plus the accuracy
the time by which it is called the *latest*, leaving the library the
freedom to schedule the wake-up somewhere inbetween.

If the accuracy is specified as 0 the default of 250ms will be used.

When scheduling timeouts we will now try to elapse them at the same
point within each second, across the entire system. We do this by using
a fixed perturbation value keyed off the boot id. If this point within a
second is not in the acceptable range, we try again with a fixed time
within each 250ms time step. If that doesn't work either, we wake up at
the last possible time.
2013-10-10 21:22:59 +02:00
Lennart Poettering
5a045dad1c security: missing header inclusions 2013-10-10 21:22:59 +02:00
Tero Roponen
dfcd88f634 bus: fix duplicate comparisons
Testing for y > x is the same as testing for x < y.
2013-10-10 18:37:48 +02:00
Lennart Poettering
d682b3a7e7 security: rework selinux, smack, ima, apparmor detection logic
Always cache the results, and bypass low-level security calls when the
respective subsystem is not enabled.
2013-10-10 16:35:44 +02:00
David Herrmann
0581dac2c1 login: make sd_session_get_vt() actually work
We use VTNR, not VTNr as key. Until now sd_session_get_vt() just returns
an error.
2013-10-10 13:14:18 +02:00
David Herrmann
3f4fee033b login: fix invalid free() in sd_session_get_vt()
We need to clear variables markes as _cleanup_free_. Otherwise, our
error-paths might corrupt random memory.
2013-10-10 13:14:18 +02:00
Lennart Poettering
fd38203a2a bus: add minimal event loop API
So far we tried to use epoll directly wherever we needed an event loop.
However, that has various shortcomings, such as the inability to handle
larger amounts of timers (since each timerfd costs one fd, which is a
very limited resource, usually bounded to 1024), and inability to do
priorisation between multiple queued events.

Let's add a minimal event loop API around epoll that is suitable for
implementation of our own daemons and maybe one day can become public
API for those who desire it.

This loop is part of libsystemd-bus, but may be used independently of
it.
2013-10-10 04:44:48 +02:00
Zbigniew Jędrzejewski-Szmek
2b98f75a63 journald: remove rotated file from hashmap when rotation fails
Before, when the user journal file was rotated, journal_file_rotate
could close the old file and fail to open the new file. In that
case, we would leave the old (deallocated) file in the hashmap.
On subsequent accesses, we could retrieve this stale entry, leading
to a segfault.

When journal_file_rotate fails with the file pointer set to 0,
old file is certainly gone, and cannot be used anymore.

https://bugzilla.redhat.com/show_bug.cgi?id=890463
2013-10-09 22:32:08 -04:00
Zbigniew Jędrzejewski-Szmek
57535f4703 journald: replace new+snprintf with asprintf 2013-10-09 22:32:08 -04:00
Kay Sievers
6c7980093c do not accept "garbage" from acpi firmware performance data (FPDT)
00000000  46 42 50 54 38 00 00 00  02 00 30 02 00 00 00 00  |FBPT8.....0.....|
00000010  23 45 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |#E..............|
00000020  f5 6a 51 00 00 00 00 00  00 00 00 00 00 00 00 00  |.jQ.............|
00000030  00 00 00 00 00 00 00 00  70 74 61 6c 58 00 00 00  |........ptalX...|
2013-10-10 01:38:11 +02:00
Auke Kok
8552b17660 Smack: Test if smack is enabled before mounting
Since on most systems with xattr systemd will compile with Smack
support enabled, we still attempt to mount various fs's with
Smack-only options.

Before mounting any of these Smack-related filesystems with
Smack specific mount options, check if Smack is functionally
active on the running kernel.

If Smack is really enabled in the kernel, all these Smack mounts
are now *fatal*, as they should be.

We no longer mount smackfs if systemd was compiled without
Smack support. This makes it easier to make smackfs mount
failures a critical error when Smack is enabled.

We no longer mount these filesystems with their Smack specific
options inside containers. There these filesystems will be
mounted with there non-mount smack options for now.
2013-10-09 15:06:17 -07:00
Kay Sievers
463b5dbb0d udev: add SECLABEL{selinux}= support 2013-10-09 17:31:41 +02:00
Martin Pitt
35bffce819 keymap: Fix Samsung 900X[34]C
It appears that it's not really the 900 vs. 940 or the X3 vs X4, but the
A/B/C/D suffix after that which makes the difference between the keymaps. On a
NP900X3C-A04RU you get

   MODALIAS=dmi:bvn*:bvr*:bd*:svnSAMSUNGELECTRONICSCO.,LTD.:pn900X3C/900X3D/900X4C/900X4D:*

So change the matches to use AB vs. CDG as the differentiator.

Thanks to Anatoly Markov for reporting and testing!
2013-10-09 16:13:20 +02:00
Kay Sievers
b7e2b7641e udev: reset Linux Security Module labels if no custom rules are given 2013-10-09 04:26:41 +02:00
Lennart Poettering
753eff037e bus: fix missing initialization 2013-10-09 04:08:00 +02:00
Lennart Poettering
510b857f7d tests: fix some memory leaks in tests 2013-10-09 04:08:00 +02:00
Lennart Poettering
2ee0591d12 journald: fix minor memory leak 2013-10-09 04:08:00 +02:00