umh.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef __LINUX_UMH_H__
  2. #define __LINUX_UMH_H__
  3. #include <linux/gfp.h>
  4. #include <linux/stddef.h>
  5. #include <linux/errno.h>
  6. #include <linux/compiler.h>
  7. #include <linux/workqueue.h>
  8. #include <linux/sysctl.h>
  9. struct cred;
  10. struct file;
  11. #define UMH_NO_WAIT 0 /* don't wait at all */
  12. #define UMH_WAIT_EXEC 1 /* wait for the exec, but not the process */
  13. #define UMH_WAIT_PROC 2 /* wait for the process to complete */
  14. #define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */
  15. struct subprocess_info {
  16. struct work_struct work;
  17. struct completion *complete;
  18. const char *path;
  19. char **argv;
  20. char **envp;
  21. int wait;
  22. int retval;
  23. int (*init)(struct subprocess_info *info, struct cred *new);
  24. void (*cleanup)(struct subprocess_info *info);
  25. void *data;
  26. } __randomize_layout;
  27. extern int
  28. call_usermodehelper(const char *path, char **argv, char **envp, int wait);
  29. extern struct subprocess_info *
  30. call_usermodehelper_setup(const char *path, char **argv, char **envp,
  31. gfp_t gfp_mask,
  32. int (*init)(struct subprocess_info *info, struct cred *new),
  33. void (*cleanup)(struct subprocess_info *), void *data);
  34. extern int
  35. call_usermodehelper_exec(struct subprocess_info *info, int wait);
  36. extern struct ctl_table usermodehelper_table[];
  37. enum umh_disable_depth {
  38. UMH_ENABLED = 0,
  39. UMH_FREEZING,
  40. UMH_DISABLED,
  41. };
  42. extern int __usermodehelper_disable(enum umh_disable_depth depth);
  43. extern void __usermodehelper_set_disable_depth(enum umh_disable_depth depth);
  44. static inline int usermodehelper_disable(void)
  45. {
  46. return __usermodehelper_disable(UMH_DISABLED);
  47. }
  48. static inline void usermodehelper_enable(void)
  49. {
  50. __usermodehelper_set_disable_depth(UMH_ENABLED);
  51. }
  52. extern int usermodehelper_read_trylock(void);
  53. extern long usermodehelper_read_lock_wait(long timeout);
  54. extern void usermodehelper_read_unlock(void);
  55. #endif /* __LINUX_UMH_H__ */