- fprintf(stderr," -h, -? Print this help screen.\n");
- fprintf(stderr," -F Foreground (no-daemon mode)\n");
- fprintf(stderr," -d Verbose logging to stderr. Foreground mode only.\n");
- fprintf(stderr," -V Display version information and exit.\n");
+ fprintf(stderr," -h, -?, --help Print this help screen.\n");
+ fprintf(stderr," -F, --foreground Foreground (no-daemon mode)\n");
+ fprintf(stderr," -d, --no-syslog Verbose logging to stderr. Foreground mode only.\n");
+ fprintf(stderr," -p, --port Port to listen on\n");
+ fprintf(stderr," -o, --outgoing-port Port for outgoing connections\n");
+ fprintf(stderr," -V, -v, --version Display version information and exit.\n");
+ fprintf(stderr," -n, --name Specify a local hostname.\n");
+ fprintf(stderr," -P State directory path.\n");
+ fprintf(stderr," -N Run in notify only mode.\n");
+ fprintf(stderr," -L, --no-notify Do not perform any notification.\n");
+ fprintf(stderr," -H Specify a high-availability callout program.\n");
+}
+
+static const char *pidfile = "/var/run/rpc.statd.pid";
+
+int pidfd = -1;
+static void create_pidfile(void)
+{
+ FILE *fp;
+
+ unlink(pidfile);
+ fp = fopen(pidfile, "w");
+ if (!fp)
+ xlog_err("Opening %s failed: %m\n", pidfile);
+ fprintf(fp, "%d\n", getpid());
+ pidfd = dup(fileno(fp));
+ if (fclose(fp) < 0) {
+ xlog_warn("Flushing pid file failed: errno %d (%m)\n",
+ errno);
+ }