[Mono-devel-list] Re: [PATCH] make --debug symfiles use mmap

Ben Maurer bmaurer at ximian.com
Sat Jan 22 15:28:00 EST 2005


On Sat, 2005-01-22 at 15:20 -0500, Jonathan Pryor wrote:
> On Sat, 2005-01-22 at 13:06 -0500, Ben Maurer wrote:
> > +       if ((f = open (symfile->filename, O_RDONLY | O_BINARY)) > 0) {
> > +               struct stat stat_buf;
> > +                       
> > +               if (fstat (f, &stat_buf) < 0) {
> > +                       g_warning ("stat of %s failed: %s", symfile-
> > >filename,  g_strerror (errno));
> > +               } else {        
> > +                       symfile->raw_contents_size = stat_buf.st_size;
> > +                       symfile->raw_contents = mono_raw_buffer_load
> > (f, FALSE, 0, stat_buf.st_size);
> > +               }
> > +               
> > +               close (f);
> > +       }
> 
> Why do you use fstat() here?  Wouldn't it be easier to just use stat()?
> Then you could avoid the open(), close(), and O_BINARY definition.

Lupus didn't want the O_BINARY hack.

-- Ben




More information about the Mono-devel-list mailing list