comparison src/os/posix/vm/os_posix.cpp @ 14412:e2722a66aba7

Merge
author kvn
date Thu, 05 Sep 2013 11:04:39 -0700
parents bdd155477289 f92b82d454fa
children 2b8e28fdf503
comparison
equal deleted inserted replaced
14411:bdd155477289 14412:e2722a66aba7
1 /* 1 /*
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
163 getrlimit(RLIMIT_CORE, &rlim); 163 getrlimit(RLIMIT_CORE, &rlim);
164 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); 164 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
165 else st->print("%uk", rlim.rlim_cur >> 10); 165 else st->print("%uk", rlim.rlim_cur >> 10);
166 166
167 // Isn't there on solaris 167 // Isn't there on solaris
168 #if! defined(TARGET_OS_FAMILY_solaris) && !defined(TARGET_OS_FAMILY_aix) 168 #if !defined(TARGET_OS_FAMILY_solaris) && !defined(TARGET_OS_FAMILY_aix)
169 st->print(", NPROC "); 169 st->print(", NPROC ");
170 getrlimit(RLIMIT_NPROC, &rlim); 170 getrlimit(RLIMIT_NPROC, &rlim);
171 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); 171 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
172 else st->print("%d", rlim.rlim_cur); 172 else st->print("%d", rlim.rlim_cur);
173 #endif 173 #endif
266 266
267 FILE* os::open(int fd, const char* mode) { 267 FILE* os::open(int fd, const char* mode) {
268 return ::fdopen(fd, mode); 268 return ::fdopen(fd, mode);
269 } 269 }
270 270
271 void* os::get_default_process_handle() {
272 return (void*)::dlopen(NULL, RTLD_LAZY);
273 }
274
275 // Builds a platform dependent Agent_OnLoad_<lib_name> function name
276 // which is used to find statically linked in agents.
277 // Parameters:
278 // sym_name: Symbol in library we are looking for
279 // lib_name: Name of library to look in, NULL for shared libs.
280 // is_absolute_path == true if lib_name is absolute path to agent
281 // such as "/a/b/libL.so"
282 // == false if only the base name of the library is passed in
283 // such as "L"
284 char* os::build_agent_function_name(const char *sym_name, const char *lib_name,
285 bool is_absolute_path) {
286 char *agent_entry_name;
287 size_t len;
288 size_t name_len;
289 size_t prefix_len = strlen(JNI_LIB_PREFIX);
290 size_t suffix_len = strlen(JNI_LIB_SUFFIX);
291 const char *start;
292
293 if (lib_name != NULL) {
294 len = name_len = strlen(lib_name);
295 if (is_absolute_path) {
296 // Need to strip path, prefix and suffix
297 if ((start = strrchr(lib_name, *os::file_separator())) != NULL) {
298 lib_name = ++start;
299 }
300 if (len <= (prefix_len + suffix_len)) {
301 return NULL;
302 }
303 lib_name += prefix_len;
304 name_len = strlen(lib_name) - suffix_len;
305 }
306 }
307 len = (lib_name != NULL ? name_len : 0) + strlen(sym_name) + 2;
308 agent_entry_name = NEW_C_HEAP_ARRAY_RETURN_NULL(char, len, mtThread);
309 if (agent_entry_name == NULL) {
310 return NULL;
311 }
312 strcpy(agent_entry_name, sym_name);
313 if (lib_name != NULL) {
314 strcat(agent_entry_name, "_");
315 strncat(agent_entry_name, lib_name, name_len);
316 }
317 return agent_entry_name;
318 }
271 319
272 // Returned string is a constant. For unknown signals "UNKNOWN" is returned. 320 // Returned string is a constant. For unknown signals "UNKNOWN" is returned.
273 const char* os::Posix::get_signal_name(int sig, char* out, size_t outlen) { 321 const char* os::Posix::get_signal_name(int sig, char* out, size_t outlen) {
274 322
275 static const struct { 323 static const struct {