< prev index next >

src/hotspot/os/linux/os_linux.inline.hpp

Print this page




  79 {
  80   return NAME_MAX + sizeof(dirent) + 1;
  81 }
  82 
  83 inline jlong os::lseek(int fd, jlong offset, int whence) {
  84   return (jlong) ::lseek64(fd, offset, whence);
  85 }
  86 
  87 inline int os::fsync(int fd) {
  88   return ::fsync(fd);
  89 }
  90 
  91 inline char* os::native_path(char *path) {
  92   return path;
  93 }
  94 
  95 inline int os::ftruncate(int fd, jlong length) {
  96   return ::ftruncate64(fd, length);
  97 }
  98 
  99 inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
 100 {
 101 // readdir_r has been deprecated since glibc 2.24.
 102 // See https://sourceware.org/bugzilla/show_bug.cgi?id=19056 for more details.
 103 #pragma GCC diagnostic push
 104 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 105 
 106   dirent* p;
 107   int status;
 108   assert(dirp != NULL, "just checking");
 109 
 110   // NOTE: Linux readdir_r (on RH 6.2 and 7.2 at least) is NOT like the POSIX
 111   // version. Here is the doc for this function:
 112   // http://www.gnu.org/manual/glibc-2.2.3/html_node/libc_262.html
 113 
 114   if((status = ::readdir_r(dirp, dbuf, &p)) != 0) {
 115     errno = status;
 116     return NULL;
 117   } else
 118     return p;
 119 
 120 #pragma GCC diagnostic pop

 121 }
 122 
 123 inline int os::closedir(DIR *dirp) {
 124   assert(dirp != NULL, "argument is NULL");
 125   return ::closedir(dirp);
 126 }
 127 
 128 // macros for restartable system calls
 129 
 130 #define RESTARTABLE(_cmd, _result) do { \
 131     _result = _cmd; \
 132   } while(((int)_result == OS_ERR) && (errno == EINTR))
 133 
 134 #define RESTARTABLE_RETURN_INT(_cmd) do { \
 135   int _result; \
 136   RESTARTABLE(_cmd, _result); \
 137   return _result; \
 138 } while(false)
 139 
 140 inline bool os::numa_has_static_binding()   { return true; }




  79 {
  80   return NAME_MAX + sizeof(dirent) + 1;
  81 }
  82 
  83 inline jlong os::lseek(int fd, jlong offset, int whence) {
  84   return (jlong) ::lseek64(fd, offset, whence);
  85 }
  86 
  87 inline int os::fsync(int fd) {
  88   return ::fsync(fd);
  89 }
  90 
  91 inline char* os::native_path(char *path) {
  92   return path;
  93 }
  94 
  95 inline int os::ftruncate(int fd, jlong length) {
  96   return ::ftruncate64(fd, length);
  97 }
  98 
  99 inline struct dirent* os::readdir(DIR* dirp)
 100 {





 101   dirent* p;

 102   assert(dirp != NULL, "just checking");
 103 
 104   p = ::readdir(dirp);
 105   if (errno == 0) {






 106       return p;
 107   } else {
 108       return NULL;
 109   }
 110 }
 111 
 112 inline int os::closedir(DIR *dirp) {
 113   assert(dirp != NULL, "argument is NULL");
 114   return ::closedir(dirp);
 115 }
 116 
 117 // macros for restartable system calls
 118 
 119 #define RESTARTABLE(_cmd, _result) do { \
 120     _result = _cmd; \
 121   } while(((int)_result == OS_ERR) && (errno == EINTR))
 122 
 123 #define RESTARTABLE_RETURN_INT(_cmd) do { \
 124   int _result; \
 125   RESTARTABLE(_cmd, _result); \
 126   return _result; \
 127 } while(false)
 128 
 129 inline bool os::numa_has_static_binding()   { return true; }


< prev index next >