~ubuntu-branches/ubuntu/jaunty/pvm/jaunty

« back to all changes in this revision

Viewing changes to src/lpvm.c

  • Committer: Bazaar Package Importer
  • Author(s): Steinar H. Gunderson
  • Date: 2006-08-09 00:00:40 UTC
  • mfrom: (2.1.5 dapper)
  • Revision ID: james.westby@ubuntu.com-20060809000040-16kh33tmxx2em716
Tags: 3.4.5-7
Build with SHELL=/bin/bash in debian/rules; fixes FTBFS when /bin/sh
isn't bash. (Closes: #379543)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
static char rcsid[] =
3
 
        "$Id: lpvm.c,v 1.53 1999/07/08 18:59:53 kohl Exp $";
 
3
        "$Id: lpvm.c,v 1.69 2004/01/14 18:50:55 pvmsrc Exp $";
4
4
 
5
5
/*
6
6
 *         PVM version 3.4:  Parallel Virtual Machine System
36
36
 *      Libpvm core for unix environment.
37
37
 *
38
38
 * $Log: lpvm.c,v $
 
39
 * Revision 1.69  2004/01/14 18:50:55  pvmsrc
 
40
 * Added new AIX5* arches.
 
41
 * (Spanker=kohl)
 
42
 *
 
43
 * Revision 1.68  2003/02/04 20:03:04  pvmsrc
 
44
 * Got rid of Jigen's goofy my_errno...
 
45
 *      - never resolved anywhere...
 
46
 * (Spanker=kohl)
 
47
 *
 
48
 * Revision 1.67  2002/04/16 15:06:01  pvmsrc
 
49
 * WIN32 Fixes for Multiple Domains.
 
50
 *      - submitted by Jigen Zhou <jigen@icemcfd.com>.
 
51
 * (Spanker=kohl)
 
52
 *
 
53
 * Revision 1.66  2002/02/18 19:18:33  pvmsrc
 
54
 * Added "|| defined(IMA_SUN4SOL2)" to "const void *i, *j" #if
 
55
 *      for int_compare() / qsort()...
 
56
 *      (needed for sure for 64 bit) Solaris)
 
57
 * (Spanker=kohl)
 
58
 *
 
59
 * Revision 1.65  2001/12/07 16:06:09  pvmsrc
 
60
 * Oops!  Some new Unix fixes & features break Windows (of course!).
 
61
 *      - #ifdef-ed away fcntl() calls for non-blocking sockets / stdin.
 
62
 *      (one for bug fix in lpvm.c, one for check_ext_input() in pvmd.c)
 
63
 * (Spanker=kohl)
 
64
 *
 
65
 * Revision 1.64  2001/09/25 21:20:17  pvmsrc
 
66
 * Minor TMPNAMFUN()/tmpnam() cleanup.
 
67
 *      - moved macro def to pvm3.h, renamed PVMTNPMAN().
 
68
 *      - same for LEN_OF_TMP_NAM -> PVMTMPNAMLEN.
 
69
 *      - mostly a huge waste of time, since *both* tmpnam() & mktemp()
 
70
 *              produce the same "dangerous" warning message in Linux/gcc...
 
71
 *      - damn.
 
72
 * (Spanker=kohl)
 
73
 *
 
74
 * Revision 1.63  2001/09/25 17:28:09  pvmsrc
 
75
 * Fixed leftover tmpnam() usage -> use TMPNAMFUN() instead...
 
76
 *      - also got rid of "double" call to tmpnam()...
 
77
 * (Spanker=kohl)
 
78
 *
 
79
 * Revision 1.62  2001/05/11 19:40:50  pvmsrc
 
80
 * Fixed direct-routing bug, removed blocking socket deadlock.
 
81
 *      - fix submitted by Kamil Iskra <kamil@wins.uva.nl> (as well as
 
82
 *              <jc@esi.fr>, Dick van Albada <dick@wins.uva.nl>, and
 
83
 *              Zeger Hendrikse <zegerh@wins.uva.nl>).
 
84
 * (Spanker=kohl)
 
85
 *
 
86
 * Revision 1.61  2001/05/11 19:21:29  pvmsrc
 
87
 * Added "&& errno != EAGAIN" to select() return code check in mxfer().
 
88
 *      - reported by "Johannes Hennecke" <Johannes.Hennecke@ELSA.de>
 
89
 * (Spanker=kohl)
 
90
 *
 
91
 * Revision 1.60  2001/05/11 17:32:26  pvmsrc
 
92
 * Eliminated references to sys_errlist & sys_nerr.
 
93
 *      - unnecessary, and we're whacking that crap anyway.
 
94
 * (Spanker=kohl)
 
95
 *
 
96
 * Revision 1.59  2001/02/07 23:14:04  pvmsrc
 
97
 * First Half of CYGWIN Check-ins...
 
98
 * (Spanker=kohl)
 
99
 *
 
100
 * Revision 1.58  2000/06/15 17:51:49  pvmsrc
 
101
 * Fixed bug in WIN32 direct routing.
 
102
 *      - stupid #endif in the wrong place, pvm_fd_add() call whacked.
 
103
 *      - turned back on direct routing default and setopt.
 
104
 * (Spanker=kohl)
 
105
 *
 
106
 * Revision 1.57  2000/02/17 23:12:10  pvmsrc
 
107
 * *** Changes for new BEOLIN port ***
 
108
 *      - MPP-like, similar to SP2, etc.
 
109
 *      - submitted by Paul Springer <pls@smokeymt.jpl.nasa.gov>.
 
110
 *      - format-checked & cleaned up by Jeembo...  :-)
 
111
 * (Spanker=kohl)
 
112
 *
 
113
 * Revision 1.56  2000/02/16 21:59:40  pvmsrc
 
114
 * Fixed up #include <sys/types.h> stuff...
 
115
 *      - use <bsd/sys/types.h> for IMA_TITN...
 
116
 *      - #include before any NEEDMENDIAN #includes...
 
117
 * (Spanker=kohl)
 
118
 *
 
119
 * Revision 1.55  2000/02/07 22:22:07  pvmsrc
 
120
 * Hack to help with select()/fd_sets in WIN32:
 
121
 *      - fd_set is *NOT* a bit field in WIN32, is a circular buffer.
 
122
 *      - must check for !FD_ISSET() before FD_SET() else duplicate
 
123
 *              entries possible, and fd_set buffer overflow/overwrite.
 
124
 *      - similary, FD_ISSET() check before FD_CLR().
 
125
 *      - patch submitted by "Bruce W. Church" <bwc1@cornell.edu>.
 
126
 * (Spanker=kohl)
 
127
 *
 
128
 * Revision 1.54  1999/11/08 17:44:29  pvmsrc
 
129
 * SGI compiler cleanup.
 
130
 * (Spanker=kohl)
 
131
 *
39
132
 * Revision 1.53  1999/07/08 18:59:53  kohl
40
133
 * Fixed "Log" keyword placement.
41
134
 *      - indent with " * " for new CVS.
467
560
#include <process.h>
468
561
#include <stdlib.h>
469
562
#include <search.h>
 
563
#endif
 
564
 
 
565
#include <stdio.h>
 
566
 
 
567
#ifdef IMA_TITN
 
568
#include <bsd/sys/types.h>
 
569
#else
470
570
#include <sys/types.h>
471
571
#endif
472
572
 
473
 
#include <stdio.h>
474
573
#ifdef NEEDMENDIAN
475
574
#include <machine/endian.h>
476
575
#endif
482
581
#endif
483
582
 
484
583
#include <pvm3.h>
485
 
#ifdef WIN32
486
 
#ifndef _XDR_HEADERS
487
 
#define _XDR_HEADERS
 
584
 
 
585
#if defined(WIN32) || defined(CYGWIN)
488
586
#include "..\xdr\types.h"
489
587
#include "..\xdr\xdr.h"
490
 
#endif
491
588
#else
492
589
#include <rpc/types.h>
493
590
#include <rpc/xdr.h>
 
591
#endif
 
592
 
 
593
#ifndef WIN32
494
594
#include <sys/socket.h>
495
595
#endif
496
596
 
509
609
#endif
510
610
#include <errno.h>
511
611
#include <signal.h>
 
612
 
 
613
#ifdef IMA_BEOLIN
 
614
#include <netdb.h>
 
615
#endif
 
616
 
512
617
#include <pvmproto.h>
513
618
#include "pvmalloc.h"
514
619
#include "pvmfrag.h"
547
652
#define TTSOCKBUF       0x8000
548
653
#endif
549
654
 
550
 
#ifdef  NOTMPNAM
551
 
#define TMPNAMFUN(x)    pvmtmpnam(x)
552
 
#define LEN_OF_TMP_NAM  32
553
 
char *pvmtmpnam();
554
 
 
555
 
#else   /*NOTMPNAM*/
556
 
