STARTUPHOOK_ESTABLISH(9)
π STARTUPHOOK_ESTABLISH(9) π
okay bestie, welcome to the Kernel Developer's Manual corner where we talk startup hooks. This page is about startuphook_establish and startuphook_disestablish β the add/remove duo for startup hooks. Itβs giving very specific kernel timing, and honestly? iconic. β¨
πΈ NAME πΈ
startuphook_establish, startuphook_disestablish β the duo that adds or removes a startup hook.
β¨ SYNOPSIS β¨
#include <sys/types.h>
#include <sys/systm.h>
void *
startuphook_establish(void (*fn)(void *), void *arg);
void
startuphook_disestablish(void *cookie);
π DESCRIPTION π
So startuphook_establish() adds fn to the list of hooks that dostartuphooks(9) invokes at startup. When that hook gets invoked, the hook function fn receives arg as its only argument. Periodt.
startuphook_disestablish() removes the hook described by the opaque pointer cookie from the list of hooks to be invoked at startup. If cookie is invalid, the result of startuphook_disestablish() is undefined.
π¨ undefined behavior alert: invalidcookiemeans all bets are off forstartuphook_disestablish().
Startup hooks are for one-time activities that must happen immediately before the root and swap devices are configured, but after normal device autoconfiguration. That timing window is the whole vibe. Also, startup hooks are implemented via the more general dohooks(9) API. iykyk.
π«Ά RETURN VALUES π«Ά
If it works, startuphook_establish() returns an opaque pointer describing the newly established startup hook. If not, it returns NULL. No cap.
π¦ SEE ALSO π¦
π BUGS π
ngl, the names are clumsy, at best. The functionality ate, but the naming? Not so much. π
π cute sign-off: this page comes from Debian, dated December 10, 2014. bye bestie, go establish those hooks responsibly! π
π¦ where this page comes from
- nixpkgs unstable: cvs-export
- Copyright (c) 1995 Niklas Hallqvist
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms