diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-11 07:04:23 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-11 07:04:23 +0000 |
| commit | 473dae080a8a0089d5d619a56d8943d131aa451e (patch) | |
| tree | 29763aae84d2c9336d9f34a5dc02c024285af60e /include | |
| parent | f1a7141cfcacf606ae321faa58c45617045460fe (diff) | |
| download | busybox-w32-473dae080a8a0089d5d619a56d8943d131aa451e.tar.gz busybox-w32-473dae080a8a0089d5d619a56d8943d131aa451e.tar.bz2 busybox-w32-473dae080a8a0089d5d619a56d8943d131aa451e.zip | |
add more convenient defines for [NO]MMU:
"#ifndef BB_NOMMU" is a double negative
Diffstat (limited to 'include')
| -rw-r--r-- | include/libbb.h | 10 | ||||
| -rw-r--r-- | include/platform.h | 12 |
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); | |||
| 269 | char *xmalloc_readlink_or_warn(const char *path); | 269 | char *xmalloc_readlink_or_warn(const char *path); |
| 270 | char *xmalloc_realpath(const char *path); | 270 | char *xmalloc_realpath(const char *path); |
| 271 | 271 | ||
| 272 | |||
| 273 | //TODO: signal(sid, f) is the same? then why? | ||
| 272 | extern void sig_catch(int,void (*)(int)); | 274 | extern void sig_catch(int,void (*)(int)); |
| 273 | //#define sig_ignore(s) (sig_catch((s), SIG_IGN)) | 275 | //#define sig_ignore(s) (sig_catch((s), SIG_IGN)) |
| 274 | //#define sig_uncatch(s) (sig_catch((s), SIG_DFL)) | 276 | //#define sig_uncatch(s) (sig_catch((s), SIG_DFL)) |
| @@ -278,7 +280,6 @@ extern void sig_unblock(int); | |||
| 278 | extern void sig_pause(void); | 280 | extern void sig_pause(void); |
| 279 | 281 | ||
| 280 | 282 | ||
| 281 | |||
| 282 | void xsetgid(gid_t gid); | 283 | void xsetgid(gid_t gid); |
| 283 | void xsetuid(uid_t uid); | 284 | void xsetuid(uid_t uid); |
| 284 | void xchdir(const char *path); | 285 | void xchdir(const char *path); |
| @@ -519,15 +520,14 @@ pid_t xspawn(char **argv); | |||
| 519 | 520 | ||
| 520 | /* Unlike waitpid, waits ONLY for one process, | 521 | /* Unlike waitpid, waits ONLY for one process, |
| 521 | * It's safe to pass negative 'pids' from failed [v]fork - | 522 | * It's safe to pass negative 'pids' from failed [v]fork - |
| 522 | * wait4pid will return -1 and ECHILD in errno. | 523 | * wait4pid will return -1 (and will not clobber [v]fork's errno). |
| 523 | * IOW: rc = wait4pid(spawn(argv)); | 524 | * IOW: rc = wait4pid(spawn(argv)); |
| 524 | * if (rc < 0) bb_perror_msg("%s", argv[0]); | 525 | * if (rc < 0) bb_perror_msg("%s", argv[0]); |
| 525 | * if (rc > 0) bb_error_msg("exit code: %d", rc); | 526 | * if (rc > 0) bb_error_msg("exit code: %d", rc); |
| 526 | */ | 527 | */ |
| 528 | int wait4pid(int pid); | ||
| 527 | int wait_pid(int *wstat, int pid); | 529 | int wait_pid(int *wstat, int pid); |
| 528 | int wait_nohang(int *wstat); | 530 | int wait_nohang(int *wstat); |
| 529 | int wait4pid(int pid); | ||
| 530 | //TODO: signal(sid, f) is the same? then why? | ||
| 531 | #define wait_crashed(w) ((w) & 127) | 531 | #define wait_crashed(w) ((w) & 127) |
| 532 | #define wait_exitcode(w) ((w) >> 8) | 532 | #define wait_exitcode(w) ((w) >> 8) |
| 533 | #define wait_stopsig(w) ((w) >> 8) | 533 | #define wait_stopsig(w) ((w) >> 8) |
| @@ -564,7 +564,7 @@ enum { | |||
| 564 | DAEMON_CLOSE_EXTRA_FDS = 4, | 564 | DAEMON_CLOSE_EXTRA_FDS = 4, |
| 565 | DAEMON_ONLY_SANITIZE = 8, /* internal use */ | 565 | DAEMON_ONLY_SANITIZE = 8, /* internal use */ |
| 566 | }; | 566 | }; |
| 567 | #ifndef BB_NOMMU | 567 | #if BB_MMU |
| 568 | void forkexit_or_rexec(void); | 568 | void forkexit_or_rexec(void); |
| 569 | # define forkexit_or_rexec(argv) forkexit_or_rexec() | 569 | # define forkexit_or_rexec(argv) forkexit_or_rexec() |
| 570 | # define bb_daemonize_or_rexec(flags, argv) bb_daemonize_or_rexec(flags) | 570 | # 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; | |||
| 212 | */ | 212 | */ |
| 213 | #if defined __UCLIBC__ && __UCLIBC_MAJOR__ >= 0 && __UCLIBC_MINOR__ >= 9 && \ | 213 | #if defined __UCLIBC__ && __UCLIBC_MAJOR__ >= 0 && __UCLIBC_MINOR__ >= 9 && \ |
| 214 | __UCLIBC_SUBLEVEL__ > 28 && !defined __ARCH_USE_MMU__ | 214 | __UCLIBC_SUBLEVEL__ > 28 && !defined __ARCH_USE_MMU__ |
| 215 | #define BB_NOMMU | 215 | #define BB_MMU 0 |
| 216 | #define BB_NOMMU 1 | ||
| 217 | #define USE_FOR_NOMMU(...) __VA_ARGS__ | ||
| 218 | #define USE_FOR_MMU(...) | ||
| 219 | #else | ||
| 220 | #define BB_MMU 1 | ||
| 221 | /* BB_NOMMU is not defined in this case! */ | ||
| 222 | #define USE_FOR_NOMMU(...) | ||
| 223 | #define USE_FOR_MMU(...) __VA_ARGS__ | ||
| 216 | #endif | 224 | #endif |
| 217 | 225 | ||
| 218 | /* Platforms that haven't got dprintf need to implement fdprintf() in | 226 | /* 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) { | |||
| 232 | } | 240 | } |
| 233 | #endif | 241 | #endif |
| 234 | 242 | ||
| 235 | /* Don't use lchown with glibc older than 2.1.x ... uC-libc lacks it */ | 243 | /* Don't use lchown with glibc older than 2.1.x ... uClibc lacks it */ |
| 236 | #if (defined __GLIBC__ && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 1) || \ | 244 | #if (defined __GLIBC__ && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 1) || \ |
| 237 | defined __UC_LIBC__ | 245 | defined __UC_LIBC__ |
| 238 | # define lchown chown | 246 | # define lchown chown |
