37 {
38 ssize_t size, increment;
39
40 if (fp->ctf_version > CTF_VERSION_1 &&
41 tp->ctt_size == CTF_LSIZE_SENT) {
42 size = CTF_TYPE_LSIZE(tp);
43 increment = sizeof (ctf_type_t);
44 } else {
45 size = tp->ctt_size;
46 increment = sizeof (ctf_stype_t);
47 }
48
49 if (sizep)
50 *sizep = size;
51 if (incrementp)
52 *incrementp = increment;
53
54 return (size);
55 }
56
57 /*
58 * Iterate over the members of a STRUCT or UNION. We pass the name, member
59 * type, and offset of each member to the specified callback function.
60 */
61 int
62 ctf_member_iter(ctf_file_t *fp, ctf_id_t type, ctf_member_f *func, void *arg)
63 {
64 ctf_file_t *ofp = fp;
65 const ctf_type_t *tp;
66 ssize_t size, increment;
67 uint_t kind, n;
68 int rc;
69
70 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
71 return (CTF_ERR); /* errno is set for us */
72
73 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
74 return (CTF_ERR); /* errno is set for us */
75
76 (void) ctf_get_ctt_size(fp, tp, &size, &increment);
|
37 {
38 ssize_t size, increment;
39
40 if (fp->ctf_version > CTF_VERSION_1 &&
41 tp->ctt_size == CTF_LSIZE_SENT) {
42 size = CTF_TYPE_LSIZE(tp);
43 increment = sizeof (ctf_type_t);
44 } else {
45 size = tp->ctt_size;
46 increment = sizeof (ctf_stype_t);
47 }
48
49 if (sizep)
50 *sizep = size;
51 if (incrementp)
52 *incrementp = increment;
53
54 return (size);
55 }
56
57 void
58 ctf_set_ctt_size(ctf_type_t *tp, ssize_t size)
59 {
60 if (size > CTF_MAX_SIZE) {
61 tp->ctt_size = CTF_LSIZE_SENT;
62 tp->ctt_lsizehi = CTF_SIZE_TO_LSIZE_HI(size);
63 tp->ctt_lsizelo = CTF_SIZE_TO_LSIZE_LO(size);
64 } else {
65 tp->ctt_size = (ushort_t)size;
66 }
67 }
68
69 /*
70 * Iterate over the members of a STRUCT or UNION. We pass the name, member
71 * type, and offset of each member to the specified callback function.
72 */
73 int
74 ctf_member_iter(ctf_file_t *fp, ctf_id_t type, ctf_member_f *func, void *arg)
75 {
76 ctf_file_t *ofp = fp;
77 const ctf_type_t *tp;
78 ssize_t size, increment;
79 uint_t kind, n;
80 int rc;
81
82 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
83 return (CTF_ERR); /* errno is set for us */
84
85 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
86 return (CTF_ERR); /* errno is set for us */
87
88 (void) ctf_get_ctt_size(fp, tp, &size, &increment);
|