Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.3:Staging:C:DVD
firebird-classic
fbguard-allow-creating-a-guard-pidfile.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fbguard-allow-creating-a-guard-pidfile.patch of Package firebird-classic
From: Michal Kubecek <mkubecek@suse.cz> Date: Sun, 3 Jun 2012 15:18:30 +0200 Subject: fbguard: allow creating a guard pidfile To cooperate with killproc better, add option -gpidfile to create a pidfile with fbguard PID. --- src/utilities/guard/guard.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/utilities/guard/guard.cpp b/src/utilities/guard/guard.cpp index beeef10..4052f94 100644 --- a/src/utilities/guard/guard.cpp +++ b/src/utilities/guard/guard.cpp @@ -97,6 +97,7 @@ int CLIB_ROUTINE main( int argc, char **argv) bool daemon = false; const TEXT* prog_name = argv[0]; const TEXT* pidfilename = 0; + const TEXT* gpidfilename = 0; int guard_exit_code = 0; const TEXT* const* const end = argc + argv; @@ -122,9 +123,13 @@ int CLIB_ROUTINE main( int argc, char **argv) case 'P': pidfilename = *argv++; break; + case 'G': + gpidfilename = *argv++; + break; default: fprintf(stderr, - "Usage: %s [-signore | -onetime | -forever (default)] [-daemon] [-pidfile filename]\n", + "Usage: %s [-signore | -onetime | -forever (default)] [-daemon]\n" + " [-pidfile filename] [-gpidfile filename]\n", prog_name); exit(-1); break; @@ -232,6 +237,22 @@ int CLIB_ROUTINE main( int argc, char **argv) } } + if (gpidfilename) + { + FILE *gpf = fopen(gpidfilename, "w"); + if (gpf) + { + unsigned guard_pid = getpid(); + fprintf(gpf, "%d", guard_pid); + fclose(gpf); + } + else + { + gds__log("%s: guardian could not open %s for writing, error %d\n", + prog_name, gpidfilename, errno); + } + } + // wait for child to die, and evaluate exit status bool shutdown_child = true; if (!shutting_down) @@ -302,6 +323,9 @@ int CLIB_ROUTINE main( int argc, char **argv) if (pidfilename) { remove(pidfilename); } + if (gpidfilename) { + remove(gpidfilename); + } UTIL_ex_unlock(fd_guard); exit(guard_exit_code); } // main -- 1.8.4.5
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor