< prev index next >

src/hotspot/os/linux/os_linux.cpp

Print this page
rev 52870 : 8214944: replace strerror by os::strerror


5929 address os::current_stack_base() {
5930   address bottom;
5931   size_t size;
5932   current_stack_region(&bottom, &size);
5933   return (bottom + size);
5934 }
5935 
5936 size_t os::current_stack_size() {
5937   // This stack size includes the usable stack and HotSpot guard pages
5938   // (for the threads that have Hotspot guard pages).
5939   address bottom;
5940   size_t size;
5941   current_stack_region(&bottom, &size);
5942   return size;
5943 }
5944 #endif
5945 
5946 static inline struct timespec get_mtime(const char* filename) {
5947   struct stat st;
5948   int ret = os::stat(filename, &st);
5949   assert(ret == 0, "failed to stat() file '%s': %s", filename, strerror(errno));
5950   return st.st_mtim;
5951 }
5952 
5953 int os::compare_file_modified_times(const char* file1, const char* file2) {
5954   struct timespec filetime1 = get_mtime(file1);
5955   struct timespec filetime2 = get_mtime(file2);
5956   int diff = filetime1.tv_sec - filetime2.tv_sec;
5957   if (diff == 0) {
5958     return filetime1.tv_nsec - filetime2.tv_nsec;
5959   }
5960   return diff;
5961 }
5962 
5963 /////////////// Unit tests ///////////////
5964 
5965 #ifndef PRODUCT
5966 
5967 class TestReserveMemorySpecial : AllStatic {
5968  public:
5969   static void small_page_write(void* addr, size_t size) {




5929 address os::current_stack_base() {
5930   address bottom;
5931   size_t size;
5932   current_stack_region(&bottom, &size);
5933   return (bottom + size);
5934 }
5935 
5936 size_t os::current_stack_size() {
5937   // This stack size includes the usable stack and HotSpot guard pages
5938   // (for the threads that have Hotspot guard pages).
5939   address bottom;
5940   size_t size;
5941   current_stack_region(&bottom, &size);
5942   return size;
5943 }
5944 #endif
5945 
5946 static inline struct timespec get_mtime(const char* filename) {
5947   struct stat st;
5948   int ret = os::stat(filename, &st);
5949   assert(ret == 0, "failed to stat() file '%s': %s", filename, os::strerror(errno));
5950   return st.st_mtim;
5951 }
5952 
5953 int os::compare_file_modified_times(const char* file1, const char* file2) {
5954   struct timespec filetime1 = get_mtime(file1);
5955   struct timespec filetime2 = get_mtime(file2);
5956   int diff = filetime1.tv_sec - filetime2.tv_sec;
5957   if (diff == 0) {
5958     return filetime1.tv_nsec - filetime2.tv_nsec;
5959   }
5960   return diff;
5961 }
5962 
5963 /////////////// Unit tests ///////////////
5964 
5965 #ifndef PRODUCT
5966 
5967 class TestReserveMemorySpecial : AllStatic {
5968  public:
5969   static void small_page_write(void* addr, size_t size) {


< prev index next >