Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/agent/src/os/solaris/proc/salibproc.h
38841 views
/*1* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/23#ifndef _SALIBPROC_H_24#define _SALIBPROC_H_2526/*27* The following definitions, prototypes are from Solaris libproc.h.28* We used to use the copy of it from Solaris 8.0. But there are29* problems with that approach in building this library across Solaris30* versions. Solaris 10 has libproc.h in /usr/include. And libproc.h31* varies slightly across Solaris versions. On Solaris 9, we get32* 'sysret_t multiply defined' error. This is common minimum subset we33* really need from libproc.h. The libproc.h in the current dir has34* been left for reference and not used in build.35*/3637#include <dlfcn.h>38#include <gelf.h>39#include <procfs.h>40#include <proc_service.h>41#include <fcntl.h>42#include <unistd.h>4344#ifdef __cplusplus45extern "C" {46#endif4748/* extended symbol table information */49typedef struct {50const char *prs_object; /* object name */51const char *prs_name; /* symbol name */52Lmid_t prs_lmid; /* link map id */53uint_t prs_id; /* symbol id */54uint_t prs_table; /* symbol table id */55} prsyminfo_t;5657typedef struct ps_prochandle ps_prochandle_t;5859/*60* 'object_name' is the name of a load object obtained from an61* iteration over the process's address space mappings (Pmapping_iter),62* or an iteration over the process's mapped objects (Pobject_iter),63* or else it is one of the special PR_OBJ_* values above.64*/6566extern int Plookup_by_addr(ps_prochandle_t *, uintptr_t, char *,67size_t, GElf_Sym *, prsyminfo_t *);68extern ps_prochandle_t *proc_arg_grab(const char *, int, int,69int *, const char **);7071typedef int proc_map_f(void *, const prmap_t *, const char *);72extern int Pobject_iter(struct ps_prochandle *, proc_map_f *, void *);7374/*75* Utility functions for processing arguments which should be /proc files,76* pids, and/or core files. The returned error code can be passed to77* Pgrab_error() in order to convert it to an error string.78*/79#define PR_ARG_PIDS 0x1 /* Allow pid and /proc file arguments */80#define PR_ARG_CORES 0x2 /* Allow core file arguments */81#define PR_ARG_ANY (PR_ARG_PIDS | PR_ARG_CORES)8283/* Flags accepted by Pgrab() (partial) */84#define PGRAB_FORCE 0x02 /* Open the process w/o O_EXCL */8586/* Error codes from Pgrab(), Pfgrab_core(), and Pgrab_core() */87#define G_STRANGE -1 /* Unanticipated error, errno is meaningful */88#define G_NOPROC 1 /* No such process */89#define G_NOCORE 2 /* No such core file */90#define G_NOPROCORCORE 3 /* No such proc or core (for proc_arg_grab) */91#define G_NOEXEC 4 /* Cannot locate executable file */92#define G_ZOMB 5 /* Zombie process */93#define G_PERM 6 /* No permission */94#define G_BUSY 7 /* Another process has control */95#define G_SYS 8 /* System process */96#define G_SELF 9 /* Process is self */97#define G_INTR 10 /* Interrupt received while grabbing */98#define G_LP64 11 /* Process is _LP64, self is ILP32 */99#define G_FORMAT 12 /* File is not an ELF format core file */100#define G_ELF 13 /* Libelf error, elf_errno() is meaningful */101#define G_NOTE 14 /* Required PT_NOTE Phdr not present in core */102103extern const pstatus_t *Pstatus(struct ps_prochandle *);104105/* Flags accepted by Prelease (partial) */106#define PRELEASE_CLEAR 0x10 /* Clear all tracing flags */107108extern void Prelease(struct ps_prochandle *, int);109extern int Psetrun(struct ps_prochandle *, int, int);110extern int Pstop(struct ps_prochandle *, uint_t);111112/*113* Stack frame iteration interface.114*/115#ifdef SOLARIS_11_B159_OR_LATER116/* building on Nevada-B159 or later so define the new callback */117typedef int proc_stack_f(118void *, /* the cookie given to Pstack_iter() */119const prgregset_t, /* the frame's registers */120uint_t, /* argc for the frame's function */121const long *, /* argv for the frame's function */122int, /* bitwise flags describing the frame (see below) */123int); /* a signal number */124125#define PR_SIGNAL_FRAME 1 /* called by a signal handler */126#define PR_FOUND_SIGNAL 2 /* we found the corresponding signal number */127#else128/* building on Nevada-B158 or earlier so define the old callback */129typedef int proc_stack_f(void *, const prgregset_t, uint_t, const long *);130#endif131132extern int Pstack_iter(struct ps_prochandle *,133const prgregset_t, proc_stack_f *, void *);134135#define PR_OBJ_EVERY ((const char *)-1) /* search every load object */136137138#ifdef __cplusplus139}140#endif141142#endif /* _SALIBPROC_H_ */143144145