Back to home page

OSCL-LXR

 
 

    


0001 #ifndef __LINUX_UMH_H__
0002 #define __LINUX_UMH_H__
0003 
0004 #include <linux/gfp.h>
0005 #include <linux/stddef.h>
0006 #include <linux/errno.h>
0007 #include <linux/compiler.h>
0008 #include <linux/workqueue.h>
0009 #include <linux/sysctl.h>
0010 
0011 struct cred;
0012 struct file;
0013 
0014 #define UMH_NO_WAIT 0   /* don't wait at all */
0015 #define UMH_WAIT_EXEC   1   /* wait for the exec, but not the process */
0016 #define UMH_WAIT_PROC   2   /* wait for the process to complete */
0017 #define UMH_KILLABLE    4   /* wait for EXEC/PROC killable */
0018 
0019 struct subprocess_info {
0020     struct work_struct work;
0021     struct completion *complete;
0022     const char *path;
0023     char **argv;
0024     char **envp;
0025     int wait;
0026     int retval;
0027     int (*init)(struct subprocess_info *info, struct cred *new);
0028     void (*cleanup)(struct subprocess_info *info);
0029     void *data;
0030 } __randomize_layout;
0031 
0032 extern int
0033 call_usermodehelper(const char *path, char **argv, char **envp, int wait);
0034 
0035 extern struct subprocess_info *
0036 call_usermodehelper_setup(const char *path, char **argv, char **envp,
0037               gfp_t gfp_mask,
0038               int (*init)(struct subprocess_info *info, struct cred *new),
0039               void (*cleanup)(struct subprocess_info *), void *data);
0040 
0041 extern int
0042 call_usermodehelper_exec(struct subprocess_info *info, int wait);
0043 
0044 extern struct ctl_table usermodehelper_table[];
0045 
0046 enum umh_disable_depth {
0047     UMH_ENABLED = 0,
0048     UMH_FREEZING,
0049     UMH_DISABLED,
0050 };
0051 
0052 extern int __usermodehelper_disable(enum umh_disable_depth depth);
0053 extern void __usermodehelper_set_disable_depth(enum umh_disable_depth depth);
0054 
0055 static inline int usermodehelper_disable(void)
0056 {
0057     return __usermodehelper_disable(UMH_DISABLED);
0058 }
0059 
0060 static inline void usermodehelper_enable(void)
0061 {
0062     __usermodehelper_set_disable_depth(UMH_ENABLED);
0063 }
0064 
0065 extern int usermodehelper_read_trylock(void);
0066 extern long usermodehelper_read_lock_wait(long timeout);
0067 extern void usermodehelper_read_unlock(void);
0068 
0069 #endif /* __LINUX_UMH_H__ */