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