Changeset bc0d32 in git for Singular/links/ssiLink.cc


Ignore:
Timestamp:
Apr 9, 2013, 3:33:02 PM (11 years ago)
Author:
Hans Schoenemann <hannes@…>
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
Message:
add: handling signals in systyem calls
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/links/ssiLink.cc

    rf8565a rbc0d32  
    2525#include "config.h"
    2626#include <kernel/mod2.h>
     27#include <Singular/si_signals.h>
    2728
    2829#include <omalloc/omalloc.h>
     
    832833          ssiToBeClosed->next=NULL;
    833834          SSI_BLOCK_CHLD;
    834           close(pc[1]); close(cp[0]);
     835          si_close(pc[1]); si_close(cp[0]);
    835836          d->f_write=fdopen(cp[1],"w");
    836837          SSI_UNBLOCK_CHLD;
     
    869870          d->pid=pid;
    870871          SSI_BLOCK_CHLD;
    871           close(pc[0]); close(cp[1]);
     872          si_close(pc[0]); si_close(cp[1]);
    872873          d->f_write=fdopen(pc[1],"w");
    873874          SSI_UNBLOCK_CHLD;
     
    919920        Print("waiting on port %d\n", portno);mflush();
    920921        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);
    922923        if(newsockfd < 0)
    923924        {
     
    933934        d->f_write = fdopen(newsockfd, "w");
    934935        SI_LINK_SET_RW_OPEN_P(l);
    935         close(sockfd);
     936        si_close(sockfd);
    936937      }
    937938      // no ssi-Link on stdin or stdout
     
    10081009        omFree(ser_host);
    10091010        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);
    10111012        if(newsockfd < 0)
    10121013        {
     
    10221023        SSI_BLOCK_CHLD;
    10231024        d->f_write = fdopen(newsockfd, "w");
    1024         close(sockfd);
     1025        si_close(sockfd);
    10251026        SSI_UNBLOCK_CHLD;
    10261027        SI_LINK_SET_RW_OPEN_P(l);
     
    10521053                server->h_length);
    10531054          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)
    10551056          { Werror("ERROR connecting(errno=%d)",errno); return TRUE; }
    10561057          //PrintS("connected\n");mflush();
     
    11621163      if (d->r!=NULL) rKill(d->r);
    11631164      if ((d->pid!=0)
    1164       && (waitpid(d->pid,NULL,WNOHANG)==0))
     1165      && (si_waitpid(d->pid,NULL,WNOHANG)==0))
    11651166      {
    11661167        struct timespec t;
     
    11681169        t.tv_nsec=50000000; // <=50 ms
    11691170        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))
    11711172        {
    11721173          kill(d->pid,15);
     
    11741175          t.tv_nsec=10000000; // <=10 ms
    11751176          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))
    11771178          {
    11781179            kill(d->pid,9); // just to be sure
    1179             waitpid(d->pid,NULL,0);
     1180            si_waitpid(d->pid,NULL,0);
    11801181          }
    11811182        }
     
    14981499      //Print("test fd %d\n",d->fd_read);
    14991500    /* check with select: chars waiting: no -> not ready */
    1500       switch (select(d->fd_read+1, &mask, NULL, NULL, &wt))
     1501      switch (si_select(d->fd_read+1, &mask, NULL, NULL, &wt))
    15011502      {
    15021503        case 0: /* not ready */ return "not ready";
     
    16691670  #endif
    16701671  #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);
    16721673  #else
    16731674  SSI_BLOCK_CHLD;
    1674   s = select(max_fd, &mask, NULL, NULL, wt_ptr);
     1675  s = si_select(max_fd, &mask, NULL, NULL, wt_ptr);
    16751676  SSI_UNBLOCK_CHLD;
    16761677  #endif
     
    18481849  struct sockaddr_in cli_addr;
    18491850  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);
    18511852  if(newsockfd < 0)
    18521853  {
     
    18941895  {
    18951896    ssiReserved_P=0;
    1896     close(ssiReserved_sockfd);
     1897    si_close(ssiReserved_sockfd);
    18971898  }
    18981899  return l;
     
    19191920  loop
    19201921  {
    1921     kidpid = waitpid(-1, &status, WNOHANG);
     1922    kidpid = si_waitpid(-1, &status, WNOHANG);
    19221923    if (kidpid==-1)
    19231924    {
Note: See TracChangeset for help on using the changeset viewer.