blob: 380de9ab8c17ef84f24f0dba3f65a6355f1e669c [file] [log] [blame]
Eric Andersenf6b71392000-09-26 01:09:18 +00001/* vi: set sw=4 ts=4: */
2/*
3 * Busybox main internal header file
4 *
Bernhard Reutner-Fischer86f5c992006-01-22 22:55:11 +00005 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
Eric Andersenf6b71392000-09-26 01:09:18 +00006 */
7#ifndef _BB_INTERNAL_H_
8#define _BB_INTERNAL_H_ 1
9
Robert Grieblc9aca452002-06-04 20:06:25 +000010#include "libbb.h"
Eric Andersenc3196012001-03-14 01:15:06 +000011
Denis Vlasenko335b63d2007-04-10 21:38:30 +000012#if ENABLE_FEATURE_INSTALLER
Denis Vlasenko0ee39992006-12-24 15:23:28 +000013/* order matters: used as index into "install_dir[]" in busybox.c */
Denis Vlasenko335b63d2007-04-10 21:38:30 +000014typedef enum bb_install_loc_t {
Eric Andersenf6b71392000-09-26 01:09:18 +000015 _BB_DIR_ROOT = 0,
16 _BB_DIR_BIN,
17 _BB_DIR_SBIN,
18 _BB_DIR_USR_BIN,
19 _BB_DIR_USR_SBIN
Denis Vlasenko335b63d2007-04-10 21:38:30 +000020} bb_install_loc_t;
21#endif
Eric Andersenf6b71392000-09-26 01:09:18 +000022
Denis Vlasenko335b63d2007-04-10 21:38:30 +000023#if ENABLE_FEATURE_SUID
24typedef enum bb_suid_t {
Robert Grieblc9aca452002-06-04 20:06:25 +000025 _BB_SUID_NEVER = 0,
26 _BB_SUID_MAYBE,
27 _BB_SUID_ALWAYS
Denis Vlasenko335b63d2007-04-10 21:38:30 +000028} bb_suid_t;
29#endif
Robert Grieblc9aca452002-06-04 20:06:25 +000030
Denis Vlasenko335b63d2007-04-10 21:38:30 +000031struct bb_applet {
Glenn L McGrath60a22ad2002-08-22 15:54:22 +000032 const char *name;
33 int (*main) (int argc, char **argv);
Denis Vlasenko335b63d2007-04-10 21:38:30 +000034#if ENABLE_FEATURE_INSTALLER
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
Denis Vlasenkoc44ab012007-04-09 03:11:58 +000041 /* true if instead if fork(); exec("applet"); waitpid();
42 * one can do fork(); exit(applet_main(argc,argv)); waitpid(); */
43 unsigned char noexec;
44 /* Even nicer */
45 /* true if instead if fork(); exec("applet"); waitpid();
46 * one can simply call applet_main(argc,argv); */
47 unsigned char nofork;
Denis Vlasenko335b63d2007-04-10 21:38:30 +000048#endif
Eric Andersenf6b71392000-09-26 01:09:18 +000049};
Glenn L McGrath60a22ad2002-08-22 15:54:22 +000050
Denis Vlasenko32b633a2007-04-09 03:05:48 +000051/* Defined in applet.c */
Denis Vlasenko335b63d2007-04-10 21:38:30 +000052extern const struct bb_applet applets[];
Denis Vlasenko0ee39992006-12-24 15:23:28 +000053extern const unsigned short NUM_APPLETS;
Eric Andersenf6b71392000-09-26 01:09:18 +000054
Denis Vlasenkoc7ba8b92007-02-03 17:27:14 +000055#endif /* _BB_INTERNAL_H_ */