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

version» Context lines:

pike.git/src/modules/Pipe/pipe.c:15: Inside #if defined(HAVE_MMAP)
  #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.21 1998/04/20 18:53:46 grubba Exp $"); + RCSID("$Id: pipe.c,v 1.22 1998/05/17 18:37:12 grubba Exp $");      #include "threads.h"   #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:42:   #endif   #endif      /*   #define PIPE_STRING_DEBUG   #define PIPE_MMAP_DEBUG   #define PIPE_FILE_DEBUG   #define BLOCKING_CLOSE   */    + #ifndef SEEK_SET + #define SEEK_SET 0 + #endif /* SEEK_SET */ + #ifndef SEEK_CUR + #define SEEK_CUR 1 + #endif /* SEEK_CUR */ + #ifndef SEEK_END + #define SEEK_END 2 + #endif /* SEEK_END */ +  +    #if 0   #define INSISTANT_WRITE   #endif      #ifndef MAP_FILE   # define MAP_FILE 0   #endif      #define READ_BUFFER_SIZE 65536   #define MAX_BYTES_IN_BUFFER 65536
pike.git/src/modules/Pipe/pipe.c:258:    * scheduled for output. Return 1 if we have more bytes in buffers    * than allowed afterwards.    */   static INLINE int append_buffer(struct pike_string *s)    /* 1=buffer full */   {    struct buffer *b;       if(THIS->fd!= -1)    { -  lseek(THIS->fd,THIS->pos,0); -  write(THIS->fd,s->str,s->len); +  lseek(THIS->fd, THIS->pos, SEEK_SET); +  write(THIS->fd, s->str, s->len);    THIS->pos+=s->len;    return 0;    }    else    {    nbuffers++;    b=ALLOC_STRUCT(buffer);    b->next=NULL;    b->s=s;    sbuffers += s->len;
pike.git/src/modules/Pipe/pipe.c:415:       /* We have a file cache, read from it */    if (this->fd!=-1)    {    char buffer[READ_BUFFER_SIZE];       if (this->pos<=pos) return NULL; /* no data */    len=this->pos-pos;    if (len>READ_BUFFER_SIZE) len=READ_BUFFER_SIZE;    THREADS_ALLOW(); -  lseek(this->fd, pos, 0); /* SEEK_SET */ +  lseek(this->fd, pos, SEEK_SET);    THREADS_DISALLOW();    do {    THREADS_ALLOW();    len = read(this->fd, buffer, len);    THREADS_DISALLOW();    if (len < 0) {    if (errno != EINTR) {    return(NULL);    }    }
pike.git/src/modules/Pipe/pipe.c:824: Inside #if 0
   f_mark_fd(2);    pop_stack();   #endif /* 0 */       THIS->living_outputs++;       while (THIS->firstbuffer)    {    b=THIS->firstbuffer;    THIS->firstbuffer=b->next; -  lseek(THIS->fd,THIS->pos,0); +  lseek(THIS->fd, THIS->pos, SEEK_SET);    write(THIS->fd,b->s->str,b->s->len);    sbuffers-=b->s->len;    nbuffers--;    free_string(b->s);    free((char *)b);    }    THIS->lastbuffer=NULL;       /* keep the file pointer of the duped fd    THIS->pos=0; */