Wed, 02 Oct 2013 20:58:44 +0400
8025283: Nits in os_bsd file breaks compilation of open hotspot
Summary: Couple of nits in os_bsd.cpp brake compilation of open hotspot on non-apple platforms
Reviewed-by: sla, sspitsyn
src/os/bsd/vm/os_bsd.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/os/bsd/vm/os_bsd.cpp Tue Oct 01 15:41:39 2013 -0400 1.2 +++ b/src/os/bsd/vm/os_bsd.cpp Wed Oct 02 20:58:44 2013 +0400 1.3 @@ -100,6 +100,7 @@ 1.4 # include <stdint.h> 1.5 # include <inttypes.h> 1.6 # include <sys/ioctl.h> 1.7 +# include <sys/syscall.h> 1.8 1.9 #if defined(__FreeBSD__) || defined(__NetBSD__) 1.10 # include <elf.h> 1.11 @@ -152,6 +153,7 @@ 1.12 // utility functions 1.13 1.14 static int SR_initialize(); 1.15 +static void unpackTime(timespec* absTime, bool isAbsolute, jlong time); 1.16 1.17 julong os::available_memory() { 1.18 return Bsd::available_memory(); 1.19 @@ -247,7 +249,17 @@ 1.20 * since it returns a 64 bit value) 1.21 */ 1.22 mib[0] = CTL_HW; 1.23 + 1.24 +#if defined (HW_MEMSIZE) // Apple 1.25 mib[1] = HW_MEMSIZE; 1.26 +#elif defined(HW_PHYSMEM) // Most of BSD 1.27 + mib[1] = HW_PHYSMEM; 1.28 +#elif defined(HW_REALMEM) // Old FreeBSD 1.29 + mib[1] = HW_REALMEM; 1.30 +#else 1.31 + #error No ways to get physmem 1.32 +#endif 1.33 + 1.34 len = sizeof(mem_val); 1.35 if (sysctl(mib, 2, &mem_val, &len, NULL, 0) != -1) { 1.36 assert(len == sizeof(mem_val), "unexpected data size"); 1.37 @@ -1904,7 +1916,7 @@ 1.38 bool timedwait(unsigned int sec, int nsec); 1.39 private: 1.40 jlong currenttime() const; 1.41 - semaphore_t _semaphore; 1.42 + os_semaphore_t _semaphore; 1.43 }; 1.44 1.45 Semaphore::Semaphore() : _semaphore(0) { 1.46 @@ -1972,7 +1984,7 @@ 1.47 1.48 bool Semaphore::timedwait(unsigned int sec, int nsec) { 1.49 struct timespec ts; 1.50 - jlong endtime = unpackTime(&ts, false, (sec * NANOSECS_PER_SEC) + nsec); 1.51 + unpackTime(&ts, false, (sec * NANOSECS_PER_SEC) + nsec); 1.52 1.53 while (1) { 1.54 int result = sem_timedwait(&_semaphore, &ts);