IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12887


Ignore:
Timestamp:
Apr 18, 2007, 9:38:36 AM (19 years ago)
Author:
rhl
Message:

getpagesize() isn't in posix, and isn't needed --- adding 1 ensures a trailing NUL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/types/psMetadataConfig.c

    r12529 r12887  
    1111*  @author Joshua Hoblitt, University of Hawaii 2006-2007
    1212*
    13 *  @version $Revision: 1.133 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2007-03-22 00:32:18 $
     13*  @version $Revision: 1.134 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2007-04-18 19:38:36 $
    1515*
    1616*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    13031303    }
    13041304
    1305     // determine the system page size
    1306     int pageSize = getpagesize();
    1307 
    1308     // request one extra page.  even if st_size is an exact multiple of pageSize, this
    1309     // will guarantee we get a block of 0-valued bytes at the end of the file data.
    1310     int nPages = buf.st_size / pageSize + 1;
    1311 
    1312     int nBytes = nPages * pageSize;
    1313 
    13141305    // psMetadataConfigParse() is going to read the entire file into memory so
    1315     // we're trying to be nice by allowing the VM to flush the file out of
    1316     // memory if need be.
     1306    // lets use mmap() to allow the system to be cleverer about what gets read
     1307    //
     1308    // We're adding 1 to buf.st_size here in case st_size / system page size has
     1309    // a remainder of zero (otherwise there won't be any trailing \0s at the end
     1310    // of the page).
     1311    int nBytes = buf.st_size + 1;
    13171312
    13181313    void *file = mmap(0, nBytes, PROT_READ, MAP_PRIVATE, fd, 0);
Note: See TracChangeset for help on using the changeset viewer.