summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-04-11 07:04:23 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-04-11 07:04:23 +0000
commit473dae080a8a0089d5d619a56d8943d131aa451e (patch)
tree29763aae84d2c9336d9f34a5dc02c024285af60e /include
parentf1a7141cfcacf606ae321faa58c45617045460fe (diff)
add more convenient defines for [NO]MMU:
"#ifndef BB_NOMMU" is a double negative
Diffstat (limited to 'include')
-rw-r--r--include/libbb.h10
-rw-r--r--include/platform.h12
2 files changed, 15 insertions, 7 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 04bf6a5cd..11fcd19f2 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -269,6 +269,8 @@ char *xrealloc_getcwd_or_warn(char *cwd);
char *xmalloc_readlink_or_warn(const char *path);
char *xmalloc_realpath(const char *path);
+
+//TODO: signal(sid, f) is the same? then why?
extern void sig_catch(int,void (*)(int));
//#define sig_ignore(s) (sig_catch((s), SIG_IGN))
//#define sig_uncatch(s) (sig_catch((s), SIG_DFL))
@@ -278,7 +280,6 @@ extern void sig_unblock(int);
extern void sig_pause(void);
-
void xsetgid(gid_t gid);
void xsetuid(uid_t uid);
void xchdir(const char *path);
@@ -519,15 +520,14 @@ pid_t xspawn(char **argv);
/* Unlike waitpid, waits ONLY for one process,
* It's safe to pass negative 'pids' from failed [v]fork -
- * wait4pid will return -1 and ECHILD in errno.
+ * wait4pid will return -1 (and will not clobber [v]fork's errno).
* IOW: rc = wait4pid(spawn(argv));
* if (rc < 0) bb_perror_msg("%s", argv[0]);
* if (rc > 0) bb_error_msg("exit code: %d", rc);
*/
+int wait4pid(int pid);
int wait_pid(int *wstat, int pid);
int wait_nohang(int *wstat);
-int wait4pid(int pid);
-//TODO: signal(sid, f) is the same? then why?
#define wait_crashed(w) ((w) & 127)
#define wait_exitcode(w) ((w) >> 8)
#define wait_stopsig(w) ((w) >> 8)
@@ -564,7 +564,7 @@ enum {
DAEMON_CLOSE_EXTRA_FDS = 4,
DAEMON_ONLY_SANITIZE = 8, /* internal use */
};
-#ifndef BB_NOMMU
+#if BB_MMU
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)
diff --git a/include/platform.h b/include/platform.h
index 51add6c0f..d7389f1aa 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -212,7 +212,15 @@ typedef unsigned smalluint;
*/
#if defined __UCLIBC__ && __UCLIBC_MAJOR__ >= 0 && __UCLIBC_MINOR__ >= 9 && \
__UCLIBC_SUBLEVEL__ > 28 && !defined __ARCH_USE_MMU__
-#define BB_NOMMU
+#define BB_MMU 0
+#define BB_NOMMU 1
+#define USE_FOR_NOMMU(...) __VA_ARGS__
+#define USE_FOR_MMU(...)
+#else
+#define BB_MMU 1
+/* BB_NOMMU is not defined in this case! */
+#define USE_FOR_NOMMU(...)
+#define USE_FOR_MMU(...) __VA_ARGS__
#endif
/* Platforms that haven't got dprintf need to implement fdprintf() in
@@ -232,7 +240,7 @@ static ATTRIBUTE_ALWAYS_INLINE char* strchrnul(const char *s, char c) {
}
#endif
-/* Don't use lchown with glibc older than 2.1.x ... uC-libc lacks it */
+/* Don't use lchown with glibc older than 2.1.x ... uClibc lacks it */
#if (defined __GLIBC__ && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 1) || \
defined __UC_LIBC__
# define lchown chown