~ubuntu-branches/ubuntu/trusty/pvm/trusty-proposed

« back to all changes in this revision

Viewing changes to src/pmsg.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: pmsg.c,v 1.13 1999/07/08 19:00:05 kohl Exp $";
 
3
        "$Id: pmsg.c,v 1.17 2001/02/07 23:15:50 pvmsrc Exp $";
4
4
 
5
5
/*
6
6
 *         PVM version 3.4:  Parallel Virtual Machine System
36
36
 *      Libpvm and pvmd message descriptors
37
37
 *
38
38
 * $Log: pmsg.c,v $
 
39
 * Revision 1.17  2001/02/07 23:15:50  pvmsrc
 
40
 * 2nd Half of CYGWIN Check-ins...
 
41
 * (Spanker=kohl)
 
42
 *
 
43
 * Revision 1.16  2001/02/06 22:26:57  pvmsrc
 
44
 * Added handling for -DUSE_XDR_LONGLONG.
 
45
 *      - for Alphas with broken XDR...
 
46
 * (Spanker=kohl)
 
47
 *
 
48
 * Revision 1.15  2000/02/16 21:59:48  pvmsrc
 
49
 * Fixed up #include <sys/types.h> stuff...
 
50
 *      - use <bsd/sys/types.h> for IMA_TITN...
 
51
 *      - #include before any NEEDMENDIAN #includes...
 
52
 * (Spanker=kohl)
 
53
 *
 
54
 * Revision 1.14  2000/02/11 20:42:09  pvmsrc
 
55
 * Added support for rare Strongarm float byte order to fbol()...
 
56
 *      - hope this doesn't break anything else!!!
 
57
 *      - submitted by Alexander Schulz <un23@rz.uni-karlsruhe.de>.
 
58
 * (Spanker=kohl)
 
59
 *
39
60
 * Revision 1.13  1999/07/08 19:00:05  kohl
40
61
 * Fixed "Log" keyword placement.
41
62
 *      - indent with " * " for new CVS.
108
129
 
109
130
#include <stdio.h>
110
131
#ifdef NEEDMENDIAN
 
132
#include <sys/types.h>
111
133
#include <machine/endian.h>
112
134
#endif
113
135
#ifdef NEEDENDIAN
118
140
#endif
119
141
 
120
142
#include <pvm3.h>
121
 
#ifdef WIN32
122
 
#ifndef _XDR_HEADERS
123
 
#define _XDR_HEADERS
 
143
 
 
144
#if defined(WIN32) || defined(CYGWIN)
124
145
#include "..\xdr\types.h"
125
146
#include "..\xdr\xdr.h"
126
 
#endif
127
147
#else
128
148
#include <rpc/types.h>
129
149
#include <rpc/xdr.h>
273
293
                        if (j == n)
274
294
                                return i << o;
275
295
 
 
296
                        /* weird float byte order for Strongarm?! */
 
297
                        /* submitted Alexander Schulz <un23@rz.uni-karlsruhe.de> */
276
298
                        for (j = 0; j < n; j++)
277
299
                                if (p[(((j/4)*8)+3)-j] != thesigs[i].bytes[j])
278
300
                                        break;
