cid_valid(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ cid_valid(9) ✨

okay so bestie, welcome to the cid_valid(9) page β€” that's the kernel API manual, and yes we're gonna read it together, it's short and it's iconic πŸ’…


πŸŽ€ NAME πŸŽ€

cid_valid β€” verify a cid value, to be used on ops input args. that's literally the whole job description and she does it well 🫢


🌸 SYNOPSIS 🌸

bool cid_valid (struct scx_sched *sch , s32 cid );

πŸ’– ARGUMENTS πŸ’–

  • sch β€” the scx_sched that gets aborted on error 😭 like, if things go bad, this is the one catching the fallout.
  • cid β€” the cid which came from a BPF ops ✨ it's giving "value from the outside world", so of course we gotta check it.

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea β˜• β€” this function returns true if cid is in [0, num_possible_cpus) πŸ‘‘ that's the sweet spot, that's the range, that's where we want her to be.

on failure? it triggers scx_error and returns false πŸ’€ no cap, that's the whole flow. validate, and if it doesn't vibe check out, error out and say no.


🌈 SEE ALSO 🌈

kernel file ./kernel/sched/ext/cid.h β€” and the whole friend group:


ngl bestie, if you're out here passing a cid from a BPF ops without checking it first, this page is your sign 🫢 use the validator, protect your scheduler, periodt πŸ’œ

and that's the page!! sign-off time πŸŽ€ this one lives in ./kernel/sched/ext, dated October 2026 β€” mwah, go forth and validate responsibly, iykyk πŸ§šπŸ’–

πŸ“¦ where this page comes from