fix mdev help output
[oweals/busybox.git] / include / busybox.h
1 /* vi: set sw=4 ts=4: */
2 /*
3  * Busybox main internal header file
4  *
5  * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
6  */
7 #ifndef _BB_INTERNAL_H_
8 #define _BB_INTERNAL_H_    1
9
10 #include "bb_config.h"
11
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <stdarg.h>
15 #include <sys/types.h>
16 #include <sys/stat.h>
17
18 #if __GNU_LIBRARY__ < 5 && \
19     !defined(__dietlibc__) && \
20     !defined(_NEWLIB_VERSION)
21 #error "Sorry, this libc version is not supported :("
22 #endif
23
24 #ifndef BB_EXTRA_VERSION
25 #define BB_BANNER "BusyBox v" BB_VER " (" BB_BT ")"
26 #else
27 #define BB_BANNER "BusyBox v" BB_VER " (" BB_EXTRA_VERSION ")"
28 #endif
29
30 #include <features.h>
31
32 /* Pull in the utility routines from libbb */
33 #include "libbb.h"
34
35 enum Location {
36         _BB_DIR_ROOT = 0,
37         _BB_DIR_BIN,
38         _BB_DIR_SBIN,
39         _BB_DIR_USR_BIN,
40         _BB_DIR_USR_SBIN
41 };
42
43 enum SUIDRoot {
44         _BB_SUID_NEVER = 0,
45         _BB_SUID_MAYBE,
46         _BB_SUID_ALWAYS
47 };
48
49 struct BB_applet {
50         const char *name;
51         int (*main) (int argc, char **argv);
52         __extension__ enum Location location:4;
53         __extension__ enum SUIDRoot need_suid:4;
54 };
55
56 /* From busybox.c */
57 extern const struct BB_applet applets[];
58
59 /* Automagically pull in all the applet function prototypes and
60  * applet usage strings.  These are all of the form:
61  *              extern int foo_main(int argc, char **argv);
62  *              extern const char foo_usage[];
63  * These are all autogenerated from the set of currently defined applets.
64  */
65 #define PROTOTYPES
66 #include "applets.h"
67 #undef PROTOTYPES
68
69 #ifdef CONFIG_FEATURE_BUFFERS_GO_ON_STACK
70 #define RESERVE_CONFIG_BUFFER(buffer,len)           char buffer[len]
71 #define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char buffer[len]
72 #define RELEASE_CONFIG_BUFFER(buffer)      ((void)0)
73 #else
74 #ifdef CONFIG_FEATURE_BUFFERS_GO_IN_BSS
75 #define RESERVE_CONFIG_BUFFER(buffer,len)  static          char buffer[len]
76 #define RESERVE_CONFIG_UBUFFER(buffer,len) static unsigned char buffer[len]
77 #define RELEASE_CONFIG_BUFFER(buffer)      ((void)0)
78 #else
79 #define RESERVE_CONFIG_BUFFER(buffer,len)           char *buffer=xmalloc(len)
80 #define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len)
81 #define RELEASE_CONFIG_BUFFER(buffer)      free (buffer)
82 #endif
83 #endif
84
85
86 #ifndef RB_POWER_OFF
87 /* Stop system and switch power off if possible.  */
88 #define RB_POWER_OFF   0x4321fedc
89 #endif
90
91 /* Try to pull in PATH_MAX */
92 #include <limits.h>
93
94 /* for PATH_MAX on systems that don't have it in limits.h */
95 #include <sys/param.h>
96 #ifndef PATH_MAX
97 #define  PATH_MAX         256
98 #endif
99
100 #ifdef DMALLOC
101 #include <dmalloc.h>
102 #endif
103
104 #endif                                                  /* _BB_INTERNAL_H_ */