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:52:35 +0000 |
commit | 162dd389301ce238b5003d6b4f6031256532508b (patch) | |
tree | 8100bf96362321edec26f099334102d3962c5bdd /meta/recipes-devtools/unfs3/unfs3/fix_pid_race_parent_writes_child_pid.patch | |
parent | b3bb9c770b17be4f7e1e424e0d0ec00ebe5bfb62 (diff) | |
download | poky-162dd389301ce238b5003d6b4f6031256532508b.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]
(From OE-Core rev: 24183f5ec9c71db936e75060387941463d30d962)
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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 @@ | |||
1 | daemon.c: Fix race window for writing of the pid file | ||
2 | |||
3 | The parent process should write the pid file such that the pid file | ||
4 | will can be checked immediately following exit of the fork from the | ||
5 | parent. | ||
6 | |||
7 | This allows external monitoring applications to watch the daemon | ||
8 | without having to add sleep calls to wait for the pid file be written | ||
9 | on a busy system. | ||
10 | |||
11 | Signed-off-by: Jason Wessel <jason.wessel@windriver.com> | ||
12 | |||
13 | Upstream-Status: Pending | ||
14 | |||
15 | --- | ||
16 | daemon.c | 12 +++++++++--- | ||
17 | 1 file changed, 9 insertions(+), 3 deletions(-) | ||
18 | |||
19 | --- a/daemon.c | ||
20 | +++ b/daemon.c | ||
21 | @@ -153,7 +153,7 @@ int get_socket_type(struct svc_req *rqst | ||
22 | /* | ||
23 | * write current pid to a file | ||
24 | */ | ||
25 | -static void create_pid_file(void) | ||
26 | +static void create_pid_file(int pid) | ||
27 | { | ||
28 | char buf[16]; | ||
29 | int fd, res, len; | ||
30 | @@ -175,7 +175,7 @@ static void create_pid_file(void) | ||
31 | } | ||
32 | #endif | ||
33 | |||
34 | - sprintf(buf, "%i\n", backend_getpid()); | ||
35 | + sprintf(buf, "%i\n", pid); | ||
36 | len = strlen(buf); | ||
37 | |||
38 | res = backend_pwrite(fd, buf, len, 0); | ||
39 | @@ -970,6 +970,10 @@ int main(int argc, char **argv) | ||
40 | fprintf(stderr, "could not fork into background\n"); | ||
41 | daemon_exit(0); | ||
42 | } | ||
43 | + if (pid) | ||
44 | + create_pid_file(pid); | ||
45 | + } else { | ||
46 | + create_pid_file(backend_getpid()); | ||
47 | } | ||
48 | #endif /* WIN32 */ | ||
49 | |||
50 | @@ -1006,8 +1010,10 @@ int main(int argc, char **argv) | ||
51 | /* no umask to not screw up create modes */ | ||
52 | umask(0); | ||
53 | |||
54 | +#ifdef WIN32 | ||
55 | /* create pid file if wanted */ | ||
56 | - create_pid_file(); | ||
57 | + create_pid_file(backend_getpid()); | ||
58 | +#endif | ||
59 | |||
60 | /* initialize internal stuff */ | ||
61 | fh_cache_init(); | ||