Print this page
3946 ::gcore
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libproc/common/Pcontrol.h
          +++ new/usr/src/lib/libproc/common/Pcontrol.h
↓ open down ↓ 17 lines elided ↑ open up ↑
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  /*
  26   26   * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
  27   27   * Copyright (c) 2013, Joyent, Inc. All rights reserved.
       28 + * Copyright (c) 2013 by Delphix. All rights reserved.
  28   29   */
  29   30  
  30   31  #ifndef _PCONTROL_H
  31   32  #define _PCONTROL_H
  32   33  
  33   34  /*
  34   35   * Implemention-specific include file for libproc process management.
  35   36   * This is not to be seen by the clients of libproc.
  36   37   */
  37   38  
  38   39  #include <stdio.h>
  39   40  #include <gelf.h>
  40   41  #include <synch.h>
  41   42  #include <procfs.h>
  42   43  #include <rtld_db.h>
  43   44  #include <libproc.h>
  44   45  #include <libctf.h>
  45   46  #include <limits.h>
       47 +#include <libproc.h>
  46   48  
  47   49  #ifdef  __cplusplus
  48   50  extern "C" {
  49   51  #endif
  50   52  
  51   53  #include "Putil.h"
  52   54  
  53   55  /*
  54   56   * Definitions of the process control structures, internal to libproc.
  55   57   * These may change without affecting clients of libproc.
↓ open down ↓ 127 lines elided ↑ open up ↑
 183  185          Elf64_Word e_shnum;     /* shdr count extended to 32 bits */
 184  186          Elf64_Word e_shstrndx;  /* shdr string index extended to 32 bits */
 185  187  } elf_file_header_t;
 186  188  
 187  189  typedef struct elf_file {       /* convenience for managing ELF files */
 188  190          elf_file_header_t e_hdr; /* Extended ELF header */
 189  191          Elf *e_elf;             /* ELF library handle */
 190  192          int e_fd;               /* file descriptor */
 191  193  } elf_file_t;
 192  194  
 193      -typedef struct ps_rwops {       /* ops vector for Pread() and Pwrite() */
 194      -        ssize_t (*p_pread)(struct ps_prochandle *,
 195      -            void *, size_t, uintptr_t);
 196      -        ssize_t (*p_pwrite)(struct ps_prochandle *,
 197      -            const void *, size_t, uintptr_t);
 198      -} ps_rwops_t;
 199      -
 200  195  #define HASHSIZE                1024    /* hash table size, power of 2 */
 201  196  
 202  197  struct ps_prochandle {
 203  198          struct ps_lwphandle **hashtab;  /* hash table for LWPs (Lgrab()) */
 204  199          mutex_t proc_lock;      /* protects hash table; serializes Lgrab() */
 205  200          pstatus_t orig_status;  /* remembered status on Pgrab() */
 206  201          pstatus_t status;       /* status when stopped */
 207  202          psinfo_t psinfo;        /* psinfo_t from last Ppsinfo() request */
 208  203          uintptr_t sysaddr;      /* address of most recent syscall instruction */
 209  204          pid_t   pid;            /* process-ID */
↓ open down ↓ 10 lines elided ↑ open up ↑
 220  215          size_t  map_count;      /* number of mappings */
 221  216          size_t  map_alloc;      /* number of mappings allocated */
 222  217          uint_t  num_files;      /* number of file elements in file_info */
 223  218          plist_t file_head;      /* head of mapped files w/ symbol table info */
 224  219          char    *execname;      /* name of the executable file */
 225  220          auxv_t  *auxv;          /* the process's aux vector */
 226  221          int     nauxv;          /* number of aux vector entries */
 227  222          rd_agent_t *rap;        /* cookie for rtld_db */
 228  223          map_info_t *map_exec;   /* the mapping for the executable file */
 229  224          map_info_t *map_ldso;   /* the mapping for ld.so.1 */
 230      -        const ps_rwops_t *ops;  /* pointer to ops-vector for read and write */
 231      -        core_info_t *core;      /* information specific to core (if PS_DEAD) */
      225 +        ps_ops_t ops;           /* ops-vector */
 232  226          uintptr_t *ucaddrs;     /* ucontext-list addresses */
 233  227          uint_t  ucnelems;       /* number of elements in the ucaddrs list */
 234  228          char    *zoneroot;      /* cached path to zone root */
 235  229          plist_t fd_head;        /* head of file desc info list */
 236  230          int     num_fd;         /* number of file descs in list */
 237  231          uintptr_t map_missing;  /* first missing mapping in core due to sig */
 238  232          siginfo_t killinfo;     /* signal that interrupted core dump */
 239  233          psinfo_t spymaster;     /* agent LWP's spymaster, if any */
      234 +        void *data;             /* private data */
 240  235  };
 241  236  
 242  237  /* flags */
 243  238  #define CREATED         0x01    /* process was created by Pcreate() */
 244  239  #define SETSIG          0x02    /* set signal trace mask before continuing */
 245  240  #define SETFAULT        0x04    /* set fault trace mask before continuing */
 246  241  #define SETENTRY        0x08    /* set sysentry trace mask before continuing */
 247  242  #define SETEXIT         0x10    /* set sysexit trace mask before continuing */
 248  243  #define SETHOLD         0x20    /* set signal hold mask before continuing */
 249  244  #define SETREGS         0x40    /* set registers before continuing */
      245 +#define INCORE          0x80    /* use in-core data to build symbol tables */
 250  246  
 251  247  struct ps_lwphandle {
 252  248          struct ps_prochandle *lwp_proc; /* process to which this lwp belongs */
 253  249          struct ps_lwphandle *lwp_hash;  /* hash table linked list */
 254  250          lwpstatus_t     lwp_status;     /* status when stopped */
 255  251          lwpsinfo_t      lwp_psinfo;     /* lwpsinfo_t from last Lpsinfo() */
 256  252          lwpid_t         lwp_id;         /* lwp identifier */
 257  253          int             lwp_state;      /* state of the lwp, see "libproc.h" */
 258  254          uint_t          lwp_flags;      /* SETHOLD and/or SETREGS */
 259  255          int             lwp_ctlfd;      /* /proc/<pid>/lwp/<lwpid>/lwpctl */
↓ open down ↓ 57 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX