Ignore:
Timestamp:
Feb 13, 2012, 10:07:12 PM (14 years ago)
Author:
dmik
Message:

trunk: Merged in openjdk6 b24 from branches/vendor/oracle.

Location:
trunk/openjdk
Files:
17 deleted
77 edited
11 copied

Legend:

Unmodified
Added
Removed
  • trunk/openjdk

  • trunk/openjdk/hotspot/src/os/linux/vm/attachListener_linux.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    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"
    2730
    2831#include <unistd.h>
     
    177180  int n = snprintf(path, UNIX_PATH_MAX, "%s/.java_pid%d",
    178181                   os::get_temp_directory(), os::current_process_id());
    179   if (n <= (int)UNIX_PATH_MAX) {
     182  if (n < (int)UNIX_PATH_MAX) {
    180183    n = snprintf(initial_path, UNIX_PATH_MAX, "%s.tmp", path);
    181184  }
    182   if (n > (int)UNIX_PATH_MAX) {
     185  if (n >= (int)UNIX_PATH_MAX) {
    183186    return -1;
    184187  }
  • trunk/openjdk/hotspot/src/os/linux/vm/c1_globals_linux.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     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
    2531//
    2632// Sets the default values for operating system dependent flags used by the
    2733// client compiler. (see c1_globals.hpp)
    2834//
     35
     36#endif // OS_LINUX_VM_C1_GLOBALS_LINUX_HPP
  • trunk/openjdk/hotspot/src/os/linux/vm/c2_globals_linux.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     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
    2531//
    2632// Sets the default values for operating system dependent flags used by the
    2733// server compiler. (see c2_globals.hpp)
    2834//
     35
     36#endif // OS_LINUX_VM_C2_GLOBALS_LINUX_HPP
  • trunk/openjdk/hotspot/src/os/linux/vm/chaitin_linux.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    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"
    2728
    2829void PhaseRegAlloc::pd_preallocate_hook() {
  • trunk/openjdk/hotspot/src/os/linux/vm/dtraceJSDT_linux.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    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"
    2735
    2836int DTraceJSDT::pd_activate(
  • trunk/openjdk/hotspot/src/os/linux/vm/globals_linux.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef OS_LINUX_VM_GLOBALS_LINUX_HPP
     26#define OS_LINUX_VM_GLOBALS_LINUX_HPP
     27
    2528//
    2629// Defines Linux specific flags. They are not available on other platforms.
     
    4346define_pd_global(bool, UseOSErrorReporting, false);
    4447define_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  
    11/*
    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.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef OS_LINUX_VM_INTERFACESUPPORT_LINUX_HPP
     26#define OS_LINUX_VM_INTERFACESUPPORT_LINUX_HPP
     27
    2528// Contains inlined functions for class InterfaceSupport
    2629
     
    2831  os::write_memory_serialize_page(thread);
    2932}
     33
     34#endif // OS_LINUX_VM_INTERFACESUPPORT_LINUX_HPP
  • trunk/openjdk/hotspot/src/os/linux/vm/jsig.c

    r278 r309  
    11/*
    2  * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/src/os/linux/vm/jvm_linux.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    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"
    2729
    2830#include <signal.h>
  • trunk/openjdk/hotspot/src/os/linux/vm/jvm_linux.h

    r278 r309  
    11/*
    2  * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef OS_LINUX_VM_JVM_LINUX_H
     26#define OS_LINUX_VM_JVM_LINUX_H
    2427
    2528/*
     
    9699// jvm_solaris.h        1.6 99/06/22 16:38:47
    97100// End
     101
     102#endif // OS_LINUX_VM_JVM_LINUX_H
  • trunk/openjdk/hotspot/src/os/linux/vm/mutex_linux.cpp

    r278 r309  
    11/*
    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.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    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"
    2731
    2832// put OS-includes here
  • trunk/openjdk/hotspot/src/os/linux/vm/mutex_linux.inline.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     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
    2532
    2633// Reconciliation History
    2734// mutex_solaris.inline.hpp     1.5 99/06/22 16:38:49
    2835// End
     36
     37#endif // OS_LINUX_VM_MUTEX_LINUX_INLINE_HPP
  • trunk/openjdk/hotspot/src/os/linux/vm/osThread_linux.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    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
    2742
    2843
  • trunk/openjdk/hotspot/src/os/linux/vm/osThread_linux.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef OS_LINUX_VM_OSTHREAD_LINUX_HPP
     26#define OS_LINUX_VM_OSTHREAD_LINUX_HPP
    2427
    2528 private:
     
    140143// osThread_solaris.hpp 1.24 99/08/27 13:11:54
    141144// End
     145
     146#endif // OS_LINUX_VM_OSTHREAD_LINUX_HPP
  • trunk/openjdk/hotspot/src/os/linux/vm/os_linux.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2525# define __STDC_FORMAT_MACROS
    2626
    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
    2985
    3086// put OS-includes here
     
    60116# include <stdint.h>
    61117# include <inttypes.h>
     118# include <sys/ioctl.h>
    62119
    63120#define MAX_PATH    (2 * K)
     
    828885      switch (thr_type) {
    829886      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();
    832891        break;
    833892      case os::compiler_thread:
     
    15081567void os::set_error_file(const char *logfile) {}
    15091568
     1569
     1570// This method is a copy of JDK's sysGetLastErrorString
     1571// from src/solaris/hpi/src/system_md.c
     1572
     1573size_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
    15101587intx os::current_thread_id() { return (intx)pthread_self(); }
    15111588int os::current_process_id() {
     
    16131690
    16141691  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;
    16171698    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;
    16231709}
    16241710
     
    18711957
    18721958
    1873 bool _print_ascii_file(const char* filename, outputStream* st) {
    1874   int fd = open(filename, O_RDONLY);
     1959static bool _print_ascii_file(const char* filename, outputStream* st) {
     1960  int fd = ::open(filename, O_RDONLY);
    18751961  if (fd == -1) {
    18761962     return false;
     
    18791965  char buf[32];
    18801966  int bytes;
    1881   while ((bytes = read(fd, buf, sizeof(buf))) > 0) {
     1967  while ((bytes = ::read(fd, buf, sizeof(buf))) > 0) {
    18821968    st->print_raw(buf, bytes);
    18831969  }
    18841970
    1885   close(fd);
     1971  ::close(fd);
    18861972
    18871973  return true;
     
    21612247          // "libjvm"debug_only("_g")".so" since for fastdebug version
    21622248          // we should have "libjvm.so" but debug_only("_g") adds "_g"!
    2163           // It is used when we are choosing the HPI library's name
    2164           // "libhpi[_g].so" in hpi::initialize_get_interface().
    21652249          len = strlen(buf);
    21662250          snprintf(buf + len, buflen-len, "/hotspot/libjvm%s.so", p);
     
    23462430  unlink(buf);
    23472431
    2348   int fd = open(buf, O_CREAT | O_RDWR, S_IRWXU);
     2432  int fd = ::open(buf, O_CREAT | O_RDWR, S_IRWXU);
    23492433
    23502434  if (fd != -1) {
    2351     off_t rv = lseek(fd, size-2, SEEK_SET);
     2435    off_t rv = ::lseek(fd, size-2, SEEK_SET);
    23522436    if (rv != (off_t)-1) {
    2353       if (write(fd, "", 1) == 1) {
     2437      if (::write(fd, "", 1) == 1) {
    23542438        mmap(base, size,
    23552439             PROT_READ|PROT_WRITE|PROT_EXEC,
     
    23572441      }
    23582442    }
    2359     close(fd);
     2443    ::close(fd);
    23602444    unlink(buf);
    23612445  }
     
    39224006  Linux::install_signal_handlers();
    39234007
     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
    39244017  size_t threadStackSizeInBytes = ThreadStackSize * K;
    39254018  if (threadStackSizeInBytes != 0 &&
    3926       threadStackSizeInBytes < Linux::min_stack_allowed) {
     4019      threadStackSizeInBytes < os::Linux::min_stack_allowed) {
    39274020        tty->print_cr("\nThe stack size specified is too small, "
    39284021                      "Specify at least %dk",
    3929                       Linux::min_stack_allowed / K);
     4022                      os::Linux::min_stack_allowed/ K);
    39304023        return JNI_ERR;
    39314024  }
     
    39794072  // Initialize lock used to serialize thread creation (see os::create_thread)
    39804073  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   }
    39884074
    39894075  // at-exit methods are called in the reverse order of their registration.
     
    41844270    return -1;
    41854271  }
    4186   hpi::native_path(strcpy(pathbuf, path));
     4272  os::native_path(strcpy(pathbuf, path));
    41874273  return ::stat(pathbuf, sbuf);
    41884274}
     
    42164302}
    42174303
     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
     4315int 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
    42184383// create binary file, rewriting existing file if required
    42194384int os::create_binary_file(const char* path, bool rewrite_existing) {
     
    42334398jlong os::seek_to_file_offset(int fd, jlong offset) {
    42344399  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
     4405int 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
     4436int 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;
    42354443}
    42364444
     
    44614669  if (fd != -1) {
    44624670    struct stat buf;
    4463     close(fd);
     4671    ::close(fd);
    44644672    while (::stat(filename, &buf) == 0) {
    44654673      (void)::poll(NULL, 0, 100);
     
    48395047  // Next, demultiplex/decode time arguments
    48405048  timespec absTime;
    4841   if (time < 0) { // don't wait at all
     5049  if (time < 0 || (isAbsolute && time == 0) ) { // don't wait at all
    48425050    return;
    48435051  }
  • trunk/openjdk/hotspot/src/os/linux/vm/os_linux.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef OS_LINUX_VM_OS_LINUX_HPP
     26#define OS_LINUX_VM_OS_LINUX_HPP
    2427
    2528// Linux_OS defines the interface to Linux operating systems
     
    329332    }
    330333} ;
     334
     335#endif // OS_LINUX_VM_OS_LINUX_HPP
  • trunk/openjdk/hotspot/src/os/linux/vm/os_linux.inline.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     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
    2550inline void* os::thread_local_storage_at(int index) {
    2651  return pthread_getspecific((pthread_key_t)index);
     
    75100inline void os::bang_stack_shadow_pages() {
    76101}
     102
     103inline void os::dll_unload(void *lib) {
     104  ::dlclose(lib);
     105}
     106
     107inline const int os::default_file_open_flags() { return 0;}
    77108
    78109inline DIR* os::opendir(const char* dirname)
     
    85116{
    86117  return NAME_MAX + sizeof(dirent) + 1;
     118}
     119
     120inline jlong os::lseek(int fd, jlong offset, int whence) {
     121  return (jlong) ::lseek64(fd, offset, whence);
     122}
     123
     124inline int os::fsync(int fd) {
     125  return ::fsync(fd);
     126}
     127
     128inline char* os::native_path(char *path) {
     129  return path;
     130}
     131
     132inline int os::ftruncate(int fd, jlong length) {
     133  return ::ftruncate64(fd, length);
    87134}
    88135
     
    104151}
    105152
    106 inline int os::closedir(DIR *dirp)
    107 {
    108   assert(dirp != NULL, "just checking");
     153inline int os::closedir(DIR *dirp) {
     154  assert(dirp != NULL, "argument is NULL");
    109155  return ::closedir(dirp);
    110156}
     
    124170inline bool os::numa_has_static_binding()   { return true; }
    125171inline bool os::numa_has_group_homing()     { return false;  }
     172
     173inline 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
     179inline 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
     185inline int os::close(int fd) {
     186  return ::close(fd);
     187}
     188
     189inline int os::socket_close(int fd) {
     190  return ::close(fd);
     191}
     192
     193inline int os::socket(int domain, int type, int protocol) {
     194  return ::socket(domain, type, protocol);
     195}
     196
     197inline int os::recv(int fd, char *buf, int nBytes, int flags) {
     198  RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, (unsigned int) flags));
     199}
     200
     201inline int os::send(int fd, char *buf, int nBytes, int flags) {
     202  RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, (unsigned int) flags));
     203}
     204
     205inline int os::raw_send(int fd, char *buf, int nBytes, int flags) {
     206  return os::send(fd, buf, nBytes, flags);
     207}
     208
     209inline 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
     241inline int os::listen(int fd, int count) {
     242  return ::listen(fd, count);
     243}
     244
     245inline int os::connect(int fd, struct sockaddr *him, int len) {
     246  RESTARTABLE_RETURN_INT(::connect(fd, him, len));
     247}
     248
     249inline 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
     260inline 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
     265inline 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
     270inline int os::socket_shutdown(int fd, int howto){
     271  return ::shutdown(fd, howto);
     272}
     273
     274inline int os::bind(int fd, struct sockaddr *him, int len){
     275  return ::bind(fd, him, len);
     276}
     277
     278inline int os::get_sock_name(int fd, struct sockaddr *him, int *len){
     279  return ::getsockname(fd, him, (socklen_t *)len);
     280}
     281
     282inline int os::get_host_name(char* name, int namelen){
     283  return ::gethostname(name, namelen);
     284}
     285
     286inline struct hostent*  os::get_host_by_name(char* name) {
     287  return ::gethostbyname(name);
     288}
     289inline 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
     294inline 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  
    11/*
    2  * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef OS_LINUX_VM_OS_SHARE_LINUX_HPP
     26#define OS_LINUX_VM_OS_SHARE_LINUX_HPP
     27
    2528// misc
    2629void signalHandler(int, siginfo_t*, ucontext_t*);
     
    3134
    3235#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  
    11/*
    2  * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    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"
    2734
    2835// put OS-includes here
     
    629636  }
    630637
    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  }
    632661}
    633662
  • trunk/openjdk/hotspot/src/os/linux/vm/stubRoutines_linux.cpp

    r278 r309  
    11/*
    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.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    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  
    11/*
    2  * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    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"
    2728
    2829// put OS-includes here
  • trunk/openjdk/hotspot/src/os/linux/vm/thread_linux.inline.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     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
    2548// Contains inlined functions for class Thread and ThreadLocalStorage
    2649
    2750inline 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  
    11/*
    2  * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    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"
    2730
    2831#include <sys/types.h>
     
    4245               "\n\n"
    4346               "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"
    4548               "Enter 'yes' to launch gdb automatically (PATH must include gdb)\n"
    4649               "Otherwise, press RETURN to abort...",
    4750               os::current_process_id(), os::current_process_id(),
    48                os::current_thread_id());
     51               os::current_thread_id(), os::current_thread_id());
    4952
    5053    yes = os::message_box("Unexpected Error", buf);
  • trunk/openjdk/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp

    r278 r309  
    3939
    4040#include <proc_service.h>
    41 #include "incls/_precompiled.incl"
    42 #include "incls/_vmStructs.cpp.incl"
    43 
     41#include "code/codeBlob.hpp"
     42#include "code/nmethod.hpp"
     43#include "code/pcDesc.hpp"
     44#include "gc_interface/collectedHeap.hpp"
     45#include "memory/heap.hpp"
     46#include "memory/memRegion.hpp"
     47#include "memory/universe.hpp"
     48#include "oops/constMethodOop.hpp"
     49#include "oops/klass.hpp"
     50#include "oops/methodOop.hpp"
     51#include "oops/oop.hpp"
     52#include "oops/symbolOop.hpp"
     53#include "runtime/virtualspace.hpp"
     54#include "runtime/vmStructs.hpp"
     55#include "utilities/accessFlags.hpp"
     56#include "utilities/globalDefinitions.hpp"
    4457#ifdef COMPILER1
    4558#if defined(DEBUG) || defined(FASTDEBUG)
     
    231244  GEN_OFFS(CodeBlob, _name);
    232245  GEN_OFFS(CodeBlob, _header_size);
    233   GEN_OFFS(CodeBlob, _instructions_offset);
     246  GEN_OFFS(CodeBlob, _content_offset);
     247  GEN_OFFS(CodeBlob, _code_offset);
    234248  GEN_OFFS(CodeBlob, _data_offset);
    235249  GEN_OFFS(CodeBlob, _frame_size);
  • trunk/openjdk/hotspot/src/os/solaris/dtrace/generateJvmOffsets.h

    r278 r309  
    11/*
    2  * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef OS_SOLARIS_DTRACE_GENERATEJVMOFFSETS_H
     26#define OS_SOLARIS_DTRACE_GENERATEJVMOFFSETS_H
     27
    2528#include <stdio.h>
    2629#include <strings.h>
     
    3740        void gen_epilogue(GEN_variant gen_var);
    3841}
     42
     43#endif // OS_SOLARIS_DTRACE_GENERATEJVMOFFSETS_H
  • trunk/openjdk/hotspot/src/os/solaris/dtrace/generateJvmOffsetsMain.c

    r278 r309  
    11/*
    2  * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/src/os/solaris/dtrace/hotspot.d

    r278 r309  
    11/*
    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.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/src/os/solaris/dtrace/jvm_dtrace.c

    r278 r309  
    11/*
    2  * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/src/os/solaris/dtrace/jvm_dtrace.h

    r278 r309  
    11/*
    2  * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/src/os/solaris/dtrace/libjvm_db.c

    r278 r309  
    125125
    126126  int32_t  orig_pc_offset;      /* _orig_pc_offset */
    127   int32_t  instrs_beg;          /* _instructions_offset */
     127  int32_t  instrs_beg;          /* _code_offset */
    128128  int32_t  instrs_end;
    129129  int32_t  deopt_beg;           /* _deoptimize_offset */
     
    588588
    589589  /* Instructions */
    590   err = ps_pread(J->P, nm + OFFSET_CodeBlob_instructions_offset, &N->instrs_beg, SZ32);
     590  err = ps_pread(J->P, nm + OFFSET_CodeBlob_code_offset, &N->instrs_beg, SZ32);
    591591  CHECK_FAIL(err);
    592592  err = ps_pread(J->P, nm + OFFSET_CodeBlob_data_offset, &N->instrs_end, SZ32);
  • trunk/openjdk/hotspot/src/os/solaris/dtrace/libjvm_db.h

    r278 r309  
    11/*
    2  * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef OS_SOLARIS_DTRACE_LIBJVM_DB_H
     26#define OS_SOLARIS_DTRACE_LIBJVM_DB_H
    2427
    2528#include <proc_service.h>
     
    6265} /* extern "C" */
    6366#endif /* __cplusplus */
     67
     68#endif // OS_SOLARIS_DTRACE_LIBJVM_DB_H
  • trunk/openjdk/hotspot/src/os/solaris/vm/attachListener_solaris.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_attachListener_solaris.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"
    2730
    2831#include <door.h>
  • trunk/openjdk/hotspot/src/os/solaris/vm/c1_globals_solaris.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef OS_SOLARIS_VM_C1_GLOBALS_SOLARIS_HPP
     26#define OS_SOLARIS_VM_C1_GLOBALS_SOLARIS_HPP
     27
     28#include "utilities/globalDefinitions.hpp"
     29#include "utilities/macros.hpp"
     30
    2531//
    2632// Sets the default values for operating system dependent flags used by the
    2733// client compiler. (see c1_globals.hpp)
    2834//
     35
     36#endif // OS_SOLARIS_VM_C1_GLOBALS_SOLARIS_HPP
  • trunk/openjdk/hotspot/src/os/solaris/vm/c2_globals_solaris.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef OS_SOLARIS_VM_C2_GLOBALS_SOLARIS_HPP
     26#define OS_SOLARIS_VM_C2_GLOBALS_SOLARIS_HPP
     27
     28#include "utilities/globalDefinitions.hpp"
     29#include "utilities/macros.hpp"
     30
    2531//
    2632// Sets the default values for operating system dependent flags used by the
    2733// server compiler. (see c2_globals.hpp)
    2834//
     35
     36#endif // OS_SOLARIS_VM_C2_GLOBALS_SOLARIS_HPP
  • trunk/openjdk/hotspot/src/os/solaris/vm/chaitin_solaris.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_chaitin_solaris.cpp.incl"
     25#include "precompiled.hpp"
     26#include "opto/chaitin.hpp"
     27#include "opto/machnode.hpp"
    2728
    2829void PhaseRegAlloc::pd_preallocate_hook() {
  • trunk/openjdk/hotspot/src/os/solaris/vm/dtraceJSDT_solaris.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_dtraceJSDT_solaris.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"
    2735
    2836#ifdef HAVE_DTRACE_H
  • trunk/openjdk/hotspot/src/os/solaris/vm/globals_solaris.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef OS_SOLARIS_VM_GLOBALS_SOLARIS_HPP
     26#define OS_SOLARIS_VM_GLOBALS_SOLARIS_HPP
    2427
    2528//
     
    4851define_pd_global(bool, UseOSErrorReporting, false);
    4952define_pd_global(bool, UseThreadPriorities, false);
     53
     54#endif // OS_SOLARIS_VM_GLOBALS_SOLARIS_HPP
  • trunk/openjdk/hotspot/src/os/solaris/vm/interfaceSupport_solaris.hpp

    r278 r309  
    11/*
    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.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef OS_SOLARIS_VM_INTERFACESUPPORT_SOLARIS_HPP
     26#define OS_SOLARIS_VM_INTERFACESUPPORT_SOLARIS_HPP
     27
    2528// Contains inlined functions for class InterfaceSupport
    2629
     
    2831  os::write_memory_serialize_page(thread);
    2932}
     33
     34#endif // OS_SOLARIS_VM_INTERFACESUPPORT_SOLARIS_HPP
  • trunk/openjdk/hotspot/src/os/solaris/vm/jsig.c

    r278 r309  
    11/*
    2  * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/src/os/solaris/vm/jvm_solaris.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_jvm_solaris.cpp.incl"
     25#include "precompiled.hpp"
     26#include "prims/jvm.h"
     27#include "runtime/interfaceSupport.hpp"
     28#include "runtime/osThread.hpp"
    2729
    2830#include <signal.h>
  • trunk/openjdk/hotspot/src/os/solaris/vm/jvm_solaris.h

    r278 r309  
    11/*
    2  * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef OS_SOLARIS_VM_JVM_SOLARIS_H
     26#define OS_SOLARIS_VM_JVM_SOLARIS_H
    2427
    2528/*
     
    99102
    100103#endif /* JVM_MD_H */
     104
     105#endif // OS_SOLARIS_VM_JVM_SOLARIS_H
  • trunk/openjdk/hotspot/src/os/solaris/vm/mutex_solaris.cpp

    r278 r309  
    11/*
    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.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_mutex_solaris.cpp.incl"
     25#include "precompiled.hpp"
     26#include "mutex_solaris.inline.hpp"
     27#include "runtime/interfaceSupport.hpp"
     28#include "runtime/mutex.hpp"
     29#include "thread_solaris.inline.hpp"
     30#include "utilities/events.hpp"
    2731
    2832// Solaris-specific include, therefore not in includeDB_*
  • trunk/openjdk/hotspot/src/os/solaris/vm/mutex_solaris.inline.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef OS_SOLARIS_VM_MUTEX_SOLARIS_INLINE_HPP
     26#define OS_SOLARIS_VM_MUTEX_SOLARIS_INLINE_HPP
     27
     28#include "os_solaris.inline.hpp"
     29#include "runtime/interfaceSupport.hpp"
     30#include "thread_solaris.inline.hpp"
     31
     32#endif // OS_SOLARIS_VM_MUTEX_SOLARIS_INLINE_HPP
  • trunk/openjdk/hotspot/src/os/solaris/vm/osThread_solaris.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 // do not include  precompiled  header file
    26 # include "incls/_osThread_solaris.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
    2740# include <signal.h>
    2841
  • trunk/openjdk/hotspot/src/os/solaris/vm/osThread_solaris.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef OS_SOLARIS_VM_OSTHREAD_SOLARIS_HPP
     26#define OS_SOLARIS_VM_OSTHREAD_SOLARIS_HPP
    2427
    2528// This is embedded via include into the class OSThread
     
    150153  void pd_initialize();
    151154  void pd_destroy();
     155
     156#endif // OS_SOLARIS_VM_OSTHREAD_SOLARIS_HPP
  • trunk/openjdk/hotspot/src/os/solaris/vm/os_share_solaris.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef OS_SOLARIS_VM_OS_SHARE_SOLARIS_HPP
     26#define OS_SOLARIS_VM_OS_SHARE_SOLARIS_HPP
    2427
    2528// Defines the interfaces to Solaris operating systems that vary across platforms
     
    6669
    6770#define PROCFILE_LENGTH 128
     71
     72#endif // OS_SOLARIS_VM_OS_SHARE_SOLARIS_HPP
  • trunk/openjdk/hotspot/src/os/solaris/vm/os_solaris.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 // do not include  precompiled  header file
    26 # include "incls/_os_solaris.cpp.incl"
     25// no precompiled headers
     26#include "classfile/classLoader.hpp"
     27#include "classfile/systemDictionary.hpp"
     28#include "classfile/vmSymbols.hpp"
     29#include "code/icBuffer.hpp"
     30#include "code/vtableStubs.hpp"
     31#include "compiler/compileBroker.hpp"
     32#include "interpreter/interpreter.hpp"
     33#include "jvm_solaris.h"
     34#include "memory/allocation.inline.hpp"
     35#include "memory/filemap.hpp"
     36#include "mutex_solaris.inline.hpp"
     37#include "oops/oop.inline.hpp"
     38#include "os_share_solaris.hpp"
     39#include "prims/jniFastGetField.hpp"
     40#include "prims/jvm.h"
     41#include "prims/jvm_misc.hpp"
     42#include "runtime/arguments.hpp"
     43#include "runtime/extendedPC.hpp"
     44#include "runtime/globals.hpp"
     45#include "runtime/interfaceSupport.hpp"
     46#include "runtime/java.hpp"
     47#include "runtime/javaCalls.hpp"
     48#include "runtime/mutexLocker.hpp"
     49#include "runtime/objectMonitor.hpp"
     50#include "runtime/osThread.hpp"
     51#include "runtime/perfMemory.hpp"
     52#include "runtime/sharedRuntime.hpp"
     53#include "runtime/statSampler.hpp"
     54#include "runtime/stubRoutines.hpp"
     55#include "runtime/threadCritical.hpp"
     56#include "runtime/timer.hpp"
     57#include "services/attachListener.hpp"
     58#include "services/runtimeService.hpp"
     59#include "thread_solaris.inline.hpp"
     60#include "utilities/decoder.hpp"
     61#include "utilities/defaultStream.hpp"
     62#include "utilities/events.hpp"
     63#include "utilities/growableArray.hpp"
     64#include "utilities/vmError.hpp"
     65#ifdef TARGET_ARCH_x86
     66# include "assembler_x86.inline.hpp"
     67# include "nativeInst_x86.hpp"
     68#endif
     69#ifdef TARGET_ARCH_sparc
     70# include "assembler_sparc.inline.hpp"
     71# include "nativeInst_sparc.hpp"
     72#endif
     73#ifdef COMPILER1
     74#include "c1/c1_Runtime1.hpp"
     75#endif
     76#ifdef COMPILER2
     77#include "opto/runtime.hpp"
     78#endif
    2779
    2880// put OS-includes here
    2981# include <dlfcn.h>
    3082# include <errno.h>
     83# include <exception>
    3184# include <link.h>
    3285# include <poll.h>
     
    64117# include <sys/loadavg.h>
    65118# include <string.h>
     119# include <stdio.h>
    66120
    67121# define _STRUCTURED_PROC 1  //  this gets us the new structured proc interfaces of 5.6 & later
     
    168222static clock_t clock_tics_per_sec = 100;
    169223
     224// Track if we have called enable_extended_FILE_stdio (on Solaris 10u4+)
     225static bool enabled_extended_FILE_stdio = false;
     226
    170227// For diagnostics to print a message once. see run_periodic_checks
    171228static bool check_addr0_done = false;
     
    227284              "sp must be inside of selected thread stack");
    228285
    229     thread->_self_raw_id = raw_id;  // mark for quick retrieval
     286    thread->set_self_raw_id(raw_id);  // mark for quick retrieval
    230287    _get_thread_cache[ index ] = thread;
    231288  }
     
    335392// its former state whether or not an interrupt is received.
    336393// Used by classloader os::read
    337 // hpi calls skip this layer and stay in _thread_in_native
     394// os::restartable_read calls skip this layer and stay in _thread_in_native
    338395
    339396void os::Solaris::setup_interruptible(JavaThread* thread) {
     
    14201477}
    14211478
     1479
     1480void _handle_uncaught_cxx_exception() {
     1481  VMError err("An uncaught C++ exception");
     1482  err.report_and_die();
     1483}
     1484
     1485
    14221486// First crack at OS-specific initialization, from inside the new thread.
    14231487void os::initialize_thread() {
     
    15091573
    15101574  os::Solaris::init_thread_fpu_state();
     1575  std::set_terminate(_handle_uncaught_cxx_exception);
    15111576}
    15121577
     
    16991764
    17001765bool os::enable_vtime() {
    1701   int fd = open("/proc/self/ctl", O_WRONLY);
     1766  int fd = ::open("/proc/self/ctl", O_WRONLY);
    17021767  if (fd == -1)
    17031768    return false;
    17041769
    17051770  long cmd[] = { PCSET, PR_MSACCT };
    1706   int res = write(fd, cmd, sizeof(long) * 2);
    1707   close(fd);
     1771  int res = ::write(fd, cmd, sizeof(long) * 2);
     1772  ::close(fd);
    17081773  if (res != sizeof(long) * 2)
    17091774    return false;
     
    17131778
    17141779bool os::vtime_enabled() {
    1715   int fd = open("/proc/self/status", O_RDONLY);
     1780  int fd = ::open("/proc/self/status", O_RDONLY);
    17161781  if (fd == -1)
    17171782    return false;
    17181783
    17191784  pstatus_t status;
    1720   int res = read(fd, (void*) &status, sizeof(pstatus_t));
    1721   close(fd);
     1785  int res = os::read(fd, (void*) &status, sizeof(pstatus_t));
     1786  ::close(fd);
    17221787  if (res != sizeof(pstatus_t))
    17231788    return false;
     
    18341899void os::dll_build_name(char* buffer, size_t buflen,
    18351900                        const char* pname, const char* fname) {
    1836   // Copied from libhpi
    18371901  const size_t pnamelen = pname ? strlen(pname) : 0;
    18381902
     
    19121976      #define RTLD_DL_SYMENT 1
    19131977      #endif
    1914       Sym * info;
     1978#ifdef _LP64
     1979      Elf64_Sym * info;
     1980#else
     1981      Elf32_Sym * info;
     1982#endif
    19151983      if (dladdr1_func((void *)addr, &dlinfo, (void **)&info,
    19161984                       RTLD_DL_SYMENT)) {
    1917           if (buf) jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname);
    1918           if (offset) *offset = addr - (address)dlinfo.dli_saddr;
    1919 
    1920           // check if the returned symbol really covers addr
    1921           return ((char *)dlinfo.dli_saddr + info->st_size > (char *)addr);
    1922       } else {
    1923           if (buf) buf[0] = '\0';
    1924           if (offset) *offset  = -1;
    1925           return false;
     1985        if ((char *)dlinfo.dli_saddr + info->st_size > (char *)addr) {
     1986          if (buf != NULL) {
     1987            if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen))
     1988              jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname);
     1989            }
     1990            if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr;
     1991            return true;
     1992        }
    19261993      }
     1994      if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) {
     1995        if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
     1996          dlinfo.dli_fname, buf, buflen, offset) == Decoder::no_error) {
     1997          return true;
     1998        }
     1999      }
     2000      if (buf != NULL) buf[0] = '\0';
     2001      if (offset != NULL) *offset  = -1;
     2002      return false;
    19272003  } else {
    19282004      // no, only dladdr is available
    1929       if(dladdr((void *)addr, &dlinfo)) {
    1930           if (buf) jio_snprintf(buf, buflen, dlinfo.dli_sname);
    1931           if (offset) *offset = addr - (address)dlinfo.dli_saddr;
     2005      if (dladdr((void *)addr, &dlinfo)) {
     2006        if (buf != NULL) {
     2007          if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen))
     2008            jio_snprintf(buf, buflen, dlinfo.dli_sname);
     2009        }
     2010        if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr;
     2011        return true;
     2012      } else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) {
     2013        if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
     2014          dlinfo.dli_fname, buf, buflen, offset) == Decoder::no_error) {
    19322015          return true;
    1933       } else {
    1934           if (buf) buf[0] = '\0';
    1935           if (offset) *offset  = -1;
    1936           return false;
     2016        }
    19372017      }
     2018      if (buf != NULL) buf[0] = '\0';
     2019      if (offset != NULL) *offset  = -1;
     2020      return false;
    19382021  }
    19392022}
     
    21302213}
    21312214
    2132 
    2133 bool _print_ascii_file(const char* filename, outputStream* st) {
    2134   int fd = open(filename, O_RDONLY);
     2215int os::stat(const char *path, struct stat *sbuf) {
     2216  char pathbuf[MAX_PATH];
     2217  if (strlen(path) > MAX_PATH - 1) {
     2218    errno = ENAMETOOLONG;
     2219    return -1;
     2220  }
     2221  os::native_path(strcpy(pathbuf, path));
     2222  return ::stat(pathbuf, sbuf);
     2223}
     2224
     2225static bool _print_ascii_file(const char* filename, outputStream* st) {
     2226  int fd = ::open(filename, O_RDONLY);
    21352227  if (fd == -1) {
    21362228     return false;
     
    21392231  char buf[32];
    21402232  int bytes;
    2141   while ((bytes = read(fd, buf, sizeof(buf))) > 0) {
     2233  while ((bytes = ::read(fd, buf, sizeof(buf))) > 0) {
    21422234    st->print_raw(buf, bytes);
    21432235  }
    21442236
    2145   close(fd);
     2237  ::close(fd);
    21462238
    21472239  return true;
     
    22062298static bool check_addr0(outputStream* st) {
    22072299  jboolean status = false;
    2208   int fd = open("/proc/self/map",O_RDONLY);
     2300  int fd = ::open("/proc/self/map",O_RDONLY);
    22092301  if (fd >= 0) {
    22102302    prmap_t p;
    2211     while(read(fd, &p, sizeof(p)) > 0) {
     2303    while(::read(fd, &p, sizeof(p)) > 0) {
    22122304      if (p.pr_vaddr == 0x0) {
    22132305        st->print("Warning: Address: 0x%x, Size: %dK, ",p.pr_vaddr, p.pr_size/1024, p.pr_mapname);
     
    22202312        status = true;
    22212313      }
    2222       close(fd);
     2314      ::close(fd);
    22232315    }
    22242316  }
     
    24682560          // "libjvm"debug_only("_g")".so" since for fastdebug version
    24692561          // we should have "libjvm.so" but debug_only("_g") adds "_g"!
    2470           // It is used when we are choosing the HPI library's name
    2471           // "libhpi[_g].so" in hpi::initialize_get_interface().
    24722562          len = strlen(buf);
    24732563          snprintf(buf + len, buflen-len, "/hotspot/libjvm%s.so", p);
     
    24912581void os::print_jni_name_suffix_on(outputStream* st, int args_size) {
    24922582  // no suffix required
     2583}
     2584
     2585// This method is a copy of JDK's sysGetLastErrorString
     2586// from src/solaris/hpi/src/system_md.c
     2587
     2588size_t os::lasterror(char *buf, size_t len) {
     2589
     2590  if (errno == 0)  return 0;
     2591
     2592  const char *s = ::strerror(errno);
     2593  size_t n = ::strlen(s);
     2594  if (n >= len) {
     2595    n = len - 1;
     2596  }
     2597  ::strncpy(buf, s, n);
     2598  buf[n] = '\0';
     2599  return n;
    24932600}
    24942601
     
    29873094      jio_snprintf(buf, sizeof(buf), ": %s", strerror(err));
    29883095    }
    2989     warning("attempt_reserve_memory_at: couldn't reserve %d bytes at "
     3096    warning("attempt_reserve_memory_at: couldn't reserve " SIZE_FORMAT " bytes at "
    29903097            PTR_FORMAT ": reserve_memory_helper returned " PTR_FORMAT
    29913098            "%s", bytes, requested_addr, addr, buf);
     
    33753482    // thread.Interrupt.
    33763483
    3377     if((res == OS_ERR) && (errno == EINTR)) {
     3484    // See c/r 6751923. Poll can return 0 before time
     3485    // has elapsed if time is set via clock_settime (as NTP does).
     3486    // res == 0 if poll timed out (see man poll RETURN VALUES)
     3487    // using the logic below checks that we really did
     3488    // sleep at least "millis" if not we'll sleep again.
     3489    if( ( res == 0 ) || ((res == OS_ERR) && (errno == EINTR))) {
    33783490      newtime = getTimeMillis();
    33793491      assert(newtime >= prevtime, "time moving backwards");
     
    33953507size_t os::read(int fd, void *buf, unsigned int nBytes) {
    33963508  INTERRUPTIBLE_RETURN_INT_VM(::read(fd, buf, nBytes), os::Solaris::clear_interrupted);
     3509}
     3510
     3511size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) {
     3512  INTERRUPTIBLE_RETURN_INT(::read(fd, buf, nBytes), os::Solaris::clear_interrupted);
    33973513}
    33983514
     
    45664682#define LWPINDEX(ary,ix)   ((lwpstatus_t *)(((ary)->pr_entsize * (ix)) + (ADR((ary) + 1))))
    45674683
    4568   lwpFile = open("/proc/self/lstatus", O_RDONLY, 0);
     4684  lwpFile = ::open("/proc/self/lstatus", O_RDONLY, 0);
    45694685  if (lwpFile < 0) {
    45704686      if (ThreadPriorityVerbose) warning ("Couldn't open /proc/self/lstatus\n");
     
    45734689  lwpSize = 16*1024;
    45744690  for (;;) {
    4575     lseek (lwpFile, 0, SEEK_SET);
     4691    ::lseek64 (lwpFile, 0, SEEK_SET);
    45764692    lwpArray = (prheader_t *)NEW_C_HEAP_ARRAY(char, lwpSize);
    4577     if (read(lwpFile, lwpArray, lwpSize) < 0) {
     4693    if (::read(lwpFile, lwpArray, lwpSize) < 0) {
    45784694      if (ThreadPriorityVerbose) warning("Error reading /proc/self/lstatus\n");
    45794695      break;
     
    45964712
    45974713  FREE_C_HEAP_ARRAY(char, lwpArray);
    4598   close (lwpFile);
     4714  ::close (lwpFile);
    45994715  if (ThreadPriorityVerbose) {
    46004716    if (isT2) tty->print_cr("We are running with a T2 libthread\n");
     
    47924908  Solaris::misc_sym_init();
    47934909
    4794   int fd = open("/dev/zero", O_RDWR);
     4910  int fd = ::open("/dev/zero", O_RDWR);
    47954911  if (fd < 0) {
    47964912    fatal(err_msg("os::init: cannot open /dev/zero (%s)", strerror(errno)));
     
    48784994  // the java system classes, including StackOverflowError - depends on page
    48794995  // size.  Add a page for compiler2 recursion in main thread.
    4880   // Add in BytesPerWord times page size to account for VM stack during
     4996  // Add in 2*BytesPerWord times page size to account for VM stack during
    48814997  // class initialization depending on 32 or 64 bit VM.
    4882   guarantee((Solaris::min_stack_allowed >=
    4883     (StackYellowPages+StackRedPages+StackShadowPages+BytesPerWord
    4884      COMPILER2_PRESENT(+1)) * page_size),
    4885     "need to increase Solaris::min_stack_allowed on this platform");
     4998  os::Solaris::min_stack_allowed = MAX2(os::Solaris::min_stack_allowed,
     4999            (size_t)(StackYellowPages+StackRedPages+StackShadowPages+
     5000                    2*BytesPerWord COMPILER2_PRESENT(+1)) * page_size);
    48865001
    48875002  size_t threadStackSizeInBytes = ThreadStackSize * K;
    48885003  if (threadStackSizeInBytes != 0 &&
    4889     threadStackSizeInBytes < Solaris::min_stack_allowed) {
     5004    threadStackSizeInBytes < os::Solaris::min_stack_allowed) {
    48905005    tty->print_cr("\nThe stack size specified is too small, Specify at least %dk",
    4891                   Solaris::min_stack_allowed/K);
     5006                  os::Solaris::min_stack_allowed/K);
    48925007    return JNI_ERR;
    48935008  }
     
    49635078  }
    49645079
    4965   // Initialize HPI.
    4966   jint hpi_result = hpi::initialize();
    4967   if (hpi_result != JNI_OK) {
    4968     tty->print_cr("There was an error trying to initialize the HPI library.");
    4969     return hpi_result;
    4970   }
    4971 
    49725080  // Calculate theoretical max. size of Threads to guard gainst
    49735081  // artifical out-of-memory situations, where all available address-
     
    50285136
    50295137// OS interface.
    5030 
    5031 int os::stat(const char *path, struct stat *sbuf) {
    5032   char pathbuf[MAX_PATH];
    5033   if (strlen(path) > MAX_PATH - 1) {
    5034     errno = ENAMETOOLONG;
    5035     return -1;
    5036   }
    5037   hpi::native_path(strcpy(pathbuf, path));
    5038   return ::stat(pathbuf, sbuf);
    5039 }
    5040 
    50415138
    50425139bool os::check_heap(bool force) { return true; }
     
    50845181}
    50855182
     5183// This code originates from JDK's sysOpen and open64_w
     5184// from src/solaris/hpi/src/system_md.c
     5185
     5186#ifndef O_DELETE
     5187#define O_DELETE 0x10000
     5188#endif
     5189
     5190// Open a file. Unlink the file immediately after open returns
     5191// if the specified oflag has the O_DELETE flag set.
     5192// O_DELETE is used only in j2se/src/share/native/java/util/zip/ZipFile.c
     5193
     5194int os::open(const char *path, int oflag, int mode) {
     5195  if (strlen(path) > MAX_PATH - 1) {
     5196    errno = ENAMETOOLONG;
     5197    return -1;
     5198  }
     5199  int fd;
     5200  int o_delete = (oflag & O_DELETE);
     5201  oflag = oflag & ~O_DELETE;
     5202
     5203  fd = ::open64(path, oflag, mode);
     5204  if (fd == -1) return -1;
     5205
     5206  //If the open succeeded, the file might still be a directory
     5207  {
     5208    struct stat64 buf64;
     5209    int ret = ::fstat64(fd, &buf64);
     5210    int st_mode = buf64.st_mode;
     5211
     5212    if (ret != -1) {
     5213      if ((st_mode & S_IFMT) == S_IFDIR) {
     5214        errno = EISDIR;
     5215        ::close(fd);
     5216        return -1;
     5217      }
     5218    } else {
     5219      ::close(fd);
     5220      return -1;
     5221    }
     5222  }
     5223    /*
     5224     * 32-bit Solaris systems suffer from:
     5225     *
     5226     * - an historical default soft limit of 256 per-process file
     5227     *   descriptors that is too low for many Java programs.
     5228     *
     5229     * - a design flaw where file descriptors created using stdio
     5230     *   fopen must be less than 256, _even_ when the first limit above
     5231     *   has been raised.  This can cause calls to fopen (but not calls to
     5232     *   open, for example) to fail mysteriously, perhaps in 3rd party
     5233     *   native code (although the JDK itself uses fopen).  One can hardly
     5234     *   criticize them for using this most standard of all functions.
     5235     *
     5236     * We attempt to make everything work anyways by:
     5237     *
     5238     * - raising the soft limit on per-process file descriptors beyond
     5239     *   256
     5240     *
     5241     * - As of Solaris 10u4, we can request that Solaris raise the 256
     5242     *   stdio fopen limit by calling function enable_extended_FILE_stdio.
     5243     *   This is done in init_2 and recorded in enabled_extended_FILE_stdio
     5244     *
     5245     * - If we are stuck on an old (pre 10u4) Solaris system, we can
     5246     *   workaround the bug by remapping non-stdio file descriptors below
     5247     *   256 to ones beyond 256, which is done below.
     5248     *
     5249     * See:
     5250     * 1085341: 32-bit stdio routines should support file descriptors >255
     5251     * 6533291: Work around 32-bit Solaris stdio limit of 256 open files
     5252     * 6431278: Netbeans crash on 32 bit Solaris: need to call
     5253     *          enable_extended_FILE_stdio() in VM initialisation
     5254     * Giri Mandalika's blog
     5255     * http://technopark02.blogspot.com/2005_05_01_archive.html
     5256     */
     5257#ifndef  _LP64
     5258     if ((!enabled_extended_FILE_stdio) && fd < 256) {
     5259         int newfd = ::fcntl(fd, F_DUPFD, 256);
     5260         if (newfd != -1) {
     5261             ::close(fd);
     5262             fd = newfd;
     5263         }
     5264     }
     5265#endif // 32-bit Solaris
     5266    /*
     5267     * All file descriptors that are opened in the JVM and not
     5268     * specifically destined for a subprocess should have the
     5269     * close-on-exec flag set.  If we don't set it, then careless 3rd
     5270     * party native code might fork and exec without closing all
     5271     * appropriate file descriptors (e.g. as we do in closeDescriptors in
     5272     * UNIXProcess.c), and this in turn might:
     5273     *
     5274     * - cause end-of-file to fail to be detected on some file
     5275     *   descriptors, resulting in mysterious hangs, or
     5276     *
     5277     * - might cause an fopen in the subprocess to fail on a system
     5278     *   suffering from bug 1085341.
     5279     *
     5280     * (Yes, the default setting of the close-on-exec flag is a Unix
     5281     * design flaw)
     5282     *
     5283     * See:
     5284     * 1085341: 32-bit stdio routines should support file descriptors >255
     5285     * 4843136: (process) pipe file descriptor from Runtime.exec not being closed
     5286     * 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9
     5287     */
     5288#ifdef FD_CLOEXEC
     5289    {
     5290        int flags = ::fcntl(fd, F_GETFD);
     5291        if (flags != -1)
     5292            ::fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
     5293    }
     5294#endif
     5295
     5296  if (o_delete != 0) {
     5297    ::unlink(path);
     5298  }
     5299  return fd;
     5300}
     5301
    50865302// create binary file, rewriting existing file if required
    50875303int os::create_binary_file(const char* path, bool rewrite_existing) {
     
    51015317jlong os::seek_to_file_offset(int fd, jlong offset) {
    51025318  return (jlong)::lseek64(fd, (off64_t)offset, SEEK_SET);
     5319}
     5320
     5321jlong os::lseek(int fd, jlong offset, int whence) {
     5322  return (jlong) ::lseek64(fd, offset, whence);
     5323}
     5324
     5325char * os::native_path(char *path) {
     5326  return path;
     5327}
     5328
     5329int os::ftruncate(int fd, jlong length) {
     5330  return ::ftruncate64(fd, length);
     5331}
     5332
     5333int os::fsync(int fd)  {
     5334  RESTARTABLE_RETURN_INT(::fsync(fd));
     5335}
     5336
     5337int os::available(int fd, jlong *bytes) {
     5338  jlong cur, end;
     5339  int mode;
     5340  struct stat64 buf64;
     5341
     5342  if (::fstat64(fd, &buf64) >= 0) {
     5343    mode = buf64.st_mode;
     5344    if (S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) {
     5345      /*
     5346      * XXX: is the following call interruptible? If so, this might
     5347      * need to go through the INTERRUPT_IO() wrapper as for other
     5348      * blocking, interruptible calls in this file.
     5349      */
     5350      int n,ioctl_return;
     5351
     5352      INTERRUPTIBLE(::ioctl(fd, FIONREAD, &n),ioctl_return,os::Solaris::clear_interrupted);
     5353      if (ioctl_return>= 0) {
     5354          *bytes = n;
     5355        return 1;
     5356      }
     5357    }
     5358  }
     5359  if ((cur = ::lseek64(fd, 0L, SEEK_CUR)) == -1) {
     5360    return 0;
     5361  } else if ((end = ::lseek64(fd, 0L, SEEK_END)) == -1) {
     5362    return 0;
     5363  } else if (::lseek64(fd, cur, SEEK_SET) == -1) {
     5364    return 0;
     5365  }
     5366  *bytes = end - cur;
     5367  return 1;
    51035368}
    51045369
     
    51615426  if (fd != -1) {
    51625427    struct stat buf;
    5163     close(fd);
     5428    ::close(fd);
    51645429    while (::stat(filename, &buf) == 0) {
    51655430      (void)::poll(NULL, 0, 100);
     
    53585623                     getpid(),
    53595624                     thread->osthread()->lwp_id());
    5360   fd = open(proc_name, O_RDONLY);
     5625  fd = ::open(proc_name, O_RDONLY);
    53615626  if ( fd == -1 ) return -1;
    53625627
    53635628  do {
    5364     count = pread(fd,
     5629    count = ::pread(fd,
    53655630                  (void *)&prusage.pr_utime,
    53665631                  thr_time_size,
    53675632                  thr_time_off);
    53685633  } while (count < 0 && errno == EINTR);
    5369   close(fd);
     5634  ::close(fd);
    53705635  if ( count < 0 ) return -1;
    53715636
     
    58376102  // First, demultiplex/decode time arguments
    58386103  timespec absTime;
    5839   if (time < 0) { // don't wait at all
     6104  if (time < 0 || (isAbsolute && time == 0) ) { // don't wait at all
    58406105    return;
    58416106  }
     
    60396304}
    60406305
    6041 
     6306size_t os::write(int fd, const void *buf, unsigned int nBytes) {
     6307  INTERRUPTIBLE_RETURN_INT(::write(fd, buf, nBytes), os::Solaris::clear_interrupted);
     6308}
     6309
     6310int os::close(int fd) {
     6311  RESTARTABLE_RETURN_INT(::close(fd));
     6312}
     6313
     6314int os::socket_close(int fd) {
     6315  RESTARTABLE_RETURN_INT(::close(fd));
     6316}
     6317
     6318int os::recv(int fd, char *buf, int nBytes, int flags) {
     6319  INTERRUPTIBLE_RETURN_INT(::recv(fd, buf, nBytes, flags), os::Solaris::clear_interrupted);
     6320}
     6321
     6322
     6323int os::send(int fd, char *buf, int nBytes, int flags) {
     6324  INTERRUPTIBLE_RETURN_INT(::send(fd, buf, nBytes, flags), os::Solaris::clear_interrupted);
     6325}
     6326
     6327int os::raw_send(int fd, char *buf, int nBytes, int flags) {
     6328  RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags));
     6329}
     6330
     6331// As both poll and select can be interrupted by signals, we have to be
     6332// prepared to restart the system call after updating the timeout, unless
     6333// a poll() is done with timeout == -1, in which case we repeat with this
     6334// "wait forever" value.
     6335
     6336int os::timeout(int fd, long timeout) {
     6337  int res;
     6338  struct timeval t;
     6339  julong prevtime, newtime;
     6340  static const char* aNull = 0;
     6341  struct pollfd pfd;
     6342  pfd.fd = fd;
     6343  pfd.events = POLLIN;
     6344
     6345  gettimeofday(&t, &aNull);
     6346  prevtime = ((julong)t.tv_sec * 1000)  +  t.tv_usec / 1000;
     6347
     6348  for(;;) {
     6349    INTERRUPTIBLE_NORESTART(::poll(&pfd, 1, timeout), res, os::Solaris::clear_interrupted);
     6350    if(res == OS_ERR && errno == EINTR) {
     6351        if(timeout != -1) {
     6352          gettimeofday(&t, &aNull);
     6353          newtime = ((julong)t.tv_sec * 1000)  +  t.tv_usec /1000;
     6354          timeout -= newtime - prevtime;
     6355          if(timeout <= 0)
     6356            return OS_OK;
     6357          prevtime = newtime;
     6358        }
     6359    } else return res;
     6360  }
     6361}
     6362
     6363int os::connect(int fd, struct sockaddr *him, int len) {
     6364  int _result;
     6365  INTERRUPTIBLE_NORESTART(::connect(fd, him, len), _result,
     6366                          os::Solaris::clear_interrupted);
     6367
     6368  // Depending on when thread interruption is reset, _result could be
     6369  // one of two values when errno == EINTR
     6370
     6371  if (((_result == OS_INTRPT) || (_result == OS_ERR))
     6372                                        && (errno == EINTR)) {
     6373     /* restarting a connect() changes its errno semantics */
     6374     INTERRUPTIBLE(::connect(fd, him, len), _result,
     6375                     os::Solaris::clear_interrupted);
     6376     /* undo these changes */
     6377     if (_result == OS_ERR) {
     6378       if (errno == EALREADY) {
     6379         errno = EINPROGRESS; /* fall through */
     6380       } else if (errno == EISCONN) {
     6381         errno = 0;
     6382         return OS_OK;
     6383       }
     6384     }
     6385   }
     6386   return _result;
     6387 }
     6388
     6389int os::accept(int fd, struct sockaddr *him, int *len) {
     6390  if (fd < 0)
     6391   return OS_ERR;
     6392  INTERRUPTIBLE_RETURN_INT((int)::accept(fd, him,\
     6393    (socklen_t*) len), os::Solaris::clear_interrupted);
     6394 }
     6395
     6396int os::recvfrom(int fd, char *buf, int nBytes, int flags,
     6397                             sockaddr *from, int *fromlen) {
     6398   //%%note jvm_r11
     6399  INTERRUPTIBLE_RETURN_INT((int)::recvfrom(fd, buf, nBytes,\
     6400    flags, from, fromlen), os::Solaris::clear_interrupted);
     6401}
     6402
     6403int os::sendto(int fd, char *buf, int len, int flags,
     6404                           struct sockaddr *to, int tolen) {
     6405  //%%note jvm_r11
     6406  INTERRUPTIBLE_RETURN_INT((int)::sendto(fd, buf, len, flags,\
     6407    to, tolen), os::Solaris::clear_interrupted);
     6408}
     6409
     6410int os::socket_available(int fd, jint *pbytes) {
     6411   if (fd < 0)
     6412     return OS_OK;
     6413
     6414   int ret;
     6415
     6416   RESTARTABLE(::ioctl(fd, FIONREAD, pbytes), ret);
     6417
     6418   //%% note ioctl can return 0 when successful, JVM_SocketAvailable
     6419   // is expected to return 0 on failure and 1 on success to the jdk.
     6420
     6421   return (ret == OS_ERR) ? 0 : 1;
     6422}
     6423
     6424
     6425int os::bind(int fd, struct sockaddr *him, int len) {
     6426   INTERRUPTIBLE_RETURN_INT_NORESTART(::bind(fd, him, len),\
     6427     os::Solaris::clear_interrupted);
     6428}
  • trunk/openjdk/hotspot/src/os/solaris/vm/os_solaris.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef OS_SOLARIS_VM_OS_SOLARIS_HPP
     26#define OS_SOLARIS_VM_OS_SOLARIS_HPP
     27
    2528// Solaris_OS defines the interface to Solaris operating systems
    2629
     
    395398    }
    396399} ;
     400
     401#endif // OS_SOLARIS_VM_OS_SOLARIS_HPP
  • trunk/openjdk/hotspot/src/os/solaris/vm/os_solaris.inline.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP
     26#define OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP
     27
     28#include "runtime/atomic.hpp"
     29#include "runtime/os.hpp"
     30#ifdef TARGET_OS_ARCH_solaris_x86
     31# include "atomic_solaris_x86.inline.hpp"
     32# include "orderAccess_solaris_x86.inline.hpp"
     33#endif
     34#ifdef TARGET_OS_ARCH_solaris_sparc
     35# include "atomic_solaris_sparc.inline.hpp"
     36# include "orderAccess_solaris_sparc.inline.hpp"
     37#endif
     38
     39// System includes
     40#include <sys/param.h>
     41#include <dlfcn.h>
     42#include <sys/socket.h>
     43#include <sys/poll.h>
     44#include <sys/filio.h>
     45#include <unistd.h>
     46#include <netdb.h>
     47#include <setjmp.h>
     48
    2549inline const char* os::file_separator() { return "/"; }
    2650inline const char* os::line_separator() { return "\n"; }
     
    5680inline void os::bang_stack_shadow_pages() {
    5781}
    58 
    59 inline DIR* os::opendir(const char* dirname)
    60 {
     82inline void os::dll_unload(void *lib) { ::dlclose(lib); }
     83
     84inline DIR* os::opendir(const char* dirname) {
    6185  assert(dirname != NULL, "just checking");
    6286  return ::opendir(dirname);
    6387}
    6488
    65 inline int os::readdir_buf_size(const char *path)
    66 {
     89inline int os::readdir_buf_size(const char *path) {
    6790  int size = pathconf(path, _PC_NAME_MAX);
    6891  return (size < 0 ? MAXPATHLEN : size) + sizeof(dirent) + 1;
    6992}
    7093
    71 inline struct dirent* os::readdir(DIR* dirp, dirent* dbuf)
    72 {
     94inline struct dirent* os::readdir(DIR* dirp, dirent* dbuf) {
    7395  assert(dirp != NULL, "just checking");
    7496#if defined(_LP64) || defined(_GNU_SOURCE)
     
    86108}
    87109
    88 inline int os::closedir(DIR *dirp)
    89 {
    90   assert(dirp != NULL, "just checking");
     110inline int os::closedir(DIR *dirp) {
     111  assert(dirp != NULL, "argument is NULL");
    91112  return ::closedir(dirp);
    92113}
     
    208229inline bool os::numa_has_static_binding()   { return false; }
    209230inline bool os::numa_has_group_homing()     { return true;  }
     231
     232inline int    os::socket(int domain, int type, int protocol) {
     233  return ::socket(domain, type, protocol);
     234}
     235
     236inline int    os::listen(int fd, int count) {
     237  if (fd < 0) return OS_ERR;
     238
     239  return ::listen(fd, count);
     240}
     241
     242inline int os::socket_shutdown(int fd, int howto){
     243  return ::shutdown(fd, howto);
     244}
     245
     246inline int os::get_sock_name(int fd, struct sockaddr *him, int *len){
     247  return ::getsockname(fd, him, (socklen_t*) len);
     248}
     249
     250inline int os::get_host_name(char* name, int namelen){
     251  return ::gethostname(name, namelen);
     252}
     253
     254inline struct hostent*  os::get_host_by_name(char* name) {
     255  return ::gethostbyname(name);
     256}
     257inline int os::get_sock_opt(int fd, int level, int optname,
     258                             char *optval, int* optlen){
     259  return ::getsockopt(fd, level, optname, optval, (socklen_t*) optlen);
     260}
     261
     262inline int os::set_sock_opt(int fd, int level, int optname,
     263                             const char *optval, int optlen){
     264  return ::setsockopt(fd, level, optname, optval, optlen);
     265}
     266#endif // OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP
  • trunk/openjdk/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_perfMemory_solaris.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_solaris.inline.hpp"
     31#include "runtime/handles.inline.hpp"
     32#include "runtime/perfMemory.hpp"
     33#include "utilities/exceptions.hpp"
    2734
    2835// put OS-includes here
  • trunk/openjdk/hotspot/src/os/solaris/vm/stubRoutines_solaris.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_stubRoutines_solaris.cpp.incl"
     25#include "precompiled.hpp"
     26#include "runtime/os.hpp"
     27#include "runtime/stubRoutines.hpp"
     28
  • trunk/openjdk/hotspot/src/os/solaris/vm/threadCritical_solaris.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_threadCritical_solaris.cpp.incl"
     25#include "precompiled.hpp"
     26#include "runtime/threadCritical.hpp"
     27#include "thread_solaris.inline.hpp"
    2728
    2829// OS-includes here
  • trunk/openjdk/hotspot/src/os/solaris/vm/thread_solaris.inline.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef OS_SOLARIS_VM_THREAD_SOLARIS_INLINE_HPP
     26#define OS_SOLARIS_VM_THREAD_SOLARIS_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_solaris_x86
     33# include "atomic_solaris_x86.inline.hpp"
     34# include "orderAccess_solaris_x86.inline.hpp"
     35# include "prefetch_solaris_x86.inline.hpp"
     36#endif
     37#ifdef TARGET_OS_ARCH_solaris_sparc
     38# include "atomic_solaris_sparc.inline.hpp"
     39# include "orderAccess_solaris_sparc.inline.hpp"
     40# include "prefetch_solaris_sparc.inline.hpp"
     41#endif
     42
    2543// Thread::current is "hot" it's called > 128K times in the 1st 500 msecs of
    2644// startup.
     
    3654  uintptr_t raw = pd_raw_thread_id();
    3755  int ix = pd_cache_index(raw);
    38   Thread *Candidate = ThreadLocalStorage::_get_thread_cache[ix];
    39   if (Candidate->_self_raw_id == raw) {
     56  Thread* candidate = ThreadLocalStorage::_get_thread_cache[ix];
     57  if (candidate->self_raw_id() == raw) {
    4058    // hit
    41     return Candidate;
     59    return candidate;
    4260  } else {
    4361    return ThreadLocalStorage::get_thread_via_cache_slowly(raw, ix);
    4462  }
    4563}
     64
     65#endif // OS_SOLARIS_VM_THREAD_SOLARIS_INLINE_HPP
  • trunk/openjdk/hotspot/src/os/solaris/vm/vmError_solaris.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_vmError_solaris.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"
    2730
    2831#include <sys/types.h>
  • trunk/openjdk/hotspot/src/os/windows/vm/attachListener_windows.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_attachListener_windows.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"
    2730
    2831#include <windows.h>
  • trunk/openjdk/hotspot/src/os/windows/vm/c1_globals_windows.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef OS_WINDOWS_VM_C1_GLOBALS_WINDOWS_HPP
     26#define OS_WINDOWS_VM_C1_GLOBALS_WINDOWS_HPP
     27
     28#include "utilities/globalDefinitions.hpp"
     29#include "utilities/macros.hpp"
     30
    2531//
    2632// Sets the default values for operating system dependent flags used by the
    2733// client compiler. (see c1_globals.hpp)
    2834//
     35
     36#endif // OS_WINDOWS_VM_C1_GLOBALS_WINDOWS_HPP
  • trunk/openjdk/hotspot/src/os/windows/vm/c2_globals_windows.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef OS_WINDOWS_VM_C2_GLOBALS_WINDOWS_HPP
     26#define OS_WINDOWS_VM_C2_GLOBALS_WINDOWS_HPP
     27
     28#include "utilities/globalDefinitions.hpp"
     29#include "utilities/macros.hpp"
     30
    2531//
    2632// Sets the default values for operating system dependent flags used by the
    2733// server compiler. (see c2_globals.hpp)
    2834//
     35
     36#endif // OS_WINDOWS_VM_C2_GLOBALS_WINDOWS_HPP
  • trunk/openjdk/hotspot/src/os/windows/vm/chaitin_windows.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_chaitin_windows.cpp.incl"
     25#include "precompiled.hpp"
     26#include "opto/chaitin.hpp"
     27#include "opto/machnode.hpp"
    2728
    2829// Disallow the use of the frame pointer (EBP) for implicit null exceptions
  • trunk/openjdk/hotspot/src/os/windows/vm/dtraceJSDT_windows.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_dtraceJSDT_windows.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"
    2735
    2836int DTraceJSDT::pd_activate(
  • trunk/openjdk/hotspot/src/os/windows/vm/globals_windows.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef OS_WINDOWS_VM_GLOBALS_WINDOWS_HPP
     26#define OS_WINDOWS_VM_GLOBALS_WINDOWS_HPP
     27
    2528//
    2629// Defines Windows specific flags. They are not available on other platforms.
     
    4144define_pd_global(bool, UseOSErrorReporting, false);  // for now.
    4245define_pd_global(bool, UseThreadPriorities, true) ;
     46
     47#endif // OS_WINDOWS_VM_GLOBALS_WINDOWS_HPP
  • trunk/openjdk/hotspot/src/os/windows/vm/interfaceSupport_windows.hpp

    r278 r309  
    11/*
    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.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef OS_WINDOWS_VM_INTERFACESUPPORT_WINDOWS_HPP
     26#define OS_WINDOWS_VM_INTERFACESUPPORT_WINDOWS_HPP
     27
    2528// Contains inlined functions for class InterfaceSupport
    2629
     
    4043    {}
    4144}
     45
     46#endif // OS_WINDOWS_VM_INTERFACESUPPORT_WINDOWS_HPP
  • trunk/openjdk/hotspot/src/os/windows/vm/jvm_windows.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_jvm_windows.cpp.incl"
     25#include "precompiled.hpp"
     26#include "prims/jvm.h"
     27#include "runtime/interfaceSupport.hpp"
     28#include "runtime/osThread.hpp"
    2729
    2830#include <signal.h>
  • trunk/openjdk/hotspot/src/os/windows/vm/jvm_windows.h

    r278 r309  
    11/*
    2  * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/src/os/windows/vm/mutex_windows.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_mutex_windows.cpp.incl"
     25#include "precompiled.hpp"
     26#include "mutex_windows.inline.hpp"
     27#include "runtime/interfaceSupport.hpp"
     28#include "runtime/mutex.hpp"
     29#include "thread_windows.inline.hpp"
     30#include "utilities/events.hpp"
    2731
    2832// put OS-includes here
  • trunk/openjdk/hotspot/src/os/windows/vm/mutex_windows.inline.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef OS_WINDOWS_VM_MUTEX_WINDOWS_INLINE_HPP
     26#define OS_WINDOWS_VM_MUTEX_WINDOWS_INLINE_HPP
     27
     28#include "os_windows.inline.hpp"
     29#include "runtime/interfaceSupport.hpp"
     30#include "thread_windows.inline.hpp"
     31
     32#endif // OS_WINDOWS_VM_MUTEX_WINDOWS_INLINE_HPP
  • trunk/openjdk/hotspot/src/os/windows/vm/osThread_windows.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_osThread_windows.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
    2636
    2737void OSThread::pd_initialize() {
  • trunk/openjdk/hotspot/src/os/windows/vm/osThread_windows.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef OS_WINDOWS_VM_OSTHREAD_WINDOWS_HPP
     26#define OS_WINDOWS_VM_OSTHREAD_WINDOWS_HPP
    2427
    2528typedef void* HANDLE;
     
    6568  void pd_initialize();
    6669  void pd_destroy();
     70
     71#endif // OS_WINDOWS_VM_OSTHREAD_WINDOWS_HPP
  • trunk/openjdk/hotspot/src/os/windows/vm/os_share_windows.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef OS_WINDOWS_VM_OS_SHARE_WINDOWS_HPP
     26#define OS_WINDOWS_VM_OS_SHARE_WINDOWS_HPP
     27
    2528// Defines the interfaces to Windows operating system that vary across platforms
     29
     30#endif // OS_WINDOWS_VM_OS_SHARE_WINDOWS_HPP
  • trunk/openjdk/hotspot/src/os/windows/vm/os_windows.cpp

    r297 r309  
    11/*
    2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     2 * CopyrighT (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2828#endif
    2929
    30 // do not include precompiled header file
    31 # include "incls/_os_windows.cpp.incl"
     30// no precompiled headers
     31#include "classfile/classLoader.hpp"
     32#include "classfile/systemDictionary.hpp"
     33#include "classfile/vmSymbols.hpp"
     34#include "code/icBuffer.hpp"
     35#include "code/vtableStubs.hpp"
     36#include "compiler/compileBroker.hpp"
     37#include "interpreter/interpreter.hpp"
     38#include "jvm_windows.h"
     39#include "memory/allocation.inline.hpp"
     40#include "memory/filemap.hpp"
     41#include "mutex_windows.inline.hpp"
     42#include "oops/oop.inline.hpp"
     43#include "os_share_windows.hpp"
     44#include "prims/jniFastGetField.hpp"
     45#include "prims/jvm.h"
     46#include "prims/jvm_misc.hpp"
     47#include "runtime/arguments.hpp"
     48#include "runtime/extendedPC.hpp"
     49#include "runtime/globals.hpp"
     50#include "runtime/interfaceSupport.hpp"
     51#include "runtime/java.hpp"
     52#include "runtime/javaCalls.hpp"
     53#include "runtime/mutexLocker.hpp"
     54#include "runtime/objectMonitor.hpp"
     55#include "runtime/osThread.hpp"
     56#include "runtime/perfMemory.hpp"
     57#include "runtime/sharedRuntime.hpp"
     58#include "runtime/statSampler.hpp"
     59#include "runtime/stubRoutines.hpp"
     60#include "runtime/threadCritical.hpp"
     61#include "runtime/timer.hpp"
     62#include "services/attachListener.hpp"
     63#include "services/runtimeService.hpp"
     64#include "thread_windows.inline.hpp"
     65#include "utilities/decoder.hpp"
     66#include "utilities/defaultStream.hpp"
     67#include "utilities/events.hpp"
     68#include "utilities/growableArray.hpp"
     69#include "utilities/vmError.hpp"
     70#ifdef TARGET_ARCH_x86
     71# include "assembler_x86.inline.hpp"
     72# include "nativeInst_x86.hpp"
     73#endif
     74#ifdef COMPILER1
     75#include "c1/c1_Runtime1.hpp"
     76#endif
     77#ifdef COMPILER2
     78#include "opto/runtime.hpp"
     79#endif
    3280
    3381#if defined(_DEBUG) && !defined(__WIN32OS2__)
     
    10511099}
    10521100
    1053 const char* os::dll_file_extension() { return ".dll"; }
    1054 
    10551101// This must be hard coded because it's the system's temporary
    10561102// directory not the java application's temp directory, ala java.io.tmpdir.
     
    10741120void os::dll_build_name(char *buffer, size_t buflen,
    10751121                        const char* pname, const char* fname) {
    1076   // Copied from libhpi
    10771122  const size_t pnamelen = pname ? strlen(pname) : 0;
    10781123  const char c = (pnamelen > 0) ? pname[pnamelen-1] : 0;
     
    13801425bool os::dll_address_to_function_name(address addr, char *buf,
    13811426                                      int buflen, int *offset) {
    1382   // Unimplemented on Windows - in order to use SymGetSymFromAddr(),
    1383   // we need to initialize imagehlp/dbghelp, then load symbol table
    1384   // for every module. That's too much work to do after a fatal error.
    1385   // For an example on how to implement this function, see 1.4.2.
    1386   if (offset)  *offset  = -1;
    1387   if (buf) buf[0] = '\0';
     1427  if (Decoder::decode(addr, buf, buflen, offset) == Decoder::no_error) {
     1428    return true;
     1429  }
     1430  if (offset != NULL)  *offset  = -1;
     1431  if (buf != NULL) buf[0] = '\0';
    13881432  return false;
    1389 }
    1390 
    1391 void* os::dll_lookup(void* handle, const char* name) {
    1392   return CAST_FROM_FN_PTR(void *, GetProcAddress((HMODULE)handle, name));
    13931433}
    13941434
     
    17531793  }
    17541794
     1795  buf[0] = '\0';
     1796  if (strcmp(Arguments::sun_java_launcher(), "gamma") == 0) {
     1797     // Support for the gamma launcher. Check for an
     1798     // JAVA_HOME environment variable
     1799     // and fix up the path so it looks like
     1800     // libjvm.so is installed there (append a fake suffix
     1801     // hotspot/libjvm.so).
     1802     char* java_home_var = ::getenv("JAVA_HOME");
     1803     if (java_home_var != NULL && java_home_var[0] != 0) {
     1804
     1805        strncpy(buf, java_home_var, buflen);
     1806
     1807        // determine if this is a legacy image or modules image
     1808        // modules image doesn't have "jre" subdirectory
     1809        size_t len = strlen(buf);
     1810        char* jrebin_p = buf + len;
     1811        jio_snprintf(jrebin_p, buflen-len, "\\jre\\bin\\");
     1812        if (0 != _access(buf, 0)) {
     1813          jio_snprintf(jrebin_p, buflen-len, "\\bin\\");
     1814        }
     1815        len = strlen(buf);
     1816        jio_snprintf(buf + len, buflen-len, "hotspot\\jvm.dll");
     1817     }
     1818  }
     1819
     1820  if(buf[0] == '\0') {
    17551821  GetModuleFileName(vm_lib_handle, buf, buflen);
     1822  }
    17561823  strcpy(saved_jvm_path, buf);
    17571824}
     
    17691836  st->print("@%d", args_size  * sizeof(int));
    17701837#endif
     1838}
     1839
     1840// This method is a copy of JDK's sysGetLastErrorString
     1841// from src/windows/hpi/src/system_md.c
     1842
     1843size_t os::lasterror(char *buf, size_t len) {
     1844  long errval;
     1845
     1846  if ((errval = GetLastError()) != 0) {
     1847      /* DOS error */
     1848    int n = (int)FormatMessage(
     1849          FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
     1850          NULL,
     1851          errval,
     1852          0,
     1853          buf,
     1854          (DWORD)len,
     1855          NULL);
     1856    if (n > 3) {
     1857      /* Drop final '.', CR, LF */
     1858      if (buf[n - 1] == '\n') n--;
     1859      if (buf[n - 1] == '\r') n--;
     1860      if (buf[n - 1] == '.') n--;
     1861      buf[n] = '\0';
     1862    }
     1863    return n;
     1864  }
     1865
     1866  if (errno != 0) {
     1867    /* C runtime error that has no corresponding DOS error code */
     1868    const char *s = strerror(errno);
     1869    size_t n = strlen(s);
     1870    if (n >= len) n = len - 1;
     1871    strncpy(buf, s, n);
     1872    buf[n] = '\0';
     1873    return n;
     1874  }
     1875  return 0;
    17711876}
    17721877
     
    19832088  int   number;
    19842089};
     2090
     2091// All Visual C++ exceptions thrown from code generated by the Microsoft Visual
     2092// C++ compiler contain this error code. Because this is a compiler-generated
     2093// error, the code is not listed in the Win32 API header files.
     2094// The code is actually a cryptic mnemonic device, with the initial "E"
     2095// standing for "exception" and the final 3 bytes (0x6D7363) representing the
     2096// ASCII values of "msc".
     2097
     2098#define EXCEPTION_UNCAUGHT_CXX_EXCEPTION    0xE06D7363
     2099
    19852100
    19862101struct siglabel exceptlabels[] = {
     
    20082123    def_excpt(EXCEPTION_GUARD_PAGE),
    20092124    def_excpt(EXCEPTION_INVALID_HANDLE),
     2125    def_excpt(EXCEPTION_UNCAUGHT_CXX_EXCEPTION),
    20102126    NULL, 0
    20112127};
     
    22402356    }
    22412357  }
    2242 
    22432358
    22442359  if (t != NULL && t->is_Java_thread()) {
     
    24452560    }
    24462561#ifndef _WIN64
    2447     if ((thread->thread_state() == _thread_in_Java) ||
    2448         (thread->thread_state() == _thread_in_native) )
     2562    if (((thread->thread_state() == _thread_in_Java) ||
     2563        (thread->thread_state() == _thread_in_native)) &&
     2564        exception_code != EXCEPTION_UNCAUGHT_CXX_EXCEPTION)
    24492565    {
    24502566      LONG result=Handle_FLT_Exception(exceptionInfo);
     
    24702586      case EXCEPTION_INT_OVERFLOW:
    24712587      case EXCEPTION_INT_DIVIDE_BY_ZERO:
     2588      case EXCEPTION_UNCAUGHT_CXX_EXCEPTION:
    24722589      {  report_error(t, exception_code, pc, exceptionInfo->ExceptionRecord,
    24732590                       exceptionInfo->ContextRecord);
     
    29983115  // >1: Thread is still suspended.
    29993116  assert(ret != SYS_THREAD_ERROR, "StartThread failed"); // should propagate back
    3000 }
    3001 
    3002 size_t os::read(int fd, void *buf, unsigned int nBytes) {
    3003   return ::read(fd, buf, nBytes);
    30043117}
    30053118
     
    34423555}
    34433556
    3444 
    34453557// this is called _after_ the global arguments have been parsed
    34463558jint os::init_2(void) {
     
    35153627  }
    35163628
    3517   // Initialize HPI.
    3518   jint hpi_result = hpi::initialize();
    3519   if (hpi_result != JNI_OK) { return hpi_result; }
    3520 
    35213629  // If stack_commit_size is 0, windows will reserve the default size,
    35223630  // but only commit a small portion of it.
     
    35273635    // If stack_commit_size == 0, we want this too
    35283636    actual_reserve_size = default_reserve_size;
     3637  }
     3638
     3639  // Check minimum allowable stack size for thread creation and to initialize
     3640  // the java system classes, including StackOverflowError - depends on page
     3641  // size.  Add a page for compiler2 recursion in main thread.
     3642  // Add in 2*BytesPerWord times page size to account for VM stack during
     3643  // class initialization depending on 32 or 64 bit VM.
     3644  size_t min_stack_allowed =
     3645            (size_t)(StackYellowPages+StackRedPages+StackShadowPages+
     3646            2*BytesPerWord COMPILER2_PRESENT(+1)) * os::vm_page_size();
     3647  if (actual_reserve_size < min_stack_allowed) {
     3648    tty->print_cr("\nThe stack size specified is too small, "
     3649                  "Specify at least %dk",
     3650                  min_stack_allowed / K);
     3651    return JNI_ERR;
    35293652  }
    35303653
     
    36103733    return -1;
    36113734  }
    3612   hpi::native_path(strcpy(pathbuf, path));
     3735  os::native_path(strcpy(pathbuf, path));
    36133736  int ret = ::stat(pathbuf, sbuf);
    36143737  if (sbuf != NULL && UseUTCFileTimestamp) {
     
    37543877}
    37553878
     3879// This method is a slightly reworked copy of JDK's sysOpen
     3880// from src/windows/hpi/src/sys_api_md.c
     3881
     3882int os::open(const char *path, int oflag, int mode) {
     3883  char pathbuf[MAX_PATH];
     3884
     3885  if (strlen(path) > MAX_PATH - 1) {
     3886    errno = ENAMETOOLONG;
     3887          return -1;
     3888  }
     3889  os::native_path(strcpy(pathbuf, path));
     3890  return ::open(pathbuf, oflag | O_BINARY | O_NOINHERIT, mode);
     3891}
     3892
    37563893// Is a (classpath) directory empty?
    37573894bool os::dir_is_empty(const char* path) {
     
    37843921}
    37853922
     3923
     3924jlong os::lseek(int fd, jlong offset, int whence) {
     3925  return (jlong) ::_lseeki64(fd, offset, whence);
     3926}
     3927
     3928// This method is a slightly reworked copy of JDK's sysNativePath
     3929// from src/windows/hpi/src/path_md.c
     3930
     3931/* Convert a pathname to native format.  On win32, this involves forcing all
     3932   separators to be '\\' rather than '/' (both are legal inputs, but Win95
     3933   sometimes rejects '/') and removing redundant separators.  The input path is
     3934   assumed to have been converted into the character encoding used by the local
     3935   system.  Because this might be a double-byte encoding, care is taken to
     3936   treat double-byte lead characters correctly.
     3937
     3938   This procedure modifies the given path in place, as the result is never
     3939   longer than the original.  There is no error return; this operation always
     3940   succeeds. */
     3941char * os::native_path(char *path) {
     3942  char *src = path, *dst = path, *end = path;
     3943  char *colon = NULL;           /* If a drive specifier is found, this will
     3944                                        point to the colon following the drive
     3945                                        letter */
     3946
     3947  /* Assumption: '/', '\\', ':', and drive letters are never lead bytes */
     3948  assert(((!::IsDBCSLeadByte('/'))
     3949    && (!::IsDBCSLeadByte('\\'))
     3950    && (!::IsDBCSLeadByte(':'))),
     3951    "Illegal lead byte");
     3952
     3953  /* Check for leading separators */
     3954#define isfilesep(c) ((c) == '/' || (c) == '\\')
     3955  while (isfilesep(*src)) {
     3956    src++;
     3957  }
     3958
     3959  if (::isalpha(*src) && !::IsDBCSLeadByte(*src) && src[1] == ':') {
     3960    /* Remove leading separators if followed by drive specifier.  This
     3961      hack is necessary to support file URLs containing drive
     3962      specifiers (e.g., "file://c:/path").  As a side effect,
     3963      "/c:/path" can be used as an alternative to "c:/path". */
     3964    *dst++ = *src++;
     3965    colon = dst;
     3966    *dst++ = ':';
     3967    src++;
     3968  } else {
     3969    src = path;
     3970    if (isfilesep(src[0]) && isfilesep(src[1])) {
     3971      /* UNC pathname: Retain first separator; leave src pointed at
     3972         second separator so that further separators will be collapsed
     3973         into the second separator.  The result will be a pathname
     3974         beginning with "\\\\" followed (most likely) by a host name. */
     3975      src = dst = path + 1;
     3976      path[0] = '\\';     /* Force first separator to '\\' */
     3977    }
     3978  }
     3979
     3980  end = dst;
     3981
     3982  /* Remove redundant separators from remainder of path, forcing all
     3983      separators to be '\\' rather than '/'. Also, single byte space
     3984      characters are removed from the end of the path because those
     3985      are not legal ending characters on this operating system.
     3986  */
     3987  while (*src != '\0') {
     3988    if (isfilesep(*src)) {
     3989      *dst++ = '\\'; src++;
     3990      while (isfilesep(*src)) src++;
     3991      if (*src == '\0') {
     3992        /* Check for trailing separator */
     3993        end = dst;
     3994        if (colon == dst - 2) break;                      /* "z:\\" */
     3995        if (dst == path + 1) break;                       /* "\\" */
     3996        if (dst == path + 2 && isfilesep(path[0])) {
     3997          /* "\\\\" is not collapsed to "\\" because "\\\\" marks the
     3998            beginning of a UNC pathname.  Even though it is not, by
     3999            itself, a valid UNC pathname, we leave it as is in order
     4000            to be consistent with the path canonicalizer as well
     4001            as the win32 APIs, which treat this case as an invalid
     4002            UNC pathname rather than as an alias for the root
     4003            directory of the current drive. */
     4004          break;
     4005        }
     4006        end = --dst;  /* Path does not denote a root directory, so
     4007                                    remove trailing separator */
     4008        break;
     4009      }
     4010      end = dst;
     4011    } else {
     4012      if (::IsDBCSLeadByte(*src)) { /* Copy a double-byte character */
     4013        *dst++ = *src++;
     4014        if (*src) *dst++ = *src++;
     4015        end = dst;
     4016      } else {         /* Copy a single-byte character */
     4017        char c = *src++;
     4018        *dst++ = c;
     4019        /* Space is not a legal ending character */
     4020        if (c != ' ') end = dst;
     4021      }
     4022    }
     4023  }
     4024
     4025  *end = '\0';
     4026
     4027  /* For "z:", add "." to work around a bug in the C runtime library */
     4028  if (colon == dst - 1) {
     4029          path[2] = '.';
     4030          path[3] = '\0';
     4031  }
     4032
     4033  #ifdef DEBUG
     4034    jio_fprintf(stderr, "sysNativePath: %s\n", path);
     4035  #endif DEBUG
     4036  return path;
     4037}
     4038
     4039// This code is a copy of JDK's sysSetLength
     4040// from src/windows/hpi/src/sys_api_md.c
     4041
     4042int os::ftruncate(int fd, jlong length) {
     4043  HANDLE h = (HANDLE)::_get_osfhandle(fd);
     4044  long high = (long)(length >> 32);
     4045  DWORD ret;
     4046
     4047  if (h == (HANDLE)(-1)) {
     4048    return -1;
     4049  }
     4050
     4051  ret = ::SetFilePointer(h, (long)(length), &high, FILE_BEGIN);
     4052  if ((ret == 0xFFFFFFFF) && (::GetLastError() != NO_ERROR)) {
     4053      return -1;
     4054  }
     4055
     4056  if (::SetEndOfFile(h) == FALSE) {
     4057    return -1;
     4058  }
     4059
     4060  return 0;
     4061}
     4062
     4063
     4064// This code is a copy of JDK's sysSync
     4065// from src/windows/hpi/src/sys_api_md.c
     4066// except for the legacy workaround for a bug in Win 98
     4067
     4068int os::fsync(int fd) {
     4069  HANDLE handle = (HANDLE)::_get_osfhandle(fd);
     4070
     4071  if ( (!::FlushFileBuffers(handle)) &&
     4072         (GetLastError() != ERROR_ACCESS_DENIED) ) {
     4073    /* from winerror.h */
     4074    return -1;
     4075  }
     4076  return 0;
     4077}
     4078
     4079static int nonSeekAvailable(int, long *);
     4080static int stdinAvailable(int, long *);
     4081
     4082#define S_ISCHR(mode)   (((mode) & _S_IFCHR) == _S_IFCHR)
     4083#define S_ISFIFO(mode)  (((mode) & _S_IFIFO) == _S_IFIFO)
     4084
     4085// This code is a copy of JDK's sysAvailable
     4086// from src/windows/hpi/src/sys_api_md.c
     4087
     4088int os::available(int fd, jlong *bytes) {
     4089  jlong cur, end;
     4090  struct _stati64 stbuf64;
     4091
     4092  if (::_fstati64(fd, &stbuf64) >= 0) {
     4093    int mode = stbuf64.st_mode;
     4094    if (S_ISCHR(mode) || S_ISFIFO(mode)) {
     4095      int ret;
     4096      long lpbytes;
     4097      if (fd == 0) {
     4098        ret = stdinAvailable(fd, &lpbytes);
     4099      } else {
     4100        ret = nonSeekAvailable(fd, &lpbytes);
     4101      }
     4102      (*bytes) = (jlong)(lpbytes);
     4103      return ret;
     4104    }
     4105    if ((cur = ::_lseeki64(fd, 0L, SEEK_CUR)) == -1) {
     4106      return FALSE;
     4107    } else if ((end = ::_lseeki64(fd, 0L, SEEK_END)) == -1) {
     4108      return FALSE;
     4109    } else if (::_lseeki64(fd, cur, SEEK_SET) == -1) {
     4110      return FALSE;
     4111    }
     4112    *bytes = end - cur;
     4113    return TRUE;
     4114  } else {
     4115    return FALSE;
     4116  }
     4117}
     4118
     4119// This code is a copy of JDK's nonSeekAvailable
     4120// from src/windows/hpi/src/sys_api_md.c
     4121
     4122static int nonSeekAvailable(int fd, long *pbytes) {
     4123  /* This is used for available on non-seekable devices
     4124    * (like both named and anonymous pipes, such as pipes
     4125    *  connected to an exec'd process).
     4126    * Standard Input is a special case.
     4127    *
     4128    */
     4129  HANDLE han;
     4130
     4131  if ((han = (HANDLE) ::_get_osfhandle(fd)) == (HANDLE)(-1)) {
     4132    return FALSE;
     4133  }
     4134
     4135  if (! ::PeekNamedPipe(han, NULL, 0, NULL, (LPDWORD)pbytes, NULL)) {
     4136        /* PeekNamedPipe fails when at EOF.  In that case we
     4137         * simply make *pbytes = 0 which is consistent with the
     4138         * behavior we get on Solaris when an fd is at EOF.
     4139         * The only alternative is to raise an Exception,
     4140         * which isn't really warranted.
     4141         */
     4142    if (::GetLastError() != ERROR_BROKEN_PIPE) {
     4143      return FALSE;
     4144    }
     4145    *pbytes = 0;
     4146  }
     4147  return TRUE;
     4148}
     4149
     4150#define MAX_INPUT_EVENTS 2000
     4151
     4152// This code is a copy of JDK's stdinAvailable
     4153// from src/windows/hpi/src/sys_api_md.c
     4154
     4155static int stdinAvailable(int fd, long *pbytes) {
     4156  HANDLE han;
     4157  DWORD numEventsRead = 0;      /* Number of events read from buffer */
     4158  DWORD numEvents = 0;  /* Number of events in buffer */
     4159  DWORD i = 0;          /* Loop index */
     4160  DWORD curLength = 0;  /* Position marker */
     4161  DWORD actualLength = 0;       /* Number of bytes readable */
     4162  BOOL error = FALSE;         /* Error holder */
     4163  INPUT_RECORD *lpBuffer;     /* Pointer to records of input events */
     4164
     4165  if ((han = ::GetStdHandle(STD_INPUT_HANDLE)) == INVALID_HANDLE_VALUE) {
     4166        return FALSE;
     4167  }
     4168
     4169  /* Construct an array of input records in the console buffer */
     4170  error = ::GetNumberOfConsoleInputEvents(han, &numEvents);
     4171  if (error == 0) {
     4172    return nonSeekAvailable(fd, pbytes);
     4173  }
     4174
     4175  /* lpBuffer must fit into 64K or else PeekConsoleInput fails */
     4176  if (numEvents > MAX_INPUT_EVENTS) {
     4177    numEvents = MAX_INPUT_EVENTS;
     4178  }
     4179
     4180  lpBuffer = (INPUT_RECORD *)os::malloc(numEvents * sizeof(INPUT_RECORD));
     4181  if (lpBuffer == NULL) {
     4182    return FALSE;
     4183  }
     4184
     4185  error = ::PeekConsoleInput(han, lpBuffer, numEvents, &numEventsRead);
     4186  if (error == 0) {
     4187    os::free(lpBuffer);
     4188    return FALSE;
     4189  }
     4190
     4191  /* Examine input records for the number of bytes available */
     4192  for(i=0; i<numEvents; i++) {
     4193    if (lpBuffer[i].EventType == KEY_EVENT) {
     4194
     4195      KEY_EVENT_RECORD *keyRecord = (KEY_EVENT_RECORD *)
     4196                                      &(lpBuffer[i].Event);
     4197      if (keyRecord->bKeyDown == TRUE) {
     4198        CHAR *keyPressed = (CHAR *) &(keyRecord->uChar);
     4199        curLength++;
     4200        if (*keyPressed == '\r') {
     4201          actualLength = curLength;
     4202        }
     4203      }
     4204    }
     4205  }
     4206
     4207  if(lpBuffer != NULL) {
     4208    os::free(lpBuffer);
     4209  }
     4210
     4211  *pbytes = (long) actualLength;
     4212  return TRUE;
     4213}
    37864214
    37874215// Map a block of memory.
     
    39504378  if (fd != -1) {
    39514379    struct stat buf;
    3952     close(fd);
     4380    ::close(fd);
    39534381    while (::stat(filename, &buf) == 0) {
    39544382      Sleep(100);
     
    41334561    return;
    41344562  }
    4135   else if (time == 0) {
     4563  else if (time == 0 && !isAbsolute) {
    41364564    time = INFINITE;
    41374565  }
     
    43144742bool os::is_headless_jre() { return false; }
    43154743
     4744// OS_SocketInterface
     4745// Not used on Windows
     4746
     4747// OS_SocketInterface
     4748typedef struct hostent * (PASCAL FAR *ws2_ifn_ptr_t)(...);
     4749ws2_ifn_ptr_t *get_host_by_name_fn = NULL;
     4750
     4751typedef CRITICAL_SECTION mutex_t;
     4752#define mutexInit(m)    InitializeCriticalSection(m)
     4753#define mutexDestroy(m) DeleteCriticalSection(m)
     4754#define mutexLock(m)    EnterCriticalSection(m)
     4755#define mutexUnlock(m)  LeaveCriticalSection(m)
     4756
     4757static bool sockfnptrs_initialized = FALSE;
     4758static mutex_t sockFnTableMutex;
     4759
     4760/* is Winsock2 loaded? better to be explicit than to rely on sockfnptrs */
     4761static bool winsock2Available = FALSE;
     4762
     4763
     4764static void initSockFnTable() {
     4765  int (PASCAL FAR* WSAStartupPtr)(WORD, LPWSADATA);
     4766  WSADATA wsadata;
     4767
     4768  ::mutexInit(&sockFnTableMutex);
     4769  ::mutexLock(&sockFnTableMutex);
     4770
     4771  if (sockfnptrs_initialized == FALSE) {
     4772        HMODULE hWinsock;
     4773
     4774          /* try to load Winsock2, and if that fails, load Winsock */
     4775    hWinsock = ::LoadLibrary("ws2_32.dll");
     4776
     4777    if (hWinsock == NULL) {
     4778      jio_fprintf(stderr, "Could not load Winsock 2 (error: %d)\n",
     4779      ::GetLastError());
     4780      return;
     4781    }
     4782
     4783    /* If we loaded a DLL, then we might as well initialize it.  */
     4784    WSAStartupPtr = (int (PASCAL FAR *)(WORD, LPWSADATA))
     4785    ::GetProcAddress(hWinsock, "WSAStartup");
     4786
     4787    if (WSAStartupPtr(MAKEWORD(1,1), &wsadata) != 0) {
     4788        jio_fprintf(stderr, "Could not initialize Winsock\n");
     4789    }
     4790
     4791    get_host_by_name_fn
     4792        = (ws2_ifn_ptr_t*) GetProcAddress(hWinsock, "gethostbyname");
     4793  }
     4794
     4795  assert(get_host_by_name_fn != NULL,
     4796    "gethostbyname function not found");
     4797  sockfnptrs_initialized = TRUE;
     4798  ::mutexUnlock(&sockFnTableMutex);
     4799}
     4800
     4801struct hostent*  os::get_host_by_name(char* name) {
     4802  if (!sockfnptrs_initialized) {
     4803    initSockFnTable();
     4804  }
     4805
     4806  assert(sockfnptrs_initialized == TRUE && get_host_by_name_fn != NULL,
     4807    "sockfnptrs is not initialized or pointer to gethostbyname function is NULL");
     4808  return (*get_host_by_name_fn)(name);
     4809}
     4810
     4811
     4812int os::socket_close(int fd) {
     4813  ShouldNotReachHere();
     4814  return 0;
     4815}
     4816
     4817int os::socket_available(int fd, jint *pbytes) {
     4818  ShouldNotReachHere();
     4819  return 0;
     4820}
     4821
     4822int os::socket(int domain, int type, int protocol) {
     4823  ShouldNotReachHere();
     4824  return 0;
     4825}
     4826
     4827int os::listen(int fd, int count) {
     4828  ShouldNotReachHere();
     4829  return 0;
     4830}
     4831
     4832int os::connect(int fd, struct sockaddr *him, int len) {
     4833  ShouldNotReachHere();
     4834  return 0;
     4835}
     4836
     4837int os::accept(int fd, struct sockaddr *him, int *len) {
     4838  ShouldNotReachHere();
     4839  return 0;
     4840}
     4841
     4842int os::sendto(int fd, char *buf, int len, int flags,
     4843                        struct sockaddr *to, int tolen) {
     4844  ShouldNotReachHere();
     4845  return 0;
     4846}
     4847
     4848int os::recvfrom(int fd, char *buf, int nBytes, int flags,
     4849                         sockaddr *from, int *fromlen) {
     4850  ShouldNotReachHere();
     4851  return 0;
     4852}
     4853
     4854int os::recv(int fd, char *buf, int nBytes, int flags) {
     4855  ShouldNotReachHere();
     4856  return 0;
     4857}
     4858
     4859int os::send(int fd, char *buf, int nBytes, int flags) {
     4860  ShouldNotReachHere();
     4861  return 0;
     4862}
     4863
     4864int os::raw_send(int fd, char *buf, int nBytes, int flags) {
     4865  ShouldNotReachHere();
     4866  return 0;
     4867}
     4868
     4869int os::timeout(int fd, long timeout) {
     4870  ShouldNotReachHere();
     4871  return 0;
     4872}
     4873
     4874int os::get_host_name(char* name, int namelen) {
     4875  ShouldNotReachHere();
     4876  return 0;
     4877}
     4878
     4879int os::socket_shutdown(int fd, int howto) {
     4880  ShouldNotReachHere();
     4881  return 0;
     4882}
     4883
     4884int os::bind(int fd, struct sockaddr *him, int len) {
     4885  ShouldNotReachHere();
     4886  return 0;
     4887}
     4888
     4889int os::get_sock_name(int fd, struct sockaddr *him, int *len) {
     4890  ShouldNotReachHere();
     4891  return 0;
     4892}
     4893
     4894int os::get_sock_opt(int fd, int level, int optname,
     4895                             char *optval, int* optlen) {
     4896  ShouldNotReachHere();
     4897  return 0;
     4898}
     4899
     4900int os::set_sock_opt(int fd, int level, int optname,
     4901                             const char *optval, int optlen) {
     4902  ShouldNotReachHere();
     4903  return 0;
     4904}
  • trunk/openjdk/hotspot/src/os/windows/vm/os_windows.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2222 *
    2323 */
     24
     25#ifndef OS_WINDOWS_VM_OS_WINDOWS_HPP
     26#define OS_WINDOWS_VM_OS_WINDOWS_HPP
    2427
    2528// Win32_OS defines the interface to windows operating systems
     
    125128
    126129} ;
     130
     131#endif // OS_WINDOWS_VM_OS_WINDOWS_HPP
  • trunk/openjdk/hotspot/src/os/windows/vm/os_windows.inline.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP
     26#define OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP
     27
     28#include "runtime/atomic.hpp"
     29#include "runtime/os.hpp"
     30#ifdef TARGET_OS_ARCH_windows_x86
     31# include "atomic_windows_x86.inline.hpp"
     32# include "orderAccess_windows_x86.inline.hpp"
     33#endif
     34
    2535inline const char* os::file_separator()                { return "\\"; }
    2636inline const char* os::line_separator()                { return "\r\n"; }
    2737inline const char* os::path_separator()                { return ";"; }
     38inline const char* os::dll_file_extension()            { return ".dll"; }
    2839
    2940#ifdef __EMX__
     
    3546#endif
    3647
     48inline const int os::default_file_open_flags() { return O_BINARY | O_NOINHERIT;}
     49
    3750// File names are case-insensitive on windows only
    3851inline int os::file_name_strcmp(const char* s, const char* t) {
    3952  return _stricmp(s, t);
     53}
     54
     55inline void  os::dll_unload(void *lib) {
     56  ::FreeLibrary((HMODULE)lib);
     57}
     58
     59inline void* os::dll_lookup(void *lib, const char *name) {
     60  return (void*)::GetProcAddress((HMODULE)lib, name);
    4061}
    4162
     
    7899inline bool os::numa_has_static_binding()   { return true;   }
    79100inline bool os::numa_has_group_homing()     { return false;  }
     101
     102inline size_t os::read(int fd, void *buf, unsigned int nBytes) {
     103  return ::read(fd, buf, nBytes);
     104}
     105
     106inline size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) {
     107  return ::read(fd, buf, nBytes);
     108}
     109
     110inline size_t os::write(int fd, const void *buf, unsigned int nBytes) {
     111  return ::write(fd, buf, nBytes);
     112}
     113
     114inline int os::close(int fd) {
     115  return ::close(fd);
     116}
     117#endif // OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP
  • trunk/openjdk/hotspot/src/os/windows/vm/perfMemory_windows.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_perfMemory_windows.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_windows.inline.hpp"
     31#include "runtime/handles.inline.hpp"
     32#include "runtime/perfMemory.hpp"
     33#include "utilities/exceptions.hpp"
    2734
    2835#include <windows.h>
     
    894901                        (sizeof(ACCESS_ALLOWED_ACE) - sizeof(DWORD)) * ace_count;
    895902  for (int i = 0; i < ace_count; i++) {
     903     assert(aces[i].pSid != 0, "pSid should not be 0");
    896904     newACLsize += GetLengthSid(aces[i].pSid);
    897905  }
     
    10901098  aces[0].pSid = get_user_sid(GetCurrentProcess());
    10911099  aces[0].mask = umask;
     1100
     1101  if (aces[0].pSid == 0)
     1102    return NULL;
    10921103
    10931104  // get the well known SID for BUILTIN\Administrators
  • trunk/openjdk/hotspot/src/os/windows/vm/stubRoutines_windows.cpp

    r278 r309  
    11/*
    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.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_stubRoutines_windows.cpp.incl"
     25#include "precompiled.hpp"
     26#include "runtime/os.hpp"
     27#include "runtime/stubRoutines.hpp"
     28
  • trunk/openjdk/hotspot/src/os/windows/vm/threadCritical_windows.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_threadCritical_windows.cpp.incl"
     25#include "precompiled.hpp"
     26#include "runtime/threadCritical.hpp"
     27#include "thread_windows.inline.hpp"
    2728
    2829// OS-includes here
  • trunk/openjdk/hotspot/src/os/windows/vm/thread_windows.inline.hpp

    r278 r309  
    11/*
    2  * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
     25#ifndef OS_WINDOWS_VM_THREAD_WINDOWS_INLINE_HPP
     26#define OS_WINDOWS_VM_THREAD_WINDOWS_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_windows_x86
     33# include "atomic_windows_x86.inline.hpp"
     34# include "orderAccess_windows_x86.inline.hpp"
     35# include "prefetch_windows_x86.inline.hpp"
     36#endif
     37
    2538// Contains inlined functions for class Thread and ThreadLocalStorage
    2639
    2740inline void ThreadLocalStorage::pd_invalidate_all()            { return; }
     41
     42#endif // OS_WINDOWS_VM_THREAD_WINDOWS_INLINE_HPP
  • trunk/openjdk/hotspot/src/os/windows/vm/vmError_windows.cpp

    r278 r309  
    11/*
    2  * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    2323 */
    2424
    25 # include "incls/_precompiled.incl"
    26 # include "incls/_vmError_windows.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"
    2730
    2831
Note: See TracChangeset for help on using the changeset viewer.