Info

struct linux_binfmt {

struct linux_binfmt * next; struct module *module;

int (*load_binary)(struct linux_binprm *, struct pt_regs * regs); int (*load_shlib)(struct file *);

int (*core_dump)(long signr, struct pt_regs * regs, struct file * file); unsigned long min_coredump; /* minimal dump size */

Each binary format must provide three functions:

1. load_binary to load normal programs.

2. load_shlib to load a shared library, that is, a dynamic library.

3. core_dump to write a core dump if there is a program error. This dump can subsequently be analyzed using a debugger (e.g., gdb) for troubleshooting purposes. min_coredump is a lower bound on the core file size from which a coredump will be generated (usually, this is the size of a single memory page).

Each binary format must first be registered in the kernel using register_binfmt. The purpose of this function is to add a new binary format to a linked list whose list head is represented by the formats global variable from fs/exec.c. The linux_binfmt instances are linked with each other by means of their next element.

Continue reading here: Exiting Processes

Was this article helpful?

0 0