~ubuntu-branches/ubuntu/feisty/pvm/feisty

« back to all changes in this revision

Viewing changes to src/lpvmgen.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: lpvmgen.c,v 1.83 1999/07/08 18:59:56 kohl Exp $";
 
3
        "$Id: lpvmgen.c,v 1.99 2004/02/17 18:01:29 pvmsrc Exp $";
4
4
 
5
5
/*
6
6
 *         PVM version 3.4:  Parallel Virtual Machine System
36
36
 *      Libpvm generic functions.
37
37
 *
38
38
 * $Log: lpvmgen.c,v $
 
39
 * Revision 1.99  2004/02/17 18:01:29  pvmsrc
 
40
 * False alarm, removed debug output for AMD64.
 
41
 * (Spanker=kohl)
 
42
 *
 
43
 * Revision 1.98  2004/02/09 17:21:13  pvmsrc
 
44
 * Oops...  typo...
 
45
 * (Spanker=kohl)
 
46
 *
 
47
 * Revision 1.97  2004/02/09 17:17:01  pvmsrc
 
48
 * Added pvmlogperror debug output for AMD64...
 
49
 *      - the arch that wouldn't die...  er, run without seg faulting...  :)
 
50
 * (Spanker=kohl)
 
51
 *
 
52
 * Revision 1.96  2004/02/03 21:40:57  pvmsrc
 
53
 * Added check for NULL strerror() return...
 
54
 *      - to chase down AMD64 problem...
 
55
 * (Spanker=kohl)
 
56
 *
 
57
 * Revision 1.95  2004/01/14 19:12:34  pvmsrc
 
58
 * Added (char *) cast to strerror() assignment...
 
59
 * (Spanker=kohl)
 
60
 *
 
61
 * Revision 1.94  2004/01/14 18:50:56  pvmsrc
 
62
 * Added new AIX5* arches.
 
63
 * (Spanker=kohl)
 
64
 *
 
65
 * Revision 1.93  2001/09/26 23:35:43  pvmsrc
 
66
 * Removed stuffing of PVM_VMID env var when spawning remote tasks.
 
67
 *      - first, each host can have it's own local vmid (why not?),
 
68
 *              so we shouldn't stomp that on the spawn.
 
69
 *      - second, each local pvmd sets its PVM_VMID env var on startup
 
70
 *              if the option is passed to it, so there's no need to
 
71
 *              additionally set the vmid on the spawn.
 
72
 * (Spanker=kohl)
 
73
 *
 
74
 * Revision 1.92  2001/09/26 21:22:34  pvmsrc
 
75
 * Added Handling for Optional Virtual Machine ID.
 
76
 *      - append PVM_VMID env var to spawn env for tasks (if set).
 
77
 * (Spanker=kohl)
 
78
 *
 
79
 * Revision 1.91  2001/06/28 16:45:29  pvmsrc
 
80
 * D-Oh!  Better set context around message handler functions.
 
81
 *      - if message comes in with a particular context, reply should
 
82
 *              probably be in same context!  :-]
 
83
 * (Spanker=kohl)
 
84
 *
 
85
 * Revision 1.90  2001/05/11 18:58:11  pvmsrc
 
86
 * Added use of new "USESTRERROR" define.
 
87
 *      - uses strerror() function instead of sys_errlist/sys_nerr
 
88
 *              (which aren't public globals on some new operating systems).
 
89
 * (Spanker=kohl)
 
90
 *
 
91
 * Revision 1.89  2001/02/07 23:14:06  pvmsrc
 
92
 * First Half of CYGWIN Check-ins...
 
93
 * (Spanker=kohl)
 
94
 *
 
95
 * Revision 1.88  2000/06/15 17:51:50  pvmsrc
 
96
 * Fixed bug in WIN32 direct routing.
 
97
 *      - stupid #endif in the wrong place, pvm_fd_add() call whacked.
 
98
 *      - turned back on direct routing default and setopt.
 
99
 * (Spanker=kohl)
 
100
 *
 
101
 * Revision 1.87  2000/02/17 23:12:12  pvmsrc
 
102
 * *** Changes for new BEOLIN port ***
 
103
 *      - MPP-like, similar to SP2, etc.
 
104
 *      - submitted by Paul Springer <pls@smokeymt.jpl.nasa.gov>.
 
105
 *      - format-checked & cleaned up by Jeembo...  :-)
 
106
 * (Spanker=kohl)
 
107
 *
 
108
 * Revision 1.86  2000/02/16 21:59:43  pvmsrc
 
109
 * Fixed up #include <sys/types.h> stuff...
 
110
 *      - use <bsd/sys/types.h> for IMA_TITN...
 
111
 *      - #include before any NEEDMENDIAN #includes...
 
112
 * (Spanker=kohl)
 
113
 *
 
114
 * Revision 1.85  1999/11/08 17:44:32  pvmsrc
 
115
 * SGI compiler cleanup.
 
116
 * (Spanker=kohl)
 
117
 *
 
118
 * Revision 1.84  1999/10/27 18:49:00  pvmsrc
 
119
 * Fixed (hopefully) the function header declaration for pvm_recvf().
 
120
 *      - should work on all platforms now (using __ProtoGlarp__())...
 
121
 * (Spanker=kohl)
 
122
 *
39
123
 * Revision 1.83  1999/07/08 18:59:56  kohl
40
124
 * Fixed "Log" keyword placement.
41
125
 *      - indent with " * " for new CVS.
496
580
 
497
581
#include <stdio.h>
498
582
#ifdef NEEDMENDIAN
 
583
#include <sys/types.h>
499
584
#include <machine/endian.h>
500
585
#endif
501
586
#ifdef NEEDENDIAN
506
591
#endif
507
592
 
508
593
#include <pvm3.h>
509
 
#ifdef WIN32
510
 
#ifndef _XDR_HEADERS
511
 
#define _XDR_HEADERS
 
594
 
 
595
#if defined(WIN32) || defined(CYGWIN)
512
596
#include "..\xdr\types.h"
513
597
#include "..\xdr\xdr.h"
514
 
#endif
515
598
#else
516
599
#include <rpc/types.h>
517
600
#include <rpc/xdr.h>
524
607
#include <strings.h>
525
608
#define CINDEX(s,c)     index(s,c)
526
609
#endif
 
610
 
527
611
#include <errno.h>
528
612
#include <signal.h>
529
613
 
546
630
#include "waitc.h"
547
631
#include "global.h"
548
632
 
549
 
#if defined(IMA_PGON) || defined(IMA_SP2MPI) || defined(IMA_AIX4SP2)
 
633
#if defined(IMA_PGON) || defined(IMA_SP2MPI) || defined(IMA_AIX4SP2) \
 
634
        || defined(IMA_AIX5SP2) || defined(IMA_BEOLIN)
550
635
#include "pvmmimd.h"
551
636
#include "lmsg.h"
552
637
extern struct msgid *pvm_inprecv;
554
639
 
555
640
#ifndef HASERRORVARS
556
641
extern int errno;                                               /* from libc */
 
