Changeset View
Changeset View
Standalone View
Standalone View
cddl/contrib/opensolaris/common/ctf/ctf_types.c
Show First 20 Lines • Show All 289 Lines • ▼ Show 20 Lines | for (cdp = ctf_list_next(&cd.cd_nodes[prec]); | ||||
ctf_decl_sprintf(&cd, "volatile"); | ctf_decl_sprintf(&cd, "volatile"); | ||||
break; | break; | ||||
case CTF_K_CONST: | case CTF_K_CONST: | ||||
ctf_decl_sprintf(&cd, "const"); | ctf_decl_sprintf(&cd, "const"); | ||||
break; | break; | ||||
case CTF_K_RESTRICT: | case CTF_K_RESTRICT: | ||||
ctf_decl_sprintf(&cd, "restrict"); | ctf_decl_sprintf(&cd, "restrict"); | ||||
break; | break; | ||||
case CTF_K_CONSTVAL: { | |||||
ssize_t increment; | |||||
int32_t i32; | |||||
int64_t i64; | |||||
void *dptr; | |||||
int vlen; | |||||
(void) ctf_get_ctt_size(rfp, tp, NULL, &increment); | |||||
dptr = (void *)((uintptr_t)tp + increment); | |||||
vlen = LCTF_INFO_VLEN(rfp, tp->ctt_info); | |||||
i64 = 0; | |||||
switch (vlen) { | |||||
case 0: | |||||
break; | |||||
case 4: | |||||
memcpy(&i32, dptr, sizeof(i32)); | |||||
i64 = i32; | |||||
break; | |||||
case 8: | |||||
memcpy(&i64, dptr, sizeof(i64)); | |||||
break; | |||||
} | } | ||||
ctf_decl_sprintf(&cd, "constval<%jd>", (intmax_t)i64); | |||||
break; | |||||
} | |||||
} | |||||
k = cdp->cd_kind; | k = cdp->cd_kind; | ||||
} | } | ||||
if (rp == prec) | if (rp == prec) | ||||
ctf_decl_sprintf(&cd, ")"); | ctf_decl_sprintf(&cd, ")"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 172 Lines • ▼ Show 20 Lines | if ((tp = ctf_lookup_by_id(&fp, type)) == NULL) | ||||
return (CTF_ERR); /* errno is set for us */ | return (CTF_ERR); /* errno is set for us */ | ||||
switch (LCTF_INFO_KIND(fp, tp->ctt_info)) { | switch (LCTF_INFO_KIND(fp, tp->ctt_info)) { | ||||
case CTF_K_POINTER: | case CTF_K_POINTER: | ||||
case CTF_K_TYPEDEF: | case CTF_K_TYPEDEF: | ||||
case CTF_K_VOLATILE: | case CTF_K_VOLATILE: | ||||
case CTF_K_CONST: | case CTF_K_CONST: | ||||
case CTF_K_RESTRICT: | case CTF_K_RESTRICT: | ||||
case CTF_K_CONSTVAL: | |||||
return (tp->ctt_type); | return (tp->ctt_type); | ||||
default: | default: | ||||
return (ctf_set_errno(ofp, ECTF_NOTREF)); | return (ctf_set_errno(ofp, ECTF_NOTREF)); | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* Find a pointer to type by looking in fp->ctf_ptrtab. If we can't find a | * Find a pointer to type by looking in fp->ctf_ptrtab. If we can't find a | ||||
▲ Show 20 Lines • Show All 393 Lines • Show Last 20 Lines |