Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/include/busybox.h
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/include/busybox.h
r1765 r2725 3 3 * Busybox main internal header file 4 4 * 5 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.5 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 6 6 */ 7 #ifndef _BB_INTERNAL_H_8 #define _BB_INTERNAL_H_17 #ifndef BUSYBOX_H 8 #define BUSYBOX_H 1 9 9 10 10 #include "libbb.h" 11 11 12 #if ENABLE_FEATURE_INSTALLER 13 /* order matters: used as index into "install_dir[]" in busybox.c */ 12 PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN 13 14 /* order matters: used as index into "install_dir[]" in appletlib.c */ 14 15 typedef enum bb_install_loc_t { 15 16 _BB_DIR_ROOT = 0, 16 17 _BB_DIR_BIN, 17 18 _BB_DIR_SBIN, 19 #if ENABLE_INSTALL_NO_USR 20 _BB_DIR_USR_BIN = _BB_DIR_BIN, 21 _BB_DIR_USR_SBIN = _BB_DIR_SBIN, 22 #else 18 23 _BB_DIR_USR_BIN, 19 _BB_DIR_USR_SBIN 24 _BB_DIR_USR_SBIN, 25 #endif 20 26 } bb_install_loc_t; 27 28 typedef enum bb_suid_t { 29 _BB_SUID_DROP = 0, 30 _BB_SUID_MAYBE, 31 _BB_SUID_REQUIRE 32 } bb_suid_t; 33 34 35 /* Defined in appletlib.c (by including generated applet_tables.h) */ 36 /* Keep in sync with applets/applet_tables.c! */ 37 extern const char applet_names[]; 38 extern int (*const applet_main[])(int argc, char **argv); 39 extern const uint16_t applet_nameofs[]; 40 extern const uint8_t applet_install_loc[]; 41 42 #if ENABLE_FEATURE_SUID || ENABLE_FEATURE_PREFER_APPLETS 43 # define APPLET_NAME(i) (applet_names + (applet_nameofs[i] & 0x0fff)) 44 #else 45 # define APPLET_NAME(i) (applet_names + applet_nameofs[i]) 46 #endif 47 48 #if ENABLE_FEATURE_PREFER_APPLETS 49 # define APPLET_IS_NOFORK(i) (applet_nameofs[i] & (1 << 12)) 50 # define APPLET_IS_NOEXEC(i) (applet_nameofs[i] & (1 << 13)) 51 #else 52 # define APPLET_IS_NOFORK(i) 0 53 # define APPLET_IS_NOEXEC(i) 0 21 54 #endif 22 55 23 56 #if ENABLE_FEATURE_SUID 24 typedef enum bb_suid_t { 25 _BB_SUID_NEVER = 0, 26 _BB_SUID_MAYBE, 27 _BB_SUID_ALWAYS 28 } bb_suid_t; 57 # define APPLET_SUID(i) ((applet_nameofs[i] >> 14) & 0x3) 29 58 #endif 30 59 31 struct bb_applet {32 const char *name;33 int (*main) (int argc, char **argv);34 60 #if ENABLE_FEATURE_INSTALLER 35 __extension__ enum bb_install_loc_t install_loc:8; 61 #define APPLET_INSTALL_LOC(i) ({ \ 62 unsigned v = (i); \ 63 if (v & 1) v = applet_install_loc[v/2] >> 4; \ 64 else v = applet_install_loc[v/2] & 0xf; \ 65 v; }) 36 66 #endif 37 #if ENABLE_FEATURE_SUID 38 __extension__ enum bb_suid_t need_suid:8; 67 68 69 /* Length of these names has effect on size of libbusybox 70 * and "individual" binaries. Keep them short. 71 */ 72 #if ENABLE_BUILD_LIBBUSYBOX 73 #if ENABLE_FEATURE_SHARED_BUSYBOX 74 int lbb_main(char **argv) EXTERNALLY_VISIBLE; 75 #else 76 int lbb_main(char **argv); 39 77 #endif 40 #if ENABLE_FEATURE_PREFER_APPLETS41 /* true if instead of 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 of fork(); exec("applet"); waitpid();46 * one can simply call applet_main(argc,argv); */47 unsigned char nofork;48 78 #endif 49 };50 79 51 /* Defined in applet.c */ 52 extern const struct bb_applet applets[]; 53 extern const unsigned short NUM_APPLETS; 80 POP_SAVED_FUNCTION_VISIBILITY 54 81 55 #endif /* _BB_INTERNAL_H_ */82 #endif
Note:
See TracChangeset
for help on using the changeset viewer.