sd-event: make sd_event_source_get_enabled return more info

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-11-16 08:43:43 +01:00
parent 7d92a1a490
commit 08c1eb0e30
2 changed files with 11 additions and 9 deletions

View File

@ -74,8 +74,10 @@
<para><function>sd_event_source_get_enabled()</function> may be
used to query whether the event source object
<parameter>source</parameter> is currently enabled or not. It
returns the enablement state in
<parameter>enabled</parameter>.</para>
returns the enablement state (one of <constant>SD_EVENT_ON</constant>,
<constant>SD_EVENT_OFF</constant>, <constant>SD_EVENT_ONESHOT</constant>)
in <parameter>enabled</parameter>, if it is not <constant>NULL</constant>.
It also returns true if the event source is not disabled.</para>
<para>Event source objects are enabled when they are first created
with calls such as
@ -100,10 +102,10 @@
<refsect1>
<title>Return Value</title>
<para>On success, <function>sd_event_source_set_enabled()</function> and
<function>sd_event_source_get_enabled()</function> return a
non-negative integer. On failure, they return a negative
errno-style error code.</para>
<para>On success, <function>sd_event_source_set_enabled()</function> returns a non-negative
integer. <function>sd_event_source_get_enabled()</function> returns zero if the source is
disabled (<constant>SD_EVENT_OFF</constant>) and a positive integer otherwise. On failure, they
return a negative errno-style error code.</para>
</refsect1>
<refsect1>

View File

@ -2143,11 +2143,11 @@ fail:
_public_ int sd_event_source_get_enabled(sd_event_source *s, int *m) {
assert_return(s, -EINVAL);
assert_return(m, -EINVAL);
assert_return(!event_pid_changed(s->event), -ECHILD);
*m = s->enabled;
return 0;
if (m)
*m = s->enabled;
return s->enabled != SD_EVENT_OFF;
}
_public_ int sd_event_source_set_enabled(sd_event_source *s, int m) {