[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);
|
---|
| 18 | extern const uint16_t applet_nameofs[];
|
---|
[3232] | 19 | extern const uint8_t applet_install_loc[] ALIGN1;
|
---|
[2725] | 20 |
|
---|
| 21 | #if ENABLE_FEATURE_SUID || ENABLE_FEATURE_PREFER_APPLETS
|
---|
| 22 | # define APPLET_NAME(i) (applet_names + (applet_nameofs[i] & 0x0fff))
|
---|
| 23 | #else
|
---|
| 24 | # define APPLET_NAME(i) (applet_names + applet_nameofs[i])
|
---|
[1765] | 25 | #endif
|
---|
[821] | 26 |
|
---|
[2725] | 27 | #if ENABLE_FEATURE_PREFER_APPLETS
|
---|
| 28 | # define APPLET_IS_NOFORK(i) (applet_nameofs[i] & (1 << 12))
|
---|
| 29 | # define APPLET_IS_NOEXEC(i) (applet_nameofs[i] & (1 << 13))
|
---|
| 30 | #else
|
---|
| 31 | # define APPLET_IS_NOFORK(i) 0
|
---|
| 32 | # define APPLET_IS_NOEXEC(i) 0
|
---|
[1765] | 33 | #endif
|
---|
[2725] | 34 |
|
---|
[1765] | 35 | #if ENABLE_FEATURE_SUID
|
---|
[2725] | 36 | # define APPLET_SUID(i) ((applet_nameofs[i] >> 14) & 0x3)
|
---|
[1765] | 37 | #endif
|
---|
[2725] | 38 |
|
---|
| 39 | #if ENABLE_FEATURE_INSTALLER
|
---|
| 40 | #define APPLET_INSTALL_LOC(i) ({ \
|
---|
| 41 | unsigned v = (i); \
|
---|
| 42 | if (v & 1) v = applet_install_loc[v/2] >> 4; \
|
---|
| 43 | else v = applet_install_loc[v/2] & 0xf; \
|
---|
| 44 | v; })
|
---|
[1765] | 45 | #endif
|
---|
[821] | 46 |
|
---|
| 47 |
|
---|
[2725] | 48 | /* Length of these names has effect on size of libbusybox
|
---|
| 49 | * and "individual" binaries. Keep them short.
|
---|
| 50 | */
|
---|
| 51 | #if ENABLE_BUILD_LIBBUSYBOX
|
---|
| 52 | #if ENABLE_FEATURE_SHARED_BUSYBOX
|
---|
| 53 | int lbb_main(char **argv) EXTERNALLY_VISIBLE;
|
---|
| 54 | #else
|
---|
| 55 | int lbb_main(char **argv);
|
---|
| 56 | #endif
|
---|
| 57 | #endif
|
---|
| 58 |
|
---|
| 59 | POP_SAVED_FUNCTION_VISIBILITY
|
---|
| 60 |
|
---|
| 61 | #endif
|
---|