File 0006-Reflect-provider-information-in-ps-via-argv.patch of Package sblim-sfcb
diff -wruN -x '*~' ../orig-sblim-sfcb-1.3.16/control.c ./control.c
--- ../orig-sblim-sfcb-1.3.16/control.c 2012-06-13 23:21:09.000000000 +0200
+++ ./control.c 2012-12-22 16:02:50.947718176 +0100
@@ -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.16/providerDrv.c ./providerDrv.c
--- ../orig-sblim-sfcb-1.3.16/providerDrv.c 2012-11-01 22:38:23.000000000 +0100
+++ ./providerDrv.c 2012-12-22 16:02:50.947718176 +0100
@@ -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.16/sfcb.cfg.pre.in ./sfcb.cfg.pre.in
--- ../orig-sblim-sfcb-1.3.16/sfcb.cfg.pre.in 2012-06-13 23:21:09.000000000 +0200
+++ ./sfcb.cfg.pre.in 2012-12-22 16:02:50.947718176 +0100
@@ -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.16/sfcBroker.c ./sfcBroker.c
--- ../orig-sblim-sfcb-1.3.16/sfcBroker.c 2012-11-21 18:18:04.000000000 +0100
+++ ./sfcBroker.c 2012-12-22 16:02:50.947718176 +0100
@@ -561,6 +561,8 @@
exit(0);
}
+extern void passOrigArgPtrs(int *argc, char ***argv);
+
int main(int argc, char *argv[])
{
int c, i;
@@ -570,6 +572,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;
@@ -740,6 +743,9 @@
printf("--- Provider pausing for: %s\n",pauseStr);
}
+ if ((getControlBool("argvDebug", &argvDebug) == 0) && argvDebug)
+ passOrigArgPtrs(&argc, &argv);
+
if (getControlBool("enableHttp", &enableHttp))
enableHttp=1;