pike.git / src / modules / Pipe / pipe.c

version» Context lines:

pike.git/src/modules/Pipe/pipe.c:1:   #include <config.h>   #include "machine.h"      #include <sys/types.h>   #include <sys/stat.h>    + #include <errno.h> +    #ifdef HAVE_SYS_MMAN_H   #include <sys/mman.h>   #else   #ifdef HAVE_LINUX_MMAN_H   #include <linux/mman.h>   #else   #ifdef HAVE_MMAP   /* sys/mman.h is _probably_ there anyway. */   #include <sys/mman.h>   #endif   #endif   #endif      #include <fcntl.h>      #include "global.h" - RCSID("$Id: pipe.c,v 1.8 1997/05/19 22:51:33 hubbe Exp $"); + RCSID("$Id: pipe.c,v 1.9 1997/05/22 16:17:20 grubba Exp $");      #include "stralloc.h"   #include "pike_macros.h"   #include "object.h"   #include "constants.h"   #include "interpret.h"   #include "svalue.h"   #include "error.h"   #include "builtin_functions.h"   
pike.git/src/modules/Pipe/pipe.c:364:    low_start();    finished_p();   }      /* This function reads some data from the file cache..    * Called when we want some data to send.    */   static INLINE struct pike_string* gimme_some_data(unsigned long pos)   {    struct buffer *b; -  unsigned long len; +  long len;       /* We have a file cache, read from it */    if (THIS->fd!=-1)    {    if (THIS->pos<=pos) return NULL; /* no data */    len=THIS->pos-pos;    if (len>READ_BUFFER_SIZE) len=READ_BUFFER_SIZE;    lseek(THIS->fd,pos,0); /* SEEK_SET */ -  read(THIS->fd,static_buffer,len); +  do { +  len = read(THIS->fd,static_buffer,len); +  if (len < 0) { +  if (errno != EINTR) { +  return(NULL); +  } +  } +  } while(len < 0);    return make_shared_binary_string(static_buffer,len);    }       if (pos<THIS->pos)    return make_shared_string("buffer underflow"); /* shit */       /* We want something in the next buffer */    while (THIS->firstbuffer && pos>=THIS->pos+THIS->firstbuffer->s->len)    {    /* Free the first buffer, and update THIS->pos */