1 /* |
1 /* |
2 * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright 2012, 2013 SAP AG. All rights reserved. |
3 * Copyright 2012, 2015 SAP AG. All rights reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * |
5 * |
6 * This code is free software; you can redistribute it and/or modify it |
6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as |
7 * under the terms of the GNU General Public License version 2 only, as |
8 * published by the Free Software Foundation. |
8 * published by the Free Software Foundation. |
38 |
38 |
39 inline void* os::thread_local_storage_at(int index) { |
39 inline void* os::thread_local_storage_at(int index) { |
40 return pthread_getspecific((pthread_key_t)index); |
40 return pthread_getspecific((pthread_key_t)index); |
41 } |
41 } |
42 |
42 |
43 // File names are case-sensitive on windows only |
43 // File names are case-sensitive on windows only. |
44 inline int os::file_name_strcmp(const char* s1, const char* s2) { |
44 inline int os::file_name_strcmp(const char* s1, const char* s2) { |
45 return strcmp(s1, s2); |
45 return strcmp(s1, s2); |
46 } |
46 } |
47 |
47 |
48 inline bool os::obsolete_option(const JavaVMOption *option) { |
48 inline bool os::obsolete_option(const JavaVMOption *option) { |
51 |
51 |
52 inline bool os::uses_stack_guard_pages() { |
52 inline bool os::uses_stack_guard_pages() { |
53 return true; |
53 return true; |
54 } |
54 } |
55 |
55 |
|
56 // Whether or not calling code should/can commit/uncommit stack pages |
|
57 // before guarding them. Answer for AIX is definitly no, because memory |
|
58 // is automatically committed on touch. |
56 inline bool os::allocate_stack_guard_pages() { |
59 inline bool os::allocate_stack_guard_pages() { |
57 assert(uses_stack_guard_pages(), "sanity check"); |
60 assert(uses_stack_guard_pages(), "sanity check"); |
58 return true; |
61 return false; |
59 } |
62 } |
60 |
|
61 |
63 |
62 // On Aix, reservations are made on a page by page basis, nothing to do. |
64 // On Aix, reservations are made on a page by page basis, nothing to do. |
63 inline void os::pd_split_reserved_memory(char *base, size_t size, |
65 inline void os::pd_split_reserved_memory(char *base, size_t size, |
64 size_t split, bool realloc) { |
66 size_t split, bool realloc) { |
65 } |
67 } |
66 |
|
67 |
68 |
68 // Bang the shadow pages if they need to be touched to be mapped. |
69 // Bang the shadow pages if they need to be touched to be mapped. |
69 inline void os::bang_stack_shadow_pages() { |
70 inline void os::bang_stack_shadow_pages() { |
70 } |
71 } |
71 |
72 |
73 ::dlclose(lib); |
74 ::dlclose(lib); |
74 } |
75 } |
75 |
76 |
76 inline const int os::default_file_open_flags() { return 0;} |
77 inline const int os::default_file_open_flags() { return 0;} |
77 |
78 |
78 inline DIR* os::opendir(const char* dirname) |
79 inline DIR* os::opendir(const char* dirname) { |
79 { |
|
80 assert(dirname != NULL, "just checking"); |
80 assert(dirname != NULL, "just checking"); |
81 return ::opendir(dirname); |
81 return ::opendir(dirname); |
82 } |
82 } |
83 |
83 |
84 inline int os::readdir_buf_size(const char *path) |
84 inline int os::readdir_buf_size(const char *path) { |
85 { |
85 // According to aix sys/limits, NAME_MAX must be retrieved at runtime. |
86 // according to aix sys/limits, NAME_MAX must be retrieved at runtime. */ |
|
87 const long my_NAME_MAX = pathconf(path, _PC_NAME_MAX); |
86 const long my_NAME_MAX = pathconf(path, _PC_NAME_MAX); |
88 return my_NAME_MAX + sizeof(dirent) + 1; |
87 return my_NAME_MAX + sizeof(dirent) + 1; |
89 } |
88 } |
90 |
89 |
91 inline jlong os::lseek(int fd, jlong offset, int whence) { |
90 inline jlong os::lseek(int fd, jlong offset, int whence) { |
102 |
101 |
103 inline int os::ftruncate(int fd, jlong length) { |
102 inline int os::ftruncate(int fd, jlong length) { |
104 return ::ftruncate64(fd, length); |
103 return ::ftruncate64(fd, length); |
105 } |
104 } |
106 |
105 |
107 inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf) |
106 inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf) { |
108 { |
|
109 dirent* p; |
107 dirent* p; |
110 int status; |
108 int status; |
111 assert(dirp != NULL, "just checking"); |
109 assert(dirp != NULL, "just checking"); |
112 |
110 |
113 // NOTE: Linux readdir_r (on RH 6.2 and 7.2 at least) is NOT like the POSIX |
111 // NOTE: Linux readdir_r (on RH 6.2 and 7.2 at least) is NOT like the POSIX |
172 |
170 |
173 inline int os::send(int fd, char* buf, size_t nBytes, uint flags) { |
171 inline int os::send(int fd, char* buf, size_t nBytes, uint flags) { |
174 RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags)); |
172 RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags)); |
175 } |
173 } |
176 |
174 |
177 inline int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) { |
175 inline int os::raw_send(int fd, char *buf, size_t nBytes, uint flags) { |
178 return os::send(fd, buf, nBytes, flags); |
176 return os::send(fd, buf, nBytes, flags); |
179 } |
177 } |
180 |
178 |
181 inline int os::connect(int fd, struct sockaddr* him, socklen_t len) { |
179 inline int os::connect(int fd, struct sockaddr *him, socklen_t len) { |
182 RESTARTABLE_RETURN_INT(::connect(fd, him, len)); |
180 RESTARTABLE_RETURN_INT(::connect(fd, him, len)); |
183 } |
181 } |
184 |
182 |
185 inline struct hostent* os::get_host_by_name(char* name) { |
183 inline struct hostent* os::get_host_by_name(char* name) { |
186 return ::gethostbyname(name); |
184 return ::gethostbyname(name); |