COREDUMP_WRITE(9)

πŸ“¦ version 11.0, in nixpkgs unstable

✨ COREDUMP_WRITE(9) ✨

okay so bestie, welcome to the coredump_write era of the NetBSD Kernel Developer's Manual πŸŽ€ (yes it's a section 9 page, yes we're reading it, yes we're thriving).


πŸ’– NAME πŸ’–

coredump_write β€” the common coredump write routine, aka the little legend that actually puts your crash info onto disk 🫢


🌸 SYNOPSIS 🌸

#include <sys/signalvar.h>

int
coredump_write(void *iocookie, enum uio_seg segflg, const void *data,
    size_t len);

literally just include the header and call it, iykyk ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so coredump_write() is the shared bestie used by both machine-dependent and machine-independent components to write information to a coredump πŸ’… no cap, both sides use the same routine.

let's break down the args, because we love a signature:

  • iocookie β€” an opaque pointer that was supplied to the caller of coredump_write(). it's giving "don't look at me, i'm just the cookie" πŸ™ˆ
  • segflg β€” tells you where the data is located: system space or user space. vibe check on the memory region ✨
  • data β€” points to the information to be written to the coredump πŸ“
  • len β€” the amount of data to be written. the length. the size. the moment πŸ”₯

and the return? coredump_write() returns 0 on success and an appropriate error code on failure. periodt πŸ’€


πŸ‘‘ CODE REFERENCES πŸ‘‘

where does the magic happen? bestie, i got you, here's the map πŸ—ΊοΈ

  • Process core dumps are initiated within the file sys/kern/kern_sig.c 🌈
  • Process core dumps for ELF NetBSD binaries are performed within the files sys/kern/core_elf32.c or sys/kern/core_elf64.c ⭐
  • Process core dumps for other NetBSD binaries are performed within the file sys/kern/core_netbsd.c πŸ’œ

🧚 SEE ALSO 🧚

  • cpu_coredump(9) β€” go read that one next, bestie, it's iconic πŸ‘‘

and that's the whole page, fr fr πŸ’– this was Debian, December 24, 2005 β€” happy holidays to this manpage specifically πŸŽ€βœ¨ slay, and good luck out there with your coredumps 🫢

πŸ“¦ where this page comes from