aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/busybox.h29
1 files changed, 16 insertions, 13 deletions
diff --git a/include/busybox.h b/include/busybox.h
index f99901aa3..ec6953e87 100644
--- a/include/busybox.h
+++ b/include/busybox.h
@@ -28,28 +28,31 @@ typedef enum bb_suid_t {
28/* Defined in appletlib.c (by including generated applet_tables.h) */ 28/* Defined in appletlib.c (by including generated applet_tables.h) */
29/* Keep in sync with applets/applet_tables.c! */ 29/* Keep in sync with applets/applet_tables.c! */
30extern const char applet_names[]; 30extern const char applet_names[];
31extern int (*const applet_mains[])(int argc, char **argv); 31extern int (*const applet_main[])(int argc, char **argv);
32extern const uint16_t applet_nameofs[];
33extern const uint8_t applet_install_loc[];
32 34
33#if ENABLE_FEATURE_INSTALLER || ENABLE_FEATURE_PREFER_APPLETS 35#if ENABLE_FEATURE_SUID || ENABLE_FEATURE_PREFER_APPLETS
34extern const uint32_t applet_nameofs[]; 36#define APPLET_NAME(i) (applet_names + (applet_nameofs[i] & 0x0fff))
35#else 37#else
36extern const uint16_t applet_nameofs[]; 38#define APPLET_NAME(i) (applet_names + applet_nameofs[i])
39#endif
40
41#if ENABLE_FEATURE_PREFER_APPLETS
42#define APPLET_IS_NOFORK(i) (applet_nameofs[i] & (1 << 12))
43#define APPLET_IS_NOEXEC(i) (applet_nameofs[i] & (1 << 13))
37#endif 44#endif
38 45
39#if ENABLE_FEATURE_SUID 46#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) 47#define APPLET_SUID(i) ((applet_nameofs[i] >> 14) & 0x3)
42#else
43#define APPLET_NAME(i) (applet_names + (applet_nameofs[i] & 0xffff))
44#endif 48#endif
45 49
46#if ENABLE_FEATURE_INSTALLER 50#if ENABLE_FEATURE_INSTALLER
47#define APPLET_INSTALL_LOC(i) ((applet_nameofs[i] >> 16) & 0x7) 51#define APPLET_INSTALL_LOC(i) ({ \
48#endif 52 unsigned v = (i); \
49 53 if (v & 1) v = applet_install_loc[v/2] >> 4; \
50#if ENABLE_FEATURE_PREFER_APPLETS 54 else v = applet_install_loc[v/2] & 0xf; \
51#define APPLET_IS_NOFORK(i) (applet_nameofs[i] & (1 << 19)) 55 v; })
52#define APPLET_IS_NOEXEC(i) (applet_nameofs[i] & (1 << 20))
53#endif 56#endif
54 57
55 58