#define TMPNAMFUN(x)    tmpnam(x)
557
 
#ifdef  L_tmpnam
558
 
#define LEN_OF_TMP_NAM  L_tmpnam
559
 
#else
560
 
#define LEN_OF_TMP_NAM  64
561
 
#endif
562
 
#endif  /*NOTMPNAM*/
563
 
 
564
655
 
565
656
/***************
566
657
 **  Globals  **
582
673
 
583
674
#ifndef HASERRORVARS
584
675
extern int errno;                                               /* from libc */
585
 
extern char *sys_errlist[];
586
 
extern int sys_nerr;
587
676
#endif
588
677
 
589
678
#if defined(IMA_PGON)
637
726
        int sets;                       /* which sets */
638
727
{
639
728
#ifdef  SANITY
 
729
#ifndef WIN32
640
730
        if (fd < 0 || fd >= FD_SETSIZE) {
641
731
                pvmlogprintf("pvm_fd_add() bad fd %d\n", fd);
642
732
                return 1;
643
733
        }
644
734
#endif
 
735
#endif
645
736
        if (sets & 1)
646
 
                FD_SET(fd, &pvmrfds);
 
737
                if ( !FD_ISSET(fd, &pvmrfds) ) {
 
738
                        FD_SET(fd, &pvmrfds);
 
739
#ifdef WIN32
 
740
                        pvmnfds++;
 
741
#endif
 
742
                }
647
743
/*
648
744
        if (sets & 2)
649
 
                FD_SET(fd, &pvmwfds);
 
745
                if ( !FD_ISSET(fd, &pvmwfds) ) {
 
746
                        FD_SET(fd, &pvmwfds);
 
747
#ifdef WIN32
 
748
                        pvmnwfds++;
 
749
#endif
 
750
                }
650
751
        if (sets & 4)
651
 
                FD_SET(fd, &pvmefds);
 
752
                if ( !FD_ISSET(fd, &pvmefds) ) {
 
753
                        FD_SET(fd, &pvmefds);
 
754
#ifdef WIN32
 
755
                        pvmnefds++;
 
756
#endif
 
757
                }
652
758
*/
653
759
 
 
760
#ifndef WIN32
654
761
        /* if this is new highest, adjust nfds */
655
 
 
656
762
        if (fd >= pvmnfds)
657
763
                pvmnfds = fd + 1;
 
764
#endif
 
765
 
658
766
        return 0;
659
767
}
660
768
 
