cpuidle_enter(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’€ cpuidle_enter(9) β€” from the Kernel API Manual, bestie πŸ’€

okay so real talk, this is the function that literally puts your CPU to sleep 😴 and honestly? iconic. it's cpuidle_enter, straight out of the Kernel API Manual, and we're gonna get into it.


✨ NAME ✨

cpuidle_enter β€” the moment your CPU goes "aight imma head out" and enters the specified idle state πŸ›Œ


πŸ¦‹ SYNOPSIS πŸ¦‹

int cpuidle_enter (struct cpuidle_driver *drv , struct cpuidle_device *dev , int index );

that's the whole signature, no cap. three args, one int coming back at you πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • drv β€” the cpuidle driver that's tied with the cpu 🫢 like, this is the driver for this specific CPU, they're bonded, it's giving soulmate energy.
  • dev β€” the cpuidle device 🌸 your actual device struct, the main character of this whole operation.
  • index β€” the index in the idle state table πŸ“‹ which nap are we picking from the menu, bestie? that's the number.

🌈 DESCRIPTION 🌈

so what does it do? it returns the index in the idle state β€” like, the same index vibe comes back at you as the return value πŸ’«

and if things go wrong? it returns < 0 😭 yep, anything negative means error, and the specific error code depends on the backend driver β€” so like, don't come for cpuidle_enter, go ask the backend, it's the one holding the receipts πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

the kernel file in question is ./drivers/cpuidle/cpuidle.c πŸ“ β€” and here's the whole friend group, all of them (9) sections, all of them part of the lore:

(fr fr, that's every single one, I did not skip a single icon πŸ’–)


⚠️ friendly reminder bestie: an error is anything < 0, and which error you get is entirely up to the backend driver β€” do not assume, do not guess, read your backend. periodt.

and that's the page!! πŸŽ€ source is ./drivers/cpuidle, dated October 2026, and the whole thing lives under cpuidle_enter(9) β€” mwah, go put that CPU to bed πŸ’œβœ¨πŸ¦‹

πŸ“¦ where this page comes from