1 /* vi: set sw=4 ts=4: */
3 * Busybox main internal header file
5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
12 PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
14 /* order matters: used as index into "install_dir[]" in appletlib.c */
15 typedef enum bb_install_loc_t {
19 #if ENABLE_INSTALL_NO_USR
20 _BB_DIR_USR_BIN = _BB_DIR_BIN,
21 _BB_DIR_USR_SBIN = _BB_DIR_SBIN,
28 typedef enum bb_suid_t {
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[];
42 #if ENABLE_FEATURE_SUID || ENABLE_FEATURE_PREFER_APPLETS
43 # define APPLET_NAME(i) (applet_names + (applet_nameofs[i] & 0x0fff))
45 # define APPLET_NAME(i) (applet_names + applet_nameofs[i])
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))
52 # define APPLET_IS_NOFORK(i) 0
53 # define APPLET_IS_NOEXEC(i) 0
56 #if ENABLE_FEATURE_SUID
57 # define APPLET_SUID(i) ((applet_nameofs[i] >> 14) & 0x3)
60 #if ENABLE_FEATURE_INSTALLER
61 #define APPLET_INSTALL_LOC(i) ({ \
63 if (v & 1) v = applet_install_loc[v/2] >> 4; \
64 else v = applet_install_loc[v/2] & 0xf; \
69 /* Length of these names has effect on size of libbusybox
70 * and "individual" binaries. Keep them short.
72 #if ENABLE_BUILD_LIBBUSYBOX
73 #if ENABLE_FEATURE_SHARED_BUSYBOX
74 int lbb_main(char **argv) EXTERNALLY_VISIBLE;
76 int lbb_main(char **argv);
80 POP_SAVED_FUNCTION_VISIBILITY