sd-event: fix sd_event_source_get_inotify_path()

Follow-ups for 74c4231ce5.

Previously, the path is obtained from the fd, but it is closed in
sd_event_loop() to unpin the filesystem.
So, let's save the path when the event source is created, and make
sd_event_source_get_inotify_path() simply read it.
This commit is contained in:
Yu Watanabe
2024-04-20 11:14:32 +02:00
committed by Luca Boccassi
parent d762f4d52d
commit 4a7cd0caad
5 changed files with 55 additions and 23 deletions
+8 -4
View File
@@ -67,7 +67,7 @@
<funcprototype>
<funcdef>int <function>sd_event_source_get_inotify_path</function></funcdef>
<paramdef>sd_event_source *<parameter>source</parameter></paramdef>
<paramdef>char **<parameter>ret</parameter></paramdef>
<paramdef>const char **<parameter>ret</parameter></paramdef>
</funcprototype>
</funcsynopsis>
@@ -144,7 +144,8 @@
<para><function>sd_event_source_get_inotify_path()</function> retrieves the target path of the configured
inotify watch of an event source created previously with <function>sd_event_add_inotify()</function>. It
takes the event source object as the <parameter>source</parameter> parameter and a pointer to a
<type>char **</type> variable to return the path in. The caller needs to free the returned path.</para>
<type>const char **</type> variable to return the path in. The caller must not free the returned path.
</para>
</refsect1>
<refsect1>
@@ -207,8 +208,11 @@
<varlistentry>
<term><constant>-ENOSYS</constant></term>
<listitem><para><function>sd_event_add_inotify_fd()</function> was called without
<filename>/proc/</filename> mounted.</para></listitem>
<listitem>
<para><function>sd_event_add_inotify_fd()</function> or
<function>sd_event_source_get_inotify_path()</function> was called without
<filename>/proc/</filename> mounted.</para>
</listitem>
</varlistentry>