at v6.2 1.9 kB view raw
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 11struct cred; 12struct file; 13 14#define UMH_NO_WAIT 0x00 /* don't wait at all */ 15#define UMH_WAIT_EXEC 0x01 /* wait for the exec, but not the process */ 16#define UMH_WAIT_PROC 0x02 /* wait for the process to complete */ 17#define UMH_KILLABLE 0x04 /* wait for EXEC/PROC killable */ 18#define UMH_FREEZABLE 0x08 /* wait for EXEC/PROC freezable */ 19 20struct subprocess_info { 21 struct work_struct work; 22 struct completion *complete; 23 const char *path; 24 char **argv; 25 char **envp; 26 int wait; 27 int retval; 28 int (*init)(struct subprocess_info *info, struct cred *new); 29 void (*cleanup)(struct subprocess_info *info); 30 void *data; 31} __randomize_layout; 32 33extern int 34call_usermodehelper(const char *path, char **argv, char **envp, int wait); 35 36extern struct subprocess_info * 37call_usermodehelper_setup(const char *path, char **argv, char **envp, 38 gfp_t gfp_mask, 39 int (*init)(struct subprocess_info *info, struct cred *new), 40 void (*cleanup)(struct subprocess_info *), void *data); 41 42extern int 43call_usermodehelper_exec(struct subprocess_info *info, int wait); 44 45extern struct ctl_table usermodehelper_table[]; 46 47enum umh_disable_depth { 48 UMH_ENABLED = 0, 49 UMH_FREEZING, 50 UMH_DISABLED, 51}; 52 53extern int __usermodehelper_disable(enum umh_disable_depth depth); 54extern void __usermodehelper_set_disable_depth(enum umh_disable_depth depth); 55 56static inline int usermodehelper_disable(void) 57{ 58 return __usermodehelper_disable(UMH_DISABLED); 59} 60 61static inline void usermodehelper_enable(void) 62{ 63 __usermodehelper_set_disable_depth(UMH_ENABLED); 64} 65 66extern int usermodehelper_read_trylock(void); 67extern long usermodehelper_read_lock_wait(long timeout); 68extern void usermodehelper_read_unlock(void); 69 70#endif /* __LINUX_UMH_H__ */