Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2:Update
sblim-sfcb
0006-Reflect-provider-information-in-ps-via-arg...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0006-Reflect-provider-information-in-ps-via-argv.patch of Package sblim-sfcb
From 48cd38bd8ca5de5a524a9cb44f3939415e754bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de> Date: Thu, 8 Mar 2012 14:34:41 +0100 Subject: [PATCH] Reflect provider information in 'ps' via argv This patch changes the argv[] buffer to contain provider information (provider name, location and class name) making it easier to debug misbehaving providers. Set argvDebug: true in sfcb.cfg to enable this. --- control.c | 1 + providerDrv.c | 39 +++++++++++++++++++++++++++++++++++++++ sfcBroker.c | 6 ++++++ sfcb.cfg.pre.in | 5 +++++ 4 files changed, 51 insertions(+), 0 deletions(-) diff -wruN -x '*~' ../orig-sblim-sfcb-1.3.14/control.c ./control.c --- ../orig-sblim-sfcb-1.3.14/control.c 2012-03-30 19:56:41.000000000 +0200 +++ ./control.c 2012-04-03 09:30:45.000000000 +0200 @@ -61,6 +61,7 @@ // { property, type, value} // Type: 0=string, 1=num, 2=bool, 3=unstripped string Control init[] = { + {"argvDebug", 2, "false"}, {"httpPort", 1, "5988"}, {"enableHttp", 2, "true"}, {"enableUds", 2, "true"}, diff -wruN -x '*~' ../orig-sblim-sfcb-1.3.14/providerDrv.c ./providerDrv.c --- ../orig-sblim-sfcb-1.3.14/providerDrv.c 2012-03-31 01:15:00.000000000 +0200 +++ ./providerDrv.c 2012-04-03 09:30:45.000000000 +0200 @@ -894,6 +894,42 @@ _SFCB_RETURN(-1); } +static int *origArgcPtr; +static char ***origArgvPtr; +void passOrigArgPtrs(int *argc, char ***argv) +{ + origArgcPtr = argc; + origArgvPtr = argv; +} + +/* Reflect provider in argv (restartArgv) for 'ps' + * if argvDebug=true in sfcb.conf + */ + +void providerStarted(ProviderInfo * info) +{ + char **argv; + char *ptr; + + if (origArgvPtr == NULL) + return; /* disabled in conf */ + + argv = *origArgvPtr; + ptr = argv[0]; + + argv[0] = strcpy(ptr,"sfcbd "); ptr += (strlen(argv[0])); + argv[1] = strcpy(ptr,"provider:"); ptr += (strlen(argv[1])); + argv[2] = strcpy(ptr,info->providerName); ptr += (strlen(argv[2])); + argv[3] = strcpy(ptr," -class:"); ptr += (strlen(argv[3])); + argv[4] = strcpy(ptr,info->className); ptr += (strlen(argv[4])); + argv[5] = strcpy(ptr," -location:"); ptr += (strlen(argv[5])); + argv[6] = strcpy(ptr,info->location); ptr += (strlen(argv[6])); +// *origArgvPtr = argv; + *origArgcPtr = 7; + + fprintf(stderr, "Provider %s started for %s from %s\n", info->providerName, info->className, info->location); +} + // I think we should break this function into two subfunctions: // something like isLoaded() and doForkProvider() int forkProvider(ProviderInfo * info, OperationHdr * req, char **msg) @@ -946,6 +982,8 @@ BinRequestContext binCtx; BinResponseHdr *resp; + providerStarted(info); + memset(&binCtx,0,sizeof(BinRequestContext)); sreq.className = setCharsMsgSegment(info->className); sreq.libName = setCharsMsgSegment(info->location); diff -wruN -x '*~' ../orig-sblim-sfcb-1.3.14/sfcb.cfg.pre.in ./sfcb.cfg.pre.in --- ../orig-sblim-sfcb-1.3.14/sfcb.cfg.pre.in 2012-03-29 17:39:33.000000000 +0200 +++ ./sfcb.cfg.pre.in 2012-04-03 09:30:45.000000000 +0200 @@ -11,6 +11,11 @@ ## Use '#' at the start of a line to comment ## +##--- Debug --- +## Show provider information via argv, viewable in 'ps' output +## Default: false +argvDebug: true + ##------------------------------------- HTTP ---------------------------------- ## Enable HTTP. ## Default is true. If HTTPS is configured, default is false. diff -wruN -x '*~' ../orig-sblim-sfcb-1.3.14/sfcBroker.c ./sfcBroker.c --- ../orig-sblim-sfcb-1.3.14/sfcBroker.c 2012-03-05 20:12:09.000000000 +0100 +++ ./sfcBroker.c 2012-04-03 09:30:45.000000000 +0200 @@ -556,6 +556,8 @@ exit(0); } +extern void passOrigArgPtrs(int *argc, char ***argv); + int main(int argc, char *argv[]) { int c, i; @@ -565,6 +567,7 @@ int enableUds=0; #endif int enableHttp=0,enableHttps=0,useChunking=0,doBa=0,enableInterOp=0,httpLocalOnly=0; + int argvDebug = 0; int syslogLevel=LOG_ERR; long dSockets,sSockets,pSockets; char *pauseStr; @@ -731,6 +734,9 @@ printf("--- Provider pausing for: %s\n",pauseStr); } + if (getControlBool("argvDebug", &argvDebug) == 0) + passOrigArgPtrs(&argc, &argv); + if (getControlBool("enableHttp", &enableHttp)) enableHttp=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