< prev index next >

src/hotspot/os/bsd/os_bsd.inline.hpp

Print this page
rev 50955 : [mq]: readdir


  60 #endif
  61 }
  62 
  63 
  64 // On Bsd, reservations are made on a page by page basis, nothing to do.
  65 inline void os::pd_split_reserved_memory(char *base, size_t size,
  66                                       size_t split, bool realloc) {
  67 }
  68 
  69 
  70 // Bang the shadow pages if they need to be touched to be mapped.
  71 inline void os::map_stack_shadow_pages(address sp) {
  72 }
  73 
  74 inline void os::dll_unload(void *lib) {
  75   ::dlclose(lib);
  76 }
  77 
  78 inline const int os::default_file_open_flags() { return 0;}
  79 
  80 inline DIR* os::opendir(const char* dirname)
  81 {
  82   assert(dirname != NULL, "just checking");
  83   return ::opendir(dirname);
  84 }
  85 
  86 inline int os::readdir_buf_size(const char *path)
  87 {
  88   return NAME_MAX + sizeof(dirent) + 1;
  89 }
  90 
  91 inline jlong os::lseek(int fd, jlong offset, int whence) {
  92   return (jlong) ::lseek(fd, offset, whence);
  93 }
  94 
  95 inline int os::fsync(int fd) {
  96   return ::fsync(fd);
  97 }
  98 
  99 inline int os::ftruncate(int fd, jlong length) {
 100   return ::ftruncate(fd, length);
 101 }
 102 
 103 inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
 104 {
 105   dirent* p;
 106   int status;
 107   assert(dirp != NULL, "just checking");
 108 
 109   // NOTE: Bsd readdir_r (on RH 6.2 and 7.2 at least) is NOT like the POSIX
 110   // version. Here is the doc for this function:
 111   // http://www.gnu.org/manual/glibc-2.2.3/html_node/libc_262.html
 112 
 113   if((status = ::readdir_r(dirp, dbuf, &p)) != 0) {
 114     errno = status;
 115     return NULL;
 116   } else
 117     return p;
 118 }
 119 
 120 inline int os::closedir(DIR *dirp) {
 121   assert(dirp != NULL, "argument is NULL");
 122   return ::closedir(dirp);
 123 }
 124 
 125 // macros for restartable system calls
 126 
 127 #define RESTARTABLE(_cmd, _result) do { \
 128     _result = _cmd; \
 129   } while(((int)_result == OS_ERR) && (errno == EINTR))
 130 
 131 #define RESTARTABLE_RETURN_INT(_cmd) do { \
 132   int _result; \
 133   RESTARTABLE(_cmd, _result); \
 134   return _result; \
 135 } while(false)
 136 
 137 inline bool os::numa_has_static_binding()   { return true; }
 138 inline bool os::numa_has_group_homing()     { return false;  }
 139 
 140 inline size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) {
 141   size_t res;
 142   RESTARTABLE( (size_t) ::read(fd, buf, (size_t) nBytes), res);




  60 #endif
  61 }
  62 
  63 
  64 // On Bsd, reservations are made on a page by page basis, nothing to do.
  65 inline void os::pd_split_reserved_memory(char *base, size_t size,
  66                                       size_t split, bool realloc) {
  67 }
  68 
  69 
  70 // Bang the shadow pages if they need to be touched to be mapped.
  71 inline void os::map_stack_shadow_pages(address sp) {
  72 }
  73 
  74 inline void os::dll_unload(void *lib) {
  75   ::dlclose(lib);
  76 }
  77 
  78 inline const int os::default_file_open_flags() { return 0;}
  79 











  80 inline jlong os::lseek(int fd, jlong offset, int whence) {
  81   return (jlong) ::lseek(fd, offset, whence);
  82 }
  83 
  84 inline int os::fsync(int fd) {
  85   return ::fsync(fd);
  86 }
  87 
  88 inline int os::ftruncate(int fd, jlong length) {
  89   return ::ftruncate(fd, length);






















  90 }
  91 
  92 // macros for restartable system calls
  93 
  94 #define RESTARTABLE(_cmd, _result) do { \
  95     _result = _cmd; \
  96   } while(((int)_result == OS_ERR) && (errno == EINTR))
  97 
  98 #define RESTARTABLE_RETURN_INT(_cmd) do { \
  99   int _result; \
 100   RESTARTABLE(_cmd, _result); \
 101   return _result; \
 102 } while(false)
 103 
 104 inline bool os::numa_has_static_binding()   { return true; }
 105 inline bool os::numa_has_group_homing()     { return false;  }
 106 
 107 inline size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) {
 108   size_t res;
 109   RESTARTABLE( (size_t) ::read(fd, buf, (size_t) nBytes), res);


< prev index next >