| | 1696 | | work() | | | 1697 | | { | | | 1698 | | static int lastpinged = 0; | | | 1699 | | #ifdef FDSETNOTSTRUCT | | | 1700 | | fd_set rfds, wfds; | | | 1701 | | | | | 1702 | | #else | | | 1703 | | struct fd_set rfds, wfds; | | | 1704 | | | | | 1705 | | #endif | | | 1706 | | int nrdy; | | | | | ... | | | 1718 | | double tbpl; | | | 1719 | | double toutpl; | | | 1720 | | int timed_out; | | | 1721 | | extern double dclock(); | | | 1722 | | #endif | | | 1723 | | #endif | | | 1724 | | #ifdef SHMEM | | | 1725 | | int someclosed; | | | 1726 | | #endif | | | 1727 | | | | | 1728 | | gettimeofday(&tnow, (struct timezone*)0); | | | 1729 | | if (pvmdebmask || myhostpart) { | | | 1730 | | PVM_TIMET time_temp;
| | | 1731 | | pvmlogprintf("%s (%s) %s %s\n", | | | 1732 | | hosts->ht_hosts[hosts->ht_local]->hd_name, | | | 1733 | | inadport_decimal(&hosts->ht_hosts[hosts->ht_local]->hd_sad), | | | 1734 | | myarchname, | | | 1735 | | PVM_VER);
| | | 1736 | | pvmlogprintf("ready "); | | | 1737 | | time_temp = (PVM_TIMET) tnow.tv_sec;
| | | 1738 | | pvmlogprintf(ctime(&time_temp)); | | | 1739 | | } | | | 1740 | | | | | 1741 | | | | | 1742 | | | | | 1743 | | | | | 1744 | | | | | 1745 | | | | | 1746 | | if ( myhostpart ) { | | | 1747 | | char *av[5]; | | | 1748 | | char *buf; | | | 1749 | | char *cmd; | | | 1750 | | int ac; | | | 1751 | | int i; | | | 1752 | | | | | 1753 | | for ( i=0 ; modulenames[i] ; i++ ) { | | | 1754 | | cmd = getenv( modulenames[i] ); | | | 1755 | | if ( cmd != NULL )
| | | 1756 | | { | | | | | ... | | | 1765 | | } | | | 1766 | | if (buf) PVM_FREE( buf );
| | | 1767 | | } | | | 1768 | | } | | | 1769 | | } | | | 1770 | | | | | 1771 | | | | | 1772 | | | | | 1773 | | | | | 1774 | | | | | 1775 | | if (addmesg) { | | | 1776 | | struct pmsg *mp = addmesg; | | | 1777 | | | | | 1778 | | addmesg = 0; | | | 1779 | | sendmessage(mp); | | | 1780 | | } | | | 1781 | | | | | 1782 | | | | | 1783 | | | | | 1784 | | | | | 1785 | | | | | 1786 | | pvmgetclock(&tnow); | | | 1787 | | tout.tv_sec = DDBAILTIME;
| | | 1788 | | tout.tv_usec = 0; | | | 1789 | | TVXADDY(&tbail, &tnow, &tout);
| | | 1790 | | | | | 1791 | | tout.tv_sec = DDPINGTIME;
| | | 1792 | | tout.tv_usec = 0; | | | 1793 | | TVXADDY(&tping, &tnow, &tout);
| | | 1794 | | | | | 1795 | | | | | 1796 | | | | | 1797 | | wrk_fds_init(); | | | 1798 | | | | | 1799 | | if (loclsock >= 0) | | | 1800 | | wrk_fds_add(loclsock, 1); | | | 1801 | | wrk_fds_add(netsock, 1); | | | 1802 | | | | | 1803 | | for (; ; ) { | | | 1804 | | | | | 1805 | | | | | 1806 | | | | | 1807 | | | | | 1808 | | #ifdef IMA_BEOSCYLD | | | 1809 | | reap(SIGCLD); | | | 1810 | | #endif | | | 1811 | | while (rdead != wdead) { | | | 1812 | | if (deads[rdead].dd_pid == pprime) { | | | 1813 | | int cc; | | | 1814 | | #ifdef SOCKLENISUINT | | | 1815 | | #if defined(IMA_AIX4SP2) || defined(IMA_AIX5SP2) \ | | | 1816 | | || defined(IMA_AIX56K64) || defined(IMA_LINUXALPHA) | | | 1817 | | unsigned int oslen; | | | 1818 | | #else | | | 1819 | | size_t oslen; | | | 1820 | | #endif | | | 1821 | | #else | | | 1822 | | int oslen; | | | 1823 | | #endif | | | 1824 | | struct sockaddr_in osad; | | | 1825 | | struct timeval t; | | | 1826 | | char buf[DDFRAGHDR];
| | | 1827 | | | | | 1828 | | hostfailentry(hosts->ht_hosts[0]); |
| | 1830 | | pprime = 0; | | | 1831 | | | | | 1832 | | while (1) { | | | 1833 | | FD_ZERO(&rfds);
| | | 1834 | | FD_SET(ppnetsock, &rfds);
| | | 1835 | | t.tv_sec = 0; | | | 1836 | | t.tv_usec = 0; | | | 1837 | | cc = select(ppnetsock + 1, | | | 1838 | | #ifdef FDSETISINT | | | 1839 | | (int *)&rfds, (int *)0, (int *)0, | | | 1840 | | #else | | | 1841 | | (fd_set *)&rfds, (fd_set *)0, (fd_set *)0, | | | 1842 | | #endif | | | 1843 | | &t); | | | 1844 | | if (cc == 1) { | | | 1845 | | oslen = sizeof(osad); | | | 1846 | | recvfrom(ppnetsock, buf, sizeof(buf), | | | 1847 | | 0, (struct sockaddr*)&osad, &oslen); | | | 1848 | | | | | 1849 | | } else if (cc != -1 || errno != EINTR)
| | | 1850 | | break; | | | 1851 | | } | | | 1852 | | | | | 1853 | | } else { | | | 1854 | | if (tp = task_findpid(deads[rdead].dd_pid)) { | | | 1855 | | | | | 1856 | | | | | 1857 | | | | | 1858 | | | | | 1859 | | | | | 1860 | | tp->t_status = deads[rdead].dd_es; | | | 1861 | | tp->t_utime = deads[rdead].dd_ut; | | | 1862 | | tp->t_stime = deads[rdead].dd_st; | | | 1863 | | while (tp->t_out >= 0) { | | | 1864 | | | | | 1865 | | #ifdef FDSETNOTSTRUCT | | | 1866 | | fd_set rfds; | | | 1867 | | #else | | | 1868 | | struct fd_set rfds; | | | 1869 | | #endif | | | 1870 | | | | | 1871 | | FD_ZERO(&rfds);
| | | 1872 | | FD_SET(tp->t_out, &rfds);
| | | 1873 | | TVCLEAR(&tout);
| | | 1874 | | if (select(tp->t_out + 1, | | | 1875 | | #ifdef FDSETISINT | | | 1876 | | (int *)&rfds, (int *)0, (int *)0, | | | 1877 | | #else | | | 1878 | | (fd_set *)&rfds, (fd_set *)0, (fd_set *)0, | | | 1879 | | #endif | | | 1880 | | &tout) == 1) | | | 1881 | | loclstout(tp); | | | 1882 | | | | | 1883 | | else | | | 1884 | | break; | | | 1885 | | } | | | 1886 | | #if defined(IMA_PGON) || defined(IMA_SP2MPI) || defined(IMA_AIX4SP2) \ | | | 1887 | | || defined(IMA_AIX5SP2) || defined(IMA_BEOLIN) | | | 1888 | | mpp_free(tp); | | | 1889 | | #endif | | | 1890 | | task_cleanup(tp); | | | 1891 | | task_free(tp); | | | 1892 | | } | | | 1893 | | } | | | 1894 | | if (++rdead >= ndead) | | | 1895 | | rdead = 0; | | | 1896 | | } | | | 1897 | | |
| | 2225 | | | | netoutput() | | | 2226 | | | | { | | | 2227 | | | | struct timeval tnow, tx; | | | 2228 | | | | struct pkt *pp, *pp2; | | | 2229 | | | | struct hostd *hp; | | | 2230 | | | | char *cp; | | | 2231 | | | | int len; | | | 2232 | | | | int cc; | | | 2233 | | | | char dummy[DDFRAGHDR];
| | | 2234 | | | | | | | 2235 | | | | | | | 2236 | | | | | | | 2237 | | | | | | | 2238 | | | | | | | 2239 | | | | | | | 2240 | | | | | | | 2241 | | | | if (opq->pk_tlink == opq) | | | 2242 | | | | return 0; | | | 2243 | | | | | | | 2244 | | | | | | | 2245 | | | | | | | 2246 | | | | | | | 2247 | | | | | | | 2248 | | | | pvmgetclock(&tnow); | | | 2249 | | | | | | opq->pk_tlink->pk_tlink <= 4095 | 2250 | | | | while ((pp = opq->pk_tlink) != opq && TVXLTY(&pp->pk_rtv, &tnow)) { | Problem | | opq->pk_tlink->pk_tlink <= 4095 |
| | | 2251 | | | | | | | 2252 | | | | | | | 2253 | | | | | | | 2254 | | | | | | | 2255 | | | | hp = pp->pk_hostd; | | | 2256 | | | | if (pp->pk_nrt >= DDMINRETRIES
| | | 2257 | | | | && pp->pk_rto.tv_sec >= DDMINTIMEOUT) {
| | | 2258 | | | | pvmlogprintf( | | | 2259 | | | | "netoutput() timed out sending to %s after %d, %d.%06d\n", | | | 2260 | | | | hp->hd_name, pp->pk_nrt, | | | 2261 | | | | pp->pk_rto.tv_sec, pp->pk_rto.tv_usec); | | | 2262 | | | | hd_dump(hp); | | | 2263 | | | | hostfailentry(hp); | | | 2264 | | | | clear_opq_of((int)(TIDPVMD | hp->hd_hostpart));
| | | 2265 | | | | ht_delete(hosts, hp); | | | 2266 | | | | if (newhosts) | | | 2267 | | | | ht_delete(newhosts, hp); | | | 2268 | | | | continue; | | | 2269 | | | | } | | | 2270 | | | | | | | 2271 | | | | cp = pp->pk_dat; | | | 2272 | | | | len = pp->pk_len; | | | 2273 | | | | if (pp->pk_flag & FFSOM) {
| | | 2274 | | | | cp -= MSGHDRLEN;
| | | 2275 | | | | len += MSGHDRLEN;
| | | 2276 | | | | if (cp < pp->pk_buf) { | | | 2277 | | | | pvmlogerror("netoutput() no headroom for message \n"); | | | 2278 | | | | return 0; | | | 2279 | | | | } | | | 2280 | | | | pvmput32(cp, pp->pk_enc); | | | 2281 | | | | pvmput32(cp + 4, pp->pk_tag); | | | 2282 | | | | pvmput32(cp + 8, pp->pk_ctx); | | | 2283 | | | | pvmput32(cp + 16, pp->pk_wid); | | | 2284 | | | | pvmput32(cp + 20, pp->pk_crc); | | | 2285 | | | | } | | | 2286 | | | | cp -= DDFRAGHDR;
| | | 2287 | | | | len += DDFRAGHDR;
| | | 2288 | | | | | | | 2289 | | | | | | | 2290 | | | | | | | 2291 | | | | | | | 2292 | | | | | | | 2293 | | | | BCOPY(cp, dummy, sizeof(dummy));
| | | 2294 | | | | if (cp < pp->pk_buf) { | | | 2295 | | | | pvmlogerror("netoutput() no headroom for packet \n"); | | | 2296 | | | | return 0; | | | 2297 | | | | } | | | 2298 | | | | | | | 2299 | | | | if (pvmdebmask & PDMPACKET) {
| | | 2300 | | | | pvmlogprintf( | | | 2301 | | | | "netoutput() pkt to %s src t%x dst t%x f %s len %d seq %d ack %d retry %d\n", | | | 2302 | | | | hp->hd_name, pp->pk_src, pp->pk_dst, pkt_flags(pp->pk_flag), | | | 2303 | | | | pp->pk_len, pp->pk_seq, pp->pk_ack, pp->pk_nrt); | | | 2304 | | | | } | | | 2305 | | | | pvmput32(cp, pp->pk_dst); | | | 2306 | | | | pvmput32(cp + 4, pp->pk_src); | | | 2307 | | | | pvmput16(cp + 8, pp->pk_seq); | | | 2308 | | | | pvmput16(cp + 10, pp->pk_ack); | | | 2309 | | | | pvmput32(cp + 12, 0); | | | 2310 | | | | pvmput8(cp + 12, pp->pk_flag); | | | 2311 | | | | #if 0 | | | 2312 | | | | | | | 2313 | | | | if (!(random() & 3)) { | | | 2314 | | | | pvmlogerror("netoutput() darn, dropped one\n"); | | | 2315 | | | | cc = -1; | | | 2316 | | | | } else | | | 2317 | | | | #endif | | | 2318 | | | | if ((cc = sendto(netsock, cp, len, 0, | | | 2319 | | | | (struct sockaddr*)&hp->hd_sad, sizeof(hp->hd_sad))) == -1 | | | 2320 | | | | && errno != EINTR
| | | 2321 | | | | #ifndef WIN32 | | | 2322 | | | | && errno != ENOBUFS
| | | 2323 | | | | #endif | | | 2324 | | | | #ifdef IMA_LINUX | | | 2325 | | | | | | | 2326 | | | | | | | 2327 | | | | #endif | | | 2328 | | | | | | | 2329 | | | | && errno != ENOMEM
| | | | | | | ... | | | 2331 | | | | pvmlogperror("netoutput() sendto"); | | | 2332 | | | | #if defined(IMA_SUN4SOL2) || defined(IMA_X86SOL2) || defined(IMA_SUNMP) || defined(IMA_UXPM) || defined(IMA_UXPV) | | | 2333 | | | | | | | 2334 | | | | if (errno == ECHILD) | | | 2335 | | | | pvmlogerror("this message brought to you by solaris\n"); | | | 2336 | | | | else | | | 2337 | | | | #endif | | | 2338 | | | | pvmbailout(0); | | | 2339 | | | | } | | | 2340 | | | | #ifdef STATISTICS | | | 2341 | | | | if (cc == -1) | | | 2342 | | | | stats.sdneg++; | | | 2343 | | | | else | | | 2344 | | | | stats.sdok++; | | | 2345 | | | | #endif | | | 2346 | | | | | | | 2347 | | | | BCOPY(dummy, cp, sizeof(dummy));
| | | 2348 | | | | | | | 2349 | | | | | | | 2350 | | | | | | | 2351 | | | | | | | 2352 | | | | if (cc != -1) { | | | 2353 | | | | if ((pp->pk_flag & (FFFIN|FFACK)) == (FFFIN|FFACK)) {
| | | 2354 | | | | pk_free(pp); | | | 2355 | | | | if (hp != hosts->ht_hosts[0]) { | | | 2356 | | | | hostfailentry(hp); | | | 2357 | | | | clear_opq_of((int)(TIDPVMD | hp->hd_hostpart));
| | | 2358 | | | | ht_delete(hosts, hp); | | | 2359 | | | | if (newhosts) | | | 2360 | | | | ht_delete(newhosts, hp); | | | 2361 | | | | } | | | 2362 | | | | continue; | | | 2363 | | | | } | | | 2364 | | | | if (!((pp->pk_flag & FFDAT)
| | | 2365 | | | | || (pp->pk_flag & (FFFIN|FFACK)) == FFFIN)) {
| | | 2366 | | | | pk_free(pp); | | | 2367 | | | | continue; | | | 2368 | | | | } | | | 2369 | | | | if (!TVISSET(&pp->pk_at))
| | | 2370 | | | | pp->pk_at = tnow; | | | 2371 | | | | TVXADDY(&pp->pk_rtv, &tnow, &pp->pk_rta);
| | | 2372 | | | | TVXADDY(&pp->pk_rto, &pp->pk_rto, &pp->pk_rta);
| | | 2373 | | | | #ifdef STATISTICS | | | 2374 | | | | if (pp->pk_nrt) | | | 2375 | | | | stats.netret++; | | | 2376 | | | | #endif | | | 2377 | | | | ++pp->pk_nrt; | | | 2378 | | | | if (pp->pk_rta.tv_sec < DDMAXRTT) {
| | | 2379 | | | | TVXADDY(&pp->pk_rta, &pp->pk_rta, &pp->pk_rta);
| | | 2380 | | | | } | | | 2381 | | | | | | | 2382 | | | | } else { | | | 2383 | | | | tx.tv_sec = DDERRRETRY/1000000;
| | | 2384 | | | | tx.tv_usec = DDERRRETRY%1000000;
| | | 2385 | | | | TVXADDY(&pp->pk_rtv, &tnow, &tx);
| | | 2386 | | | | TVXADDY(&pp->pk_rto, &pp->pk_rto, &tx);
| | | 2387 | | | | } | | | 2388 | | | | | | | 2389 | | | | | | | 2390 | | | | | | pp->pk_tlink <= 4095 | 2391 | | | | LISTDELETE(pp, pk_tlink, pk_trlink);
|
|