busybox.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * Busybox main internal header file
  4. *
  5. * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
  6. */
  7. #ifndef _BB_INTERNAL_H_
  8. #define _BB_INTERNAL_H_ 1
  9. #include "libbb.h"
  10. #if ENABLE_FEATURE_INSTALLER
  11. /* order matters: used as index into "install_dir[]" in busybox.c */
  12. typedef enum bb_install_loc_t {
  13. _BB_DIR_ROOT = 0,
  14. _BB_DIR_BIN,
  15. _BB_DIR_SBIN,
  16. _BB_DIR_USR_BIN,
  17. _BB_DIR_USR_SBIN
  18. } bb_install_loc_t;
  19. #endif
  20. #if ENABLE_FEATURE_SUID
  21. typedef enum bb_suid_t {
  22. _BB_SUID_NEVER = 0,
  23. _BB_SUID_MAYBE,
  24. _BB_SUID_ALWAYS
  25. } bb_suid_t;
  26. #endif
  27. struct bb_applet {
  28. const char *name;
  29. int (*main) (int argc, char **argv);
  30. #if ENABLE_FEATURE_INSTALLER
  31. __extension__ enum bb_install_loc_t install_loc:8;
  32. #endif
  33. #if ENABLE_FEATURE_SUID
  34. __extension__ enum bb_suid_t need_suid:8;
  35. #endif
  36. #if ENABLE_FEATURE_PREFER_APPLETS
  37. /* true if instead of fork(); exec("applet"); waitpid();
  38. * one can do fork(); exit(applet_main(argc,argv)); waitpid(); */
  39. unsigned char noexec;
  40. /* Even nicer */
  41. /* true if instead of fork(); exec("applet"); waitpid();
  42. * one can simply call applet_main(argc,argv); */
  43. unsigned char nofork;
  44. #endif
  45. };
  46. /* Defined in appletlib.c */
  47. extern const struct bb_applet applets[];
  48. extern const unsigned short NUM_APPLETS;
  49. /* Length of these names has effect on size of libbusybox
  50. * and "individual" binaries. Keep them short.
  51. */
  52. void lbb_prepare(const char *applet, char **argv) MAIN_EXTERNALLY_VISIBLE;
  53. #if ENABLE_BUILD_LIBBUSYBOX
  54. #if ENABLE_FEATURE_SHARED_BUSYBOX
  55. int lbb_main(int argc, char **argv) EXTERNALLY_VISIBLE;
  56. #else
  57. int lbb_main(int argc, char **argv);
  58. #endif
  59. #endif
  60. #endif /* _BB_INTERNAL_H_ */