642
#ifndef USESTRERROR
557
643
extern char *sys_errlist[];
558
644
extern int sys_nerr;
559
645
#endif
 
646
#endif
560
647
 
561
648
#ifdef WIN32
562
649
#ifndef SOCK_DEFINES
589
676
 
590
677
char *pvmnametag(int tag, int *found);
591
678
 
 
679
 
592
680
/***************
593
681
 **  Private  **
594
682
 **           **
784
872
        char *em;
785
873
#endif
786
874
 
787
 
#if defined(IMA_SP2MPI) || defined(IMA_AIX4SP2)
 
875
#if defined(IMA_SP2MPI) || defined(IMA_AIX4SP2) || defined(IMA_AIX5SP2)
788
876
        int l;
789
877
 
790
878
        /* if (mpierrcode) {
791
879
                MPI_Error_string(mpierrcode, pvmtxt, &l);
792
880
                em = pvmtxt;
793
881
        } else */
 
882
#ifdef USESTRERROR
 
883
                em = strerror( errno );
 
884
#else
794
885
                em = ((errno >= 0 && errno < sys_nerr)
795
886
                        ? sys_errlist[errno] : "Unknown Error");
 
887
#endif
796
888
#else
797
889
 
798
890
#ifdef IMA_CM5
799
891
        errno = CMMD_get_errno();
