Lines Matching refs:fp
60 ctf_file_t *fp;
73 if ((fp = ctf_bufopen(&cts, NULL, NULL, errp)) == NULL) {
78 fp->ctf_flags |= LCTF_RDWR;
79 fp->ctf_dthashlen = hashlen;
81 fp->ctf_dthash = hash;
82 fp->ctf_dtstrlen = sizeof (_CTF_STRTAB_TEMPLATE);
83 fp->ctf_dtnextid = 1;
84 fp->ctf_dtoldid = 0;
86 return (fp);
92 ctf_file_t *fp;
115 if ((fp = ctf_fdcreate_int(fd, errp, &cts)) == NULL) {
120 fp->ctf_flags |= LCTF_RDWR;
121 fp->ctf_dthashlen = hashlen;
123 fp->ctf_dthash = hash;
124 fp->ctf_dtstrlen = sizeof (_CTF_STRTAB_TEMPLATE);
125 fp->ctf_dtnextid = 1;
126 fp->ctf_dtoldid = 0;
128 return (fp);
226 ctf_ref_inc(ctf_file_t *fp, ctf_id_t tid)
228 ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, tid);
233 if (!(fp->ctf_flags & LCTF_RDWR))
244 ctf_ref_dec(ctf_file_t *fp, ctf_id_t tid)
246 ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, tid);
251 if (!(fp->ctf_flags & LCTF_RDWR))
269 * ctf_bufopen() will return a new ctf_file_t, but we want to keep the fp
278 ctf_update(ctf_file_t *fp)
297 uintptr_t symbase = (uintptr_t)fp->ctf_symtab.cts_data;
298 uintptr_t strbase = (uintptr_t)fp->ctf_strtab.cts_data;
300 if (!(fp->ctf_flags & LCTF_RDWR))
301 return (ctf_set_errno(fp, ECTF_RDONLY));
303 if (!(fp->ctf_flags & LCTF_DIRTY))
316 if (fp->ctf_flags & LCTF_CHILD) {
317 if (fp->ctf_parname == NULL) {
322 plen = strlen(fp->ctf_parname) + 1;
323 plabel = ctf_label_topmost(fp->ctf_parent);
333 for (labelsize = 0, dld = ctf_list_next(&fp->ctf_dldefs);
341 for (size = 0, dtd = ctf_list_next(&fp->ctf_dtdefs);
382 dsd = ctf_list_next(&fp->ctf_dsdefs);
383 for (objsize = 0, funcsize = 0, i = 0; i < fp->ctf_nsyms; i++) {
386 if (fp->ctf_symtab.cts_entsize == sizeof (Elf32_Sym)) {
440 hdr.cth_strlen = fp->ctf_dtstrlen + plen;
448 return (ctf_set_errno(fp, EAGAIN));
469 bcopy(fp->ctf_parname, s, plen);
477 for (dld = ctf_list_next(&fp->ctf_dldefs); dld != NULL;
495 for (dtd = ctf_list_next(&fp->ctf_dtdefs);
584 dsd = ctf_list_next(&fp->ctf_dsdefs);
585 for (i = 0; i < fp->ctf_nsyms; i++) {
587 if (fp->ctf_symtab.cts_entsize == sizeof (Elf32_Sym)) {
637 * is successful, we then switch nfp and fp and free the old container.
648 if (fp->ctf_nsyms == 0) {
652 symp = &fp->ctf_symtab;
653 strp = &fp->ctf_strtab;
658 return (ctf_set_errno(fp, err));
661 (void) ctf_setmodel(nfp, ctf_getmodel(fp));
662 (void) ctf_import(nfp, fp->ctf_parent);
664 nfp->ctf_refcnt = fp->ctf_refcnt;
665 nfp->ctf_flags |= fp->ctf_flags & ~LCTF_DIRTY;
666 nfp->ctf_dthash = fp->ctf_dthash;
667 nfp->ctf_dthashlen = fp->ctf_dthashlen;
668 nfp->ctf_dtdefs = fp->ctf_dtdefs;
669 nfp->ctf_dsdefs = fp->ctf_dsdefs;
670 nfp->ctf_dldefs = fp->ctf_dldefs;
671 nfp->ctf_dtstrlen = fp->ctf_dtstrlen;
672 nfp->ctf_dtnextid = fp->ctf_dtnextid;
673 nfp->ctf_dtoldid = fp->ctf_dtnextid - 1;
674 nfp->ctf_specific = fp->ctf_specific;
676 fp->ctf_dthash = NULL;
677 fp->ctf_dthashlen = 0;
678 bzero(&fp->ctf_dtdefs, sizeof (ctf_list_t));
679 bzero(&fp->ctf_dsdefs, sizeof (ctf_list_t));
680 bzero(&fp->ctf_dldefs, sizeof (ctf_list_t));
689 sname = fp->ctf_symtab.cts_name;
690 bzero(&fp->ctf_symtab, sizeof (ctf_sect_t));
691 fp->ctf_symtab.cts_name = sname;
693 sname = fp->ctf_strtab.cts_name;
694 bzero(&fp->ctf_strtab, sizeof (ctf_sect_t));
695 fp->ctf_strtab.cts_name = sname;
697 bcopy(fp, &ofp, sizeof (ctf_file_t));
698 bcopy(nfp, fp, sizeof (ctf_file_t));
706 fp->ctf_lookups[0].ctl_hash = &fp->ctf_structs;
707 fp->ctf_lookups[1].ctl_hash = &fp->ctf_unions;
708 fp->ctf_lookups[2].ctl_hash = &fp->ctf_enums;
709 fp->ctf_lookups[3].ctl_hash = &fp->ctf_names;
718 ctf_dtd_insert(ctf_file_t *fp, ctf_dtdef_t *dtd)
720 ulong_t h = dtd->dtd_type & (fp->ctf_dthashlen - 1);
722 dtd->dtd_hash = fp->ctf_dthash[h];
723 fp->ctf_dthash[h] = dtd;
724 ctf_list_append(&fp->ctf_dtdefs, dtd);
728 ctf_dtd_delete(ctf_file_t *fp, ctf_dtdef_t *dtd)
730 ulong_t h = dtd->dtd_type & (fp->ctf_dthashlen - 1);
731 ctf_dtdef_t *p, **q = &fp->ctf_dthash[h];
756 fp->ctf_dtstrlen -= len;
759 ctf_ref_dec(fp, dmd->dmd_type);
765 ctf_ref_dec(fp, dtd->dtd_data.ctt_type);
768 ctf_ref_dec(fp, dtd->dtd_u.dtu_argv[i]);
773 ctf_ref_dec(fp, dtd->dtd_u.dtu_arr.ctr_contents);
774 ctf_ref_dec(fp, dtd->dtd_u.dtu_arr.ctr_index);
777 ctf_ref_dec(fp, dtd->dtd_data.ctt_type);
783 ctf_ref_dec(fp, dtd->dtd_data.ctt_type);
790 fp->ctf_dtstrlen -= len;
793 ctf_list_delete(&fp->ctf_dtdefs, dtd);
798 ctf_dtd_lookup(ctf_file_t *fp, ctf_id_t type)
800 ulong_t h = type & (fp->ctf_dthashlen - 1);
803 if (fp->ctf_dthash == NULL)
806 for (dtd = fp->ctf_dthash[h]; dtd != NULL; dtd = dtd->dtd_hash) {
815 ctf_dsd_lookup(ctf_file_t *fp, ulong_t idx)
819 for (dsd = ctf_list_next(&fp->ctf_dsdefs); dsd != NULL;
832 ctf_dsd_insert(ctf_file_t *fp, ctf_dsdef_t *dsd)
836 for (i = ctf_list_next(&fp->ctf_dsdefs); i != NULL;
843 ctf_list_append(&fp->ctf_dsdefs, dsd);
847 ctf_list_insert_before(&fp->ctf_dsdefs, i, dsd);
852 ctf_dsd_delete(ctf_file_t *fp, ctf_dsdef_t *dsd)
857 ctf_list_delete(&fp->ctf_dsdefs, dsd);
862 ctf_dld_lookup(ctf_file_t *fp, const char *name)
866 for (dld = ctf_list_next(&fp->ctf_dldefs); dld != NULL;
876 ctf_dld_insert(ctf_file_t *fp, ctf_dldef_t *dld, uint_t pos)
881 ctf_list_prepend(&fp->ctf_dldefs, dld);
885 for (l = ctf_list_next(&fp->ctf_dldefs); pos != 0 && dld != NULL;
890 ctf_list_append(&fp->ctf_dldefs, dld);
892 ctf_list_insert_before(&fp->ctf_dsdefs, l, dld);
896 ctf_dld_delete(ctf_file_t *fp, ctf_dldef_t *dld)
898 ctf_list_delete(&fp->ctf_dldefs, dld);
903 fp->ctf_dtstrlen -= len;
918 ctf_discard(ctf_file_t *fp)
922 if (!(fp->ctf_flags & LCTF_RDWR))
923 return (ctf_set_errno(fp, ECTF_RDONLY));
925 if (!(fp->ctf_flags & LCTF_DIRTY))
928 for (dtd = ctf_list_prev(&fp->ctf_dtdefs); dtd != NULL; dtd = ntd) {
930 if (dtd->dtd_type <= fp->ctf_dtoldid)
933 ctf_dtd_delete(fp, dtd);
936 fp->ctf_dtnextid = fp->ctf_dtoldid + 1;
937 fp->ctf_flags &= ~LCTF_DIRTY;
943 ctf_add_generic(ctf_file_t *fp, uint_t flag, const char *name, ctf_dtdef_t **rp)
950 return (ctf_set_errno(fp, EINVAL));
952 if (!(fp->ctf_flags & LCTF_RDWR))
953 return (ctf_set_errno(fp, ECTF_RDONLY));
955 if (CTF_INDEX_TO_TYPE(fp->ctf_dtnextid, 1) > CTF_MAX_TYPE)
956 return (ctf_set_errno(fp, ECTF_FULL));
959 return (ctf_set_errno(fp, EAGAIN));
963 return (ctf_set_errno(fp, EAGAIN));
966 type = fp->ctf_dtnextid++;
967 type = CTF_INDEX_TO_TYPE(type, (fp->ctf_flags & LCTF_CHILD));
974 fp->ctf_dtstrlen += strlen(s) + 1;
976 ctf_dtd_insert(fp, dtd);
977 fp->ctf_flags |= LCTF_DIRTY;
984 ctf_add_encoded(ctf_file_t *fp, uint_t flag,
991 return (ctf_set_errno(fp, EINVAL));
993 if ((type = ctf_add_generic(fp, flag, name, &dtd)) == CTF_ERR)
1011 ctf_add_reftype(ctf_file_t *fp, uint_t flag,
1018 return (ctf_set_errno(fp, EINVAL));
1020 if ((type = ctf_add_generic(fp, flag, name, &dtd)) == CTF_ERR)
1023 ctf_ref_inc(fp, ref);
1032 ctf_add_integer(ctf_file_t *fp, uint_t flag,
1035 return (ctf_add_encoded(fp, flag, name, ep, CTF_K_INTEGER));
1039 ctf_add_float(ctf_file_t *fp, uint_t flag,
1042 return (ctf_add_encoded(fp, flag, name, ep, CTF_K_FLOAT));
1046 ctf_add_pointer(ctf_file_t *fp, uint_t flag, const char *name, ctf_id_t ref)
1048 return (ctf_add_reftype(fp, flag, name, ref, CTF_K_POINTER));
1052 ctf_add_array(ctf_file_t *fp, uint_t flag, const ctf_arinfo_t *arp)
1059 return (ctf_set_errno(fp, EINVAL));
1061 fpd = fp;
1063 ctf_dtd_lookup(fp, arp->ctr_contents) == NULL) {
1066 return (ctf_set_errno(fp, ECTF_BADID));
1069 fpd = fp;
1071 ctf_dtd_lookup(fp, arp->ctr_index) == NULL) {
1073 return (ctf_set_errno(fp, ECTF_BADID));
1076 if ((type = ctf_add_generic(fp, flag, NULL, &dtd)) == CTF_ERR)
1082 ctf_ref_inc(fp, arp->ctr_contents);
1083 ctf_ref_inc(fp, arp->ctr_index);
1089 ctf_set_array(ctf_file_t *fp, ctf_id_t type, const ctf_arinfo_t *arp)
1092 ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, type);
1094 if (!(fp->ctf_flags & LCTF_RDWR))
1095 return (ctf_set_errno(fp, ECTF_RDONLY));
1098 return (ctf_set_errno(fp, ECTF_BADID));
1100 fpd = fp;
1102 ctf_dtd_lookup(fp, arp->ctr_contents) == NULL)
1103 return (ctf_set_errno(fp, ECTF_BADID));
1105 fpd = fp;
1107 ctf_dtd_lookup(fp, arp->ctr_index) == NULL)
1108 return (ctf_set_errno(fp, ECTF_BADID));
1110 ctf_ref_dec(fp, dtd->dtd_u.dtu_arr.ctr_contents);
1111 ctf_ref_dec(fp, dtd->dtd_u.dtu_arr.ctr_index);
1112 fp->ctf_flags |= LCTF_DIRTY;
1114 ctf_ref_inc(fp, arp->ctr_contents);
1115 ctf_ref_inc(fp, arp->ctr_index);
1121 ctf_add_funcptr(ctf_file_t *fp, uint_t flag,
1133 return (ctf_set_errno(fp, EINVAL));
1140 return (ctf_set_errno(fp, EOVERFLOW));
1142 fpd = fp;
1144 ctf_dtd_lookup(fp, ctc->ctc_return) == NULL)
1145 return (ctf_set_errno(fp, ECTF_BADID));
1148 fpd = fp;
1150 ctf_dtd_lookup(fp, argv[i]) == NULL)
1151 return (ctf_set_errno(fp, ECTF_BADID));
1155 return (ctf_set_errno(fp, EAGAIN));
1157 if ((type = ctf_add_generic(fp, flag, NULL, &dtd)) == CTF_ERR) {
1165 ctf_ref_inc(fp, ctc->ctc_return);
1167 ctf_ref_inc(fp, argv[i]);
1178 ctf_add_struct(ctf_file_t *fp, uint_t flag, const char *name)
1180 ctf_hash_t *hp = &fp->ctf_structs;
1186 hep = ctf_hash_lookup(hp, fp, name, strlen(name));
1188 if (hep != NULL && ctf_type_kind(fp, hep->h_type) == CTF_K_FORWARD) {
1190 dtd = ctf_dtd_lookup(fp, type);
1196 type = ctf_add_generic(fp, flag, name, &dtd);
1208 fp->ctf_flags |= LCTF_DIRTY;
1214 ctf_add_union(ctf_file_t *fp, uint_t flag, const char *name)
1216 ctf_hash_t *hp = &fp->ctf_unions;
1222 hep = ctf_hash_lookup(hp, fp, name, strlen(name));
1224 if (hep != NULL && ctf_type_kind(fp, hep->h_type) == CTF_K_FORWARD) {
1226 dtd = ctf_dtd_lookup(fp, type);
1232 type = ctf_add_generic(fp, flag, name, &dtd);
1244 fp->ctf_flags |= LCTF_DIRTY;
1250 ctf_add_enum(ctf_file_t *fp, uint_t flag, const char *name)
1252 ctf_hash_t *hp = &fp->ctf_enums;
1258 hep = ctf_hash_lookup(hp, fp, name, strlen(name));
1260 if (hep != NULL && ctf_type_kind(fp, hep->h_type) == CTF_K_FORWARD) {
1262 dtd = ctf_dtd_lookup(fp, type);
1268 type = ctf_add_generic(fp, flag, name, &dtd);
1275 dtd->dtd_data.ctt_size = fp->ctf_dmodel->ctd_int;
1280 fp->ctf_flags |= LCTF_DIRTY;
1286 ctf_add_forward(ctf_file_t *fp, uint_t flag, const char *name, uint_t kind)
1295 hp = &fp->ctf_structs;
1298 hp = &fp->ctf_unions;
1301 hp = &fp->ctf_enums;
1304 return (ctf_set_errno(fp, ECTF_NOTSUE));
1312 fp, name, strlen(name))) != NULL)
1315 if ((type = ctf_add_generic(fp, flag, name, &dtd)) == CTF_ERR)
1325 ctf_add_typedef(ctf_file_t *fp, uint_t flag, const char *name, ctf_id_t ref)
1331 fpd = fp;
1333 ctf_dtd_lookup(fp, ref) == NULL))
1334 return (ctf_set_errno(fp, EINVAL));
1336 if ((type = ctf_add_generic(fp, flag, name, &dtd)) == CTF_ERR)
1341 ctf_ref_inc(fp, ref);
1347 ctf_add_volatile(ctf_file_t *fp, uint_t flag, const char *name, ctf_id_t ref)
1349 return (ctf_add_reftype(fp, flag, name, ref, CTF_K_VOLATILE));
1353 ctf_add_const(ctf_file_t *fp, uint_t flag, const char *name, ctf_id_t ref)
1355 return (ctf_add_reftype(fp, flag, name, ref, CTF_K_CONST));
1359 ctf_add_restrict(ctf_file_t *fp, uint_t flag, const char *name, ctf_id_t ref)
1361 return (ctf_add_reftype(fp, flag, name, ref, CTF_K_RESTRICT));
1365 ctf_add_enumerator(ctf_file_t *fp, ctf_id_t enid, const char *name, int value)
1367 ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, enid);
1374 return (ctf_set_errno(fp, EINVAL));
1376 if (!(fp->ctf_flags & LCTF_RDWR))
1377 return (ctf_set_errno(fp, ECTF_RDONLY));
1380 return (ctf_set_errno(fp, ECTF_BADID));
1387 return (ctf_set_errno(fp, ECTF_NOTENUM));
1390 return (ctf_set_errno(fp, ECTF_DTFULL));
1396 return (ctf_set_errno(fp, ECTF_DUPMEMBER));
1401 return (ctf_set_errno(fp, EAGAIN));
1405 return (ctf_set_errno(fp, EAGAIN));
1416 fp->ctf_dtstrlen += strlen(s) + 1;
1417 fp->ctf_flags |= LCTF_DIRTY;
1423 ctf_add_member(ctf_file_t *fp, ctf_id_t souid, const char *name, ctf_id_t type,
1426 ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, souid);
1435 if (!(fp->ctf_flags & LCTF_RDWR))
1436 return (ctf_set_errno(fp, ECTF_RDONLY));
1439 return (ctf_set_errno(fp, ECTF_BADID));
1446 return (ctf_set_errno(fp, ECTF_NOTSOU));
1449 return (ctf_set_errno(fp, ECTF_DTFULL));
1461 return (ctf_set_errno(fp, ECTF_DUPMEMBER));
1466 if ((msize = ctf_type_size(fp, type)) == CTF_ERR ||
1467 (malign = ctf_type_align(fp, type)) == CTF_ERR ||
1468 (mkind = ctf_type_kind(fp, type)) == CTF_ERR)
1480 if (ctf_type_encoding(fp, type, &e) == CTF_ERR)
1496 return (ctf_set_errno(fp, EINVAL));
1504 return (ctf_set_errno(fp, EAGAIN));
1508 return (ctf_set_errno(fp, EAGAIN));
1517 ctf_id_t ltype = ctf_type_resolve(fp, lmd->dmd_type);
1525 if (ctf_type_encoding(fp, ltype, &linfo) != CTF_ERR)
1527 else if ((lsize = ctf_type_size(fp, ltype)) != CTF_ERR)
1550 ssize = ctf_get_ctt_size(fp, &dtd->dtd_data, NULL, NULL);
1565 fp->ctf_dtstrlen += strlen(s) + 1;
1567 ctf_ref_inc(fp, type);
1568 fp->ctf_flags |= LCTF_DIRTY;
1581 ctf_delete_type(ctf_file_t *fp, ctf_id_t type)
1584 ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, type);
1586 if (!(fp->ctf_flags & LCTF_RDWR))
1587 return (ctf_set_errno(fp, ECTF_RDONLY));
1594 fpd = fp;
1596 ctf_dtd_lookup(fp, type) == NULL)
1600 return (ctf_set_errno(fp, ECTF_NOTDYN));
1602 if (dtd->dtd_ref != 0 || fp->ctf_refcnt > 1)
1603 return (ctf_set_errno(fp, ECTF_REFERENCED));
1605 ctf_dtd_delete(fp, dtd);
1606 fp->ctf_flags |= LCTF_DIRTY;
1975 ctf_add_function(ctf_file_t *fp, ulong_t idx, const ctf_funcinfo_t *fip,
1981 uintptr_t symbase = (uintptr_t)fp->ctf_symtab.cts_data;
1983 if (!(fp->ctf_flags & LCTF_RDWR))
1984 return (ctf_set_errno(fp, ECTF_RDONLY));
1986 if (ctf_dsd_lookup(fp, idx) != NULL)
1987 return (ctf_set_errno(fp, ECTF_CONFLICT));
1990 return (ctf_set_errno(fp, ECTF_STRTAB));
1992 if (idx > fp->ctf_nsyms)
1993 return (ctf_set_errno(fp, ECTF_NOTDATA));
1995 if (fp->ctf_symtab.cts_entsize == sizeof (Elf32_Sym)) {
1998 return (ctf_set_errno(fp, ECTF_NOTFUNC));
2002 return (ctf_set_errno(fp, ECTF_NOTFUNC));
2005 afp = fp;
2010 afp = fp;
2017 return (ctf_set_errno(fp, ENOMEM));
2025 return (ctf_set_errno(fp, ENOMEM));
2034 ctf_dsd_insert(fp, dsd);
2035 fp->ctf_flags |= LCTF_DIRTY;
2041 ctf_add_object(ctf_file_t *fp, ulong_t idx, ctf_id_t type)
2045 uintptr_t symbase = (uintptr_t)fp->ctf_symtab.cts_data;
2047 if (!(fp->ctf_flags & LCTF_RDWR))
2048 return (ctf_set_errno(fp, ECTF_RDONLY));
2050 if (!(fp->ctf_flags & LCTF_RDWR))
2051 return (ctf_set_errno(fp, ECTF_RDONLY));
2053 if (ctf_dsd_lookup(fp, idx) != NULL)
2054 return (ctf_set_errno(fp, ECTF_CONFLICT));
2057 return (ctf_set_errno(fp, ECTF_STRTAB));
2059 if (idx > fp->ctf_nsyms)
2060 return (ctf_set_errno(fp, ECTF_NOTDATA));
2062 if (fp->ctf_symtab.cts_entsize == sizeof (Elf32_Sym)) {
2065 return (ctf_set_errno(fp, ECTF_NOTDATA));
2069 return (ctf_set_errno(fp, ECTF_NOTDATA));
2072 afp = fp;
2078 return (ctf_set_errno(fp, ENOMEM));
2083 ctf_dsd_insert(fp, dsd);
2084 fp->ctf_flags |= LCTF_DIRTY;
2090 ctf_dataptr(ctf_file_t *fp, const void **addrp, size_t *sizep)
2093 *addrp = fp->ctf_base;
2095 *sizep = fp->ctf_size;
2099 ctf_add_label(ctf_file_t *fp, const char *name, ctf_id_t type, uint_t position)
2105 return (ctf_set_errno(fp, EINVAL));
2107 if (!(fp->ctf_flags & LCTF_RDWR))
2108 return (ctf_set_errno(fp, ECTF_RDONLY));
2110 fpd = fp;
2114 if (type != 0 && (fp->ctf_flags & LCTF_CHILD) &&
2116 return (ctf_set_errno(fp, ECTF_NOPARENT));
2118 if (ctf_dld_lookup(fp, name) != NULL)
2119 return (ctf_set_errno(fp, ECTF_LABELEXISTS));
2122 return (ctf_set_errno(fp, EAGAIN));
2126 return (ctf_set_errno(fp, EAGAIN));
2130 fp->ctf_dtstrlen += strlen(name) + 1;
2131 ctf_dld_insert(fp, dld, position);
2132 fp->ctf_flags |= LCTF_DIRTY;
2144 ctf_set_size(ctf_file_t *fp, ctf_id_t id, const ulong_t newsz)
2146 ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, id);
2150 if (!(fp->ctf_flags & LCTF_RDWR))
2151 return (ctf_set_errno(fp, ECTF_RDONLY));
2154 return (ctf_set_errno(fp, ECTF_BADID));
2159 return (ctf_set_errno(fp, ECTF_NOTSOU));
2165 return (ctf_set_errno(fp, EINVAL));
2175 fp->ctf_flags |= LCTF_DIRTY;
2180 ctf_set_root(ctf_file_t *fp, ctf_id_t id, const boolean_t vis)
2182 ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, id);
2185 if (!(fp->ctf_flags & LCTF_RDWR))
2186 return (ctf_set_errno(fp, ECTF_RDONLY));
2189 return (ctf_set_errno(fp, ECTF_BADID));