blob: 59d800e8b5f14c575031d6ad5d800f14e505ce0d [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
Rob Landley193c8c72005-07-27 06:55:36 +000010#include "bb_config.h"
Eric Andersenf6b71392000-09-26 01:09:18 +000011
Eric Andersened3ef502001-01-27 08:24:39 +000012#include <stdio.h>
Manuel Novoa III 68474f32004-02-05 14:45:58 +000013#include <stdlib.h>
Eric Andersenf6b71392000-09-26 01:09:18 +000014#include <stdarg.h>
Eric Andersen01bda5d2001-01-02 01:16:38 +000015#include <sys/types.h>
"Vladimir N. Oleynik"843c5ef2005-09-29 07:55:51 +000016#include <sys/stat.h>
Eric Andersenf6b71392000-09-26 01:09:18 +000017
Mike Frysingerca1b6fc2005-03-04 01:09:43 +000018#if __GNU_LIBRARY__ < 5 && \
19 !defined(__dietlibc__) && \
20 !defined(_NEWLIB_VERSION)
21#error "Sorry, this libc version is not supported :("
Eric Andersen85e5e722003-07-22 08:56:55 +000022#endif
23
"Vladimir N. Oleynik"dd1ccdd2006-02-16 15:40:24 +000024extern const char BB_BANNER[];
Matt Kraai6ba1a802001-04-12 20:11:55 +000025
Eric Andersen2b1c3672001-03-14 01:36:52 +000026#include <features.h>
Eric Andersenc3196012001-03-14 01:15:06 +000027
Glenn L McGrath60a22ad2002-08-22 15:54:22 +000028/* Pull in the utility routines from libbb */
Robert Grieblc9aca452002-06-04 20:06:25 +000029#include "libbb.h"
Eric Andersenc3196012001-03-14 01:15:06 +000030
Eric Andersenf6b71392000-09-26 01:09:18 +000031enum Location {
32 _BB_DIR_ROOT = 0,
33 _BB_DIR_BIN,
34 _BB_DIR_SBIN,
35 _BB_DIR_USR_BIN,
36 _BB_DIR_USR_SBIN
37};
38
Robert Grieblc9aca452002-06-04 20:06:25 +000039enum SUIDRoot {
40 _BB_SUID_NEVER = 0,
41 _BB_SUID_MAYBE,
42 _BB_SUID_ALWAYS
43};
44
Eric Andersenf6b71392000-09-26 01:09:18 +000045struct BB_applet {
Glenn L McGrath60a22ad2002-08-22 15:54:22 +000046 const char *name;
47 int (*main) (int argc, char **argv);
Bernhard Reutner-Fischer86f5c992006-01-22 22:55:11 +000048 __extension__ enum Location location:4;
49 __extension__ enum SUIDRoot need_suid:4;
Eric Andersenf6b71392000-09-26 01:09:18 +000050};
Glenn L McGrath60a22ad2002-08-22 15:54:22 +000051
Eric Andersenf6b71392000-09-26 01:09:18 +000052/* From busybox.c */
53extern const struct BB_applet applets[];
54
Eric Andersen8c725e62000-11-30 00:27:06 +000055/* Automagically pull in all the applet function prototypes and
Eric Andersen87559822000-12-01 19:02:24 +000056 * applet usage strings. These are all of the form:
Eric Andersen8c725e62000-11-30 00:27:06 +000057 * extern int foo_main(int argc, char **argv);
58 * extern const char foo_usage[];
Eric Andersenc7bda1c2004-03-15 08:29:22 +000059 * These are all autogenerated from the set of currently defined applets.
Eric Andersen8c725e62000-11-30 00:27:06 +000060 */
61#define PROTOTYPES
62#include "applets.h"
63#undef PROTOTYPES
Eric Andersenf6b71392000-09-26 01:09:18 +000064
Eric Andersenaad1a882001-03-16 22:47:14 +000065#ifndef RB_POWER_OFF
66/* Stop system and switch power off if possible. */
67#define RB_POWER_OFF 0x4321fedc
Eric Andersend35c2152001-01-25 23:49:09 +000068#endif
69
Eric Andersen38ddbed2002-03-16 02:12:30 +000070/* Try to pull in PATH_MAX */
71#include <limits.h>
Glenn L McGrath60a22ad2002-08-22 15:54:22 +000072
Eric Andersen38ddbed2002-03-16 02:12:30 +000073/* for PATH_MAX on systems that don't have it in limits.h */
Glenn L McGrath60a22ad2002-08-22 15:54:22 +000074#include <sys/param.h>
75#ifndef PATH_MAX
Eric Andersen20d739a2002-01-26 23:58:22 +000076#define PATH_MAX 256
77#endif
Mark Whitleye0bf91d2001-03-13 00:40:19 +000078
Bernhard Reutner-Fischerd4cffd12005-09-21 17:38:30 +000079#ifdef DMALLOC
80#include <dmalloc.h>
81#endif
82
Glenn L McGrath60a22ad2002-08-22 15:54:22 +000083#endif /* _BB_INTERNAL_H_ */