prepare_creds(9)
π prepare_creds β Kernel API Manual β¨
okay so bestie, welcome to the glow-up station for task credentials π this page lives in the prepare_creds(9) section of the Kernel API Manual, and honestly it's giving "backstage pass to the creds closet" energy. let's get into it π«Ά
πΈ NAME πΈ
prepare_creds β Prepare a new set of credentials for modification
like, the whole point is: you're about to change a task's creds, and this function hands you a shiny fresh copy to mess with π
β¨ SYNOPSIS β¨
struct cred * prepare_creds (void );
no cap, that's the whole thing. returns a struct cred *. slay.
π¦ ARGUMENTS π¦
voidβ no arguments. literally none. it takes nothing, it needs nothing, it's that girl π
π DESCRIPTION π
Prepare a new set of task credentials for modification. π
here's the tea, bestie: a task's creds shouldn't generally be modified directly β like, do not just go editing them in place, that's not the vibe and it's not allowed π so instead you call this function to prepare a new copy, which you then modify, and then you commit it by calling commit_creds. main character workflow, honestly π₯
Preparation involves making a copy of the objective creds for modification. that's it, that's the task. copy time π§
Returns a pointer to the new creds-to-be if successful, NULL otherwise. β so like, vibe check the return value before you go dereferencing anything, iykyk.
π important reminder: callcommit_credsorabort_credsto clean up. don't leave your new creds just floating there, that's rude, that's a leak, and we don't do that in this house π
π SEE ALSO π
Kernel file ./kernel/cred.c β plus these iconic little functions, go give them a read:
__put_cred(9)get_task_cred(9)commit_creds(9)abort_creds(9)cred_fscmp(9)prepare_kernel_cred(9)set_security_override(9)set_create_files_as(9)
and that's the page, bestie π
cute little sign-off: this one comes from ./kernel πΈ and it's dated October 2026 π and yes, it's still prepare_creds(9) at the bottom, we didn't lose her π mwah, go copy some creds responsibly π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms