Skip to content

signalfd4

Intro

signalfd4 - create a file descriptor to receive signals

Description

The signalfd4() system call is used to create an "eventfd" object which can be used to receive notifications of signals. It is similar to the signalfd() system call, but in addition it allows the user to specify an additional 'mask' parameter which can be used to limit which signals are monitored. The 'mask' parameter is a bitmask of the signals to monitor. The 'sizemask' parameter is the size of the 'mask' parameter in bytes. The 'flags' parameter can be used to fine-tune the behavior of the call.

Signalfd4() allows for very precise signal handling and can be used to reduce the amount of signal handling work a process needs to do. It can also be used to throttle signal delivery or prevent signal flooding.

Arguments

  • fd:int - file descriptor.
  • mask:const sigset_t*[K] - a bitmask of signals to monitoring, 0 to only monitor SIGIO.
  • sizemask:size_t - size of the 'mask' parameter, in bytes.
  • flags:int - flags to fine-tune the behavior of the call.

Available Tags

  • K - Originated from kernel-space.

Hooks

signalfd4

Type

Kprobe/Kretprobe

Purpose

To add instrumentation to the signalfd4() syscall to retrieve arguments and return value from the syscall

Example Use Case

For example, an application may need to wait for a signal to arrive and then process the signal. Rather than having to check for the signal periodically and receive it synchronously, the application can use signalfd4() to create a file descriptor that will be notified whenever the signal arrives.

Issues

This system call is not available in all systems, check for availability in the Linux manual page.

The related event to this syscall are read(), write(), poll(), signalfd() and exit().

This document was automatically generated by OpenAI and needs review. It might not be accurate and might contain errors. The authors of Tracee recommend that the user reads the "events.go" source file to understand the events and their arguments better.