Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

eventfd

This document describes the event file descriptor in the Kyronix kernel. It is the child of Filesystems.

Source

kernel/fs/eventfd.c

Overview

eventfd provides a lightweight signaling mechanism between processes or threads. It implements a 64-bit counter that can be read and written atomically.

Syscalls

SyscallNumberDescription
eventfd284Create eventfd with flags
eventfd2290Create eventfd with flags (O_CLOEXEC, O_NONBLOCK)

Operations

OperationBehavior
read()Blocks if counter is 0; otherwise returns counter and resets to 0
write()Adds to the counter atomically
poll()Returns readable when counter > 0, writable when counter < MAX

Implementation

eventfd instances are backed by a 64-bit atomic counter stored in the VFS node’s data field. Reads and writes are performed atomically using spinlocks.

Last reviewed: 2026-07-22