Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
firebird
firebird-2.5.2-gpidfile.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File firebird-2.5.2-gpidfile.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 files changed, 25 insertions(+), 1 deletions(-) diff --git a/src/utilities/guard/guard.cpp b/src/utilities/guard/guard.cpp index 8387605..7d4ab74 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.7.7
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