sd-event: rename output parameters to ret

This commit is contained in:
Yu Watanabe 2024-10-10 10:01:24 +09:00
parent 50ed3b1682
commit ff5ba2d6fe
10 changed files with 67 additions and 67 deletions

View File

@ -66,7 +66,7 @@
<funcprototype>
<funcdef>int <function>sd_event_source_get_child_pid</function></funcdef>
<paramdef>sd_event_source *<parameter>source</parameter></paramdef>
<paramdef>pid_t *<parameter>pid</parameter></paramdef>
<paramdef>pid_t *<parameter>ret</parameter></paramdef>
</funcprototype>
<funcprototype>

View File

@ -57,7 +57,7 @@
<funcprototype>
<funcdef>int <function>sd_event_source_get_io_events</function></funcdef>
<paramdef>sd_event_source *<parameter>source</parameter></paramdef>
<paramdef>uint32_t *<parameter>events</parameter></paramdef>
<paramdef>uint32_t *<parameter>ret</parameter></paramdef>
</funcprototype>
<funcprototype>
@ -69,7 +69,7 @@
<funcprototype>
<funcdef>int <function>sd_event_source_get_io_revents</function></funcdef>
<paramdef>sd_event_source *<parameter>source</parameter></paramdef>
<paramdef>uint32_t *<parameter>revents</parameter></paramdef>
<paramdef>uint32_t *<parameter>ret</parameter></paramdef>
</funcprototype>
<funcprototype>

View File

@ -67,7 +67,7 @@
<funcprototype>
<funcdef>int <function>sd_event_source_get_time</function></funcdef>
<paramdef>sd_event_source *<parameter>source</parameter></paramdef>
<paramdef>uint64_t *<parameter>usec</parameter></paramdef>
<paramdef>uint64_t *<parameter>ret</parameter></paramdef>
</funcprototype>
<funcprototype>
@ -85,7 +85,7 @@
<funcprototype>
<funcdef>int <function>sd_event_source_get_time_accuracy</function></funcdef>
<paramdef>sd_event_source *<parameter>source</parameter></paramdef>
<paramdef>uint64_t *<parameter>usec</parameter></paramdef>
<paramdef>uint64_t *<parameter>ret</parameter></paramdef>
</funcprototype>
<funcprototype>
@ -97,7 +97,7 @@
<funcprototype>
<funcdef>int <function>sd_event_source_get_time_clock</function></funcdef>
<paramdef>sd_event_source *<parameter>source</parameter></paramdef>
<paramdef>clockid_t *<parameter>clock</parameter></paramdef>
<paramdef>clockid_t *<parameter>ret</parameter></paramdef>
</funcprototype>
</funcsynopsis>

View File

@ -35,7 +35,7 @@
<funcprototype>
<funcdef>int <function>sd_event_get_exit_code</function></funcdef>
<paramdef>sd_event *<parameter>event</parameter></paramdef>
<paramdef>int *<parameter>code</parameter></paramdef>
<paramdef>int *<parameter>ret</parameter></paramdef>
</funcprototype>
</funcsynopsis>
@ -66,7 +66,7 @@
otherwise no further operation is executed.</para>
<para><function>sd_event_get_exit_code()</function> may be used to query the exit code passed to an
earlier call of <function>sd_event_exit()</function>. The return parameter <parameter>code</parameter>
earlier call of <function>sd_event_exit()</function>. The return parameter <parameter>ret</parameter>
may be set to <constant>NULL</constant>, in order to simply check if <function>sd_event_exit()</function>
has been called before (as <function>sd_event_get_exit_code()</function> fails with
<constant>-ENODATA</constant> if that's not the case, see below).</para>

View File

@ -61,7 +61,7 @@
<funcprototype>
<funcdef>int <function>sd_event_get_tid</function></funcdef>
<paramdef>sd_event *<parameter>event</parameter></paramdef>
<paramdef>pid_t *<parameter>tid</parameter></paramdef>
<paramdef>pid_t *<parameter>ret</parameter></paramdef>
</funcprototype>
</funcsynopsis>

View File

@ -29,7 +29,7 @@
<funcdef>int <function>sd_event_now</function></funcdef>
<paramdef>sd_event *<parameter>event</parameter></paramdef>
<paramdef>clockid_t <parameter>clock</parameter></paramdef>
<paramdef>uint64_t *<parameter>usec</parameter></paramdef>
<paramdef>uint64_t *<parameter>ret</parameter></paramdef>
</funcprototype>
</funcsynopsis>
@ -52,7 +52,7 @@
<constant>CLOCK_BOOTTIME_ALARM</constant>), see
<citerefentry project='man-pages'><refentrytitle>clock_gettime</refentrytitle><manvolnum>2</manvolnum></citerefentry>
for more information on the various clocks. The retrieved
timestamp is stored in the <parameter>usec</parameter> parameter,
timestamp is stored in the <parameter>ret</parameter> parameter,
in μs since the clock's epoch. If this function is invoked before
the first event loop iteration, the current time is returned, as
reported by <function>clock_gettime()</function>. To distinguish
@ -65,8 +65,8 @@
<title>Return Value</title>
<para>If the first event loop iteration has not run yet <function>sd_event_now()</function> writes
current time to <parameter>usec</parameter> and returns a positive return value. Otherwise, it will
write the requested timestamp to <parameter>usec</parameter> and return 0. On failure, the call returns a
current time to <parameter>ret</parameter> and returns a positive return value. Otherwise, it will
write the requested timestamp to <parameter>ret</parameter> and return 0. On failure, the call returns a
negative errno-style error code.</para>
<refsect2>