664
772
        int sets;                       /* which sets */
665
773
{
666
774
#ifdef  SANITY
 
775
#ifndef WIN32
667
776
        if (fd < 0 || fd >= FD_SETSIZE) {
668
777
                pvmlogprintf("pvm_fd_delete() bad fd %d\n", fd);
669
778
                return 1;
670
779
        }
671
780
#endif
 
781
#endif
672
782
        if (sets & 1)
673
 
                FD_CLR(fd, &pvmrfds);
 
783
                if ( FD_ISSET(fd, &pvmrfds) ) {
 
784
                        FD_CLR(fd, &pvmrfds);
 
785
#ifdef WIN32
 
786
                        pvmnfds--;
 
787
#endif
 
788
                }
674
789
/*
675
790
        if (sets & 2)
676
 
                FD_CLR(fd, &pvmwfds);
 
791
                if ( FD_ISSET(fd, &pvmwfds) ) {
 
792
                        FD_CLR(fd, &pvmwfds);
 
793
#ifdef WIN32
 
794
                        pvmnwfds--;
 
795
#endif
 
796
                }
677
797
        if (sets & 4)
678
 
                FD_CLR(fd, &pvmefds);
 
798
                if ( FD_ISSET(fd, &pvmefds) ) {
 
799
                        FD_CLR(fd, &pvmefds);
 
800
#ifdef WIN32
 
801
                        pvmnefds--;
 
802
#endif
 
803
                }
679
804
*/
680
805
 
 
806
#ifndef WIN32
681
807
        /* if this was highest, may have to adjust nfds to new highest */
682
 
 
683
808
        if (fd + 1 == pvmnfds)
684
809
                while (pvmnfds > 0) {
685
810
                        pvmnfds--;
686
811
                        if (FD_ISSET(pvmnfds, &pvmrfds)
687
812
/*
688
 
                        || FD_ISSET(pvmnfds, &pvmefds)
689
 
                        || FD_ISSET(pvmnfds, &pvmwfds)
 
813
                        || FD_ISSET(pvmnefds, &pvmefds)
 
814
                        || FD_ISSET(pvmnwfds, &pvmwfds)
690
815
*/
691
816
                        ) {
692
817
                                pvmnfds++;
693
818
                                break;
694
819
                        }
695
820
                }
 
821
#endif
 
822
 
696
823
        return 0;
697
824
}
698
825
 
