17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef OS_BSD_VM_OS_BSD_INLINE_HPP
26 #define OS_BSD_VM_OS_BSD_INLINE_HPP
27
28 #include "runtime/os.hpp"
29
30 // System includes
31
32 #include <unistd.h>
33 #include <sys/socket.h>
34 #include <poll.h>
35 #include <netdb.h>
36
37 // File names are case-insensitive on windows only
38 inline int os::file_name_strncmp(const char* s1, const char* s2, size_t num) {
39 return strncmp(s1, s2, num);
40 }
41
42 inline bool os::obsolete_option(const JavaVMOption *option) {
43 return false;
44 }
45
46 inline bool os::uses_stack_guard_pages() {
47 return true;
48 }
49
50 inline bool os::must_commit_stack_guard_pages() {
51 assert(uses_stack_guard_pages(), "sanity check");
52 #if !defined(__FreeBSD__) || __FreeBSD__ < 5
53 // Since FreeBSD 4 uses malloc() for allocating the thread stack
54 // there is no need to do anything extra to allocate the guard pages
55 return false;
56 #else
57 // FreeBSD 5+ uses mmap MAP_STACK for allocating the thread stacks.
58 // Must 'allocate' them or guard pages are ignored.
59 return true;
60 #endif
61 }
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef OS_BSD_VM_OS_BSD_INLINE_HPP
26 #define OS_BSD_VM_OS_BSD_INLINE_HPP
27
28 #include "runtime/os.hpp"
29
30 // System includes
31
32 #include <unistd.h>
33 #include <sys/socket.h>
34 #include <poll.h>
35 #include <netdb.h>
36
37 #ifdef __APPLE__
38
39 #include <stdlib.h>
40
41 inline int os::file_name_strncmp(const char* s1, const char* s2, size_t num) {
42 // Fast path, most of the time the file paths are the same
43 int result = strncmp(s1, s2, num);
44 if (result != 0) {
45 // Slow path, we will have to access the filesystem
46 // to resolve both paths, and then compare them
47 char resolved1[PATH_MAX] = {'\0'};
48 realpath(s1, resolved1);
49 char path2[PATH_MAX] = {'\0'};
50 strncpy(path2, s2, num);
51 char resolved2[PATH_MAX] = {'\0'};
52 realpath(path2, resolved2);
53 result = strcmp(resolved1, resolved2);
54 }
55 return result;
56 }
57
58 #else
59
60 inline int os::file_name_strncmp(const char* s1, const char* s2, size_t num) {
61 return strncmp(s1, s2, num);
62 }
63
64 #endif // __APPLE__
65
66 inline bool os::obsolete_option(const JavaVMOption *option) {
67 return false;
68 }
69
70 inline bool os::uses_stack_guard_pages() {
71 return true;
72 }
73
74 inline bool os::must_commit_stack_guard_pages() {
75 assert(uses_stack_guard_pages(), "sanity check");
76 #if !defined(__FreeBSD__) || __FreeBSD__ < 5
77 // Since FreeBSD 4 uses malloc() for allocating the thread stack
78 // there is no need to do anything extra to allocate the guard pages
79 return false;
80 #else
81 // FreeBSD 5+ uses mmap MAP_STACK for allocating the thread stacks.
82 // Must 'allocate' them or guard pages are ignored.
83 return true;
84 #endif
85 }
|