aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/unfs-server/unfs-server-2.2beta47/019-pid-before-fork.patch
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:14:24 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:29:45 +0100
commit29d6678fd546377459ef75cf54abeef5b969b5cf (patch)
tree8edd65790e37a00d01c3f203f773fe4b5012db18 /meta/recipes-devtools/unfs-server/unfs-server-2.2beta47/019-pid-before-fork.patch
parentda49de6885ee1bc424e70bc02f21f6ab920efb55 (diff)
downloadopenembedded-core-contrib-29d6678fd546377459ef75cf54abeef5b969b5cf.tar.gz
Major layout change to the packages directory
Having one monolithic packages directory makes it hard to find things and is generally overwhelming. This commit splits it into several logical sections roughly based on function, recipes.txt gives more information about the classifications used. The opportunity is also used to switch from "packages" to "recipes" as used in OpenEmbedded as the term "packages" can be confusing to people and has many different meanings. Not all recipes have been classified yet, this is just a first pass at separating things out. Some packages are moved to meta-extras as they're no longer actively used or maintained. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/recipes-devtools/unfs-server/unfs-server-2.2beta47/019-pid-before-fork.patch')
-rw-r--r--meta/recipes-devtools/unfs-server/unfs-server-2.2beta47/019-pid-before-fork.patch125
1 files changed, 125 insertions, 0 deletions
diff --git a/meta/recipes-devtools/unfs-server/unfs-server-2.2beta47/019-pid-before-fork.patch b/meta/recipes-devtools/unfs-server/unfs-server-2.2beta47/019-pid-before-fork.patch
new file mode 100644
index 0000000000..960ca8e47f
--- /dev/null
+++ b/meta/recipes-devtools/unfs-server/unfs-server-2.2beta47/019-pid-before-fork.patch
@@ -0,0 +1,125 @@
+# Write a pid file before forking
+# Patch origin: Wind River
+
+Index: nfs-server-2.2beta47/daemon.c
+===================================================================
+--- nfs-server-2.2beta47.orig/daemon.c
++++ nfs-server-2.2beta47/daemon.c
+@@ -15,6 +15,19 @@
+ static const char * pidfilename = 0;
+ static const char * get_signame(int signo);
+
++void
++writepid(pid_t pid, int clear)
++{
++ FILE *fp;
++
++ fp = fopen(pidfilename, clear? "w" : "a");
++ if (fp == NULL)
++ Dprintf(L_FATAL, "Unable to open %s: %m", pidfilename);
++ fprintf(fp, "%d\n", pid);
++ fclose(fp);
++ return;
++}
++
+ /*
+ * Do the Crawley Thing
+ */
+@@ -33,8 +46,10 @@ daemonize(void)
+ Dprintf(L_FATAL, "unable to fork: %s", strerror(errno));
+
+ /* Parent process: exit */
+- if (c > 0)
++ if (c > 0) {
++ writepid(c, 1);
+ exit(0);
++ }
+
+ /* Do the session stuff */
+ close(0);
+@@ -60,19 +75,6 @@ setpidpath(const char *filename)
+ }
+
+ void
+-writepid(pid_t pid, int clear)
+-{
+- FILE *fp;
+-
+- fp = fopen(pidfilename, clear? "w" : "a");
+- if (fp == NULL)
+- Dprintf(L_FATAL, "Unable to open %s: %m", pidfilename);
+- fprintf(fp, "%d\n", pid);
+- fclose(fp);
+- return;
+-}
+-
+-void
+ failsafe(int level, int ncopies)
+ {
+ int *servers, running, child, i;
+Index: nfs-server-2.2beta47/mountd.c
+===================================================================
+--- nfs-server-2.2beta47.orig/mountd.c
++++ nfs-server-2.2beta47/mountd.c
+@@ -425,9 +425,6 @@ main(int argc, char **argv)
+ background_logging();
+ }
+
+- /* Become a daemon */
+- if (!foreground)
+- daemonize();
+
+ /* Initialize the FH module. */
+ fh_init();
+@@ -435,11 +432,15 @@ main(int argc, char **argv)
+ /* Initialize the AUTH module. */
+ auth_init(auth_file);
+
+- /* Write pidfile */
+ if (mount_pid_file == 0)
+ mount_pid_file = _PATH_MOUNTD_PIDFILE;
+ setpidpath(mount_pid_file);
+- writepid(getpid(), 1);
++
++ /* Become a daemon */
++ if (!foreground)
++ daemonize();
++ else
++ writepid(getpid(), 1);
+
+ /* Failsafe mode */
+ if (failsafe_level)
+Index: nfs-server-2.2beta47/nfsd.c
+===================================================================
+--- nfs-server-2.2beta47.orig/nfsd.c
++++ nfs-server-2.2beta47/nfsd.c
+@@ -1147,11 +1147,6 @@ main(int argc, char **argv)
+ /* if (ncopies > 1)
+ read_only = 1; */
+
+- /*
+- * We first fork off a child and detach from tty
+- */
+- if (!foreground)
+- daemonize();
+
+ /* Initialize the AUTH module. */
+ auth_init(auth_file);
+@@ -1160,9 +1155,16 @@ main(int argc, char **argv)
+ nfs_pid_file = _PATH_NFSD_PIDFILE;
+ setpidpath(nfs_pid_file);
+
++ /*
++ * We first fork off a child and detach from tty
++ */
++ if (!foreground)
++ daemonize();
++ else
++ writepid(getpid(), 1);
++
+ if (failsafe_level == 0) {
+ /* Start multiple copies of the server */
+- writepid(getpid(), 1);
+ for (i = 1; i < ncopies; i++) {
+ pid_t pid;
+