[821] | 1 | /* vi: set sw=4 ts=4: */
|
---|
| 2 | /*
|
---|
[2725] | 3 | * Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
---|
[821] | 4 | */
|
---|
[2725] | 5 | #ifndef BUSYBOX_H
|
---|
| 6 | #define BUSYBOX_H 1
|
---|
[821] | 7 |
|
---|
| 8 | #include "libbb.h"
|
---|
[3232] | 9 | /* BB_DIR_foo and BB_SUID_bar constants: */
|
---|
| 10 | #include "applet_metadata.h"
|
---|
[821] | 11 |
|
---|
[2725] | 12 | PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
|
---|
| 13 |
|
---|
| 14 | /* Defined in appletlib.c (by including generated applet_tables.h) */
|
---|
| 15 | /* Keep in sync with applets/applet_tables.c! */
|
---|
[3232] | 16 | extern const char applet_names[] ALIGN1;
|
---|
[2725] | 17 | extern int (*const applet_main[])(int argc, char **argv);
|
---|
[3621] | 18 | extern const uint8_t applet_flags[] ALIGN1;
|
---|
| 19 | extern const uint8_t applet_suid[] ALIGN1;
|
---|
[3232] | 20 | extern const uint8_t applet_install_loc[] ALIGN1;
|
---|
[2725] | 21 |
|
---|
| 22 | #if ENABLE_FEATURE_PREFER_APPLETS
|
---|
[3621] | 23 | # define APPLET_IS_NOFORK(i) (applet_flags[(i)/4] & (1 << (2 * ((i)%4))))
|
---|
| 24 | # define APPLET_IS_NOEXEC(i) (applet_flags[(i)/4] & (1 << ((2 * ((i)%4))+1)))
|
---|
[2725] | 25 | #else
|
---|
| 26 | # define APPLET_IS_NOFORK(i) 0
|
---|
| 27 | # define APPLET_IS_NOEXEC(i) 0
|
---|
[1765] | 28 | #endif
|
---|
[2725] | 29 |
|
---|
[1765] | 30 | #if ENABLE_FEATURE_SUID
|
---|
[3621] | 31 | # define APPLET_SUID(i) ((applet_suid[(i)/4] >> (2 * ((i)%4)) & 3))
|
---|
[1765] | 32 | #endif
|
---|
[2725] | 33 |
|
---|
| 34 | #if ENABLE_FEATURE_INSTALLER
|
---|
| 35 | #define APPLET_INSTALL_LOC(i) ({ \
|
---|
| 36 | unsigned v = (i); \
|
---|
| 37 | if (v & 1) v = applet_install_loc[v/2] >> 4; \
|
---|
| 38 | else v = applet_install_loc[v/2] & 0xf; \
|
---|
| 39 | v; })
|
---|
[1765] | 40 | #endif
|
---|
[821] | 41 |
|
---|
| 42 |
|
---|
[2725] | 43 | /* Length of these names has effect on size of libbusybox
|
---|
| 44 | * and "individual" binaries. Keep them short.
|
---|
| 45 | */
|
---|
| 46 | #if ENABLE_BUILD_LIBBUSYBOX
|
---|
| 47 | #if ENABLE_FEATURE_SHARED_BUSYBOX
|
---|
| 48 | int lbb_main(char **argv) EXTERNALLY_VISIBLE;
|
---|
| 49 | #else
|
---|
| 50 | int lbb_main(char **argv);
|
---|
| 51 | #endif
|
---|
| 52 | #endif
|
---|
| 53 |
|
---|
| 54 | POP_SAVED_FUNCTION_VISIBILITY
|
---|
| 55 |
|
---|
| 56 | #endif
|
---|