Changeset b19e8e in git
- Timestamp:
- Mar 22, 2024, 2:19:48 PM (2 months ago)
- Branches:
- (u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
- Children:
- c1b4b44600babf6d7a56f4684f4ff14c98a41e20
- Parents:
- c1cb4469fcf4806587c032c0165d48cf7891316f
- Location:
- Singular
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/iparith.cc
rc1cb44 rb19e8e 5576 5576 } 5577 5577 j = 1; 5578 Lforks->m[i-1].CleanUp(); 5579 Lforks->m[i-1].rtyp=DEF_CMD; 5580 Lforks->m[i-1].data=NULL; 5578 if (i>0) 5579 { 5580 Lforks->m[i-1].CleanUp(); 5581 Lforks->m[i-1].rtyp=DEF_CMD; 5582 Lforks->m[i-1].data=NULL; 5583 } 5581 5584 } 5582 5585 res->data = (void*)(long)j; -
Singular/links/ssiLink.cc
rc1cb44 rb19e8e 1954 1954 ssiInfo *d=NULL; 1955 1955 int d_fd; 1956 fd_set mask, fdmask;1957 FD_ZERO(&fdmask);1958 FD_ZERO(&mask);1959 int max_fd=0; /* 1 + max fd in fd_set */1960 1961 /* timeout */1962 struct timeval wt;1963 struct timeval *wt_ptr=&wt;1964 int startingtime = getRTimer()/TIMER_RESOLUTION; // in seconds1965 if (timeout== -1)1966 {1967 wt_ptr=NULL;1968 }1969 else1970 {1971 wt.tv_sec = timeout / 1000000;1972 wt.tv_usec = timeout % 1000000;1973 }1974 1975 /* auxiliary variables */1976 int i;1977 int j;1978 int k;1979 1956 int s; 1980 char fdmaskempty; 1981 1982 /* check the links and fill in fdmask */1983 /* check ssi links for ungetc_buf */1984 for(i =L->nr; i>=0; i--)1957 #ifdef HAVE_POLL 1958 int nfd=L->nr+1; 1959 int wait_for=0; 1960 pollfd *pfd=(pollfd*)omAlloc0(nfd*sizeof(pollfd)); 1961 for(int i=L->nr; i>=0; i--) 1985 1962 { 1986 1963 if (L->m[i].Typ()!=DEF_CMD) … … 2004 1981 if (!s_isready(d->f_read)) 2005 1982 { 1983 pfd[i].fd=d_fd; 1984 pfd[i].events=POLLIN; 1985 wait_for++; 1986 } 1987 else 1988 { 1989 return i+1; 1990 } 1991 } 1992 else 1993 { 1994 Werror("wrong link type >>%s<<",l->m->type); 1995 return -2; 1996 } 1997 } 1998 } 1999 if (timeout>0) timeout=timeout/1000000; 2000 do_poll: 2001 s=poll(pfd,nfd,timeout); 2002 if (s==-1) 2003 { 2004 WerrorS("error in poll call"); 2005 return -2; /*error*/ 2006 } 2007 if(s==0) 2008 { 2009 return 0; /*timeout*/ 2010 } 2011 for(int i=L->nr; i>=0; i--) 2012 { 2013 if (L->m[i].rtyp==LINK_CMD) 2014 { 2015 // the link type is ssi, that's already tested 2016 l=(si_link)L->m[i].Data(); 2017 d=(ssiInfo*)l->data; 2018 d_fd=d->fd_read; 2019 //for(int j=nfd-1;j>=0;j--) 2020 if (!s_isready(d->f_read)) 2021 { 2022 if (pfd[i].fd==d_fd) 2023 { 2024 if (pfd[i].revents &POLLIN) 2025 { 2026 omFree(pfd); 2027 return i+1; 2028 } 2029 if (pfd[i].revents &POLLERR) 2030 { 2031 wait_for--; 2032 pfd[i].events=0; 2033 } 2034 } 2035 } 2036 } 2037 } 2038 // none ready, wait again: 2039 if ((timeout!=0)&&(wait_for>0)) goto do_poll; 2040 return 0; 2041 #else 2042 fd_set mask, fdmask; 2043 FD_ZERO(&fdmask); 2044 FD_ZERO(&mask); 2045 int max_fd=0; /* 1 + max fd in fd_set */ 2046 2047 /* timeout */ 2048 struct timeval wt; 2049 struct timeval *wt_ptr=&wt; 2050 int startingtime = getRTimer()/TIMER_RESOLUTION; // in seconds 2051 if (timeout== -1) 2052 { 2053 wt_ptr=NULL; 2054 } 2055 else 2056 { 2057 wt.tv_sec = timeout / 1000000; 2058 wt.tv_usec = timeout % 1000000; 2059 } 2060 2061 /* auxiliary variables */ 2062 int i; 2063 int j; 2064 int k; 2065 char fdmaskempty; 2066 2067 /* check the links and fill in fdmask */ 2068 /* check ssi links for ungetc_buf */ 2069 for(i=L->nr; i>=0; i--) 2070 { 2071 if (L->m[i].Typ()!=DEF_CMD) 2072 { 2073 if (L->m[i].Typ()!=LINK_CMD) 2074 { WerrorS("all elements must be of type link"); return -2;} 2075 l=(si_link)L->m[i].Data(); 2076 if(SI_LINK_OPEN_P(l)==0) 2077 { WerrorS("all links must be open"); return -2;} 2078 if (((strcmp(l->m->type,"ssi")!=0) && (strcmp(l->m->type,"MPtcp")!=0)) 2079 || ((strcmp(l->mode,"fork")!=0) && (strcmp(l->mode,"tcp")!=0) 2080 && (strcmp(l->mode,"launch")!=0) && (strcmp(l->mode,"connect")!=0))) 2081 { 2082 WerrorS("all links must be of type ssi:fork, ssi:tcp, ssi:connect"); 2083 return -2; 2084 } 2085 if (strcmp(l->m->type,"ssi")==0) 2086 { 2087 d=(ssiInfo*)l->data; 2088 d_fd=d->fd_read; 2089 if (!s_isready(d->f_read)) 2090 { 2006 2091 if (FD_SETSIZE<=d_fd) 2007 2092 { … … 2060 2145 { 2061 2146 l=(si_link)L->m[i].Data(); 2062 if (strcmp(l->m->type,"ssi")==0) 2063 { 2064 d=(ssiInfo*)l->data; 2065 d_fd=d->fd_read; 2066 if(j==d_fd) break; 2067 } 2068 else 2069 { 2070 Werror("wrong link type >>%s<<",l->m->type); 2071 return -2; 2072 } 2073 } 2074 } 2075 // only ssi links: 2147 // only ssi links: 2148 d=(ssiInfo*)l->data; 2149 d_fd=d->fd_read; 2150 if(j==d_fd) break; 2151 } 2152 } 2076 2153 loop 2077 2154 { … … 2118 2195 } 2119 2196 } 2197 #endif 2120 2198 } 2121 2199
Note: See TracChangeset
for help on using the changeset viewer.