[MPlayer-cvslog] r24194 - trunk/osdep/mmap_anon.c

Diego Biurrun diego at biurrun.de
Sat Aug 25 19:53:31 CEST 2007


On Sat, Aug 25, 2007 at 07:52:39PM +0200, Reimar D?ffinger wrote:
> On Sat, Aug 25, 2007 at 07:40:34PM +0200, Diego Biurrun wrote:
> > On Sat, Aug 25, 2007 at 07:25:14PM +0200, Reimar Döffinger wrote:
> > > On Sat, Aug 25, 2007 at 07:09:09PM +0200, diego wrote:
> > > > 
> > > > Log:
> > > > warning fix:
> > > > mmap_anon.c: In function 'mmap_anon':
> > > > mmap_anon.c:37: warning: unused variable 'fd'
> > > > 
> > > > --- trunk/osdep/mmap_anon.c	(original)
> > > > +++ trunk/osdep/mmap_anon.c	Sat Aug 25 19:09:09 2007
> > > > @@ -34,7 +34,6 @@
> > > >   */
> > > >  void *mmap_anon(void *addr, size_t len, int prot, int flags, off_t offset)
> > > >  {
> > > > -    int fd;
> > > >      void *result;
> > > >  
> > > >       /* From loader/ext.c:
> > > > @@ -50,6 +49,7 @@ void *mmap_anon(void *addr, size_t len, 
> > > >      result = mmap(addr, len, prot, flags | MAP_ANONYMOUS, -1, offset);
> > > >  #else
> > > >      /* SysV-style anonymous mapping */
> > > > +    int fd;
> > > >      fd = open("/dev/zero", O_RDWR);
> > > >      if(fd < 0){
> > > >          perror( "Cannot open /dev/zero for READ+WRITE. Check permissions! error: ");
> > > 
> > > Well, it was there to avoid problems with gcc 2.95.
> > > No idea what kind of systems still do not have MAP_ANONYMOUS though.
> > 
> > I explicitly tested this with gcc 2.95, the preprocessor removes all
> > statements before this variable declaration.
> 
> The only problematic case is a system with MAP_SHARED, MAP_PRIVATE but
> not MAP_ANONYMOUS.
> Maybe such a system does not even exist, no idea.
> Furthermore, I am not even sure if the "flags = (flags & ~MAP_SHARED) |
> MAP_PRIVATE;" make sense outside the MAP_ANONYMOUS.
> Just explaining why the variable was where it was.

Do you want the commit reverted?

Diego



More information about the MPlayer-cvslog mailing list