1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright (c) 2001 by Sun Microsystems, Inc. 24*7c478bd9Sstevel@tonic-gate * All rights reserved. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 28*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate 31*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 32*7c478bd9Sstevel@tonic-gate /* 33*7c478bd9Sstevel@tonic-gate * UNIX shell 34*7c478bd9Sstevel@tonic-gate */ 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #include "defs.h" 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate 39*7c478bd9Sstevel@tonic-gate /* 40*7c478bd9Sstevel@tonic-gate * storage allocator 41*7c478bd9Sstevel@tonic-gate * (circular first fit strategy) 42*7c478bd9Sstevel@tonic-gate */ 43*7c478bd9Sstevel@tonic-gate 44*7c478bd9Sstevel@tonic-gate #define BUSY 01 45*7c478bd9Sstevel@tonic-gate #define busy(x) (Rcheat((x)->word) & BUSY) 46*7c478bd9Sstevel@tonic-gate 47*7c478bd9Sstevel@tonic-gate unsigned brkincr = BRKINCR; 48*7c478bd9Sstevel@tonic-gate struct blk *blokp; /* current search pointer */ 49*7c478bd9Sstevel@tonic-gate struct blk *bloktop; /* top of arena (last blok) */ 50*7c478bd9Sstevel@tonic-gate 51*7c478bd9Sstevel@tonic-gate unsigned char *brkbegin; 52*7c478bd9Sstevel@tonic-gate unsigned char *setbrk(); 53*7c478bd9Sstevel@tonic-gate 54*7c478bd9Sstevel@tonic-gate #ifdef __STDC__ 55*7c478bd9Sstevel@tonic-gate void * 56*7c478bd9Sstevel@tonic-gate #else 57*7c478bd9Sstevel@tonic-gate char * 58*7c478bd9Sstevel@tonic-gate #endif 59*7c478bd9Sstevel@tonic-gate alloc(nbytes) 60*7c478bd9Sstevel@tonic-gate size_t nbytes; 61*7c478bd9Sstevel@tonic-gate { 62*7c478bd9Sstevel@tonic-gate register unsigned rbytes = round(nbytes+BYTESPERWORD, BYTESPERWORD); 63*7c478bd9Sstevel@tonic-gate 64*7c478bd9Sstevel@tonic-gate if (stakbot == 0) { 65*7c478bd9Sstevel@tonic-gate addblok((unsigned)0); 66*7c478bd9Sstevel@tonic-gate } 67*7c478bd9Sstevel@tonic-gate 68*7c478bd9Sstevel@tonic-gate for (;;) 69*7c478bd9Sstevel@tonic-gate { 70*7c478bd9Sstevel@tonic-gate int c = 0; 71*7c478bd9Sstevel@tonic-gate register struct blk *p = blokp; 72*7c478bd9Sstevel@tonic-gate register struct blk *q; 73*7c478bd9Sstevel@tonic-gate 74*7c478bd9Sstevel@tonic-gate do 75*7c478bd9Sstevel@tonic-gate { 76*7c478bd9Sstevel@tonic-gate if (!busy(p)) 77*7c478bd9Sstevel@tonic-gate { 78*7c478bd9Sstevel@tonic-gate while (!busy(q = p->word)) 79*7c478bd9Sstevel@tonic-gate p->word = q->word; 80*7c478bd9Sstevel@tonic-gate if ((char *)q - (char *)p >= rbytes) 81*7c478bd9Sstevel@tonic-gate { 82*7c478bd9Sstevel@tonic-gate blokp = (struct blk *) 83*7c478bd9Sstevel@tonic-gate ((char *)p + rbytes); 84*7c478bd9Sstevel@tonic-gate if (q > blokp) 85*7c478bd9Sstevel@tonic-gate blokp->word = p->word; 86*7c478bd9Sstevel@tonic-gate p->word = (struct blk *) 87*7c478bd9Sstevel@tonic-gate (Rcheat(blokp) | BUSY); 88*7c478bd9Sstevel@tonic-gate return ((char *)(p + 1)); 89*7c478bd9Sstevel@tonic-gate } 90*7c478bd9Sstevel@tonic-gate } 91*7c478bd9Sstevel@tonic-gate q = p; 92*7c478bd9Sstevel@tonic-gate p = (struct blk *)(Rcheat(p->word) & ~BUSY); 93*7c478bd9Sstevel@tonic-gate } while (p > q || (c++) == 0); 94*7c478bd9Sstevel@tonic-gate addblok(rbytes); 95*7c478bd9Sstevel@tonic-gate } 96*7c478bd9Sstevel@tonic-gate } 97*7c478bd9Sstevel@tonic-gate 98*7c478bd9Sstevel@tonic-gate addblok(reqd) 99*7c478bd9Sstevel@tonic-gate unsigned reqd; 100*7c478bd9Sstevel@tonic-gate { 101*7c478bd9Sstevel@tonic-gate if (stakbot == 0) 102*7c478bd9Sstevel@tonic-gate { 103*7c478bd9Sstevel@tonic-gate brkbegin = setbrk(3 * BRKINCR); 104*7c478bd9Sstevel@tonic-gate bloktop = (struct blk *)brkbegin; 105*7c478bd9Sstevel@tonic-gate } 106*7c478bd9Sstevel@tonic-gate 107*7c478bd9Sstevel@tonic-gate if (stakbas != staktop) 108*7c478bd9Sstevel@tonic-gate { 109*7c478bd9Sstevel@tonic-gate register unsigned char *rndstak; 110*7c478bd9Sstevel@tonic-gate register struct blk *blokstak; 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gate if (staktop >= brkend) 113*7c478bd9Sstevel@tonic-gate growstak(staktop); 114*7c478bd9Sstevel@tonic-gate pushstak(0); 115*7c478bd9Sstevel@tonic-gate rndstak = (unsigned char *)round(staktop, BYTESPERWORD); 116*7c478bd9Sstevel@tonic-gate blokstak = (struct blk *)(stakbas) - 1; 117*7c478bd9Sstevel@tonic-gate blokstak->word = stakbsy; 118*7c478bd9Sstevel@tonic-gate stakbsy = blokstak; 119*7c478bd9Sstevel@tonic-gate bloktop->word = (struct blk *)(Rcheat(rndstak) | BUSY); 120*7c478bd9Sstevel@tonic-gate bloktop = (struct blk *)(rndstak); 121*7c478bd9Sstevel@tonic-gate } 122*7c478bd9Sstevel@tonic-gate reqd += brkincr; 123*7c478bd9Sstevel@tonic-gate reqd &= ~(brkincr - 1); 124*7c478bd9Sstevel@tonic-gate blokp = bloktop; 125*7c478bd9Sstevel@tonic-gate /* 126*7c478bd9Sstevel@tonic-gate * brkend points to the first invalid address. 127*7c478bd9Sstevel@tonic-gate * make sure bloktop is valid. 128*7c478bd9Sstevel@tonic-gate */ 129*7c478bd9Sstevel@tonic-gate if ((unsigned char *)&bloktop->word >= brkend) 130*7c478bd9Sstevel@tonic-gate { 131*7c478bd9Sstevel@tonic-gate if (setbrk((unsigned)((unsigned char *) 132*7c478bd9Sstevel@tonic-gate (&bloktop->word) - brkend + sizeof (struct blk))) == 133*7c478bd9Sstevel@tonic-gate (unsigned char *)-1) 134*7c478bd9Sstevel@tonic-gate error(nospace); 135*7c478bd9Sstevel@tonic-gate } 136*7c478bd9Sstevel@tonic-gate bloktop = bloktop->word = (struct blk *)(Rcheat(bloktop) + reqd); 137*7c478bd9Sstevel@tonic-gate if ((unsigned char *)&bloktop->word >= brkend) 138*7c478bd9Sstevel@tonic-gate { 139*7c478bd9Sstevel@tonic-gate if (setbrk((unsigned)((unsigned char *) 140*7c478bd9Sstevel@tonic-gate (&bloktop->word) - brkend + sizeof (struct blk))) == 141*7c478bd9Sstevel@tonic-gate (unsigned char *)-1) 142*7c478bd9Sstevel@tonic-gate error(nospace); 143*7c478bd9Sstevel@tonic-gate } 144*7c478bd9Sstevel@tonic-gate bloktop->word = (struct blk *)(brkbegin + 1); 145*7c478bd9Sstevel@tonic-gate { 146*7c478bd9Sstevel@tonic-gate register unsigned char *stakadr = (unsigned char *) 147*7c478bd9Sstevel@tonic-gate (bloktop + 2); 148*7c478bd9Sstevel@tonic-gate register unsigned char *sp = stakadr; 149*7c478bd9Sstevel@tonic-gate if (reqd = (staktop-stakbot)) 150*7c478bd9Sstevel@tonic-gate { 151*7c478bd9Sstevel@tonic-gate if (stakadr + reqd >= brkend) 152*7c478bd9Sstevel@tonic-gate growstak(stakadr + reqd); 153*7c478bd9Sstevel@tonic-gate while (reqd-- > 0) 154*7c478bd9Sstevel@tonic-gate *sp++ = *stakbot++; 155*7c478bd9Sstevel@tonic-gate sp--; 156*7c478bd9Sstevel@tonic-gate } 157*7c478bd9Sstevel@tonic-gate staktop = sp; 158*7c478bd9Sstevel@tonic-gate if (staktop >= brkend) 159*7c478bd9Sstevel@tonic-gate growstak(staktop); 160*7c478bd9Sstevel@tonic-gate stakbas = stakbot = stakadr; 161*7c478bd9Sstevel@tonic-gate } 162*7c478bd9Sstevel@tonic-gate } 163*7c478bd9Sstevel@tonic-gate 164*7c478bd9Sstevel@tonic-gate void 165*7c478bd9Sstevel@tonic-gate free(ap) 166*7c478bd9Sstevel@tonic-gate void *ap; 167*7c478bd9Sstevel@tonic-gate { 168*7c478bd9Sstevel@tonic-gate register struct blk *p; 169*7c478bd9Sstevel@tonic-gate 170*7c478bd9Sstevel@tonic-gate if ((p = (struct blk *)ap) && p < bloktop && p > (struct blk *)brkbegin) 171*7c478bd9Sstevel@tonic-gate { 172*7c478bd9Sstevel@tonic-gate #ifdef DEBUG 173*7c478bd9Sstevel@tonic-gate chkbptr(p); 174*7c478bd9Sstevel@tonic-gate #endif 175*7c478bd9Sstevel@tonic-gate --p; 176*7c478bd9Sstevel@tonic-gate p->word = (struct blk *)(Rcheat(p->word) & ~BUSY); 177*7c478bd9Sstevel@tonic-gate } 178*7c478bd9Sstevel@tonic-gate 179*7c478bd9Sstevel@tonic-gate 180*7c478bd9Sstevel@tonic-gate } 181*7c478bd9Sstevel@tonic-gate 182*7c478bd9Sstevel@tonic-gate 183*7c478bd9Sstevel@tonic-gate #ifdef DEBUG 184*7c478bd9Sstevel@tonic-gate 185*7c478bd9Sstevel@tonic-gate chkbptr(ptr) 186*7c478bd9Sstevel@tonic-gate struct blk *ptr; 187*7c478bd9Sstevel@tonic-gate { 188*7c478bd9Sstevel@tonic-gate int exf = 0; 189*7c478bd9Sstevel@tonic-gate register struct blk *p = (struct blk *)brkbegin; 190*7c478bd9Sstevel@tonic-gate register struct blk *q; 191*7c478bd9Sstevel@tonic-gate int us = 0, un = 0; 192*7c478bd9Sstevel@tonic-gate 193*7c478bd9Sstevel@tonic-gate for (;;) 194*7c478bd9Sstevel@tonic-gate { 195*7c478bd9Sstevel@tonic-gate q = (struct blk *)(Rcheat(p->word) & ~BUSY); 196*7c478bd9Sstevel@tonic-gate 197*7c478bd9Sstevel@tonic-gate if (p+1 == ptr) 198*7c478bd9Sstevel@tonic-gate exf++; 199*7c478bd9Sstevel@tonic-gate 200*7c478bd9Sstevel@tonic-gate if (q < (struct blk *)brkbegin || q > bloktop) 201*7c478bd9Sstevel@tonic-gate abort(3); 202*7c478bd9Sstevel@tonic-gate 203*7c478bd9Sstevel@tonic-gate if (p == bloktop) 204*7c478bd9Sstevel@tonic-gate break; 205*7c478bd9Sstevel@tonic-gate 206*7c478bd9Sstevel@tonic-gate if (busy(p)) 207*7c478bd9Sstevel@tonic-gate us += q - p; 208*7c478bd9Sstevel@tonic-gate else 209*7c478bd9Sstevel@tonic-gate un += q - p; 210*7c478bd9Sstevel@tonic-gate 211*7c478bd9Sstevel@tonic-gate if (p >= q) 212*7c478bd9Sstevel@tonic-gate abort(4); 213*7c478bd9Sstevel@tonic-gate 214*7c478bd9Sstevel@tonic-gate p = q; 215*7c478bd9Sstevel@tonic-gate } 216*7c478bd9Sstevel@tonic-gate if (exf == 0) 217*7c478bd9Sstevel@tonic-gate abort(1); 218*7c478bd9Sstevel@tonic-gate } 219*7c478bd9Sstevel@tonic-gate 220*7c478bd9Sstevel@tonic-gate 221*7c478bd9Sstevel@tonic-gate chkmem() 222*7c478bd9Sstevel@tonic-gate { 223*7c478bd9Sstevel@tonic-gate register struct blk *p = (struct blk *)brkbegin; 224*7c478bd9Sstevel@tonic-gate register struct blk *q; 225*7c478bd9Sstevel@tonic-gate int us = 0, un = 0; 226*7c478bd9Sstevel@tonic-gate 227*7c478bd9Sstevel@tonic-gate for (;;) { 228*7c478bd9Sstevel@tonic-gate q = (struct blk *)(Rcheat(p->word) & ~BUSY); 229*7c478bd9Sstevel@tonic-gate 230*7c478bd9Sstevel@tonic-gate if (q < (struct blk *)brkbegin || q > bloktop) 231*7c478bd9Sstevel@tonic-gate abort(3); 232*7c478bd9Sstevel@tonic-gate 233*7c478bd9Sstevel@tonic-gate if (p == bloktop) 234*7c478bd9Sstevel@tonic-gate break; 235*7c478bd9Sstevel@tonic-gate 236*7c478bd9Sstevel@tonic-gate if (busy(p)) 237*7c478bd9Sstevel@tonic-gate us += q - p; 238*7c478bd9Sstevel@tonic-gate else 239*7c478bd9Sstevel@tonic-gate un += q - p; 240*7c478bd9Sstevel@tonic-gate 241*7c478bd9Sstevel@tonic-gate if (p >= q) 242*7c478bd9Sstevel@tonic-gate abort(4); 243*7c478bd9Sstevel@tonic-gate 244*7c478bd9Sstevel@tonic-gate p = q; 245*7c478bd9Sstevel@tonic-gate } 246*7c478bd9Sstevel@tonic-gate 247*7c478bd9Sstevel@tonic-gate prs("un/used/avail "); 248*7c478bd9Sstevel@tonic-gate prn(un); 249*7c478bd9Sstevel@tonic-gate blank(); 250*7c478bd9Sstevel@tonic-gate prn(us); 251*7c478bd9Sstevel@tonic-gate blank(); 252*7c478bd9Sstevel@tonic-gate prn((char *)bloktop - brkbegin - (un + us)); 253*7c478bd9Sstevel@tonic-gate newline(); 254*7c478bd9Sstevel@tonic-gate 255*7c478bd9Sstevel@tonic-gate } 256*7c478bd9Sstevel@tonic-gate 257*7c478bd9Sstevel@tonic-gate #endif 258*7c478bd9Sstevel@tonic-gate 259*7c478bd9Sstevel@tonic-gate size_t 260*7c478bd9Sstevel@tonic-gate blklen(q) 261*7c478bd9Sstevel@tonic-gate char *q; 262*7c478bd9Sstevel@tonic-gate { 263*7c478bd9Sstevel@tonic-gate register struct blk *pp = (struct blk *)q; 264*7c478bd9Sstevel@tonic-gate register struct blk *p; 265*7c478bd9Sstevel@tonic-gate 266*7c478bd9Sstevel@tonic-gate --pp; 267*7c478bd9Sstevel@tonic-gate p = (struct blk *)(Rcheat(pp->word) & ~BUSY); 268*7c478bd9Sstevel@tonic-gate 269*7c478bd9Sstevel@tonic-gate return ((size_t)((long)p - (long)q)); 270*7c478bd9Sstevel@tonic-gate } 271*7c478bd9Sstevel@tonic-gate 272*7c478bd9Sstevel@tonic-gate /* 273*7c478bd9Sstevel@tonic-gate * This is a really hasty hack at putting realloc() in the shell, along 274*7c478bd9Sstevel@tonic-gate * with alloc() and free(). I really hate having to do things like this, 275*7c478bd9Sstevel@tonic-gate * hacking in something before I understand _why_ libcollate does any 276*7c478bd9Sstevel@tonic-gate * memory (re)allocation, let alone feel comfortable with this particular 277*7c478bd9Sstevel@tonic-gate * implementation of realloc, assuming it actually gets used by anything. 278*7c478bd9Sstevel@tonic-gate * 279*7c478bd9Sstevel@tonic-gate * I plan to revist this, for now this is just to get sh to compile so 280*7c478bd9Sstevel@tonic-gate * that xcu4 builds may be done and we get xcu4 on our desktops. 281*7c478bd9Sstevel@tonic-gate * 282*7c478bd9Sstevel@tonic-gate * Eric Brunner, 10/21/94 283*7c478bd9Sstevel@tonic-gate * 284*7c478bd9Sstevel@tonic-gate * Implemented a variation on the suggested fix in Trusted Solaris 2.5, 285*7c478bd9Sstevel@tonic-gate * then forward ported the fix into the mainline shell. 286*7c478bd9Sstevel@tonic-gate * 287*7c478bd9Sstevel@tonic-gate * 3/3/99 288*7c478bd9Sstevel@tonic-gate */ 289*7c478bd9Sstevel@tonic-gate #ifdef __STDC__ 290*7c478bd9Sstevel@tonic-gate void * 291*7c478bd9Sstevel@tonic-gate realloc(pp, nbytes) 292*7c478bd9Sstevel@tonic-gate void *pp; 293*7c478bd9Sstevel@tonic-gate size_t nbytes; 294*7c478bd9Sstevel@tonic-gate #else 295*7c478bd9Sstevel@tonic-gate char * 296*7c478bd9Sstevel@tonic-gate realloc(pp, nbytes) 297*7c478bd9Sstevel@tonic-gate char *pp; 298*7c478bd9Sstevel@tonic-gate size_t nbytes; 299*7c478bd9Sstevel@tonic-gate #endif 300*7c478bd9Sstevel@tonic-gate { 301*7c478bd9Sstevel@tonic-gate char *q; 302*7c478bd9Sstevel@tonic-gate size_t blen; 303*7c478bd9Sstevel@tonic-gate 304*7c478bd9Sstevel@tonic-gate if (pp == NULL) 305*7c478bd9Sstevel@tonic-gate return (alloc(nbytes)); 306*7c478bd9Sstevel@tonic-gate if ((nbytes == 0) && (pp != NULL)) 307*7c478bd9Sstevel@tonic-gate free(pp); 308*7c478bd9Sstevel@tonic-gate 309*7c478bd9Sstevel@tonic-gate blen = blklen(pp); 310*7c478bd9Sstevel@tonic-gate 311*7c478bd9Sstevel@tonic-gate if (blen < nbytes) { /* need to grow */ 312*7c478bd9Sstevel@tonic-gate q = alloc(nbytes); 313*7c478bd9Sstevel@tonic-gate memcpy(q, pp, blen); 314*7c478bd9Sstevel@tonic-gate free(pp); 315*7c478bd9Sstevel@tonic-gate return ((char *)q); 316*7c478bd9Sstevel@tonic-gate } else if (blen == nbytes) { /* do nothing */ 317*7c478bd9Sstevel@tonic-gate return (pp); 318*7c478bd9Sstevel@tonic-gate } else { /* free excess */ 319*7c478bd9Sstevel@tonic-gate q = alloc(nbytes); 320*7c478bd9Sstevel@tonic-gate memcpy(q, pp, nbytes); 321*7c478bd9Sstevel@tonic-gate free(pp); 322*7c478bd9Sstevel@tonic-gate return ((char *)q); 323*7c478bd9Sstevel@tonic-gate } 324*7c478bd9Sstevel@tonic-gate 325*7c478bd9Sstevel@tonic-gate #ifdef undef 326*7c478bd9Sstevel@tonic-gate /* 327*7c478bd9Sstevel@tonic-gate * all of what follows is the _idea_ of what is going to be done 328*7c478bd9Sstevel@tonic-gate * getting the size of the block is a problem -- what follows 329*7c478bd9Sstevel@tonic-gate * is _not_ "real", since "sizeof" isn't going to tell me any 330*7c478bd9Sstevel@tonic-gate * thing usefull, probably have to travers the list to the next 331*7c478bd9Sstevel@tonic-gate * blk, then subtract ptr addrs ... and be careful not to leave 332*7c478bd9Sstevel@tonic-gate * holes. 333*7c478bd9Sstevel@tonic-gate */ 334*7c478bd9Sstevel@tonic-gate p = (struct blk *)pp; 335*7c478bd9Sstevel@tonic-gate if (sizeof (p) < nbytes) { /* need to grow */ 336*7c478bd9Sstevel@tonic-gate q = alloc(nbytes); 337*7c478bd9Sstevel@tonic-gate memcpy(q, pp, sizeof (p)); 338*7c478bd9Sstevel@tonic-gate free(pp); 339*7c478bd9Sstevel@tonic-gate return ((char *)q); 340*7c478bd9Sstevel@tonic-gate } else if (sizeof (p) == nbytes) { /* do nothing */ 341*7c478bd9Sstevel@tonic-gate return (pp); 342*7c478bd9Sstevel@tonic-gate } else { /* free excess */ 343*7c478bd9Sstevel@tonic-gate q = alloc(nbytes); 344*7c478bd9Sstevel@tonic-gate memcpy(q, pp, nbytes); 345*7c478bd9Sstevel@tonic-gate free(pp); 346*7c478bd9Sstevel@tonic-gate return ((char *)q); 347*7c478bd9Sstevel@tonic-gate } 348*7c478bd9Sstevel@tonic-gate #endif 349*7c478bd9Sstevel@tonic-gate } 350