Commit graph

12360 commits

Author SHA1 Message Date
Mantas Mikulėnas a0a6408e31 manager: connect to private bus even if $DBUS_SESSION_BUS_ADDRESS is not set
Because that's exactly the kind of situation where the private bus is
necessary.
2013-10-13 23:01:23 -04:00
Lennart Poettering 3990f24765 rfkill: add new rfkill tool to save/restore rfkill state across reboots
This works analogous to the existing backlight and random seed services
2013-10-14 04:31:49 +02:00
Lennart Poettering 0f4ba83c39 backlight: always prefer "firmware"/"platform" backlights over "raw" backlights if we have both for the same device 2013-10-14 02:22:35 +02:00
Zbigniew Jędrzejewski-Szmek 124b48b00d man: add more markup to udevadm(8) 2013-10-13 19:43:19 -04:00
Zbigniew Jędrzejewski-Szmek 0eb2e0e340 event: avoid derefencing null pointer 2013-10-13 17:56:55 -04:00
Zbigniew Jędrzejewski-Szmek 23c6f770cc bus: make sure we don't try to malloc 0 bytes 2013-10-13 17:56:55 -04:00
Zbigniew Jędrzejewski-Szmek 1ca208fb4f Introduce udev object cleanup functions 2013-10-13 17:56:55 -04:00
Zbigniew Jędrzejewski-Szmek b506291ff1 gitignore: ignore clang --analyze output 2013-10-13 17:56:55 -04:00
Zbigniew Jędrzejewski-Szmek f6d2d42147 Make sure that we don't dereference NULL
The code was actually safe, because b should
never be null, because if rvalue is empty, a different
branch is taken. But we *do* check for NULL in the
loop above, so it's better to also check here for symmetry.
2013-10-13 17:56:55 -04:00
Zbigniew Jędrzejewski-Szmek 97fec53e5e udev: use initialization instead of zeroing in one place 2013-10-13 17:56:55 -04:00
Zbigniew Jędrzejewski-Szmek 872c8faaf2 Fix write-only use of a few variables
Since the invention of read-only memory, write-only memory has been
considered deprecated. Where appropriate, either make use of the
value, or avoid writing it, to make it clear that it is not used.
2013-10-13 17:56:54 -04:00
Zbigniew Jędrzejewski-Szmek 51d122af23 Introduce _cleanup_fdset_free_ 2013-10-13 17:56:54 -04:00
Zbigniew Jędrzejewski-Szmek a3e7f417d7 bus: fix access to unitialized variable in error path
src/machine/machined-dbus.c:237:13: warning: Branch condition evaluates to a garbage value
        if (m)
            ^
2013-10-13 17:56:54 -04:00
Zbigniew Jędrzejewski-Szmek 6891529fe1 drop-ins: check return value
If the function failed, nothing serious would happen
because unlink would probably return EFAULT, but this
would obscure the real error and is a bit sloppy.
2013-10-13 17:56:54 -04:00
Zbigniew Jędrzejewski-Szmek 7ca9dffae1 journald: use greedy_realloc in one place 2013-10-13 17:56:54 -04:00
Zbigniew Jędrzejewski-Szmek 74dcc2df7b dbus-common: avoid leak in error path
src/shared/dbus-common.c:968:33: warning: Potential leak of memory pointed to by 'l'
                        return -EINVAL;
                                ^~~~~~
2013-10-13 17:56:54 -04:00
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