nloodin@3783: /* mikael@4153: * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. nloodin@3783: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. nloodin@3783: * nloodin@3783: * This code is free software; you can redistribute it and/or modify it nloodin@3783: * under the terms of the GNU General Public License version 2 only, as nloodin@3783: * published by the Free Software Foundation. nloodin@3783: * nloodin@3783: * This code is distributed in the hope that it will be useful, but WITHOUT nloodin@3783: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or nloodin@3783: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License nloodin@3783: * version 2 for more details (a copy is included in the LICENSE file that nloodin@3783: * accompanied this code). nloodin@3783: * nloodin@3783: * You should have received a copy of the GNU General Public License version nloodin@3783: * 2 along with this work; if not, write to the Free Software Foundation, nloodin@3783: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. nloodin@3783: * nloodin@3783: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA nloodin@3783: * or visit www.oracle.com if you need additional information or have any nloodin@3783: * questions. nloodin@3783: * nloodin@3783: */ nloodin@3783: nloodin@3783: #ifndef OS_POSIX_VM_OS_POSIX_HPP nloodin@3783: #define OS_POSIX_VM_OS_POSIX_HPP nloodin@3783: class Posix { nloodin@3783: friend class os; nloodin@3783: nloodin@3783: protected: nloodin@3783: static void print_distro_info(outputStream* st); nloodin@3783: static void print_rlimit_info(outputStream* st); nloodin@3783: static void print_uname_info(outputStream* st); nloodin@3783: static void print_libversion_info(outputStream* st); nloodin@3783: static void print_load_average(outputStream* st); nloodin@3783: nloodin@3783: nloodin@3783: }; nloodin@3783: rbackman@5424: /* rbackman@5424: * Crash protection for the watcher thread. Wrap the callback rbackman@5424: * with a sigsetjmp and in case of a SIGSEGV/SIGBUS we siglongjmp rbackman@5424: * back. rbackman@5424: * To be able to use this - don't take locks, don't rely on destructors, rbackman@5424: * don't make OS library calls, don't allocate memory, don't print, rbackman@5424: * don't call code that could leave the heap / memory in an inconsistent state, rbackman@5424: * or anything else where we are not in control if we suddenly jump out. rbackman@5424: */ rbackman@5424: class WatcherThreadCrashProtection : public StackObj { rbackman@5424: public: rbackman@5424: WatcherThreadCrashProtection(); rbackman@5424: bool call(os::CrashProtectionCallback& cb); rbackman@5424: rbackman@5424: static void check_crash_protection(int signal, Thread* thread); rbackman@5424: private: rbackman@5424: void restore(); rbackman@5424: sigjmp_buf _jmpbuf; rbackman@5424: }; nloodin@3783: nloodin@3783: #endif