src/hotspot/os/windows/os_windows.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File open Sdiff src/hotspot/os/windows

src/hotspot/os/windows/os_windows.cpp

Print this page




4040   DWORD old_status;
4041   if (!VirtualProtect((char *)_polling_page, os::vm_page_size(),
4042                       PAGE_NOACCESS, &old_status)) {
4043     fatal("Could not disable polling page");
4044   }
4045 }
4046 
4047 // Mark the polling page as readable
4048 void os::make_polling_page_readable(void) {
4049   DWORD old_status;
4050   if (!VirtualProtect((char *)_polling_page, os::vm_page_size(),
4051                       PAGE_READONLY, &old_status)) {
4052     fatal("Could not enable polling page");
4053   }
4054 }
4055 
4056 
4057 int os::stat(const char *path, struct stat *sbuf) {
4058   char pathbuf[MAX_PATH];
4059   if (strlen(path) > MAX_PATH - 1) {


4060     errno = ENAMETOOLONG;
4061     return -1;
4062   }
4063   os::native_path(strcpy(pathbuf, path));
4064   int ret = ::stat(pathbuf, sbuf);
4065   if (sbuf != NULL && UseUTCFileTimestamp) {
4066     // Fix for 6539723.  st_mtime returned from stat() is dependent on
4067     // the system timezone and so can return different values for the
4068     // same file if/when daylight savings time changes.  This adjustment
4069     // makes sure the same timestamp is returned regardless of the TZ.
4070     //
4071     // See:
4072     // http://msdn.microsoft.com/library/
4073     //   default.asp?url=/library/en-us/sysinfo/base/
4074     //   time_zone_information_str.asp
4075     // and
4076     // http://msdn.microsoft.com/library/default.asp?url=
4077     //   /library/en-us/sysinfo/base/settimezoneinformation.asp
4078     //
4079     // NOTE: there is a insidious bug here:  If the timezone is changed


4186 //    value.  This is basically the algorithm used by UNIX kernels.
4187 //
4188 // Note that sampling thread starvation could affect both (b) and (c).
4189 int os::loadavg(double loadavg[], int nelem) {
4190   return -1;
4191 }
4192 
4193 
4194 // DontYieldALot=false by default: dutifully perform all yields as requested by JVM_Yield()
4195 bool os::dont_yield() {
4196   return DontYieldALot;
4197 }
4198 
4199 // This method is a slightly reworked copy of JDK's sysOpen
4200 // from src/windows/hpi/src/sys_api_md.c
4201 
4202 int os::open(const char *path, int oflag, int mode) {
4203   char pathbuf[MAX_PATH];
4204 
4205   if (strlen(path) > MAX_PATH - 1) {


4206     errno = ENAMETOOLONG;
4207     return -1;
4208   }
4209   os::native_path(strcpy(pathbuf, path));
4210   return ::open(pathbuf, oflag | O_BINARY | O_NOINHERIT, mode);
4211 }
4212 
4213 FILE* os::open(int fd, const char* mode) {
4214   return ::_fdopen(fd, mode);
4215 }
4216 
4217 // Is a (classpath) directory empty?
4218 bool os::dir_is_empty(const char* path) {
4219   WIN32_FIND_DATA fd;
4220   HANDLE f = FindFirstFile(path, &fd);
4221   if (f == INVALID_HANDLE_VALUE) {
4222     return true;
4223   }
4224   FindClose(f);
4225   return false;




4040   DWORD old_status;
4041   if (!VirtualProtect((char *)_polling_page, os::vm_page_size(),
4042                       PAGE_NOACCESS, &old_status)) {
4043     fatal("Could not disable polling page");
4044   }
4045 }
4046 
4047 // Mark the polling page as readable
4048 void os::make_polling_page_readable(void) {
4049   DWORD old_status;
4050   if (!VirtualProtect((char *)_polling_page, os::vm_page_size(),
4051                       PAGE_READONLY, &old_status)) {
4052     fatal("Could not enable polling page");
4053   }
4054 }
4055 
4056 
4057 int os::stat(const char *path, struct stat *sbuf) {
4058   char pathbuf[MAX_PATH];
4059   if (strlen(path) > MAX_PATH - 1) {
4060     warning("os::stat failed: path length %d exceeds max length %d\n    path %s",
4061       strlen(path), MAX_PATH, path);
4062     errno = ENAMETOOLONG;
4063     return -1;
4064   }
4065   os::native_path(strcpy(pathbuf, path));
4066   int ret = ::stat(pathbuf, sbuf);
4067   if (sbuf != NULL && UseUTCFileTimestamp) {
4068     // Fix for 6539723.  st_mtime returned from stat() is dependent on
4069     // the system timezone and so can return different values for the
4070     // same file if/when daylight savings time changes.  This adjustment
4071     // makes sure the same timestamp is returned regardless of the TZ.
4072     //
4073     // See:
4074     // http://msdn.microsoft.com/library/
4075     //   default.asp?url=/library/en-us/sysinfo/base/
4076     //   time_zone_information_str.asp
4077     // and
4078     // http://msdn.microsoft.com/library/default.asp?url=
4079     //   /library/en-us/sysinfo/base/settimezoneinformation.asp
4080     //
4081     // NOTE: there is a insidious bug here:  If the timezone is changed


4188 //    value.  This is basically the algorithm used by UNIX kernels.
4189 //
4190 // Note that sampling thread starvation could affect both (b) and (c).
4191 int os::loadavg(double loadavg[], int nelem) {
4192   return -1;
4193 }
4194 
4195 
4196 // DontYieldALot=false by default: dutifully perform all yields as requested by JVM_Yield()
4197 bool os::dont_yield() {
4198   return DontYieldALot;
4199 }
4200 
4201 // This method is a slightly reworked copy of JDK's sysOpen
4202 // from src/windows/hpi/src/sys_api_md.c
4203 
4204 int os::open(const char *path, int oflag, int mode) {
4205   char pathbuf[MAX_PATH];
4206 
4207   if (strlen(path) > MAX_PATH - 1) {
4208     warning("os::open failed: path length %d exceeds max length %d\n    path %s",
4209       strlen(path), MAX_PATH, path);
4210     errno = ENAMETOOLONG;
4211     return -1;
4212   }
4213   os::native_path(strcpy(pathbuf, path));
4214   return ::open(pathbuf, oflag | O_BINARY | O_NOINHERIT, mode);
4215 }
4216 
4217 FILE* os::open(int fd, const char* mode) {
4218   return ::_fdopen(fd, mode);
4219 }
4220 
4221 // Is a (classpath) directory empty?
4222 bool os::dir_is_empty(const char* path) {
4223   WIN32_FIND_DATA fd;
4224   HANDLE f = FindFirstFile(path, &fd);
4225   if (f == INVALID_HANDLE_VALUE) {
4226     return true;
4227   }
4228   FindClose(f);
4229   return false;


src/hotspot/os/windows/os_windows.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File