dev_coredumpm(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… dev_coredumpm(9) β€” the Kernel API Manual, bestie edition

okay so this is a page from the Kernel API Manual (section 9, kernel developer stuff, iykyk) and it's literally about dev_coredumpm β€” say it with me: dev-coredump-m. it's giving "my device crashed and we need to preserve the evidence" energy. let's get into it 🫢


✨ NAME ✨

dev_coredumpm β€” create a device coredump with read/free methods πŸ’–


🌸 SYNOPSIS 🌸

void dev_coredumpm (struct device *dev , struct module *owner , void
*data , size_t datalen , gfp_t gfp , ssize_t (*read)(char *buffer,
loff_t offset, size_t count, void *data, size_t datalen) , void
(*free)(void *data) );

like, that's the whole signature, no cap. it's a void function so it doesn't even return anything β€” it just does its thing. iconic behavior honestly πŸ‘‘


πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” the struct device for the crashed device. this is the main character of the whole operation πŸ’€
  • owner β€” the module that contains the read/free functions. use THIS_MODULE, periodt. don't overthink it.
  • data β€” data cookie for the read/free functions. it's literally just a lil cookie passed along, cute πŸ“
  • datalen β€” length of the data. the size, the amount, the big number energy.
  • gfp β€” allocation flags. idk your memory situation bestie, but these are your flags.
  • read β€” function to read from the given buffer. function signature is ssize_t (*read)(char *buffer, loff_t offset, size_t count, void *data, size_t datalen) ✨
  • free β€” function to free the given buffer. signature: void (*free)(void *data) 🧚

πŸ¦‹ DESCRIPTION πŸ¦‹

Creates a new device coredump for the given device. that's the whole assignment. slay.

here's the important plot twist though: if a previous one hasn't been read yet, the new coredump is discarded. so it's not stacking up old crashes forever, it's like "nope, you didn't read that one, moving on" πŸ™ˆ

The data lifetime is determined by the device coredump framework β€” you don't manage it, the framework does, it's very independent girlboss of it β€” and when it is no longer needed the free function will be called to free the data. so your free callback is the one doing the actual cleanup at the end. don't forget to register it fr fr 🫢


🌈 SEE ALSO 🌈

Kernel file ./include/linux/devcoredump.h β€” go read the header bestie, it's right there πŸ‘€


lowkey reminder: pass THIS_MODULE as owner, and remember your free gets called by the framework when the data is done being needed. don't be weird about it πŸ’…

okay that's the whole page!! source is ./include/linux, dated October 2026, and this is dev_coredumpm(9) signing off πŸ’œβœ¨ go crash some devices responsibly, mwah πŸŽ€

πŸ“¦ where this page comes from