Changeset bc0d32 in git for Singular/links/ssiLink.cc
- Timestamp:
- Apr 9, 2013, 3:33:02 PM (11 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- bdda8c2a271e7650c11462d22c70cd15d21d34f1
- Parents:
- f8565ac2b56eae4e46fb63670efa1bc402ae3628
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2013-04-09 15:33:02+02:00
- git-committer:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2013-04-09 15:33:47+02:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/links/ssiLink.cc
rf8565a rbc0d32 25 25 #include "config.h" 26 26 #include <kernel/mod2.h> 27 #include <Singular/si_signals.h> 27 28 28 29 #include <omalloc/omalloc.h> … … 832 833 ssiToBeClosed->next=NULL; 833 834 SSI_BLOCK_CHLD; 834 close(pc[1]);close(cp[0]);835 si_close(pc[1]); si_close(cp[0]); 835 836 d->f_write=fdopen(cp[1],"w"); 836 837 SSI_UNBLOCK_CHLD; … … 869 870 d->pid=pid; 870 871 SSI_BLOCK_CHLD; 871 close(pc[0]);close(cp[1]);872 si_close(pc[0]); si_close(cp[1]); 872 873 d->f_write=fdopen(pc[1],"w"); 873 874 SSI_UNBLOCK_CHLD; … … 919 920 Print("waiting on port %d\n", portno);mflush(); 920 921 listen(sockfd,1); 921 newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, (socklen_t *)&clilen);922 newsockfd = si_accept(sockfd, (struct sockaddr *) &cli_addr, (socklen_t *)&clilen); 922 923 if(newsockfd < 0) 923 924 { … … 933 934 d->f_write = fdopen(newsockfd, "w"); 934 935 SI_LINK_SET_RW_OPEN_P(l); 935 close(sockfd);936 si_close(sockfd); 936 937 } 937 938 // no ssi-Link on stdin or stdout … … 1008 1009 omFree(ser_host); 1009 1010 clilen = sizeof(cli_addr); 1010 newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, (socklen_t *)&clilen);1011 newsockfd = si_accept(sockfd, (struct sockaddr *) &cli_addr, (socklen_t *)&clilen); 1011 1012 if(newsockfd < 0) 1012 1013 { … … 1022 1023 SSI_BLOCK_CHLD; 1023 1024 d->f_write = fdopen(newsockfd, "w"); 1024 close(sockfd);1025 si_close(sockfd); 1025 1026 SSI_UNBLOCK_CHLD; 1026 1027 SI_LINK_SET_RW_OPEN_P(l); … … 1052 1053 server->h_length); 1053 1054 serv_addr.sin_port = htons(portno); 1054 if ( connect(sockfd,(sockaddr*)&serv_addr,sizeof(serv_addr)) < 0)1055 if (si_connect(sockfd,(sockaddr*)&serv_addr,sizeof(serv_addr)) < 0) 1055 1056 { Werror("ERROR connecting(errno=%d)",errno); return TRUE; } 1056 1057 //PrintS("connected\n");mflush(); … … 1162 1163 if (d->r!=NULL) rKill(d->r); 1163 1164 if ((d->pid!=0) 1164 && ( waitpid(d->pid,NULL,WNOHANG)==0))1165 && (si_waitpid(d->pid,NULL,WNOHANG)==0)) 1165 1166 { 1166 1167 struct timespec t; … … 1168 1169 t.tv_nsec=50000000; // <=50 ms 1169 1170 int r=nanosleep(&t,NULL); 1170 if((r==0) && ( waitpid(d->pid,NULL,WNOHANG)==0))1171 if((r==0) && (si_waitpid(d->pid,NULL,WNOHANG)==0)) 1171 1172 { 1172 1173 kill(d->pid,15); … … 1174 1175 t.tv_nsec=10000000; // <=10 ms 1175 1176 r=nanosleep(&t,NULL); 1176 if((r==0)&&( waitpid(d->pid,NULL,WNOHANG)==0))1177 if((r==0)&&(si_waitpid(d->pid,NULL,WNOHANG)==0)) 1177 1178 { 1178 1179 kill(d->pid,9); // just to be sure 1179 waitpid(d->pid,NULL,0);1180 si_waitpid(d->pid,NULL,0); 1180 1181 } 1181 1182 } … … 1498 1499 //Print("test fd %d\n",d->fd_read); 1499 1500 /* check with select: chars waiting: no -> not ready */ 1500 switch (s elect(d->fd_read+1, &mask, NULL, NULL, &wt))1501 switch (si_select(d->fd_read+1, &mask, NULL, NULL, &wt)) 1501 1502 { 1502 1503 case 0: /* not ready */ return "not ready"; … … 1669 1670 #endif 1670 1671 #ifdef HAVE_PSELECT 1671 s = pselect(max_fd, &mask, NULL, NULL, wt_ptr, &sigmask);1672 s = si_pselect(max_fd, &mask, NULL, NULL, wt_ptr, &sigmask); 1672 1673 #else 1673 1674 SSI_BLOCK_CHLD; 1674 s = s elect(max_fd, &mask, NULL, NULL, wt_ptr);1675 s = si_select(max_fd, &mask, NULL, NULL, wt_ptr); 1675 1676 SSI_UNBLOCK_CHLD; 1676 1677 #endif … … 1848 1849 struct sockaddr_in cli_addr; 1849 1850 int clilen = sizeof(cli_addr); 1850 int newsockfd = accept(ssiReserved_sockfd, (struct sockaddr *) &cli_addr, (socklen_t *)&clilen);1851 int newsockfd = si_accept(ssiReserved_sockfd, (struct sockaddr *) &cli_addr, (socklen_t *)&clilen); 1851 1852 if(newsockfd < 0) 1852 1853 { … … 1894 1895 { 1895 1896 ssiReserved_P=0; 1896 close(ssiReserved_sockfd);1897 si_close(ssiReserved_sockfd); 1897 1898 } 1898 1899 return l; … … 1919 1920 loop 1920 1921 { 1921 kidpid = waitpid(-1, &status, WNOHANG);1922 kidpid = si_waitpid(-1, &status, WNOHANG); 1922 1923 if (kidpid==-1) 1923 1924 {
Note: See TracChangeset
for help on using the changeset viewer.