800
892
#endif
801
893
 
 
894
#ifdef USESTRERROR
 
895
        em = (char *) strerror( errno );
 
896
#else
802
897
        em = ((errno >= 0 && errno < sys_nerr)
803
898
                ? sys_errlist[errno] : "Unknown Error");
 
899
#endif
804
900
 
805
901
#endif /*IMA_SP2MPI*/
806
902
 
859
955
{
860
956
        int savesbuf;
861
957
        int saverbuf;
 
958
        int savectx;
862
959
        int i;
863
960
        TEV_DECLS
864
961
 
901
998
 
902
999
                        savesbuf = pvm_setsbuf( 0 );
903
1000
                        saverbuf = pvm_setrbuf( up->m_mid );
 
1001
                        savectx = pvm_setcontext( up->m_ctx );
904
1002
 
905
1003
                        (handles[i].f)(up->m_mid);
906
1004
 
 
1005
                        pvm_setcontext( savectx );
907
1006
                        pvm_freebuf( pvm_setsbuf( savesbuf ) );
908
1007
                        pvm_freebuf( pvm_setrbuf( saverbuf ) );
909
1008
 
1245
1344
                rc = pvmnoreset;
1246
1345
                break;
1247
1346
 
1248
 
#if defined(IMA_AIX4MP) || defined(IMA_ALPHAMP) || defined(IMA_CSPP) \
1249
 
        || defined(IMA_HPPAMP) || defined(IMA_RS6KMP) || defined(IMA_SGIMP) \
1250
 
        || defined(IMA_SGIMP6) || defined(IMA_SGIMP64) || defined(IMA_SUNMP)
 
1347
#if defined(IMA_AIX4MP) || defined(IMA_AIX5MP) \
 
1348
        || defined(IMA_ALPHAMP) || defined(IMA_CSPP) \
 
1349
        || defined(IMA_HPPAMP) || defined(IMA_RS6KMP) \
 
1350
        || defined(IMA_SGIMP) || defined(IMA_SGIMP6) \
 
1351
        || defined(IMA_SGIMP64) || defined(IMA_SUNMP)
1251
1352
 
1252
1353
        case PvmPollTime:
1253
1354
                rc = pvmpolltime;
1314
1415
                case PvmAllowDirect:
1315
1416
                case PvmRouteDirect:
1316
1417
                        rc = pvmrouteopt;
1317
 
#if !defined(IMA_PGON) && !defined(IMA_SP2MPI) && !defined(IMA_AIX4SP2) && !defined(WIN32)
 
1418
#if (!defined(IMA_PGON)) && (!defined(IMA_SP2MPI)) \
 
1419
                && (!defined(IMA_AIX4SP2)) && (!defined(IMA_AIX5SP2))
1318
1420
                        pvmrouteopt = val;
1319
1421
#endif
1320
1422
                        break;
1431
1533
 
1432
1534
        case PvmFragSize:
1433
1535
 
1434
 
#if defined(IMA_AIX4MP) || defined(IMA_ALPHAMP) || defined(IMA_CSPP) \
1435
 
        || defined(IMA_HPPAMP) || defined(IMA_RS6KMP) || defined(IMA_SGIMP) \
1436
 
        || defined(IMA_SGIMP6) || defined(IMA_SGIMP64) || defined(IMA_SUNMP)
 
1536
#if defined(IMA_AIX4MP) || defined(IMA_AIX5MP) \
 
1537
        || defined(IMA_ALPHAMP) || defined(IMA_CSPP) \
 
1538
        || defined(IMA_HPPAMP) || defined(IMA_RS6KMP) \
 
1539
        || defined(IMA_SGIMP) || defined(IMA_SGIMP6) \
 
1540
        || defined(IMA_SGIMP64) || defined(IMA_SUNMP)
1437
1541
 
1438
1542
                rc = PvmBadParam;
1439
1543
                err = 1;
1441
1545
#else /* SHMEM */
1442
1546
 
1443
1547
#if defined(IMA_CM5) || defined(IMA_CUBE) || defined(IMA_I860) \
1444
 
        || defined(IMA_PGON) || defined(IMA_SP2MPI) || defined(IMA_AIX4SP2)
 
1548
        || defined(IMA_PGON) || defined(IMA_SP2MPI) \
 
1549
        || defined(IMA_AIX4SP2) || defined(IMA_AIX5SP2) \
 
1550
        || defined(IMA_BEOLIN)
1445
1551
                /* if (val < TDFRAGHDR + TTMSGHDR + 4 || val > 1048576) */
1446
1552
                if (val < TDFRAGHDR + MSGHDRLEN + 4 || val > MAXFRAGSIZE)
1447
1553
#else
1657
1763
                }
