Print this page
8158 Want named threads API
9857 proc manpages should have LIBRARY section
*** 24,34 ****
* Use is subject to license terms.
*/
/*
* Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
! * Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/thread.h>
--- 24,34 ----
* Use is subject to license terms.
*/
/*
* Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
! * Copyright 2018 Joyent, Inc.
*/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/thread.h>
*** 92,102 ****
}
mutex_exit(&fip->fi_lock);
v[0].p_type = PT_NOTE;
v[0].p_flags = PF_R;
! v[0].p_filesz = (sizeof (Note) * (10 + 2 * nlwp + nzomb + nfd))
+ roundup(sizeof (psinfo_t), sizeof (Word))
+ roundup(sizeof (pstatus_t), sizeof (Word))
+ roundup(prgetprivsize(), sizeof (Word))
+ roundup(priv_get_implinfo_size(), sizeof (Word))
+ roundup(strlen(platform) + 1, sizeof (Word))
--- 92,102 ----
}
mutex_exit(&fip->fi_lock);
v[0].p_type = PT_NOTE;
v[0].p_flags = PF_R;
! v[0].p_filesz = (sizeof (Note) * (10 + 3 * nlwp + nzomb + nfd))
+ roundup(sizeof (psinfo_t), sizeof (Word))
+ roundup(sizeof (pstatus_t), sizeof (Word))
+ roundup(prgetprivsize(), sizeof (Word))
+ roundup(priv_get_implinfo_size(), sizeof (Word))
+ roundup(strlen(platform) + 1, sizeof (Word))
*** 105,114 ****
--- 105,115 ----
+ roundup(sizeof (utsname), sizeof (Word))
+ roundup(sizeof (core_content_t), sizeof (Word))
+ roundup(sizeof (prsecflags_t), sizeof (Word))
+ (nlwp + nzomb) * roundup(sizeof (lwpsinfo_t), sizeof (Word))
+ nlwp * roundup(sizeof (lwpstatus_t), sizeof (Word))
+ + nlwp * roundup(sizeof (prlwpname_t), sizeof (Word))
+ nfd * roundup(sizeof (prfdinfo_t), sizeof (Word));
if (curproc->p_agenttp != NULL) {
v[0].p_filesz += sizeof (Note) +
roundup(sizeof (psinfo_t), sizeof (Word));
*** 454,463 ****
--- 455,465 ----
nlwp = p->p_lwpcnt;
nzomb = p->p_zombcnt;
/* for each entry in the lwp directory ... */
for (ldp = p->p_lwpdir; nlwp + nzomb != 0; ldp++) {
+ prlwpname_t name = { 0, };
if ((lep = ldp->ld_entry) == NULL) /* empty slot */
continue;
if ((t = lep->le_thread) != NULL) { /* active lwp */
*** 464,473 ****
--- 466,479 ----
ASSERT(nlwp != 0);
nlwp--;
lwp = ttolwp(t);
mutex_enter(&p->p_lock);
prgetlwpsinfo(t, &bigwad->lwpsinfo);
+ if (t->t_name != NULL) {
+ (void) strlcpy(name.pr_lwpname, t->t_name,
+ sizeof (name.pr_lwpname));
+ }
mutex_exit(&p->p_lock);
} else { /* zombie lwp */
ASSERT(nzomb != 0);
nzomb--;
bzero(&bigwad->lwpsinfo, sizeof (bigwad->lwpsinfo));
*** 474,488 ****
--- 480,498 ----
bigwad->lwpsinfo.pr_lwpid = lep->le_lwpid;
bigwad->lwpsinfo.pr_state = SZOMB;
bigwad->lwpsinfo.pr_sname = 'Z';
bigwad->lwpsinfo.pr_start.tv_sec = lep->le_start;
}
+
+ name.pr_lwpid = bigwad->lwpsinfo.pr_lwpid;
+
error = elfnote(vp, &offset, NT_LWPSINFO,
sizeof (bigwad->lwpsinfo), (caddr_t)&bigwad->lwpsinfo,
rlimit, credp);
if (error)
goto done;
+
if (t == NULL) /* nothing more to do for a zombie */
continue;
mutex_enter(&p->p_lock);
if (t == curthread) {
*** 512,521 ****
--- 522,536 ----
sizeof (bigwad->lwpstatus), (caddr_t)&bigwad->lwpstatus,
rlimit, credp);
if (error)
goto done;
+ if ((error = elfnote(vp, &offset, NT_LWPNAME, sizeof (name),
+ (caddr_t)&name, rlimit, credp)) != 0)
+ goto done;
+
+
#if defined(__sparc)
/*
* Unspilled SPARC register windows.
*/
{