diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/applets.h | 14 | ||||
-rw-r--r-- | include/busybox.h | 26 | ||||
-rw-r--r-- | include/libbb.h | 10 |
3 files changed, 30 insertions, 20 deletions
diff --git a/include/applets.h b/include/applets.h index b59d33183..d05299b69 100644 --- a/include/applets.h +++ b/include/applets.h | |||
@@ -52,12 +52,12 @@ s - suid type: | |||
52 | # define APPLET_NOFORK(name,main,l,s,name2) LINK l name | 52 | # define APPLET_NOFORK(name,main,l,s,name2) LINK l name |
53 | 53 | ||
54 | #else | 54 | #else |
55 | const struct BB_applet applets[] = { /* name,main,location,need_suid */ | 55 | const struct bb_applet applets[] = { /* name, main, location, need_suid */ |
56 | # define APPLET(name,l,s) {#name,name##_main,l,s}, | 56 | # define APPLET(name,l,s) { #name, name##_main USE_FEATURE_INSTALLER(,l) USE_FEATURE_SUID(,s) }, |
57 | # define APPLET_NOUSAGE(name,main,l,s) {#name,main##_main,l,s}, | 57 | # define APPLET_NOUSAGE(name,main,l,s) { #name, main##_main USE_FEATURE_INSTALLER(,l) USE_FEATURE_SUID(,s) }, |
58 | # define APPLET_ODDNAME(name,main,l,s,name2) {#name,main##_main,l,s}, | 58 | # define APPLET_ODDNAME(name,main,l,s,name2) { #name, main##_main USE_FEATURE_INSTALLER(,l) USE_FEATURE_SUID(,s) }, |
59 | # define APPLET_NOEXEC(name,main,l,s,name2) {#name,main##_main,l,s,1}, | 59 | # define APPLET_NOEXEC(name,main,l,s,name2) { #name, main##_main USE_FEATURE_INSTALLER(,l) USE_FEATURE_SUID(,s) USE_FEATURE_EXEC_PREFER_APPLETS(,1) }, |
60 | # define APPLET_NOFORK(name,main,l,s,name2) {#name,main##_main,l,s,1,1}, | 60 | # define APPLET_NOFORK(name,main,l,s,name2) { #name, main##_main USE_FEATURE_INSTALLER(,l) USE_FEATURE_SUID(,s) USE_FEATURE_EXEC_PREFER_APPLETS(,1 ,1) }, |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | #if ENABLE_INSTALL_NO_USR | 63 | #if ENABLE_INSTALL_NO_USR |
@@ -355,7 +355,7 @@ USE_GUNZIP(APPLET_ODDNAME(zcat, gunzip, _BB_DIR_BIN, _BB_SUID_NEVER, zcat)) | |||
355 | USE_ZCIP(APPLET(zcip, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 355 | USE_ZCIP(APPLET(zcip, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
356 | 356 | ||
357 | #if !defined(PROTOTYPES) && !defined(MAKE_USAGE) | 357 | #if !defined(PROTOTYPES) && !defined(MAKE_USAGE) |
358 | { 0, NULL, 0, 0 } | 358 | { NULL } |
359 | }; | 359 | }; |
360 | #endif | 360 | #endif |
361 | 361 | ||
diff --git a/include/busybox.h b/include/busybox.h index 6f4808778..380de9ab8 100644 --- a/include/busybox.h +++ b/include/busybox.h | |||
@@ -9,26 +9,35 @@ | |||
9 | 9 | ||
10 | #include "libbb.h" | 10 | #include "libbb.h" |
11 | 11 | ||
12 | #if ENABLE_FEATURE_INSTALLER | ||
12 | /* order matters: used as index into "install_dir[]" in busybox.c */ | 13 | /* order matters: used as index into "install_dir[]" in busybox.c */ |
13 | enum Location { | 14 | typedef enum bb_install_loc_t { |
14 | _BB_DIR_ROOT = 0, | 15 | _BB_DIR_ROOT = 0, |
15 | _BB_DIR_BIN, | 16 | _BB_DIR_BIN, |
16 | _BB_DIR_SBIN, | 17 | _BB_DIR_SBIN, |
17 | _BB_DIR_USR_BIN, | 18 | _BB_DIR_USR_BIN, |
18 | _BB_DIR_USR_SBIN | 19 | _BB_DIR_USR_SBIN |
19 | }; | 20 | } bb_install_loc_t; |
21 | #endif | ||
20 | 22 | ||
21 | enum SUIDRoot { | 23 | #if ENABLE_FEATURE_SUID |
24 | typedef enum bb_suid_t { | ||
22 | _BB_SUID_NEVER = 0, | 25 | _BB_SUID_NEVER = 0, |
23 | _BB_SUID_MAYBE, | 26 | _BB_SUID_MAYBE, |
24 | _BB_SUID_ALWAYS | 27 | _BB_SUID_ALWAYS |
25 | }; | 28 | } bb_suid_t; |
29 | #endif | ||
26 | 30 | ||
27 | struct BB_applet { | 31 | struct bb_applet { |
28 | const char *name; | 32 | const char *name; |
29 | int (*main) (int argc, char **argv); | 33 | int (*main) (int argc, char **argv); |
30 | __extension__ enum Location location:8; | 34 | #if ENABLE_FEATURE_INSTALLER |
31 | __extension__ enum SUIDRoot need_suid:8; | 35 | __extension__ enum bb_install_loc_t install_loc:8; |
36 | #endif | ||
37 | #if ENABLE_FEATURE_SUID | ||
38 | __extension__ enum bb_suid_t need_suid:8; | ||
39 | #endif | ||
40 | #if ENABLE_FEATURE_EXEC_PREFER_APPLETS | ||
32 | /* true if instead if fork(); exec("applet"); waitpid(); | 41 | /* true if instead if fork(); exec("applet"); waitpid(); |
33 | * one can do fork(); exit(applet_main(argc,argv)); waitpid(); */ | 42 | * one can do fork(); exit(applet_main(argc,argv)); waitpid(); */ |
34 | unsigned char noexec; | 43 | unsigned char noexec; |
@@ -36,10 +45,11 @@ struct BB_applet { | |||
36 | /* true if instead if fork(); exec("applet"); waitpid(); | 45 | /* true if instead if fork(); exec("applet"); waitpid(); |
37 | * one can simply call applet_main(argc,argv); */ | 46 | * one can simply call applet_main(argc,argv); */ |
38 | unsigned char nofork; | 47 | unsigned char nofork; |
48 | #endif | ||
39 | }; | 49 | }; |
40 | 50 | ||
41 | /* Defined in applet.c */ | 51 | /* Defined in applet.c */ |
42 | extern const struct BB_applet applets[]; | 52 | extern const struct bb_applet applets[]; |
43 | extern const unsigned short NUM_APPLETS; | 53 | extern const unsigned short NUM_APPLETS; |
44 | 54 | ||
45 | #endif /* _BB_INTERNAL_H_ */ | 55 | #endif /* _BB_INTERNAL_H_ */ |
diff --git a/include/libbb.h b/include/libbb.h index 3919524bc..6fff441c5 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -608,7 +608,7 @@ llist_t *llist_rev(llist_t *list); | |||
608 | int write_pidfile(const char *path); | 608 | int write_pidfile(const char *path); |
609 | #define remove_pidfile(f) ((void)unlink(f)) | 609 | #define remove_pidfile(f) ((void)unlink(f)) |
610 | #else | 610 | #else |
611 | #define write_pidfile(f) 1 | 611 | #define write_pidfile(f) TRUE |
612 | #define remove_pidfile(f) ((void)0) | 612 | #define remove_pidfile(f) ((void)0) |
613 | #endif | 613 | #endif |
614 | 614 | ||
@@ -623,7 +623,7 @@ extern smallint logmode; | |||
623 | extern int die_sleep; | 623 | extern int die_sleep; |
624 | extern int xfunc_error_retval; | 624 | extern int xfunc_error_retval; |
625 | extern jmp_buf die_jmp; | 625 | extern jmp_buf die_jmp; |
626 | extern void sleep_and_die(void) ATTRIBUTE_NORETURN; | 626 | extern void xfunc_die(void) ATTRIBUTE_NORETURN; |
627 | extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE; | 627 | extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE; |
628 | extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); | 628 | extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); |
629 | extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); | 629 | extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); |
@@ -670,8 +670,8 @@ const struct hwtype *get_hwntype(int type); | |||
670 | 670 | ||
671 | 671 | ||
672 | #ifndef BUILD_INDIVIDUAL | 672 | #ifndef BUILD_INDIVIDUAL |
673 | struct BB_applet; | 673 | struct bb_applet; |
674 | extern const struct BB_applet *find_applet_by_name(const char *name); | 674 | extern const struct bb_applet *find_applet_by_name(const char *name); |
675 | /* Returns only if applet is not found. */ | 675 | /* Returns only if applet is not found. */ |
676 | extern void run_applet_by_name(const char *name, int argc, char **argv); | 676 | extern void run_applet_by_name(const char *name, int argc, char **argv); |
677 | extern void run_current_applet_and_exit(int argc, char **argv) ATTRIBUTE_NORETURN; | 677 | extern void run_current_applet_and_exit(int argc, char **argv) ATTRIBUTE_NORETURN; |
@@ -880,7 +880,7 @@ enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */ | |||
880 | }; | 880 | }; |
881 | 881 | ||
882 | #define FILEUTILS_CP_OPTSTR "pdRfils" USE_SELINUX("c") | 882 | #define FILEUTILS_CP_OPTSTR "pdRfils" USE_SELINUX("c") |
883 | extern const struct BB_applet *current_applet; | 883 | extern const struct bb_applet *current_applet; |
884 | extern const char *applet_name; | 884 | extern const char *applet_name; |
885 | extern const char BB_BANNER[]; | 885 | extern const char BB_BANNER[]; |
886 | 886 | ||