pidfile
int pidfile(const char *);
FILE *pidfile;
pidfile = fopen(_PATH_MOUNTDPID, "r");
if (pidfile != NULL) {
if (fscanf(pidfile, "%d\n", &c) > 0 && c > 0) {
pidfile = freopen(_PATH_MOUNTDPID, "w", pidfile);
pidfile = fopen(_PATH_MOUNTDPID, "w");
if (pidfile) {
fprintf(pidfile, "%ld\n", (long)getpid());
fclose(pidfile);
else O_STR(opt, "pidfile", pidfile)
free(cfg->pidfile);
if(!(cfg->pidfile = strdup(PIDFILE))) goto error_exit;
else S_STR("pidfile:", pidfile)
char* pidfile;
free(cfg_parser->cfg->pidfile);
cfg_parser->cfg->pidfile = $2;
char *pidfile; /* Path to file containing pid to signal */
if ((q->pidfile && pltmp->file &&
strcmp(pltmp->file, q->pidfile) == 0 &&
pl->file = q->pidfile;
send_signal(char *pidfile, int signal)
if ((f = fopen(pidfile, "r")) == NULL) {
warn("can't open %s", pidfile);
warnx("%s pid file: %s", err, pidfile);
sys_signame[signal], pidfile);
working->pidfile = PIDFILE;
working->pidfile = strdup(q);
if (working->pidfile == NULL)
working->pidfile = NULL;
n = snprintf(pidfile, sizeof(pidfile), "%s/%s",
if (n < 0 || (u_int)n >= sizeof(pidfile)) {
if ((pidfd = open(pidfile, O_RDWR|O_CREAT, 0644)) == -1 ||
syslog(LOG_ERR, "cannot open or create %s: %s", pidfile,
pidfile, otherpid, strerror(save_errno));
char pidfile[PATH_MAX]; /* we save pid in this file. */
if (pidfile[0] && pidfd != -1)
if (unlink(pidfile) == -1)
syslog(LOG_ERR, "cannot unlink %s (%m)", pidfile);
{ cfg_parser->opt->pidfile = region_strdup(cfg_parser->opt->region, $2); }
SERV_GET_PATH(final, pidfile, o);
print_string_var("pidfile:", opt->pidfile);
if (!file_inside_chroot(opt->pidfile, opt->chroot)) {
filename, opt->pidfile, opt->chroot);
if(!nsd.pidfile)
if(nsd.options->pidfile)
nsd.pidfile = nsd.options->pidfile;
nsd.pidfile = PIDFILE;
} else if (!file_inside_chroot(nsd.pidfile, nsd.chrootdir)) {
nsd.pidfile, nsd.chrootdir);
if(nsd.pidfile && nsd.pidfile[0] &&
if ((oldpid = readpid(nsd.pidfile)) == -1) {
nsd.pidfile, strerror(errno));
if (nsd.pidfile && nsd.pidfile[0] == '/')
nsd.pidfile += l;
nsd.pidfile, strerror(errno));
unlinkpid(nsd.pidfile, nsd.username);
if(!nsd->pidfile || !nsd->pidfile[0])
if((fd = open(nsd->pidfile, O_WRONLY | O_CREAT | O_TRUNC
nsd->pidfile, strerror(errno));
nsd->pidfile, strerror(errno));
nsd->pidfile);
nsd.pidfile = 0;
nsd.pidfile = optarg;
const char *pidfile;
opt->pidfile = PIDFILE;
const char* pidfile;
unlinkpid(nsd->pidfile, nsd->username);
unlinkpid(nsd->pidfile, nsd->username);
free(daemon->pidfile);
char* pidfile;
m += getmem_str(cfg->pidfile);
COPY_VAR_ptr(pidfile);
writepid (const char* pidfile, pid_t pid)
if((fd = open(pidfile, O_WRONLY | O_CREAT | O_TRUNC
pidfile, strerror(errno));
pidfile, strerror(errno));
"write returns 0 bytes written", pidfile);
checkoldpid(char* pidfile, int inchroot)
if((old = readpid(pidfile)) != -1) {
strncmp(cfg->pidfile, cfg->chrootdir,
if(cfg->pidfile && cfg->pidfile[0] && need_pidfile) {
if(cfg->pidfile[0] == '/')
daemon->pidfile = strdup(cfg->pidfile);
else daemon->pidfile = fname_after_chroot(cfg->pidfile,
if(!daemon->pidfile)
checkoldpid(daemon->pidfile, pidinchroot);
if(cfg->pidfile && cfg->pidfile[0] && need_pidfile) {
writepid(daemon->pidfile, getpid());
if(daemon->pidfile && daemon->pidfile[0] &&
strncmp(daemon->pidfile, cfg->chrootdir,
char* old = daemon->pidfile;
daemon->pidfile = strdup(old+strlen(cfg->chrootdir));
if(!daemon->pidfile)
if(daemon->pidfile) {
fd = open(daemon->pidfile, O_WRONLY | O_TRUNC
unlink(daemon->pidfile);
char *p = fname_after_chroot(cfg->pidfile, cfg, 1);
if(cfg->pidfile && cfg->pidfile[0]) {
char* ad = (cfg->pidfile[0]=='/')?strdup(cfg->pidfile):
fname_after_chroot(cfg->pidfile, cfg, 1);
else O_STR(opt, "pidfile", pidfile)
free(cfg->pidfile);
if(!(cfg->pidfile = strdup(PIDFILE))) goto error_exit;
else S_STR("pidfile:", pidfile)
char* pidfile;
free(cfg_parser->cfg->pidfile);
cfg_parser->cfg->pidfile = $2;