1#ifndef _LINUX_BINFMTS_H
2#define _LINUX_BINFMTS_H
3
4#include <linux/ptrace.h>
5#include <linux/capability.h>
6
7
8
9
10
11
12#define MAX_ARG_PAGES 32
13
14
15#define BINPRM_BUF_SIZE 128
16
17#ifdef __KERNEL__
18
19
20
21
22struct linux_binprm{
23 char buf[BINPRM_BUF_SIZE];
24 struct page *page[MAX_ARG_PAGES];
25 unsigned long p;
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;
32 unsigned long loader, exec;
33};
34
35
36
37
38
39struct 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;
46};
47
48extern int register_binfmt(struct linux_binfmt *);
49extern int unregister_binfmt(struct linux_binfmt *);
50
51extern int prepare_binprm(struct linux_binprm *);
52extern void remove_arg_zero(struct linux_binprm *);
53extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
54extern int flush_old_exec(struct linux_binprm * bprm);
55extern int setup_arg_pages(struct linux_binprm * bprm);
56extern int copy_strings(int argc,char ** argv,struct linux_binprm *bprm);
57extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);
58extern void compute_creds(struct linux_binprm *binprm);
59extern int do_coredump(long signr, struct pt_regs * regs);
60extern void set_binfmt(struct linux_binfmt *new);
61
62
63#if 0
64
65#define change_ldt(a,b) setup_arg_pages(a,b)
66#endif
67
68#endif
69#endif
70