diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2016-08-17 14:31:25 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2016-08-22 16:43:26 +0000 |
commit | 60f9d69e016b11c468c98ea75ba0a60c44afbbc4 (patch) | |
tree | ecb49581a9e41a37943c22cd9ef3f63451b20ee7 /import-layers/yocto-poky/meta/recipes-devtools/unfs3/unfs3/fix_pid_race_parent_writes_child_pid.patch | |
parent | e18c61205e0234b03697129c20cc69c9b3940efc (diff) | |
download | blackbird-openbmc-60f9d69e016b11c468c98ea75ba0a60c44afbbc4.tar.gz blackbird-openbmc-60f9d69e016b11c468c98ea75ba0a60c44afbbc4.zip |
yocto-poky: Move to import-layers subdir
We are going to import additional layers, so create a subdir to
hold all of the layers that we import with git-subtree.
Change-Id: I6f732153a22be8ca663035c518837e3cc5ec0799
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Diffstat (limited to 'import-layers/yocto-poky/meta/recipes-devtools/unfs3/unfs3/fix_pid_race_parent_writes_child_pid.patch')
-rw-r--r-- | import-layers/yocto-poky/meta/recipes-devtools/unfs3/unfs3/fix_pid_race_parent_writes_child_pid.patch | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/unfs3/unfs3/fix_pid_race_parent_writes_child_pid.patch b/import-layers/yocto-poky/meta/recipes-devtools/unfs3/unfs3/fix_pid_race_parent_writes_child_pid.patch new file mode 100644 index 000000000..46b187e5f --- /dev/null +++ b/import-layers/yocto-poky/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: Submitted http://sourceforge.net/p/unfs3/bugs/5/ + +--- + 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(); |