about summary refs log tree commit diff
path: root/src/process/fdop.h
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-02-03 16:42:40 -0500
committerRich Felker <dalias@aerifal.cx>2013-02-03 16:42:40 -0500
commitfb6b159d9ec7cf1e037daa974eeeacf3c8b3b3f1 (patch)
treeb2abcc807bf30691c9e65a59f463c77f0e46ff19 /src/process/fdop.h
parent89d3df6e5420878e35a93a481105017a94a02852 (diff)
downloadmusl-fb6b159d9ec7cf1e037daa974eeeacf3c8b3b3f1.tar.gz
musl-fb6b159d9ec7cf1e037daa974eeeacf3c8b3b3f1.tar.xz
musl-fb6b159d9ec7cf1e037daa974eeeacf3c8b3b3f1.zip
overhaul posix_spawn to use CLONE_VM instead of vfork
the proposed change was described in detail in detail previously on
the mailing list. in short, vfork is unsafe because:

1. the compiler could make optimizations that cause the child to
clobber the parent's local vars.

2. strace is buggy and allows the vforking parent to run before the
child execs when run under strace.

the new design uses a close-on-exec pipe instead of vfork semantics to
synchronize the parent and child so that the parent does not return
before the child has finished using its arguments (and now, also its
stack). this also allows reporting exec failures to the caller instead
of giving the caller a child that mysteriously exits with status 127
on exec error.

basic testing has been performed on both the success and failure code
paths. further testing should be done.
Diffstat (limited to 'src/process/fdop.h')
-rw-r--r--src/process/fdop.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/process/fdop.h b/src/process/fdop.h
index 02ff83c5..00b87514 100644
--- a/src/process/fdop.h
+++ b/src/process/fdop.h
@@ -4,7 +4,7 @@
 
 struct fdop {
 	struct fdop *next, *prev;
-	int cmd, fd, newfd, oflag;
+	int cmd, fd, srcfd, oflag;
 	mode_t mode;
 	char path[];
 };