Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/include/busybox.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 815 by niro, Sat Sep 1 22:45:15 2007 UTC revision 816 by niro, Fri Apr 24 18:33:46 2009 UTC
# Line 9  Line 9 
9    
10  #include "libbb.h"  #include "libbb.h"
11    
12  /* order matters: used as index into "install_dir[]" in busybox.c */  #if __GNUC_PREREQ(4,1)
13  enum Location {  # pragma GCC visibility push(hidden)
14    #endif
15    
16    /* order matters: used as index into "install_dir[]" in appletlib.c */
17    typedef enum bb_install_loc_t {
18   _BB_DIR_ROOT = 0,   _BB_DIR_ROOT = 0,
19   _BB_DIR_BIN,   _BB_DIR_BIN,
20   _BB_DIR_SBIN,   _BB_DIR_SBIN,
21   _BB_DIR_USR_BIN,   _BB_DIR_USR_BIN,
22   _BB_DIR_USR_SBIN   _BB_DIR_USR_SBIN
23  };  } bb_install_loc_t;
24    
25  enum SUIDRoot {  typedef enum bb_suid_t {
26   _BB_SUID_NEVER = 0,   _BB_SUID_NEVER = 0,
27   _BB_SUID_MAYBE,   _BB_SUID_MAYBE,
28   _BB_SUID_ALWAYS   _BB_SUID_ALWAYS
29  };  } bb_suid_t;
30    
31    
32    /* Defined in appletlib.c (by including generated applet_tables.h) */
33    /* Keep in sync with applets/applet_tables.c! */
34    extern const char applet_names[];
35    extern int (*const applet_main[])(int argc, char **argv);
36    extern const uint16_t applet_nameofs[];
37    extern const uint8_t applet_install_loc[];
38    
39    #if ENABLE_FEATURE_SUID || ENABLE_FEATURE_PREFER_APPLETS
40    #define APPLET_NAME(i) (applet_names + (applet_nameofs[i] & 0x0fff))
41    #else
42    #define APPLET_NAME(i) (applet_names + applet_nameofs[i])
43    #endif
44    
45    #if ENABLE_FEATURE_PREFER_APPLETS
46    #define APPLET_IS_NOFORK(i) (applet_nameofs[i] & (1 << 12))
47    #define APPLET_IS_NOEXEC(i) (applet_nameofs[i] & (1 << 13))
48    #endif
49    
50    #if ENABLE_FEATURE_SUID
51    #define APPLET_SUID(i) ((applet_nameofs[i] >> 14) & 0x3)
52    #endif
53    
54    #if ENABLE_FEATURE_INSTALLER
55    #define APPLET_INSTALL_LOC(i) ({ \
56     unsigned v = (i); \
57     if (v & 1) v = applet_install_loc[v/2] >> 4; \
58     else v = applet_install_loc[v/2] & 0xf; \
59     v; })
60    #endif
61    
62    
63  struct BB_applet {  /* Length of these names has effect on size of libbusybox
64   const char *name;   * and "individual" binaries. Keep them short.
  int (*main) (int argc, char **argv);  
  __extension__ enum Location location:4;  
  __extension__ enum SUIDRoot need_suid:4;  
 };  
   
 /* From busybox.c and applet.c */  
 extern int busybox_main(int argc, char **argv);  
 extern const struct BB_applet applets[];  
 extern const unsigned short NUM_APPLETS;  
   
 /* Automagically pull in all the applet function prototypes and  
  * applet usage strings.  These are all of the form:  
  * extern int foo_main(int argc, char **argv);  
  * extern const char foo_usage[];  
  * These are all autogenerated from the set of currently defined applets.  
65   */   */
66  #define PROTOTYPES  #if ENABLE_BUILD_LIBBUSYBOX
67  #include "applets.h"  #if ENABLE_FEATURE_SHARED_BUSYBOX
68  #undef PROTOTYPES  int lbb_main(char **argv) EXTERNALLY_VISIBLE;
69    #else
70    int lbb_main(char **argv);
71    #endif
72    #endif
73    
74    #if __GNUC_PREREQ(4,1)
75    # pragma GCC visibility pop
76    #endif
77    
78  #endif /* _BB_INTERNAL_H_ */  #endif /* _BB_INTERNAL_H_ */

Legend:
Removed from v.815  
changed lines
  Added in v.816