aboutsummaryrefslogtreecommitdiff
path: root/include/libbb.h
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2017-08-30 16:57:45 +0100
committerRon Yorston <rmy@pobox.com>2017-08-30 17:09:57 +0100
commit0599746d9bcf513c4898cbd1a46ef1d5b3478627 (patch)
treee9e64f90efef836b22b404bbe351032cd14a8050 /include/libbb.h
parent002f3c9ea19a1cd68294d905f566be5b615a9bef (diff)
downloadbusybox-w32-0599746d9bcf513c4898cbd1a46ef1d5b3478627.tar.gz
busybox-w32-0599746d9bcf513c4898cbd1a46ef1d5b3478627.tar.bz2
busybox-w32-0599746d9bcf513c4898cbd1a46ef1d5b3478627.zip
win32: make vfork fail at compile-time
Nothing in busybox-w32 uses fork. Remove the implementations of fork, vfork and xvfork so that, for example, enabling cpio pass-through causes an error at compile-time, not run-time. MinGW-w64 defines pid_t, so we don't have to. Ensure code containing xvfork in netcat is disabled when NC_EXTRA is disabled. Otherwise removing the implementation of vfork costs 64 bytes.
Diffstat (limited to 'include/libbb.h')
-rw-r--r--include/libbb.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 2b349ed12..9ce89636a 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1103,6 +1103,7 @@ void exec_prog_or_SHELL(char **argv) NORETURN FAST_FUNC;
1103 1103
1104/* xvfork() can't be a _function_, return after vfork in child mangles stack 1104/* xvfork() can't be a _function_, return after vfork in child mangles stack
1105 * in the parent. It must be a macro. */ 1105 * in the parent. It must be a macro. */
1106#if !ENABLE_PLATFORM_MINGW32
1106#define xvfork() \ 1107#define xvfork() \
1107({ \ 1108({ \
1108 pid_t bb__xvfork_pid = vfork(); \ 1109 pid_t bb__xvfork_pid = vfork(); \
@@ -1110,6 +1111,9 @@ void exec_prog_or_SHELL(char **argv) NORETURN FAST_FUNC;
1110 bb_perror_msg_and_die("vfork"); \ 1111 bb_perror_msg_and_die("vfork"); \
1111 bb__xvfork_pid; \ 1112 bb__xvfork_pid; \
1112}) 1113})
1114#else
1115#define xvfork() vfork()
1116#endif
1113#if BB_MMU 1117#if BB_MMU
1114pid_t xfork(void) FAST_FUNC; 1118pid_t xfork(void) FAST_FUNC;
1115#endif 1119#endif