You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

58 lines
1.5 KiB

Index: hclnfsd.c
--- hclnfsd.c.orig 2005-04-26 21:23:57 +0200
+++ hclnfsd.c 2005-05-22 10:15:55 +0200
@@ -223,6 +223,7 @@
static time_t GidCacheTimeoutTime=0;
int debugmode, DontDoPrinting;
char *debuglog;
+char *pidfile;
struct queueentry {
int jobid;
@@ -2933,6 +2934,7 @@
prog = argv[0];
debugmode = 0;
debuglog = NULL;
+ pidfile = NULL;
DontDoPrinting = 0;
if (sizeof(_uint32) != 4)
ErrAndDie("Integral size mismatch. Try defining INT32_LONG and recompiling\n", NULL, NULL, NULL, NULL);
@@ -3009,6 +3011,19 @@
argv++;
goto another;
}
+ if ((argc > 0) && (strcmp(*argv, "-P") == 0)) {
+ argc--;
+ argv++;
+ if (argc < 1)
+ ErrAndDie(USAGE, prog, NULL, NULL, NULL);
+ if (**argv)
+ pidfile = my_strdup(*argv);
+ if (pidfile == NULL)
+ ErrAndDie("Out of Memory", NULL, NULL, NULL, NULL);
+ argc--;
+ argv++;
+ goto another;
+ }
if ((argc != 1) && (!DontDoPrinting))
ErrAndDie(USAGE, prog, NULL, NULL, NULL);
@@ -3093,6 +3108,18 @@
fprintf(stdout,"%s: [main] real group %d, effective group %d\n", PROGNAME, getgid(), getegid());
debugmode++;
}
+ /* write pid file */
+ {
+ pid_t pid;
+ FILE *fp;
+ pid = getpid();
+ if ((fp = fopen(pidfile, "w")) == NULL) {
+ fprintf(stderr, "%s: [main] cannot write pidfile '%s'", PROGNAME, pidfile);
+ exit(1);
+ }
+ fprintf(fp, "%ld\n", (long)pid);
+ fclose(fp);
+ }
}
if (!DontDoPrinting) {