aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/applets.h14
-rw-r--r--include/busybox.h26
-rw-r--r--include/libbb.h10
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))
355USE_ZCIP(APPLET(zcip, _BB_DIR_SBIN, _BB_SUID_NEVER)) 355USE_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 */
13enum Location { 14typedef 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
21enum SUIDRoot { 23#if ENABLE_FEATURE_SUID
24typedef 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
27struct BB_applet { 31struct 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 */
42extern const struct BB_applet applets[]; 52extern const struct bb_applet applets[];
43extern const unsigned short NUM_APPLETS; 53extern 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);
608int write_pidfile(const char *path); 608int 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;
623extern int die_sleep; 623extern int die_sleep;
624extern int xfunc_error_retval; 624extern int xfunc_error_retval;
625extern jmp_buf die_jmp; 625extern jmp_buf die_jmp;
626extern void sleep_and_die(void) ATTRIBUTE_NORETURN; 626extern void xfunc_die(void) ATTRIBUTE_NORETURN;
627extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE; 627extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE;
628extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); 628extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
629extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); 629extern 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
673struct BB_applet; 673struct bb_applet;
674extern const struct BB_applet *find_applet_by_name(const char *name); 674extern 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. */
676extern void run_applet_by_name(const char *name, int argc, char **argv); 676extern void run_applet_by_name(const char *name, int argc, char **argv);
677extern void run_current_applet_and_exit(int argc, char **argv) ATTRIBUTE_NORETURN; 677extern 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")
883extern const struct BB_applet *current_applet; 883extern const struct bb_applet *current_applet;
884extern const char *applet_name; 884extern const char *applet_name;
885extern const char BB_BANNER[]; 885extern const char BB_BANNER[];
886 886