1 #ifndef _LINUX_BINFMTS_H 2 #define _LINUX_BINFMTS_H 3 4 #include <linux/ptrace.h> 5 #include <linux/capability.h> 6 7 /* 8 * MAX_ARG_PAGES defines the number of pages allocated for arguments 9 * and envelope for the new program. 32 should suffice, this gives 10 * a maximum env+arg of 128kB w/4KB pages! 11 */ 12 #define MAX_ARG_PAGES 32 13 14 /* sizeof(linux_binprm->buf) */ 15 #define BINPRM_BUF_SIZE 128 16 17 #ifdef __KERNEL__ 18 19 /* 20 * This structure is used to hold the arguments that are used when loading binaries. 21 */ 22 struct linux_binprm{ 23 char buf[BINPRM_BUF_SIZE]; 24 struct page *page[MAX_ARG_PAGES]; 25 unsigned long p; /* current top of mem */ 26 int sh_bang; 27 struct file * file; 28 int e_uid, e_gid; 29 kernel_cap_t cap_inheritable, cap_permitted, cap_effective; 30 int argc, envc; 31 char * filename; /* Name of binary */ 32 unsigned long loader, exec; 33 }; 34 35 /* 36 * This structure defines the functions that are used to load the binary formats that 37 * linux accepts. 38 */ 39 struct linux_binfmt { 40 struct linux_binfmt * next; 41 struct module *module; 42 int (*load_binary)(struct linux_binprm *, struct pt_regs * regs); 43 int (*load_shlib)(struct file *); 44 int (*core_dump)(long signr, struct pt_regs * regs, struct file * file); 45 unsigned long min_coredump; /* minimal dump size */ 46 }; 47 48 extern int register_binfmt(struct linux_binfmt *); 49 extern int unregister_binfmt(struct linux_binfmt *); 50 51 extern int prepare_binprm(struct linux_binprm *); 52 extern void remove_arg_zero(struct linux_binprm *); 53 extern int search_binary_handler(struct linux_binprm *,struct pt_regs *); 54 extern int flush_old_exec(struct linux_binprm * bprm); 55 extern int setup_arg_pages(struct linux_binprm * bprm); 56 extern int copy_strings(int argc,char ** argv,struct linux_binprm *bprm); 57 extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm); 58 extern void compute_creds(struct linux_binprm *binprm); 59 extern int do_coredump(long signr, struct pt_regs * regs); 60 extern void set_binfmt(struct linux_binfmt *new); 61 62 63 #if 0 64 /* this went away now */ 65 #define change_ldt(a,b) setup_arg_pages(a,b) 66 #endif 67 68 #endif /* __KERNEL__ */ 69 #endif /* _LINUX_BINFMTS_H */ 70