990
1117
        int i;
991
1118
        int ictx;
992
1119
#ifdef SOCKLENISUINT
993
 
#ifdef IMA_AIX4SP2
 
1120
#if defined(IMA_AIX4SP2) || defined(IMA_AIX5SP2)
994
1121
        unsigned int oslen;
995
1122
#else
996
1123
        size_t oslen;
1000
1127
#endif
1001
1128
#ifndef NOUNIXDOM
1002
1129
        struct sockaddr_un uns;
1003
 
        char spath[LEN_OF_TMP_NAM];
 
1130
        char spath[PVMTMPNAMLEN];
1004
1131
#endif
1005
1132
        char buf[256];
1006
1133
 
1091
1218
                                        pvmlogperror("pvm_tc_conreq() socket");
1092
1219
 
1093
1220
                                } else {
1094
 
                                        (void)TMPNAMFUN(spath);
1095
1221
                                        BZERO((char*)&uns, sizeof(uns));
1096
1222
                                        uns.sun_family = AF_UNIX;
1097
1223
                                        spath[0] = 0;
1098
 
                                        (void)tmpnam(spath);
 
1224
                                        (void)PVMTMPNAMFUN(spath);
1099
1225
                                        strcpy(uns.sun_path, spath);
1100
1226
 
1101
1227
                                        oslen = sizeof(uns);
1320
1446
#endif
1321
1447
                                                                (void)fcntl(pcbp->tt_fd, F_SETFL, i);
1322
1448
                                                        }
 
1449
#endif
1323
1450
                                                        pvm_fd_add(pcbp->tt_fd, 1);
1324
 
#endif
1325
1451
                                                }
1326
1452
                                        }
1327
1453
                                }
1402
1528
        int n;                                  /* bytes received */
1403
1529
        int m;                                  /* length of fragment */
1404
1530
        struct pmsg *rxup;              /* message containing this frag */
1405
 
        struct pmsg *frgpile, *hdfrgpile;
 
1531
        struct pmsg *hdfrgpile;
1406
1532
        char *cp;                               /* gp */
1407
1533
        int src;
1408
1534
        int dst;
1540
1666
                return gotem;
1541
1667
        }
1542
1668
 
