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

@@ -23,11 +23,11 @@
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 /*
  * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
- * Copyright 2015 Joyent, Inc.
+ * Copyright 2018 Joyent, Inc.
  * Copyright (c) 2013 by Delphix. All rights reserved.
  */
 
 #define _STRUCTURED_PROC        1
 

@@ -507,10 +507,11 @@
 static int
 new_per_lwp(void *data, const lwpstatus_t *lsp, const lwpsinfo_t *lip)
 {
         pgcore_t *pgc = data;
         struct ps_prochandle *P = pgc->P;
+        prlwpname_t name = { 0, "" };
         psinfo_t ps;
 
         /*
          * If lsp is NULL this indicates that this is a zombie LWP in
          * which case we dump only the lwpsinfo_t structure and none of

@@ -575,10 +576,18 @@
                 }
         }
 #endif  /* __sparcv9 */
 #endif  /* sparc */
 
+        if (Plwp_getname(P, lsp->pr_lwpid, name.pr_lwpname,
+            sizeof (name.pr_lwpname)) == 0) {
+                name.pr_lwpid = lsp->pr_lwpid;
+                if (write_note(pgc->pgc_fd, NT_LWPNAME, &name,
+                    sizeof (name), pgc->pgc_doff) != 0)
+                        return (1);
+        }
+
         if (!(lsp->pr_flags & PR_AGENT))
                 return (0);
 
         if (Plwp_getspymaster(P, lsp->pr_lwpid, &ps) != 0)
                 return (0);