src/jdk.hotspot.agent/solaris/native/libsaproc/libproc.h
author sgehwolf
Wed, 06 Nov 2019 18:06:36 +0100
changeset 59120 fc68b2cdfeeb
parent 48166 2659c4fe8ea7
permissions -rw-r--r--
8233712: Limit default tests jobs based on ulimit -u setting Reviewed-by: erikj, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
48166
2659c4fe8ea7 8191324: SA cleanup -- part 2
jgeorge
parents: 47216
diff changeset
     2
 * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
 * Interfaces available from the process control library, libproc.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
 * libproc provides process control functions for the /proc tools
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
 * (commands in /usr/proc/bin), /usr/bin/truss, and /usr/bin/gcore.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
 * libproc is a private support library for these commands only.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
 * It is _not_ a public interface, although it might become one
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
 * in the fullness of time, when the interfaces settle down.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
 * In the meantime, be aware that any program linked with libproc in this
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
 * release of Solaris is almost guaranteed to break in the next release.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
 * In short, do not use this header file or libproc for any purpose.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
#ifndef _LIBPROC_H
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
#define _LIBPROC_H
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
#include <stdlib.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
#include <unistd.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
#include <fcntl.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
#include <nlist.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
#include <door.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
#include <gelf.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
#include <proc_service.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
#include <rtld_db.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
#include <procfs.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
#include <sys/stat.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
#include <sys/statvfs.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
#include <sys/auxv.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
#include <sys/resource.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
#include <sys/socket.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
#include <sys/utsname.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
#ifdef  __cplusplus
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
extern "C" {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
 * Opaque structure tag reference to a process control structure.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
 * Clients of libproc cannot look inside the process control structure.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
 * The implementation of struct ps_prochandle can change w/o affecting clients.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
struct ps_prochandle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
extern  int     _libproc_debug; /* set non-zero to enable debugging fprintfs */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
#if defined(sparc) || defined(__sparc)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
#define R_RVAL1 R_O0            /* register holding a function return value */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
#define R_RVAL2 R_O1            /* 32 more bits for a 64-bit return value */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
#define SYSCALL32 0x91d02008    /* 32-bit syscall (ta 8) instruction */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
#define SYSCALL64 0x91d02040    /* 64-bit syscall (ta 64) instruction */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
typedef uint32_t syscall_t;     /* holds a syscall instruction */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
#endif  /* sparc */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
48166
2659c4fe8ea7 8191324: SA cleanup -- part 2
jgeorge
parents: 47216
diff changeset
    80
#if defined(__i386)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
#define R_PC    EIP
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
#define R_SP    UESP
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
#define R_RVAL1 EAX             /* register holding a function return value */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
#define R_RVAL2 EDX             /* 32 more bits for a 64-bit return value */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
#define SYSCALL 0x9a            /* syscall (lcall) instruction opcode */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
typedef uchar_t syscall_t[7];   /* holds a syscall instruction */
48166
2659c4fe8ea7 8191324: SA cleanup -- part 2
jgeorge
parents: 47216
diff changeset
    87
#endif  /* __i386 */
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
#define R_RVAL  R_RVAL1         /* simple function return value register */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
/* maximum sizes of things */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
#define PRMAXSIG        (32 * sizeof (sigset_t) / sizeof (uint32_t))
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
#define PRMAXFAULT      (32 * sizeof (fltset_t) / sizeof (uint32_t))
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
#define PRMAXSYS        (32 * sizeof (sysset_t) / sizeof (uint32_t))
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
/* State values returned by Pstate() */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
#define PS_RUN          1       /* process is running */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
#define PS_STOP         2       /* process is stopped */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
#define PS_LOST         3       /* process is lost to control (EAGAIN) */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
#define PS_UNDEAD       4       /* process is terminated (zombie) */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
#define PS_DEAD         5       /* process is terminated (core file) */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
/* Flags accepted by Pgrab() */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
#define PGRAB_RETAIN    0x01    /* Retain tracing flags, else clear flags */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
#define PGRAB_FORCE     0x02    /* Open the process w/o O_EXCL */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
#define PGRAB_RDONLY    0x04    /* Open the process or core w/ O_RDONLY */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
#define PGRAB_NOSTOP    0x08    /* Open the process but do not stop it */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
/* Error codes from Pcreate() */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
#define C_STRANGE       -1      /* Unanticipated error, errno is meaningful */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
#define C_FORK          1       /* Unable to fork */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
#define C_PERM          2       /* No permission (file set-id or unreadable) */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
#define C_NOEXEC        3       /* Cannot find executable file */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
#define C_INTR          4       /* Interrupt received while creating */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
#define C_LP64          5       /* Program is _LP64, self is _ILP32 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
/* Error codes from Pgrab(), Pfgrab_core(), and Pgrab_core() */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
#define G_STRANGE       -1      /* Unanticipated error, errno is meaningful */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
#define G_NOPROC        1       /* No such process */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
#define G_NOCORE        2       /* No such core file */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
#define G_NOPROCORCORE  3       /* No such proc or core (for proc_arg_grab) */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
#define G_NOEXEC        4       /* Cannot locate executable file */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
#define G_ZOMB          5       /* Zombie process */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
#define G_PERM          6       /* No permission */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
#define G_BUSY          7       /* Another process has control */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
#define G_SYS           8       /* System process */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
#define G_SELF          9       /* Process is self */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
#define G_INTR          10      /* Interrupt received while grabbing */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
#define G_LP64          11      /* Process is _LP64, self is ILP32 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
#define G_FORMAT        12      /* File is not an ELF format core file */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
#define G_ELF           13      /* Libelf error, elf_errno() is meaningful */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
#define G_NOTE          14      /* Required PT_NOTE Phdr not present in core */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
/* Flags accepted by Prelease */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
#define PRELEASE_CLEAR  0x10    /* Clear all tracing flags */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
#define PRELEASE_RETAIN 0x20    /* Retain final tracing flags */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
#define PRELEASE_HANG   0x40    /* Leave the process stopped */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
#define PRELEASE_KILL   0x80    /* Terminate the process */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
typedef struct {        /* argument descriptor for system call (Psyscall) */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
        long    arg_value;      /* value of argument given to system call */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
        void    *arg_object;    /* pointer to object in controlling process */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
        char    arg_type;       /* AT_BYVAL, AT_BYREF */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
        char    arg_inout;      /* AI_INPUT, AI_OUTPUT, AI_INOUT */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
        ushort_t arg_size;      /* if AT_BYREF, size of object in bytes */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
} argdes_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
typedef struct {        /* return values from system call (Psyscall) */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
        int     sys_errno;      /* syscall error number */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
        long    sys_rval1;      /* primary return value from system call */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
        long    sys_rval2;      /* second return value from system call */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
} sysret_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
/* values for type */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
#define AT_BYVAL        1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
#define AT_BYREF        2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
/* values for inout */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
#define AI_INPUT        1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
#define AI_OUTPUT       2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
#define AI_INOUT        3
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
/* maximum number of syscall arguments */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
#define MAXARGS         8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
/* maximum size in bytes of a BYREF argument */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
#define MAXARGL         (4*1024)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
/* Kludges to make things work on Solaris 2.6 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
#if !defined(_LP64) && !defined(PR_MODEL_UNKNOWN)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
#define PR_MODEL_UNKNOWN 0
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
#define PR_MODEL_ILP32  0       /* process data model is ILP32 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
#define PR_MODEL_LP64   2       /* process data model is LP64 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
#define PR_MODEL_NATIVE PR_MODEL_ILP32
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
#define pr_dmodel       pr_filler[0]
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
#define STACK_BIAS      0
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
 * Function prototypes for routines in the process control package.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
extern struct ps_prochandle *Pcreate(const char *, char *const *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
    int *, char *, size_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
extern const char *Pcreate_error(int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
extern struct ps_prochandle *Pgrab(pid_t, int, int *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
extern struct ps_prochandle *Pgrab_core(const char *, const char *, int, int *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
extern struct ps_prochandle *Pfgrab_core(int, const char *, int *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
extern const char *Pgrab_error(int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
extern  int     Preopen(struct ps_prochandle *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
extern  void    Prelease(struct ps_prochandle *, int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
extern  void    Pfree(struct ps_prochandle *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
extern  int     Pasfd(struct ps_prochandle *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
extern  int     Pctlfd(struct ps_prochandle *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
extern  int     Pcreate_agent(struct ps_prochandle *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
extern  void    Pdestroy_agent(struct ps_prochandle *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
extern  int     Pwait(struct ps_prochandle *, uint_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
extern  int     Pstop(struct ps_prochandle *, uint_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
extern  int     Pstate(struct ps_prochandle *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
extern  const psinfo_t *Ppsinfo(struct ps_prochandle *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
extern  const pstatus_t *Pstatus(struct ps_prochandle *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
extern  int     Pcred(struct ps_prochandle *, prcred_t *, int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
extern  int     Pgetareg(struct ps_prochandle *, int, prgreg_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
extern  int     Pputareg(struct ps_prochandle *, int, prgreg_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
extern  int     Psetrun(struct ps_prochandle *, int, int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
extern  ssize_t Pread(struct ps_prochandle *, void *, size_t, uintptr_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
extern  ssize_t Pread_string(struct ps_prochandle *, char *, size_t, uintptr_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
extern  ssize_t Pwrite(struct ps_prochandle *, const void *, size_t, uintptr_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
extern  int     Pclearsig(struct ps_prochandle *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
extern  int     Pclearfault(struct ps_prochandle *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
extern  int     Psetbkpt(struct ps_prochandle *, uintptr_t, ulong_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
extern  int     Pdelbkpt(struct ps_prochandle *, uintptr_t, ulong_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
extern  int     Pxecbkpt(struct ps_prochandle *, ulong_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
extern  int     Psetflags(struct ps_prochandle *, long);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
extern  int     Punsetflags(struct ps_prochandle *, long);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
extern  int     Psignal(struct ps_prochandle *, int, int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
extern  int     Pfault(struct ps_prochandle *, int, int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
extern  int     Psysentry(struct ps_prochandle *, int, int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
extern  int     Psysexit(struct ps_prochandle *, int, int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
extern  void    Psetsignal(struct ps_prochandle *, const sigset_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
extern  void    Psetfault(struct ps_prochandle *, const fltset_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
extern  void    Psetsysentry(struct ps_prochandle *, const sysset_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
extern  void    Psetsysexit(struct ps_prochandle *, const sysset_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
extern  void    Psync(struct ps_prochandle *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
extern  sysret_t Psyscall(struct ps_prochandle *, int, uint_t, argdes_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
extern  int     Pisprocdir(struct ps_prochandle *, const char *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
 * Function prototypes for system calls forced on the victim process.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
extern  int     pr_open(struct ps_prochandle *, const char *, int, mode_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
extern  int     pr_creat(struct ps_prochandle *, const char *, mode_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
extern  int     pr_close(struct ps_prochandle *, int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
extern  int     pr_door_info(struct ps_prochandle *, int, struct door_info *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
extern  void    *pr_mmap(struct ps_prochandle *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
                        void *, size_t, int, int, int, off_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
extern  void    *pr_zmap(struct ps_prochandle *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
                        void *, size_t, int, int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
extern  int     pr_munmap(struct ps_prochandle *, void *, size_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
extern  int     pr_memcntl(struct ps_prochandle *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
                        caddr_t, size_t, int, caddr_t, int, int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
extern  int     pr_sigaction(struct ps_prochandle *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
                        int, const struct sigaction *, struct sigaction *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
extern  int     pr_getitimer(struct ps_prochandle *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
                        int, struct itimerval *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
extern  int     pr_setitimer(struct ps_prochandle *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
                        int, const struct itimerval *, struct itimerval *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
extern  int     pr_ioctl(struct ps_prochandle *, int, int, void *, size_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
extern  int     pr_fcntl(struct ps_prochandle *, int, int, void *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
extern  int     pr_stat(struct ps_prochandle *, const char *, struct stat *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
extern  int     pr_lstat(struct ps_prochandle *, const char *, struct stat *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
extern  int     pr_fstat(struct ps_prochandle *, int, struct stat *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
extern  int     pr_statvfs(struct ps_prochandle *, const char *, statvfs_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
extern  int     pr_fstatvfs(struct ps_prochandle *, int, statvfs_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
extern  int     pr_getrlimit(struct ps_prochandle *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
                        int, struct rlimit *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
extern  int     pr_setrlimit(struct ps_prochandle *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
                        int, const struct rlimit *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
#if defined(_LARGEFILE64_SOURCE)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
extern  int     pr_getrlimit64(struct ps_prochandle *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
                        int, struct rlimit64 *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
extern  int     pr_setrlimit64(struct ps_prochandle *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
                        int, const struct rlimit64 *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
#endif  /* _LARGEFILE64_SOURCE */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
extern  int     pr_lwp_exit(struct ps_prochandle *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
extern  int     pr_exit(struct ps_prochandle *, int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
extern  int     pr_waitid(struct ps_prochandle *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
                        idtype_t, id_t, siginfo_t *, int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
extern  off_t   pr_lseek(struct ps_prochandle *, int, off_t, int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
extern  offset_t pr_llseek(struct ps_prochandle *, int, offset_t, int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
extern  int     pr_rename(struct ps_prochandle *, const char *, const char *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
extern  int     pr_link(struct ps_prochandle *, const char *, const char *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
extern  int     pr_unlink(struct ps_prochandle *, const char *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
extern  int     pr_getpeername(struct ps_prochandle *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
                        int, struct sockaddr *, socklen_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
extern  int     pr_getsockname(struct ps_prochandle *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
                        int, struct sockaddr *, socklen_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
 * Function prototypes for accessing per-LWP register information.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
extern int Plwp_getregs(struct ps_prochandle *, lwpid_t, prgregset_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
extern int Plwp_setregs(struct ps_prochandle *, lwpid_t, const prgregset_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
extern int Plwp_getfpregs(struct ps_prochandle *, lwpid_t, prfpregset_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
extern int Plwp_setfpregs(struct ps_prochandle *, lwpid_t,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
    const prfpregset_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
#if defined(sparc) || defined(__sparc)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
extern int Plwp_getxregs(struct ps_prochandle *, lwpid_t, prxregset_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
extern int Plwp_setxregs(struct ps_prochandle *, lwpid_t, const prxregset_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
#if defined(__sparcv9)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
extern int Plwp_getasrs(struct ps_prochandle *, lwpid_t, asrset_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
extern int Plwp_setasrs(struct ps_prochandle *, lwpid_t, const asrset_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
#endif  /* __sparcv9 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
#endif  /* __sparc */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
extern int Plwp_getpsinfo(struct ps_prochandle *, lwpid_t, lwpsinfo_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
 * LWP iteration interface.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
typedef int proc_lwp_f(void *, const lwpstatus_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
extern int Plwp_iter(struct ps_prochandle *, proc_lwp_f *, void *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
 * Symbol table interfaces.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
 * Pseudo-names passed to Plookup_by_name() for well-known load objects.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
 * NOTE: It is required that PR_OBJ_EXEC and PR_OBJ_LDSO exactly match
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
 * the definitions of PS_OBJ_EXEC and PS_OBJ_LDSO from <proc_service.h>.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
#define PR_OBJ_EXEC     ((const char *)0)       /* search the executable file */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
#define PR_OBJ_LDSO     ((const char *)1)       /* search ld.so.1 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
#define PR_OBJ_EVERY    ((const char *)-1)      /* search every load object */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
 * 'object_name' is the name of a load object obtained from an
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
 * iteration over the process's address space mappings (Pmapping_iter),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
 * or an iteration over the process's mapped objects (Pobject_iter),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
 * or else it is one of the special PR_OBJ_* values above.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
extern int Plookup_by_name(struct ps_prochandle *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
    const char *, const char *, GElf_Sym *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
extern int Plookup_by_addr(struct ps_prochandle *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
    uintptr_t, char *, size_t, GElf_Sym *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
typedef int proc_map_f(void *, const prmap_t *, const char *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
extern int Pmapping_iter(struct ps_prochandle *, proc_map_f *, void *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
extern int Pobject_iter(struct ps_prochandle *, proc_map_f *, void *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
extern const prmap_t *Paddr_to_map(struct ps_prochandle *, uintptr_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
extern const prmap_t *Paddr_to_text_map(struct ps_prochandle *, uintptr_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
extern const prmap_t *Pname_to_map(struct ps_prochandle *, const char *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
extern char *Pplatform(struct ps_prochandle *, char *, size_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
extern int Puname(struct ps_prochandle *, struct utsname *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
extern char *Pexecname(struct ps_prochandle *, char *, size_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
extern char *Pobjname(struct ps_prochandle *, uintptr_t, char *, size_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
extern char *Pgetenv(struct ps_prochandle *, const char *, char *, size_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
extern long Pgetauxval(struct ps_prochandle *, int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
 * Symbol table iteration interface.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
typedef int proc_sym_f(void *, const GElf_Sym *, const char *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
extern int Psymbol_iter(struct ps_prochandle *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
    const char *, int, int, proc_sym_f *, void *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
 * 'which' selects which symbol table and can be one of the following.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
#define PR_SYMTAB       1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
#define PR_DYNSYM       2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
 * 'type' selects the symbols of interest by binding and type.  It is a bit-
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
 * mask of one or more of the following flags, whose order MUST match the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
 * order of STB and STT constants in <sys/elf.h>.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
#define BIND_LOCAL      0x0001
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
#define BIND_GLOBAL     0x0002
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
#define BIND_WEAK       0x0004
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
#define BIND_ANY (BIND_LOCAL|BIND_GLOBAL|BIND_WEAK)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
#define TYPE_NOTYPE     0x0100
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
#define TYPE_OBJECT     0x0200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
#define TYPE_FUNC       0x0400
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
#define TYPE_SECTION    0x0800
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
#define TYPE_FILE       0x1000
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
#define TYPE_ANY (TYPE_NOTYPE|TYPE_OBJECT|TYPE_FUNC|TYPE_SECTION|TYPE_FILE)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
 * This returns the rtld_db agent handle for the process.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
 * The handle will become invalid at the next successful exec() and
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
 * must not be used beyond that point (see Preset_maps(), below).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
extern rd_agent_t *Prd_agent(struct ps_prochandle *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
 * This should be called when an RD_DLACTIVITY event with the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
 * RD_CONSISTENT state occurs via librtld_db's event mechanism.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
 * This makes libproc's address space mappings and symbol tables current.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
extern void Pupdate_maps(struct ps_prochandle *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
 * This must be called after the victim process performs a successful
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
 * exec() if any of the symbol table interface functions have been called
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
 * prior to that point.  This is essential because an exec() invalidates
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
 * all previous symbol table and address space mapping information.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
 * It is always safe to call, but if it is called other than after an
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
 * exec() by the victim process it just causes unnecessary overhead.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
 * The rtld_db agent handle obtained from a previous call to Prd_agent() is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
 * made invalid by Preset_maps() and Prd_agent() must be called again to get
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
 * the new handle.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
extern void Preset_maps(struct ps_prochandle *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
 * Given an address, Ppltdest() determines if this is part of a PLT, and if
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
 * so returns the target address of this PLT entry and a flag indicating
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
 * whether or not this PLT entry has been bound by the run-time linker.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
extern uintptr_t Ppltdest(struct ps_prochandle *, uintptr_t, int *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
 * Stack frame iteration interface.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
 */
9407
c985006c2940 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 5547
diff changeset
   423
typedef int proc_stack_f(
c985006c2940 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 5547
diff changeset
   424
    void *,             /* the cookie given to Pstack_iter() */
c985006c2940 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 5547
diff changeset
   425
    const prgregset_t,  /* the frame's registers */
c985006c2940 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 5547
diff changeset
   426
    uint_t,             /* argc for the frame's function */
c985006c2940 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 5547
diff changeset
   427
    const long *,       /* argv for the frame's function */
c985006c2940 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 5547
diff changeset
   428
    int,                /* bitwise flags describing the frame (see below) */
c985006c2940 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 5547
diff changeset
   429
    int);               /* a signal number */
c985006c2940 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 5547
diff changeset
   430
c985006c2940 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 5547
diff changeset
   431
#define PR_SIGNAL_FRAME    1    /* called by a signal handler */
c985006c2940 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 5547
diff changeset
   432
#define PR_FOUND_SIGNAL    2    /* we found the corresponding signal number */
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
extern int Pstack_iter(struct ps_prochandle *,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
    const prgregset_t, proc_stack_f *, void *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
 * Compute the full pathname of a named directory without using chdir().
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
 * This is useful for dealing with /proc/<pid>/cwd.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
extern char *proc_dirname(const char *, char *, size_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
 * Remove unprintable characters from psinfo.pr_psargs and replace with
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
 * whitespace characters so it is safe for printing.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
extern void proc_unctrl_psinfo(psinfo_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
 * Utility functions for processing arguments which should be /proc files,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
 * pids, and/or core files.  The returned error code can be passed to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
 * Pgrab_error() in order to convert it to an error string.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
#define PR_ARG_PIDS     0x1     /* Allow pid and /proc file arguments */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
#define PR_ARG_CORES    0x2     /* Allow core file arguments */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
#define PR_ARG_ANY      (PR_ARG_PIDS | PR_ARG_CORES)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
extern struct ps_prochandle *proc_arg_grab(const char *, int, int, int *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
extern pid_t proc_arg_psinfo(const char *, int, psinfo_t *, int *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
 * Utility functions for obtaining information via /proc without actually
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
 * performing a Pcreate() or Pgrab():
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
extern int proc_get_auxv(pid_t, auxv_t *, int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
extern int proc_get_cred(pid_t, prcred_t *, int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
extern int proc_get_psinfo(pid_t, psinfo_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
extern int proc_get_status(pid_t, pstatus_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
 * Utility functions for debugging tools to convert numeric fault,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
 * signal, and system call numbers to symbolic names:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
extern char *proc_fltname(int, char *, size_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
extern char *proc_signame(int, char *, size_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
extern char *proc_sysname(int, char *, size_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
#ifdef  __cplusplus
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
#endif  /* _LIBPROC_H */