1658
1764
                break;
1659
1765
 
1660
 
#if defined(IMA_AIX4MP) || defined(IMA_ALPHAMP) || defined(IMA_CSPP) \
1661
 
        || defined(IMA_HPPAMP) || defined(IMA_RS6KMP) || defined(IMA_SGIMP) \
1662
 
        || defined(IMA_SGIMP6) || defined(IMA_SGIMP64) || defined(IMA_SUNMP)
 
1766
#if defined(IMA_AIX4MP) || defined(IMA_AIX5MP) \
 
1767
        || defined(IMA_ALPHAMP) || defined(IMA_CSPP) \
 
1768
        || defined(IMA_HPPAMP) || defined(IMA_RS6KMP) \
 
1769
        || defined(IMA_SGIMP) || defined(IMA_SGIMP6) \
 
1770
        || defined(IMA_SGIMP64) || defined(IMA_SUNMP)
1663
1771
 
1664
1772
        case PvmPollTime:
1665
1773
                rc = pvmpolltime;
2046
2154
int
2047
2155
pvm_exit()
2048
2156
{
2049
 
        int i, info, lndh;
 
2157
        int i, lndh;
2050
2158
        int sbf, rbf;
2051
2159
        int cc = 0;
2052
2160
        struct waitc *wp, *wp2;
2093
2201
                */
2094
2202
                lndh = ndhandles - 1;
2095
2203
                for (i = lndh; i >= 0; i--){
2096
 
                        info = pvm_delmhf(i);
 
2204
                        pvm_delmhf(i);
2097
2205
                }
2098
2206
 
2099
2207
                pvmendtask();
2730
2838
                                up = up->m_rlink;
2731
2839
                                if ((cc = mroute(0, 0, 0, (struct timeval *)0)) < 0)
2732
2840
                                        goto done;
2733
 
#if defined(IMA_PGON) || defined(IMA_SP2MPI) || defined(IMA_AIX4SP2)
 
2841
#if defined(IMA_PGON) || defined(IMA_SP2MPI) || defined(IMA_AIX4SP2) \
 
2842
                || defined(IMA_AIX5SP2)
2734
2843
                        /* bypass matching of messages when in a precv that completed */
2735
2844
                                if (pvm_inprecv && pvm_inprecv->complete)
2736
2845
                                        return 0;
2784
2893
 
2785
2894
int (*
2786
2895
pvm_recvf(new))()
2787
 
#ifdef  IMA_SCO
2788
 
        int (*new)(int,int,int);
2789
 
#else
2790
 
        int (*new)();
2791
 
#endif
 
2896
        int (*new)__ProtoGlarp__((int,int,int));
2792
2897
{
2793
2898
        int (*old)() = recv_match;
2794
2899
        TEV_DECLS