Name

sd_readahead — Control ongoing disk boot-time read-ahead operations

Synopsis

#include "sd-daemon.h"
int fsfuncsd_readahead(const char *action);
 

Notes

This function is provided by the reference implementation of APIs for controlling boot-time read-ahead and distributed with the systemd package. The algorithm it implements is simple, and can easily be reimplemented in daemons if it is important to support this interface without using the reference implementation.

Internally, this function creates a file in /run/systemd/readahead/ which is then used as flag file to notify the read-ahead subsystem.

For details about the algorithm check the liberally licensed reference implementation sources: http://cgit.freedesktop.org/systemd/tree/src/sd-readahead.c resp. http://cgit.freedesktop.org/systemd/tree/src/sd-readahead.h

sd_readahead() is implemented in the reference implementation's sd-readahead.c and sd-readahead.h files. These interfaces are available as shared library, which can be compiled and linked to with the libsystemd-daemon pkg-config(1) file. Alternatively, applications consuming this API may copy the implementation into their source tree. For more details about the reference implementation see sd-readahead(7).

If the reference implementation is used as drop-in files and -DDISABLE_SYSTEMD is set during compilation this function will always return 0 and otherwise become a NOP.