Changeset 12887 for trunk/psLib
- Timestamp:
- Apr 18, 2007, 9:38:36 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/types/psMetadataConfig.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/types/psMetadataConfig.c
r12529 r12887 11 11 * @author Joshua Hoblitt, University of Hawaii 2006-2007 12 12 * 13 * @version $Revision: 1.13 3$ $Name: not supported by cvs2svn $14 * @date $Date: 2007-0 3-22 00:32:18$13 * @version $Revision: 1.134 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2007-04-18 19:38:36 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1303 1303 } 1304 1304 1305 // determine the system page size1306 int pageSize = getpagesize();1307 1308 // request one extra page. even if st_size is an exact multiple of pageSize, this1309 // 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 1314 1305 // 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; 1317 1312 1318 1313 void *file = mmap(0, nBytes, PROT_READ, MAP_PRIVATE, fd, 0);
Note:
See TracChangeset
for help on using the changeset viewer.
