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

version» Context lines:

pike.git/src/modules/Pipe/pipe.c:13: 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.4 1997/03/17 03:09:45 hubbe Exp $"); + RCSID("$Id: pipe.c,v 1.5 1997/03/20 16:05:49 grubba Exp $");      #include "stralloc.h"   #include "types.h"   #include "pike_macros.h"   #include "object.h"   #include "constants.h"   #include "interpret.h"   #include "svalue.h"   #include "error.h"   
pike.git/src/modules/Pipe/pipe.c:690:    {    /* test if usable as buffer */    apply(sp[-args].u.object,"query_fd",0);       if ((sp[-1].type==T_INT)    && (fd=sp[-1].u.integer)>=0    && (fstat(fd,&s)==0)    && S_ISREG(s.st_mode)    && (THIS->fd=dup(fd))!=-1 )    { +  /* keep the file pointer of the duped fd */ +  THIS->pos=lseek(fd, 0L, SEEK_CUR); +    #if 0    /* This won't work if the spider-module is dynamically linked. */    push_int(THIS->fd);    push_string(make_shared_string("pipe.c: file buffer"));    f_mark_fd(2);    pop_stack();   #endif /* 0 */       THIS->living_outputs++;   
pike.git/src/modules/Pipe/pipe.c:713:    THIS->firstbuffer=b->next;    lseek(THIS->fd,THIS->pos,0);    write(THIS->fd,b->s->str,b->s->len);    sbuffers-=b->s->len;    nbuffers--;    free_string(b->s);    free((char *)b);    }    THIS->lastbuffer=NULL;    -  THIS->pos=0; +  /* keep the file pointer of the duped fd +  THIS->pos=0; */    push_int(0);    apply(sp[-args-2].u.object,"set_id", 1);    pop_n_elems(args+2); /* ... and from apply x 2 */    return;    }    pop_stack(); /* from apply */    }       THIS->living_outputs++;    THISOBJ->refs++; /* Weird */
pike.git/src/modules/Pipe/pipe.c:751:    o->set_blocking_offset<0)    {    free_object(o->obj);    error("illegal file object%s%s%s\n",    ((o->write_offset<0)?"; no write":""),    ((o->set_nonblocking_offset<0)?"; no set_nonblocking":""),    ((o->set_blocking_offset<0)?"; no set_blocking":""));    }       o->mode=O_RUN; -  o->pos=0; +  /* keep the file pointer of the duped fd +  o->pos=0; */ +  o->pos=THIS->pos;       push_object(obj);    obj->refs++;    apply(o->obj,"set_id",1);    pop_stack();       push_int(0);    push_callback(offset_output_write_callback);    push_callback(offset_output_close_callback);    apply_low(o->obj,o->set_nonblocking_offset,3);