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

Jonathan Pryor jonpryor at vt.edu
Sat Jan 22 15:20:41 EST 2005


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.

 - Jon





More information about the Mono-devel-list mailing list