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 #if __GNUC_PREREQ(4,1)
13 # pragma GCC visibility push(hidden)
16 /* order matters: used as index into "install_dir[]" in appletlib.c */
17 typedef enum bb_install_loc_t {
25 typedef enum bb_suid_t {
32 /* Defined in appletlib.c (by including generated applet_tables.h) */
33 /* Keep in sync with applets/applet_tables.c! */
34 extern const char applet_names[];
35 extern int (*const applet_main[])(int argc, char **argv);
36 extern const uint16_t applet_nameofs[];
37 extern const uint8_t applet_install_loc[];
39 #if ENABLE_FEATURE_SUID || ENABLE_FEATURE_PREFER_APPLETS
40 #define APPLET_NAME(i) (applet_names + (applet_nameofs[i] & 0x0fff))
42 #define APPLET_NAME(i) (applet_names + applet_nameofs[i])
45 #if ENABLE_FEATURE_PREFER_APPLETS
46 #define APPLET_IS_NOFORK(i) (applet_nameofs[i] & (1 << 12))
47 #define APPLET_IS_NOEXEC(i) (applet_nameofs[i] & (1 << 13))
50 #if ENABLE_FEATURE_SUID
51 #define APPLET_SUID(i) ((applet_nameofs[i] >> 14) & 0x3)
54 #if ENABLE_FEATURE_INSTALLER
55 #define APPLET_INSTALL_LOC(i) ({ \
57 if (v & 1) v = applet_install_loc[v/2] >> 4; \
58 else v = applet_install_loc[v/2] & 0xf; \
63 /* Length of these names has effect on size of libbusybox
64 * and "individual" binaries. Keep them short.
66 #if ENABLE_BUILD_LIBBUSYBOX
67 #if ENABLE_FEATURE_SHARED_BUSYBOX
68 int lbb_main(char **argv) EXTERNALLY_VISIBLE;
70 int lbb_main(char **argv);
74 #if __GNUC_PREREQ(4,1)
75 # pragma GCC visibility pop
78 #endif /* _BB_INTERNAL_H_ */