relay (formerly relayfs)

[home] [FAQ] [news] [examples] [contact]

Welcome to the official website for relay (formerly relayfs).

The relay project files (example apps and related stuff) can be found here. relay itself is in the mainline linux kernel and can be found there.

If you're interested in examples of things you can do with relay and/or example code, see the examples page.

NOTE: These pages are in transition and don't yet reflect the latest version of relayfs, which is now called 'relay' due to the 'fs' part of 'relayfs' being removed (the original functionality is exactly the same - the only difference is that the 'fs' role is now played by host filesystems such as debugfs). The examples section and the nice pictures apply to what was once the "new" or "redux" relayfs. I guess the new relay could be called the "new new" relayfs, which these pages haven't yet been updated for. Please see the FAQ for the difference between the "old", "new" and "new new" relayfs.

Latest news

03/24/07: The relay-apps examples have been updated to match the relay_open() API change in the 2.6.21 kernel.
08/23/06: The relay-apps examples have now been completely converted to creating their files in debugfs using the new 'relay' API.
02/19/06: As of 2.6.17, the fs part of relayfs has been removed and the rest of relayfs has been moved into kernel/relay.c. The functionality remains the same, the only difference being that the files representing the channel buffers will now live in a different filesystem.
01/08/06: The relayfs support for non-relay ("control") files, exported relay file operations, and global relayfs channels has been added to the mainline kernel (and removed from 2.6.15-mm3). The relay-apps examples (starting with relay-apps-0.90) now make use of these features.
09/10/05: An updated version of the 2.4 relayfs port is available.
09/07/05: relayfs is now in the mainline kernel (2.6.14).
08/10/05: Thanks to Hareesh Nagarajan, there is now a 2.4 relayfs port - see the project files.
03/12/05: relayfs included in the 2.6.11-mm3 kernel.

Older news...

What is relayfs?

Basically relayfs is just a bunch of per-cpu kernel buffers that can be efficiently written into from kernel code. These buffers are represented as files which can be mmap'ed and directly read from in user space. The purpose of this setup is to provide the simplest possible mechanism allowing potentially large amounts of data to be logged in the kernel and 'relayed' to user space.

See the official documentation for a more formal answer and a description of the API.

Here's a simple diagram illustrating the basic components of relayfs and a typical relayfs application:


This shows 4 cpus, each logging data to its own per-cpu kernel buffer via relay_write(), one of a few relayfs API functions used for writing data into a buffer (these functions automatically determine the correct buffer to write into based on the current cpu id). Each of the per-cpu buffers is represented by a user-specified filename in the relayfs file system. Once the filesystem is mounted, the kernel buffers can be mapped into the address space of a user space application by using mmap(2) on the corresponding relayfs file. As data becomes available in the kernel buffer, write(2) can be used to write it to disk, for example. That's pretty much all there is to it.

For more information on using relayfs, see the examples page. Logo