diff options
author | Jason Wessel <jason.wessel@windriver.com> | 2014-01-23 08:32:41 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-01-28 00:48:27 +0000 |
commit | 24183f5ec9c71db936e75060387941463d30d962 (patch) | |
tree | 56d0f61785a94fdb66be124d67bf74b19b74e4a5 /meta/recipes-devtools/unfs3/unfs3/fix_pid_race_parent_writes_child_pid.patch | |
parent | 56490921d267b784118df43cbd107925c8b94200 (diff) | |
download | openembedded-core-24183f5ec9c71db936e75060387941463d30d962.tar.gz |
unfs3: Add a NFSv3 user mode server for use with runqemu
The user mode nfs server allows the use of runqemu without any root
privileges and may even be accelerated with kvm.
Example:
runqemu-extract-sdk tmp-eglibc/deploy/images/qemux86-64/core-image-minimal-qemux86-64.tar.bz2 rootfs
runqemu qemux86-64 `pwd`/rootfs nographic slirp kvm
[YOCTO #5639]
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'meta/recipes-devtools/unfs3/unfs3/fix_pid_race_parent_writes_child_pid.patch')
-rw-r--r-- | meta/recipes-devtools/unfs3/unfs3/fix_pid_race_parent_writes_child_pid.patch | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/meta/recipes-devtools/unfs3/unfs3/fix_pid_race_parent_writes_child_pid.patch b/meta/recipes-devtools/unfs3/unfs3/fix_pid_race_parent_writes_child_pid.patch new file mode 100644 index 0000000000..76d7555ea9 --- /dev/null +++ b/meta/recipes-devtools/unfs3/unfs3/fix_pid_race_parent_writes_child_pid.patch @@ -0,0 +1,61 @@ +daemon.c: Fix race window for writing of the pid file + +The parent process should write the pid file such that the pid file +will can be checked immediately following exit of the fork from the +parent. + +This allows external monitoring applications to watch the daemon +without having to add sleep calls to wait for the pid file be written +on a busy system. + +Signed-off-by: Jason Wessel <jason.wessel@windriver.com> + +Upstream-Status: Pending + +--- + daemon.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/daemon.c ++++ b/daemon.c +@@ -153,7 +153,7 @@ int get_socket_type(struct svc_req *rqst + /* + * write current pid to a file + */ +-static void create_pid_file(void) ++static void create_pid_file(int pid) + { + char buf[16]; + int fd, res, len; +@@ -175,7 +175,7 @@ static void create_pid_file(void) + } + #endif + +- sprintf(buf, "%i\n", backend_getpid()); ++ sprintf(buf, "%i\n", pid); + len = strlen(buf); + + res = backend_pwrite(fd, buf, len, 0); +@@ -970,6 +970,10 @@ int main(int argc, char **argv) + fprintf(stderr, "could not fork into background\n"); + daemon_exit(0); + } ++ if (pid) ++ create_pid_file(pid); ++ } else { ++ create_pid_file(backend_getpid()); + } + #endif /* WIN32 */ + +@@ -1006,8 +1010,10 @@ int main(int argc, char **argv) + /* no umask to not screw up create modes */ + umask(0); + ++#ifdef WIN32 + /* create pid file if wanted */ +- create_pid_file(); ++ create_pid_file(backend_getpid()); ++#endif + + /* initialize internal stuff */ + fh_cache_init(); |