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