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

version» Context lines:

pike.git/src/modules/Pipe/pipe.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: pipe.c,v 1.56 2003/10/07 16:27:25 mast Exp $ + || $Id: pipe.c,v 1.57 2003/10/08 14:53:48 grubba Exp $   */      #include "global.h"   #include "config.h"   #include "machine.h"   #include "module.h"      #include <sys/types.h>   #include <sys/stat.h>   
pike.git/src/modules/Pipe/pipe.c:31:   #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.56 2003/10/07 16:27:25 mast Exp $"); + RCSID("$Id: pipe.c,v 1.57 2003/10/08 14:53:48 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:725: Inside #if defined(HAVE_MMAP) && defined(HAVE_MUNMAP)
   pop_stack();       if (fd != -1 && fstat(fd,&s)==0)    {    off_t filep=fd_lseek(fd, 0L, SEEK_CUR); /* keep the file pointer */    size_t len = s.st_size - filep;    if(S_ISREG(s.st_mode) /* regular file */    && ((m=(char *)mmap(0, len, PROT_READ,    MAP_FILE|MAP_SHARED,fd,filep))+1))    { - #ifdef HAVE_GETEUID -  int ou = 0; - #endif +     mmapped += len;       i->type=I_MMAP;    i->len = len;    i->u.mmap=m;   #if defined(HAVE_MADVISE) && defined(MADV_SEQUENTIAL)    /* Mark the pages as sequential read only access... */ -  -  /* NOTE: -  * -  * Potential race-condition with other threads -  */ -  - #ifdef HAVE_GETEUID -  if((ou=geteuid()) && !getuid()) { - #ifdef HAVE_SETEUID -  seteuid(0); - #else /* ! HAVE_SETEUID */ - #ifdef HAVE_SETRESUID -  setresuid(-1, 0, -1); - #endif /* HAVE_SETRESUID */ - #endif /* HAVE_SETEUID */ -  } - #endif +     madvise(m, len, MADV_SEQUENTIAL); - #ifdef HAVE_GETEUID -  if(ou) { - #ifdef HAVE_SETEUID -  seteuid(ou); - #else /* ! HAVE_SETEUID */ - #ifdef HAVE_SETRESUID -  setresuid(-1, ou, -1); - #endif /* HAVE_SETRESUID */ - #endif /* HAVE_SETEUID */ -  } +    #endif - #endif +     pop_n_elems(args);    push_int(0);    return;    }    }    }   #endif       i->u.obj=obj;    nobjects++;