Commit | Line | Data |
---|---|---|
c1f3fa2a LR |
1 | #ifndef __LINUX_UMH_H__ |
2 | #define __LINUX_UMH_H__ | |
3 | ||
4 | #include <linux/gfp.h> | |
5 | #include <linux/stddef.h> | |
6 | #include <linux/errno.h> | |
7 | #include <linux/compiler.h> | |
8 | #include <linux/workqueue.h> | |
9 | #include <linux/sysctl.h> | |
10 | ||
11 | struct cred; | |
12 | struct file; | |
13 | ||
14 | #define UMH_NO_WAIT 0 /* don't wait at all */ | |
15 | #define UMH_WAIT_EXEC 1 /* wait for the exec, but not the process */ | |
16 | #define UMH_WAIT_PROC 2 /* wait for the process to complete */ | |
17 | #define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */ | |
18 | ||
19 | struct subprocess_info { | |
20 | struct work_struct work; | |
21 | struct completion *complete; | |
22 | const char *path; | |
23 | char **argv; | |
24 | char **envp; | |
449325b5 | 25 | struct file *file; |
c1f3fa2a LR |
26 | int wait; |
27 | int retval; | |
449325b5 | 28 | pid_t pid; |
c1f3fa2a LR |
29 | int (*init)(struct subprocess_info *info, struct cred *new); |
30 | void (*cleanup)(struct subprocess_info *info); | |
31 | void *data; | |
32 | } __randomize_layout; | |
33 | ||
34 | extern int | |
35 | call_usermodehelper(const char *path, char **argv, char **envp, int wait); | |
36 | ||
37 | extern struct subprocess_info * | |
38 | call_usermodehelper_setup(const char *path, char **argv, char **envp, | |
39 | gfp_t gfp_mask, | |
40 | int (*init)(struct subprocess_info *info, struct cred *new), | |
41 | void (*cleanup)(struct subprocess_info *), void *data); | |
42 | ||
449325b5 AS |
43 | struct subprocess_info *call_usermodehelper_setup_file(struct file *file, |
44 | int (*init)(struct subprocess_info *info, struct cred *new), | |
45 | void (*cleanup)(struct subprocess_info *), void *data); | |
46 | struct umh_info { | |
47 | struct file *pipe_to_umh; | |
48 | struct file *pipe_from_umh; | |
49 | pid_t pid; | |
50 | }; | |
51 | int fork_usermode_blob(void *data, size_t len, struct umh_info *info); | |
52 | ||
c1f3fa2a LR |
53 | extern int |
54 | call_usermodehelper_exec(struct subprocess_info *info, int wait); | |
55 | ||
56 | extern struct ctl_table usermodehelper_table[]; | |
57 | ||
58 | enum umh_disable_depth { | |
59 | UMH_ENABLED = 0, | |
60 | UMH_FREEZING, | |
61 | UMH_DISABLED, | |
62 | }; | |
63 | ||
64 | extern int __usermodehelper_disable(enum umh_disable_depth depth); | |
65 | extern void __usermodehelper_set_disable_depth(enum umh_disable_depth depth); | |
66 | ||
67 | static inline int usermodehelper_disable(void) | |
68 | { | |
69 | return __usermodehelper_disable(UMH_DISABLED); | |
70 | } | |
71 | ||
72 | static inline void usermodehelper_enable(void) | |
73 | { | |
74 | __usermodehelper_set_disable_depth(UMH_ENABLED); | |
75 | } | |
76 | ||
77 | extern int usermodehelper_read_trylock(void); | |
78 | extern long usermodehelper_read_lock_wait(long timeout); | |
79 | extern void usermodehelper_read_unlock(void); | |
80 | ||
81 | #endif /* __LINUX_UMH_H__ */ |