toyflags.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* Flags values for the third argument of NEWTOY()
  2. *
  3. * Included from both main.c (runs in toys.h context) and scripts/install.c
  4. * (which may build on crazy things like macosx when cross compiling).
  5. */
  6. // Flags describing command behavior.
  7. // Where to install (toybox --long outputs absolute paths to commands)
  8. // If no location bits set, command not listed in "toybox" command's output.
  9. #define TOYFLAG_USR (1<<0)
  10. #define TOYFLAG_BIN (1<<1)
  11. #define TOYFLAG_SBIN (1<<2)
  12. #define TOYMASK_LOCATION ((1<<4)-1)
  13. // This is a shell built-in function, running in the same process context.
  14. #define TOYFLAG_NOFORK (1<<4)
  15. #define TOYFLAG_MAYFORK (1<<5)
  16. // Start command with a umask of 0 (saves old umask in this.old_umask)
  17. #define TOYFLAG_UMASK (1<<6)
  18. // This command runs as root.
  19. #define TOYFLAG_STAYROOT (1<<7) // Don't drop suid root before running cmd_main
  20. #define TOYFLAG_NEEDROOT (1<<8) // Refuse to run if real uid != 0
  21. #define TOYFLAG_ROOTONLY (TOYFLAG_STAYROOT|TOYFLAG_NEEDROOT)
  22. // Call setlocale to listen to environment variables.
  23. // This invalidates sprintf("%.*s", size, string) as a valid length constraint.
  24. #define TOYFLAG_LOCALE (1<<9)
  25. // Suppress default --help processing
  26. #define TOYFLAG_NOHELP (1<<10)
  27. // Line buffered stdout
  28. #define TOYFLAG_LINEBUF (1<<11)
  29. // Error code to return if argument parsing fails (default 1)
  30. #define TOYFLAG_ARGFAIL(x) (x<<24)