b26fa1a2fbcfee7d03b0c8fd15ec3aa64ae70b9f |
|
10-Feb-2016 |
Daniel Mack <daniel@zonque.org> |
tree-wide: remove Emacs lines from all files
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file. |
393003e1debf7c7f75beaacbd532b92c3e3dc729 |
|
01-Feb-2016 |
Lennart Poettering <lennart@poettering.net> |
sd-event: permit a USEC_INFINITY timeout as an alternative to a disabling an event source
This should simplify handling of time events in clients and is in-line with the USEC_INFINITY macro we already have.
This way setting a timeout to 0 indicates "elapse immediately", and a timeout of USEC_INFINITY "elapse never". |
1bce0ffa66f329bd50d8bfaa943a755caa65b269 |
|
01-Feb-2016 |
Lennart Poettering <lennart@poettering.net> |
sd-event: when determining the last allowed time a time event may elapse, deal with overflows |
90f604d1289aa780da20659d3e68e1a6987f49d3 |
|
18-Jan-2016 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
sd-event: fix theoretical leak on error in event_make_signal_data |
2c86ba5a51b29e41bdfde6771d93cc5317b253cf |
|
18-Jan-2016 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
sd-event: check clock argument to sd_event_now()
sd_event_now() is a public function, so we must check all
arguments for validity. Update man page and add tests.
Sample debug message:
Assertion 'IN_SET(clock, CLOCK_REALTIME, CLOCK_REALTIME_ALARM, CLOCK_MONOTONIC, CLOCK_BOOTTIME, CLOCK_BOOTTIME_ALARM)' failed at src/libsystemd/sd-event/sd-event.c:2719, function sd_event_now(). Ignoring. |
34a6843d622e71d197dedee8de24a59eaddb86ea |
|
12-Jan-2016 |
Vito Caputo <vito.caputo@coreos.com> |
sd-event: minor fixups to delays profiling changes |
34b87517749caa4142b19eb3c63bdf349fafbc49 |
|
12-Jan-2016 |
Vito Caputo <vcaputo@gnugeneration.com> |
sd-event: instrument sd_event_run() for profiling delays
Set SD_EVENT_PROFILE_DELAYS to activate accounting and periodic logging
of the distribution of delays between sd_event_run() calls.
Time spent in dispatching as well as time spent outside of
sd_event_run() is measured and accounted for. Every 5 seconds a
logarithmic histogram loop iteration delays since 5 seconds previous is
logged.
This is useful in identifying the frequency and magnitude of latencies
affecting the event loop, which should be kept to a minimum. |
55cbfaa54ba92d8b605c7e0ccf328964e1c5b28e |
|
21-Dec-2015 |
Daniel Mack <daniel@zonque.org> |
sd-event: improve debugging of event source errors
Printing the pointer variable really doesn't help, so drop that.
Instead, add a string lookup table for the EventSourceType enum, and print
the type of event source in case of errors. |
c983e776c4e7e2ea6e1990123d215e639deb353b |
|
22-Nov-2015 |
Evgeny Vereshchagin <evvers@ya.ru> |
sd-event: use prioq_ensure_allocated where possible |
0be6c2f617732902921d42bb0705f016b2838aba |
|
19-Nov-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-event: define a new PREPARING state
We already have a state RUNNING and EXITING when we dispatch regular and
exit callbacks. Let's introduce a new state called PREPARING that is
active while we invoke preparation callbacks. This way we have a state
each for all three kinds of event handlers.
The states are currently not documented, hence let's add a new state to
the end, before we start documenting this. |
6680dd6b66e8a3e116819122ef66d89846d95f58 |
|
19-Nov-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-event: make _ref() calls NOPs when NULL is passed to them
Let's make _ref() calls happy when NULL is passed to them, and simply
return NULL without any assertion logic. This makes them nicely
symmetric to the _unref() calls which also are happy to take NULL and
become NOPs then. |
4a0b58c4a30ecaa61202f845ed86f75b36370cd0 |
|
17-Nov-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: use right cast macros for UIDs, GIDs and PIDs |
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ce |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out allocation calls into alloc-util.[ch] |
3ffd4af22052963e7a29431721ee204e634bea75 |
|
25-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them
over. |
07630cea1f3a845c09309f197ac7c4f11edd3b62 |
|
24-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.
This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.
Also touches a few unrelated include files. |
50e0d56cf37d8ca5b9162ab83906920392998623 |
|
17-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: fix error handling of pthread API calls
pthread APIs (unlike the rest of libc) return their errors as positive
error codes directly from the functions, rather than using errno. Let's
make sure we always handle things that way. |
6fe869c251790a0e3cef5b243169dda363723f49 |
|
29-Sep-2015 |
David Herrmann <dh.herrmann@gmail.com> |
sd-event: don't provide priority stability
Currently, we guarantee that if two event-sources with the same priority
fire at the same time, they're always dispatched in the same order. While
this might sound nice in theory, there's is little benefit in providing
stability on that level. We have no control over the order the events are
reported, hence, we cannot guarantee that we get notified about both at
the same time.
By dropping the stability guarantee, we loose roughly 10% Heap swaps in
the prioq on a desktop cold-boot. Krzysztof Kotlenga even reported up to
20% on his tests. This sounds worth optimizing, so drop the stability
guarantee. |
8046c4576a68977a1089d2585866bfab8152661b |
|
24-Sep-2015 |
Krzysztof Kotlenga <k.kotlenga@sims.pl> |
sd-event: fix prepare priority queue comparison function
Otherwise a disabled event source can get swapped with an enabled one
and cause a severe sd-event malfunction.
http://lists.freedesktop.org/archives/systemd-devel/2015-September/034356.html |
10edebf6cd69cfbe0d38dbaf5478264fbb60a51e |
|
07-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-event: make sure to create a signal queue for the right signal
We should never access the "signal" part of the event source unless the
event source is actually for a signal. In this case it's a child pid
handler however, hence make sure to use the right signal.
This is a fix for PR #1177, which in turn was a fix for
9da4cb2be260ed123f2676cb85cb350c527b1492. |
b8a50a99a6e158a5b3ceacf0764dbe9f42558f3e |
|
06-Sep-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
sd-event: fix call to event_make_signal_data
This looks like a typo from commit 9da4cb2b where it was added. |
9da4cb2be260ed123f2676cb85cb350c527b1492 |
|
04-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-event: make sure RT signals are not dropped
RT signals operate in a queue, and we should be careful to never merge
two queued signals into one. Hence, makes sure we only ever dequeue a
single signal at a time and leave the remaining ones queued in the
signalfd. In order to implement correct priorities for the signals
introduce one signalfd per priority, so that we only process the highest
priority signal at a time. |
556c25cf8c1250cb529c9a95e3b20b6f4d19ffc2 |
|
31-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-event: improve debug message when we fail to remove and fd from an epoll
Let's help users to debug issues with epoll fd removal by printing the
name of the event source. |
8ac43fee1a2890d62edfe29282f66780bc1b634f |
|
14-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: generate EBADF when we get invalid fds
This is a follow-up to #907, and makes the same change for all our other
public APIs. |
38a03f06a7393d2721c23f23f0589d2f6d0904af |
|
03-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-event: make sure sd_event_now() cannot fail
Previously, if the event loop never ran before sd_event_now() would
fail. With this change it will instead fall back to invoking now(). This
way, the function cannot fail anymore, except for programming error when
invoking it with wrong parameters.
This takes into account the fact that many callers did not handle the
error condition correctly, and if the callers did, then they kept simply
invoking now() as fall back on their own. Hence let's shorten the code
using this call, and make things more robust, and let's just fall back
to now() internally.
Whether now() is used or the cache timestamp may still be detected via
the return value of sd_event_now(). If > 0 is returned, then the fall
back to now() was used, if == 0 is returned, then the cached value was
returned.
This patch also simplifies many of the invocations of sd_event_now():
the manual fall back to now() can be removed. Also, in cases where the
call is invoked withing void functions we can now protect the invocation
via assert_se(), acknowledging the fact that the call cannot fail
anymore except for programming errors with the parameters.
This change is inspired by #841. |
366e641139130833a7354d9f2f96ce72633b1053 |
|
17-Jun-2015 |
David Herrmann <dh.herrmann@gmail.com> |
sd-event: make errors on EPOLL_CTL_DEL pseudo-fatal
If we call EPOLL_CTL_DEL, we *REALLY* expect the file-descriptor to be
present in that given epoll-set. We actually track such state via our
s->io.registered flag, so it better be true.
Make sure if that's not true, we treat it similar to assert_return() (ie.,
print a loud warning). |
cde40acc805b855909b95f15fd9a3111e40be672 |
|
10-Jun-2015 |
Lennart Poettering <lennart@poettering.net> |
logind,sd-event: drop spurious new-lines |
f68067348f58cd08d8f4f5325ce22f9a9d2c2140 |
|
04-Jun-2015 |
Tom Gundersen <teg@jklm.no> |
sd-event: don't touch fd's accross forks
We protect most of the API from use accross forks, but we still allow both
sd_event and sd_event_source objects to be unref'ed. This would cause
problems as it would unregister sources from the underlying eventfd, hence
also affecting the original instance in the parent process.
This fixes the issue by not touching the fds on unref when done accross a fork,
but still free the memory.
This fixes a regression introduced by
"udevd: move main-loop to sd-event": 693d371d30fee
where the worker processes were disabling the inotify event source in the
main daemon. |
24882e06c135584f16f31ba8a00fecde8b7f6fad |
|
29-May-2015 |
Lennart Poettering <lennart@poettering.net> |
util: split out signal-util.[ch] from util.[ch]
No functional changes. |
53bac4e0e32b017e7a5c1fd1181c740a1583e3fd |
|
10-Apr-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-event: simplify sd_event_run() |
02d30981b1bef116caee26ef3229fb910a88a394 |
|
14-Mar-2015 |
Tom Gundersen <teg@jklm.no> |
sd-event: sd_event_run - only return 0 on timeout
sd_event_dispatch() returns 0 on FINISH, so let's eat that up. |
2b0c9ef7352dae53ee746c32033999c1346633b3 |
|
14-Mar-2015 |
Tom Gundersen <teg@jklm.no> |
sd-event: rename PASSIVE/PREPARED to INITIAL/ARMED |
15411c0cb1192799b37ec8f25d6f30e8d7292fc6 |
|
13-Mar-2015 |
David Herrmann <dh.herrmann@gmail.com> |
tree-wide: there is no ENOTSUP on linux
Replace ENOTSUP by EOPNOTSUPP as this is what linux actually uses. |
a2360a467b50a62902eb612ff747df87bace81c5 |
|
13-Mar-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
sd-event: fix typo |
1c724e9e0ec5bc4bf791a3d7b1cf5b955cdb98b2 |
|
05-Mar-2015 |
Hannes Reinecke <hare@suse.de> |
Remove the cap on epoll events
Currently the code will silently blank out events if there are more
then 512 epoll events, causing them never to be handled at all. This
patch removes the cap on the number of events for epoll_wait, thereby
avoiding this issue. |
2eec67acbb00593e414549a7e5b35eb7dd776b1b |
|
23-Feb-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
remove unused includes
This patch removes includes that are not used. The removals were found with
include-what-you-use which checks if any of the symbols from a header is
in use. |
c4f1aff2306e4fb10efeda75f7015e5d043d4e8d |
|
02-Feb-2015 |
Tom Gundersen <teg@jklm.no> |
sd-event: treat NULL callback for timer events like sig events
In both cases exit the event loop. |
da927ba997d68401563b927f92e6e40e021a8e5c |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: no need to negate errno for log_*_errno()
It corrrectly handles both positive and negative errno values. |
0a1beeb64207eaa88ab9236787b1cbc2f704ae14 |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: auto-convert the simple cases to log_*_errno()
As a followup to 086891e5c1 "log: add an "error" parameter to all
low-level logging calls and intrdouce log_error_errno() as log calls
that take error numbers", use sed to convert the simple cases to use
the new macros:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/'
Multi-line log_*() invocations are not covered.
And we also should add log_unit_*_errno(). |
f4b2933ee7890e5d414ab266d8586f19027a2bd9 |
|
04-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus,sd-event: unify error handling of object descriptions
a) When getting the description return ENXIO if none is set
b) Allow setting a description to NULL
c) return ECHILD on fork() like for other calls |
f1f00dbb7f3741b30d4a26b1a8b65ec46ff1fde3 |
|
04-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-event: implicitly set signal event source's descriptions to the signal name |
356779df90a2ecab5da2cb310ad0f8ebc9ca9f46 |
|
04-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-event: rename sd_event_source_set_name() to sd_event_source_get_name()
To mirror the recent name change of the concept for sd_bus objects,
follow the same logic for sd_event_source objects, too. |
f95387cda829bc053992c398789ce3aa6f42f81e |
|
09-Oct-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
sd-event: also update signal mask when disconnecting sources |
4807d2d068ae9fc08b87121fc0a574394f8acc5b |
|
09-Oct-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
sd-event: be more careful when enabling/disabling signals
When a child event is disabled (in order to be freed) and there is no
SIGCHLD signal event, sd_event_source_set_enabled will disable SIGCHLD
even if there are other child events.
Also remove some unneeded signalfd updates.
https://bugs.freedesktop.org/show_bug.cgi?id=84659
Based-on-a-patch-by: Hristo Venev <mustrumr97@gmail.com> |
7057bd993110c1eff0cd3a8776902ca66417634e |
|
04-Oct-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
sd-event: check the value of received signal
Appease coverity report #1237775.
Also rename ss to n, to make it visually different from ss. |
d5099efc47d4e6ac60816b5381a5f607ab03f06e |
|
15-Sep-2014 |
Michal Schmidt <mschmidt@redhat.com> |
hashmap: introduce hash_ops to make struct Hashmap smaller
It is redundant to store 'hash' and 'compare' function pointers in
struct Hashmap separately. The functions always comprise a pair.
Store a single pointer to struct hash_ops instead.
systemd keeps hundreds of hashmaps, so this saves a little bit of
memory. |
32b13b2f58b916ea22626e89cdd8cdb70ca6b6c9 |
|
28-Aug-2014 |
David Herrmann <dh.herrmann@gmail.com> |
sd-event: simplify sd_event_source_set_name()
free_and_strdup() does exactly the same as sd_event_source_set_name(), use
it! |
752bbf75b9b52c0faae29bb4b77a99c4bb0d298f |
|
28-Aug-2014 |
Tom Gundersen <teg@jklm.no> |
sd-event: use event source name rather than address in debug messages |
f7f53e9e6ebb9f656d880f5e779fc174a1d983bf |
|
28-Aug-2014 |
Tom Gundersen <teg@jklm.no> |
sd-event: allow naming event sources |
6d148a842ebb04a9a9bc2853e167a9d8eddf8cd8 |
|
26-Aug-2014 |
Tom Gundersen <teg@jklm.no> |
sd-event: sd_event_prepare - stay in PREPARED if sd_event_wait() indicates that no sources are pending |
c45a5a74465a39280b855f9d720b2ab4779a47fa |
|
25-Aug-2014 |
Tom Gundersen <teg@jklm.no> |
sd-event: split run into prepare/wait/dispatch
This will allow sd-event to be integrated into an external event loop, which
in turn will allow (say) glib-based applications to use our various libraries,
without manually integrating each of them (bus, rtnl, dhcp, ...).
The external event-loop should integrate sd-event int he following way:
Every iteration must start with a call to sd_event_prepare(), which will
return 0 if no event sources are ready to be processed, a positive value if
they are and a negative value on error. sd_event_prepare() may only be called
following sd_event_dispatch(); a call to sd_event_wait() indicating that no
sources are ready to be dispatched; or a failed call to sd_event_dispatch() or
sd_event_wait().
A successful call to sd_event_prepare() indicating that no event sources are
ready to be dispatched must be followed by a call to sd_event_wait(),
which will return 0 if it timed out without event sources being ready to
be processed, a negative value on error and a positive value otherwise.
sd_event_wait() may only be called following a successful call to
sd_event_prepare() indicating that no event sources are ready to be dispatched.
If sd_event_wait() indicates that some events sources are ready to be
dispatched, it must be followed by a call to sd_event_dispatch(). This
is the only time sd_event_dispatch() may be called. |
9b364545435d2b65fcf73519b3064bb7c28093b7 |
|
20-Aug-2014 |
Tom Gundersen <teg@jklm.no> |
sd-event: add API to access epoll_fd
This is a prerequisite for integrating sd-event into an external
event loop. |
050f74f286b12945e3eb13a45dca92783fa65bb8 |
|
15-Aug-2014 |
Tom Gundersen <teg@jklm.no> |
sd-event: return 'r' rather than '-errno' |
e07bbb7c503dca966b307e7af21e2efbc6f45b89 |
|
15-Aug-2014 |
Tom Gundersen <teg@jklm.no> |
sd-event: fix missing needs_rearm |
d06441da04cd5102816858d8d1e4aa367c00156b |
|
14-Aug-2014 |
Tom Gundersen <teg@jklm.no> |
sd-event: drop _likely_()
This is not certain to be likely.
Lennart says: a frequent usecase is invoking some function regularly in intervals
in such a case every single iteration we'll have to rearm |
212bbb1798e5746a669dfba4a1732a4eabe4f2d8 |
|
14-Aug-2014 |
Tom Gundersen <teg@jklm.no> |
sd-event: do not arm timers unnecessarily
Rather than recalculating the next timeout on every loop, we only do it when something changed. |
3a43da2832dc5360a638d043f469a6dcbe025582 |
|
29-Jul-2014 |
Kay Sievers <kay@vrfy.org> |
time-util: add and use USEC/NSEC_INFINIY |
a854881616afbe4c4f55396d3fc2f922bbbe716b |
|
24-Jul-2014 |
Tom Gundersen <teg@jklm.no> |
sd-event: add support for CLOCK_BOOTTIME
This requires a very recent kernel (3.15), so care should be taken
when using this functionality. |
92daebc0d0268c35f416c1665e0da3d4be5dd69f |
|
11-Jul-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-event: don't require a signal event source to be enabled for the child event source to work |
b63c8d4f0364457b0ead8793504012bb7113974f |
|
11-Jul-2014 |
David Herrmann <dh.herrmann@gmail.com> |
sd-event: always call epoll_ctl() on mask-updates if edge-triggered
A call to sd_event_source_set_io_events() skipps calling into the kernel
if the new event-mask matches the old one. This is safe for
level-triggered sources as the kernel moves them onto the ready-list
automatically if events change. However, edge-triggered sources might not
be on the ready-list even though events are present.
A call to sd_event_source_set_io_events() with EPOLLET set might thus be
used to just move the io-source onto the ready-list so the next poll
will return it again. This is very useful to avoid starvation in
priority-based event queues.
Imagine a read() loop on an edge-triggered fd. If we cannot read data fast
enough to drain the receive queue, we might decide to skip reading for now
and schedule it for later. On edge-triggered io-sources we have to make
sure it's put on the ready-list so the next dispatch-round will return it
again if it's still the highest priority task. We could make sd-event
handle edge-triggered sources directly and allow marking them ready again.
However, it's much simpler to let the kernel do that for now via
EPOLL_CTL_MOD. |
eec6022cf039e62233139000b9e95db943959e48 |
|
05-Jun-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-event: restore correct timeout behaviour |
4a134c4903dbf6ef6c6ad55780643a5dd816d349 |
|
15-May-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-resolve: add "floating" resolve queries
Same story as for sd-bus and sd-event: allow passing NULL to store query
in in which case the query is freed automatically. |
a71fe8b8aee1cb78c4d8c56eeb234743f64e4b4d |
|
15-May-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-event: introduce concept of "floating" event sources
These are the counterpart of "floating" bus slots, i.e. event sources
that are bound to the lifetime of the event object itself, and thus
don't require an explicit reference to be kept. |
cc567911ba790931743c18332b2476e8c4accf64 |
|
05-May-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-event: allow disabling event sources when an event object is dying anyway |
59bc1fd776b5270bcabe3c536852afd0c892fbe1 |
|
05-May-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-event: make it easy to bind signal handling to event loop exits
By passing a NULL callback provide a simple way to make event loops exit
on SIGTERM and other signals. |
9f2a50a3005a771a3b6cea2136b6a6c7e5686a0e |
|
27-Mar-2014 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
silence warnings |
75145780813957ecbe6835f2c8bc20113a3605d2 |
|
25-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-event: don't accidentally turn of watchdog timer event if we determine 0 |
52444dc478fe38b5b69a771923ab429a41927aa5 |
|
24-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-event: initialization perturbation value right before we use it
That way, we don't forget to initialize it when the watchdog is
initialized before all event sources. |
79e16ce3bf734434081e57f1170333277830a592 |
|
24-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
networkd: fix a couple of memory leaks |
6a0f1f6d5af7c7300d3db7a0ba2b068f8abd222b |
|
24-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-event: rework API to support CLOCK_REALTIME_ALARM and CLOCK_BOOTTIME_ALARM, too |
03e334a1c7dc8c20c38902aa039440763acc9b17 |
|
18-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
util: replace close_nointr_nofail() by a more useful safe_close()
safe_close() automatically becomes a NOP when a negative fd is passed,
and returns -1 unconditionally. This makes it easy to write lines like
this:
fd = safe_close(fd);
Which will close an fd if it is open, and reset the fd variable
correctly.
By making use of this new scheme we can drop a > 200 lines of code that
was required to test for non-negative fds or to reset the closed fd
variable afterwards. |
bdd13f6be4b588568683a1ab54f421fc6a636dbb |
|
25-Feb-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Remove dead lines in various places
As pointed-out by clang -Wunreachable-code.
No behaviour changes. |
6e9feda30d6d5c4aa9908d458c92eb0daf90eb3a |
|
21-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
event: add new kind of event source called "post"
This new event source is triggered by the dispatching of any non-post
event source. It can thus be used to do clean-up or recheck work,
triggered by any other event source having been executed.
This is different from "defer" event source which are unconditionally
triggered as long as they are enabled. A "defer" event source that does
nothing will result in the event loop busy looping unless it is turned
off eventually. This is different for "post" event sources that will be
only triggered when some other non-post ran, and will thus not keep the
event loop busy on its own. |
9ac441c0f40a10a6c498398e5876a5256b833e31 |
|
21-Feb-2014 |
Thomas Bächler <thomas@archlinux.org> |
sd-event: Fix systemd crash when using timer units.
There was a copy-paste error introduced in commit c2ba3ad6604ef2e189d7e0a36d6911116e84d3ab
which causes the following error when using timer units:
Assertion '(x->type == SOURCE_MONOTONIC && y->type == SOURCE_MONOTONIC) || (x->type == SOURCE_REALTIME && y->type == SOURCE_REALTIME)'
failed at src/libsystemd/sd-event/sd-event.c:264, function latest_time_prioq_compare(). Aborting. |
151b9b9662a90455262ce575a8a8ae74bf4ff336 |
|
20-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
api: in constructor function calls, always put the returned object pointer first (or second)
Previously the returned object of constructor functions where sometimes
returned as last, sometimes as first and sometimes as second parameter.
Let's clean this up a bit. Here are the new rules:
1. The object the new object is derived from is put first, if there is any
2. The object we are creating will be returned in the next arguments
3. This is followed by any additional arguments
Rationale:
For functions that operate on an object we always put that object first.
Constructors should probably not be too different in this regard. Also,
if the additional parameters might want to use varargs which suggests to
put them last.
Note that this new scheme only applies to constructor functions, not to
all other functions. We do give a lot of freedom for those.
Note that this commit only changes the order of the new functions we
added, for old ones we accept the wrong order and leave it like that. |
39883f622f392d8579f4428fc5a789a102efbb10 |
|
19-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
make gcc shut up
If -flto is used then gcc will generate a lot more warnings than before,
among them a number of use-without-initialization warnings. Most of them
without are false positives, but let's make them go away, because it
doesn't really matter. |
7a0d4a3d16855bac2ce2f2973122dae1ed069dff |
|
19-Feb-2014 |
David Herrmann <dh.herrmann@gmail.com> |
event: fix crash on child-source state modifications
Setting a child-source state to anything but SD_EVENT_OFF currently does
nothing. The condition logic is flawed. Move the state update *below* the
test for the previous state.
Fixes a crash if you call:
sd_event_source_set_enabled(source, SD_EVENT_ON);
sd_event_source_unref(source);
on a child-source in its own callback. |
607553f9306286fdccf0b356bc3d1087adfe21c4 |
|
21-Jan-2014 |
Tom Gundersen <teg@jklm.no> |
libsystemd: split up into subdirs
We still only produce on .so, but let's keep the sources separate to make things a bit
less messy. |