00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <SUM.h>
00025 #include <sys/socket.h>
00026 #include <sys/errno.h>
00027 #include <sys/time.h>
00028 #include <rpc/rpc.h>
00029 #include <rpc/pmap_clnt.h>
00030 #include <signal.h>
00031 #include <sum_rpc.h>
00032 #include <soi_error.h>
00033 #if defined(SUMS_TAPE_AVAILABLE) && SUMS_TAPE_AVAILABLE
00034 #include <tape.h>
00035 #endif
00036 #include <printk.h>
00037 #include <unistd.h>
00038 #include "serverdefs.h"
00039
00040 extern PART ptabx[];
00041
00042 void logkey();
00043 extern int errno;
00044 extern Sinfoarray sarray;
00045 static void sumprog_1();
00046 static void sumprog_1_array();
00047 struct timeval TIMEOUT = { 10, 0 };
00048 uint32_t rinfo;
00049 uint32_t sumprog, sumvers;
00050 int rrid = 0;
00051 float ftmp;
00052 char jsoc_machine[MAX_STR];
00053 static struct timeval first[4], second[4];
00054
00055 FILE *logfp;
00056 CLIENT *current_client, *clnttape, *clnttape_old;
00057 SVCXPRT *glb_transp;
00058 char *dbname;
00059 char thishost[MAX_STR];
00060 char usedhost[MAX_STR];
00061 char hostn[MAX_STR];
00062 char logname[MAX_STR];
00063 char newlogname[MAX_STR];
00064 char datestr[32];
00065 char timetag[32];
00066 int thispid;
00067 int soi_errno = NO_ERROR;
00068 int debugflg = 0;
00069 int sim = 0;
00070 int tapeoffline = 0;
00071 int newlog = 0;
00072 int logcnt = 0;
00073
00074
00075 void StartTimer(int n)
00076 {
00077 gettimeofday (&first[n], NULL);
00078 }
00079
00080 float StopTimer(int n)
00081 {
00082 gettimeofday (&second[n], NULL);
00083 if (first[n].tv_usec > second[n].tv_usec) {
00084 second[n].tv_usec += 1000000;
00085 second[n].tv_sec--;
00086 }
00087 return (float) (second[n].tv_sec-first[n].tv_sec) +
00088 (float) (second[n].tv_usec-first[n].tv_usec)/1000000.0;
00089 }
00090
00091
00092 void open_log(char *filename)
00093 {
00094 if((logfp=fopen(filename, "a+")) == NULL) {
00095 fprintf(stderr, "Can't open the log file %s\n", filename);
00096 }
00097 }
00098
00099
00100
00101
00102 char *datestring()
00103 {
00104 struct timeval tvalr;
00105 struct tm *t_ptr;
00106
00107 gettimeofday(&tvalr, NULL);
00108 t_ptr = localtime((const time_t *)&tvalr);
00109 sprintf(datestr, "%s", asctime(t_ptr));
00110 datestr[19] = (char)NULL;
00111 return(&datestr[4]);
00112 }
00113
00114
00115 char *gettimetag()
00116 {
00117 struct timeval tvalr;
00118 struct tm *t_ptr;
00119
00120 gettimeofday(&tvalr, NULL);
00121 t_ptr = localtime((const time_t *)&tvalr);
00122 sprintf(timetag, "%04d.%02d.%02d.%02d%02d%02d",
00123 (t_ptr->tm_year+1900), (t_ptr->tm_mon+1), t_ptr->tm_mday, t_ptr->tm_hour, t_ptr->tm_min, t_ptr->tm_sec);
00124 return(timetag);
00125 }
00126
00127
00128
00129
00130 int write_log(const char *fmt, ...)
00131 {
00132 va_list args;
00133 char string[4096];
00134
00135 va_start(args, fmt);
00136 vsprintf(string, fmt, args);
00137 if(logfp) {
00138 fprintf(logfp, string);
00139 fflush(logfp);
00140 }
00141 else
00142 fprintf(stderr, string);
00143 va_end(args);
00144 return(0);
00145 }
00146
00147
00148 void sighandler(sig)
00149 int sig;
00150 {
00151 printf("sig = %d\n", sig);
00152 if(sig == SIGTERM) {
00153 write_log("*** %s sum_svc got SIGTERM. Exiting.\n", datestring());
00154 exit(1);
00155 }
00156 if(sig == SIGINT) {
00157 write_log("*** %s sum_svc got SIGINT. Exiting.\n", datestring());
00158 DS_DisConnectDB();
00159 exit(1);
00160 }
00161 write_log("*** %s sum_svc got an illegal signal %d, ignoring...\n",
00162 datestring(), sig);
00163 if (signal(SIGINT, SIG_IGN) != SIG_IGN)
00164 signal(SIGINT, sighandler);
00165 if (signal(SIGALRM, SIG_IGN) != SIG_IGN)
00166 signal(SIGALRM, sighandler);
00167 }
00168
00169
00170
00171
00172 void usr1_sig(int sig)
00173 {
00174 write_log("%s usr1_sig received by sum_svc\n", datestring());
00175
00176 logcnt++;
00177 write_log("%s Closing the current log file. Goodby.\n", datestring());
00178 fclose(logfp);
00179 sprintf(newlogname, "%s_%d", logname, logcnt);
00180 open_log(newlogname);
00181 write_log("\n## %s reopen log sum_svc on %s for pid = %d ##\n",
00182 datestring(), thishost, thispid);
00183 signal(SIGUSR1, &usr1_sig);
00184 }
00185
00186
00187 void get_cmd(int argc, char *argv[])
00188 {
00189 int c;
00190 char *username, *cptr, *cptr2;
00191
00192 if(!(username = (char *)getenv("USER"))) username = "nouser";
00193 if(strcmp(username, SUMS_MANAGER)) {
00194 printf("!!NOTE: You must be user %s to run sum_svc!\n", SUMS_MANAGER);
00195 exit(1);
00196 }
00197
00198 while((--argc > 0) && ((*++argv)[0] == '-')) {
00199 while((c = *++argv[0])) {
00200 switch(c) {
00201 case 'd':
00202 debugflg=1;
00203 break;
00204 case 's':
00205 sim=1;
00206 break;
00207 case 'o':
00208 tapeoffline=1;
00209 break;
00210 default:
00211 break;
00212 }
00213 }
00214 }
00215 if(argc != 2) {
00216 printf("!!ERROR: program needs 2 args: dbname and logfilename. e.g:\n");
00217 printf("sum_svc jsoc_sums sum_svc_2011.06.06.140140.log\n");
00218 exit(1);
00219 }
00220 dbname = argv[0];
00221
00222
00223
00224 sprintf(logname, "%s/%s", SUMLOG_BASEDIR, argv[1]);
00225 if(cptr = strstr(logname, "_R")) {
00226 if(cptr2 = strstr(logname, "log_R")) {
00227 *(cptr2+3) = (char)NULL;
00228 logcnt = 0;
00229 open_log(logname);
00230 }
00231 else if(cptr2 = strstr(logname, "log_")) {
00232 *cptr= (char)NULL;
00233 open_log(logname);
00234 *(cptr2+3) = (char)NULL;
00235 cptr2 = cptr2 + 4;
00236 sscanf(cptr2, "%d", &logcnt);
00237 }
00238 else {
00239 printf("!!ERROR: called with NG log file name: %s\n", logname);
00240 exit(1);
00241 }
00242 }
00243 else { open_log(logname); }
00244 }
00245
00246
00247 void setup()
00248 {
00249 FILE *fplog;
00250 int tpid, i;
00251 char *cptr, *machine;
00252 char lfile[MAX_STR], acmd[MAX_STR], line[MAX_STR];
00253
00254
00255
00256
00257
00258 sprintf(thishost, "localhost");
00259 gethostname(hostn, 80);
00260 cptr = index(hostn, '.');
00261 if(cptr) *cptr = (char)NULL;
00262 gettimetag();
00263
00264 sumprog = SUMPROG;
00265 sumvers = SUMVERS;
00266 thispid = getpid();
00267 if(!(machine = (char *)getenv("JSOC_MACHINE"))) {
00268 sprintf(jsoc_machine, "NOTGIVEN");
00269 write_log("!!WARNING: No JSOC_MACHINE in env\n");
00270 write_log("SUMLIB_InfoGetArray() calls will fail\n");
00271 }
00272 else
00273 sprintf(jsoc_machine, "%s", machine);
00274
00275
00276 printk_set(write_log, write_log);
00277 write_log("\n## %s sum_svc on %s (%s) for pid = %d ##\n",
00278 datestring(), thishost, hostn, thispid);
00279
00280
00281 signal(SIGINT, sighandler);
00282 if (signal(SIGTERM, SIG_IGN) != SIG_IGN)
00283 signal(SIGTERM, sighandler);
00284 if (signal(SIGALRM, SIG_IGN) != SIG_IGN)
00285 signal(SIGALRM, sighandler);
00286 signal(SIGUSR1, &usr1_sig);
00287
00288
00289
00290 sprintf(lfile, "/tmp/find_tview.log");
00291 sprintf(acmd, "ps -ef | grep %s 1> %s 2>&1", TAPEVIEWERNAME, lfile);
00292 if(system(acmd)) {
00293 write_log("**Can't execute %s.\n", acmd);
00294 return;
00295 }
00296 if((fplog=fopen(lfile, "r")) == NULL) {
00297 write_log("**Can't open %s to find any %s\n", lfile, TAPEVIEWERNAME);
00298 return;
00299 }
00300 while(fgets(line, 128, fplog)) {
00301 if(!(strstr(line, "perl"))) continue;
00302 sscanf(line, "%s %d", acmd, &tpid);
00303 sprintf(lfile, "%s/sum_restart_%d.touch", SUMLOG_BASEDIR, tpid);
00304 sprintf(acmd, "/bin/touch %s", lfile);
00305 write_log("%s\n", acmd);
00306 system(acmd);
00307 }
00308 fclose(fplog);
00309 }
00310
00311
00312 void sumbye(void) {
00313 printf("sumbye() called by atexit() at %s\n", datestring());
00314 write_log("sumbye() called by atexit() at %s\n", datestring());
00315 }
00316
00317
00318 int main(int argc, char *argv[])
00319 {
00320 register SVCXPRT *transp;
00321 int i;
00322 pid_t pid;
00323 char dsvcname[80], cmd[128];
00324 char *args[5], pgport[32];
00325 char *simmode;
00326
00327 get_cmd(argc, argv);
00328 printf("\nPlease wait for sum_svc and tape inventory (optional) to initialize...\n");
00329 setup();
00330 if(atexit(sumbye)) {
00331 printf("Can't register sumbye() function in atexit()\n");
00332 }
00333
00334
00335 (void) pmap_unset(SUMPROG, SUMVERS);
00336 transp = (SVCXPRT *)svctcp_create(RPC_ANYSOCK, 0, 0);
00337 if (transp == NULL) {
00338 write_log("***cannot create tcp service\n");
00339 exit(1);
00340 }
00341 write_log("svctcp_create() port# = %u\n", transp->xp_port);
00342 if (!svc_register(transp, SUMPROG, SUMVERS, sumprog_1, IPPROTO_TCP)) {
00343 write_log("***unable to register (SUMPROG, SUMVERS, tcp)\n");
00344 exit(1);
00345 }
00346
00347
00348 if(!(simmode = (char *)getenv("SUMSIMMODE"))) {
00349 sprintf(pgport, SUMPGPORT);
00350 setenv("SUMPGPORT", pgport, 1);
00351 write_log("sum_svc sets SUMPGPORT env to %s\n", pgport);
00352 }
00353 else {
00354 write_log("sum_svc sim mode SUMPGPORT %s\n", (char *)getenv("SUMPGPORT"));
00355 }
00356
00357
00358
00359 #ifndef __LOCALIZED_DEFS__
00360 #ifndef IRISDCFLG
00361
00362
00363
00364
00365 if(!strcmp(hostn, "dcs0") || !strcmp(hostn, "dcs1") || !strcmp(hostn, "dcs2") || !strcmp(hostn, "dcs3")) {
00366 if((pid = fork()) < 0) {
00367 write_log("***Can't fork(). errno=%d\n", errno);
00368 exit(1);
00369 }
00370 else if(pid == 0) {
00371 write_log("execvp of tape_svc\n");
00372 args[0] = "tape_svc";
00373 if(tapeoffline) {
00374 args[1] = "-o";
00375 args[2] = dbname;
00376 args[3] = timetag;
00377 args[4] = NULL;
00378 }
00379 else if(sim) {
00380 args[1] = "-s";
00381 args[2] = dbname;
00382 args[3] = timetag;
00383 args[4] = NULL;
00384 }
00385 else {
00386 args[1] = dbname;
00387 args[2] = timetag;
00388 args[3] = NULL;
00389 }
00390 if(execvp(args[0], args) < 0) {
00391 write_log("***Can't execvp() tape_svc. errno=%d\n", errno);
00392 exit(1);
00393 }
00394 }
00395
00396 sleep(10);
00397 for(i=0; i < MAX_DRIVES; i++) {
00398 if((pid = fork()) < 0) {
00399 write_log("***Can't fork(). errno=%d\n", errno);
00400 exit(1);
00401 }
00402 else if(pid == 0) {
00403 sprintf(dsvcname, "drive%d_svc", i);
00404 write_log("execvp of %s\n", dsvcname);
00405 args[0] = dsvcname;
00406 if(tapeoffline) {
00407 args[1] = "-o";
00408 args[2] = dbname;
00409 args[3] = timetag;
00410 args[4] = NULL;
00411 }
00412 else if(sim) {
00413 args[1] = "-s";
00414 args[2] = dbname;
00415 args[3] = timetag;
00416 args[4] = NULL;
00417 }
00418 else {
00419 args[1] = dbname;
00420 args[2] = timetag;
00421 args[3] = NULL;
00422 }
00423 if(execvp(args[0], args) < 0) {
00424 write_log("***Can't execvp() %s. errno=%d\n", dsvcname, errno);
00425 exit(1);
00426 }
00427 }
00428 }
00429 if((pid = fork()) < 0) {
00430 write_log("***Can't fork(). errno=%d\n", errno);
00431 exit(1);
00432 }
00433 else if(pid == 0) {
00434 write_log("execvp of robot0_svc\n");
00435 args[0] = "robot0_svc";
00436 args[1] = dbname;
00437 args[2] = timetag;
00438 args[3] = NULL;
00439 if(execvp(args[0], args) < 0) {
00440 write_log("***Can't execvp() robot0_svc. errno=%d\n", errno);
00441 exit(1);
00442 }
00443 }
00444 }
00445 #else
00446 if((pid = fork()) < 0) {
00447 write_log("***Can't fork(). errno=%d\n", errno);
00448 exit(1);
00449 }
00450 else if(pid == 0) {
00451 write_log("execvp of sum_rm\n");
00452 args[0] = "sum_rm";
00453 args[1] = dbname;
00454 args[2] = timetag;
00455 args[3] = NULL;
00456 if(execvp(args[0], args) < 0) {
00457 write_log("***Can't execvp() sum_rm. errno=%d\n", errno);
00458 exit(1);
00459 }
00460 }
00461 #endif
00462 #endif
00463 #ifdef __LOCALIZED_DEFS__
00464 if((pid = fork()) < 0) {
00465 write_log("***Can't fork(). errno=%d\n", errno);
00466 exit(1);
00467 }
00468 else if(pid == 0) {
00469 write_log("execvp of sum_rm\n");
00470 args[0] = "sum_rm";
00471 args[1] = dbname;
00472 args[2] = timetag;
00473 args[3] = NULL;
00474 if(execvp(args[0], args) < 0) {
00475 write_log("***Can't execvp() sum_rm. errno=%d\n", errno);
00476 exit(1);
00477 }
00478 }
00479 #endif
00480
00481 #ifndef __LOCALIZED_DEFS__
00482 #ifndef IRISDCFLG
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500 if(strcmp(hostn, "xim") && strcmp(hostn, "n02")) {
00501
00502 printf("\nsum_svc waiting for tape servers to start (approx 10sec)...\n");
00503 sleep(13);
00504
00505 if(strcmp(hostn, SUMSVCHOST)) {
00506 clnttape = clnt_create(thishost, TAPEPROG, TAPEVERS, "tcp");
00507 strcpy(usedhost, thishost);
00508 }
00509 else {
00510 clnttape = clnt_create(TAPEHOST, TAPEPROG, TAPEVERS, "tcp");
00511 strcpy(usedhost, TAPEHOST);
00512 }
00513 if(!clnttape) {
00514 clnt_pcreateerror("Can't get client handle to tape_svc (xsum_svc)");
00515 write_log("tape_svc not there on %s\n", usedhost);
00516
00517 }
00518 clnttape_old = clnttape;
00519 }
00520 #endif
00521 #endif
00522
00523 if(SUM_Init(dbname)) {
00524 write_log("***Can't SUM_Init()\n");
00525 exit(1);
00526 }
00527 sleep(5);
00528 printf("sum_svc now available\n");
00529
00530
00531
00532
00533
00534 svc_run();
00535 write_log("!!Fatal Error: svc_run() returned in sum_svc\n");
00536 exit(1);
00537 }
00538
00539
00540
00541
00542
00543 static void
00544 sumprog_1(rqstp, transp)
00545 struct svc_req *rqstp;
00546 SVCXPRT *transp;
00547 {
00548 char procname[128];
00549 uint64_t ck_client;
00550 uint64_t uid;
00551
00552
00553 union __svcargun {
00554 Rkey sumdo_1_arg;
00555 } argument;
00556 char *result, *call_err;
00557 enum clnt_stat clnt_stat;
00558
00559 bool_t (*xdr_argument)(), (*xdr_result)();
00560 char *(*local)();
00561
00562 if(rqstp->rq_proc == INFODOARRAY) {
00563 sumprog_1_array(rqstp, transp);
00564 return;
00565 }
00566
00567 switch (rqstp->rq_proc) {
00568 case NULLPROC:
00569 (void) svc_sendreply(transp, (xdrproc_t)xdr_void, (char *)NULL);
00570 return;
00571 break;
00572
00573
00574
00575
00576
00577
00578 case OPENDO:
00579 sprintf(procname, "OPENDO");
00580 xdr_argument = xdr_Rkey;
00581 xdr_result = xdr_uint32_t;
00582 local = (char *(*)()) opendo_1;
00583 break;
00584 case CONFIGDO:
00585 sprintf(procname, "CONFIGDO");
00586 xdr_argument = xdr_Rkey;
00587 xdr_result = xdr_uint32_t;
00588 local = (char *(*)()) configdo_1;
00589 break;
00590 case SHUTDO:
00591 sprintf(procname, "SHUTDO");
00592 xdr_argument = xdr_Rkey;
00593 xdr_result = xdr_uint32_t;
00594 local = (char *(*)()) shutdo_1;
00595 break;
00596 case ALLOCDO:
00597 sprintf(procname, "ALLOCDO");
00598 xdr_argument = xdr_Rkey;
00599 xdr_result = xdr_Rkey;
00600 local = (char *(*)()) allocdo_1;
00601 break;
00602 case INFODO:
00603 sprintf(procname, "INFODO");
00604 xdr_argument = xdr_Rkey;
00605 xdr_result = xdr_Rkey;
00606 local = (char *(*)()) infodo_1;
00607 break;
00608 case INFODOX:
00609 sprintf(procname, "INFODOX");
00610 xdr_argument = xdr_Rkey;
00611 xdr_result = xdr_Rkey;
00612 local = (char *(*)()) infodoX_1;
00613 break;
00614 case GETDO:
00615 sprintf(procname, "GETDO");
00616 xdr_argument = xdr_Rkey;
00617 xdr_result = xdr_Rkey;
00618 local = (char *(*)()) getdo_1;
00619 break;
00620 case PUTDO:
00621 sprintf(procname, "PUTDO");
00622 xdr_argument = xdr_Rkey;
00623 xdr_result = xdr_Rkey;
00624 local = (char *(*)()) putdo_1;
00625 break;
00626 case CLOSEDO:
00627 sprintf(procname, "CLOSEDO");
00628 xdr_argument = xdr_Rkey;
00629 xdr_result = xdr_uint32_t;
00630 local = (char *(*)()) closedo_1;
00631 break;
00632 case SUMRESPDO:
00633 sprintf(procname, "SUMRESPDO");
00634 xdr_argument = xdr_Rkey;
00635 xdr_result = xdr_Rkey;
00636 local = (char *(*)()) sumrespdo_1;
00637 break;
00638 case DELSERIESDO:
00639 sprintf(procname, "DELSERIESDO");
00640 xdr_argument = xdr_Rkey;
00641 xdr_result = xdr_uint32_t;
00642 local = (char *(*)()) delseriesdo_1;
00643 break;
00644 case NOPDO:
00645 sprintf(procname, "NOPDO");
00646 xdr_argument = xdr_Rkey;
00647 xdr_result = xdr_uint32_t;
00648 local = (char *(*)()) nopdo_1;
00649 break;
00650 case TAPERECONNECTDO:
00651 sprintf(procname, "TAPERESTARTDO");
00652 xdr_argument = xdr_Rkey;
00653 xdr_result = xdr_uint32_t;
00654 local = (char *(*)()) tapereconnectdo_1;
00655 break;
00656 case SUMREPARTN:
00657 sprintf(procname, "SUMREPARTN");
00658 xdr_argument = xdr_Rkey;
00659 xdr_result = xdr_uint32_t;
00660 local = (char *(*)()) repartndo_1;
00661 break;
00662 default:
00663 write_log("**sumprog_1() dispatch default procedure %d,ignore\n", rqstp->rq_proc);
00664 svcerr_noproc(transp);
00665 return;
00666 }
00667 bzero((char *)&argument, sizeof(argument));
00668 if (!svc_getargs(transp, (xdrproc_t)xdr_argument, (char *)&argument)) {
00669 write_log("***Error on svc_getargs()\n");
00670 svcerr_decode(transp);
00671
00672
00673
00674
00675 svc_sendreply(transp, (xdrproc_t)xdr_void, (char *)NULL);
00676 return;
00677
00678 }
00679 glb_transp = transp;
00680 result = (*local)(&argument, rqstp);
00681
00682
00683
00684 if(result) {
00685 if(result == (char *)1) {
00686
00687 }
00688 else {
00689 if(debugflg) {
00690 write_log("\n###KEYLIST at return in sum_svc\n");
00691 keyiterate(logkey, (KEY *)result);
00692 }
00693 if(current_client == 0) {
00694 write_log("***Error on clnt_call() back to orig sum_svc caller\n");
00695 write_log(" current_client was NULL\n");
00696 }
00697 else {
00698 ck_client = ((uint64_t)current_client & 0xfc00000000000000) >> 58;
00699 if(!((ck_client == 0) || (ck_client == 0x3f))) {
00700 write_log("***Error invalid current_client\n");
00701
00702
00703 }
00704 else {
00705 clnt_stat=clnt_call(current_client, RESPDO,(xdrproc_t)xdr_result,
00706 result, (xdrproc_t)xdr_void, 0, TIMEOUT);
00707 if(clnt_stat != RPC_SUCCESS) {
00708 if(clnt_stat != RPC_TIMEDOUT) {
00709 clnt_perrno(clnt_stat);
00710 write_log("***Error on clnt_call() back to RESPDO procedure\n");
00711 if(findkey(result, "uid")) {
00712 uid = getkey_uint64(result, "uid");
00713 write_log("***The original client caller has probably exited. Its uid=%lu\n", uid);
00714 }
00715 else {
00716 write_log("***The original client caller has probably exited\n");
00717 }
00718 call_err = clnt_sperror(current_client, "Err");
00719 write_log("%s\n", call_err);
00720
00721 }
00722 else {
00723 write_log("Timeout ignored on RESPDO back to current_client\n");
00724 }
00725 }
00726 clnt_destroy(current_client);
00727 }
00728 }
00729 freekeylist((KEY **)&result);
00730 }
00731 }
00732 else {
00733 }
00734 if (!svc_freeargs(transp, (xdrproc_t)xdr_argument, (char *)&argument)) {
00735 write_log("**unable to free arguments\n");
00736
00737 }
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753 return;
00754 }
00755
00756
00757
00758 static void
00759 sumprog_1_array(rqstp, transp)
00760 struct svc_req *rqstp;
00761 SVCXPRT *transp;
00762 {
00763 char procname[128];
00764 uint64_t ck_client;
00765 uint64_t uid;
00766
00767
00768 union __svcargun {
00769 Sunumarray sumdo_1_arg;
00770 } argument;
00771 char *result, *call_err;
00772 enum clnt_stat clnt_stat;
00773
00774 bool_t (*xdr_argument)(), (*xdr_result)();
00775 char *(*local)();
00776
00777 switch (rqstp->rq_proc) {
00778 case INFODOARRAY:
00779 sprintf(procname, "INFODOARRAY");
00780 xdr_argument = xdr_Sunumarray;
00781 xdr_result = xdr_Rkey;
00782 local = (char *(*)()) infodoArray_1;
00783 break;
00784 default:
00785 write_log("**sumprog_1_array() dispatch default procedure %d,ignore\n", rqstp->rq_proc);
00786 svcerr_noproc(transp);
00787 return;
00788 }
00789 bzero((char *)&argument, sizeof(argument));
00790 if (!svc_getargs(transp, (xdrproc_t)xdr_argument, (char *)&argument)) {
00791 write_log("***Error on svc_getargs()\n");
00792 svcerr_decode(transp);
00793
00794
00795
00796
00797 svc_sendreply(transp, (xdrproc_t)xdr_void, (char *)NULL);
00798 return;
00799
00800 }
00801 glb_transp = transp;
00802 result = (*local)(&argument, rqstp);
00803
00804
00805
00806 if(result) {
00807 if(result == (char *)1) {
00808
00809 }
00810 else {
00811 if(debugflg) {
00812 }
00813 if(current_client == 0) {
00814 write_log("***Error on clnt_call() back to orig sum_svc caller\n");
00815 write_log(" current_client was NULL\n");
00816 }
00817 else {
00818 ck_client = ((uint64_t)current_client & 0xfc00000000000000) >> 58;
00819 if(!((ck_client == 0) || (ck_client == 0x3f))) {
00820 write_log("***Error invalid current_client\n");
00821
00822
00823 }
00824 else {
00825 clnt_stat=clnt_call(current_client, RESPDOARRAY,(xdrproc_t)xdr_result, result, (xdrproc_t)xdr_void, 0, TIMEOUT);
00826 if(clnt_stat != RPC_SUCCESS) {
00827 if(clnt_stat != RPC_TIMEDOUT) {
00828 clnt_perrno(clnt_stat);
00829 write_log("***Error on clnt_call() back to RESPDO procedure\n");
00830 if(findkey(result, "uid")) {
00831 uid = getkey_uint64(result, "uid");
00832 write_log("***The original client caller has probably exited. Its uid=%lu\n", uid);
00833 }
00834 else {
00835 write_log("***The original client caller has probably exited\n");
00836 }
00837 call_err = clnt_sperror(current_client, "Err");
00838 write_log("%s\n", call_err);
00839
00840 }
00841 else {
00842 write_log("Timeout ignored on RESPDO back to current_client\n");
00843 }
00844 }
00845 clnt_destroy(current_client);
00846 }
00847 }
00848 freekeylist((KEY **)&result);
00849 }
00850 }
00851 else {
00852 }
00853 if (!svc_freeargs(transp, (xdrproc_t)xdr_argument, (char *)&argument)) {
00854 write_log("**unable to free arguments\n");
00855
00856 }
00857
00858
00859 return;
00860 }
00861