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/Plwpregs.c
          +++ new/usr/src/lib/libproc/common/Plwpregs.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 2006 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
  26   26  /*
  27      - * Copyright (c) 2013, Joyent, Inc. All rights reserved.
       27 + * Copyright 2018 Joyent, Inc.
  28   28   * Copyright (c) 2013 by Delphix. All rights reserved.
  29   29   */
  30   30  
  31   31  #include <sys/types.h>
  32   32  #include <sys/uio.h>
  33   33  #include <string.h>
  34   34  #include <errno.h>
  35   35  #include <limits.h>
  36   36  
  37   37  #include "Pcontrol.h"
↓ open down ↓ 307 lines elided ↑ open up ↑
 345  345          }
 346  346  
 347  347          if ((lwp = getlwpcore(P, lwpid)) != NULL) {
 348  348                  (void) memcpy(lps, &lwp->lwp_psinfo, sizeof (lwpsinfo_t));
 349  349                  return (0);
 350  350          }
 351  351  
 352  352          return (-1);
 353  353  }
 354  354  
      355 +int
      356 +Plwp_getname(struct ps_prochandle *P, lwpid_t lwpid,
      357 +    char *buf, size_t bufsize)
      358 +{
      359 +        char lwpname[THREAD_NAME_MAX];
      360 +        char *from = NULL;
      361 +        lwp_info_t *lwp;
      362 +
      363 +        if (P->state == PS_IDLE) {
      364 +                errno = ENODATA;
      365 +                return (-1);
      366 +        }
      367 +
      368 +        if (P->state != PS_DEAD) {
      369 +                if (getlwpfile(P, lwpid, "lwpname",
      370 +                    lwpname, sizeof (lwpname)) != 0)
      371 +                        return (-1);
      372 +                from = lwpname;
      373 +        } else {
      374 +                if ((lwp = getlwpcore(P, lwpid)) == NULL)
      375 +                        return (-1);
      376 +                from = lwp->lwp_name;
      377 +        }
      378 +
      379 +        if (strlcpy(buf, from, bufsize) >= bufsize) {
      380 +                errno = ENAMETOOLONG;
      381 +                return (-1);
      382 +        }
      383 +
      384 +        return (0);
      385 +}
      386 +
 355  387  int
 356  388  Plwp_getspymaster(struct ps_prochandle *P, lwpid_t lwpid, psinfo_t *ps)
 357  389  {
 358  390          lwpstatus_t lps;
 359  391  
 360  392          if (P->state == PS_IDLE) {
 361  393                  errno = ENODATA;
 362  394                  return (-1);
 363  395          }
 364  396  
↓ open down ↓ 173 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX