add_timer(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– add_timer(9) β€” like, the "start a timer" girlie πŸ’–

okay so this is a page from the Kernel API Manual (add_timer(9)) and bestie, it's honestly so straightforward. we're starting a timer. that's the whole vibe. let me walk you through it πŸŽ€


✨ NAME ✨

add_timer β€” Start a timer πŸ•


✨ SYNOPSIS ✨

void add_timer (struct timer_list *timer );

like, that's it. one function, void return, one pointer. clean. iconic. πŸ’…


✨ ARGUMENTS ✨

  • timer β€” The timer to be started. that's the one, that's the main character 🌟

✨ DESCRIPTION ✨

okay so what this does: you start timer so it expires at timer->expires in the future. and timer->expires is the absolute expiry time, measured in 'jiffies' β€” not relative, absolute, so don't come at it with "in 5 seconds" energy, it wants the actual tick number fr fr ⏰

when the timer expires, timer->function(timer) gets invoked from soft interrupt context. not regular context. softirq. noted πŸ‘‘

⚠️ before you call this, timer->expires and timer->function must both already be set. both. of them. no skipping, no "it'll be fine" β€” it will not be fine πŸ™ˆ

and here's the little quirks, because of course there are quirks:

  • if timer->function == NULL, the start operation is silently discarded. like it just... doesn't happen. no error, no fuss, no warning. just vibes and nothingness πŸ’€
  • if timer->expires is already in the past, the timer gets queued to expire at the next timer tick. close enough, we move πŸ¦‹
  • this can only operate on an inactive timer. if you try to invoke it on an active timer, it gets rejected with a warning. so do a vibe check on that timer state first, bestie, seriously 🚨

✨ SEE ALSO ✨

the whole friend group, literally all of them, no cap:

like I said. the whole group chat. go say hi πŸ’œ


and that's the page!! this one lives in ./kernel/time and it's dated October 2026 β€” so yeah, mark your calendar, that's the version and date we're repping πŸ—“οΈβœ¨ slay, you now understand add_timer(9). periodt. 🌈🫢

πŸ“¦ where this page comes from