src/os/linux/vm/os_linux.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8007074 Sdiff src/os/linux/vm

src/os/linux/vm/os_linux.hpp

Print this page




  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef OS_LINUX_VM_OS_LINUX_HPP
  26 #define OS_LINUX_VM_OS_LINUX_HPP
  27 
  28 // Linux_OS defines the interface to Linux operating systems
  29 
  30 /* pthread_getattr_np comes with LinuxThreads-0.9-7 on RedHat 7.1 */
  31 typedef int (*pthread_getattr_func_type) (pthread_t, pthread_attr_t *);
  32 
  33 class Linux {
  34   friend class os;

  35 
  36   // For signal-chaining
  37 #define MAXSIGNUM 32
  38   static struct sigaction sigact[MAXSIGNUM]; // saved preinstalled sigactions
  39   static unsigned int sigs;             // mask of signals that have
  40                                         // preinstalled signal handlers
  41   static bool libjsig_is_loaded;        // libjsig that interposes sigaction(),
  42                                         // __sigaction(), signal() is loaded
  43   static struct sigaction *(*get_signal_action)(int);
  44   static struct sigaction *get_preinstalled_handler(int);
  45   static void save_preinstalled_handler(int, struct sigaction&);
  46 
  47   static void check_signal_handler(int sig);
  48 
  49   // For signal flags diagnostics
  50   static int sigflags[MAXSIGNUM];
  51 
  52   static int (*_clock_gettime)(clockid_t, struct timespec *);
  53   static int (*_pthread_getcpuclockid)(pthread_t, clockid_t *);
  54 


  75   static julong available_memory();
  76   static julong physical_memory() { return _physical_memory; }
  77   static void initialize_system_info();
  78 
  79   static int commit_memory_impl(char* addr, size_t bytes, bool exec);
  80   static int commit_memory_impl(char* addr, size_t bytes,
  81                                 size_t alignment_hint, bool exec);
  82 
  83   static void set_glibc_version(const char *s)      { _glibc_version = s; }
  84   static void set_libpthread_version(const char *s) { _libpthread_version = s; }
  85 
  86   static bool supports_variable_stack_size();
  87 
  88   static void set_is_NPTL()                   { _is_NPTL = true;  }
  89   static void set_is_LinuxThreads()           { _is_NPTL = false; }
  90   static void set_is_floating_stack()         { _is_floating_stack = true; }
  91 
  92   static void rebuild_cpu_to_node_map();
  93   static GrowableArray<int>* cpu_to_node()    { return _cpu_to_node; }
  94 





  95   static bool hugetlbfs_sanity_check(bool warn, size_t page_size);








  96 
  97   static void print_full_memory_info(outputStream* st);
  98   static void print_distro_info(outputStream* st);
  99   static void print_libversion_info(outputStream* st);
 100 
 101  public:
 102   static bool _stack_is_executable;
 103   static void *dlopen_helper(const char *name, char *ebuf, int ebuflen);
 104   static void *dll_load_in_vmthread(const char *name, char *ebuf, int ebuflen);
 105 
 106   static void init_thread_fpu_state();
 107   static int  get_fpu_control_word();
 108   static void set_fpu_control_word(int fpu_control);
 109   static pthread_t main_thread(void)                                { return _main_thread; }
 110   // returns kernel thread id (similar to LWP id on Solaris), which can be
 111   // used to access /proc
 112   static pid_t gettid();
 113   static void set_createThread_lock(Mutex* lk)                      { _createThread_lock = lk; }
 114   static Mutex* createThread_lock(void)                             { return _createThread_lock; }
 115   static void hotspot_sigmask(Thread* thread);




  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef OS_LINUX_VM_OS_LINUX_HPP
  26 #define OS_LINUX_VM_OS_LINUX_HPP
  27 
  28 // Linux_OS defines the interface to Linux operating systems
  29 
  30 /* pthread_getattr_np comes with LinuxThreads-0.9-7 on RedHat 7.1 */
  31 typedef int (*pthread_getattr_func_type) (pthread_t, pthread_attr_t *);
  32 
  33 class Linux {
  34   friend class os;
  35   friend class TestReserveMemorySpecial;
  36 
  37   // For signal-chaining
  38 #define MAXSIGNUM 32
  39   static struct sigaction sigact[MAXSIGNUM]; // saved preinstalled sigactions
  40   static unsigned int sigs;             // mask of signals that have
  41                                         // preinstalled signal handlers
  42   static bool libjsig_is_loaded;        // libjsig that interposes sigaction(),
  43                                         // __sigaction(), signal() is loaded
  44   static struct sigaction *(*get_signal_action)(int);
  45   static struct sigaction *get_preinstalled_handler(int);
  46   static void save_preinstalled_handler(int, struct sigaction&);
  47 
  48   static void check_signal_handler(int sig);
  49 
  50   // For signal flags diagnostics
  51   static int sigflags[MAXSIGNUM];
  52 
  53   static int (*_clock_gettime)(clockid_t, struct timespec *);
  54   static int (*_pthread_getcpuclockid)(pthread_t, clockid_t *);
  55 


  76   static julong available_memory();
  77   static julong physical_memory() { return _physical_memory; }
  78   static void initialize_system_info();
  79 
  80   static int commit_memory_impl(char* addr, size_t bytes, bool exec);
  81   static int commit_memory_impl(char* addr, size_t bytes,
  82                                 size_t alignment_hint, bool exec);
  83 
  84   static void set_glibc_version(const char *s)      { _glibc_version = s; }
  85   static void set_libpthread_version(const char *s) { _libpthread_version = s; }
  86 
  87   static bool supports_variable_stack_size();
  88 
  89   static void set_is_NPTL()                   { _is_NPTL = true;  }
  90   static void set_is_LinuxThreads()           { _is_NPTL = false; }
  91   static void set_is_floating_stack()         { _is_floating_stack = true; }
  92 
  93   static void rebuild_cpu_to_node_map();
  94   static GrowableArray<int>* cpu_to_node()    { return _cpu_to_node; }
  95 
  96   static size_t find_large_page_size();
  97   static size_t setup_large_page_size();
  98 
  99   static bool setup_large_page_type(size_t page_size);
 100   static bool transparent_huge_pages_sanity_check(bool warn, size_t pages_size);
 101   static bool hugetlbfs_sanity_check(bool warn, size_t page_size);
 102 
 103   static char* reserve_memory_special_shm(size_t bytes, size_t alignment, char* req_addr, bool exec);
 104   static char* reserve_memory_special_huge_tlbfs(size_t bytes, size_t alignment, char* req_addr, bool exec);
 105   static char* reserve_memory_special_huge_tlbfs_only(size_t bytes, char* req_addr, bool exec);
 106   static char* reserve_memory_special_huge_tlbfs_mixed(size_t bytes, size_t alignment, char* req_addr, bool exec);
 107 
 108   static bool release_memory_special_shm(char* base, size_t bytes);
 109   static bool release_memory_special_huge_tlbfs(char* base, size_t bytes);
 110 
 111   static void print_full_memory_info(outputStream* st);
 112   static void print_distro_info(outputStream* st);
 113   static void print_libversion_info(outputStream* st);
 114 
 115  public:
 116   static bool _stack_is_executable;
 117   static void *dlopen_helper(const char *name, char *ebuf, int ebuflen);
 118   static void *dll_load_in_vmthread(const char *name, char *ebuf, int ebuflen);
 119 
 120   static void init_thread_fpu_state();
 121   static int  get_fpu_control_word();
 122   static void set_fpu_control_word(int fpu_control);
 123   static pthread_t main_thread(void)                                { return _main_thread; }
 124   // returns kernel thread id (similar to LWP id on Solaris), which can be
 125   // used to access /proc
 126   static pid_t gettid();
 127   static void set_createThread_lock(Mutex* lk)                      { _createThread_lock = lk; }
 128   static Mutex* createThread_lock(void)                             { return _createThread_lock; }
 129   static void hotspot_sigmask(Thread* thread);


src/os/linux/vm/os_linux.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File