1543
 
        frgpile = hdfrgpile = pvm_mpp_pmsgs();
 
1669
        hdfrgpile = pvm_mpp_pmsgs();
1544
1670
#else
1545
 
        frgpile = hdfrgpile = pcbp->tt_rxfrag ;
 
1671
        hdfrgpile = pcbp->tt_rxfrag ;
1546
1672
#endif
1547
1673
        /*
1548
1674
        * if start of message, make new umbuf, add to frag pile
1655
1781
        int ff;
1656
1782
        int n;
1657
1783
#ifdef SOCKLENISUINT
1658
 
#ifdef IMA_AIX4SP2
 
1784
#if defined(IMA_AIX4SP2) || defined(IMA_AIX5SP2)
1659
1785
        unsigned int oslen;
1660
1786
#else
1661
1787
        size_t oslen;
1814
1940
                                (fd_set *)&rfds, (fd_set *)&wfds, (fd_set*)0,
1815
1941
#endif
1816
1942
                                tvp)) == -1
1817
 
                && errno != EINTR) {
 
1943
                && errno != EINTR
 
1944
#ifdef IMA_LINUX
 
1945
                && errno != EAGAIN
 
1946
#endif
 
1947
                ) {
1818
1948
                        pvmlogperror("mxfer() select");
1819
1949
                        return PvmSysErr;
1820
1950
                }
1881
2011
                                                        if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY,
1882
2012
                                                                        (char*)&n, sizeof(int)) == -1)
1883
2013
                                                                pvmlogperror("mxfer() setsockopt");
1884
 
#if (!defined(IMA_RS6K)) && (!defined(IMA_AIX46K))
 
2014
#if (!defined(IMA_RS6K)) \
 
2015
                && (!defined(IMA_AIX46K)) && (!defined(IMA_AIX46K64)) \
 
2016
                && (!defined(IMA_AIX56K)) && (!defined(IMA_AIX56K64))
1885
2017
                                                        n = TTSOCKBUF;
1886
2018
                                                        if (setsockopt(s, SOL_SOCKET, SO_SNDBUF,
1887
2019
                                                                        (char*)&n, sizeof(int)) == -1
1888
2020
                                                        || setsockopt(s, SOL_SOCKET, SO_RCVBUF,
1889
2021
                                                                        (char*)&n, sizeof(n)) == -1)
1890
 
                                                                pvmlogperror("mxfer() setsockopt SO_SNDBUF");
 
2022
                                                                pvmlogperror(
 
2023
                                                                        "mxfer() setsockopt SO_SNDBUF");
1891
2024
#endif
1892
2025
#ifndef NOUNIXDOM
1893
2026
                                                }
1909
2042
                                                check_routedelete(pcbp);
1910
2043
                                                pcbp->tt_fd = s;
1911
2044
                                                pcbp->tt_state = TTOPEN;
 
2045
 
 
2046
#ifndef WIN32
 
2047
                                                {
 
2048
                                                        int i;
 
2049
 
 
2050
                                                        if ((i = fcntl(pcbp->tt_fd, F_GETFL, 0))
 
2051
                                                                        == -1)
 
2052
                                                                pvmlogperror("mxfer() fcntl");
 
2053
                                                        else {
 
2054
#ifdef O_NDELAY
 
2055
                                                                i |= O_NDELAY;
 
2056
#else
 
2057
                                                                i |= FNDELAY;
 
2058
#endif
 
2059
                                                                (void)fcntl(pcbp->tt_fd, F_SETFL, i);
 
2060
                                                        }
 
2061
                                                }
 
2062
#endif
 
2063
 
1912
2064
                                                pvm_fd_add(s, 1);
1913
2065
 
1914
2066
        /* new route socket created for communication */
1918
2070
                                }
1919
2071
                }
1920
2072
 
 
2073
                bypassRead = bypassRead; /* sgi compiler */
 
2074
 
1921
2075
#else   /* !IMA_MPP */
1922
2076
 
