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

version» Context lines:

pike.git/src/modules/Pipe/pipe.c:23:   #endif   #endif   #endif      #ifdef HAVE_SYS_ID_H   #include <sys/id.h>   #endif /* HAVE_SYS_ID_H */      #include <fcntl.h>    - RCSID("$Id: pipe.c,v 1.45 2000/12/05 21:08:31 per Exp $"); + RCSID("$Id: pipe.c,v 1.46 2001/09/24 11:58:28 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 "pike_error.h"   #include "builtin_functions.h"
pike.git/src/modules/Pipe/pipe.c:682:   #endif   }      /********** methods *********************************************************/      /* Add an input to this pipe */   static void pipe_input(INT32 args)   {    struct input *i;    int fd=-1; /* Per, one less warning to worry about... */ -  char *m; -  struct stat s; +     struct object *obj;       if (args<1 || sp[-args].type != T_OBJECT)    Pike_error("Bad/missing argument 1 to pipe->input().\n");       obj=sp[-args].u.object;    if(!obj || !obj->prog)    Pike_error("pipe->input() on destructed object.\n");       push_int(0);    apply(sp[-args-1].u.object,"set_id", 1);    pop_stack();       i=new_input();      #if defined(HAVE_MMAP) && defined(HAVE_MUNMAP)       /* We do not handle mmaps if we have a buffer */    if(THIS->fd == -1)    { -  +  char *m; +  struct stat s; +     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=fd_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 - filep,PROT_READ,    MAP_FILE|MAP_SHARED,fd,filep))!=-1))