]> bbs.cooldavid.org Git - net-next-2.6.git/blame - include/linux/binfmts.h
icom: add new sub-device-id to support new adapter
[net-next-2.6.git] / include / linux / binfmts.h
CommitLineData
1da177e4
LT
1#ifndef _LINUX_BINFMTS_H
2#define _LINUX_BINFMTS_H
3
4#include <linux/capability.h>
5
6struct pt_regs;
7
8/*
9 * MAX_ARG_PAGES defines the number of pages allocated for arguments
10 * and envelope for the new program. 32 should suffice, this gives
11 * a maximum env+arg of 128kB w/4KB pages!
12 */
13#define MAX_ARG_PAGES 32
14
15/* sizeof(linux_binprm->buf) */
16#define BINPRM_BUF_SIZE 128
17
18#ifdef __KERNEL__
19
20/*
21 * This structure is used to hold the arguments that are used when loading binaries.
22 */
23struct linux_binprm{
24 char buf[BINPRM_BUF_SIZE];
25 struct page *page[MAX_ARG_PAGES];
26 struct mm_struct *mm;
27 unsigned long p; /* current top of mem */
28 int sh_bang;
29 struct file * file;
30 int e_uid, e_gid;
31 kernel_cap_t cap_inheritable, cap_permitted, cap_effective;
32 void *security;
33 int argc, envc;
34 char * filename; /* Name of binary as seen by procps */
35 char * interp; /* Name of the binary really executed. Most
36 of the time same as filename, but could be
37 different for binfmt_{misc,script} */
38 unsigned interp_flags;
39 unsigned interp_data;
40 unsigned long loader, exec;
41};
42
43#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
44#define BINPRM_FLAGS_ENFORCE_NONDUMP (1 << BINPRM_FLAGS_ENFORCE_NONDUMP_BIT)
45
46/* fd of the binary should be passed to the interpreter */
47#define BINPRM_FLAGS_EXECFD_BIT 1
48#define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT)
49
50
51/*
52 * This structure defines the functions that are used to load the binary formats that
53 * linux accepts.
54 */
55struct linux_binfmt {
56 struct linux_binfmt * next;
57 struct module *module;
58 int (*load_binary)(struct linux_binprm *, struct pt_regs * regs);
59 int (*load_shlib)(struct file *);
60 int (*core_dump)(long signr, struct pt_regs * regs, struct file * file);
61 unsigned long min_coredump; /* minimal dump size */
9fbbd4dd 62 int hasvdso;
1da177e4
LT
63};
64
65extern int register_binfmt(struct linux_binfmt *);
66extern int unregister_binfmt(struct linux_binfmt *);
67
68extern int prepare_binprm(struct linux_binprm *);
69extern void remove_arg_zero(struct linux_binprm *);
70extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
71extern int flush_old_exec(struct linux_binprm * bprm);
72
d6e71144
AC
73extern int suid_dumpable;
74#define SUID_DUMP_DISABLE 0 /* No setuid dumping */
75#define SUID_DUMP_USER 1 /* Dump as user of process */
76#define SUID_DUMP_ROOT 2 /* Dump as root */
77
1da177e4
LT
78/* Stack area protections */
79#define EXSTACK_DEFAULT 0 /* Whatever the arch defaults to */
80#define EXSTACK_DISABLE_X 1 /* Disable executable stacks */
81#define EXSTACK_ENABLE_X 2 /* Enable executable stacks */
82
83extern int setup_arg_pages(struct linux_binprm * bprm,
84 unsigned long stack_top,
85 int executable_stack);
1da177e4
LT
86extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);
87extern void compute_creds(struct linux_binprm *binprm);
88extern int do_coredump(long signr, int exit_code, struct pt_regs * regs);
89extern int set_binfmt(struct linux_binfmt *new);
90
91#endif /* __KERNEL__ */
92#endif /* _LINUX_BINFMTS_H */