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.6 1997/04/16 03:11:06 hubbe Exp $"); + RCSID("$Id: pipe.c,v 1.7 1997/05/07 23:07:17 per 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"   #include "builtin_functions.h"
pike.git/src/modules/Pipe/pipe.c:585: Inside #if defined(HAVE_MMAP) && defined(HAVE_MUNMAP)
      /* We do not handle mmaps if we have a buffer */    if(THIS->fd == -1)    {    apply(obj, "query_fd", 0);    if(sp[-1].type == T_INT) fd=sp[-1].u.integer;    pop_stack();       if (fd != -1 && fstat(fd,&s)==0)    { +  int filep=lseek(fd, 0L, SEEK_CUR); /* keep the file pointer */    if(S_ISREG(s.st_mode) /* regular file */ -  && ((long)(m=(char *)mmap(0,s.st_size,PROT_READ, -  MAP_FILE|MAP_SHARED,fd,0))!=-1)) +  && ((long)(m=(char *)mmap(0,s.st_size - filep,PROT_READ, +  MAP_FILE|MAP_SHARED,fd,filep))!=-1))    {    mmapped += s.st_size;       i->type=I_MMAP;    i->len=s.st_size;    i->u.mmap=m;       pop_n_elems(args);    push_int(0);    return;