859
881
{
860
882
    register long *np;
861
883
    register char *cp;
862
 
    char     buf[4];
 
884
    char     buf[8];
863
885
    int cc = 0;
864
886
 
865
887
    for (np = (long *)vp; cnt-- > 0; np += std) {
866
888
        cp = (char *)np;
 
889
#ifdef USE_XDR_LONGLONG
 
890
        buf[7] = *cp;
 
891
        buf[6] = *(cp+1);
 
892
        buf[5] = *(cp+2);
 
893
        buf[4] = *(cp+3);
 
894
        buf[3] = *(cp+4);
 
895
        buf[2] = *(cp+5);
 
896
        buf[1] = *(cp+6);
 
897
        buf[0] = *(cp+7);
 
898
#else
867
899
        buf[3] = *cp;
868
900
        buf[2] = *(cp+1);
869
901
        buf[1] = *(cp+2);
870
902
        buf[0] = *(cp+3);
871
 
        if (cc = bytepk(mp, buf, 4, 1, 1))
 
903
#endif
 
904
        if (cc = bytepk(mp, buf,
 
905
#ifdef USE_XDR_LONGLONG
 
906
                                8,
 
907
#else
 
908
                                4,
 
909
#endif
 
910
                                1, 1))
872
911
            return cc;
873
912
    }
874
913
    return 0;
1062
1101
{
1063
1102
    register long *np;
1064
1103
    register char *cp;
1065
 
    char     buf[4];
 
1104
    char     buf[8];
1066
1105
    int cc = 0;
1067
1106
 
1068
1107
    for (np = (long *)vp; cnt-- > 0; np += std) {
1069
 
        if (cc = byteupk(mp, buf, 4, 1, 1))
 
1108
        if (cc = byteupk(mp, buf,
 
1109
#ifdef USE_XDR_LONGLONG
 
1110
                                8,
 
1111
#else
 
1112
                                4,
 
1113
#endif
 
1114
                                1, 1))
1070
1115
            return cc;
1071
1116
        cp = (char *)np;
 
1117
#ifdef USE_XDR_LONGLONG
 
1118
        *cp     = buf[7];
 
1119
        *(cp+1) = buf[6];
 
1120
        *(cp+2) = buf[5];
 
1121
        *(cp+3) = buf[4];
 
1122
        *(cp+4) = buf[3];
 
1123
        *(cp+5) = buf[2];
 
1124
        *(cp+6) = buf[1];
 
1125
        *(cp+7) = buf[0];
 
1126
#else
1072
1127
        *cp = buf[3];
1073
1128
        *(cp+1) = buf[2];
1074
1129
        *(cp+2) = buf[1];
1075
1130
        *(cp+3) = buf[0];
 
1131
#endif
1076
1132
    }
1077
1133
    return 0;
1078
1134
}
1333
1389
        int cc = 0;
1334
1390
 
1335
1391
        for (np = (long*)vp; cnt-- > 0; np += std)
1336
 
                if (!xdr_long(&mp->m_xdr, np)) {
 
1392
#ifdef USE_XDR_LONGLONG
 
1393
                if (!xdr_longlong_t(&mp->m_xdr, np))
 
1394
#else
 
1395
                if (!xdr_long(&mp->m_xdr, np))
 
1396
#endif
 
1397
                {
 
1398
#ifdef USE_XDR_LONGLONG
 
1399
                        if ((*np & ~(long)0x7fffffffffffffff)
 
1400
                        && (*np & ~(long)0x7fffffffffffffff)
 
1401
                                        != ~(long)0x7fffffffffffffff)
 
1402
#else
1337
1403
                        if ((*np & ~(long)0x7fffffff)
1338
 
                        && (*np & ~(long)0x7fffffff) != ~(long)0x7fffffff) {
 
1404
                        && (*np & ~(long)0x7fffffff) != ~(long)0x7fffffff)
 
1405
#endif
 
1406
                        {
1339
1407
                                cc = PvmOverflow;
1340
1408
                                break;
1341
1409
                        }
1343
1411
                        if (cc = enc_xdr_step(mp))
1344
1412
                                break;
1345
1413
                        else
1346
 
                                if (!xdr_long(&mp->m_xdr, np)) {
 
1414
#ifdef USE_XDR_LONGLONG
 
1415
                                if (!xdr_longlong_t(&mp->m_xdr, np))
 
1416
#else
 
1417
                                if (!xdr_long(&mp->m_xdr, np))
 
1418
#endif
 
1419
                                {
1347
1420
                                        cc = PvmNoMem;
1348
1421
                                        break;
1349
1422
                                }
1363
1436
        int cc = 0;
1364
1437
 
1365
1438
        for (np = (unsigned long*)vp; cnt-- > 0; np += std)
1366
 
                if (!xdr_u_long(&mp->m_xdr, np)) {
1367
 
                        if (*np & ~(long)0xffffffff) {
 
1439
#ifdef USE_XDR_LONGLONG
 
1440
                if (!xdr_u_longlong_t(&mp->m_xdr, np))
 
1441
#else
 
1442
                if (!xdr_u_long(&mp->m_xdr, np))
 
1443
#endif
 
1444
                {
 
1445
#ifdef USE_XDR_LONGLONG
 
1446
                        if (*np & ~(long)0xffffffffffffffff)
 
1447
#else
 
1448
                        if (*np & ~(long)0xffffffff)
 
1449
#endif
 
1450
                        {
1368
1451
                                cc = PvmOverflow;
1369
1452
                                break;
1370
1453
                        }
1372
1455
                        if (cc = enc_xdr_step(mp))
1373
1456
                                break;
1374
1457
                        else
1375
 
                                if (!xdr_u_long(&mp->m_xdr, np)) {
 
1458
#ifdef USE_XDR_LONGLONG
 
1459
                                if (!xdr_u_longlong_t(&mp->m_xdr, np))
 
1460
#else
 
1461
                                if (!xdr_u_long(&mp->m_xdr, np))
 
1462
#endif
 
1463
                                {
1376
1464
                                        cc = PvmNoMem;
1377
1465
                                        break;
1378
1466
                                }
1566
1654
                        return PvmBadMsg;
1567
1655
 
1568
1656
                } else {
1569
 
/*
1570
 
                        pvmlogprintf("fragment has %d bytes left, doing fixup\n", l);
1571
 
*/
 
1657
                        /*
 
1658
                        pvmlogprintf("fragment has %d bytes left, doing fixup\n",
 
1659
                                        l);
 
1660
                        */
1572
1661
                        fp->fr_dat -= l;
1573
1662
                        fp->fr_len += l;
1574
1663
                        BCOPY(p, fp->fr_dat, l);
1668
1757
        int cc = 0;
1669
1758
 
1670
1759
        for (np = (long*)vp; cnt-- > 0; np += std)
1671
 
                if (!xdr_long(&mp->m_xdr, np)) {
 
1760
#ifdef USE_XDR_LONGLONG
 
1761
                if (!xdr_longlong_t(&mp->m_xdr, np))
 
1762
#else
 
1763
                if (!xdr_long(&mp->m_xdr, np))
 
1764
#endif
 
1765
                {
1672
1766
                        mp->m_cpos = xdr_getpos(&mp->m_xdr);
1673
1767
                        if (cc = dec_xdr_step(mp))
1674
1768
                                break;
1675
1769
                        else
1676
 
                                if (!xdr_long(&mp->m_xdr, np)) {
 
1770
#ifdef USE_XDR_LONGLONG
 
1771
                                if (!xdr_longlong_t(&mp->m_xdr, np))
 
1772
#else
 
1773
                                if (!xdr_long(&mp->m_xdr, np))
 
1774
#endif
 
1775
                                {
1677
1776
                                        cc = PvmNoData;
1678
1777
                                        break;
1679
1778
                                }
1743
1842
        int cc = 0;
1744
1843
 
1745
1844
        for (np = (unsigned long*)vp; cnt-- > 0; np += std)
1746
 
                if (!xdr_u_long(&mp->m_xdr, np)) {
 
1845
#ifdef USE_XDR_LONGLONG
 
1846
                if (!xdr_u_longlong_t(&mp->m_xdr, np))
 
1847
#else
 
1848
                if (!xdr_u_long(&mp->m_xdr, np))
 
1849
#endif
 
1850
                {
1747
1851
                        mp->m_cpos = xdr_getpos(&mp->m_xdr);
1748
1852
                        if (cc = dec_xdr_step(mp))
1749
1853
                                break;
1750
1854
                        else
1751
 
                                if (!xdr_u_long(&mp->m_xdr, np)) {
 
1855
#ifdef USE_XDR_LONGLONG
 
1856
                                if (!xdr_u_longlong_t(&mp->m_xdr, np))
 
1857
#else
 
1858
                                if (!xdr_u_long(&mp->m_xdr, np))
 
1859
#endif
 
1860
                                {
1752
1861
                                        cc = PvmNoData;
1753
1862
                                        break;
1754
1863
                                }