View File

@ -35,7 +35,7 @@
<funcprototype>
<funcdef>int <function>sd_event_source_get_description</function></funcdef>
<paramdef>sd_event_source *<parameter>source</parameter></paramdef>
<paramdef>const char **<parameter>description</parameter></paramdef>
<paramdef>const char **<parameter>ret</parameter></paramdef>
</funcprototype>
</funcsynopsis>
@ -61,7 +61,7 @@
<para><function>sd_event_source_get_description()</function> may
be used to query the current descriptive name assigned to the
event source object <parameter>source</parameter>. It returns a
pointer to the current name in <parameter>description</parameter>,
pointer to the current name in <parameter>ret</parameter>,
stored in memory internal to the event source. The memory is
invalidated when the event source is destroyed or the descriptive
name is changed.</para>

View File

@ -44,7 +44,7 @@
<funcprototype>
<funcdef>int <function>sd_event_source_get_enabled</function></funcdef>
<paramdef>sd_event_source *<parameter>source</parameter></paramdef>
<paramdef>int *<parameter>enabled</parameter></paramdef>
<paramdef>int *<parameter>ret</parameter></paramdef>
</funcprototype>
</funcsynopsis>
@ -69,10 +69,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. If both the
<parameter>source</parameter> and the output parameter <parameter>enabled</parameter> are
<parameter>source</parameter> and the output parameter <parameter>ret</parameter> are
<constant>NULL</constant>, this function returns false. Otherwise, <parameter>source</parameter> must be
a valid pointer to an <structname>sd_event_source</structname> object. If the output parameter
<parameter>enabled</parameter> is not <constant>NULL</constant>, it is set to the enablement state (one
<parameter>ret</parameter> is not <constant>NULL</constant>, it is set to the enablement state (one
of <constant>SD_EVENT_ON</constant>, <constant>SD_EVENT_OFF</constant>,
<constant>SD_EVENT_ONESHOT</constant>). The function also returns true if the event source is not
disabled.</para>

View File

@ -2618,14 +2618,14 @@ _public_ int sd_event_source_set_description(sd_event_source *s, const char *des
return free_and_strdup(&s->description, description);
}
_public_ int sd_event_source_get_description(sd_event_source *s, const char **description) {
_public_ int sd_event_source_get_description(sd_event_source *s, const char **ret) {
assert_return(s, -EINVAL);
assert_return(description, -EINVAL);
assert_return(ret, -EINVAL);
if (!s->description)
return -ENXIO;
*description = s->description;
*ret = s->description;
return 0;
}
@ -2705,13 +2705,13 @@ _public_ int sd_event_source_set_io_fd_own(sd_event_source *s, int own) {
return 0;
}
_public_ int sd_event_source_get_io_events(sd_event_source *s, uint32_t* events) {
_public_ int sd_event_source_get_io_events(sd_event_source *s, uint32_t *ret) {
assert_return(s, -EINVAL);
assert_return(events, -EINVAL);
assert_return(ret, -EINVAL);
assert_return(s->type == SOURCE_IO, -EDOM);
assert_return(!event_origin_changed(s->event), -ECHILD);
*events = s->io.events;
*ret = s->io.events;
return 0;
}
@ -2743,14 +2743,14 @@ _public_ int sd_event_source_set_io_events(sd_event_source *s, uint32_t events)
return 0;
}
_public_ int sd_event_source_get_io_revents(sd_event_source *s, uint32_t* revents) {
_public_ int sd_event_source_get_io_revents(sd_event_source *s, uint32_t *ret) {
assert_return(s, -EINVAL);
assert_return(revents, -EINVAL);
assert_return(ret, -EINVAL);
assert_return(s->type == SOURCE_IO, -EDOM);
assert_return(s->pending, -ENODATA);
assert_return(!event_origin_changed(s->event), -ECHILD);
*revents = s->io.revents;
*ret = s->io.revents;
return 0;
}
@ -2762,11 +2762,12 @@ _public_ int sd_event_source_get_signal(sd_event_source *s) {
return s->signal.sig;
}
_public_ int sd_event_source_get_priority(sd_event_source *s, int64_t *priority) {
_public_ int sd_event_source_get_priority(sd_event_source *s, int64_t *ret) {
assert_return(s, -EINVAL);
assert_return(ret, -EINVAL);
assert_return(!event_origin_changed(s->event), -ECHILD);
*priority = s->priority;
*ret = s->priority;
return 0;
}
@ -3107,13 +3108,13 @@ _public_ int sd_event_source_set_enabled(sd_event_source *s, int m) {
return 0;
}
_public_ int sd_event_source_get_time(sd_event_source *s, uint64_t *usec) {
_public_ int sd_event_source_get_time(sd_event_source *s, uint64_t *ret) {
assert_return(s, -EINVAL);
assert_return(usec, -EINVAL);
assert_return(ret, -EINVAL);
assert_return(EVENT_SOURCE_IS_TIME(s->type), -EDOM);
assert_return(!event_origin_changed(s->event), -ECHILD);
*usec = s->time.next;
*ret = s->time.next;
return 0;
}
@ -3157,13 +3158,13 @@ _public_ int sd_event_source_set_time_relative(sd_event_source *s, uint64_t usec
return sd_event_source_set_time(s, usec);
}
_public_ int sd_event_source_get_time_accuracy(sd_event_source *s, uint64_t *usec) {
_public_ int sd_event_source_get_time_accuracy(sd_event_source *s, uint64_t *ret) {
assert_return(s, -EINVAL);
assert_return(usec, -EINVAL);
assert_return(ret, -EINVAL);
assert_return(EVENT_SOURCE_IS_TIME(s->type), -EDOM);
assert_return(!event_origin_changed(s->event), -ECHILD);
*usec = s->time.accuracy;
*ret = s->time.accuracy;
return 0;
}
@ -3189,23 +3190,23 @@ _public_ int sd_event_source_set_time_accuracy(sd_event_source *s, uint64_t usec
return 0;
}
_public_ int sd_event_source_get_time_clock(sd_event_source *s, clockid_t *clock) {
_public_ int sd_event_source_get_time_clock(sd_event_source *s, clockid_t *ret) {
assert_return(s, -EINVAL);
assert_return(clock, -EINVAL);
assert_return(ret, -EINVAL);
assert_return(EVENT_SOURCE_IS_TIME(s->type), -EDOM);
assert_return(!event_origin_changed(s->event), -ECHILD);
*clock = event_source_type_to_clock(s->type);
*ret = event_source_type_to_clock(s->type);
return 0;
}
_public_ int sd_event_source_get_child_pid(sd_event_source *s, pid_t *pid) {
_public_ int sd_event_source_get_child_pid(sd_event_source *s, pid_t *ret) {
assert_return(s, -EINVAL);
assert_return(pid, -EINVAL);
assert_return(ret, -EINVAL);
assert_return(s->type == SOURCE_CHILD, -EDOM);
assert_return(!event_origin_changed(s->event), -ECHILD);
*pid = s->child.pid;
*ret = s->child.pid;
return 0;
}
@ -4951,7 +4952,7 @@ _public_ int sd_event_get_state(sd_event *e) {
return e->state;
}
_public_ int sd_event_get_exit_code(sd_event *e, int *code) {
_public_ int sd_event_get_exit_code(sd_event *e, int *ret) {
assert_return(e, -EINVAL);
assert_return(e = event_resolve(e), -ENOPKG);
assert_return(!event_origin_changed(e), -ECHILD);
@ -4959,8 +4960,8 @@ _public_ int sd_event_get_exit_code(sd_event *e, int *code) {
if (!e->exit_requested)
return -ENODATA;
if (code)
*code = e->exit_code;
if (ret)
*ret = e->exit_code;
return 0;
}
@ -4976,10 +4977,10 @@ _public_ int sd_event_exit(sd_event *e, int code) {
return 0;
}
_public_ int sd_event_now(sd_event *e, clockid_t clock, uint64_t *usec) {
_public_ int sd_event_now(sd_event *e, clockid_t clock, uint64_t *ret) {
assert_return(e, -EINVAL);
assert_return(e = event_resolve(e), -ENOPKG);
assert_return(usec, -EINVAL);
assert_return(ret, -EINVAL);
assert_return(!event_origin_changed(e), -ECHILD);
if (!TRIPLE_TIMESTAMP_HAS_CLOCK(clock))
@ -4987,11 +4988,11 @@ _public_ int sd_event_now(sd_event *e, clockid_t clock, uint64_t *usec) {
if (!triple_timestamp_is_set(&e->timestamp)) {
/* Implicitly fall back to now() if we never ran before and thus have no cached time. */
*usec = now(clock);
*ret = now(clock);
return 1;
}
*usec = triple_timestamp_by_clock(&e->timestamp, clock);
*ret = triple_timestamp_by_clock(&e->timestamp, clock);
return 0;
}
@ -5019,18 +5020,17 @@ _public_ int sd_event_default(sd_event **ret) {
return 1;
}
_public_ int sd_event_get_tid(sd_event *e, pid_t *tid) {
_public_ int sd_event_get_tid(sd_event *e, pid_t *ret) {
assert_return(e, -EINVAL);
assert_return(e = event_resolve(e), -ENOPKG);
assert_return(tid, -EINVAL);
assert_return(ret, -EINVAL);
assert_return(!event_origin_changed(e), -ECHILD);
if (e->tid != 0) {
*tid = e->tid;
return 0;
}
if (e->tid == 0)
return -ENXIO;
return -ENXIO;
*ret = e->tid;
return 0;
}
_public_ int sd_event_set_watchdog(sd_event *e, int b) {

View File

@ -108,12 +108,12 @@ int sd_event_run(sd_event *e, uint64_t usec);
int sd_event_loop(sd_event *e);
int sd_event_exit(sd_event *e, int code);
int sd_event_now(sd_event *e, clockid_t clock, uint64_t *usec);
int sd_event_now(sd_event *e, clockid_t clock, uint64_t *ret);
int sd_event_get_fd(sd_event *e);
int sd_event_get_state(sd_event *e);
int sd_event_get_tid(sd_event *e, pid_t *tid);
int sd_event_get_exit_code(sd_event *e, int *code);
int sd_event_get_tid(sd_event *e, pid_t *ret);
int sd_event_get_exit_code(sd_event *e, int *ret);
int sd_event_set_watchdog(sd_event *e, int b);
int sd_event_get_watchdog(sd_event *e);
int sd_event_get_iteration(sd_event *e, uint64_t *ret);
@ -128,28 +128,28 @@ void* sd_event_source_get_userdata(sd_event_source *s);
void* sd_event_source_set_userdata(sd_event_source *s, void *userdata);
int sd_event_source_set_description(sd_event_source *s, const char *description);
int sd_event_source_get_description(sd_event_source *s, const char **description);
int sd_event_source_get_description(sd_event_source *s, const char **ret);
int sd_event_source_set_prepare(sd_event_source *s, sd_event_handler_t callback);
int sd_event_source_get_pending(sd_event_source *s);
int sd_event_source_get_priority(sd_event_source *s, int64_t *priority);
int sd_event_source_get_priority(sd_event_source *s, int64_t *ret);
int sd_event_source_set_priority(sd_event_source *s, int64_t priority);
int sd_event_source_get_enabled(sd_event_source *s, int *enabled);
int sd_event_source_get_enabled(sd_event_source *s, int *ret);
int sd_event_source_set_enabled(sd_event_source *s, int enabled);
int sd_event_source_get_io_fd(sd_event_source *s);
int sd_event_source_set_io_fd(sd_event_source *s, int fd);
int sd_event_source_get_io_fd_own(sd_event_source *s);
int sd_event_source_set_io_fd_own(sd_event_source *s, int own);
int sd_event_source_get_io_events(sd_event_source *s, uint32_t* events);
int sd_event_source_get_io_events(sd_event_source *s, uint32_t *ret);
int sd_event_source_set_io_events(sd_event_source *s, uint32_t events);
int sd_event_source_get_io_revents(sd_event_source *s, uint32_t* revents);
int sd_event_source_get_time(sd_event_source *s, uint64_t *usec);
int sd_event_source_get_io_revents(sd_event_source *s, uint32_t *ret);
int sd_event_source_get_time(sd_event_source *s, uint64_t *ret);
int sd_event_source_set_time(sd_event_source *s, uint64_t usec);
int sd_event_source_set_time_relative(sd_event_source *s, uint64_t usec);
int sd_event_source_get_time_accuracy(sd_event_source *s, uint64_t *usec);
int sd_event_source_get_time_accuracy(sd_event_source *s, uint64_t *ret);
int sd_event_source_set_time_accuracy(sd_event_source *s, uint64_t usec);
int sd_event_source_get_time_clock(sd_event_source *s, clockid_t *clock);
int sd_event_source_get_time_clock(sd_event_source *s, clockid_t *ret);
int sd_event_source_get_signal(sd_event_source *s);
int sd_event_source_get_child_pid(sd_event_source *s, pid_t *pid);
int sd_event_source_get_child_pid(sd_event_source *s, pid_t *ret);
int sd_event_source_get_child_pidfd(sd_event_source *s);
int sd_event_source_get_child_pidfd_own(sd_event_source *s);
int sd_event_source_set_child_pidfd_own(sd_event_source *s, int own);