Print this page
3946 ::gcore
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
*** 23,32 ****
--- 23,33 ----
* Use is subject to license terms.
*/
/*
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
#include <sys/types.h>
#include <sys/uio.h>
#include <string.h>
*** 48,61 ****
* about an lwp in the core file, given its lwpid.
*/
static lwp_info_t *
getlwpcore(struct ps_prochandle *P, lwpid_t lwpid)
{
! lwp_info_t *lwp = list_next(&P->core->core_lwp_head);
uint_t i;
! for (i = 0; i < P->core->core_nlwp; i++, lwp = list_next(lwp)) {
if (lwp->lwp_id == lwpid)
return (lwp);
}
errno = EINVAL;
--- 49,63 ----
* about an lwp in the core file, given its lwpid.
*/
static lwp_info_t *
getlwpcore(struct ps_prochandle *P, lwpid_t lwpid)
{
! core_info_t *core = P->data;
! lwp_info_t *lwp = list_next(&core->core_lwp_head);
uint_t i;
! for (i = 0; i < core->core_nlwp; i++, lwp = list_next(lwp)) {
if (lwp->lwp_id == lwpid)
return (lwp);
}
errno = EINVAL;
*** 116,126 ****
/*
* If this is a core file, we need to iterate through our list of
* cached lwp information and then copy out the status.
*/
! if (P->core != NULL && (lwp = getlwpcore(P, lwpid)) != NULL) {
(void) memcpy(lps, &lwp->lwp_status, sizeof (lwpstatus_t));
return (0);
}
return (-1);
--- 118,128 ----
/*
* If this is a core file, we need to iterate through our list of
* cached lwp information and then copy out the status.
*/
! if (P->data != NULL && (lwp = getlwpcore(P, lwpid)) != NULL) {
(void) memcpy(lps, &lwp->lwp_status, sizeof (lwpstatus_t));
return (0);
}
return (-1);