1 /* vi: set sw=4 ts=4: */
3 * Busybox main internal header file
5 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
7 #ifndef _BB_INTERNAL_H_
8 #define _BB_INTERNAL_H_ 1
12 /* order matters: used as index into "install_dir[]" in appletlib.c */
13 typedef enum bb_install_loc_t {
21 typedef enum bb_suid_t {
28 /* Defined in appletlib.c (by including generated applet_tables.h) */
29 /* Keep in sync with applets/applet_tables.c! */
30 extern const char applet_names[];
31 extern int (*const applet_mains[])(int argc, char **argv);
33 #if ENABLE_FEATURE_INSTALLER || ENABLE_FEATURE_PREFER_APPLETS
34 extern const uint32_t applet_nameofs[];
36 extern const uint16_t applet_nameofs[];
39 #if ENABLE_FEATURE_SUID
40 #define APPLET_NAME(i) (applet_names + (applet_nameofs[i] & 0x3fff))
41 #define APPLET_SUID(i) ((applet_nameofs[i] >> 14) & 0x3)
43 #define APPLET_NAME(i) (applet_names + (applet_nameofs[i] & 0xffff))
46 #if ENABLE_FEATURE_INSTALLER
47 #define APPLET_INSTALL_LOC(i) ((applet_nameofs[i] >> 16) & 0x7)
50 #if ENABLE_FEATURE_PREFER_APPLETS
51 #define APPLET_IS_NOFORK(i) (applet_nameofs[i] & (1 << 19))
52 #define APPLET_IS_NOEXEC(i) (applet_nameofs[i] & (1 << 20))
56 /* Length of these names has effect on size of libbusybox
57 * and "individual" binaries. Keep them short.
59 void lbb_prepare(const char *applet, char **argv) MAIN_EXTERNALLY_VISIBLE;
60 #if ENABLE_BUILD_LIBBUSYBOX
61 #if ENABLE_FEATURE_SHARED_BUSYBOX
62 int lbb_main(int argc, char **argv) EXTERNALLY_VISIBLE;
64 int lbb_main(int argc, char **argv);
69 #endif /* _BB_INTERNAL_H_ */