comparison src/os/linux/vm/perfMemory_linux.cpp @ 2103:e24ab3fa6aaf hs20-b06 jdk7-b125

Merge
author trims
date Fri, 07 Jan 2011 22:56:35 -0800
parents 02895c6a2f82
children d2a62e0f25eb
comparison
equal deleted inserted replaced
2064:9fc3ffb1e0b1 2103:e24ab3fa6aaf
633 } 633 }
634 RESTARTABLE(::close(fd), result); 634 RESTARTABLE(::close(fd), result);
635 return -1; 635 return -1;
636 } 636 }
637 637
638 return fd; 638 // Verify that we have enough disk space for this file.
639 // We'll get random SIGBUS crashes on memory accesses if
640 // we don't.
641
642 for (size_t seekpos = 0; seekpos < size; seekpos += os::vm_page_size()) {
643 int zero_int = 0;
644 result = (int)os::seek_to_file_offset(fd, (jlong)(seekpos));
645 if (result == -1 ) break;
646 RESTARTABLE(::write(fd, &zero_int, 1), result);
647 if (result != 1) {
648 if (errno == ENOSPC) {
649 warning("Insufficient space for shared memory file:\n %s\nTry using the -Djava.io.tmpdir= option to select an alternate temp location.\n", filename);
650 }
651 break;
652 }
653 }
654
655 if (result != -1) {
656 return fd;
657 } else {
658 RESTARTABLE(::close(fd), result);
659 return -1;
660 }
639 } 661 }
640 662
641 // open the shared memory file for the given user and vmid. returns 663 // open the shared memory file for the given user and vmid. returns
642 // the file descriptor for the open file or -1 if the file could not 664 // the file descriptor for the open file or -1 if the file could not
643 // be opened. 665 // be opened.