| | 1027 | | | | | | | 1028 | | | | #ifdef SHAREDTMP | | | 1029 | | | | | | | 1030 | | | | if (gethostname(hna, sizeof(hna)-1) == -1) { | | | 1031 | | | | pvmlogerror("pvmdsockfile() can't gethostname()\n"); | | | 1032 | | | | return (char*)0; | | | 1033 | | | | } | | | 1034 | | | | if (p = CINDEX(hna, '.')) | | | 1035 | | | | *p = 0; | | | 1036 | | | | | | | | | | | ... | | | 1045 | | | | #else | | | 1046 | | | | | | | 1047 | | | | #ifdef IMA_CSPP | | | 1048 | | | | if (scid > 1) | | | 1049 | | | | (void)sprintf(buf, TDSOCKNAME_CSPP, pvmtmp, pvm_useruid, scid); | | | 1050 | | | | else | | | 1051 | | | | #endif | | | 1052 | | | | #ifdef WIN32 | | | 1053 | | | | sprintf( buf, "%s\\pvmd.%s", pvmtmp, username ); | | | 1054 | | | | #else | | | 1055 | | | | (void)sprintf(buf, TDSOCKNAME, pvmtmp, pvm_useruid);
| | | 1056 | | | | #endif | | | 1057 | | | | | | | 1058 | | | | #endif | | | 1059 | | | | | | | 1060 | | | | | | | 1061 | | | | if ( p = getenv("PVM_VMID") ) { | | | 1062 | | | | strcat( buf, "." ); | | | 1063 | | | | strcat( buf, p ); | | | 1064 | | | | } | | | 1065 | | | | | | | 1066 | | | | return buf; | | $input_12 > 107 | 1067 | | | | } |
| | 2827 | | pvmlogerror("mksocs() pvmdsockfile() failed\n"); | | | 2828 | | goto bail; | | | 2829 | | } | | | 2830 | | #ifndef WIN32 | | | 2831 | | if ((d = open(p, O_RDONLY, 0)) == -1) {
| | | 2832 | | #else | | | 2833 | | d = win32_open_file(p); | | | 2834 | | if (d == (HANDLE) -2) { | | | 2835 | | system_loser_win=TRUE; | | | 2836 | | d = (HANDLE) _open(p,O_RDONLY,0); | | | 2837 | | } | | | 2838 | | if (d== (HANDLE) -1) { | | | 2839 | | #endif | | | 2840 | | pvmlogperror(p); | | | 2841 | | goto bail; | | | | | ... | | | 2843 | | #ifdef WIN32 | | | 2844 | | if (!system_loser_win) { | | | 2845 | | n = win32_read_file(d,buf,sizeof(buf)); | | | 2846 | | win32_close_file(d); | | | 2847 | | } | | | 2848 | | else { | | | 2849 | | n = (int)_read((int)d, (void *)buf, (unsigned int)sizeof(buf)); | | | 2850 | | (void)_close((int)d); | | | 2851 | | } | | | 2852 | | #else | | $input_12 > 107 | 2853 | | n = read(d, buf, sizeof(buf)); | | | 2854 | | (void)close(d); | | | 2855 | | #endif | | | 2856 | | if (n == -1) { | | | 2857 | | pvmlogperror("mksocs() read addr file"); | | | 2858 | | goto bail; | | | 2859 | | } | | | 2860 | | if (n == 0) { | | | 2861 | | pvmlogerror("mksocs() read addr file: wrong length read\n"); | | | 2862 | | goto bail; | | | 2863 | | } | | n > 107 | 2864 | | buf[n] = 0; | | strlen(&buf[0]) > 107 | 2865 | | p = buf; | | | 2866 | | } | | | 2867 | | | | | 2868 | | FD_ZERO(&pvmrfds);
| | | 2869 | | | | | 2870 | | | | | 2871 | | | | | 2872 | | pvmnfds = 0; | | | 2873 | | | | | 2874 | | topvmd = ttpcb_new(); | | | 2875 | | topvmd->tt_tid = TIDPVMD;
| | | 2876 | | | | | 2877 | | if (p[0] == '/') { | | | 2878 | | #ifdef NOUNIXDOM | | | 2879 | | pvmlogerror("mksocs() no support for Unix domain socket\n"); | | | 2880 | | goto bail; | | | 2881 | | | | | 2882 | | #else | | | 2883 | | if ((topvmd->tt_fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
| | | 2884 | | pvmlogperror("mksocs() socket"); | | | 2885 | | goto bail; | | | 2886 | | } | | | 2887 | | | | | 2888 | | | | | 2889 | | | | | 2890 | | | | | 2891 | | | | | 2892 | | | | | 2893 | | try = 5; | | | 2894 | | while (1) { | | | 2895 | | BZERO((char*)&uns, sizeof(uns));
| | | 2896 | | uns.sun_family = AF_UNIX;
| | strlen(p) > 107 | 2897 | | strcpy(uns.sun_path, p); | | | 2898 | | n = sizeof(uns); | | | 2899 | | if (connect(topvmd->tt_fd, (struct sockaddr*)&uns, n) == -1) { | | | 2900 | | if (--try <= 0) { | | | 2901 | | pvmlogperror("mksocs() connect"); | | | 2902 | | pvmlogprintf("\tsocket address tried: %s\n",p); | | | 2903 | | goto bail; | | | 2904 | | } | | | 2905 | | pvmsleep(1); |
|