kopia lustrzana https://gitlab.com/sane-project/backends
Add a PID file.
rodzic
ce7efefec7
commit
cbb3833dbe
|
@ -1,7 +1,7 @@
|
||||||
2008-04-10 Julien Blache <jb@jblache.org>
|
2008-04-10 Julien Blache <jb@jblache.org>
|
||||||
* frontend/saned.c: do not use daemon(), as it's a 4.4BSD/glibc
|
* frontend/saned.c: do not use daemon(), as it's a 4.4BSD/glibc
|
||||||
function; OS/2 for instance does not have it. Use an open-coded
|
function; OS/2 for instance does not have it. Use an open-coded
|
||||||
equivalent.
|
equivalent. Add a PID file.
|
||||||
|
|
||||||
2008-04-06 Nicolas Martin <nicols-guest at users.alioth.debian.org>
|
2008-04-06 Nicolas Martin <nicols-guest at users.alioth.debian.org>
|
||||||
* backend/pixma_mp150.c:
|
* backend/pixma_mp150.c:
|
||||||
|
|
|
@ -190,6 +190,7 @@ struct saned_child *children;
|
||||||
int numchildren;
|
int numchildren;
|
||||||
|
|
||||||
#define SANED_CONFIG_FILE "saned.conf"
|
#define SANED_CONFIG_FILE "saned.conf"
|
||||||
|
#define SANED_PID_FILE "/var/run/saned.pid"
|
||||||
|
|
||||||
#define SANED_SERVICE_NAME "sane-port"
|
#define SANED_SERVICE_NAME "sane-port"
|
||||||
#define SANED_SERVICE_PORT 6566
|
#define SANED_SERVICE_PORT 6566
|
||||||
|
@ -2445,6 +2446,8 @@ run_standalone (int argc, char **argv)
|
||||||
int i;
|
int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
FILE *pidfile;
|
||||||
|
|
||||||
/* Unused in this function */
|
/* Unused in this function */
|
||||||
argc = argc;
|
argc = argc;
|
||||||
argv = argv;
|
argv = argv;
|
||||||
|
@ -2473,6 +2476,18 @@ run_standalone (int argc, char **argv)
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DBG (DBG_WARN, "Now daemonized\n");
|
||||||
|
|
||||||
|
/* Write out PID file */
|
||||||
|
pidfile = fopen (SANED_PID_FILE, "w");
|
||||||
|
if (pidfile)
|
||||||
|
{
|
||||||
|
fprintf (pidfile, "%d", getpid());
|
||||||
|
fclose (pidfile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
DBG (DBG_ERR, "Could not write PID file: %s\n", strerror (errno));
|
||||||
|
|
||||||
chdir ("/");
|
chdir ("/");
|
||||||
|
|
||||||
dup2 (fd, STDIN_FILENO);
|
dup2 (fd, STDIN_FILENO);
|
||||||
|
@ -2483,8 +2498,6 @@ run_standalone (int argc, char **argv)
|
||||||
|
|
||||||
setsid ();
|
setsid ();
|
||||||
|
|
||||||
DBG (DBG_WARN, "Now daemonized\n");
|
|
||||||
|
|
||||||
signal(SIGINT, sig_int_term_handler);
|
signal(SIGINT, sig_int_term_handler);
|
||||||
signal(SIGTERM, sig_int_term_handler);
|
signal(SIGTERM, sig_int_term_handler);
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue