umh.h 1.9 KB

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