Eric Andersen | f6b7139 | 2000-09-26 01:09:18 +0000 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: */ |
| 2 | /* |
| 3 | * Busybox main internal header file |
| 4 | * |
Bernhard Reutner-Fischer | 86f5c99 | 2006-01-22 22:55:11 +0000 | [diff] [blame] | 5 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. |
Eric Andersen | f6b7139 | 2000-09-26 01:09:18 +0000 | [diff] [blame] | 6 | */ |
| 7 | #ifndef _BB_INTERNAL_H_ |
| 8 | #define _BB_INTERNAL_H_ 1 |
| 9 | |
Robert Griebl | c9aca45 | 2002-06-04 20:06:25 +0000 | [diff] [blame] | 10 | #include "libbb.h" |
Eric Andersen | c319601 | 2001-03-14 01:15:06 +0000 | [diff] [blame] | 11 | |
Denis Vlasenko | 335b63d | 2007-04-10 21:38:30 +0000 | [diff] [blame^] | 12 | #if ENABLE_FEATURE_INSTALLER |
Denis Vlasenko | 0ee3999 | 2006-12-24 15:23:28 +0000 | [diff] [blame] | 13 | /* order matters: used as index into "install_dir[]" in busybox.c */ |
Denis Vlasenko | 335b63d | 2007-04-10 21:38:30 +0000 | [diff] [blame^] | 14 | typedef enum bb_install_loc_t { |
Eric Andersen | f6b7139 | 2000-09-26 01:09:18 +0000 | [diff] [blame] | 15 | _BB_DIR_ROOT = 0, |
| 16 | _BB_DIR_BIN, |
| 17 | _BB_DIR_SBIN, |
| 18 | _BB_DIR_USR_BIN, |
| 19 | _BB_DIR_USR_SBIN |
Denis Vlasenko | 335b63d | 2007-04-10 21:38:30 +0000 | [diff] [blame^] | 20 | } bb_install_loc_t; |
| 21 | #endif |
Eric Andersen | f6b7139 | 2000-09-26 01:09:18 +0000 | [diff] [blame] | 22 | |
Denis Vlasenko | 335b63d | 2007-04-10 21:38:30 +0000 | [diff] [blame^] | 23 | #if ENABLE_FEATURE_SUID |
| 24 | typedef enum bb_suid_t { |
Robert Griebl | c9aca45 | 2002-06-04 20:06:25 +0000 | [diff] [blame] | 25 | _BB_SUID_NEVER = 0, |
| 26 | _BB_SUID_MAYBE, |
| 27 | _BB_SUID_ALWAYS |
Denis Vlasenko | 335b63d | 2007-04-10 21:38:30 +0000 | [diff] [blame^] | 28 | } bb_suid_t; |
| 29 | #endif |
Robert Griebl | c9aca45 | 2002-06-04 20:06:25 +0000 | [diff] [blame] | 30 | |
Denis Vlasenko | 335b63d | 2007-04-10 21:38:30 +0000 | [diff] [blame^] | 31 | struct bb_applet { |
Glenn L McGrath | 60a22ad | 2002-08-22 15:54:22 +0000 | [diff] [blame] | 32 | const char *name; |
| 33 | int (*main) (int argc, char **argv); |
Denis Vlasenko | 335b63d | 2007-04-10 21:38:30 +0000 | [diff] [blame^] | 34 | #if ENABLE_FEATURE_INSTALLER |
| 35 | __extension__ enum bb_install_loc_t install_loc:8; |
| 36 | #endif |
| 37 | #if ENABLE_FEATURE_SUID |
| 38 | __extension__ enum bb_suid_t need_suid:8; |
| 39 | #endif |
| 40 | #if ENABLE_FEATURE_EXEC_PREFER_APPLETS |
Denis Vlasenko | c44ab01 | 2007-04-09 03:11:58 +0000 | [diff] [blame] | 41 | /* true if instead if fork(); exec("applet"); waitpid(); |
| 42 | * one can do fork(); exit(applet_main(argc,argv)); waitpid(); */ |
| 43 | unsigned char noexec; |
| 44 | /* Even nicer */ |
| 45 | /* true if instead if fork(); exec("applet"); waitpid(); |
| 46 | * one can simply call applet_main(argc,argv); */ |
| 47 | unsigned char nofork; |
Denis Vlasenko | 335b63d | 2007-04-10 21:38:30 +0000 | [diff] [blame^] | 48 | #endif |
Eric Andersen | f6b7139 | 2000-09-26 01:09:18 +0000 | [diff] [blame] | 49 | }; |
Glenn L McGrath | 60a22ad | 2002-08-22 15:54:22 +0000 | [diff] [blame] | 50 | |
Denis Vlasenko | 32b633a | 2007-04-09 03:05:48 +0000 | [diff] [blame] | 51 | /* Defined in applet.c */ |
Denis Vlasenko | 335b63d | 2007-04-10 21:38:30 +0000 | [diff] [blame^] | 52 | extern const struct bb_applet applets[]; |
Denis Vlasenko | 0ee3999 | 2006-12-24 15:23:28 +0000 | [diff] [blame] | 53 | extern const unsigned short NUM_APPLETS; |
Eric Andersen | f6b7139 | 2000-09-26 01:09:18 +0000 | [diff] [blame] | 54 | |
Denis Vlasenko | c7ba8b9 | 2007-02-03 17:27:14 +0000 | [diff] [blame] | 55 | #endif /* _BB_INTERNAL_H_ */ |