3991N/A * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A These two files define pt_regs structure differently 0N/A#
endif //sparc or sparcv9 0N/A/************************************************************************************ 0N/A0. This is very minimal subset of Solaris libproc just enough for current application. 0N/APlease note that the bulk of the functionality is from proc_service interface. This 0N/Aadds Pgrab__ and some missing stuff. We hide the difference b/w live process and core 0N/Afile by this interface. 0N/A1. pthread_id unique in both NPTL & LinuxThreads. We store this in 0N/AOSThread::_pthread_id in JVM code. 0N/A2. All threads see the same pid when they call getpid() under NPTL. 0N/AThreads receive different pid under LinuxThreads. We used to save the result of 0N/A::getpid() call in OSThread::_thread_id. This way uniqueness of OSThread::_thread_id 0N/Awas lost under NPTL. Now, we store the result of ::gettid() call in 0N/AOSThread::_thread_id. Because gettid returns actual pid of thread (lwp id), this is 0N/Aunique again. We therefore use OSThread::_thread_id as unique identifier. 0N/A3. There is a unique LWP id under both thread libraries. libthread_db maps pthread_id 0N/Ato its underlying lwp_id under both the thread libraries. thread_info.lwp_id stores 0N/Alwp_id of the thread. The lwp id is nothing but the actual pid of clone'd processes. But 0N/Aunfortunately libthread_db does not work very well for core dumps. So, we get pthread_id 0N/Aonly for processes. For core dumps, we don't use libthread_db at all (like gdb). 0N/A4. ptrace operates on this LWP id under both the thread libraries. When we say 'pid' for 0N/Aptrace call, we refer to lwp_id of the thread. 0N/A5. for core file, we parse ELF files and read data from them. For processes we use 0N/Acombination of ptrace and /proc calls. 0N/A*************************************************************************************/ 0N/A/* copied from user.h which doesn't define this in a struct */ 0N/A// This C bool type must be int for compatibility with Linux calls and 0N/A// it would be a mistake to equivalence it to C++ bool on many platforms 0N/A// attach to a process 0N/A// attach to a core dump 0N/A// release a process or core 0N/A// functions not directly available in Solaris libproc 0N/A// initialize libproc (call this only once per app) 0N/A// pass true to make library verbose 0N/A// get number of threads 0N/A// get lwp_id of n'th thread 0N/A// get regs for a given lwp 0N/A// get number of shared objects 0N/A// get name of n'th lib 0N/A// returns true if given library is found in lib list 0N/A// address->nearest symbol lookup. return NULL for no symbol 0N/A#
endif //__LIBPROC_H_