Ядро Linux в комментариях

       

Include/linux/binfmts.h


13770 #ifndef _LINUX_BINFMTS_H 13771 #define _LINUX_BINFMTS_H 13772 13773 #include <linux/ptrace.h> 13774 #include <linux/capability.h> 13775 13776 /* MAX_ARG_PAGES defines the number of pages allocated 13777 * for arguments and envelope for the new program. 32 13778 * should suffice, this gives a maximum env+arg of 128kB 13779 * w/4KB pages! */ 13780 #define MAX_ARG_PAGES 32 13781 13782 #ifdef __KERNEL__ 13783 13784 /* This structure is used to hold the arguments that are 13785 * used when loading binaries. */ 13786 struct linux_binprm{ 13787 char buf[128]; 13788 unsigned long page[MAX_ARG_PAGES]; 13789 unsigned long p; 13790 int sh_bang; 13791 int java; /* Java bin, prevent recursive invocation */ 13792 struct dentry * dentry; 13793 int e_uid, e_gid; 13794 kernel_cap_t cap_inheritable, cap_permitted, 13795 cap_effective; 13796 int argc, envc; 13797 char * filename; /* Name of binary */ 13798 unsigned long loader, exec; 13799 }; 13800 13801 /* This structure defines the functions that are used to 13802 * load the binary formats that linux accepts. */ 13803 struct linux_binfmt { 13804 struct linux_binfmt * next; 13805 struct module *module; 13806 int (*load_binary)(struct linux_binprm *, 13807 struct pt_regs * regs); 13808 int (*load_shlib)(int fd); 13809 int (*core_dump)(long signr, struct pt_regs * regs); 13810 }; 13811 13812 extern int register_binfmt(struct linux_binfmt *); 13813 extern int unregister_binfmt(struct linux_binfmt *); 13814 13815 extern int read_exec(struct dentry *, 13816 unsigned long offset, char * addr, unsigned long count, 13817 int to_kmem); 13818 13819 extern int open_dentry(struct dentry *, int mode); 13820 13821 extern int init_elf_binfmt(void); 13822 extern int init_elf32_binfmt(void); 13823 extern int init_aout_binfmt(void); 13824 extern int init_aout32_binfmt(void); 13825 extern int init_script_binfmt(void); 13826 extern int init_java_binfmt(void); 13827 extern int init_em86_binfmt(void); 13828 extern int init_misc_binfmt(void); 13829 13830 extern int prepare_binprm(struct linux_binprm *); 13831 extern void remove_arg_zero(struct linux_binprm *); 13832 extern int search_binary_handler(struct linux_binprm *, 13833 struct pt_regs *); 13834 extern int flush_old_exec(struct linux_binprm * bprm); 13835 extern unsigned long setup_arg_pages(unsigned long p, 13836 struct linux_binprm * bprm); 13837 extern unsigned long copy_strings(int argc,char ** argv, 13838 unsigned long *page, unsigned long p, int from_kmem); 13839 13840 extern void compute_creds(struct linux_binprm *binprm); 13841 13842 /* this eventually goes away */ 13843 #define change_ldt(a,b) setup_arg_pages(a,b) 13844 13845 #endif /* __KERNEL__ */ 13846 #endif /* _LINUX_BINFMTS_H */



Содержание раздела