equal
deleted
inserted
replaced
23 * Use is subject to license terms. |
23 * Use is subject to license terms. |
24 */ |
24 */ |
25 |
25 |
26 /* |
26 /* |
27 * Copyright (c) 2013, Joyent, Inc. All rights reserved. |
27 * Copyright (c) 2013, Joyent, Inc. All rights reserved. |
|
28 * Copyright (c) 2013 by Delphix. All rights reserved. |
28 */ |
29 */ |
29 |
30 |
30 #include <sys/types.h> |
31 #include <sys/types.h> |
31 #include <sys/uio.h> |
32 #include <sys/uio.h> |
32 #include <string.h> |
33 #include <string.h> |
48 * about an lwp in the core file, given its lwpid. |
49 * about an lwp in the core file, given its lwpid. |
49 */ |
50 */ |
50 static lwp_info_t * |
51 static lwp_info_t * |
51 getlwpcore(struct ps_prochandle *P, lwpid_t lwpid) |
52 getlwpcore(struct ps_prochandle *P, lwpid_t lwpid) |
52 { |
53 { |
53 lwp_info_t *lwp = list_next(&P->core->core_lwp_head); |
54 core_info_t *core = P->data; |
|
55 lwp_info_t *lwp = list_next(&core->core_lwp_head); |
54 uint_t i; |
56 uint_t i; |
55 |
57 |
56 for (i = 0; i < P->core->core_nlwp; i++, lwp = list_next(lwp)) { |
58 for (i = 0; i < core->core_nlwp; i++, lwp = list_next(lwp)) { |
57 if (lwp->lwp_id == lwpid) |
59 if (lwp->lwp_id == lwpid) |
58 return (lwp); |
60 return (lwp); |
59 } |
61 } |
60 |
62 |
61 errno = EINVAL; |
63 errno = EINVAL; |
116 |
118 |
117 /* |
119 /* |
118 * If this is a core file, we need to iterate through our list of |
120 * If this is a core file, we need to iterate through our list of |
119 * cached lwp information and then copy out the status. |
121 * cached lwp information and then copy out the status. |
120 */ |
122 */ |
121 if (P->core != NULL && (lwp = getlwpcore(P, lwpid)) != NULL) { |
123 if (P->data != NULL && (lwp = getlwpcore(P, lwpid)) != NULL) { |
122 (void) memcpy(lps, &lwp->lwp_status, sizeof (lwpstatus_t)); |
124 (void) memcpy(lps, &lwp->lwp_status, sizeof (lwpstatus_t)); |
123 return (0); |
125 return (0); |
124 } |
126 } |
125 |
127 |
126 return (-1); |
128 return (-1); |