mod_timer(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… mod_timer(9) πŸ’…

Hey bestie! Welcome to the Kernel API Manual, section 9 β€” this is literally the mod_timer(9) page and it's iconic. Iykyk. ✨


✨ NAME ✨

mod_timer β€” Modify a timer's timeout πŸŽ€

So like, if you've got a timer and you need to change when it goes off, this is your girl. Periodt.


🌸 SYNOPSIS 🌸

int mod_timer (struct timer_list *timer , unsigned long expires );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • timer β€” the timer you're modifying. It's giving main character energy, fr fr. πŸ’–
  • expires β€” the new absolute timeout in jiffies. Not relative, bestie β€” absolute. No cap. ⏰

πŸ’– DESCRIPTION πŸ’–

Okay so literally, calling mod_timer(timer, expires) is equivalent to this whole vibe:

timer_delete(timer); timer->expires = expires; add_timer(timer);

But mod_timer ate and left no crumbs because it's more efficient than writing out that open-coded sequence yourself. Slay. πŸ’…

In case the timer is inactive, the timer_delete part is a total NOP β€” it's just vibing, doing absolutely nothing. But the timer is in any case activated with the new expiry time expires. So either way, she's going off at the new time. πŸ”₯

🚨 Caution vibes, bestie! If there are multiple unserialized concurrent users of the same timer, then mod_timer is literally the only safe way to modify the timeout. Why? Because add_timer cannot modify an already running timer. So don't come for me with add_timer when things are already in motion. This is not a drill. 😭

And if timer->function == NULL then the start operation is silently discarded. In this case the return value is 0 and, ngl, it's meaningless. So don't @ me. πŸ™ˆ


🌈 RETURN 🌈

  • 0 β€” The timer was inactive and started, or was in shutdown state and the operation was discarded. Basically, it's a "nothing happened" kinda vibe. πŸ’€
  • 1 β€” The timer was active and requeued to expire at expires, or the timer was active and not modified because expires did not change the effective expiry time. Either way, she's active and doing her thing. πŸ‘‘

πŸ‘‘ SEE ALSO πŸ‘‘

Here's the whole squad β€” every single reference, no skips, no cap: 🫢


This page is brought to you by the ./kernel/time besties, dropping October 2026. mod_timer(9) out β€” stay slay, stay safe, and may your timers always be efficiently modified. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from