<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/fdm.c, branch 1.25.0</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.25.0</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.25.0'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2025-07-21T13:44:24Z</updated>
<entry>
<title>fdm: when logging signal related errors, include the signal name</title>
<updated>2025-07-21T13:44:24Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-07-21T13:28:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=21db6a6cdc68a5a8b9561d07d3ef69e11d2a077e'/>
<id>urn:sha1:21db6a6cdc68a5a8b9561d07d3ef69e11d2a077e</id>
<content type='text'>
Since sigabbrev_np() is GNU only, provide a fallback function that
returns "SIG&lt;signo&gt;" when sigabbrev_np() doesn't exist (for example,
on FreeBSD).
</content>
</entry>
<entry>
<title>Explicitly initialize sigaction::sa_mask members with sigemptyset(3)</title>
<updated>2022-02-12T12:26:42Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2022-02-12T12:04:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=23cf80667a36aaff1865fc50afab3f98a796cf14'/>
<id>urn:sha1:23cf80667a36aaff1865fc50afab3f98a796cf14</id>
<content type='text'>
Not doing so before calling sigaction(3) is "undefined" according to
POSIX[1]:

&gt; Applications shall call either sigemptyset() or sigfillset() at least
&gt; once for each object of type sigset_t prior to any other use of that
&gt; object. If such an object is not initialized in this way, but is
&gt; nonetheless supplied as an argument to any of pthread_sigmask(),
&gt; sigaction(), sigaddset(), sigdelset(), sigismember(), sigpending(),
&gt; sigprocmask(), sigsuspend(), sigtimedwait(), sigwait(), or
&gt; sigwaitinfo(), the results are undefined.

The use of designated initializers means that sa_mask members were
still being initialized, but sigset_t is an opaque type and implicit
initialization doesn't necessarily produce the same results as using
sigemptyset(3) (although it typically does on most implementations).

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaddset.html
</content>
</entry>
<entry>
<title>fdm: always check for signals after epoll_pwait(), not only on EINTR</title>
<updated>2021-05-21T18:00:45Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-05-21T18:00:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=890dbc49cf440cb765a4d758abab6e39dc9b2e73'/>
<id>urn:sha1:890dbc49cf440cb765a4d758abab6e39dc9b2e73</id>
<content type='text'>
This fixes an issue where we, at least on FreeBSD, sometimes get stuck
in epoll_pwait() after the shell has exited.

It turned out to be because the SIGCHLD signal was delivered at the
same time FDs were made readable/writeable. I.e. epoll_pwait()
returned a non-zero value even though it should have been interrupted
by the SIGCHLD.

To avoid having to search the entire signal array *every time*
epoll_pwait() returns, add a flag that is set in the signal
handler. This tells the FDM to scan the signal array after returning
from epoll_pwait().
</content>
</entry>
<entry>
<title>spawn/slave: restore signal mask after fork</title>
<updated>2021-02-21T18:59:50Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-21T10:57:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=dd5c31657ee934c52f24fd77778c56468d668b45'/>
<id>urn:sha1:dd5c31657ee934c52f24fd77778c56468d668b45</id>
<content type='text'>
slave: no need to restore signal handlers; they are automatically
restored as long as they are not SIG_IGN (which they never are in
foot).

spawn(): restore signal mask after fork. This fixes an issue where a
terminal spawned with ctrl+shift+n did not terminate when its shell
exited.

Closes #366
</content>
</entry>
<entry>
<title>fdm: add support for managing signals</title>
<updated>2021-02-11T17:55:21Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-10T15:17:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=863ae1143f9336f300c300c4d62165c3eac22834'/>
<id>urn:sha1:863ae1143f9336f300c300c4d62165c3eac22834</id>
<content type='text'>
Add fdm_signal_add() and fdm_signal_del(). Signals added to the fdm
will be monitored, and the provided callback called as “soon as
possible” from the main context (i.e not from the signal handler
context).

Monitored signals are *blocked* by default. We use epoll_pwait() to
unblock them while we’re polling. This allows us to do race-free
signal detection.

We use a single handler for all monitored signals; the handler simply
updates the signal’s slot in a global array (sized to fit SIGRTMAX
signals).

When epoll_pwait() returns EINTR, we loop the global array. The
callback associated with each signal that fired is called.
</content>
</entry>
<entry>
<title>Convert all but 2 remaining uses of xassert(false) to BUG("...")</title>
<updated>2021-02-10T09:01:51Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2021-02-10T09:01:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3c86af52c2a3e9352a88e969392575e55c3b6f74'/>
<id>urn:sha1:3c86af52c2a3e9352a88e969392575e55c3b6f74</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Convert some uses of xassert(false) to BUG("some error message")</title>
<updated>2021-02-09T13:52:33Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2021-02-09T13:52:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=1ec56844387ed910b7e87bae186b58cc22cc317a'/>
<id>urn:sha1:1ec56844387ed910b7e87bae186b58cc22cc317a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>debug: rename assert() to xassert(), to avoid clashing with &lt;assert.h&gt;</title>
<updated>2021-01-16T20:16:00Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2021-01-16T20:16:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e56136ce1192d04a52b01ccb41284f0b7896430e'/>
<id>urn:sha1:e56136ce1192d04a52b01ccb41284f0b7896430e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Print stack trace on assert() failure or when calling fatal_error()</title>
<updated>2021-01-16T19:56:33Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2021-01-15T20:39:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=22f25a9e4feddbc093ae01cd53bdda3c2c3a82e9'/>
<id>urn:sha1:22f25a9e4feddbc093ae01cd53bdda3c2c3a82e9</id>
<content type='text'>
Note: this uses the __sanitizer_print_stack_trace() function from the
AddressSanitizer runtime, so it only works when AddressSanitizer is
in use.
</content>
</entry>
<entry>
<title>fdm: do *not* keep polling on EINTR</title>
<updated>2020-12-04T17:36:53Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-12-04T17:36:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=384ba4d30d4a77751a8068d9aebaaee2c02cf10c'/>
<id>urn:sha1:384ba4d30d4a77751a8068d9aebaaee2c02cf10c</id>
<content type='text'>
This fixes an issue where foot --server did not exit on SIGINT. This
happened because we never returned out from fdm_poll(), and thus we
never saw ‘aborted’ being set.
</content>
</entry>
<entry>
<title>fdm: keep polling on EINTR</title>
<updated>2020-11-26T17:23:01Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-11-26T17:23:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=15b35b7641955949acaa209986ff3fa8b7f1a98e'/>
<id>urn:sha1:15b35b7641955949acaa209986ff3fa8b7f1a98e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Cast printf formatter %p arguments to void*</title>
<updated>2020-08-23T08:07:08Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-08-23T05:50:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e32c0d9bf698782353bbe9e4348617523af473bd'/>
<id>urn:sha1:e32c0d9bf698782353bbe9e4348617523af473bd</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Convert most dynamic allocations to use functions from xmalloc.h</title>
<updated>2020-08-08T19:37:57Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2020-08-08T19:34:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=7a77958ba20c2b344be5e66e69e2f212a4bbf6b3'/>
<id>urn:sha1:7a77958ba20c2b344be5e66e69e2f212a4bbf6b3</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fdm: fix log message</title>
<updated>2020-01-10T18:22:41Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-10T18:22:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a07de9ef3c402371b5a484b6eb2271ec31a774b9'/>
<id>urn:sha1:a07de9ef3c402371b5a484b6eb2271ec31a774b9</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fdm: verify FDs are non-blocking (debug builds only)</title>
<updated>2020-01-10T18:22:10Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-10T18:22:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=698d5fdf06b79b66633629c7a387fa26ff352eca'/>
<id>urn:sha1:698d5fdf06b79b66633629c7a387fa26ff352eca</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fdm: add hook priorities</title>
<updated>2020-01-04T22:26:27Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-04T22:26:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=6534f64e6a1dfa21d8d99a195122035d741f7d65'/>
<id>urn:sha1:6534f64e6a1dfa21d8d99a195122035d741f7d65</id>
<content type='text'>
There are now three hook priorities: low, normal, high.

High priority hooks are executed *first*. Normal next, and last the
low priority hooks.

The renderer's terminal refresh hook now runs as a normal priority
hook.
</content>
</entry>
<entry>
<title>fdm: add support for hooks</title>
<updated>2020-01-04T18:48:15Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-04T18:48:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a3c18e72f5804051c5111fea5f4fca488fa088ca'/>
<id>urn:sha1:a3c18e72f5804051c5111fea5f4fca488fa088ca</id>
<content type='text'>
Hooks are functions executed just before going into a poll(). Or just
after executing all FD handlers, if you like.
</content>
</entry>
<entry>
<title>fdm: close fd even if we didn't find it in our list</title>
<updated>2019-12-15T14:06:09Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-12-15T14:06:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5106937c7b24933bb1f906f672606147c4bac1cb'/>
<id>urn:sha1:5106937c7b24933bb1f906f672606147c4bac1cb</id>
<content type='text'>
This behavior is debatable, but helps in error handling where we're
removing a bunch of descriptors where not all of them have been added
to the FDM yet.
</content>
</entry>
<entry>
<title>tllist: is now an external "library", so use &lt;&gt; includes</title>
<updated>2019-11-17T18:19:55Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-11-17T18:19:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=29cccadd1d9c372b3861bb0c285628bb374da2ba'/>
<id>urn:sha1:29cccadd1d9c372b3861bb0c285628bb374da2ba</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fdm: invert check to get rid of one level of indentation</title>
<updated>2019-11-02T23:52:24Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-11-02T23:42:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=777d851282a59fcfacc19b9232b9ad80c412efdf'/>
<id>urn:sha1:777d851282a59fcfacc19b9232b9ad80c412efdf</id>
<content type='text'>
</content>
</entry>
</feed>
