< prev index next >

src/hotspot/os/windows/perfMemory_windows.cpp

Print this page




1544   //
1545   // on win95/98/me, _stat returns a file size of 0 bytes, but on
1546   // winnt/2k the appropriate file size is returned. support for
1547   // the sharable aspects of performance counters was abandonded
1548   // on the non-nt win32 platforms due to this and other api
1549   // inconsistencies
1550   //
1551   if (::stat(filename, &statbuf) == OS_ERR) {
1552     if (PrintMiscellaneous && Verbose) {
1553       warning("stat %s failed: %s\n", filename, os::strerror(errno));
1554     }
1555     THROW_MSG_0(vmSymbols::java_io_IOException(),
1556                 "Could not determine PerfMemory size");
1557   }
1558 
1559   if ((statbuf.st_size == 0) || (statbuf.st_size % os::vm_page_size() != 0)) {
1560     if (PrintMiscellaneous && Verbose) {
1561       warning("unexpected file size: size = " SIZE_FORMAT "\n",
1562               statbuf.st_size);
1563     }
1564     THROW_MSG_0(vmSymbols::java_io_IOException(),
1565                 "Invalid PerfMemory size");
1566   }
1567 
1568   return statbuf.st_size;
1569 }
1570 
1571 // this method opens a file mapping object and maps the object
1572 // into the address space of the process
1573 //
1574 static void open_file_mapping(const char* user, int vmid,
1575                               PerfMemory::PerfMemoryMode mode,
1576                               char** addrp, size_t* sizep, TRAPS) {
1577 
1578   ResourceMark rm;
1579 
1580   void *mapAddress = 0;
1581   size_t size = 0;
1582   HANDLE fmh;
1583   DWORD ofm_access;
1584   DWORD mv_access;




1544   //
1545   // on win95/98/me, _stat returns a file size of 0 bytes, but on
1546   // winnt/2k the appropriate file size is returned. support for
1547   // the sharable aspects of performance counters was abandonded
1548   // on the non-nt win32 platforms due to this and other api
1549   // inconsistencies
1550   //
1551   if (::stat(filename, &statbuf) == OS_ERR) {
1552     if (PrintMiscellaneous && Verbose) {
1553       warning("stat %s failed: %s\n", filename, os::strerror(errno));
1554     }
1555     THROW_MSG_0(vmSymbols::java_io_IOException(),
1556                 "Could not determine PerfMemory size");
1557   }
1558 
1559   if ((statbuf.st_size == 0) || (statbuf.st_size % os::vm_page_size() != 0)) {
1560     if (PrintMiscellaneous && Verbose) {
1561       warning("unexpected file size: size = " SIZE_FORMAT "\n",
1562               statbuf.st_size);
1563     }
1564     THROW_MSG_0(vmSymbols::java_lang_Exception(),
1565                 "Invalid PerfMemory size");
1566   }
1567 
1568   return statbuf.st_size;
1569 }
1570 
1571 // this method opens a file mapping object and maps the object
1572 // into the address space of the process
1573 //
1574 static void open_file_mapping(const char* user, int vmid,
1575                               PerfMemory::PerfMemoryMode mode,
1576                               char** addrp, size_t* sizep, TRAPS) {
1577 
1578   ResourceMark rm;
1579 
1580   void *mapAddress = 0;
1581   size_t size = 0;
1582   HANDLE fmh;
1583   DWORD ofm_access;
1584   DWORD mv_access;


< prev index next >