1923
2077
                /* For Native Messaging mxinput is used to probe pvmd AND tasks when 
2052
2206
                                n = pvm_node_send(txcp, txtogo, txpcbp, &sendmsg, 
2053
2207
                                                        inPlaceHeader, inPlaceBodyLen);
2054
2208
#else 
 
2209
                                inPlaceBodyLen = inPlaceBodyLen; /* sgi compiler */
2055
2210
 
2056
 
#if defined(IMA_RS6K) || defined(IMA_SP2MPI) || defined(IMA_AIX4SP2)
 
2211
#if defined(IMA_RS6K) || defined(IMA_SP2MPI) || defined(IMA_AIX4SP2) \
 
2212
                || defined(IMA_AIX5SP2)
2057
2213
                                n = write(txpcbp->tt_fd, txcp, min(txtogo, 4096));
2058
2214
#else
2059
2215
#ifndef WIN32
2197
2353
        struct sockaddr_in sad;
2198
2354
        int l;
2199
2355
#ifdef SOCKLENISUINT
2200
 
#ifdef IMA_AIX4SP2
 
2356
#if defined(IMA_AIX4SP2) || defined(IMA_AIX5SP2)
2201
2357
        unsigned int oslen;
2202
2358
#else
2203
2359
        size_t oslen;
2211
2367
        char *addr = 0;
2212
2368
#ifndef NOUNIXDOM
2213
2369
        struct sockaddr_un uns;
2214
 
        char spath[LEN_OF_TMP_NAM];
 
2370
        char spath[PVMTMPNAMLEN];
2215
2371
#endif
2216
2372
 
2217
2373
        if (up = midtobuf(mid)) {
2278
2434
                                        pvmlogperror("mroute() socket");
2279
2435
 
2280
2436
                                } else {
2281
 
                                        (void)TMPNAMFUN(spath);
2282
2437
                                        BZERO((char*)&uns, sizeof(uns));
2283
2438
                                        uns.sun_family = AF_UNIX;
2284
2439
                                        spath[0] = 0;
2285
 
                                        (void)tmpnam(spath);
 
2440
                                        (void)PVMTMPNAMFUN(spath);
2286
2441
                                        strcpy(uns.sun_path, spath);
2287
2442
 
2288
2443
                                        oslen = sizeof(uns);
2326
2481
                                                        if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY,
2327
2482
                                                                        (char*)&l, sizeof(int)) == -1)
2328
2483
                                                                pvmlogperror("mroute() setsockopt");
2329
 
#if (!defined(IMA_RS6K)) && (!defined(IMA_AIX46K))
 
2484
#if (!defined(IMA_RS6K)) \
 
2485
                && (!defined(IMA_AIX46K)) && (!defined(IMA_AIX46K64)) \
 
2486
                && (!defined(IMA_AIX56K)) && (!defined(IMA_AIX56K64))
2330
2487
                                                        l = TTSOCKBUF;
