Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.0:Staging:A
firebird
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
From: Michal Kubecek <mkubecek@suse.cz> Date: Tue, 8 May 2012 21:13:41 +0200 Subject: fbguard: allow creating a guard pidfile To better cooperate with killproc, 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 2727bdf25756..60f9b090241a 100644 --- a/src/utilities/guard/guard.cpp +++ b/src/utilities/guard/guard.cpp @@ -91,6 +91,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; @@ -116,9 +117,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; @@ -213,6 +218,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) @@ -283,6 +304,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 -- 2.8.1
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