1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate /* 30*0Sstevel@tonic-gate * Routines for retrieving CTF data from a .SUNW_ctf ELF section 31*0Sstevel@tonic-gate */ 32*0Sstevel@tonic-gate 33*0Sstevel@tonic-gate #include <stdio.h> 34*0Sstevel@tonic-gate #include <stdlib.h> 35*0Sstevel@tonic-gate #include <fcntl.h> 36*0Sstevel@tonic-gate #include <unistd.h> 37*0Sstevel@tonic-gate #include <gelf.h> 38*0Sstevel@tonic-gate #include <strings.h> 39*0Sstevel@tonic-gate #include <sys/types.h> 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate #include "ctftools.h" 42*0Sstevel@tonic-gate #include "memory.h" 43*0Sstevel@tonic-gate 44*0Sstevel@tonic-gate typedef int read_cb_f(tdata_t *, char *, void *); 45*0Sstevel@tonic-gate 46*0Sstevel@tonic-gate /* 47*0Sstevel@tonic-gate * Return the source types that the object was generated from. 48*0Sstevel@tonic-gate */ 49*0Sstevel@tonic-gate source_types_t 50*0Sstevel@tonic-gate built_source_types(Elf *elf, char const *file) 51*0Sstevel@tonic-gate { 52*0Sstevel@tonic-gate source_types_t types = SOURCE_NONE; 53*0Sstevel@tonic-gate symit_data_t *si; 54*0Sstevel@tonic-gate 55*0Sstevel@tonic-gate if ((si = symit_new(elf, file)) == NULL) 56*0Sstevel@tonic-gate return (SOURCE_NONE); 57*0Sstevel@tonic-gate 58*0Sstevel@tonic-gate while (symit_next(si, STT_FILE) != NULL) { 59*0Sstevel@tonic-gate char *name = symit_name(si); 60*0Sstevel@tonic-gate size_t len = strlen(name); 61*0Sstevel@tonic-gate if (len < 2 || name[len - 2] != '.') { 62*0Sstevel@tonic-gate types |= SOURCE_UNKNOWN; 63*0Sstevel@tonic-gate continue; 64*0Sstevel@tonic-gate } 65*0Sstevel@tonic-gate 66*0Sstevel@tonic-gate switch (name[len - 1]) { 67*0Sstevel@tonic-gate case 'c': 68*0Sstevel@tonic-gate types |= SOURCE_C; 69*0Sstevel@tonic-gate break; 70*0Sstevel@tonic-gate case 'h': 71*0Sstevel@tonic-gate /* ignore */ 72*0Sstevel@tonic-gate break; 73*0Sstevel@tonic-gate case 's': 74*0Sstevel@tonic-gate types |= SOURCE_S; 75*0Sstevel@tonic-gate break; 76*0Sstevel@tonic-gate default: 77*0Sstevel@tonic-gate types |= SOURCE_UNKNOWN; 78*0Sstevel@tonic-gate } 79*0Sstevel@tonic-gate } 80*0Sstevel@tonic-gate 81*0Sstevel@tonic-gate symit_free(si); 82*0Sstevel@tonic-gate return (types); 83*0Sstevel@tonic-gate } 84*0Sstevel@tonic-gate 85*0Sstevel@tonic-gate static int 86*0Sstevel@tonic-gate read_file(Elf *elf, char *file, char *label, read_cb_f *func, void *arg, 87*0Sstevel@tonic-gate int require_ctf) 88*0Sstevel@tonic-gate { 89*0Sstevel@tonic-gate Elf_Scn *ctfscn; 90*0Sstevel@tonic-gate Elf_Data *ctfdata; 91*0Sstevel@tonic-gate symit_data_t *si = NULL; 92*0Sstevel@tonic-gate int ctfscnidx; 93*0Sstevel@tonic-gate tdata_t *td; 94*0Sstevel@tonic-gate 95*0Sstevel@tonic-gate if ((ctfscnidx = findelfsecidx(elf, ".SUNW_ctf")) < 0) { 96*0Sstevel@tonic-gate if (require_ctf && 97*0Sstevel@tonic-gate (built_source_types(elf, file) & SOURCE_C)) { 98*0Sstevel@tonic-gate terminate("Input file %s was partially built from " 99*0Sstevel@tonic-gate "C sources, but no CTF data was present\n", file); 100*0Sstevel@tonic-gate } 101*0Sstevel@tonic-gate return (0); 102*0Sstevel@tonic-gate } 103*0Sstevel@tonic-gate 104*0Sstevel@tonic-gate if ((ctfscn = elf_getscn(elf, ctfscnidx)) == NULL || 105*0Sstevel@tonic-gate (ctfdata = elf_getdata(ctfscn, NULL)) == NULL) 106*0Sstevel@tonic-gate elfterminate(file, "Cannot read CTF section"); 107*0Sstevel@tonic-gate 108*0Sstevel@tonic-gate /* Reconstruction of type tree */ 109*0Sstevel@tonic-gate if ((si = symit_new(elf, file)) == NULL) { 110*0Sstevel@tonic-gate warning("%s has no symbol table - skipping", file); 111*0Sstevel@tonic-gate return (0); 112*0Sstevel@tonic-gate } 113*0Sstevel@tonic-gate 114*0Sstevel@tonic-gate td = ctf_load(file, ctfdata->d_buf, ctfdata->d_size, si, label); 115*0Sstevel@tonic-gate tdata_build_hashes(td); 116*0Sstevel@tonic-gate 117*0Sstevel@tonic-gate symit_free(si); 118*0Sstevel@tonic-gate 119*0Sstevel@tonic-gate if (td != NULL) { 120*0Sstevel@tonic-gate if (func(td, file, arg) < 0) 121*0Sstevel@tonic-gate return (-1); 122*0Sstevel@tonic-gate else 123*0Sstevel@tonic-gate return (1); 124*0Sstevel@tonic-gate } 125*0Sstevel@tonic-gate return (0); 126*0Sstevel@tonic-gate } 127*0Sstevel@tonic-gate 128*0Sstevel@tonic-gate static int 129*0Sstevel@tonic-gate read_archive(int fd, Elf *elf, char *file, char *label, read_cb_f *func, 130*0Sstevel@tonic-gate void *arg, int require_ctf) 131*0Sstevel@tonic-gate { 132*0Sstevel@tonic-gate Elf *melf; 133*0Sstevel@tonic-gate Elf_Cmd cmd = ELF_C_READ; 134*0Sstevel@tonic-gate Elf_Arhdr *arh; 135*0Sstevel@tonic-gate int secnum = 1, found = 0; 136*0Sstevel@tonic-gate 137*0Sstevel@tonic-gate while ((melf = elf_begin(fd, cmd, elf)) != NULL) { 138*0Sstevel@tonic-gate int rc = 0; 139*0Sstevel@tonic-gate 140*0Sstevel@tonic-gate if ((arh = elf_getarhdr(melf)) == NULL) { 141*0Sstevel@tonic-gate elfterminate(file, "Can't get archive header for " 142*0Sstevel@tonic-gate "member %d", secnum); 143*0Sstevel@tonic-gate } 144*0Sstevel@tonic-gate 145*0Sstevel@tonic-gate /* skip special sections - their names begin with "/" */ 146*0Sstevel@tonic-gate if (*arh->ar_name != '/') { 147*0Sstevel@tonic-gate size_t memlen = strlen(file) + 1 + 148*0Sstevel@tonic-gate strlen(arh->ar_name) + 1 + 1; 149*0Sstevel@tonic-gate char *memname = xmalloc(memlen); 150*0Sstevel@tonic-gate 151*0Sstevel@tonic-gate snprintf(memname, memlen, "%s(%s)", file, arh->ar_name); 152*0Sstevel@tonic-gate 153*0Sstevel@tonic-gate switch (elf_kind(melf)) { 154*0Sstevel@tonic-gate case ELF_K_AR: 155*0Sstevel@tonic-gate rc = read_archive(fd, melf, memname, label, 156*0Sstevel@tonic-gate func, arg, require_ctf); 157*0Sstevel@tonic-gate break; 158*0Sstevel@tonic-gate case ELF_K_ELF: 159*0Sstevel@tonic-gate rc = read_file(melf, memname, label, 160*0Sstevel@tonic-gate func, arg, require_ctf); 161*0Sstevel@tonic-gate break; 162*0Sstevel@tonic-gate default: 163*0Sstevel@tonic-gate terminate("%s: Unknown elf kind %d\n", 164*0Sstevel@tonic-gate memname, elf_kind(melf)); 165*0Sstevel@tonic-gate } 166*0Sstevel@tonic-gate 167*0Sstevel@tonic-gate free(memname); 168*0Sstevel@tonic-gate } 169*0Sstevel@tonic-gate 170*0Sstevel@tonic-gate cmd = elf_next(melf); 171*0Sstevel@tonic-gate (void) elf_end(melf); 172*0Sstevel@tonic-gate secnum++; 173*0Sstevel@tonic-gate 174*0Sstevel@tonic-gate if (rc < 0) 175*0Sstevel@tonic-gate return (rc); 176*0Sstevel@tonic-gate else 177*0Sstevel@tonic-gate found += rc; 178*0Sstevel@tonic-gate } 179*0Sstevel@tonic-gate 180*0Sstevel@tonic-gate return (found); 181*0Sstevel@tonic-gate } 182*0Sstevel@tonic-gate 183*0Sstevel@tonic-gate static int 184*0Sstevel@tonic-gate read_ctf_common(char *file, char *label, read_cb_f *func, void *arg, 185*0Sstevel@tonic-gate int require_ctf) 186*0Sstevel@tonic-gate { 187*0Sstevel@tonic-gate Elf *elf; 188*0Sstevel@tonic-gate int found = 0; 189*0Sstevel@tonic-gate int fd; 190*0Sstevel@tonic-gate 191*0Sstevel@tonic-gate debug(3, "Reading %s (label %s)\n", file, (label ? label : "NONE")); 192*0Sstevel@tonic-gate 193*0Sstevel@tonic-gate (void) elf_version(EV_CURRENT); 194*0Sstevel@tonic-gate 195*0Sstevel@tonic-gate if ((fd = open(file, O_RDONLY)) < 0) 196*0Sstevel@tonic-gate terminate("%s: Cannot open for reading", file); 197*0Sstevel@tonic-gate if ((elf = elf_begin(fd, ELF_C_READ, NULL)) == NULL) 198*0Sstevel@tonic-gate elfterminate(file, "Cannot read"); 199*0Sstevel@tonic-gate 200*0Sstevel@tonic-gate switch (elf_kind(elf)) { 201*0Sstevel@tonic-gate case ELF_K_AR: 202*0Sstevel@tonic-gate found = read_archive(fd, elf, file, label, 203*0Sstevel@tonic-gate func, arg, require_ctf); 204*0Sstevel@tonic-gate break; 205*0Sstevel@tonic-gate 206*0Sstevel@tonic-gate case ELF_K_ELF: 207*0Sstevel@tonic-gate found = read_file(elf, file, label, 208*0Sstevel@tonic-gate func, arg, require_ctf); 209*0Sstevel@tonic-gate break; 210*0Sstevel@tonic-gate 211*0Sstevel@tonic-gate default: 212*0Sstevel@tonic-gate terminate("%s: Unknown elf kind %d\n", file, elf_kind(elf)); 213*0Sstevel@tonic-gate } 214*0Sstevel@tonic-gate 215*0Sstevel@tonic-gate (void) elf_end(elf); 216*0Sstevel@tonic-gate (void) close(fd); 217*0Sstevel@tonic-gate 218*0Sstevel@tonic-gate return (found); 219*0Sstevel@tonic-gate } 220*0Sstevel@tonic-gate 221*0Sstevel@tonic-gate /*ARGSUSED*/ 222*0Sstevel@tonic-gate int 223*0Sstevel@tonic-gate read_ctf_save_cb(tdata_t *td, char *name, void *retp) 224*0Sstevel@tonic-gate { 225*0Sstevel@tonic-gate tdata_t **tdp = retp; 226*0Sstevel@tonic-gate 227*0Sstevel@tonic-gate *tdp = td; 228*0Sstevel@tonic-gate 229*0Sstevel@tonic-gate return (1); 230*0Sstevel@tonic-gate } 231*0Sstevel@tonic-gate 232*0Sstevel@tonic-gate int 233*0Sstevel@tonic-gate read_ctf(char **files, int n, char *label, read_cb_f *func, void *private, 234*0Sstevel@tonic-gate int require_ctf) 235*0Sstevel@tonic-gate { 236*0Sstevel@tonic-gate int found; 237*0Sstevel@tonic-gate int i, rc; 238*0Sstevel@tonic-gate 239*0Sstevel@tonic-gate for (i = 0, found = 0; i < n; i++) { 240*0Sstevel@tonic-gate if ((rc = read_ctf_common(files[i], label, func, 241*0Sstevel@tonic-gate private, require_ctf)) < 0) 242*0Sstevel@tonic-gate return (rc); 243*0Sstevel@tonic-gate found += rc; 244*0Sstevel@tonic-gate } 245*0Sstevel@tonic-gate 246*0Sstevel@tonic-gate return (found); 247*0Sstevel@tonic-gate } 248*0Sstevel@tonic-gate 249*0Sstevel@tonic-gate static int 250*0Sstevel@tonic-gate count_archive(int fd, Elf *elf, char *file) 251*0Sstevel@tonic-gate { 252*0Sstevel@tonic-gate Elf *melf; 253*0Sstevel@tonic-gate Elf_Cmd cmd = ELF_C_READ; 254*0Sstevel@tonic-gate Elf_Arhdr *arh; 255*0Sstevel@tonic-gate int nfiles = 0, err = 0; 256*0Sstevel@tonic-gate 257*0Sstevel@tonic-gate while ((melf = elf_begin(fd, cmd, elf)) != NULL) { 258*0Sstevel@tonic-gate if ((arh = elf_getarhdr(melf)) == NULL) { 259*0Sstevel@tonic-gate warning("Can't process input archive %s\n", 260*0Sstevel@tonic-gate file); 261*0Sstevel@tonic-gate err++; 262*0Sstevel@tonic-gate } 263*0Sstevel@tonic-gate 264*0Sstevel@tonic-gate if (*arh->ar_name != '/') 265*0Sstevel@tonic-gate nfiles++; 266*0Sstevel@tonic-gate 267*0Sstevel@tonic-gate cmd = elf_next(melf); 268*0Sstevel@tonic-gate (void) elf_end(melf); 269*0Sstevel@tonic-gate } 270*0Sstevel@tonic-gate 271*0Sstevel@tonic-gate if (err > 0) 272*0Sstevel@tonic-gate return (-1); 273*0Sstevel@tonic-gate 274*0Sstevel@tonic-gate return (nfiles); 275*0Sstevel@tonic-gate } 276*0Sstevel@tonic-gate 277*0Sstevel@tonic-gate int 278*0Sstevel@tonic-gate count_files(char **files, int n) 279*0Sstevel@tonic-gate { 280*0Sstevel@tonic-gate int nfiles = 0, err = 0; 281*0Sstevel@tonic-gate Elf *elf; 282*0Sstevel@tonic-gate int fd, rc, i; 283*0Sstevel@tonic-gate 284*0Sstevel@tonic-gate (void) elf_version(EV_CURRENT); 285*0Sstevel@tonic-gate 286*0Sstevel@tonic-gate for (i = 0; i < n; i++) { 287*0Sstevel@tonic-gate char *file = files[i]; 288*0Sstevel@tonic-gate 289*0Sstevel@tonic-gate if ((fd = open(file, O_RDONLY)) < 0) { 290*0Sstevel@tonic-gate warning("Can't read input file %s", file); 291*0Sstevel@tonic-gate err++; 292*0Sstevel@tonic-gate continue; 293*0Sstevel@tonic-gate } 294*0Sstevel@tonic-gate 295*0Sstevel@tonic-gate if ((elf = elf_begin(fd, ELF_C_READ, NULL)) == NULL) { 296*0Sstevel@tonic-gate warning("Can't open input file %s: %s\n", file, 297*0Sstevel@tonic-gate elf_errmsg(elf_errno())); 298*0Sstevel@tonic-gate err++; 299*0Sstevel@tonic-gate (void) close(fd); 300*0Sstevel@tonic-gate continue; 301*0Sstevel@tonic-gate } 302*0Sstevel@tonic-gate 303*0Sstevel@tonic-gate switch (elf_kind(elf)) { 304*0Sstevel@tonic-gate case ELF_K_AR: 305*0Sstevel@tonic-gate if ((rc = count_archive(fd, elf, file)) < 0) 306*0Sstevel@tonic-gate err++; 307*0Sstevel@tonic-gate else 308*0Sstevel@tonic-gate nfiles += rc; 309*0Sstevel@tonic-gate break; 310*0Sstevel@tonic-gate case ELF_K_ELF: 311*0Sstevel@tonic-gate nfiles++; 312*0Sstevel@tonic-gate break; 313*0Sstevel@tonic-gate default: 314*0Sstevel@tonic-gate warning("Input file %s is corrupt\n", file); 315*0Sstevel@tonic-gate err++; 316*0Sstevel@tonic-gate } 317*0Sstevel@tonic-gate 318*0Sstevel@tonic-gate (void) elf_end(elf); 319*0Sstevel@tonic-gate (void) close(fd); 320*0Sstevel@tonic-gate } 321*0Sstevel@tonic-gate 322*0Sstevel@tonic-gate if (err > 0) 323*0Sstevel@tonic-gate return (-1); 324*0Sstevel@tonic-gate 325*0Sstevel@tonic-gate debug(2, "Found %d files in %d input files\n", nfiles, n); 326*0Sstevel@tonic-gate 327*0Sstevel@tonic-gate return (nfiles); 328*0Sstevel@tonic-gate } 329*0Sstevel@tonic-gate 330*0Sstevel@tonic-gate struct symit_data { 331*0Sstevel@tonic-gate GElf_Shdr si_shdr; 332*0Sstevel@tonic-gate Elf_Data *si_symd; 333*0Sstevel@tonic-gate Elf_Data *si_strd; 334*0Sstevel@tonic-gate GElf_Sym si_cursym; 335*0Sstevel@tonic-gate char *si_curname; 336*0Sstevel@tonic-gate char *si_curfile; 337*0Sstevel@tonic-gate int si_nument; 338*0Sstevel@tonic-gate int si_next; 339*0Sstevel@tonic-gate }; 340*0Sstevel@tonic-gate 341*0Sstevel@tonic-gate symit_data_t * 342*0Sstevel@tonic-gate symit_new(Elf *elf, const char *file) 343*0Sstevel@tonic-gate { 344*0Sstevel@tonic-gate symit_data_t *si; 345*0Sstevel@tonic-gate Elf_Scn *scn; 346*0Sstevel@tonic-gate int symtabidx; 347*0Sstevel@tonic-gate 348*0Sstevel@tonic-gate if ((symtabidx = findelfsecidx(elf, ".symtab")) < 0) 349*0Sstevel@tonic-gate return (NULL); 350*0Sstevel@tonic-gate 351*0Sstevel@tonic-gate si = xcalloc(sizeof (symit_data_t)); 352*0Sstevel@tonic-gate 353*0Sstevel@tonic-gate if ((scn = elf_getscn(elf, symtabidx)) == NULL || 354*0Sstevel@tonic-gate gelf_getshdr(scn, &si->si_shdr) == NULL || 355*0Sstevel@tonic-gate (si->si_symd = elf_getdata(scn, NULL)) == NULL) 356*0Sstevel@tonic-gate elfterminate(file, "Cannot read .symtab"); 357*0Sstevel@tonic-gate 358*0Sstevel@tonic-gate if ((scn = elf_getscn(elf, si->si_shdr.sh_link)) == NULL || 359*0Sstevel@tonic-gate (si->si_strd = elf_getdata(scn, NULL)) == NULL) 360*0Sstevel@tonic-gate elfterminate(file, "Cannot read strings for .symtab"); 361*0Sstevel@tonic-gate 362*0Sstevel@tonic-gate si->si_nument = si->si_shdr.sh_size / si->si_shdr.sh_entsize; 363*0Sstevel@tonic-gate 364*0Sstevel@tonic-gate return (si); 365*0Sstevel@tonic-gate } 366*0Sstevel@tonic-gate 367*0Sstevel@tonic-gate void 368*0Sstevel@tonic-gate symit_free(symit_data_t *si) 369*0Sstevel@tonic-gate { 370*0Sstevel@tonic-gate free(si); 371*0Sstevel@tonic-gate } 372*0Sstevel@tonic-gate 373*0Sstevel@tonic-gate void 374*0Sstevel@tonic-gate symit_reset(symit_data_t *si) 375*0Sstevel@tonic-gate { 376*0Sstevel@tonic-gate si->si_next = 0; 377*0Sstevel@tonic-gate } 378*0Sstevel@tonic-gate 379*0Sstevel@tonic-gate char * 380*0Sstevel@tonic-gate symit_curfile(symit_data_t *si) 381*0Sstevel@tonic-gate { 382*0Sstevel@tonic-gate return (si->si_curfile); 383*0Sstevel@tonic-gate } 384*0Sstevel@tonic-gate 385*0Sstevel@tonic-gate GElf_Sym * 386*0Sstevel@tonic-gate symit_next(symit_data_t *si, int type) 387*0Sstevel@tonic-gate { 388*0Sstevel@tonic-gate GElf_Sym sym; 389*0Sstevel@tonic-gate 390*0Sstevel@tonic-gate for (; si->si_next < si->si_nument; si->si_next++) { 391*0Sstevel@tonic-gate gelf_getsym(si->si_symd, si->si_next, &si->si_cursym); 392*0Sstevel@tonic-gate gelf_getsym(si->si_symd, si->si_next, &sym); 393*0Sstevel@tonic-gate si->si_curname = (caddr_t)si->si_strd->d_buf + sym.st_name; 394*0Sstevel@tonic-gate 395*0Sstevel@tonic-gate if (GELF_ST_TYPE(sym.st_info) == STT_FILE) 396*0Sstevel@tonic-gate si->si_curfile = si->si_curname; 397*0Sstevel@tonic-gate 398*0Sstevel@tonic-gate if (GELF_ST_TYPE(sym.st_info) != type || 399*0Sstevel@tonic-gate sym.st_shndx == SHN_UNDEF) 400*0Sstevel@tonic-gate continue; 401*0Sstevel@tonic-gate 402*0Sstevel@tonic-gate si->si_next++; 403*0Sstevel@tonic-gate 404*0Sstevel@tonic-gate return (&si->si_cursym); 405*0Sstevel@tonic-gate } 406*0Sstevel@tonic-gate 407*0Sstevel@tonic-gate return (NULL); 408*0Sstevel@tonic-gate } 409*0Sstevel@tonic-gate 410*0Sstevel@tonic-gate char * 411*0Sstevel@tonic-gate symit_name(symit_data_t *si) 412*0Sstevel@tonic-gate { 413*0Sstevel@tonic-gate return (si->si_curname); 414*0Sstevel@tonic-gate } 415