aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-03-26 13:35:09 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-03-26 13:35:09 +0000
commit53091ecd20c294f0e0757a5f4e0d5c8c7b23b555 (patch)
treef4ae0be26d5debff091d2c976e77fa8050c6758c /include
parentec1a4b5a521b5adf295bc757c25231910f8c854b (diff)
downloadbusybox-53091ecd20c294f0e0757a5f4e0d5c8c7b23b555.tar.gz
Attempt to get more applets compile for NOMMU.
TODO_config_nommu documents what I managed to compile so far (yay! msh works! cool). inetd, telnetd, httpd still do not compile. TODO Also make fork(), daemon() produce warnings on compile stage (in addition to erros on link stage).
Diffstat (limited to 'include')
-rw-r--r--include/libbb.h25
1 files changed, 16 insertions, 9 deletions
diff --git a/include/libbb.h b/include/libbb.h
index ff7d3bf1a..32e099b54 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -471,7 +471,9 @@ int bb_execvp(const char *file, char *const argv[]);
pid_t spawn(char **argv);
pid_t xspawn(char **argv);
/* Helpers for daemonization.
+ *
* bb_daemonize(flags) = daemonize, does not compile on NOMMU
+ *
* bb_daemonize_or_rexec(flags, argv) = daemonizes on MMU (and ignores argv),
* rexec's itself on NOMMU with argv passed as command line.
* Thus bb_daemonize_or_rexec may cause your <applet>_main() to be re-executed
@@ -482,7 +484,12 @@ pid_t xspawn(char **argv);
* Both of the above will redirect fd 0,1,2 to /dev/null and drop ctty
* (will do setsid()).
*
+ * forkexit_or_rexec(argv) = bare-bones "fork + parent exits" on MMU,
+ * "vfork + re-exec ourself" on NOMMU. No fd redirection, no setsid().
+ * Currently used for openvt. On MMU ignores argv.
+ *
* Helper for network daemons in foreground mode:
+ *
* bb_sanitize_stdio() = make sure that fd 0,1,2 are opened by opening them
* to /dev/null if they are not.
*/
@@ -493,16 +500,16 @@ enum {
DAEMON_ONLY_SANITIZE = 8, /* internal use */
};
#ifndef BB_NOMMU
-#define bb_daemonize_or_rexec(flags, argv) bb_daemonize_or_rexec(flags)
-#define bb_daemonize(flags) bb_daemonize_or_rexec(flags, bogus)
+ void forkexit_or_rexec(void);
+# define forkexit_or_rexec(argv) forkexit_or_rexec()
+# define bb_daemonize_or_rexec(flags, argv) bb_daemonize_or_rexec(flags)
+# define bb_daemonize(flags) bb_daemonize_or_rexec(flags, bogus)
#else
-extern smallint re_execed;
-pid_t BUG_fork_is_unavailable_on_nommu(void);
-pid_t BUG_daemon_is_unavailable_on_nommu(void);
-pid_t BUG_bb_daemonize_is_unavailable_on_nommu(void);
-#define fork() BUG_fork_is_unavailable_on_nommu()
-#define daemon(a,b) BUG_daemon_is_unavailable_on_nommu()
-#define bb_daemonize(a) BUG_bb_daemonize_is_unavailable_on_nommu()
+ void forkexit_or_rexec(char **argv);
+ extern smallint re_execed;
+# define fork() BUG_fork_is_unavailable_on_nommu()
+# define daemon(a,b) BUG_daemon_is_unavailable_on_nommu()
+# define bb_daemonize(a) BUG_bb_daemonize_is_unavailable_on_nommu()
#endif
void bb_daemonize_or_rexec(int flags, char **argv);
void bb_sanitize_stdio(void);