2331
2488
                                                        if (setsockopt(s, SOL_SOCKET, SO_SNDBUF,
2332
2489
                                                                        (char*)&l, sizeof(l)) == -1
2504
2661
 
2505
2662
static int
2506
2663
int_compare(i, j)
2507
 
#if defined (WIN32) || defined(IMA_SGI) || defined(IMA_SGI5) || defined(IMA_SGI6) || defined(IMA_SGI64) || defined(IMA_SGIMP) || defined(IMA_SGIMP6) || defined(IMA_SGIMP64)
 
2664
#if defined (WIN32) || defined(IMA_SGI) || defined(IMA_SGI5) || defined(IMA_SGI6) || defined(IMA_SGI64) || defined(IMA_SGIMP) || defined(IMA_SGIMP6) || defined(IMA_SGIMP64) || defined(IMA_SUN4SOL2)
2508
2665
        const void *i, *j;
2509
2666
#else
2510
2667
        void *i, *j;
2618
2775
#endif
2619
2776
 
2620
2777
#ifdef SOCKLENISUINT
2621
 
#ifdef IMA_AIX4SP2
 
2778
#if defined(IMA_AIX4SP2) || defined(IMA_AIX5SP2)
2622
2779
        unsigned int oslen;
2623
2780
#else
2624
2781
        size_t oslen;
2822
2979
        int cookie;                                             /* cookie assigned by pvmd for ident */
2823
2980
        int cc;
2824
2981
        char **ep=0;
2825
 
        char authfn[LEN_OF_TMP_NAM];    /* auth file name */
 
2982
        char authfn[PVMTMPNAMLEN];      /* auth file name */
2826
2983
        int authfd = -1;                                /* auth fd to validate pvmd ident */
2827
2984
        int i;
2828
2985
        char buf[16];                                   /* for converting sockaddr */
2835
2992
        char tmask[ 2 * TEV_MASK_LENGTH ];
2836
2993
        int tbuf, topt;
2837
2994
        int mid;
 
2995
#ifdef IMA_BEOLIN
 
2996
        struct hostent *hostaddr;
 
2997
        char namebuf[128];
 
2998
#endif
2838
2999
        TEV_DECLS
2839
3000
#ifdef WIN32
2840
3001
 
2926
3087
        */
2927
3088
 
2928
3089
#ifndef IMA_MPP
2929
 
        (void)TMPNAMFUN(authfn);
 
3090
#ifndef NOPROT
 
3091
        (void)PVMTMPNAMFUN(authfn);
2930
3092
#ifdef IMA_OS2
2931
3093
        if ((authfd = open(authfn, O_RDWR|O_CREAT|O_TRUNC, 0600)) == -1) {
2932
3094
#else
2937
3099
                cc = PvmSysErr;
2938
3100
                goto bail2;
2939
3101
        }
 
3102
#endif
2940
3103
 
2941
3104
        /*
2942
3105
        *       send first connect message to pvmd
2965
3128
        *       check our t-auth file; write in pvmd d-auth file
2966
3129
        */
2967
3130
 
 
3131
#ifndef NOPROT
 
3132
 
 
3133
#ifdef IMA_BEOLIN
 
3134
        sleep(15);  /* because of race condition over NFS--yuck! (PLS) */
 
3135
#endif
 
3136
 
2968
3137
        if ((cc = read(authfd, (char*)&cc, 1)) == -1) {
2969
3138
                pvmlogperror("pvmbeatask() read authfile");
2970
3139
                cc = PvmSysErr;
2999
3168
        authfd = -1;
3000
3169
        authfn[0] = 0;
3001
3170
 
 
3171
#endif
 
3172
 
3002
3173
        /*
3003
3174
        *       send second connect message to pvmd
3004
3175
        */
3105
3276
        pvm_upkint(&i, 1, 1);   /* XXX data signature */
3106
3277
 
3107
3278
        pvm_upkstr(buf);
 
3279
 
 
3280
#ifdef IMA_BEOLIN
 
3281
        if (gethostname(namebuf, sizeof(namebuf)-1) == -1) {
 
3282
                pvmlogerror("pvmbeatask() can't gethostname()\n");
 
3283
                hex_inadport(buf, &pvmourinet);
 
3284
        } else {
 
3285
                /* got name, now get addr */
 
3286
                if (!(hostaddr = gethostbyname( namebuf ))) {
 
3287
                        pvmlogprintf( "pvmbeatask() can't gethostbyname() for %s\n",
 
3288
                                        namebuf );
 
3289
                        hex_inadport(buf, &pvmourinet);
 
3290
                } else {
 
3291
                        /* got addr, now save it */
 
3292
                        BCOPY( hostaddr->h_addr_list[0],
 
3293
                                        (char*)&pvmourinet.sin_addr,
 
3294
                                        sizeof(struct in_addr));
 
3295
                }
 
3296
        }
 
3297
#else
3108
3298
        hex_inadport(buf, &pvmourinet);
 
3299
#endif
 
3300
 
3109
3301
        pvmourinet.sin_family = AF_INET;
3110
3302
        pvmourinet.sin_port = 0;
3111
3303