Changeset 309 for trunk/openjdk/hotspot/src/os/linux
- Timestamp:
- Feb 13, 2012, 10:07:12 PM (14 years ago)
- Location:
- trunk/openjdk
- Files:
-
- 6 deleted
- 24 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/openjdk
- Property svn:mergeinfo changed
/branches/vendor/oracle/openjdk6/b24 (added) merged: 308 /branches/vendor/oracle/openjdk6/current merged: 307
- Property svn:mergeinfo changed
-
trunk/openjdk/hotspot/src/os/linux/vm/attachListener_linux.cpp
r278 r309 1 1 /* 2 * Copyright (c) 2005, 20 08, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 23 23 */ 24 24 25 # include "incls/_precompiled.incl" 26 # include "incls/_attachListener_linux.cpp.incl" 25 #include "precompiled.hpp" 26 #include "runtime/interfaceSupport.hpp" 27 #include "runtime/os.hpp" 28 #include "services/attachListener.hpp" 29 #include "services/dtraceAttacher.hpp" 27 30 28 31 #include <unistd.h> … … 177 180 int n = snprintf(path, UNIX_PATH_MAX, "%s/.java_pid%d", 178 181 os::get_temp_directory(), os::current_process_id()); 179 if (n < =(int)UNIX_PATH_MAX) {182 if (n < (int)UNIX_PATH_MAX) { 180 183 n = snprintf(initial_path, UNIX_PATH_MAX, "%s.tmp", path); 181 184 } 182 if (n > (int)UNIX_PATH_MAX) {185 if (n >= (int)UNIX_PATH_MAX) { 183 186 return -1; 184 187 } -
trunk/openjdk/hotspot/src/os/linux/vm/c1_globals_linux.hpp
r278 r309 1 1 /* 2 * Copyright (c) 2000, 20 01, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 23 23 */ 24 24 25 #ifndef OS_LINUX_VM_C1_GLOBALS_LINUX_HPP 26 #define OS_LINUX_VM_C1_GLOBALS_LINUX_HPP 27 28 #include "utilities/globalDefinitions.hpp" 29 #include "utilities/macros.hpp" 30 25 31 // 26 32 // Sets the default values for operating system dependent flags used by the 27 33 // client compiler. (see c1_globals.hpp) 28 34 // 35 36 #endif // OS_LINUX_VM_C1_GLOBALS_LINUX_HPP -
trunk/openjdk/hotspot/src/os/linux/vm/c2_globals_linux.hpp
r278 r309 1 1 /* 2 * Copyright (c) 2000, 20 01, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 23 23 */ 24 24 25 #ifndef OS_LINUX_VM_C2_GLOBALS_LINUX_HPP 26 #define OS_LINUX_VM_C2_GLOBALS_LINUX_HPP 27 28 #include "utilities/globalDefinitions.hpp" 29 #include "utilities/macros.hpp" 30 25 31 // 26 32 // Sets the default values for operating system dependent flags used by the 27 33 // server compiler. (see c2_globals.hpp) 28 34 // 35 36 #endif // OS_LINUX_VM_C2_GLOBALS_LINUX_HPP -
trunk/openjdk/hotspot/src/os/linux/vm/chaitin_linux.cpp
r278 r309 1 1 /* 2 * Copyright (c) 1999, 20 01, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 23 23 */ 24 24 25 #include "incls/_precompiled.incl" 26 #include "incls/_chaitin_linux.cpp.incl" 25 #include "precompiled.hpp" 26 #include "opto/chaitin.hpp" 27 #include "opto/machnode.hpp" 27 28 28 29 void PhaseRegAlloc::pd_preallocate_hook() { -
trunk/openjdk/hotspot/src/os/linux/vm/dtraceJSDT_linux.cpp
r278 r309 1 1 /* 2 * Copyright (c) 1997, 20 08, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 23 23 */ 24 24 25 #include "incls/_precompiled.incl" 26 #include "incls/_dtraceJSDT_linux.cpp.incl" 25 #include "precompiled.hpp" 26 #include "classfile/javaClasses.hpp" 27 #include "code/codeBlob.hpp" 28 #include "memory/allocation.hpp" 29 #include "prims/jvm.h" 30 #include "runtime/dtraceJSDT.hpp" 31 #include "runtime/jniHandles.hpp" 32 #include "runtime/os.hpp" 33 #include "runtime/signature.hpp" 34 #include "utilities/globalDefinitions.hpp" 27 35 28 36 int DTraceJSDT::pd_activate( -
trunk/openjdk/hotspot/src/os/linux/vm/globals_linux.hpp
r278 r309 1 1 /* 2 * Copyright (c) 2005, 20 08, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 23 23 */ 24 24 25 #ifndef OS_LINUX_VM_GLOBALS_LINUX_HPP 26 #define OS_LINUX_VM_GLOBALS_LINUX_HPP 27 25 28 // 26 29 // Defines Linux specific flags. They are not available on other platforms. … … 43 46 define_pd_global(bool, UseOSErrorReporting, false); 44 47 define_pd_global(bool, UseThreadPriorities, true) ; 48 49 #endif // OS_LINUX_VM_GLOBALS_LINUX_HPP -
trunk/openjdk/hotspot/src/os/linux/vm/interfaceSupport_linux.hpp
r278 r309 1 1 /* 2 * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 23 23 */ 24 24 25 #ifndef OS_LINUX_VM_INTERFACESUPPORT_LINUX_HPP 26 #define OS_LINUX_VM_INTERFACESUPPORT_LINUX_HPP 27 25 28 // Contains inlined functions for class InterfaceSupport 26 29 … … 28 31 os::write_memory_serialize_page(thread); 29 32 } 33 34 #endif // OS_LINUX_VM_INTERFACESUPPORT_LINUX_HPP -
trunk/openjdk/hotspot/src/os/linux/vm/jsig.c
r278 r309 1 1 /* 2 * Copyright (c) 2001, 20 06, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * -
trunk/openjdk/hotspot/src/os/linux/vm/jvm_linux.cpp
r278 r309 1 1 /* 2 * Copyright (c) 1999, 20 07, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 23 23 */ 24 24 25 #include "incls/_precompiled.incl" 26 #include "incls/_jvm_linux.cpp.incl" 25 #include "precompiled.hpp" 26 #include "prims/jvm.h" 27 #include "runtime/interfaceSupport.hpp" 28 #include "runtime/osThread.hpp" 27 29 28 30 #include <signal.h> -
trunk/openjdk/hotspot/src/os/linux/vm/jvm_linux.h
r278 r309 1 1 /* 2 * Copyright (c) 1999, 20 05, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 22 22 * 23 23 */ 24 25 #ifndef OS_LINUX_VM_JVM_LINUX_H 26 #define OS_LINUX_VM_JVM_LINUX_H 24 27 25 28 /* … … 96 99 // jvm_solaris.h 1.6 99/06/22 16:38:47 97 100 // End 101 102 #endif // OS_LINUX_VM_JVM_LINUX_H -
trunk/openjdk/hotspot/src/os/linux/vm/mutex_linux.cpp
r278 r309 1 1 /* 2 * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 23 23 */ 24 24 25 # include "incls/_precompiled.incl" 26 # include "incls/_mutex_linux.cpp.incl" 25 #include "precompiled.hpp" 26 #include "mutex_linux.inline.hpp" 27 #include "runtime/interfaceSupport.hpp" 28 #include "runtime/mutex.hpp" 29 #include "thread_linux.inline.hpp" 30 #include "utilities/events.hpp" 27 31 28 32 // put OS-includes here -
trunk/openjdk/hotspot/src/os/linux/vm/mutex_linux.inline.hpp
r278 r309 1 1 /* 2 * Copyright (c) 1999, 20 02, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 23 23 */ 24 24 25 #ifndef OS_LINUX_VM_MUTEX_LINUX_INLINE_HPP 26 #define OS_LINUX_VM_MUTEX_LINUX_INLINE_HPP 27 28 #include "os_linux.inline.hpp" 29 #include "runtime/interfaceSupport.hpp" 30 #include "thread_linux.inline.hpp" 31 25 32 26 33 // Reconciliation History 27 34 // mutex_solaris.inline.hpp 1.5 99/06/22 16:38:49 28 35 // End 36 37 #endif // OS_LINUX_VM_MUTEX_LINUX_INLINE_HPP -
trunk/openjdk/hotspot/src/os/linux/vm/osThread_linux.cpp
r278 r309 1 1 /* 2 * Copyright (c) 1999, 20 04, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 23 23 */ 24 24 25 // do not include precompiled header file 26 # include "incls/_osThread_linux.cpp.incl" 25 // no precompiled headers 26 #include "runtime/atomic.hpp" 27 #include "runtime/handles.inline.hpp" 28 #include "runtime/mutexLocker.hpp" 29 #include "runtime/os.hpp" 30 #include "runtime/osThread.hpp" 31 #include "runtime/safepoint.hpp" 32 #include "runtime/vmThread.hpp" 33 #ifdef TARGET_ARCH_x86 34 # include "assembler_x86.inline.hpp" 35 #endif 36 #ifdef TARGET_ARCH_sparc 37 # include "assembler_sparc.inline.hpp" 38 #endif 39 #ifdef TARGET_ARCH_zero 40 # include "assembler_zero.inline.hpp" 41 #endif 27 42 28 43 -
trunk/openjdk/hotspot/src/os/linux/vm/osThread_linux.hpp
r278 r309 1 1 /* 2 * Copyright (c) 1999, 20 04, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 22 22 * 23 23 */ 24 25 #ifndef OS_LINUX_VM_OSTHREAD_LINUX_HPP 26 #define OS_LINUX_VM_OSTHREAD_LINUX_HPP 24 27 25 28 private: … … 140 143 // osThread_solaris.hpp 1.24 99/08/27 13:11:54 141 144 // End 145 146 #endif // OS_LINUX_VM_OSTHREAD_LINUX_HPP -
trunk/openjdk/hotspot/src/os/linux/vm/os_linux.cpp
r278 r309 1 1 /* 2 * Copyright (c) 1999, 20 09, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 25 25 # define __STDC_FORMAT_MACROS 26 26 27 // do not include precompiled header file 28 # include "incls/_os_linux.cpp.incl" 27 // no precompiled headers 28 #include "classfile/classLoader.hpp" 29 #include "classfile/systemDictionary.hpp" 30 #include "classfile/vmSymbols.hpp" 31 #include "code/icBuffer.hpp" 32 #include "code/vtableStubs.hpp" 33 #include "compiler/compileBroker.hpp" 34 #include "interpreter/interpreter.hpp" 35 #include "jvm_linux.h" 36 #include "memory/allocation.inline.hpp" 37 #include "memory/filemap.hpp" 38 #include "mutex_linux.inline.hpp" 39 #include "oops/oop.inline.hpp" 40 #include "os_share_linux.hpp" 41 #include "prims/jniFastGetField.hpp" 42 #include "prims/jvm.h" 43 #include "prims/jvm_misc.hpp" 44 #include "runtime/arguments.hpp" 45 #include "runtime/extendedPC.hpp" 46 #include "runtime/globals.hpp" 47 #include "runtime/interfaceSupport.hpp" 48 #include "runtime/java.hpp" 49 #include "runtime/javaCalls.hpp" 50 #include "runtime/mutexLocker.hpp" 51 #include "runtime/objectMonitor.hpp" 52 #include "runtime/osThread.hpp" 53 #include "runtime/perfMemory.hpp" 54 #include "runtime/sharedRuntime.hpp" 55 #include "runtime/statSampler.hpp" 56 #include "runtime/stubRoutines.hpp" 57 #include "runtime/threadCritical.hpp" 58 #include "runtime/timer.hpp" 59 #include "services/attachListener.hpp" 60 #include "services/runtimeService.hpp" 61 #include "thread_linux.inline.hpp" 62 #include "utilities/decoder.hpp" 63 #include "utilities/defaultStream.hpp" 64 #include "utilities/events.hpp" 65 #include "utilities/growableArray.hpp" 66 #include "utilities/vmError.hpp" 67 #ifdef TARGET_ARCH_x86 68 # include "assembler_x86.inline.hpp" 69 # include "nativeInst_x86.hpp" 70 #endif 71 #ifdef TARGET_ARCH_sparc 72 # include "assembler_sparc.inline.hpp" 73 # include "nativeInst_sparc.hpp" 74 #endif 75 #ifdef TARGET_ARCH_zero 76 # include "assembler_zero.inline.hpp" 77 # include "nativeInst_zero.hpp" 78 #endif 79 #ifdef COMPILER1 80 #include "c1/c1_Runtime1.hpp" 81 #endif 82 #ifdef COMPILER2 83 #include "opto/runtime.hpp" 84 #endif 29 85 30 86 // put OS-includes here … … 60 116 # include <stdint.h> 61 117 # include <inttypes.h> 118 # include <sys/ioctl.h> 62 119 63 120 #define MAX_PATH (2 * K) … … 828 885 switch (thr_type) { 829 886 case os::java_thread: 830 // Java threads use ThreadStackSize which default value can be changed with the flag -Xss 831 if (JavaThread::stack_size_at_create() > 0) stack_size = JavaThread::stack_size_at_create(); 887 // Java threads use ThreadStackSize which default value can be 888 // changed with the flag -Xss 889 assert (JavaThread::stack_size_at_create() > 0, "this should be set"); 890 stack_size = JavaThread::stack_size_at_create(); 832 891 break; 833 892 case os::compiler_thread: … … 1508 1567 void os::set_error_file(const char *logfile) {} 1509 1568 1569 1570 // This method is a copy of JDK's sysGetLastErrorString 1571 // from src/solaris/hpi/src/system_md.c 1572 1573 size_t os::lasterror(char *buf, size_t len) { 1574 1575 if (errno == 0) return 0; 1576 1577 const char *s = ::strerror(errno); 1578 size_t n = ::strlen(s); 1579 if (n >= len) { 1580 n = len - 1; 1581 } 1582 ::strncpy(buf, s, n); 1583 buf[n] = '\0'; 1584 return n; 1585 } 1586 1510 1587 intx os::current_thread_id() { return (intx)pthread_self(); } 1511 1588 int os::current_process_id() { … … 1613 1690 1614 1691 if (dladdr((void*)addr, &dlinfo) && dlinfo.dli_sname != NULL) { 1615 if (buf) jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname); 1616 if (offset) *offset = addr - (address)dlinfo.dli_saddr; 1692 if (buf != NULL) { 1693 if(!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { 1694 jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname); 1695 } 1696 } 1697 if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; 1617 1698 return true; 1618 } else { 1619 if (buf) buf[0] = '\0'; 1620 if (offset) *offset = -1; 1621 return false; 1622 } 1699 } else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) { 1700 if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), 1701 dlinfo.dli_fname, buf, buflen, offset) == Decoder::no_error) { 1702 return true; 1703 } 1704 } 1705 1706 if (buf != NULL) buf[0] = '\0'; 1707 if (offset != NULL) *offset = -1; 1708 return false; 1623 1709 } 1624 1710 … … 1871 1957 1872 1958 1873 bool _print_ascii_file(const char* filename, outputStream* st) {1874 int fd = open(filename, O_RDONLY);1959 static bool _print_ascii_file(const char* filename, outputStream* st) { 1960 int fd = ::open(filename, O_RDONLY); 1875 1961 if (fd == -1) { 1876 1962 return false; … … 1879 1965 char buf[32]; 1880 1966 int bytes; 1881 while ((bytes = read(fd, buf, sizeof(buf))) > 0) {1967 while ((bytes = ::read(fd, buf, sizeof(buf))) > 0) { 1882 1968 st->print_raw(buf, bytes); 1883 1969 } 1884 1970 1885 close(fd);1971 ::close(fd); 1886 1972 1887 1973 return true; … … 2161 2247 // "libjvm"debug_only("_g")".so" since for fastdebug version 2162 2248 // we should have "libjvm.so" but debug_only("_g") adds "_g"! 2163 // It is used when we are choosing the HPI library's name2164 // "libhpi[_g].so" in hpi::initialize_get_interface().2165 2249 len = strlen(buf); 2166 2250 snprintf(buf + len, buflen-len, "/hotspot/libjvm%s.so", p); … … 2346 2430 unlink(buf); 2347 2431 2348 int fd = open(buf, O_CREAT | O_RDWR, S_IRWXU);2432 int fd = ::open(buf, O_CREAT | O_RDWR, S_IRWXU); 2349 2433 2350 2434 if (fd != -1) { 2351 off_t rv = lseek(fd, size-2, SEEK_SET);2435 off_t rv = ::lseek(fd, size-2, SEEK_SET); 2352 2436 if (rv != (off_t)-1) { 2353 if ( write(fd, "", 1) == 1) {2437 if (::write(fd, "", 1) == 1) { 2354 2438 mmap(base, size, 2355 2439 PROT_READ|PROT_WRITE|PROT_EXEC, … … 2357 2441 } 2358 2442 } 2359 close(fd);2443 ::close(fd); 2360 2444 unlink(buf); 2361 2445 } … … 3922 4006 Linux::install_signal_handlers(); 3923 4007 4008 // Check minimum allowable stack size for thread creation and to initialize 4009 // the java system classes, including StackOverflowError - depends on page 4010 // size. Add a page for compiler2 recursion in main thread. 4011 // Add in 2*BytesPerWord times page size to account for VM stack during 4012 // class initialization depending on 32 or 64 bit VM. 4013 os::Linux::min_stack_allowed = MAX2(os::Linux::min_stack_allowed, 4014 (size_t)(StackYellowPages+StackRedPages+StackShadowPages+ 4015 2*BytesPerWord COMPILER2_PRESENT(+1)) * Linux::page_size()); 4016 3924 4017 size_t threadStackSizeInBytes = ThreadStackSize * K; 3925 4018 if (threadStackSizeInBytes != 0 && 3926 threadStackSizeInBytes < Linux::min_stack_allowed) {4019 threadStackSizeInBytes < os::Linux::min_stack_allowed) { 3927 4020 tty->print_cr("\nThe stack size specified is too small, " 3928 4021 "Specify at least %dk", 3929 Linux::min_stack_allowed/ K);4022 os::Linux::min_stack_allowed/ K); 3930 4023 return JNI_ERR; 3931 4024 } … … 3979 4072 // Initialize lock used to serialize thread creation (see os::create_thread) 3980 4073 Linux::set_createThread_lock(new Mutex(Mutex::leaf, "createThread_lock", false)); 3981 3982 // Initialize HPI.3983 jint hpi_result = hpi::initialize();3984 if (hpi_result != JNI_OK) {3985 tty->print_cr("There was an error trying to initialize the HPI library.");3986 return hpi_result;3987 }3988 4074 3989 4075 // at-exit methods are called in the reverse order of their registration. … … 4184 4270 return -1; 4185 4271 } 4186 hpi::native_path(strcpy(pathbuf, path));4272 os::native_path(strcpy(pathbuf, path)); 4187 4273 return ::stat(pathbuf, sbuf); 4188 4274 } … … 4216 4302 } 4217 4303 4304 // This code originates from JDK's sysOpen and open64_w 4305 // from src/solaris/hpi/src/system_md.c 4306 4307 #ifndef O_DELETE 4308 #define O_DELETE 0x10000 4309 #endif 4310 4311 // Open a file. Unlink the file immediately after open returns 4312 // if the specified oflag has the O_DELETE flag set. 4313 // O_DELETE is used only in j2se/src/share/native/java/util/zip/ZipFile.c 4314 4315 int os::open(const char *path, int oflag, int mode) { 4316 4317 if (strlen(path) > MAX_PATH - 1) { 4318 errno = ENAMETOOLONG; 4319 return -1; 4320 } 4321 int fd; 4322 int o_delete = (oflag & O_DELETE); 4323 oflag = oflag & ~O_DELETE; 4324 4325 fd = ::open64(path, oflag, mode); 4326 if (fd == -1) return -1; 4327 4328 //If the open succeeded, the file might still be a directory 4329 { 4330 struct stat64 buf64; 4331 int ret = ::fstat64(fd, &buf64); 4332 int st_mode = buf64.st_mode; 4333 4334 if (ret != -1) { 4335 if ((st_mode & S_IFMT) == S_IFDIR) { 4336 errno = EISDIR; 4337 ::close(fd); 4338 return -1; 4339 } 4340 } else { 4341 ::close(fd); 4342 return -1; 4343 } 4344 } 4345 4346 /* 4347 * All file descriptors that are opened in the JVM and not 4348 * specifically destined for a subprocess should have the 4349 * close-on-exec flag set. If we don't set it, then careless 3rd 4350 * party native code might fork and exec without closing all 4351 * appropriate file descriptors (e.g. as we do in closeDescriptors in 4352 * UNIXProcess.c), and this in turn might: 4353 * 4354 * - cause end-of-file to fail to be detected on some file 4355 * descriptors, resulting in mysterious hangs, or 4356 * 4357 * - might cause an fopen in the subprocess to fail on a system 4358 * suffering from bug 1085341. 4359 * 4360 * (Yes, the default setting of the close-on-exec flag is a Unix 4361 * design flaw) 4362 * 4363 * See: 4364 * 1085341: 32-bit stdio routines should support file descriptors >255 4365 * 4843136: (process) pipe file descriptor from Runtime.exec not being closed 4366 * 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9 4367 */ 4368 #ifdef FD_CLOEXEC 4369 { 4370 int flags = ::fcntl(fd, F_GETFD); 4371 if (flags != -1) 4372 ::fcntl(fd, F_SETFD, flags | FD_CLOEXEC); 4373 } 4374 #endif 4375 4376 if (o_delete != 0) { 4377 ::unlink(path); 4378 } 4379 return fd; 4380 } 4381 4382 4218 4383 // create binary file, rewriting existing file if required 4219 4384 int os::create_binary_file(const char* path, bool rewrite_existing) { … … 4233 4398 jlong os::seek_to_file_offset(int fd, jlong offset) { 4234 4399 return (jlong)::lseek64(fd, (off64_t)offset, SEEK_SET); 4400 } 4401 4402 // This code originates from JDK's sysAvailable 4403 // from src/solaris/hpi/src/native_threads/src/sys_api_td.c 4404 4405 int os::available(int fd, jlong *bytes) { 4406 jlong cur, end; 4407 int mode; 4408 struct stat64 buf64; 4409 4410 if (::fstat64(fd, &buf64) >= 0) { 4411 mode = buf64.st_mode; 4412 if (S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) { 4413 /* 4414 * XXX: is the following call interruptible? If so, this might 4415 * need to go through the INTERRUPT_IO() wrapper as for other 4416 * blocking, interruptible calls in this file. 4417 */ 4418 int n; 4419 if (::ioctl(fd, FIONREAD, &n) >= 0) { 4420 *bytes = n; 4421 return 1; 4422 } 4423 } 4424 } 4425 if ((cur = ::lseek64(fd, 0L, SEEK_CUR)) == -1) { 4426 return 0; 4427 } else if ((end = ::lseek64(fd, 0L, SEEK_END)) == -1) { 4428 return 0; 4429 } else if (::lseek64(fd, cur, SEEK_SET) == -1) { 4430 return 0; 4431 } 4432 *bytes = end - cur; 4433 return 1; 4434 } 4435 4436 int os::socket_available(int fd, jint *pbytes) { 4437 // Linux doc says EINTR not returned, unlike Solaris 4438 int ret = ::ioctl(fd, FIONREAD, pbytes); 4439 4440 //%% note ioctl can return 0 when successful, JVM_SocketAvailable 4441 // is expected to return 0 on failure and 1 on success to the jdk. 4442 return (ret < 0) ? 0 : 1; 4235 4443 } 4236 4444 … … 4461 4669 if (fd != -1) { 4462 4670 struct stat buf; 4463 close(fd);4671 ::close(fd); 4464 4672 while (::stat(filename, &buf) == 0) { 4465 4673 (void)::poll(NULL, 0, 100); … … 4839 5047 // Next, demultiplex/decode time arguments 4840 5048 timespec absTime; 4841 if (time < 0 ) { // don't wait at all5049 if (time < 0 || (isAbsolute && time == 0) ) { // don't wait at all 4842 5050 return; 4843 5051 } -
trunk/openjdk/hotspot/src/os/linux/vm/os_linux.hpp
r278 r309 1 1 /* 2 * Copyright (c) 1999, 20 09, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 22 22 * 23 23 */ 24 25 #ifndef OS_LINUX_VM_OS_LINUX_HPP 26 #define OS_LINUX_VM_OS_LINUX_HPP 24 27 25 28 // Linux_OS defines the interface to Linux operating systems … … 329 332 } 330 333 } ; 334 335 #endif // OS_LINUX_VM_OS_LINUX_HPP -
trunk/openjdk/hotspot/src/os/linux/vm/os_linux.inline.hpp
r278 r309 1 1 /* 2 * Copyright (c) 1999, 20 08, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 23 23 */ 24 24 25 #ifndef OS_LINUX_VM_OS_LINUX_INLINE_HPP 26 #define OS_LINUX_VM_OS_LINUX_INLINE_HPP 27 28 #include "runtime/atomic.hpp" 29 #include "runtime/os.hpp" 30 #ifdef TARGET_OS_ARCH_linux_x86 31 # include "atomic_linux_x86.inline.hpp" 32 # include "orderAccess_linux_x86.inline.hpp" 33 #endif 34 #ifdef TARGET_OS_ARCH_linux_sparc 35 # include "atomic_linux_sparc.inline.hpp" 36 # include "orderAccess_linux_sparc.inline.hpp" 37 #endif 38 #ifdef TARGET_OS_ARCH_linux_zero 39 # include "atomic_linux_zero.inline.hpp" 40 # include "orderAccess_linux_zero.inline.hpp" 41 #endif 42 43 // System includes 44 45 #include <unistd.h> 46 #include <sys/socket.h> 47 #include <sys/poll.h> 48 #include <netdb.h> 49 25 50 inline void* os::thread_local_storage_at(int index) { 26 51 return pthread_getspecific((pthread_key_t)index); … … 75 100 inline void os::bang_stack_shadow_pages() { 76 101 } 102 103 inline void os::dll_unload(void *lib) { 104 ::dlclose(lib); 105 } 106 107 inline const int os::default_file_open_flags() { return 0;} 77 108 78 109 inline DIR* os::opendir(const char* dirname) … … 85 116 { 86 117 return NAME_MAX + sizeof(dirent) + 1; 118 } 119 120 inline jlong os::lseek(int fd, jlong offset, int whence) { 121 return (jlong) ::lseek64(fd, offset, whence); 122 } 123 124 inline int os::fsync(int fd) { 125 return ::fsync(fd); 126 } 127 128 inline char* os::native_path(char *path) { 129 return path; 130 } 131 132 inline int os::ftruncate(int fd, jlong length) { 133 return ::ftruncate64(fd, length); 87 134 } 88 135 … … 104 151 } 105 152 106 inline int os::closedir(DIR *dirp) 107 { 108 assert(dirp != NULL, "just checking"); 153 inline int os::closedir(DIR *dirp) { 154 assert(dirp != NULL, "argument is NULL"); 109 155 return ::closedir(dirp); 110 156 } … … 124 170 inline bool os::numa_has_static_binding() { return true; } 125 171 inline bool os::numa_has_group_homing() { return false; } 172 173 inline size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) { 174 size_t res; 175 RESTARTABLE( (size_t) ::read(fd, buf, (size_t) nBytes), res); 176 return res; 177 } 178 179 inline size_t os::write(int fd, const void *buf, unsigned int nBytes) { 180 size_t res; 181 RESTARTABLE((size_t) ::write(fd, buf, (size_t) nBytes), res); 182 return res; 183 } 184 185 inline int os::close(int fd) { 186 return ::close(fd); 187 } 188 189 inline int os::socket_close(int fd) { 190 return ::close(fd); 191 } 192 193 inline int os::socket(int domain, int type, int protocol) { 194 return ::socket(domain, type, protocol); 195 } 196 197 inline int os::recv(int fd, char *buf, int nBytes, int flags) { 198 RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, (unsigned int) flags)); 199 } 200 201 inline int os::send(int fd, char *buf, int nBytes, int flags) { 202 RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, (unsigned int) flags)); 203 } 204 205 inline int os::raw_send(int fd, char *buf, int nBytes, int flags) { 206 return os::send(fd, buf, nBytes, flags); 207 } 208 209 inline int os::timeout(int fd, long timeout) { 210 julong prevtime,newtime; 211 struct timeval t; 212 213 gettimeofday(&t, NULL); 214 prevtime = ((julong)t.tv_sec * 1000) + t.tv_usec / 1000; 215 216 for(;;) { 217 struct pollfd pfd; 218 219 pfd.fd = fd; 220 pfd.events = POLLIN | POLLERR; 221 222 int res = ::poll(&pfd, 1, timeout); 223 224 if (res == OS_ERR && errno == EINTR) { 225 226 // On Linux any value < 0 means "forever" 227 228 if(timeout >= 0) { 229 gettimeofday(&t, NULL); 230 newtime = ((julong)t.tv_sec * 1000) + t.tv_usec / 1000; 231 timeout -= newtime - prevtime; 232 if(timeout <= 0) 233 return OS_OK; 234 prevtime = newtime; 235 } 236 } else 237 return res; 238 } 239 } 240 241 inline int os::listen(int fd, int count) { 242 return ::listen(fd, count); 243 } 244 245 inline int os::connect(int fd, struct sockaddr *him, int len) { 246 RESTARTABLE_RETURN_INT(::connect(fd, him, len)); 247 } 248 249 inline int os::accept(int fd, struct sockaddr *him, int *len) { 250 // This cast is from int to unsigned int on linux. Since we 251 // only pass the parameter "len" around the vm and don't try to 252 // fetch it's value, this cast is safe for now. The java.net group 253 // may need and want to change this interface someday if socklen_t goes 254 // to 64 bits on some platform that we support. 255 // Linux doc says this can't return EINTR, unlike accept() on Solaris 256 257 return ::accept(fd, him, (socklen_t *)len); 258 } 259 260 inline int os::recvfrom(int fd, char *buf, int nBytes, int flags, 261 sockaddr *from, int *fromlen) { 262 RESTARTABLE_RETURN_INT(::recvfrom(fd, buf, nBytes, (unsigned int) flags, from, (socklen_t *)fromlen)); 263 } 264 265 inline int os::sendto(int fd, char *buf, int len, int flags, 266 struct sockaddr *to, int tolen) { 267 RESTARTABLE_RETURN_INT(::sendto(fd, buf, len, (unsigned int) flags, to, tolen)); 268 } 269 270 inline int os::socket_shutdown(int fd, int howto){ 271 return ::shutdown(fd, howto); 272 } 273 274 inline int os::bind(int fd, struct sockaddr *him, int len){ 275 return ::bind(fd, him, len); 276 } 277 278 inline int os::get_sock_name(int fd, struct sockaddr *him, int *len){ 279 return ::getsockname(fd, him, (socklen_t *)len); 280 } 281 282 inline int os::get_host_name(char* name, int namelen){ 283 return ::gethostname(name, namelen); 284 } 285 286 inline struct hostent* os::get_host_by_name(char* name) { 287 return ::gethostbyname(name); 288 } 289 inline int os::get_sock_opt(int fd, int level, int optname, 290 char *optval, int* optlen){ 291 return ::getsockopt(fd, level, optname, optval, (socklen_t *)optlen); 292 } 293 294 inline int os::set_sock_opt(int fd, int level, int optname, 295 const char *optval, int optlen){ 296 return ::setsockopt(fd, level, optname, optval, optlen); 297 } 298 #endif // OS_LINUX_VM_OS_LINUX_INLINE_HPP -
trunk/openjdk/hotspot/src/os/linux/vm/os_share_linux.hpp
r278 r309 1 1 /* 2 * Copyright (c) 1999, 20 03, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 23 23 */ 24 24 25 #ifndef OS_LINUX_VM_OS_SHARE_LINUX_HPP 26 #define OS_LINUX_VM_OS_SHARE_LINUX_HPP 27 25 28 // misc 26 29 void signalHandler(int, siginfo_t*, ucontext_t*); … … 31 34 32 35 #define PROCFILE_LENGTH 128 36 37 #endif // OS_LINUX_VM_OS_SHARE_LINUX_HPP -
trunk/openjdk/hotspot/src/os/linux/vm/perfMemory_linux.cpp
r278 r309 1 1 /* 2 * Copyright (c) 2001, 20 06, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 23 23 */ 24 24 25 # include "incls/_precompiled.incl" 26 # include "incls/_perfMemory_linux.cpp.incl" 25 #include "precompiled.hpp" 26 #include "classfile/vmSymbols.hpp" 27 #include "memory/allocation.inline.hpp" 28 #include "memory/resourceArea.hpp" 29 #include "oops/oop.inline.hpp" 30 #include "os_linux.inline.hpp" 31 #include "runtime/handles.inline.hpp" 32 #include "runtime/perfMemory.hpp" 33 #include "utilities/exceptions.hpp" 27 34 28 35 // put OS-includes here … … 629 636 } 630 637 631 return fd; 638 // Verify that we have enough disk space for this file. 639 // We'll get random SIGBUS crashes on memory accesses if 640 // we don't. 641 642 for (size_t seekpos = 0; seekpos < size; seekpos += os::vm_page_size()) { 643 int zero_int = 0; 644 result = (int)os::seek_to_file_offset(fd, (jlong)(seekpos)); 645 if (result == -1 ) break; 646 RESTARTABLE(::write(fd, &zero_int, 1), result); 647 if (result != 1) { 648 if (errno == ENOSPC) { 649 warning("Insufficient space for shared memory file:\n %s\nTry using the -Djava.io.tmpdir= option to select an alternate temp location.\n", filename); 650 } 651 break; 652 } 653 } 654 655 if (result != -1) { 656 return fd; 657 } else { 658 RESTARTABLE(::close(fd), result); 659 return -1; 660 } 632 661 } 633 662 -
trunk/openjdk/hotspot/src/os/linux/vm/stubRoutines_linux.cpp
r278 r309 1 1 /* 2 * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 23 23 */ 24 24 25 #include "incls/_precompiled.incl" 26 #include "incls/_stubRoutines_linux.cpp.incl" 25 #include "precompiled.hpp" 26 #include "runtime/os.hpp" 27 #include "runtime/stubRoutines.hpp" 28 -
trunk/openjdk/hotspot/src/os/linux/vm/threadCritical_linux.cpp
r278 r309 1 1 /* 2 * Copyright (c) 2001, 20 06, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 23 23 */ 24 24 25 #include "incls/_precompiled.incl" 26 #include "incls/_threadCritical_linux.cpp.incl" 25 #include "precompiled.hpp" 26 #include "runtime/threadCritical.hpp" 27 #include "thread_linux.inline.hpp" 27 28 28 29 // put OS-includes here -
trunk/openjdk/hotspot/src/os/linux/vm/thread_linux.inline.hpp
r278 r309 1 1 /* 2 * Copyright (c) 2002, 20 03, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 23 23 */ 24 24 25 #ifndef OS_LINUX_VM_THREAD_LINUX_INLINE_HPP 26 #define OS_LINUX_VM_THREAD_LINUX_INLINE_HPP 27 28 #include "runtime/atomic.hpp" 29 #include "runtime/prefetch.hpp" 30 #include "runtime/thread.hpp" 31 #include "runtime/threadLocalStorage.hpp" 32 #ifdef TARGET_OS_ARCH_linux_x86 33 # include "atomic_linux_x86.inline.hpp" 34 # include "orderAccess_linux_x86.inline.hpp" 35 # include "prefetch_linux_x86.inline.hpp" 36 #endif 37 #ifdef TARGET_OS_ARCH_linux_sparc 38 # include "atomic_linux_sparc.inline.hpp" 39 # include "orderAccess_linux_sparc.inline.hpp" 40 # include "prefetch_linux_sparc.inline.hpp" 41 #endif 42 #ifdef TARGET_OS_ARCH_linux_zero 43 # include "atomic_linux_zero.inline.hpp" 44 # include "orderAccess_linux_zero.inline.hpp" 45 # include "prefetch_linux_zero.inline.hpp" 46 #endif 47 25 48 // Contains inlined functions for class Thread and ThreadLocalStorage 26 49 27 50 inline void ThreadLocalStorage::pd_invalidate_all() {} // nothing to do 51 52 #endif // OS_LINUX_VM_THREAD_LINUX_INLINE_HPP -
trunk/openjdk/hotspot/src/os/linux/vm/vmError_linux.cpp
r278 r309 1 1 /* 2 * Copyright (c) 2003, 20 06, Oracle and/or its affiliates. All rights reserved.2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 4 * … … 23 23 */ 24 24 25 # include "incls/_precompiled.incl" 26 # include "incls/_vmError_linux.cpp.incl" 25 #include "precompiled.hpp" 26 #include "runtime/arguments.hpp" 27 #include "runtime/os.hpp" 28 #include "runtime/thread.hpp" 29 #include "utilities/vmError.hpp" 27 30 28 31 #include <sys/types.h> … … 42 45 "\n\n" 43 46 "Do you want to debug the problem?\n\n" 44 "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " INTX_FORMAT " \n"47 "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " INTX_FORMAT " (" INTPTR_FORMAT ")\n" 45 48 "Enter 'yes' to launch gdb automatically (PATH must include gdb)\n" 46 49 "Otherwise, press RETURN to abort...", 47 50 os::current_process_id(), os::current_process_id(), 48 os::current_thread_id() );51 os::current_thread_id(), os::current_thread_id()); 49 52 50 53 yes = os::message_box("Unexpected Error", buf);
Note:
See TracChangeset
for help on using the changeset viewer.