diff options
Diffstat (limited to 'busybox/include/busybox.h')
-rw-r--r-- | busybox/include/busybox.h | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/busybox/include/busybox.h b/busybox/include/busybox.h new file mode 100644 index 000000000..f6f575957 --- /dev/null +++ b/busybox/include/busybox.h | |||
@@ -0,0 +1,121 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | ||
2 | /* | ||
3 | * Busybox main internal header file | ||
4 | * | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | * | ||
20 | * Based in part on code from sash, Copyright (c) 1999 by David I. Bell | ||
21 | * Permission has been granted to redistribute this code under the GPL. | ||
22 | * | ||
23 | */ | ||
24 | #ifndef _BB_INTERNAL_H_ | ||
25 | #define _BB_INTERNAL_H_ 1 | ||
26 | |||
27 | #include "config.h" | ||
28 | |||
29 | #include <stdio.h> | ||
30 | #include <stdlib.h> | ||
31 | #include <stdarg.h> | ||
32 | #include <sys/stat.h> | ||
33 | #include <sys/types.h> | ||
34 | |||
35 | #if __GNU_LIBRARY__ < 5 | ||
36 | #ifndef __dietlibc__ | ||
37 | #error "Sorry, libc5 is not supported" | ||
38 | #endif | ||
39 | #endif | ||
40 | |||
41 | #ifndef BB_EXTRA_VERSION | ||
42 | #define BB_BANNER "BusyBox v" BB_VER " (" BB_BT ")" | ||
43 | #else | ||
44 | #define BB_BANNER "BusyBox v" BB_VER " (" BB_EXTRA_VERSION ")" | ||
45 | #endif | ||
46 | |||
47 | #ifdef DMALLOC | ||
48 | #include <dmalloc.h> | ||
49 | #endif | ||
50 | |||
51 | #include <features.h> | ||
52 | |||
53 | /* Pull in the utility routines from libbb */ | ||
54 | #include "libbb.h" | ||
55 | |||
56 | enum Location { | ||
57 | _BB_DIR_ROOT = 0, | ||
58 | _BB_DIR_BIN, | ||
59 | _BB_DIR_SBIN, | ||
60 | _BB_DIR_USR_BIN, | ||
61 | _BB_DIR_USR_SBIN | ||
62 | }; | ||
63 | |||
64 | enum SUIDRoot { | ||
65 | _BB_SUID_NEVER = 0, | ||
66 | _BB_SUID_MAYBE, | ||
67 | _BB_SUID_ALWAYS | ||
68 | }; | ||
69 | |||
70 | struct BB_applet { | ||
71 | const char *name; | ||
72 | int (*main) (int argc, char **argv); | ||
73 | enum Location location:4; | ||
74 | enum SUIDRoot need_suid:4; | ||
75 | }; | ||
76 | |||
77 | /* From busybox.c */ | ||
78 | extern const struct BB_applet applets[]; | ||
79 | |||
80 | /* Automagically pull in all the applet function prototypes and | ||
81 | * applet usage strings. These are all of the form: | ||
82 | * extern int foo_main(int argc, char **argv); | ||
83 | * extern const char foo_usage[]; | ||
84 | * These are all autogenerated from the set of currently defined applets. | ||
85 | */ | ||
86 | #define PROTOTYPES | ||
87 | #include "applets.h" | ||
88 | #undef PROTOTYPES | ||
89 | |||
90 | #ifdef CONFIG_FEATURE_BUFFERS_GO_ON_STACK | ||
91 | #define RESERVE_CONFIG_BUFFER(buffer,len) char buffer[len] | ||
92 | #define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char buffer[len] | ||
93 | #define RELEASE_CONFIG_BUFFER(buffer) ((void)0) | ||
94 | #else | ||
95 | #ifdef CONFIG_FEATURE_BUFFERS_GO_IN_BSS | ||
96 | #define RESERVE_CONFIG_BUFFER(buffer,len) static char buffer[len] | ||
97 | #define RESERVE_CONFIG_UBUFFER(buffer,len) static unsigned char buffer[len] | ||
98 | #define RELEASE_CONFIG_BUFFER(buffer) ((void)0) | ||
99 | #else | ||
100 | #define RESERVE_CONFIG_BUFFER(buffer,len) char *buffer=xmalloc(len) | ||
101 | #define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len) | ||
102 | #define RELEASE_CONFIG_BUFFER(buffer) free (buffer) | ||
103 | #endif | ||
104 | #endif | ||
105 | |||
106 | |||
107 | #ifndef RB_POWER_OFF | ||
108 | /* Stop system and switch power off if possible. */ | ||
109 | #define RB_POWER_OFF 0x4321fedc | ||
110 | #endif | ||
111 | |||
112 | /* Try to pull in PATH_MAX */ | ||
113 | #include <limits.h> | ||
114 | |||
115 | /* for PATH_MAX on systems that don't have it in limits.h */ | ||
116 | #include <sys/param.h> | ||
117 | #ifndef PATH_MAX | ||
118 | #define PATH_MAX 256 | ||
119 | #endif | ||
120 | |||
121 | #endif /* _BB_INTERNAL_H_ */ | ||