Print this page
8158 Want named threads API
9857 proc manpages should have LIBRARY section

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libproc/common/Pcore.c
          +++ new/usr/src/lib/libproc/common/Pcore.c
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2009 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      - * Copyright (c) 2014, Joyent, Inc. All rights reserved.
       27 + * Copyright (c) 2018, Joyent, Inc. All rights reserved.
  28   28   * Copyright (c) 2013 by Delphix. All rights reserved.
  29   29   * Copyright 2015 Gary Mills
  30   30   */
  31   31  
  32   32  #include <sys/types.h>
  33   33  #include <sys/utsname.h>
  34   34  #include <sys/sysmacros.h>
  35   35  #include <sys/proc.h>
  36   36  
  37   37  #include <alloca.h>
↓ open down ↓ 681 lines elided ↑ open up ↑
 719  719  
 720  720          (void) memcpy(&lwp->lwp_psinfo, &lps, sizeof (lps));
 721  721          return (0);
 722  722  
 723  723  err:
 724  724          dprintf("Pgrab_core: failed to read NT_LWPSINFO\n");
 725  725          return (-1);
 726  726  }
 727  727  
 728  728  static int
      729 +note_lwpname(struct ps_prochandle *P, size_t nbytes)
      730 +{
      731 +        prlwpname_t name;
      732 +        lwp_info_t *lwp;
      733 +
      734 +        if (nbytes != sizeof (name) ||
      735 +            read(P->asfd, &name, sizeof (name)) != sizeof (name))
      736 +                goto err;
      737 +
      738 +        if ((lwp = lwpid2info(P, name.pr_lwpid)) == NULL)
      739 +                goto err;
      740 +
      741 +        if (strlcpy(lwp->lwp_name, name.pr_lwpname,
      742 +            sizeof (lwp->lwp_name)) >= sizeof (lwp->lwp_name)) {
      743 +                errno = ENAMETOOLONG;
      744 +                goto err;
      745 +        }
      746 +
      747 +        return (0);
      748 +
      749 +err:
      750 +        dprintf("Pgrab_core: failed to read NT_LWPNAME\n");
      751 +        return (-1);
      752 +}
      753 +
      754 +static int
 729  755  note_fdinfo(struct ps_prochandle *P, size_t nbytes)
 730  756  {
 731  757          prfdinfo_t prfd;
 732  758          fd_info_t *fip;
 733  759  
 734  760          if ((nbytes < sizeof (prfd)) ||
 735  761              (read(P->asfd, &prfd, sizeof (prfd)) != sizeof (prfd))) {
 736  762                  dprintf("Pgrab_core: failed to read NT_FDINFO\n");
 737  763                  return (-1);
 738  764          }
↓ open down ↓ 485 lines elided ↑ open up ↑
1224 1250          note_utsname,           /* 15   NT_UTSNAME              */
1225 1251          note_lwpstatus,         /* 16   NT_LWPSTATUS            */
1226 1252          note_lwpsinfo,          /* 17   NT_LWPSINFO             */
1227 1253          note_priv,              /* 18   NT_PRPRIV               */
1228 1254          note_priv_info,         /* 19   NT_PRPRIVINFO           */
1229 1255          note_content,           /* 20   NT_CONTENT              */
1230 1256          note_zonename,          /* 21   NT_ZONENAME             */
1231 1257          note_fdinfo,            /* 22   NT_FDINFO               */
1232 1258          note_spymaster,         /* 23   NT_SPYMASTER            */
1233 1259          note_secflags,          /* 24   NT_SECFLAGS             */
     1260 +        note_lwpname,           /* 25   NT_LWPNAME              */
1234 1261  };
1235 1262  
1236 1263  static void
1237 1264  core_report_mapping(struct ps_prochandle *P, GElf_Phdr *php)
1238 1265  {
1239 1266          prkillinfo_t killinfo;
1240 1267          siginfo_t *si = &killinfo.prk_info;
1241 1268          char signame[SIG2STR_MAX], sig[64], info[64];
1242 1269          void *addr = (void *)(uintptr_t)php->p_vaddr;
1243 1270  
↓ open down ↓ 1603 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX