]> xenbits.xensource.com Git - unikraft/unikraft.git/commit
lib/posix-process: Add `signalfd`/`signalfd4` support
authorSergiu Moga <sergiu@unikraft.io>
Thu, 20 Mar 2025 17:54:14 +0000 (19:54 +0200)
committerUnikraft Bot <monkey@unikraft.io>
Wed, 23 Apr 2025 10:01:21 +0000 (10:01 +0000)
commit8e4c7d9c5ef6d0b63983cfbb48c5360b1aac2700
tree1d0006798aad42830cdd8e167777560317594e94
parent4ee5d840698b490423aaef7e934fe90ee18ce81c
lib/posix-process: Add `signalfd`/`signalfd4` support

Add support for the `signalfd`/`signalfd4` syscalls which will
allow callers to add monitored signal files to the current process,
allowing them to be notified of pending signals.

Introduce the primitives required for supporting signalfd: signal files.

These embed the actual base file structure, the mask that shows what
signals are being monitored as well as other file data to properly
register with libukfile.

Each process' signal descriptor holds control over the signal files
context which tracks the combined mask of all of the open signal files
as well as a list of their references. Having a combined mask helps
to make checking to see whether a process has signal files monitoring
for a given signal faster as compared to iterating every time through
each signal file and checking their masks.

Thus, adding a new signal file entry means updating the combined mask.
Deleting one implies resetting the signal mask and reiterating
through all remaining signal files for a proper combined mask. However,
as an optimization, we don't do that. Instead, we defer mask
recalculation until we need to reiterate through the signal files
again, which is when we have to notify the registered signal files
against a signal number.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
GitHub-Closes: #1619
lib/posix-process/Config.uk
lib/posix-process/Makefile.uk
lib/posix-process/exportsyms.uk
lib/posix-process/signal/signal.h
lib/posix-process/signal/signal_file.c [new file with mode: 0644]
lib/posix-process/signal/signal_file.h [new file with mode: 0644]