diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2020-03-19 11:28:04 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2020-03-19 11:28:04 +0000 |
commit | 9f9bdc6d9964c15e63aa7abeb78eff3f478b0cfc (patch) | |
tree | afc22e4ff8117865a8e7f2ab56a74396fc154f63 | |
parent | bfe191c490dc33e77e134e9bb5e2c8a3da737a29 (diff) | |
parent | 97b5374547d500fded52d886ceba8a9962af0527 (diff) | |
download | illumos-joyent-9f9bdc6d9964c15e63aa7abeb78eff3f478b0cfc.tar.gz |
[illumos-gate merge]
commit 97b5374547d500fded52d886ceba8a9962af0527
12292 retire libbc
609 files changed, 7 insertions, 70974 deletions
diff --git a/usr/src/cmd/sgs/libdl/sparc/Makefile b/usr/src/cmd/sgs/libdl/sparc/Makefile index 371e25288e..ea152db4b2 100644 --- a/usr/src/cmd/sgs/libdl/sparc/Makefile +++ b/usr/src/cmd/sgs/libdl/sparc/Makefile @@ -30,18 +30,6 @@ include ../Makefile.com DYNFLAGS += -F /usr/lib/ld.so.1 -# A symbolic link from /usr/4lib/libdl.so.1.0 is required for BCP. - -4VERS = .0 - -4DYNLIB = libdl.so.1$(4VERS) -ROOT4LIBDIR = $(ROOT)/usr/4lib -ROOT4LINKS = $(ROOT4LIBDIR)/$(4DYNLIB) -$(ROOT4LINKS):= LIBLINKPATH = ../../lib/ - -install: all $(ROOTLIBDIR) .WAIT $(ROOTLIBS) $(ROOTLINKS) $(ROOT4LINKS) - -$(ROOT4LINKS): $(ROOTFS_DYNLIB) - $(INS.liblink) +install: all $(ROOTLIBDIR) .WAIT $(ROOTLIBS) $(ROOTLINKS) include $(SRC)/lib/Makefile.filter.targ diff --git a/usr/src/lib/libbc/Makefile b/usr/src/lib/libbc/Makefile deleted file mode 100644 index 1118f0bb7c..0000000000 --- a/usr/src/lib/libbc/Makefile +++ /dev/null @@ -1,74 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -LIBRARY= libc.a -VERS= .1.9 - -# include common library definitions -include ../Makefile.lib - -# There should be a mapfile here -MAPFILES = - -CSTD= $(CSTD_GNU89) - -# the bcp libraries go in /usr/4lib. override ROOTLIBDIR from ../Makefile.lib -ROOTLIBDIR= $(ROOT)/usr/4lib - -DYNLIBS5= libc.so.2.9 - -#DYNLIBS5 is also defined in sparc/Makefile - -LIBS = $(DYNLIB) $(DYNLIBS5) - -# dynamic libraries should have executable file mode -FILEMODE= 755 - -.KEEP_STATE: - -all clean clobber: links FRC - @cd $(MACH); pwd; $(MAKE) $@ - -install: links $(MACHLIBS) $(ROOTLIBS) - -# -# NOTE: all of these processor specific links have been hardcoded -# into this Makefile. This is because the libbc library -# is for the Binary Compatiblity Package. The BCP is -# only relevant for Sun4 machines. Future architectures will -# not use this package!!! -# -links: - -$(RM) sparc/inc/machine - $(SYMLINK) sparc sparc/inc/machine - -$(RM) inc/include/machine - $(SYMLINK) sun4 inc/include/machine - -$(RM) mach - $(SYMLINK) sparc mach - -$(RM) sparc/inc/sun4 - $(SYMLINK) sparc sparc/inc/sun4 - -# include MACH-specific library targets -include ../Makefile.mach diff --git a/usr/src/lib/libbc/THIRDPARTYLICENSE b/usr/src/lib/libbc/THIRDPARTYLICENSE deleted file mode 100644 index 73cfd186e1..0000000000 --- a/usr/src/lib/libbc/THIRDPARTYLICENSE +++ /dev/null @@ -1,57 +0,0 @@ -Copyright (c) 1980, 1982-1987 Regents of the University of California. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - 3. All advertising materials mentioning features or use of this - software must display the following acknowledgement: - This product includes software developed by the University - of California, Berkeley and its contributors. - 4. Neither the name of the University nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - * Copyright (c) 1980,1982,1983,1986,1988 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of California at Berkeley. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - - * Copyright (c) 1983,1987 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by the University of California, Berkeley. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. diff --git a/usr/src/lib/libbc/THIRDPARTYLICENSE.descrip b/usr/src/lib/libbc/THIRDPARTYLICENSE.descrip deleted file mode 100644 index 853b68d7f7..0000000000 --- a/usr/src/lib/libbc/THIRDPARTYLICENSE.descrip +++ /dev/null @@ -1 +0,0 @@ -PORTIONS OF SUNOS 4.X BINARY COMPATIBILITY FUNCTIONALITY diff --git a/usr/src/lib/libbc/csu/common/alloc_pbuf.c b/usr/src/lib/libbc/csu/common/alloc_pbuf.c deleted file mode 100644 index 12dd80b2d3..0000000000 --- a/usr/src/lib/libbc/csu/common/alloc_pbuf.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" -/* - * Copyright (c) 1987 Sun Microsystems, Inc. - */ - -#include <fcntl.h> -#include <sys/mman.h> - -/* allocate the buffer to be used by profil(2) */ -char * -_alloc_profil_buf(size) - int size; -{ - char *buf; - int fd; - - if((fd = open("/dev/zero",O_RDONLY)) == -1 ) { - return (char*) -1; - } - buf = (char*) mmap(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); - close(fd); - return buf; -} diff --git a/usr/src/lib/libbc/csu/common/mon.c b/usr/src/lib/libbc/csu/common/mon.c deleted file mode 100644 index 2a144f9ad5..0000000000 --- a/usr/src/lib/libbc/csu/common/mon.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Environment variable PROFDIR added such that: - * If PROFDIR doesn't exist, "mon.out" is produced as before. - * If PROFDIR = NULL, no profiling output is produced. - * If PROFDIR = string, "string/pid.progname" is produced, - * where name consists of argv[0] suitably massaged. - */ -#include <sys/param.h> -#include <sys/dir.h> -#include "mon.h" -#include <sys/fcntl.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> - -#define PROFDIR "PROFDIR" - -extern void profil(), perror(); - -void monitor(char *, char *, char *, int, int); -void moncontrol(int); - -char **___Argv = NULL; /* initialized to argv array by mcrt0 (if loaded) */ - -struct cnt *countbase; -int numctrs; -int profiling; - -static struct mondata { - char *s_sbuf; - int s_bufsiz; - int s_scale; - int s_lowpc; - char mon_out[MAXPATHLEN]; - char progname[MAXNAMLEN]; -} *mondata, *_mondata(); - -#define MSG "No space for monitor buffer(s)\n" - -static struct mondata * -_mondata(void) -{ - struct mondata *d = mondata; - - if (d == 0) { - if ((d = (struct mondata *) - calloc(1, sizeof(struct mondata))) == NULL) { - return (NULL); - } - mondata = d; - } - return (d); -} - -void -monstartup(char *lowpc, char *highpc) -{ - int monsize; - char *buffer; - int cntsiz; - char *_alloc_profil_buf(); - - cntsiz = (highpc - lowpc) * ARCDENSITY / 100; - if (cntsiz < MINARCS) - cntsiz = MINARCS; - monsize = (highpc - lowpc + HISTFRACTION - 1) / HISTFRACTION - + sizeof(struct phdr) + cntsiz * sizeof(struct cnt); - buffer = _alloc_profil_buf(monsize); - if (buffer == (char *)-1) { - write(2, MSG, sizeof(MSG)); - return; - } - monitor(lowpc, highpc, buffer, monsize, cntsiz); -} - -/* - * Arguments - * lowpc, hightpc: boundaries of text to be monitored - * buf: ptr to space for monitor data (WORDs) - * bufsiz: size of above space (in WORDs) - * cntsiz: max no. of functions whose calls are counted - */ -void -monitor(char *lowpc, char *highpc, char *buf, int bufsiz, int cntsiz) -{ - struct mondata *d = _mondata(); - int o; - struct phdr *php; - static int ssiz; - static char *sbuf; - char *s, *name; - - name = d->mon_out; - - if (lowpc == NULL) { /* true only at the end */ - moncontrol(0); - if (sbuf != NULL) { - int pid, n; - - if (d->progname[0] != '\0') { /* finish constructing - "PROFDIR/pid.progname" */ - /* set name to end of PROFDIR */ - name = strrchr(d->mon_out, '\0'); - if ((pid = getpid()) <= 0) /* extra test just in case */ - pid = 1; /* getpid returns something inappropriate */ - for (n = 10000; n > pid; n /= 10) - ; /* suppress leading zeros */ - for ( ; ; n /= 10) { - *name++ = pid/n + '0'; - if (n == 1) - break; - pid %= n; - } - *name++ = '.'; - (void)strcpy(name, d->progname); - } - - if ((o = creat(d->mon_out, 0666)) < 0 || - write(o, sbuf, (unsigned)ssiz) == -1) - perror(d->mon_out); - if (o >= 0) - close(o); - } - return; - } - countbase = (struct cnt *)(buf + sizeof(struct phdr)); - sbuf = NULL; - o = sizeof(struct phdr) + cntsiz * sizeof(struct cnt); - if (ssiz >= bufsiz || lowpc >= highpc) - return; /* buffer too small or PC range bad */ - if ((s = getenv(PROFDIR)) == NULL) /* PROFDIR not in environment */ - (void)strcpy(name, MON_OUT); /* use default "mon.out" */ - else if (*s == '\0') /* value of PROFDIR is NULL */ - return; /* no profiling on this run */ - else { /* set up mon_out and progname to construct - "PROFDIR/pid.progname" when done profiling */ - - while (*s != '\0') /* copy PROFDIR value (path-prefix) */ - *name++ = *s++; - *name++ = '/'; /* two slashes won't hurt */ - if (___Argv != NULL) /* mcrt0.s executed */ - if ((s = strrchr(___Argv[0], '/')) != NULL) - strcpy(d->progname, s + 1); - else - strcpy(d->progname, ___Argv[0]); - } - sbuf = buf; /* for writing buffer at the wrapup */ - ssiz = bufsiz; - php = (struct phdr *)&buf[0]; - php->lpc = (char *)lowpc; /* initialize the first */ - php->hpc = (char *)highpc; /* region of the buffer */ - php->ncnt = cntsiz; - numctrs = cntsiz; - buf += o; - bufsiz -= o; - if (bufsiz <= 0) - return; - o = (highpc - lowpc); - if(bufsiz < o) - o = ((float) bufsiz / o) * 65536; - else - o = 65536; - d->s_scale = o; - d->s_sbuf = buf; - d->s_bufsiz = bufsiz; - d->s_lowpc = (int) lowpc; - moncontrol(1); -} - -/* - * Control profiling - * profiling is what mcount checks to see if - * all the data structures are ready. - */ -void -moncontrol(int mode) -{ - struct mondata *d = _mondata(); - - if (mode) { - /* start */ - profil(d->s_sbuf, d->s_bufsiz, d->s_lowpc, d->s_scale); - profiling = 0; - } else { - /* stop */ - profil((char *)0, 0, 0, 0); - profiling = 3; - } -} diff --git a/usr/src/lib/libbc/csu/common/mon.h b/usr/src/lib/libbc/csu/common/mon.h deleted file mode 100644 index 9178d6252f..0000000000 --- a/usr/src/lib/libbc/csu/common/mon.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -struct phdr { - char *lpc; - char *hpc; - int ncnt; -}; - -typedef unsigned short WORD; - - /* - * fraction of text space to allocate for histogram counters - * here, 1/2 - */ -#define HISTFRACTION 2 - - /* - * percent of text space to allocate for counters - * with a minimum. - */ -#define ARCDENSITY 5 -#define MINARCS 50 - -struct cnt { - int *pc; - long ncall; -}; - -#define MON_OUT "mon.out" -#define MPROGS0 (150 * sizeof(WORD)) /* 300 for pdp11, 600 for 32-bits */ -#define MSCALE0 4 -#ifndef NULL -#define NULL 0 -#endif diff --git a/usr/src/lib/libbc/inc/5include/assert.h b/usr/src/lib/libbc/inc/5include/assert.h deleted file mode 100644 index 6a121aa2b8..0000000000 --- a/usr/src/lib/libbc/inc/5include/assert.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef _assert_h -#define _assert_h - -#ifdef NDEBUG -#define assert(EX) -#else -extern void _assert(); -#define assert(EX) if (EX) ; else _assert("EX", __FILE__, __LINE__) -#endif - -#endif /*!_assert_h*/ diff --git a/usr/src/lib/libbc/inc/5include/ctype.h b/usr/src/lib/libbc/inc/5include/ctype.h deleted file mode 100644 index d4dbe1b312..0000000000 --- a/usr/src/lib/libbc/inc/5include/ctype.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ -/* Portions Copyright (c) 1989 Sun Microsystems, Inc. */ -/* All Rights Reserved */ - - -#ifndef __ctype_h -#define __ctype_h - -#define _U 01 /* Upper case */ -#define _L 02 /* Lower case */ -#define _N 04 /* Numeral (digit) */ -#define _S 010 /* Spacing character */ -#define _P 020 /* Punctuation */ -#define _C 040 /* Control character */ -#define _X 0100 /* heXadecimal digit */ -#define _B 0200 /* Blank */ - -extern int isalnum(/* int c */); -extern int isalpha(/* int c */); -#ifndef _POSIX_SOURCE -extern int isascii(/* int c */); -#endif -extern int iscntrl(/* int c */); -extern int isdigit(/* int c */); -extern int isgraph(/* int c */); -extern int islower(/* int c */); -extern int isprint(/* int c */); -extern int ispunct(/* int c */); -extern int isspace(/* int c */); -extern int isupper(/* int c */); -extern int isxdigit(/* int c */); -#ifndef _POSIX_SOURCE -extern int toascii(/* int c */); -#endif -extern int tolower(/* int c */); -extern int toupper(/* int c */); - -#ifndef lint - -#define isalnum(c) ((_ctype_ + 1)[c] & (_U | _L | _N)) -#define isalpha(c) ((_ctype_ + 1)[c] & (_U | _L)) -#ifndef _POSIX_SOURCE -#define isascii(c) (!((c) & ~0177)) -#endif -#define iscntrl(c) ((_ctype_ + 1)[c] & _C) -#define isdigit(c) ((_ctype_ + 1)[c] & _N) -#define isgraph(c) ((_ctype_ + 1)[c] & (_P | _U | _L | _N)) -#define islower(c) ((_ctype_ + 1)[c] & _L) -#define isprint(c) ((_ctype_ + 1)[c] & (_P | _U | _L | _N | _B)) -#define ispunct(c) ((_ctype_ + 1)[c] & _P) -#define isspace(c) ((_ctype_ + 1)[c] & _S) -#define isupper(c) ((_ctype_ + 1)[c] & _U) -#define isxdigit(c) ((_ctype_ + 1)[c] & _X) -#ifndef _POSIX_SOURCE -#define toascii(c) ((c) & 0177) -/* - * These upper/lower macros are not codeset independent - */ - -#define _toupper(c) ((c) - 'a' + 'A') -#define _tolower(c) ((c) - 'A' + 'a') -#endif - -extern char _ctype_[]; - -#endif /* lint */ - -#endif /* !__ctype_h */ diff --git a/usr/src/lib/libbc/inc/5include/grp.h b/usr/src/lib/libbc/inc/5include/grp.h deleted file mode 100644 index e682e62453..0000000000 --- a/usr/src/lib/libbc/inc/5include/grp.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef __grp_h -#define __grp_h - -#include <sys/types.h> - -/* - * We have to make this POSIX.1 compatible header compatible with SunOS - * Release 4.0.x and the BSD interface provided by /usr/include/grp.h - * so we have a filler to make the gid_t gr_gid field here match the - * int gr_gid field there. - * This will all go away in a later release when gid_t is enlarged. - * Until then watch out for big- vs. little-endian problems in the filler. - */ -struct group { /* see getgrent(3) */ - char *gr_name; - char *gr_passwd; -#if defined(mc68000) || defined(sparc) - short gr_gid_filler; -#endif - gid_t gr_gid; -#if defined(i386) - short gr_gid_filler; -#endif - char **gr_mem; -}; - -#ifndef _POSIX_SOURCE -struct group *getgrent(); -#endif - -struct group *getgrgid(/* gid_t gid */); -struct group *getgrnam(/* char *name */); - -#endif /* !__grp_h */ diff --git a/usr/src/lib/libbc/inc/5include/malloc.h b/usr/src/lib/libbc/inc/5include/malloc.h deleted file mode 100644 index 443564dd02..0000000000 --- a/usr/src/lib/libbc/inc/5include/malloc.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - - -#ifndef __malloc_h -#define __malloc_h - -/* - * Constants defining mallopt operations - */ -#define M_MXFAST 1 /* set size of 'small blocks' */ -#define M_NLBLKS 2 /* set num of small blocks in holding block */ -#define M_GRAIN 3 /* set rounding factor for small blocks */ -#define M_KEEP 4 /* (nop) retain contents of freed blocks */ - -/* - * malloc information structure - */ -struct mallinfo { - int arena; /* total space in arena */ - int ordblks; /* number of ordinary blocks */ - int smblks; /* number of small blocks */ - int hblks; /* number of holding blocks */ - int hblkhd; /* space in holding block headers */ - int usmblks; /* space in small blocks in use */ - int fsmblks; /* space in free small blocks */ - int uordblks; /* space in ordinary blocks in use */ - int fordblks; /* space in free ordinary blocks */ - int keepcost; /* cost of enabling keep option */ - - int mxfast; /* max size of small blocks */ - int nlblks; /* number of small blocks in a holding block */ - int grain; /* small block rounding factor */ - int uordbytes; /* space (including overhead) allocated in ord. blks */ - int allocated; /* number of ordinary blocks allocated */ - int treeoverhead; /* bytes used in maintaining the free tree */ -}; - -typedef void * malloc_t; - -extern malloc_t calloc(/* size_t nmemb, size_t size */); -extern void free(/* malloc_t ptr */); -extern malloc_t malloc(/* size_t size */); -extern malloc_t realloc(/* malloc_t ptr, size_t size */); -extern int mallopt(); -extern struct mallinfo mallinfo(); - -#endif /* !__malloc_h */ diff --git a/usr/src/lib/libbc/inc/5include/pwd.h b/usr/src/lib/libbc/inc/5include/pwd.h deleted file mode 100644 index 15c42a5be0..0000000000 --- a/usr/src/lib/libbc/inc/5include/pwd.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef __pwd_h -#define __pwd_h - -#include <sys/types.h> - -/* - * We have to make this POSIX.1 compatible header compatible with SunOS - * Release 4.0.x and the BSD interface provided by /usr/include/pwd.h - * so we have fillers to make the gid_t pw_gid field here match the - * int pw_gid field there and the uid_t pw_uid field here match the - * int pw_uid field there. - * This will all go away in a later release when gid_t is enlarged. - * Until then watch out for big- vs. little-endian problems in the filler. - */ -struct passwd { - char *pw_name; - char *pw_passwd; -#if defined(mc68000) || defined(sparc) - short pw_uid_filler; -#endif - uid_t pw_uid; -#if defined(i386) - short pw_uid_filler; -#endif -#if defined(mc68000) || defined(sparc) - short pw_gid_filler; -#endif - gid_t pw_gid; -#if defined(i386) - short pw_gid_filler; -#endif - char *pw_age; - char *pw_comment; - char *pw_gecos; - char *pw_dir; - char *pw_shell; -}; - - -#ifndef _POSIX_SOURCE -extern struct passwd *getpwent(); - -struct comment { - char *c_dept; - char *c_name; - char *c_acct; - char *c_bin; -}; - -#endif - -struct passwd *getpwuid(/* uid_t uid */); -struct passwd *getpwnam(/* char *name */); - -#endif /* !__pwd_h */ diff --git a/usr/src/lib/libbc/inc/5include/stdio.h b/usr/src/lib/libbc/inc/5include/stdio.h deleted file mode 100644 index e9650f29e8..0000000000 --- a/usr/src/lib/libbc/inc/5include/stdio.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - - -#ifndef __5include_stdio_h -#define __5include_stdio_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/stdtypes.h> /* for size_t */ - -#if pdp11 -#define BUFSIZ 512 -#elif u370 -#define BUFSIZ 4096 -#else /* just about every other UNIX system in existence */ -#define BUFSIZ 1024 -#endif -#ifndef EOF -#define EOF (-1) -#endif -#define L_ctermid 9 -#define L_cuserid 9 -#define L_tmpnam 25 /* (sizeof (_tmpdir) + 15) */ -#define _tmpdir "/usr/tmp/" -#define FILENAME_MAX 1025 -#define TMP_MAX 17576 - -/* - * ANSI C requires definitions of SEEK_CUR, SEEK_END, and SEEK_SET here. - * They must be kept in sync with SEEK_* in <sys/unistd.h> (as required - * by POSIX.1) and L_* in <sys/file.h>. - * FOPEN_MAX should follow definition of _POSIX_OPEN_MAX in <sys/unistd.h>. - */ - -#ifndef SEEK_SET -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 -#endif - -#define FOPEN_MAX 16 - -#ifndef _POSIX_SOURCE -#define P_tmpdir _tmpdir -#endif -#ifndef NULL -#define NULL 0 -#endif -#define stdin (&_iob[0]) -#define stdout (&_iob[1]) -#define stderr (&_iob[2]) -/* - * _IOLBF means that a file's output will be buffered line by line - * In addition to being flags, _IONBF, _IOLBF and _IOFBF are possible - * values for "type" in setvbuf. - */ -#define _IOFBF 0000 -#define _IOREAD 0001 -#define _IOWRT 0002 -#define _IONBF 0004 -#define _IOMYBUF 0010 -#define _IOEOF 0020 -#define _IOERR 0040 -#define _IOSTRG 0100 -#define _IOLBF 0200 -#define _IORW 0400 -/* - * buffer size for multi-character output to unbuffered files - */ -#define _SBFSIZ 8 - -typedef struct { -#if pdp11 || u370 - unsigned char *_ptr; - int _cnt; -#else /* just about every other UNIX system in existence */ - int _cnt; - unsigned char *_ptr; -#endif - unsigned char *_base; - int _bufsiz; - short _flag; - unsigned char _file; /* should be short */ -} FILE; - -#ifndef _POSIX_SOURCE -extern char *ctermid(char *); /* unistd.h */ -extern char *cuserid(char *); /* unistd.h */ -extern FILE *popen(char *, char *); -extern char *tempnam(char *, char *); -#endif - -extern void clearerr(FILE *); -extern int fclose(FILE *); -extern FILE *fdopen(int, char *); -extern int feof(FILE *); -extern int ferror(FILE *); -extern int fflush(FILE *); -extern int fgetc(FILE *); -extern int fileno(FILE *); -extern FILE *fopen(char *, char *); -extern char *fgets(char *, int, FILE *); -extern int fprintf(FILE *, char *, ...); -extern int fputc(int, FILE *); -extern int fputs(char *, FILE *); -extern size_t fread(char *, int, int, FILE *); -extern FILE *freopen(char *, char *, FILE *); -extern int fscanf(FILE *, char *, ...); -extern int fseek(FILE *, long int, int); -extern long ftell(FILE *); -extern size_t fwrite(char *, int, int, FILE *); -extern int getc(FILE *); -extern int getchar(void); -extern char *gets(char *); -extern void perror(char *); -extern int printf(char *, ...); -extern int putc(int, FILE *); -extern int putchar(int); -extern int puts(char *); -extern int remove(char *); -extern int rename(char *, char *); -extern void rewind(FILE *); -extern int scanf(char *, ...); -extern void setbuf(FILE *, char *); -extern int sprintf(char *, char *, ...); -extern int sscanf(char *, char *, ...); -extern FILE *tmpfile(void); -extern char *tmpnam(char *); -extern int ungetc(int, FILE *); - -#ifndef lint -#define getc(p) (--(p)->_cnt >= 0 ? ((int) *(p)->_ptr++) : _filbuf(p)) -#define putc(x, p) (--(p)->_cnt >= 0 ?\ - (int)(*(p)->_ptr++ = (unsigned char)(x)) :\ - (((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\ - ((*(p)->_ptr = (unsigned char)(x)) != '\n' ?\ - (int)(*(p)->_ptr++) :\ - _flsbuf(*(unsigned char *)(p)->_ptr, p)) :\ - _flsbuf((unsigned char)(x), p))) -#define getchar() getc(stdin) -#define putchar(x) putc((x), stdout) -#define clearerr(p) ((void) ((p)->_flag &= ~(_IOERR | _IOEOF))) -#define feof(p) (((p)->_flag & _IOEOF) != 0) -#define ferror(p) (((p)->_flag & _IOERR) != 0) -#endif - -extern FILE _iob[]; - -#endif /* !__5include_stdio_h */ diff --git a/usr/src/lib/libbc/inc/5include/stdlib.h b/usr/src/lib/libbc/inc/5include/stdlib.h deleted file mode 100644 index 561133fd85..0000000000 --- a/usr/src/lib/libbc/inc/5include/stdlib.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * stdlib.h - */ - -#ifndef __stdlib_h -#define __stdlib_h - -#include <sys/stdtypes.h> /* to get size_t */ - -#define EXIT_SUCCESS 0 -#define EXIT_FAILURE 1 -#define RAND_MAX 0x7fff - -#ifndef NULL -#define NULL 0 -#endif - -extern unsigned int _mb_cur_max; - -#define MB_CUR_MAX _mb_cur_max - -/* declaration of various libc functions */ -extern void abort(/* void */); -extern int abs(/* int j */); -extern double atof(/* const char *nptr */); -extern int atoi(/* const char *nptr */); -extern long int atol(/* const char *nptr */); -extern void * bsearch(/* const void *key, const void *base, size_t nmemb, - size_t size, int (*compar)(const void *, const void *) */); -extern void * calloc(/* size_t nmemb, size_t size */); -extern void exit(/* int status */); -extern void free(/* void *ptr */); -extern char * getenv(/* const char *name */); -extern void * malloc(/* size_t size */); -extern void qsort(/* void *base, size_t nmemb, size_t size, - int (*compar)(const void *, const void *) */); -extern int rand(/* void */); -extern void * realloc(/* void *ptr, size_t size */); -extern void srand(/* unsigned int seed */); - -extern int mbtowc(/* wchar_t *pwc, const char *s, size_t n */); -extern int wctomb(/* char *s, wchar_t wchar */); -extern size_t mbstowcs(/* wchar_t *pwcs, const char *s, size_t n */); -extern size_t wcstombs(/* char *s, const wchar_t *pwcs, size_t n */); -#define mblen(s, n) mbtowc((wchar_t *)0, s, n) - -#endif diff --git a/usr/src/lib/libbc/inc/5include/sys/fcntl.h b/usr/src/lib/libbc/inc/5include/sys/fcntl.h deleted file mode 100644 index e35215fc99..0000000000 --- a/usr/src/lib/libbc/inc/5include/sys/fcntl.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef __sys_fcntl_h -#define __sys_fcntl_h - -#include <sys/fcntlcom.h> - -#ifndef _POSIX_SOURCE -#define O_NDELAY _FNBIO /* Non-blocking I/O (S5 style) */ -#endif - -#endif /* !__sys_fcntl_h */ diff --git a/usr/src/lib/libbc/inc/5include/time.h b/usr/src/lib/libbc/inc/5include/time.h deleted file mode 100644 index 18902b668d..0000000000 --- a/usr/src/lib/libbc/inc/5include/time.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#ifndef __5include_time_h -#define __5include_time_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/stdtypes.h> - -#ifndef NULL -#define NULL 0 -#endif - -struct tm { /* see ctime(3) */ - int tm_sec; - int tm_min; - int tm_hour; - int tm_mday; - int tm_mon; - int tm_year; - int tm_wday; - int tm_yday; - int tm_isdst; - char *tm_zone; - long tm_gmtoff; -}; - -/* - * Following 2 lines are required to make CLK_TCK work. - * If they change here they have to change in <sys/unistd.h> as well. - */ -extern long sysconf(/* int name */); -#define _SC_CLK_TCK 3 /* clock ticks/sec */ -/* - * POSIX.1 uses CLK_TCK to specify units used by times(3). - * POSIX.1a doesn't use a name for this and says CLK_TCK is obsolescent, but - * we'll probably have to support it for a long time. - */ -#define CLK_TCK (sysconf(_SC_CLK_TCK)) -/* 881207 ANSI C draft uses CLOCKS_PER_SEC to specify units used by clock(3). */ -#define CLOCKS_PER_SEC 1000000L - -extern char * asctime(/* const struct tm *t */); -extern char * ctime(/* const time_t *t */); -extern struct tm * gmtime(/* const time_t *t */); -extern struct tm * localtime(/* const time_t *t */); -extern time_t mktime(/* struct tm *timeptr */); -extern size_t strftime(/* char *s, size_t maxsize, const char *format, - const struct tm *timeptr */); -extern time_t time(/* time_t *t */); -extern void tzset(/* void */); - -extern char *tzname[]; -#ifndef _POSIX_SOURCE -extern int daylight; -extern long timezone; -extern void tzsetwall(/* void */); -#endif /* !_POSIX_SOURCE */ - -#endif /* !__5include_time_h */ diff --git a/usr/src/lib/libbc/inc/include/a.out.h b/usr/src/lib/libbc/inc/include/a.out.h deleted file mode 100644 index e40a2e4ad0..0000000000 --- a/usr/src/lib/libbc/inc/include/a.out.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef _a_out_h -#define _a_out_h - -#if !defined(_CROSS_TARGET_ARCH) - - /* The usual, native case. Usage: - * #include <a.out.h> - */ - -#include <machine/a.out.h> - -#else /*defined(_CROSS_TARGET_ARCH)*/ - - /* Used when building a cross-tool, with the target system architecture - * determined by the _CROSS_TARGET_ARCH preprocessor variable at compile - * time. Usage: - * #include <a.out.h> - * ...plus compilation with command (e.g. for Sun-4 target architecture): - * cc -DSUN2=2 -DSUN3=3 -DSUN3X=31 -DSUN4=4 \ - * -D_CROSS_TARGET_ARCH=SUN4 ... - * Note: this may go away in a future release. - */ -# if _CROSS_TARGET_ARCH == SUN2 -# include "sun2/a.out.h" -# elif _CROSS_TARGET_ARCH == SUN3 -# include "sun3/a.out.h" -# elif _CROSS_TARGET_ARCH == SUN3X -# include "sun3x/a.out.h" -# elif _CROSS_TARGET_ARCH == SUN4 -# include "sun4/a.out.h" -# elif _CROSS_TARGET_ARCH == VAX -# include "vax/a.out.h" -# endif - -#endif /*defined(_CROSS_TARGET_ARCH)*/ - -/* - * Usage when building a cross-tool with a fixed target system architecture - * (Sun-4 in this example), bypassing this file: - * #include <sun4/a.out.h> - */ - -#endif /*!_a_out_h*/ diff --git a/usr/src/lib/libbc/inc/include/arpa/inet.h b/usr/src/lib/libbc/inc/include/arpa/inet.h deleted file mode 100644 index 98108ba107..0000000000 --- a/usr/src/lib/libbc/inc/include/arpa/inet.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - * - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * External definitions for - * functions in inet(3N) - */ - -#ifndef _arpa_inet_h -#define _arpa_inet_h - -unsigned long inet_addr(); -char *inet_ntoa(); -/* - * With the introduction of CIDR the following - * routines are now considered to be Obsolete - */ -struct in_addr inet_makeaddr(); -unsigned long inet_network(); - -#endif /* !_arpa_inet_h */ diff --git a/usr/src/lib/libbc/inc/include/auevents.h b/usr/src/lib/libbc/inc/include/auevents.h deleted file mode 100644 index c36f016c67..0000000000 --- a/usr/src/lib/libbc/inc/include/auevents.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" -/* - * Integer, short and long representations of audit event classes - * used by audit mechanism. - * - * audit.h must be included before this include file. AU_* values - * are defined in audit.h. - */ - -#ifndef _auevents_h -#define _auevents_h - -#define AU_ALL AU_DREAD|AU_DWRITE|AU_DACCESS|AU_DCREATE|AU_LOGIN|AU_SREAD|AU_SCTL |AU_MINPRIV|AU_MAJPRIV|AU_ADMIN|AU_ASSIGN - -struct event_cl { - unsigned int event_mask; - char *event_sname; - char *event_lname; -} event_class[] ={ - AU_DREAD, "dr", "data_read", - AU_DWRITE, "dw", "data_write", - AU_DACCESS, "da", "data_access_change", - AU_DCREATE, "dc", "data_create", - AU_LOGIN, "lo", "login_logout", - AU_SREAD, "sr", "spooler_read", - AU_SCTL, "sc", "spooler_control", - AU_MINPRIV, "p0", "minor_privilege", - AU_MAJPRIV, "p1", "major_privilege", - AU_ADMIN, "ad", "administrative", - AU_ASSIGN, "as", "device_assign", - AU_ALL, "all", "all" -}; - -#endif /*!_auevents_h*/ diff --git a/usr/src/lib/libbc/inc/include/ctype.h b/usr/src/lib/libbc/inc/include/ctype.h deleted file mode 100644 index 79bfcdc407..0000000000 --- a/usr/src/lib/libbc/inc/include/ctype.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - - -#define _U 01 -#define _L 02 -#define _N 04 -#define _S 010 -#define _P 020 -#define _C 040 -#define _X 0100 -#define _B 0200 - -extern char _ctype_[]; - -#define isalpha(c) ((_ctype_+1)[c]&(_U|_L)) -#define isupper(c) ((_ctype_+1)[c]&_U) -#define islower(c) ((_ctype_+1)[c]&_L) -#define isdigit(c) ((_ctype_+1)[c]&_N) -#define isxdigit(c) ((_ctype_+1)[c]&_X) -#define isspace(c) ((_ctype_+1)[c]&_S) -#define ispunct(c) ((_ctype_+1)[c]&_P) -#define isalnum(c) ((_ctype_+1)[c]&(_U|_L|_N)) -#define isprint(c) ((_ctype_+1)[c]&(_P|_U|_L|_N|_B)) -#define isgraph(c) ((_ctype_+1)[c]&(_P|_U|_L|_N)) -#define iscntrl(c) ((_ctype_+1)[c]&_C) -#define isascii(c) ((unsigned)(c)<=0177) -#define toascii(c) ((c)&0177) diff --git a/usr/src/lib/libbc/inc/include/des/des_crypt.h b/usr/src/lib/libbc/inc/include/des/des_crypt.h deleted file mode 100644 index 521da663e1..0000000000 --- a/usr/src/lib/libbc/inc/include/des/des_crypt.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2000 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -/* - * Portions of this source code were derived from Berkeley 4.3 BSD - * under license from the Regents of the University of California. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * des_crypt.h, des library routine interface - */ - -#define DES_MAXDATA 8192 /* max bytes encrypted in one call */ -#define DES_DIRMASK (1 << 0) -#define DES_ENCRYPT (0*DES_DIRMASK) /* Encrypt */ -#define DES_DECRYPT (1*DES_DIRMASK) /* Decrypt */ - - -#define DES_DEVMASK (1 << 1) -#define DES_HW (0*DES_DEVMASK) /* Use hardware device */ -#define DES_SW (1*DES_DEVMASK) /* Use software device */ - - -#define DESERR_NONE 0 /* succeeded */ -#define DESERR_NOHWDEVICE 1 /* succeeded, but hw device not available */ -#define DESERR_HWERROR 2 /* failed, hardware/driver error */ -#define DESERR_BADPARAM 3 /* failed, bad parameter to call */ - -#define DES_FAILED(err) \ - ((err) > DESERR_NOHWDEVICE) - -/* - * cbc_crypt() - * ecb_crypt() - * - * Encrypt (or decrypt) len bytes of a buffer buf. - * The length must be a multiple of eight. - * The key should have odd parity in the low bit of each byte. - * ivec is the input vector, and is updated to the new one (cbc only). - * The mode is created by oring together the appropriate parameters. - * DESERR_NOHWDEVICE is returned if DES_HW was specified but - * there was no hardware to do it on (the data will still be - * encrypted though, in software). - */ - - -/* - * Cipher Block Chaining mode - */ -int -cbc_crypt(/* key, buf, len, mode, ivec */); /* - char *key; - char *buf; - unsigned len; - unsigned mode; - char *ivec; -*/ - - -/* - * Electronic Code Book mode - */ -int -ecb_crypt(/* key, buf, len, mode */); /* - char *key; - char *buf; - unsigned len; - unsigned mode; -*/ - - -#ifndef KERNEL -/* - * Set des parity for a key. - * DES parity is odd and in the low bit of each byte - */ -void -des_setparity(/* key */); /* - char *key; -*/ -#endif diff --git a/usr/src/lib/libbc/inc/include/dirent.h b/usr/src/lib/libbc/inc/include/dirent.h deleted file mode 100644 index 03a8891f78..0000000000 --- a/usr/src/lib/libbc/inc/include/dirent.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Filesystem-independent directory information. - */ - -#ifndef __dirent_h -#define __dirent_h - -#include <sys/types.h> - -#ifndef _POSIX_SOURCE -#define d_ino d_fileno /* compatability */ -#ifndef NULL -#define NULL 0 -#endif -#endif /* !_POSIX_SOURCE */ - -/* - * Definitions for library routines operating on directories. - */ -typedef struct __dirdesc { - int dd_fd; /* file descriptor */ - long dd_loc; /* buf offset of entry from last readddir() */ - long dd_size; /* amount of valid data in buffer */ - long dd_bsize; /* amount of entries read at a time */ - long dd_off; /* Current offset in dir (for telldir) */ - char *dd_buf; /* directory data buffer */ -} DIR; - -extern DIR *opendir(/* char *dirname */); -extern struct dirent *readdir(/* DIR *dirp */); -extern int closedir(/* DIR *dirp */); -#ifndef _POSIX_SOURCE -extern void seekdir(/* DIR *dirp, int loc */); -extern long telldir(/* DIR *dirp */); -#endif /* POSIX_SOURCE */ -extern void rewinddir(/* DIR *dirp */); - -#ifndef lint -#define rewinddir(dirp) seekdir((dirp), (long)0) -#endif - -#include <sys/dirent.h> - -#endif /* !__dirent_h */ diff --git a/usr/src/lib/libbc/inc/include/dlfcn.h b/usr/src/lib/libbc/inc/include/dlfcn.h deleted file mode 100644 index 2ea9524e07..0000000000 --- a/usr/src/lib/libbc/inc/include/dlfcn.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef _dlfcn_h -#define _dlfcn_h - -/* - * Copyright (c) 1989 Sun Microsystems, Inc. - */ - -/* - * Interface description for the contents of libdl -- simple programmer's - * interfaces to the dynamic linker. - */ - -/* - * Manifest constants - */ -#define RTLD_LAZY 1 /* deferred binding of procedures */ - -/* - * Function declarations - */ -extern void *dlopen(); /* open and map a shared object */ -extern void *dlsym(); /* obtain address of symbol */ -extern int dlclose(); /* remove a shared object */ -extern char *dlerror(); /* string representing last error */ - -#endif /* !_dlfcn_h */ diff --git a/usr/src/lib/libbc/inc/include/errno.h b/usr/src/lib/libbc/inc/include/errno.h deleted file mode 100644 index 06955eea4e..0000000000 --- a/usr/src/lib/libbc/inc/include/errno.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Error codes - */ - -#ifndef _errno_h -#define _errno_h - -#include <sys/errno.h> -extern int errno; - -#endif /*!_errno_h*/ diff --git a/usr/src/lib/libbc/inc/include/exportent.h b/usr/src/lib/libbc/inc/include/exportent.h deleted file mode 100644 index 907bbe6d41..0000000000 --- a/usr/src/lib/libbc/inc/include/exportent.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Exported file system table, see exportent(3) - * Copyright (C) 1986 by Sun Microsystems, Inc. - */ - -#ifndef _exportent_h -#define _exportent_h - -#define TABFILE "/etc/xtab" /* where the table is kept */ - -/* - * Options keywords - */ -#define ACCESS_OPT "access" /* machines that can mount fs */ -#define ROOT_OPT "root" /* machines with root access of fs */ -#define RO_OPT "ro" /* export read-only */ -#define RW_OPT "rw" /* export read-mostly */ -#define ANON_OPT "anon" /* uid for anonymous requests */ -#define SECURE_OPT "secure" /* require secure NFS for access */ -#define WINDOW_OPT "window" /* expiration window for credential */ - -struct exportent { - char *xent_dirname; /* directory (or file) to export */ - char *xent_options; /* options, as above */ -}; - -extern FILE *setexportent(); -extern void endexportent(); -extern int remexportent(); -extern int addexportent(); -extern char *getexportopt(); -extern struct exportent *getexportent(); - -#endif /*!_exportent_h*/ diff --git a/usr/src/lib/libbc/inc/include/floatingpoint.h b/usr/src/lib/libbc/inc/include/floatingpoint.h deleted file mode 100644 index 251bb3003f..0000000000 --- a/usr/src/lib/libbc/inc/include/floatingpoint.h +++ /dev/null @@ -1,197 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -/* - * IEEE floating-point definitions for constants, types, variables, and - * functions implemented in libc.a for: IEEE floating-point arithmetic base - * conversion; IEEE floating-point arithmetic modes; IEEE floating-point - * arithmetic exception handling; certain functions defined in 4.3 BSD and - * System V. - */ - -#ifndef _floatingpoint_h -#define _floatingpoint_h - -#include <sys/ieeefp.h> - -/* Sun TYPES for IEEE floating point. */ - -typedef float single; -typedef unsigned long extended[3]; /* MC68881/i80387 double-extended type. */ -#ifdef __STDC__ -typedef long double quadruple; /* Quadruple-precision type. */ -#else -typedef struct { - unsigned long u[4]; -} quadruple; /* Quadruple-precision type. */ -#endif - -#define N_IEEE_EXCEPTION 5 /* Number of floating-point exceptions. */ - -typedef unsigned fp_exception_field_type; -/* - * A field containing fp_exceptions OR'ed together. - */ - -typedef int sigfpe_code_type; /* Type of SIGFPE code. */ - -typedef void (*sigfpe_handler_type) (); -/* Pointer to exception handler function. */ - -#define SIGFPE_DEFAULT (void (*)())0 /* default exception handling */ -#define SIGFPE_IGNORE (void (*)())1 /* ignore this exception or code */ -#define SIGFPE_ABORT (void (*)())2 /* force abort on exception */ - -/* Sun VARIABLES for IEEE floating point. */ - -extern enum fp_direction_type fp_direction; -/* - * Current rounding direction. Updated by ieee_flags. - */ - -extern enum fp_precision_type fp_precision; -/* - * Current rounding precision. Updated by ieee_flags. - */ - -extern fp_exception_field_type fp_accrued_exceptions; -/* - * Sticky accumulated exceptions, updated by ieee_flags. In hardware - * implementations this variable is not automatically updated as the hardware - * changes and should therefore not be relied on directly. - */ - -/* Sun definitions for base conversion. */ - -#define DECIMAL_STRING_LENGTH 512 -/* Size of buffer in decimal_record. */ - -typedef char decimal_string[DECIMAL_STRING_LENGTH]; -/* Decimal significand. */ - -typedef struct { - enum fp_class_type fpclass; - int sign; - int exponent; - decimal_string ds; /* Significand - each char contains an ascii - * digit, except the string-terminating ascii - * null. */ - int more; /* On conversion from decimal to binary, != 0 - * indicates more non-zero digits following - * ds. */ - int ndigits;/* On fixed_form conversion from binary to - * decimal, contains number of digits - * required for ds. */ -} - decimal_record; - -enum decimal_form { - fixed_form, /* Fortran F format: ndigits specifies number - * of digits after point; if negative, - * specifies rounding to occur to left of - * point. */ - floating_form /* Fortran E format: ndigits specifies number - * of significant digits. */ -}; - -typedef struct { - enum fp_direction_type rd; - /* Rounding direction. */ - enum decimal_form df; /* Format for binary to decimal conversion. */ - int ndigits;/* Number of digits for conversion. */ -} - decimal_mode; - -enum decimal_string_form { /* Valid decimal number string formats. */ - invalid_form, /* Not a valid decimal string format. */ - whitespace_form, /* All white space - valid in Fortran! */ - fixed_int_form, /* <digs> */ - fixed_intdot_form, /* <digs>. */ - fixed_dotfrac_form, /* .<digs> */ - fixed_intdotfrac_form, /* <digs>.<frac> */ - floating_int_form, /* <digs><exp> */ - floating_intdot_form, /* <digs>.<exp> */ - floating_dotfrac_form, /* .<digs><exp> */ - floating_intdotfrac_form, /* <digs>.<digs><exp> */ - inf_form, /* inf */ - infinity_form, /* infinity */ - nan_form, /* nan */ - nanstring_form /* nan(string) */ -}; - -/* The following externs are used in the implementation of sprintf. */ - -extern void double_to_decimal(); -extern void quadruple_to_decimal(); -extern char *econvert(); -extern char *fconvert(); -extern char *gconvert(); -extern char *qeconvert(); -extern char *qfconvert(); -extern char *qgconvert(); - -/* - The following are used for other parts of base conversion. -*/ - -extern sigfpe_handler_type ieee_handlers[N_IEEE_EXCEPTION]; -/* - * Array of pointers to functions to handle SIGFPE's corresponding to IEEE - * fp_exceptions. sigfpe_default means do not generate SIGFPE. An invalid - * address such as sigfpe_abort will cause abort on that SIGFPE. Updated by - * ieee_handler. - */ - -extern sigfpe_handler_type sigfpe(); - -extern void single_to_decimal(); -extern void extended_to_decimal(); - -extern void decimal_to_single(); -extern void decimal_to_double(); -extern void decimal_to_extended(); -extern void decimal_to_quadruple(); - -extern char *seconvert(); -extern char *sfconvert(); -extern char *sgconvert(); - -extern void string_to_decimal(); -extern void file_to_decimal(); -extern void func_to_decimal(); - -/* Definitions from 4.3 BSD math.h 4.6 9/11/85 */ - -extern double atof(); - -/* Definitions from System V */ - -extern int errno; - -extern double strtod(); - -#endif /* !_floatingpoint_h */ diff --git a/usr/src/lib/libbc/inc/include/fstab.h b/usr/src/lib/libbc/inc/include/fstab.h deleted file mode 100644 index 35b415891f..0000000000 --- a/usr/src/lib/libbc/inc/include/fstab.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * File system table, see fstab (5) - * - * Used by dump, mount, umount, swapon, fsck, df, ... - * - * The fs_spec field is the block special name. Programs - * that want to use the character special name must create - * that name by prepending a 'r' after the right most slash. - * Quota files are always named "quotas", so if type is "rq", - * then use concatenation of fs_file and "quotas" to locate - * quota file. - */ - -#ifndef _fstab_h -#define _fstab_h - -#define FSTAB "/etc/fstab" - -#define FSTAB_RW "rw" /* read/write device */ -#define FSTAB_RQ "rq" /* read/write with quotas */ -#define FSTAB_RO "ro" /* read-only device */ -#define FSTAB_SW "sw" /* swap device */ -#define FSTAB_XX "xx" /* ignore totally */ - -struct fstab{ - char *fs_spec; /* block special device name */ - char *fs_file; /* file system path prefix */ - char *fs_type; /* FSTAB_* */ - int fs_freq; /* dump frequency, in days */ - int fs_passno; /* pass number on parallel dump */ -}; - -struct fstab *getfsent(); -struct fstab *getfsspec(); -struct fstab *getfsfile(); -struct fstab *getfstype(); -int setfsent(); -int endfsent(); - -#endif /*!_fstab_h*/ diff --git a/usr/src/lib/libbc/inc/include/ftw.h b/usr/src/lib/libbc/inc/include/ftw.h deleted file mode 100644 index 68b43db4e1..0000000000 --- a/usr/src/lib/libbc/inc/include/ftw.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Codes for the third argument to the user-supplied function - * which is passed as the second argument to ftw - */ - -#ifndef _ftw_h -#define _ftw_h - -#define FTW_F 0 /* file */ -#define FTW_D 1 /* directory */ -#define FTW_DNR 2 /* directory without read permission */ -#define FTW_NS 3 /* unknown type, stat failed */ - -#endif /*!_ftw_h*/ diff --git a/usr/src/lib/libbc/inc/include/grp.h b/usr/src/lib/libbc/inc/include/grp.h deleted file mode 100644 index 930ba2cc63..0000000000 --- a/usr/src/lib/libbc/inc/include/grp.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef __grp_h -#define __grp_h - -#include <sys/types.h> - -struct group { /* see getgrent(3) */ - char *gr_name; - char *gr_passwd; - int gr_gid; - char **gr_mem; -}; - -#ifndef _POSIX_SOURCE -struct group *getgrent(); -#endif - -struct group *getgrgid(/* gid_t gid */); -struct group *getgrnam(/* char *name */); - -#endif /* !__grp_h */ diff --git a/usr/src/lib/libbc/inc/include/grpadj.h b/usr/src/lib/libbc/inc/include/grpadj.h deleted file mode 100644 index df0c523f5d..0000000000 --- a/usr/src/lib/libbc/inc/include/grpadj.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef _grpadj_h -#define _grpadj_h - -struct group_adjunct { /* see getgraent(3) */ - char *gra_name; - char *gra_passwd; -}; - -struct group_adjunct *getgraent(), *getgragid(), *getgranam(); - -#endif /*!_grpadj_h*/ diff --git a/usr/src/lib/libbc/inc/include/langinfo.h b/usr/src/lib/libbc/inc/include/langinfo.h deleted file mode 100644 index af915fa5bc..0000000000 --- a/usr/src/lib/libbc/inc/include/langinfo.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * language infomation constants. - */ - -#define D_T_FMT 0 /* string for formatting data and time */ -#define DAY_1 1 /* Name of the first day of the week */ -#define DAY_2 2 -#define DAY_3 3 -#define DAY_4 4 -#define DAY_5 5 -#define DAY_6 6 -#define DAY_7 7 - -#define ABDAY_1 8 /* Abbreviated name of the first day of the week */ -#define ABDAY_2 9 -#define ABDAY_3 10 -#define ABDAY_4 11 -#define ABDAY_5 12 -#define ABDAY_6 13 -#define ABDAY_7 14 - -#define MON_1 15 /* Name of the first month */ -#define MON_2 16 -#define MON_3 17 -#define MON_4 18 -#define MON_5 19 -#define MON_6 20 -#define MON_7 21 -#define MON_8 22 -#define MON_9 23 -#define MON_10 24 -#define MON_11 25 -#define MON_12 26 - -#define ABMON_1 27 /* Abbreviated name of the first month */ -#define ABMON_2 28 -#define ABMON_3 29 -#define ABMON_4 30 -#define ABMON_5 31 -#define ABMON_6 32 -#define ABMON_7 33 -#define ABMON_8 34 -#define ABMON_9 35 -#define ABMON_10 36 -#define ABMON_11 37 -#define ABMON_12 38 - -#define RADIXCHAR 39 /* Radix character */ -#define THOUSEP 40 /* Separator for thousands */ -#define YESSTR 41 /* Affirmative response for yes/no queries */ -#define NOSTR 42 /* Negative response for yes/no queries */ -#define CRNCYSTR 43 /* Currency symbol */ diff --git a/usr/src/lib/libbc/inc/include/limits.h b/usr/src/lib/libbc/inc/include/limits.h deleted file mode 100644 index 33a4b8833d..0000000000 --- a/usr/src/lib/libbc/inc/include/limits.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" -/* from S5R2 1.1 */ - -#ifndef __sys_limits_h -#define __sys_limits_h - -#define CHAR_BIT 0x8 -#define SCHAR_MIN -0x80 -#define SCHAR_MAX 0x7F -#define UCHAR_MAX 0xFF -#define CHAR_MIN -0x80 -#define CHAR_MAX 0x7F -#define SHRT_MIN -0x8000 -#define SHRT_MAX 0x7FFF -#define USHRT_MAX 0xFFFF -#define INT_MIN -0x80000000 -#define INT_MAX 0x7FFFFFFF -#define UINT_MAX 0xFFFFFFFF -#define LONG_MIN -0x80000000 -#define LONG_MAX 0x7FFFFFFF -#define ULONG_MAX 0xFFFFFFFF -#define MB_LEN_MAX 4 - -/* - * All POSIX systems must support the following values - * A system may support less restrictive values - */ -#define _POSIX_ARG_MAX 4096 -#define _POSIX_CHILD_MAX 6 -#define _POSIX_LINK_MAX 8 -#define _POSIX_MAX_CANON 255 -#define _POSIX_MAX_INPUT 255 -#define _POSIX_NAME_MAX 14 -#define _POSIX_NGROUPS_MAX 0 -#define _POSIX_OPEN_MAX 16 -#define _POSIX_PATH_MAX 255 -#define _POSIX_PIPE_BUF 512 - -#define NGROUPS_MAX 16 /* Must match <sys/param.h> NGROUPS */ -#endif /* !__sys_limits_h */ diff --git a/usr/src/lib/libbc/inc/include/link.h b/usr/src/lib/libbc/inc/include/link.h deleted file mode 100644 index b8e7cf217a..0000000000 --- a/usr/src/lib/libbc/inc/include/link.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1987 by Sun Microsystems, Inc. - */ - -/* - * Link editor public definitions. - */ - -#ifndef _link_h -#define _link_h - -/* - * Structure describing logical name and requirements on an object - * which is to be loaded dynamically. - */ -struct old_link_object { - char *lo_name; /* name of object */ - int lo_library : 1, /* searched for by library rules */ - lo_unused : 31; - short lo_major; /* major version number */ - short lo_minor; /* minor version number */ -}; - -struct link_object { - long lo_name; /* name (often relative) */ - int lo_library : 1, /* searched for by library rules */ - lo_unused : 31; - short lo_major; /* major version number */ - short lo_minor; /* minor version number */ - long lo_next; /* next one (often relative) */ -}; - -/* - * Structure describing name and placement of dynamically loaded - * objects in a process' address space. - */ -struct link_map { - caddr_t lm_addr; /* address at which object mapped */ - char *lm_name; /* full name of loaded object */ - struct link_map *lm_next; /* next object in map */ - struct link_object *lm_lop; /* link object that got us here */ - caddr_t lm_lob; /* base address for said link object */ - int lm_rwt : 1; /* text is read/write */ - struct link_dynamic *lm_ld; /* dynamic structure */ - caddr_t lm_lpd; /* loader private data */ -}; - -/* - * Version 1 of dynamic linking information. With the exception of - * ld_loaded (determined at execution time) and ld_stab_hash (a special - * case of relocation handled at execution time), the values in this - * structure reflect offsets from the containing link_dynamic structure. - */ -struct link_dynamic_1 { - struct link_map *ld_loaded; /* list of loaded objects */ - long ld_need; /* list of needed objects */ - long ld_rules; /* search rules for library objects */ - long ld_got; /* global offset table */ - long ld_plt; /* procedure linkage table */ - long ld_rel; /* relocation table */ - long ld_hash; /* symbol hash table */ - long ld_stab; /* symbol table itself */ - long (*ld_stab_hash)(); /* "pointer" to symbol hash function */ - long ld_buckets; /* number of hash buckets */ - long ld_symbols; /* symbol strings */ - long ld_symb_size; /* size of symbol strings */ - long ld_text; /* size of text area */ -}; - -struct link_dynamic_2 { - struct link_map *ld_loaded; /* list of loaded objects */ - long ld_need; /* list of needed objects */ - long ld_rules; /* search rules for library objects */ - long ld_got; /* global offset table */ - long ld_plt; /* procedure linkage table */ - long ld_rel; /* relocation table */ - long ld_hash; /* symbol hash table */ - long ld_stab; /* symbol table itself */ - long (*ld_stab_hash)(); /* "pointer" to symbol hash function */ - long ld_buckets; /* number of hash buckets */ - long ld_symbols; /* symbol strings */ - long ld_symb_size; /* size of symbol strings */ - long ld_text; /* size of text area */ - long ld_plt_sz; /* size of procedure linkage table */ -}; - -/* - * Structure pointing to run time allocated common symbols and - * its string. - */ -struct rtc_symb { - struct nlist *rtc_sp; /* symbol for common */ - struct rtc_symb *rtc_next; /* next common */ -}; - -/* - * Debugger interface structure. - */ -struct ld_debug { - int ldd_version; /* version # of interface */ - int ldd_in_debugger; /* a debugger is running us */ - int ldd_sym_loaded; /* we loaded some symbols */ - char *ldd_bp_addr; /* place for ld-generated bpt */ - int ldd_bp_inst; /* instruction which was there */ - struct rtc_symb *ldd_cp; /* commons we built */ -}; - -/* - * Structure associated with each object which may be or which requires - * execution-time link editing. Used by the run-time linkage editor to - * identify needed objects and symbol definitions and references. - */ -struct old_link_dynamic { - int ld_version; /* version # of this structure */ - union { - struct link_dynamic_1 ld_1; - } ld_un; - - int in_debugging; - int sym_loaded; - char *bp_addr; - int bp_inst; - struct rtc_symb *cp; /* pointer to an array of runtime */ - /* allocated common symbols. */ -}; - -struct link_dynamic { - int ld_version; /* version # of this structure */ - struct ld_debug *ldd; - union { - struct link_dynamic_1 *ld_1; - struct link_dynamic_2 *ld_2; - } ld_un; -}; - -#define v2 ld_un.ld_2 -#define v1 ld_un.ld_1 - -/* - * get size of relocations - */ -#define GETGOTSZ(x) (x->ld_version < 2 ? ((struct old_link_dynamic *) x)->v1.ld_plt - ((struct old_link_dynamic *) x)->v1.ld_got : (x)->v2->ld_plt - (x)->v2->ld_got) - -#define GETPLTSZ(x) (x->ld_version < 2 ? ((struct old_link_dynamic *) x)->v1.ld_rel - ((struct old_link_dynamic *) x)->v1.ld_plt : (x)->v2->ld_rel - (x)->v2->ld_plt) - -#define GETRELSZ(x) (x->ld_version < 2 ? ((struct old_link_dynamic *) x)->v1.ld_hash - ((struct old_link_dynamic *) x)->v1.ld_rel : (x)->v2->ld_hash - (x)->v2->ld_rel) - -#define GETHASHSZ(x) (x->ld_version < 2 ? ((struct old_link_dynamic *) x)->v1.ld_stab - ((struct old_link_dynamic *) x)->v1.ld_hash : (x)->v2->ld_stab - (x)->v2->ld_hash) - -#define GETSTABSZ(x) (x->ld_version < 2 ? ((struct old_link_dynamic *) x)->v1.ld_symbols - ((struct old_link_dynamic *) x)->v1.ld_stab : (x)->v2->ld_symbols - (x)->v2->ld_stab) - -#undef v2 -#undef v1 - -#endif /*!_link_h*/ diff --git a/usr/src/lib/libbc/inc/include/locale.h b/usr/src/lib/libbc/inc/include/locale.h deleted file mode 100644 index 1018fb3700..0000000000 --- a/usr/src/lib/libbc/inc/include/locale.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef __locale_h -#define __locale_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Locale indices. - */ - -#ifndef NULL -#define NULL 0 -#endif - -#define LC_ALL 0 -#define LC_CTYPE 1 -#define LC_NUMERIC 2 -#define LC_TIME 3 -#define LC_MONETARY 4 -#ifndef _POSIX_SOURCE -#define LANGINFO 5 -#endif -#define LC_COLLATE 6 -#define LC_MESSAGES 7 - -#ifndef _POSIX_SOURCE -#define MAXLOCALE 8 - -#define ON 1 -#define OFF 0 -/* The maximum number of characters in the locale name */ - -#define MAXLOCALENAME 14 - -/* The maximum number of substitute mappings in LC_COLLATE table */ - -#define MAXSUBS 64 - -/* Max width of domain name */ - -#define MAXDOMAIN 255 - -/* Max width of format string for message domains */ - -#define MAXFMTS 32 - -/* Max width of the message string */ - -#define MAXMSGSTR 255 - -/* The directory where category components are kept */ - -#define LOCALE_DIR "/usr/share/lib/locale/" - -/* The directory that is private to an individual workstation user */ - -#define PRIVATE_LOCALE_DIR "/etc/locale/" - -/* The name of the file that contains default locale */ - -#define DEFAULT_LOC ".default" - - -/* size of "ctype" */ - -#define CTYPE_SIZE 514 -#endif /* _POSIX_SOURCE */ - -extern char * setlocale(/* int category, const char *locale */); -extern struct lconv * localeconv(/* void */); -#ifndef _POSIX_SOURCE -extern struct dtconv * localdtconv(); -#endif - -/* - * Numeric and monetary conversion information. - */ -struct lconv { - char *decimal_point; /* decimal point character */ - char *thousands_sep; /* thousands separator character */ - char *grouping; /* grouping of digits */ - char *int_curr_symbol; /* international currency symbol */ - char *currency_symbol; /* local currency symbol */ - char *mon_decimal_point; /* monetary decimal point character */ - char *mon_thousands_sep; /* monetary thousands separator */ - char *mon_grouping; /* monetary grouping of digits */ - char *positive_sign; /* monetary credit symbol */ - char *negative_sign; /* monetary debit symbol */ - char int_frac_digits; /* intl monetary number of fractional digits */ - char frac_digits; /* monetary number of fractional digits */ - char p_cs_precedes; /* true if currency symbol precedes credit */ - char p_sep_by_space; /* true if space separates c.s. from credit */ - char n_cs_precedes; /* true if currency symbol precedes debit */ - char n_sep_by_space; /* true if space separates c.s. from debit */ - char p_sign_posn; /* position of sign for credit */ - char n_sign_posn; /* position of sign for debit */ -}; - -#ifndef _POSIX_SOURCE -/* - * Date and time conversion information. - */ -struct dtconv { - char *abbrev_month_names[12]; /* abbreviated month names */ - char *month_names[12]; /* full month names */ - char *abbrev_weekday_names[7]; /* abbreviated weekday names */ - char *weekday_names[7]; /* full weekday names */ - char *time_format; /* time format */ - char *sdate_format; /* short date format */ - char *dtime_format; /* date/time format */ - char *am_string; /* AM string */ - char *pm_string; /* PM string */ - char *ldate_format; /* long date format */ -}; - -/* - * Langinfo - */ -struct langinfo { - char *yesstr; /* yes string */ - char *nostr; /* nostr */ -}; - -/* - * NLS nl_init - */ -#define valid(ptr) (ptr != (char *) NULL) -#define nl_init(lang) ((valid(lang) && *lang) ? \ - (valid(setlocale (LC_ALL, lang) ) ? 0 : -1) \ - : -1) -#endif /* _POSIX_SOURCE */ - -#endif /* !__locale_h */ diff --git a/usr/src/lib/libbc/inc/include/malloc.h b/usr/src/lib/libbc/inc/include/malloc.h deleted file mode 100644 index b3c2214bbc..0000000000 --- a/usr/src/lib/libbc/inc/include/malloc.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef __malloc_h -#define __malloc_h - -/* - * Constants defining mallopt operations - */ -#define M_MXFAST 1 /* set size of 'small blocks' */ -#define M_NLBLKS 2 /* set num of small blocks in holding block */ -#define M_GRAIN 3 /* set rounding factor for small blocks */ -#define M_KEEP 4 /* (nop) retain contents of freed blocks */ - -/* - * malloc information structure - */ -struct mallinfo { - int arena; /* total space in arena */ - int ordblks; /* number of ordinary blocks */ - int smblks; /* number of small blocks */ - int hblks; /* number of holding blocks */ - int hblkhd; /* space in holding block headers */ - int usmblks; /* space in small blocks in use */ - int fsmblks; /* space in free small blocks */ - int uordblks; /* space in ordinary blocks in use */ - int fordblks; /* space in free ordinary blocks */ - int keepcost; /* cost of enabling keep option */ - - int mxfast; /* max size of small blocks */ - int nlblks; /* number of small blocks in a holding block */ - int grain; /* small block rounding factor */ - int uordbytes; /* space (including overhead) allocated in ord. blks */ - int allocated; /* number of ordinary blocks allocated */ - int treeoverhead; /* bytes used in maintaining the free tree */ -}; - -typedef char * malloc_t; - -extern malloc_t calloc(/* size_t nmemb, size_t size */); -extern int free(/* malloc_t ptr */); -extern malloc_t malloc(/* size_t size */); -extern malloc_t realloc(/* malloc_t ptr, size_t size */); -extern int mallopt(); -extern struct mallinfo mallinfo(); - -#endif /* !__malloc_h */ diff --git a/usr/src/lib/libbc/inc/include/math.h b/usr/src/lib/libbc/inc/include/math.h deleted file mode 100644 index 0f864b1b7a..0000000000 --- a/usr/src/lib/libbc/inc/include/math.h +++ /dev/null @@ -1,357 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - - -/* - * Math library definitions for all the public functions implemented in libm.a. - */ - -#ifndef __math_h -#define __math_h - -/* - * Posix (actually ansi C) section - */ -#define HUGE_VAL (__infinity()) /* Produces IEEE Infinity. */ - - -extern double __infinity(); -extern double acos(/* double x */); -extern double asin(/* double x */); -extern double atan(/* double x */); -extern double atan2(/* double y, double x */); -extern double ceil(/* double x */); -extern double cos(/* double x */); -extern double cosh(/* double x */); -extern double exp(/* double x */); -extern double fabs(/* double x */); -extern double floor(/* double x */); -extern double fmod(/* double x, double y */); -extern double frexp(/* double value, int *exp */); -extern double ldexp(/* double value, int exp */); -extern double log(/* double x */); -extern double log10(/* double x */); -extern double modf(/* double value, double *iptr */); -extern double pow(/* double x, double y */); -extern double sin(/* double x */); -extern double sinh(/* double x */); -extern double sqrt(/* double x */); -extern double tan(/* double x */); -extern double tanh(/* double x */); - -#ifndef _POSIX_SOURCE /* the rest of the file is !POSIX */ -#include <floatingpoint.h> /* Contains definitions for types and - * functions implemented in libc.a. - */ -extern double acosh(); -extern double asinh(); -extern double atanh(); -extern double cbrt(); -extern double copysign(); -extern double erf(); -extern double erfc(); -extern double expm1(); -extern int finite(); -extern double hypot(); -extern double j0(); -extern double j1(); -extern double jn(); -extern double lgamma(); -extern double log1p(); -extern double rint(); -extern double y0(); -extern double y1(); -extern double yn(); - -/* - * Sun definitions. - */ - -/* - * Implemented precisions for trigonometric argument reduction. - */ -enum fp_pi_type { - fp_pi_infinite = 0, /* Infinite-precision approximation to pi. */ - fp_pi_66 = 1, /* 66-bit approximation to pi. */ - fp_pi_53 = 2 /* 53-bit approximation to pi. */ -}; - -/* - * Pi precision to use for trigonometric argument reduction. - */ -extern enum fp_pi_type fp_pi; - -/* - * Functions callable from C, intended to support IEEE arithmetic. - */ -extern enum fp_class_type fp_class(); -extern int ieee_flags(); -extern int ieee_handler(); -extern void ieee_retrospective(); -extern int ilogb(); -extern double infinity(); -extern int irint(); -extern int isinf(); -extern int isnan(); -extern int isnormal(); -extern int issubnormal(); -extern int iszero(); -extern double logb(); -extern double max_normal(); -extern double max_subnormal(); -extern double min_normal(); -extern double min_subnormal(); -extern double nextafter(); -extern void nonstandard_arithmetic(); -extern double quiet_nan(); -extern double remainder(); -extern double scalb(); -extern double scalbn(); -extern double signaling_nan(); -extern int signbit(); -extern double significand(); -extern void standard_arithmetic(); - -/* - * Other functions for C programmers. - */ -extern double acospi(); -extern double aint(); -extern double anint(); -extern double annuity(); -extern double asinpi(); -extern double atan2pi(); -extern double atanpi(); -extern double compound(); -extern double cospi(); -extern double exp10(); -extern double exp2(); -extern double log2(); -extern int nint(); -extern void sincos(); -extern void sincospi(); -extern double sinpi(); -extern double tanpi(); -extern int matherr(); - - -/* - * Single-precision functions callable from Fortran, Pascal, Modula-2, etc, - * take float* arguments instead of double and - * return FLOATFUNCTIONTYPE results instead of double. - * RETURNFLOAT is used to return a float function value without conversion - * to double. - * ASSIGNFLOAT is used to get the float value out of a FLOATFUNCTIONTYPE - * result. - * We don't want you to have to think about -fsingle2. - * - * Some internal library functions pass float parameters as 32-bit values, - * disguised as FLOATPARAMETER. FLOATPARAMETERVALUE(x) extracts the - * float value from the FLOATPARAMETER. - */ - -/* mc68000 returns float results in d0, same as int */ - -#ifdef mc68000 -#define FLOATFUNCTIONTYPE int -#define RETURNFLOAT(x) return (*(int *)(&(x))) -#define ASSIGNFLOAT(x,y) *(int *)(&x) = y -#endif - -/* sparc returns float results in %f0, same as top half of double */ - -#ifdef sparc -#define FLOATFUNCTIONTYPE double -#define RETURNFLOAT(x) { union {double _d; float _f } _kluge; _kluge._f = (x); return _kluge._d; } -#define ASSIGNFLOAT(x,y) { union {double _d; float _f } _kluge; _kluge._d = (y); x = _kluge._f; } -#endif - -/* i386 returns float results on stack as extendeds, same as double */ - -#ifdef i386 -#define FLOATFUNCTIONTYPE float -#define RETURNFLOAT(x) return (x) -#define ASSIGNFLOAT(x,y) x = y -#endif - -/* So far everybody passes float parameters as 32 bits on stack, same as int. */ - -#define FLOATPARAMETER int -#define FLOATPARAMETERVALUE(x) (*(float *)(&(x))) - -extern int ir_finite_(); -extern enum fp_class_type ir_fp_class_(); -extern int ir_ilogb_(); -extern int ir_irint_(); -extern int ir_isinf_(); -extern int ir_isnan_(); -extern int ir_isnormal_(); -extern int ir_issubnormal_(); -extern int ir_iszero_(); -extern int ir_nint_(); -extern int ir_signbit_(); -extern void r_sincos_(); -extern void r_sincospi_(); -extern FLOATFUNCTIONTYPE r_acos_(); -extern FLOATFUNCTIONTYPE r_acosh_(); -extern FLOATFUNCTIONTYPE r_acospi_(); -extern FLOATFUNCTIONTYPE r_aint_(); -extern FLOATFUNCTIONTYPE r_anint_(); -extern FLOATFUNCTIONTYPE r_annuity_(); -extern FLOATFUNCTIONTYPE r_asin_(); -extern FLOATFUNCTIONTYPE r_asinh_(); -extern FLOATFUNCTIONTYPE r_asinpi_(); -extern FLOATFUNCTIONTYPE r_atan2_(); -extern FLOATFUNCTIONTYPE r_atan2pi_(); -extern FLOATFUNCTIONTYPE r_atan_(); -extern FLOATFUNCTIONTYPE r_atanh_(); -extern FLOATFUNCTIONTYPE r_atanpi_(); -extern FLOATFUNCTIONTYPE r_cbrt_(); -extern FLOATFUNCTIONTYPE r_ceil_(); -extern FLOATFUNCTIONTYPE r_compound_(); -extern FLOATFUNCTIONTYPE r_copysign_(); -extern FLOATFUNCTIONTYPE r_cos_(); -extern FLOATFUNCTIONTYPE r_cosh_(); -extern FLOATFUNCTIONTYPE r_cospi_(); -extern FLOATFUNCTIONTYPE r_erf_(); -extern FLOATFUNCTIONTYPE r_erfc_(); -extern FLOATFUNCTIONTYPE r_exp10_(); -extern FLOATFUNCTIONTYPE r_exp2_(); -extern FLOATFUNCTIONTYPE r_exp_(); -extern FLOATFUNCTIONTYPE r_expm1_(); -extern FLOATFUNCTIONTYPE r_fabs_(); -extern FLOATFUNCTIONTYPE r_floor_(); -extern FLOATFUNCTIONTYPE r_fmod_(); -extern FLOATFUNCTIONTYPE r_hypot_(); -extern FLOATFUNCTIONTYPE r_infinity_(); -extern FLOATFUNCTIONTYPE r_j0_(); -extern FLOATFUNCTIONTYPE r_j1_(); -extern FLOATFUNCTIONTYPE r_jn_(); -extern FLOATFUNCTIONTYPE r_lgamma_(); -extern FLOATFUNCTIONTYPE r_log10_(); -extern FLOATFUNCTIONTYPE r_log1p_(); -extern FLOATFUNCTIONTYPE r_log2_(); -extern FLOATFUNCTIONTYPE r_log_(); -extern FLOATFUNCTIONTYPE r_logb_(); -extern FLOATFUNCTIONTYPE r_max_normal_(); -extern FLOATFUNCTIONTYPE r_max_subnormal_(); -extern FLOATFUNCTIONTYPE r_min_normal_(); -extern FLOATFUNCTIONTYPE r_min_subnormal_(); -extern FLOATFUNCTIONTYPE r_nextafter_(); -extern FLOATFUNCTIONTYPE r_pow_(); -extern FLOATFUNCTIONTYPE r_quiet_nan_(); -extern FLOATFUNCTIONTYPE r_remainder_(); -extern FLOATFUNCTIONTYPE r_rint_(); -extern FLOATFUNCTIONTYPE r_scalb_(); -extern FLOATFUNCTIONTYPE r_scalbn_(); -extern FLOATFUNCTIONTYPE r_signaling_nan_(); -extern FLOATFUNCTIONTYPE r_significand_(); -extern FLOATFUNCTIONTYPE r_sin_(); -extern FLOATFUNCTIONTYPE r_sinh_(); -extern FLOATFUNCTIONTYPE r_sinpi_(); -extern FLOATFUNCTIONTYPE r_sqrt_(); -extern FLOATFUNCTIONTYPE r_tan_(); -extern FLOATFUNCTIONTYPE r_tanh_(); -extern FLOATFUNCTIONTYPE r_tanpi_(); -extern FLOATFUNCTIONTYPE r_y0_(); -extern FLOATFUNCTIONTYPE r_y1_(); -extern FLOATFUNCTIONTYPE r_yn_(); - -/* Constants, variables, and functions from System V */ - -#define _ABS(x) ((x) < 0 ? -(x) : (x)) - -#define HUGE (infinity()) /* For historical compatibility. */ - -#define DOMAIN 1 -#define SING 2 -#define OVERFLOW 3 -#define UNDERFLOW 4 -#define TLOSS 5 -#define PLOSS 6 - -struct exception { - int type; - char *name; - double arg1; - double arg2; - double retval; -}; - -/* - * First three have to be defined exactly as in values.h including spacing! - */ -#define M_LN2 0.69314718055994530942 -#define M_PI 3.14159265358979323846 -#define M_SQRT2 1.41421356237309504880 - -#define M_E 2.7182818284590452354 -#define M_LOG2E 1.4426950408889634074 -#define M_LOG10E 0.43429448190325182765 -#define M_LN10 2.30258509299404568402 -#define M_PI_2 1.57079632679489661923 -#define M_PI_4 0.78539816339744830962 -#define M_1_PI 0.31830988618379067154 -#define M_2_PI 0.63661977236758134308 -#define M_2_SQRTPI 1.12837916709551257390 -#define M_SQRT1_2 0.70710678118654752440 -#define _REDUCE(TYPE, X, XN, C1, C2) { \ - double x1 = (double)(TYPE)X, x2 = X - x1; \ - X = x1 - (XN) * (C1); X += x2; X -= (XN) * (C2); } -#define _POLY1(x, c) ((c)[0] * (x) + (c)[1]) -#define _POLY2(x, c) (_POLY1((x), (c)) * (x) + (c)[2]) -#define _POLY3(x, c) (_POLY2((x), (c)) * (x) + (c)[3]) -#define _POLY4(x, c) (_POLY3((x), (c)) * (x) + (c)[4]) -#define _POLY5(x, c) (_POLY4((x), (c)) * (x) + (c)[5]) -#define _POLY6(x, c) (_POLY5((x), (c)) * (x) + (c)[6]) -#define _POLY7(x, c) (_POLY6((x), (c)) * (x) + (c)[7]) -#define _POLY8(x, c) (_POLY7((x), (c)) * (x) + (c)[8]) -#define _POLY9(x, c) (_POLY8((x), (c)) * (x) + (c)[9]) - -extern int signgam; -/* - * Deprecated functions for compatibility with past. - * Changes planned for future. - */ - -extern double cabs(); /* Use double hypot(x,y) - * Traditional cabs usage is confused - - * is its argument two doubles or one struct? - */ -extern double drem(); /* Use double remainder(x,y) - * drem will disappear in a future release. - */ -extern double gamma(); /* Use double lgamma(x) - * to compute log of gamma function. - * Name gamma is reserved for true gamma function - * to appear in a future release. - */ -#endif /* !_POSIX_SOURCE */ -#endif /* !__math_h */ diff --git a/usr/src/lib/libbc/inc/include/memory.h b/usr/src/lib/libbc/inc/include/memory.h deleted file mode 100644 index afb89b874e..0000000000 --- a/usr/src/lib/libbc/inc/include/memory.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef _memory_h -#define _memory_h - -extern char - *memccpy(), - *memchr(), - *memcpy(), - *memset(); -extern int memcmp(); - -#endif /*!_memory_h*/ diff --git a/usr/src/lib/libbc/inc/include/mntent.h b/usr/src/lib/libbc/inc/include/mntent.h deleted file mode 100644 index 9658fd158e..0000000000 --- a/usr/src/lib/libbc/inc/include/mntent.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * File system table, see mntent (5) - * - * Used by dump, mount, umount, swapon, fsck, df, ... - * - * Quota files are always named "quotas", so if type is "rq", - * then use concatenation of mnt_dir and "quotas" to locate - * quota file. - */ - -#ifndef _mntent_h -#define _mntent_h - -#define MNTTAB "/etc/fstab" -#define MOUNTED "/etc/mtab" - -#define MNTMAXSTR 128 - -#define MNTTYPE_42 "4.2" /* 4.2 file system */ -#define MNTTYPE_NFS "nfs" /* network file system */ -#define MNTTYPE_PC "pc" /* IBM PC (MSDOS) file system */ -#define MNTTYPE_SWAP "swap" /* swap file system */ -#define MNTTYPE_IGNORE "ignore"/* No type specified, ignore this entry */ -#define MNTTYPE_LO "lo" /* Loop back File system */ - -/* mount options */ -#define MNTOPT_RO "ro" /* read only */ -#define MNTOPT_RW "rw" /* read/write */ -#define MNTOPT_GRPID "grpid" /* SysV-compatible group-id on create */ -#define MNTOPT_REMOUNT "remount"/* change options on previous mount */ -#define MNTOPT_NOAUTO "noauto"/* hide entry from mount -a */ -#define MNTOPT_NOSUB "nosub" /* disallow mounts beneath this one */ - -/* 4.2 specific options */ -#define MNTOPT_QUOTA "quota" /* quotas */ -#define MNTOPT_NOQUOTA "noquota"/* no quotas */ - -/* NFS specific options */ -#define MNTOPT_SOFT "soft" /* soft mount */ -#define MNTOPT_HARD "hard" /* hard mount (default) */ -#define MNTOPT_NOSUID "nosuid"/* no set uid allowed */ -#define MNTOPT_INTR "intr" /* allow interrupts on hard mount */ -#define MNTOPT_SECURE "secure"/* use secure RPC for NFS */ -#define MNTOPT_NOAC "noac" /* don't cache file attributes */ -#define MNTOPT_NOCTO "nocto" /* no "close to open" attr consistency */ -#define MNTOPT_PORT "port" /* server IP port number */ -#define MNTOPT_RETRANS "retrans" /* set number of request retries */ -#define MNTOPT_RSIZE "rsize" /* set read size (bytes) */ -#define MNTOPT_WSIZE "wsize" /* set write size (bytes) */ -#define MNTOPT_TIMEO "timeo" /* set initial timeout (1/10 sec) */ -#define MNTOPT_ACTIMEO "actimeo" /* attr cache timeout (sec) */ -#define MNTOPT_ACREGMIN "acregmin" /* min ac timeout for reg files (sec) */ -#define MNTOPT_ACREGMAX "acregmax" /* max ac timeout for reg files (sec) */ -#define MNTOPT_ACDIRMIN "acdirmin" /* min ac timeout for dirs (sec) */ -#define MNTOPT_ACDIRMAX "acdirmax" /* max ac timeout for dirs (sec) */ -#define MNTOPT_POSIX "posix" /* ask for static pathconf values from mountd */ - -/* Information about the mount entry */ -#define MNTINFO_DEV "dev" /* device number of the mounted file system */ - -struct mntent { - char *mnt_fsname; /* name of mounted file system */ - char *mnt_dir; /* file system path prefix */ - char *mnt_type; /* MNTTYPE_* */ - char *mnt_opts; /* MNTOPT* */ - int mnt_freq; /* dump frequency, in days */ - int mnt_passno; /* pass number on parallel fsck */ -}; - -struct mntent *getmntent(); -char *hasmntopt(); -FILE *setmntent(); -int endmntent(); - -#endif /*!_mntent_h*/ diff --git a/usr/src/lib/libbc/inc/include/ndbm.h b/usr/src/lib/libbc/inc/include/ndbm.h deleted file mode 100644 index 8ef72a39a9..0000000000 --- a/usr/src/lib/libbc/inc/include/ndbm.h +++ /dev/null @@ -1,69 +0,0 @@ -#pragma ident "%Z%%M% %I% %E% SMI" -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - * - */ - -/* - * Hashed key data base library. - */ - -#ifndef _ndbm_h -#define _ndbm_h - -#define PBLKSIZ 1024 -#define DBLKSIZ 4096 - -typedef struct { - int dbm_dirf; /* open directory file */ - int dbm_pagf; /* open page file */ - int dbm_flags; /* flags, see below */ - long dbm_maxbno; /* last ``bit'' in dir file */ - long dbm_bitno; /* current bit number */ - long dbm_hmask; /* hash mask */ - long dbm_blkptr; /* current block for dbm_nextkey */ - int dbm_keyptr; /* current key for dbm_nextkey */ - long dbm_blkno; /* current page to read/write */ - long dbm_pagbno; /* current page in pagbuf */ - char dbm_pagbuf[PBLKSIZ]; /* page file block buffer */ - long dbm_dirbno; /* current block in dirbuf */ - char dbm_dirbuf[DBLKSIZ]; /* directory file block buffer */ -} DBM; - -#define _DBM_RDONLY 0x1 /* data base open read-only */ -#define _DBM_IOERR 0x2 /* data base I/O error */ - -#define dbm_rdonly(db) ((db)->dbm_flags & _DBM_RDONLY) - -#define dbm_error(db) ((db)->dbm_flags & _DBM_IOERR) - /* use this one at your own risk! */ -#define dbm_clearerr(db) ((db)->dbm_flags &= ~_DBM_IOERR) - -/* for flock(2) and fstat(2) */ -#define dbm_dirfno(db) ((db)->dbm_dirf) -#define dbm_pagfno(db) ((db)->dbm_pagf) - -typedef struct { - char *dptr; - int dsize; -} datum; - -/* - * flags to dbm_store() - */ -#define DBM_INSERT 0 -#define DBM_REPLACE 1 - -DBM *dbm_open(); -void dbm_close(); -datum dbm_fetch(); -datum dbm_firstkey(); -datum dbm_nextkey(); -datum dbm_do_nextkey(); -long dbm_forder(); -int dbm_delete(); -int dbm_store(); - -#endif /*!_ndbm_h*/ diff --git a/usr/src/lib/libbc/inc/include/net/if.h b/usr/src/lib/libbc/inc/include/net/if.h deleted file mode 100644 index 513fa0d2bf..0000000000 --- a/usr/src/lib/libbc/inc/include/net/if.h +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef _net_if_h -#define _net_if_h - -/* - * Structures defining a network interface, providing a packet - * transport mechanism (ala level 0 of the PUP protocols). - * - * Each interface accepts output datagrams of a specified maximum - * length, and provides higher level routines with input datagrams - * received from its medium. - * - * Output occurs when the routine if_output is called, with three parameters: - * (*ifp->if_output)(ifp, m, dst) - * Here m is the mbuf chain to be sent and dst is the destination address. - * The output routine encapsulates the supplied datagram if necessary, - * and then transmits it on its medium. - * - * On input, each interface unwraps the data received by it, and either - * places it on the input queue of a internetwork datagram routine - * and posts the associated software interrupt, or passes the datagram to a raw - * packet input routine. - * - * Routines exist for locating interfaces by their addresses - * or for locating a interface on a certain network, as well as more general - * routing and gateway routines maintaining information used to locate - * interfaces. These routines live in the files if.c and route.c - */ - -/* - * Structure defining a queue for a network interface. - * - * (Would like to call this struct ``if'', but C isn't PL/1.) - */ -struct ifnet { - char *if_name; /* name, e.g. ``en'' or ``lo'' */ - short if_unit; /* sub-unit for lower level driver */ - short if_mtu; /* maximum transmission unit */ - short if_flags; /* up/down, broadcast, etc. */ - short if_timer; /* time 'til if_watchdog called */ - u_short if_promisc; /* net # of requests for promisc mode */ - int if_metric; /* routing metric (external only) */ - struct ifaddr *if_addrlist; /* linked list of addresses per if */ - struct ifqueue { - struct mbuf *ifq_head; - struct mbuf *ifq_tail; - int ifq_len; - int ifq_maxlen; - int ifq_drops; - } if_snd; /* output queue */ -/* procedure handles */ - int (*if_init)(); /* init routine */ - int (*if_output)(); /* output routine */ - int (*if_ioctl)(); /* ioctl routine */ - int (*if_reset)(); /* bus reset routine */ - int (*if_watchdog)(); /* timer routine */ -/* generic interface statistics */ - int if_ipackets; /* packets received on interface */ - int if_ierrors; /* input errors on interface */ - int if_opackets; /* packets sent on interface */ - int if_oerrors; /* output errors on interface */ - int if_collisions; /* collisions on csma interfaces */ -/* end statistics */ - struct ifnet *if_next; - struct ifnet *if_upper; /* next layer up */ - struct ifnet *if_lower; /* next layer down */ - int (*if_input)(); /* input routine */ - int (*if_ctlin)(); /* control input routine */ - int (*if_ctlout)(); /* control output routine */ -#ifdef sun - struct map *if_memmap; /* rmap for interface specific memory */ -#endif -}; - -#define IFF_UP 0x1 /* interface is up */ -#define IFF_BROADCAST 0x2 /* broadcast address valid */ -#define IFF_DEBUG 0x4 /* turn on debugging */ -#define IFF_LOOPBACK 0x8 /* is a loopback net */ -#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ -#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ -#define IFF_RUNNING 0x40 /* resources allocated */ -#define IFF_NOARP 0x80 /* no address resolution protocol */ -#define IFF_PROMISC 0x100 /* receive all packets */ -#define IFF_ALLMULTI 0x200 /* receive all multicast packets */ -#define IFF_PRIVATE 0x8000 /* do not advertise */ - -/* flags set internally only: */ -#define IFF_CANTCHANGE \ - (IFF_BROADCAST | IFF_POINTOPOINT | IFF_RUNNING | IFF_PROMISC) - -/* - * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1) - * input routines have queues of messages stored on ifqueue structures - * (defined above). Entries are added to and deleted from these structures - * by these macros, which should be called with ipl raised to splimp(). - */ -#define IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen) -#define IF_DROP(ifq) ((ifq)->ifq_drops++) -#define IF_ENQUEUE(ifq, m) { \ - (m)->m_act = 0; \ - if ((ifq)->ifq_tail == 0) \ - (ifq)->ifq_head = m; \ - else \ - (ifq)->ifq_tail->m_act = m; \ - (ifq)->ifq_tail = m; \ - (ifq)->ifq_len++; \ -} -#define IF_PREPEND(ifq, m) { \ - (m)->m_act = (ifq)->ifq_head; \ - if ((ifq)->ifq_tail == 0) \ - (ifq)->ifq_tail = (m); \ - (ifq)->ifq_head = (m); \ - (ifq)->ifq_len++; \ -} -/* - * Packets destined for level-1 protocol input routines - * have a pointer to the receiving interface prepended to the data. - * IF_DEQUEUEIF extracts and returns this pointer when dequeueing the packet. - * IF_ADJ should be used otherwise to adjust for its presence. - */ -#define IF_ADJ(m) { \ - (m)->m_off += sizeof (struct ifnet *); \ - (m)->m_len -= sizeof (struct ifnet *); \ - if ((m)->m_len == 0) { \ - struct mbuf *n; \ - MFREE((m), n); \ - (m) = n; \ - } \ -} -#define IF_DEQUEUEIF(ifq, m, ifp) { \ - (m) = (ifq)->ifq_head; \ - if (m) { \ - if (((ifq)->ifq_head = (m)->m_act) == 0) \ - (ifq)->ifq_tail = 0; \ - (m)->m_act = 0; \ - (ifq)->ifq_len--; \ - (ifp) = *(mtod((m), struct ifnet **)); \ - IF_ADJ(m); \ - } \ -} -#define IF_DEQUEUE(ifq, m) { \ - (m) = (ifq)->ifq_head; \ - if (m) { \ - if (((ifq)->ifq_head = (m)->m_act) == 0) \ - (ifq)->ifq_tail = 0; \ - (m)->m_act = 0; \ - (ifq)->ifq_len--; \ - } \ -} - -#define IFQ_MAXLEN 50 -#define IFNET_SLOWHZ 1 /* granularity is 1 second */ - -/* - * The ifaddr structure contains information about one address - * of an interface. They are maintained by the different address families, - * are allocated and attached when an address is set, and are linked - * together so all addresses for an interface can be located. - */ -struct ifaddr { - struct sockaddr ifa_addr; /* address of interface */ - union { - struct sockaddr ifu_broadaddr; - struct sockaddr ifu_dstaddr; - } ifa_ifu; -#ifndef ifa_broadaddr -#define ifa_broadaddr ifa_ifu.ifu_broadaddr /* broadcast address */ -#endif -#ifndef ifa_dstaddr -#define ifa_dstaddr ifa_ifu.ifu_dstaddr /* other end of p-to-p link */ -#endif - struct ifnet *ifa_ifp; /* back-pointer to interface */ - struct ifaddr *ifa_next; /* next address for interface */ -}; - -/* - * Interface request structure used for socket - * ioctl's. All interface ioctl's must have parameter - * definitions which begin with ifr_name. The - * remainder may be interface specific. - */ -struct ifreq { -#define IFNAMSIZ 16 - char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - union { - struct sockaddr ifru_addr; - struct sockaddr ifru_dstaddr; - char ifru_oname[IFNAMSIZ]; /* other if name */ - struct sockaddr ifru_broadaddr; - short ifru_flags; - int ifru_metric; - char ifru_data[1]; /* interface dependent data */ - - /* Struct for FDDI ioctl's */ - struct ifr_dnld_reqs { - caddr_t v_addr; - caddr_t m_addr; - caddr_t ex_addr; - u_int size; - } ifru_dnld_req; - - /* Struct for FDDI stats */ - struct ifr_fddi_stats { - u_int stat_size; - caddr_t fddi_stats; - } ifru_fddi_stat; - - struct ifr_netmapents { - u_int map_ent_size, /* size of netmap structure */ - entry_number; /* index into netmap list */ - caddr_t fddi_map_ent; /* pointer to user structure */ - } ifru_netmapent; - - /* Field for generic ioctl for fddi */ - - struct ifr_fddi_gen_struct { - int ifru_fddi_gioctl; /* field for gen ioctl */ - caddr_t ifru_fddi_gaddr; /* Generic ptr to a field */ - } ifru_fddi_gstruct; - - } ifr_ifru; - -#define ifr_addr ifr_ifru.ifru_addr /* address */ -#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ -#define ifr_oname ifr_ifru.ifru_oname /* other if name */ -#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ -#define ifr_flags ifr_ifru.ifru_flags /* flags */ -#define ifr_metric ifr_ifru.ifru_metric /* metric */ -#define ifr_data ifr_ifru.ifru_data /* for use by interface */ - -/* FDDI specific */ -#define ifr_dnld_req ifr_ifru.ifru_dnld_req -#define ifr_fddi_stat ifr_ifru.ifru_fddi_stat -#define ifr_fddi_netmap ifr_ifru.ifru_netmapent /* FDDI network map entries */ -#define ifr_fddi_gstruct ifr_ifru.ifru_fddi_gstruct - -}; - -/* - * Structure used in SIOCGIFCONF request. - * Used to retrieve interface configuration - * for machine (useful for programs which - * must know all networks accessible). - */ -struct ifconf { - int ifc_len; /* size of associated buffer */ - union { - caddr_t ifcu_buf; - struct ifreq *ifcu_req; - } ifc_ifcu; -#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ -#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ -}; - -#endif /* !_net_if_h */ diff --git a/usr/src/lib/libbc/inc/include/net/if_arp.h b/usr/src/lib/libbc/inc/include/net/if_arp.h deleted file mode 100644 index 2e7fe108ce..0000000000 --- a/usr/src/lib/libbc/inc/include/net/if_arp.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 1997-2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ -/* - * This libbc private version of if_arp.h is being created as an - * exact copy of <net/if_arp.h> prior to the addition of the - * "struct xarpreq" in the standard <net/if_arp.h>. The libbc code - * does not understand the structure elements in "struct xarpreq". - */ - - -#ifndef _net_if_arp_h -#define _net_if_arp_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Address Resolution Protocol. - * - * See RFC 826 for protocol description. ARP packets are variable - * in size; the arphdr structure defines the fixed-length portion. - * Protocol type values are the same as those for 10 Mb/s Ethernet. - * It is followed by the variable-sized fields ar_sha, arp_spa, - * arp_tha and arp_tpa in that order, according to the lengths - * specified. Field names used correspond to RFC 826. - */ -struct arphdr { - ushort_t ar_hrd; /* format of hardware address */ -#define ARPHRD_ETHER 1 /* ethernet hardware address */ - ushort_t ar_pro; /* format of protocol address */ - uchar_t ar_hln; /* length of hardware address */ - uchar_t ar_pln; /* length of protocol address */ - ushort_t ar_op; /* one of: */ -#define ARPOP_REQUEST 1 /* request to resolve address */ -#define ARPOP_REPLY 2 /* response to previous request */ -#define REVARP_REQUEST 3 /* Reverse ARP request */ -#define REVARP_REPLY 4 /* Reverse ARP reply */ - /* - * The remaining fields are variable in size, - * according to the sizes above, and are defined - * as appropriate for specific hardware/protocol - * combinations. (E.g., see <netinet/if_ether.h>.) - */ -#ifdef notdef - uchar_t ar_sha[]; /* sender hardware address */ - uchar_t ar_spa[]; /* sender protocol address */ - uchar_t ar_tha[]; /* target hardware address */ - uchar_t ar_tpa[]; /* target protocol address */ -#endif /* notdef */ -}; - -/* - * ARP ioctl request - */ -struct arpreq { - struct sockaddr arp_pa; /* protocol address */ - struct sockaddr arp_ha; /* hardware address */ - int arp_flags; /* flags */ -}; -/* arp_flags and at_flags field values */ -#define ATF_INUSE 0x01 /* entry in use */ -#define ATF_COM 0x02 /* completed entry (enaddr valid) */ -#define ATF_PERM 0x04 /* permanent entry */ -#define ATF_PUBL 0x08 /* publish entry (respond for other host) */ -#define ATF_USETRAILERS 0x10 /* has requested trailers */ - -/* - * This data structure is used by kernel protocol modules to register - * their interest in a particular packet type with the Ethernet drivers. - * For example, other kinds of ARP would use this, XNS, ApleTalk, etc. - */ -struct ether_family { - int ef_family; /* address family */ - ushort_t ef_ethertype; /* ethernet type field */ - struct ifqueue *(*ef_infunc)(); /* input function */ - int (*ef_outfunc)(); /* output function */ - int (*ef_netisr)(); /* soft interrupt function */ - struct ether_family *ef_next; /* link to next on list */ -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _net_if_arp_h */ diff --git a/usr/src/lib/libbc/inc/include/netdb.h b/usr/src/lib/libbc/inc/include/netdb.h deleted file mode 100644 index 3d9a6bbe71..0000000000 --- a/usr/src/lib/libbc/inc/include/netdb.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 1980,1983,1988 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of California at Berkeley. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ - -/* - * Structures returned by network data base library. - * All addresses are supplied in host order, and - * returned in network order (suitable for use in system calls). - */ - -#ifndef _netdb_h -#define _netdb_h - -/* from UCB 5.9 4/5/88 */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#define _PATH_HEQUIV "/etc/hosts.equiv" -#define _PATH_HOSTS "/etc/hosts" -#define _PATH_NETWORKS "/etc/networks" -#define _PATH_PROTOCOLS "/etc/protocols" -#define _PATH_SERVICES "/etc/services" - -struct hostent { - char *h_name; /* official name of host */ - char **h_aliases; /* alias list */ - int h_addrtype; /* host address type */ - int h_length; /* length of address */ - char **h_addr_list; /* list of addresses from name server */ -#define h_addr h_addr_list[0] /* address, for backward compatiblity */ -}; - -/* - * Assumption here is that a network number - * fits in 32 bits -- probably a poor one. - */ -struct netent { - char *n_name; /* official name of net */ - char **n_aliases; /* alias list */ - int n_addrtype; /* net address type */ - unsigned long n_net; /* network # */ -}; - -struct servent { - char *s_name; /* official service name */ - char **s_aliases; /* alias list */ - int s_port; /* port # */ - char *s_proto; /* protocol to use */ -}; - -struct protoent { - char *p_name; /* official protocol name */ - char **p_aliases; /* alias list */ - int p_proto; /* protocol # */ -}; - -struct rpcent { - char *r_name; /* name of server for this rpc program */ - char **r_aliases; /* alias list */ - int r_number; /* rpc program number */ -}; - -struct hostent *gethostbyname(), *gethostbyaddr(), *gethostent(); -struct netent *getnetbyname(), *getnetbyaddr(), *getnetent(); -struct servent *getservbyname(), *getservbyport(), *getservent(); -struct protoent *getprotobyname(), *getprotobynumber(), *getprotoent(); -struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); - -/* - * Error return codes from gethostbyname() and gethostbyaddr() - * (when using the resolver) - */ - -extern int h_errno; - -#define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */ -#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ -#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ -#define NO_DATA 4 /* Valid name, no data record of requested type */ -#define NO_ADDRESS NO_DATA /* no address, look for MX record */ - -#define MAXALIASES 35 -#define MAXADDRS 35 - -#endif /*!_netdb_h*/ diff --git a/usr/src/lib/libbc/inc/include/netinet/if_ether.h b/usr/src/lib/libbc/inc/include/netinet/if_ether.h deleted file mode 100644 index be9681358a..0000000000 --- a/usr/src/lib/libbc/inc/include/netinet/if_ether.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of California at Berkeley. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ - -#ifndef _netinet_if_ether_h -#define _netinet_if_ether_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * The following include is for compatibility with SunOS 3.x and - * 4.3bsd. Newly written programs should include it separately. - */ -#include <net/if_arp.h> - -/* - * Ethernet address - 6 octets - */ -struct ether_addr { - u_char ether_addr_octet[6]; -}; - -/* - * Structure of a 10Mb/s Ethernet header. - */ -struct ether_header { - struct ether_addr ether_dhost; - struct ether_addr ether_shost; - u_short ether_type; -}; - -#define ETHERTYPE_PUP 0x0200 /* PUP protocol */ -#define ETHERTYPE_IP 0x0800 /* IP protocol */ -#define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */ -#define ETHERTYPE_REVARP 0x8035 /* Reverse ARP */ - -/* - * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have - * (type-ETHERTYPE_TRAIL)*512 bytes of data followed - * by an ETHER type (as given above) and then the (variable-length) header. - */ -#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ -#define ETHERTYPE_NTRAILER 16 - -#define ETHERMTU 1500 -#define ETHERMIN (60-14) - -/* - * Ethernet Address Resolution Protocol. - * - * See RFC 826 for protocol description. Structure below is adapted - * to resolving internet addresses. Field names used correspond to - * RFC 826. - */ -struct ether_arp { - struct arphdr ea_hdr; /* fixed-size header */ - struct ether_addr arp_sha; /* sender hardware address */ - u_char arp_spa[4]; /* sender protocol address */ - struct ether_addr arp_tha; /* target hardware address */ - u_char arp_tpa[4]; /* target protocol address */ -}; -#define arp_hrd ea_hdr.ar_hrd -#define arp_pro ea_hdr.ar_pro -#define arp_hln ea_hdr.ar_hln -#define arp_pln ea_hdr.ar_pln -#define arp_op ea_hdr.ar_op - -/* - * multicast address structure - * - * Keep a reference count for each multicast address so - * addresses loaded into chip are unique. - */ -struct mcaddr { - struct ether_addr mc_enaddr; /* multicast address */ - u_short mc_count; /* reference count */ -}; -#define MCADDRMAX 64 /* multicast addr table length */ -#define MCCOUNTMAX 4096 /* multicast addr max reference count */ - -/* - * Structure shared between the ethernet driver modules and - * the address resolution code. For example, each ec_softc or il_softc - * begins with this structure. - * - * The structure contains a pointer to an array of multicast addresses. - * This pointer is NULL until the first successful SIOCADDMULTI ioctl - * is issued for the interface. - */ -struct arpcom { - struct ifnet ac_if; /* network-visible interface */ - struct ether_addr ac_enaddr; /* ethernet hardware address */ - struct in_addr ac_ipaddr; /* copy of ip address- XXX */ - struct mcaddr *ac_mcaddr; /* table of multicast addrs */ - u_short ac_nmcaddr; /* count of M/C addrs in use */ - struct in_addr ac_lastip; /* cache of last ARP lookup */ - struct ether_addr ac_lastarp; /* result of the last ARP */ -}; - -/* - * Internet to ethernet address resolution table. - */ -struct arptab { - struct in_addr at_iaddr; /* internet address */ - union { - struct ether_addr atu_enaddr; /* ethernet address */ - long atu_tvsec; /* timestamp if incomplete */ - } at_union; - u_char at_timer; /* minutes since last reference */ - u_char at_flags; /* flags */ - struct mbuf *at_hold; /* last packet until resolved/timeout */ -}; - -# define at_enaddr at_union.atu_enaddr -# define at_tvsec at_union.atu_tvsec - -/* - * Compare two Ethernet addresses - assumes that the two given - * pointers can be referenced as shorts. On architectures - * where this is not the case, use bcmp instead. Note that like - * bcmp, we return zero if they are the SAME. - */ -#define ether_cmp(a,b) ( ((short *)b)[2] != ((short *)a)[2] || \ - ((short *)b)[1] != ((short *)a)[1] || ((short *)b)[0] != ((short *)a)[0] ) - -/* - * Copy Ethernet addresses from a to b - assumes that the two given - * pointers can be referenced as shorts. On architectures - * where this is not the case, use bcopy instead. - */ -#define ether_copy(a,b) { ((short *)b)[0]=((short *)a)[0]; \ - ((short *)b)[1]=((short *)a)[1]; ((short *)b)[2]=((short *)a)[2]; } - -/* - * Copy IP addresses from a to b - assumes that the two given - * pointers can be referenced as shorts. On architectures - * where this is not the case, use bcopy instead. - */ -#define ip_copy(a,b) { ((short *)b)[0]=((short *)a)[0]; \ - ((short *)b)[1]=((short *)a)[1]; } - -#endif /* !_netinet_if_ether_h */ diff --git a/usr/src/lib/libbc/inc/include/netinet/in.h b/usr/src/lib/libbc/inc/include/netinet/in.h deleted file mode 100644 index 7db2b4f096..0000000000 --- a/usr/src/lib/libbc/inc/include/netinet/in.h +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - * - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of California at Berkeley. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ - -/* - * Constants and structures defined by the internet system, - * Per RFC 790, September 1981. - */ - -#ifndef _netinet_in_h -#define _netinet_in_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Protocols - */ -#define IPPROTO_IP 0 /* dummy for IP */ -#define IPPROTO_ICMP 1 /* control message protocol */ -#define IPPROTO_IGMP 2 /* group control protocol */ -#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ -#define IPPROTO_TCP 6 /* tcp */ -#define IPPROTO_EGP 8 /* exterior gateway protocol */ -#define IPPROTO_PUP 12 /* pup */ -#define IPPROTO_UDP 17 /* user datagram protocol */ -#define IPPROTO_IDP 22 /* xns idp */ -#define IPPROTO_HELLO 63 /* "hello" routing protocol */ -#define IPPROTO_ND 77 /* UNOFFICIAL net disk proto */ - -#define IPPROTO_RAW 255 /* raw IP packet */ -#define IPPROTO_MAX 256 - -/* - * Port/socket numbers: network standard functions - */ -#define IPPORT_ECHO 7 -#define IPPORT_DISCARD 9 -#define IPPORT_SYSTAT 11 -#define IPPORT_DAYTIME 13 -#define IPPORT_NETSTAT 15 -#define IPPORT_FTP 21 -#define IPPORT_TELNET 23 -#define IPPORT_SMTP 25 -#define IPPORT_TIMESERVER 37 -#define IPPORT_NAMESERVER 42 -#define IPPORT_WHOIS 43 -#define IPPORT_MTP 57 - -/* - * Port/socket numbers: host specific functions - */ -#define IPPORT_TFTP 69 -#define IPPORT_RJE 77 -#define IPPORT_FINGER 79 -#define IPPORT_TTYLINK 87 -#define IPPORT_SUPDUP 95 - -/* - * UNIX TCP sockets - */ -#define IPPORT_EXECSERVER 512 -#define IPPORT_LOGINSERVER 513 -#define IPPORT_CMDSERVER 514 -#define IPPORT_EFSSERVER 520 - -/* - * UNIX UDP sockets - */ -#define IPPORT_BIFFUDP 512 -#define IPPORT_WHOSERVER 513 -#define IPPORT_ROUTESERVER 520 /* 520+1 also used */ - -/* - * Ports < IPPORT_RESERVED are reserved for - * privileged processes (e.g. root). - * Ports > IPPORT_USERRESERVED are reserved - * for servers, not necessarily privileged. - */ -#define IPPORT_RESERVED 1024 -#define IPPORT_USERRESERVED 5000 - -/* - * Link numbers - */ -#define IMPLINK_IP 155 -#define IMPLINK_LOWEXPER 156 -#define IMPLINK_HIGHEXPER 158 - -/* - * Internet address - * This definition contains obsolete fields for compatibility - * with SunOS 3.x and 4.2bsd. The presence of subnets renders - * divisions into fixed fields misleading at best. New code - * should use only the s_addr field. - */ -struct in_addr { - union { - struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b; - struct { u_short s_w1,s_w2; } S_un_w; - u_long S_addr; - } S_un; -#define s_addr S_un.S_addr /* should be used for all code */ -#define s_host S_un.S_un_b.s_b2 /* OBSOLETE: host on imp */ -#define s_net S_un.S_un_b.s_b1 /* OBSOLETE: network */ -#define s_imp S_un.S_un_w.s_w2 /* OBSOLETE: imp */ -#define s_impno S_un.S_un_b.s_b4 /* OBSOLETE: imp # */ -#define s_lh S_un.S_un_b.s_b3 /* OBSOLETE: logical host */ -}; - -/* - * Definitions of bits in internet address integers. - * On subnets, the decomposition of addresses to host and net parts - * is done according to subnet mask, not the masks here. - * - * Note that with the introduction of CIDR, IN_CLASSA, IN_CLASSB, - * IN_CLASSC, IN_CLASSD and IN_CLASSE macros have become "de-facto obsolete". - * IN_MULTICAST macro should be used to test if a address is a - * multicast address. - */ -#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0) -#define IN_CLASSA_NET 0xff000000 -#define IN_CLASSA_NSHIFT 24 -#define IN_CLASSA_HOST 0x00ffffff -#define IN_CLASSA_MAX 128 - -#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000) -#define IN_CLASSB_NET 0xffff0000 -#define IN_CLASSB_NSHIFT 16 -#define IN_CLASSB_HOST 0x0000ffff -#define IN_CLASSB_MAX 65536 - -#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000) -#define IN_CLASSC_NET 0xffffff00 -#define IN_CLASSC_NSHIFT 8 -#define IN_CLASSC_HOST 0x000000ff - -#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) -#define IN_MULTICAST(i) IN_CLASSD(i) - -#define IN_CLASSE(i) (((long)(i) & 0xf0000000) == 0xf0000000) - -#define IN_CLASSE_NET 0xffffffff - -/* - * We have removed CLASS E checks from the kernel - * But we preserve these defines for userland in order - * to avoid compile breakage of some 3rd party piece of software - */ -#ifndef KERNEL -#define IN_EXPERIMENTAL(i) (((long)(i) & 0xe0000000) == 0xe0000000) -#define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000) -#endif - -#define INADDR_ANY (u_long)0x00000000 -#define INADDR_LOOPBACK (u_long)0x7F000001 -#define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */ - -#define IN_LOOPBACKNET 127 /* official! */ - -/* - * Define a macro to stuff the loopback address into an Internet address - */ -#define IN_SET_LOOPBACK_ADDR(a) {(a)->sin_addr.s_addr = htonl(INADDR_LOOPBACK); \ - (a)->sin_family = AF_INET;} - -/* - * Socket address, internet style. - */ -struct sockaddr_in { - short sin_family; - u_short sin_port; - struct in_addr sin_addr; - char sin_zero[8]; -}; - -/* - * Options for use with [gs]etsockopt at the IP level. - */ -#define IP_OPTIONS 1 /* set/get IP per-packet options */ - -#if !defined(vax) && !defined(ntohl) && !defined(lint) && !defined(i386) -/* - * Macros for number representation conversion. - */ -#define ntohl(x) (x) -#define ntohs(x) (x) -#define htonl(x) (x) -#define htons(x) (x) -#endif - -#if !defined(ntohl) && (defined(vax) || defined(lint) || defined(i386)) -u_short ntohs(), htons(); -u_long ntohl(), htonl(); -#endif - -#ifdef KERNEL -extern struct domain inetdomain; -extern struct protosw inetsw[]; -struct in_addr in_makeaddr(); -u_long in_netof(), in_lnaof(); -#endif - -#endif /* !_netinet_in_h */ diff --git a/usr/src/lib/libbc/inc/include/nettli/tcp_tli.h b/usr/src/lib/libbc/inc/include/nettli/tcp_tli.h deleted file mode 100644 index cae1ac1d13..0000000000 --- a/usr/src/lib/libbc/inc/include/nettli/tcp_tli.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1988,2001 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ifndef _TCP_TLI_ -#define _TCP_TLI_ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * TLI automaton state definitions. - * - * They are expressed as bit masks to facilitate testing whether the - * current automaton state is contained in a given set of states. - */ -#define TL_UNINIT 0x0000 /* uninitialized */ -#define TL_UNBND 0x0002 /* unbound */ -#define TL_IDLE 0x0004 /* no connection established */ -/* - * outgoing connection pending for active user - */ -#define TL_OUTCON 0x0008 -/* - * incoming connection pending for passive user - */ -#define TL_INCON 0x0010 -#define TL_DATAXFER 0x0020 /* data transfer */ -/* - * outgoing orderly release (waiting for orderly release indication) - */ -#define TL_OUTREL 0x0040 -/* - * incoming orderly release (waiting to send orderly release request) - */ -#define TL_INREL 0x0080 -/* - * pseudo-state indicating disallowed transition (may end up unnecessary) - */ -#define TL_ERROR 0x0100 - -/* - * Max buffer size for each uio operation in tcptli_Ercv() - */ -#define TT_BUFSIZE 2048 - -/* - * Send and Recv size for socket operations - */ -#define TT_SENDSIZE 24 * 1024 -#define TT_RECVSIZE 24 * 1024 - -/* - * Max number of uio vectors for sosend and soreceive - */ -#define TT_MAXUIO 10 - -/* - * Flag to indicate that only part of the data buffer got sent - */ -#define TT_INCOMPLETESEND 201 - -/* - * Protocol options (socket options) supported by T_OPTMGMT_REQ - */ -struct tt_soopt { - int tts_reuseaddr; /* reuse a bound address */ - int tts_keepalive; /* keep connection alive */ - int tts_sendsize; /* socket send size */ - int tts_recvsize; /* socket recv size */ -}; - -#define TTS_BUFSIZE 4096 /* default socket send/recv size */ -#define TTS_DFLT_REUSEADDR 1 -#define TTS_DFLT_KEEPALIVE 1 - -#ifdef __cplusplus -} -#endif - -#endif /* _TCP_TLI_ */ diff --git a/usr/src/lib/libbc/inc/include/nettli/tcp_tlivar.h b/usr/src/lib/libbc/inc/include/nettli/tcp_tlivar.h deleted file mode 100644 index 456cf9cdac..0000000000 --- a/usr/src/lib/libbc/inc/include/nettli/tcp_tlivar.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _TCP_TLIVAR_ -#define _TCP_TLIVAR_ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Data structure definitions for the streams interface - * to the socket-based TCP implementation. - */ - -/* - * Socket Information block contains the special socket wakeup - * hooks. When a block of tt_sockinfo is allocated, the wupalt.wup_arg - * points to the beginning of tt_sockinfo. - */ - -struct tt_sockinfo { - struct wupalt ts_sowakeup; /* special sock wakeup hook */ - u_long ts_seqnum; /* connection sequence number */ - long ts_flags; /* see below */ - struct tt_softc *ts_ttp; /* back ptr to dev-instance handle */ -}; -/* - * No connection assoicated with this socket - */ -#define TT_TS_NOTUSED 0x00 -/* - * This socket is connected or pending connection - */ -#define TT_TS_INUSE 0x01 - -/* - * Per-device instance state information. - * - * To aid in handling resource starvation situations, we pre-allocate two - * messages for reporting errors. Tt_merror is used as a last resort, when - * attempts to allocate a normal error reply fail. It's allocated in the - * open routine and freed in the close routine. The routines that produce - * response messages try to keep tt_errack pre-allocated, but don't insist - * that it always be valid. This strategy attempts to minimize the - * probability of having to fall back on the drastic measure of using the - * M_ERROR message. - */ -struct tt_softc { - /* The tt_unit & tt_unitnext fields aren't yet used. */ - struct tt_softc *tt_next; /* link to next device instance */ - u_short tt_unit; /* instance number */ - u_short tt_unitnext; /* next unit # to be used on open */ - - queue_t *tt_rq; /* cross-link to read queue */ - struct socket *tt_so; /* socket for this device instance */ - mblk_t *tt_merror; /* pre-allocated M_ERROR message */ - mblk_t *tt_errack; /* pre-allocated T_error_ack message */ - u_int tt_state; /* current state of the tli automaton */ - long tt_seqnext; /* next sequence number to assign */ - u_long tt_flags; /* see below */ - u_long tt_event; /* service event inidication */ - struct proc *tt_auxprocp; /* Aux proc handle */ - struct in_addr tt_laddr; /* saved local address */ - u_short tt_lport; /* saved local port number */ -}; - -/* - * Flag (tt_flags) bits private to the driver. - */ -#define TT_OPEN 0x01 /* device instance is currently open */ -#define TT_ERROR 0x02 /* in error state -- unusable */ -#define TT_CLOSE 0x04 /* this device instance is closed */ -#define TT_TIMER 0x08 /* scheduled wakeup timer is already set */ -/* - * Event (tt_event) bits private to the driver. - */ -#define TTE_EVENT 0x01 /* aux proc service wanted indication */ -#define TTE_ONQUEUE 0x02 /* set if this ttp has wakeup-event pending */ - -/* - * Internet style address for TLI - */ -struct taddr_in { - short sin_family; - u_short sin_port; - struct in_addr sin_addr; -}; - -/* - * For use with direct-read only - * when: - * - TI is in the correct state - * - there are data to be read - * - socket is in state to receive - * - socket buffer not locked (we are running this - * at interrupt level !) - * - the auxproc is not running - */ -#define TT_DIRECT_READ(ttp, so) { \ - extern int tcptli_auxproc_running; \ - if (((ttp)->tt_state & TL_DATAXFER) && \ - ((so)->so_rcv.sb_cc != 0) && \ - (!((so)->so_state & SS_CANTRCVMORE)) && \ - (!((so)->so_rcv.sb_flags & SB_LOCK)) && \ - (!tcptli_auxproc_running)) \ - if (tcptli_Ercv((ttp))) \ - return; \ -} - -#ifdef TLIDEBUG -extern tcptli_debug; -#define TCPTLI_PRINTF if (tcptli_debug) printf -#else -#define TCPTLI_PRINTF -#endif /* TLIDEBUG */ - -#endif /* _TCP_TLIVAR_ */ diff --git a/usr/src/lib/libbc/inc/include/nettli/tihdr.h b/usr/src/lib/libbc/inc/include/nettli/tihdr.h deleted file mode 100644 index 424298dd80..0000000000 --- a/usr/src/lib/libbc/inc/include/nettli/tihdr.h +++ /dev/null @@ -1,386 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* from S5R3 sys/tihdr.h 10.2" */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - - -/* #ident "@(#)kern-port:sys/tihdr.h 10.2" */ - -/* - * The following is all the information - * needed by the Transport Service Interface. - */ - -#ifndef _nettli_tihdr_h -#define _nettli_tihdr_h - -/* - * The following are the definitions of the Transport - * Service Interface primitives. - */ - -/* - * Primitives that are initiated by the transport user. - */ -#define T_CONN_REQ 0 /* connection request */ -#define T_CONN_RES 1 /* connection response */ -#define T_DISCON_REQ 2 /* disconnect request */ -#define T_DATA_REQ 3 /* data request */ -#define T_EXDATA_REQ 4 /* expedited data request */ -#define T_INFO_REQ 5 /* information request */ -#define T_BIND_REQ 6 /* bind request */ -#define T_UNBIND_REQ 7 /* unbind request */ -#define T_UNITDATA_REQ 8 /* unitdata request */ -#define T_OPTMGMT_REQ 9 /* manage options req */ -#define T_ORDREL_REQ 10 /* orderly release req */ - -/* - * Primitives that are initiated by the transport provider. - */ - -#define T_CONN_IND 11 /* connection indication */ -#define T_CONN_CON 12 /* connection confirmation */ -#define T_DISCON_IND 13 /* disconnect indication */ -#define T_DATA_IND 14 /* data indication */ -#define T_EXDATA_IND 15 /* expeditied data indication */ -#define T_INFO_ACK 16 /* information acknowledgment */ -#define T_BIND_ACK 17 /* bind acknowledment */ -#define T_ERROR_ACK 18 /* error acknowledgment */ -#define T_OK_ACK 19 /* ok acknowledgment */ -#define T_UNITDATA_IND 20 /* unitdata indication */ -#define T_UDERROR_IND 21 /* unitdata error indication */ -#define T_OPTMGMT_ACK 22 /* manage options ack */ -#define T_ORDREL_IND 23 /* orderly release ind */ - -/* - * The following are the events that drive the state machine - */ -/* Initialization events */ -#define TE_BIND_REQ 0 /* bind request */ -#define TE_UNBIND_REQ 1 /* unbind request */ -#define TE_OPTMGMT_REQ 2 /* manage options req */ -#define TE_BIND_ACK 3 /* bind acknowledment */ -#define TE_OPTMGMT_ACK 4 /* manage options ack */ -#define TE_ERROR_ACK 5 /* error acknowledgment */ -#define TE_OK_ACK1 6 /* ok ack seqcnt == 0 */ -#define TE_OK_ACK2 7 /* ok ack seqcnt == 1, q == resq */ -#define TE_OK_ACK3 8 /* ok ack seqcnt == 1, q != resq */ -#define TE_OK_ACK4 9 /* ok ack seqcnt > 1 */ - -/* Connection oriented events */ -#define TE_CONN_REQ 10 /* connection request */ -#define TE_CONN_RES 11 /* connection response */ -#define TE_DISCON_REQ 12 /* disconnect request */ -#define TE_DATA_REQ 13 /* data request */ -#define TE_EXDATA_REQ 14 /* expedited data request */ -#define TE_ORDREL_REQ 15 /* orderly release req */ -#define TE_CONN_IND 16 /* connection indication */ -#define TE_CONN_CON 17 /* connection confirmation */ -#define TE_DATA_IND 18 /* data indication */ -#define TE_EXDATA_IND 19 /* expedited data indication */ -#define TE_ORDREL_IND 20 /* orderly release ind */ -#define TE_DISCON_IND1 21 /* disconnect indication seq == 0 */ -#define TE_DISCON_IND2 22 /* disconnect indication seq == 1 */ -#define TE_DISCON_IND3 23 /* disconnect indication seq > 1 */ -#define TE_PASS_CONN 24 /* pass connection */ - -/* Unit data events */ -#define TE_UNITDATA_REQ 25 /* unitdata request */ -#define TE_UNITDATA_IND 26 /* unitdata indication */ -#define TE_UDERROR_IND 27 /* unitdata error indication */ - -#define TE_NOEVENTS 28 -/* - * The following are the possible states of the Transport - * Service Interface - */ - -#define TS_UNBND 0 /* unbound */ -#define TS_WACK_BREQ 1 /* waiting ack of BIND_REQ */ -#define TS_WACK_UREQ 2 /* waiting ack of UNBIND_REQ */ -#define TS_IDLE 3 /* idle */ -#define TS_WACK_OPTREQ 4 /* wait ack options request */ -#define TS_WACK_CREQ 5 /* waiting ack of CONN_REQ */ -#define TS_WCON_CREQ 6 /* waiting confirm of CONN_REQ */ -#define TS_WRES_CIND 7 /* waiting response of CONN_IND */ -#define TS_WACK_CRES 8 /* waiting ack of CONN_RES */ -#define TS_DATA_XFER 9 /* data transfer */ -#define TS_WIND_ORDREL 10 /* releasing rd but not wr */ -#define TS_WREQ_ORDREL 11 /* wait to release wr but not rd*/ -#define TS_WACK_DREQ6 12 /* waiting ack of DISCON_REQ */ -#define TS_WACK_DREQ7 13 /* waiting ack of DISCON_REQ */ -#define TS_WACK_DREQ9 14 /* waiting ack of DISCON_REQ */ -#define TS_WACK_DREQ10 15 /* waiting ack of DISCON_REQ */ -#define TS_WACK_DREQ11 16 /* waiting ack of DISCON_REQ */ - -#define TS_NOSTATES 17 - - -/* - * The following structure definitions define the format of the - * stream message block of the above primitives. - * (everything is declared long to ensure proper alignment - * across different machines) - */ - -/* connection request */ - -struct T_conn_req { - long PRIM_type; /* always T_CONN_REQ */ - long DEST_length; /* dest addr length */ - long DEST_offset; /* dest addr offset */ - long OPT_length; /* options length */ - long OPT_offset; /* options offset */ -}; - -/* connect response */ - -struct T_conn_res { - long PRIM_type; /* always T_CONN_RES */ - void *QUEUE_ptr; /* responding queue ptr */ - long OPT_length; /* options length */ - long OPT_offset; /* options offset */ - long SEQ_number; /* sequence number */ -}; - -/* disconnect request */ - -struct T_discon_req { - long PRIM_type; /* always T_DISCON_REQ */ - long SEQ_number; /* sequnce number */ -}; - -/* data request */ - -struct T_data_req { - long PRIM_type; /* always T_DATA_REQ */ - long MORE_flag; /* more data */ -}; - -/* expedited data request */ - -struct T_exdata_req { - long PRIM_type; /* always T_EXDATA_REQ */ - long MORE_flag; /* more data */ -}; - -/* information request */ - -struct T_info_req { - long PRIM_type; /* always T_INFO_REQ */ -}; - -/* bind request */ - -struct T_bind_req { - long PRIM_type; /* always T_BIND_REQ */ - long ADDR_length; /* addr length */ - long ADDR_offset; /* addr offset */ - unsigned long CONIND_number; /*connect indications requested */ -}; - -/* unbind request */ - -struct T_unbind_req { - long PRIM_type; /* always T_UNBIND_REQ */ -}; - -/* unitdata request */ - -struct T_unitdata_req { - long PRIM_type; /* always T_UNITDATA_REQ */ - long DEST_length; /* dest addr length */ - long DEST_offset; /* dest addr offset */ - long OPT_length; /* options length */ - long OPT_offset; /* options offset */ -}; - -/* manage options request */ - -struct T_optmgmt_req { - long PRIM_type; /* always T_OPTMGMT_REQ */ - long OPT_length; /* options length */ - long OPT_offset; /* options offset */ - long MGMT_flags; /* options flags */ -}; - -/* orderly release request */ - -struct T_ordrel_req { - long PRIM_type; /* always T_ORDREL_REQ */ -}; - -/* connect indication */ - -struct T_conn_ind { - long PRIM_type; /* always T_CONN_IND */ - long SRC_length; /* src addr length */ - long SRC_offset; /* src addr offset */ - long OPT_length; /* option length */ - long OPT_offset; /* option offset */ - long SEQ_number; /* sequnce number */ -}; - -/* connect confirmation */ - -struct T_conn_con { - long PRIM_type; /* always T_CONN_CON */ - long RES_length; /* responding addr length */ - long RES_offset; /* responding addr offset */ - long OPT_length; /* option length */ - long OPT_offset; /* option offset */ -}; - -/* disconnect indication */ - -struct T_discon_ind { - long PRIM_type; /* always T_DISCON_IND */ - long DISCON_reason; /* disconnect reason */ - long SEQ_number; /* sequnce number */ -}; - -/* data indication */ - -struct T_data_ind { - long PRIM_type; /* always T_DATA_IND */ - long MORE_flag; /* more data */ -}; - -/* expedited data indication */ - -struct T_exdata_ind { - long PRIM_type; /* always T_EXDATA_IND */ - long MORE_type; /* more data */ -}; - -/* information acknowledgment */ - -struct T_info_ack { - long PRIM_type; /* always T_INFO_ACK */ - long TSDU_size; /* max TSDU size */ - long ETSDU_size; /* max ETSDU size */ - long CDATA_size; /* max connect data size */ - long DDATA_size; /* max discon data size */ - long ADDR_size; /* address size */ - long OPT_size; /* options size */ - long TIDU_size; /* max TIDU size */ - long SERV_type; /* provider service type */ - long CURRENT_state; /* current state */ -}; - -/* bind acknowledgment */ - -struct T_bind_ack { - long PRIM_type; /* always T_BIND_ACK */ - long ADDR_length; /* addr length */ - long ADDR_offset; /* addr offset */ - unsigned long CONIND_number; /* connect ind to be queued */ -}; - -/* error acknowledgment */ - -struct T_error_ack { - long PRIM_type; /* always T_ERROR_ACK */ - long ERROR_prim; /* primitive in error */ - long TLI_error; /* TLI error code */ - long UNIX_error; /* UNIX error code */ -}; - -/* ok acknowledgment */ - -struct T_ok_ack { - long PRIM_type; /* always T_OK_ACK */ - long CORRECT_prim; /* correct primitive */ -}; - -/* unitdata indication */ - -struct T_unitdata_ind { - long PRIM_type; /* always T_UNITDATA_IND */ - long SRC_length; /* source addr length */ - long SRC_offset; /* source addr offset */ - long OPT_length; /* options length */ - long OPT_offset; /* options offset */ -}; - -/* unitdata error indication */ - -struct T_uderror_ind { - long PRIM_type; /* always T_UDERROR_IND */ - long DEST_length; /* dest addr length */ - long DEST_offset; /* dest addr offset */ - long OPT_length; /* options length */ - long OPT_offset; /* options offset */ - long ERROR_type; /* error type */ -}; - -/* manage options ack */ - -struct T_optmgmt_ack { - long PRIM_type; /* always T_OPTMGMT_ACK */ - long OPT_length; /* options length */ - long OPT_offset; /* options offset */ - long MGMT_flags; /* managment flags */ -}; - -/* orderly release indication */ - -struct T_ordrel_ind { - long PRIM_type; /* always T_ORDREL_IND */ -}; - -/* - * The following is a union of the primitives - */ -union T_primitives { - long type; /* primitive type */ - struct T_conn_req conn_req; /* connect request */ - struct T_conn_res conn_res; /* connect response */ - struct T_discon_req discon_req; /* disconnect request */ - struct T_data_req data_req; /* data request */ - struct T_exdata_req exdata_req; /* expedited data req */ - struct T_info_req info_req; /* information req */ - struct T_bind_req bind_req; /* bind request */ - struct T_unbind_req unbind_req; /* unbind request */ - struct T_unitdata_req unitdata_req; /* unitdata requset */ - struct T_optmgmt_req optmgmt_req; /* manage opt req */ - struct T_ordrel_req ordrel_req; /* orderly rel req */ - struct T_conn_ind conn_ind; /* connect indication */ - struct T_conn_con conn_con; /* connect corfirm */ - struct T_discon_ind discon_ind; /* discon indication */ - struct T_data_ind data_ind; /* data indication */ - struct T_exdata_ind exdata_ind; /* expedited data ind */ - struct T_info_ack info_ack; /* info ack */ - struct T_bind_ack bind_ack; /* bind ack */ - struct T_error_ack error_ack; /* error ack */ - struct T_ok_ack ok_ack; /* ok ack */ - struct T_unitdata_ind unitdata_ind; /* unitdata ind */ - struct T_uderror_ind uderror_ind; /* unitdata error ind */ - struct T_optmgmt_ack optmgmt_ack; /* manage opt ack */ - struct T_ordrel_ind ordrel_ind; /* orderly rel ind */ -}; - -#endif /*!_nettli_tihdr_h*/ diff --git a/usr/src/lib/libbc/inc/include/nettli/timod.h b/usr/src/lib/libbc/inc/include/nettli/timod.h deleted file mode 100644 index f5c5663df0..0000000000 --- a/usr/src/lib/libbc/inc/include/nettli/timod.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* from S5R3 sys/timod.h 10.3.1.1" */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - - -/* #ident "@(#)kern-port:sys/timod.h 10.3.1.1" */ - -#ifndef _nettli_timod_h -#define _nettli_timod_h - -/* internal flags */ -#define USED 0x01 /* data structure in use */ -#define FATAL 0x02 /* fatal error M_ERROR occurred */ -#define WAITIOCACK 0x04 /* waiting for info for ioctl act */ -#define MORE 0x08 /* more data */ - - - -/* timod ioctls */ -#define TIMOD ('T'<<8) -#define TI_GETINFO (TIMOD|100) -#define TI_OPTMGMT (TIMOD|101) -#define TI_BIND (TIMOD|102) -#define TI_UNBIND (TIMOD|103) - - -/* TI interface user level structure - one per open file */ - -struct _ti_user { - ushort ti_flags; /* flags */ - int ti_rcvsize; /* rcv buffer size */ - char *ti_rcvbuf; /* rcv buffer */ - int ti_ctlsize; /* ctl buffer size */ - char *ti_ctlbuf; /* ctl buffer */ - char *ti_lookdbuf; /* look data buffer */ - char *ti_lookcbuf; /* look ctl buffer */ - int ti_lookdsize; /* look data buf size */ - int ti_lookcsize; /* look ctl buf size */ - int ti_maxpsz; /* TIDU size */ - long ti_servtype; /* service type */ - int ti_lookflg; /* buffered look flag */ -}; - - -/* This should be replaced */ -#define OPENFILES getdtablesize() - -#endif /*!_nettli_timod_h*/ diff --git a/usr/src/lib/libbc/inc/include/nettli/tiuser.h b/usr/src/lib/libbc/inc/include/nettli/tiuser.h deleted file mode 100644 index 71b9c89132..0000000000 --- a/usr/src/lib/libbc/inc/include/nettli/tiuser.h +++ /dev/null @@ -1,217 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* from S5R3 sys/tiuser.h 10.2.1.1" */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - - -/* #ident "@(#)kern-port:sys/tiuser.h 10.2.1.1" */ - -#ifndef _nettli_tiuser_h -#define _nettli_tiuser_h - -/* - * The following are the error codes needed by both the kernel - * level transport providers and the user level library. - */ -#define TBADADDR 1 /* incorrect addr format */ -#define TBADOPT 2 /* incorrect option format */ -#define TACCES 3 /* incorrect permissions */ -#define TBADF 4 /* illegal transport fd */ -#define TNOADDR 5 /* couldn't allocate addr */ -#define TOUTSTATE 6 /* out of state */ -#define TBADSEQ 7 /* bad call sequnce number */ -#define TSYSERR 8 /* system error */ -#define TLOOK 9 /* event requires attention */ -#define TBADDATA 10 /* illegal amount of data */ -#define TBUFOVFLW 11 /* buffer not large enough */ -#define TFLOW 12 /* flow control */ -#define TNODATA 13 /* no data */ -#define TNODIS 14 /* discon_ind not found on q */ -#define TNOUDERR 15 /* unitdata error not found */ -#define TBADFLAG 16 /* bad flags */ -#define TNOREL 17 /* no ord rel found on q */ -#define TNOTSUPPORT 18 /* primitive not supported */ -#define TSTATECHNG 19 /* state is in process of changing */ - -/* - * The following are the events returned by t_look - */ -#define T_LISTEN 0x0001 /* connection indication received */ -#define T_CONNECT 0x0002 /* connect confirmation received */ -#define T_DATA 0x0004 /* normal data received */ -#define T_EXDATA 0x0008 /* expedited data received */ -#define T_DISCONNECT 0x0010 /* disconnect received */ -#define T_ERROR 0x0020 /* fatal error occurred */ -#define T_UDERR 0x0040 /* data gram error indication */ -#define T_ORDREL 0x0080 /* orderly release indication */ -#define T_EVENTS 0x00ff /* event mask */ - -/* - * The following are the flag definitions needed by the - * user level library routines. - */ - -#define T_MORE 0x001 /* more data */ -#define T_EXPEDITED 0x002 /* expedited data */ -#define T_NEGOTIATE 0x004 /* set opts */ -#define T_CHECK 0x008 /* check opts */ -#define T_DEFAULT 0x010 /* get default opts */ -#define T_SUCCESS 0x020 /* successful */ -#define T_FAILURE 0x040 /* failure */ - -/* - * protocol specific service limits - */ - -struct t_info { - long addr; /* size of protocol address */ - long options; /* size of protocol options */ - long tsdu; /* size of max transport service data unit */ - long etsdu; /* size of max expedited tsdu */ - long connect; /* max data for connection primitives */ - long discon; /* max data for disconnect primitives */ - long servtype; /* provider service type */ -}; - -/* - * Service type defines - */ -#define T_COTS 01 /* connection oriented transport service */ -#define T_COTS_ORD 02 /* connection oriented w/ orderly release */ -#define T_CLTS 03 /* connectionless transport service */ - -/* - * netbuf structure - */ - -struct netbuf { - unsigned int maxlen; - unsigned int len; - char *buf; -}; - -/* - * t_bind - format of the addres and options arguments of bind - */ - -struct t_bind { - struct netbuf addr; - unsigned qlen; -}; - -/* - * options management - */ -struct t_optmgmt { - struct netbuf opt; - long flags; -}; - -/* - * disconnect structure - */ -struct t_discon { - struct netbuf udata; /* user data */ - int reason; /* reason code */ - int sequence; /* sequence number */ -}; - -/* - * call structure - */ -struct t_call { - struct netbuf addr; /* address */ - struct netbuf opt; /* options */ - struct netbuf udata; /* user data */ - int sequence; /* sequence number */ -}; - -/* - * data gram structure - */ -struct t_unitdata { - struct netbuf addr; /* address */ - struct netbuf opt; /* options */ - struct netbuf udata; /* user data */ -}; - -/* - * unitdata error - */ -struct t_uderr { - struct netbuf addr; /* address */ - struct netbuf opt; /* options */ - long error; /* error code */ -}; - -/* - * The following are structure types used when dynamically - * allocating the above structures via t_structalloc(). - */ -#define T_BIND 1 /* struct t_bind */ -#define T_OPTMGMT 2 /* struct t_optmgmt */ -#define T_CALL 3 /* struct t_call */ -#define T_DIS 4 /* struct t_discon */ -#define T_UNITDATA 5 /* struct t_unitdata */ -#define T_UDERROR 6 /* struct t_uderr */ -#define T_INFO 7 /* struct t_info */ - -/* - * The following bits specify which fields of the above - * structures should be allocated by t_structalloc(). - */ -#define T_ADDR 0x01 /* address */ -#define T_OPT 0x02 /* options */ -#define T_UDATA 0x04 /* user data */ -#define T_ALL 0x07 /* all the above */ - - -/* - * the following are the states for the user - */ - -#define T_UNINIT 0 /* uninitialized */ -#define T_UNBND 1 /* unbound */ -#define T_IDLE 2 /* idle */ -#define T_OUTCON 3 /* outgoing connection pending */ -#define T_INCON 4 /* incoming connection pending */ -#define T_DATAXFER 5 /* data transfer */ -#define T_OUTREL 6 /* outgoing release pending */ -#define T_INREL 7 /* incoming release pending */ - -#define T_NOSTATES 8 - - - -#define ROUNDUP(X) ((X + 0x03)&~0x03) - -/* - * Macro for converting signal number to a mask suitable for - * sigblock(). - */ -#define sigmask(m) (1 << ((m)-1)) - -#endif /*!_nettli_tiuser_h*/ diff --git a/usr/src/lib/libbc/inc/include/pwd.h b/usr/src/lib/libbc/inc/include/pwd.h deleted file mode 100644 index 701d19d64c..0000000000 --- a/usr/src/lib/libbc/inc/include/pwd.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef __pwd_h -#define __pwd_h - -#include <sys/types.h> - -struct passwd { - char *pw_name; - char *pw_passwd; - int pw_uid; - int pw_gid; - char *pw_age; - char *pw_comment; - char *pw_gecos; - char *pw_dir; - char *pw_shell; -}; - - -#ifndef _POSIX_SOURCE -extern struct passwd *getpwent(); - -struct comment { - char *c_dept; - char *c_name; - char *c_acct; - char *c_bin; -}; - -#endif - -struct passwd *getpwuid(/* uid_t uid */); -struct passwd *getpwnam(/* char *name */); - -#endif /* !__pwd_h */ diff --git a/usr/src/lib/libbc/inc/include/pwdadj.h b/usr/src/lib/libbc/inc/include/pwdadj.h deleted file mode 100644 index 62d3542222..0000000000 --- a/usr/src/lib/libbc/inc/include/pwdadj.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef _pwdadj_h -#define _pwdadj_h - -struct passwd_adjunct { /* see getpwaent(3) */ - char *pwa_name; - char *pwa_passwd; - blabel_t pwa_minimum; - blabel_t pwa_maximum; - blabel_t pwa_def; - audit_state_t pwa_au_always; - audit_state_t pwa_au_never; - int pwa_version; - char *pwa_age; -}; - -struct passwd_adjunct *getpwaent(), *getpwauid(), *getpwanam(); - -#define PWA_VALID 0 -#define PWA_INVALID -1 -#define PWA_UNKNOWN -2 - -#endif /*!_pwdadj_h*/ diff --git a/usr/src/lib/libbc/inc/include/rpc/auth.h b/usr/src/lib/libbc/inc/include/rpc/auth.h deleted file mode 100644 index 8209121493..0000000000 --- a/usr/src/lib/libbc/inc/include/rpc/auth.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * auth.h, Authentication interface. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - * The data structures are completely opaque to the client. The client - * is required to pass a AUTH * to routines that create rpc - * "sessions". - */ - - -#ifndef _rpc_auth_h -#define _rpc_auth_h - -#define MAX_AUTH_BYTES 400 -#define MAXNETNAMELEN 255 /* maximum length of network user's name */ - -/* - * Status returned from authentication check - */ -enum auth_stat { - AUTH_OK=0, - /* - * failed at remote end - */ - AUTH_BADCRED=1, /* bogus credentials (seal broken) */ - AUTH_REJECTEDCRED=2, /* client should begin new session */ - AUTH_BADVERF=3, /* bogus verifier (seal broken) */ - AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */ - AUTH_TOOWEAK=5, /* rejected due to security reasons */ - /* - * failed locally - */ - AUTH_INVALIDRESP=6, /* bogus response verifier */ - AUTH_FAILED=7 /* some unknown reason */ -}; - -#if (mc68000 || sparc || vax || i386) -typedef u_long u_int32; /* 32-bit unsigned integers */ -#endif - -union des_block { - struct { - u_int32 high; - u_int32 low; - } key; - char c[8]; -}; -typedef union des_block des_block; -extern bool_t xdr_des_block(); - -/* - * Authentication info. Opaque to client. - */ -struct opaque_auth { - enum_t oa_flavor; /* flavor of auth */ - caddr_t oa_base; /* address of more auth stuff */ - u_int oa_length; /* not to exceed MAX_AUTH_BYTES */ -}; - - -/* - * Auth handle, interface to client side authenticators. - */ -typedef struct { - struct opaque_auth ah_cred; - struct opaque_auth ah_verf; - union des_block ah_key; - struct auth_ops { - void (*ah_nextverf)(); - int (*ah_marshal)(); /* nextverf & serialize */ - int (*ah_validate)(); /* validate varifier */ - int (*ah_refresh)(); /* refresh credentials */ - void (*ah_destroy)(); /* destroy this structure */ - } *ah_ops; - caddr_t ah_private; -} AUTH; - - -/* - * Authentication ops. - * The ops and the auth handle provide the interface to the authenticators. - * - * AUTH *auth; - * XDR *xdrs; - * struct opaque_auth verf; - */ -#define AUTH_NEXTVERF(auth) \ - ((*((auth)->ah_ops->ah_nextverf))(auth)) -#define auth_nextverf(auth) \ - ((*((auth)->ah_ops->ah_nextverf))(auth)) - -#define AUTH_MARSHALL(auth, xdrs) \ - ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) -#define auth_marshall(auth, xdrs) \ - ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) - -#define AUTH_VALIDATE(auth, verfp) \ - ((*((auth)->ah_ops->ah_validate))((auth), verfp)) -#define auth_validate(auth, verfp) \ - ((*((auth)->ah_ops->ah_validate))((auth), verfp)) - -#define AUTH_REFRESH(auth) \ - ((*((auth)->ah_ops->ah_refresh))(auth)) -#define auth_refresh(auth) \ - ((*((auth)->ah_ops->ah_refresh))(auth)) - -#define AUTH_DESTROY(auth) \ - ((*((auth)->ah_ops->ah_destroy))(auth)) -#define auth_destroy(auth) \ - ((*((auth)->ah_ops->ah_destroy))(auth)) - - -extern struct opaque_auth _null_auth; - - -/* - * These are the various implementations of client side authenticators. - */ - -/* - * Unix style authentication - * AUTH *authunix_create(machname, uid, gid, len, aup_gids) - * char *machname; - * int uid; - * int gid; - * int len; - * int *aup_gids; - */ -#ifdef KERNEL -extern AUTH *authkern_create(); /* takes no parameters */ -#else -extern AUTH *authsys_create(const char *, const uid_t, const gid_t, - const int, const gid_t *); -extern AUTH *authsys_create_default(void); /* takes no parameters */ -extern AUTH *authnone_create(); /* takes no parameters */ -#endif -extern AUTH *authdes_create(); - -#define AUTH_NONE 0 /* no authentication */ -#define AUTH_NULL 0 /* backward compatibility */ -#define AUTH_UNIX 1 /* unix style (uid, gids) */ -#define AUTH_SHORT 2 /* short hand unix style */ -#define AUTH_DES 3 /* des style (encrypted timestamps) */ - -#endif /* !_rpc_auth_h */ diff --git a/usr/src/lib/libbc/inc/include/rpc/auth_des.h b/usr/src/lib/libbc/inc/include/rpc/auth_des.h deleted file mode 100644 index a580e7328a..0000000000 --- a/usr/src/lib/libbc/inc/include/rpc/auth_des.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * %M%, Protocol for DES style authentication for RPC - * - * Copyright (C) 1986, Sun Microsystems, Inc. - */ - -#ifndef _rpc_auth_des_h -#define _rpc_auth_des_h - -/* - * There are two kinds of "names": fullnames and nicknames - */ -enum authdes_namekind { - ADN_FULLNAME, - ADN_NICKNAME -}; - -/* - * A fullname contains the network name of the client, - * a conversation key and the window - */ -struct authdes_fullname { - char *name; /* network name of client, up to MAXNETNAMELEN */ - des_block key; /* conversation key */ - u_long window; /* associated window */ -}; - - -/* - * A credential - */ -struct authdes_cred { - enum authdes_namekind adc_namekind; - struct authdes_fullname adc_fullname; - u_long adc_nickname; -}; - - - -/* - * A des authentication verifier - */ -struct authdes_verf { - union { - struct timeval adv_ctime; /* clear time */ - des_block adv_xtime; /* crypt time */ - } adv_time_u; - u_long adv_int_u; -}; - -/* - * des authentication verifier: client variety - * - * adv_timestamp is the current time. - * adv_winverf is the credential window + 1. - * Both are encrypted using the conversation key. - */ -#define adv_timestamp adv_time_u.adv_ctime -#define adv_xtimestamp adv_time_u.adv_xtime -#define adv_winverf adv_int_u - -/* - * des authentication verifier: server variety - * - * adv_timeverf is the client's timestamp + client's window - * adv_nickname is the server's nickname for the client. - * adv_timeverf is encrypted using the conversation key. - */ -#define adv_timeverf adv_time_u.adv_ctime -#define adv_xtimeverf adv_time_u.adv_xtime -#define adv_nickname adv_int_u - -#endif /*!_rpc_auth_des_h*/ diff --git a/usr/src/lib/libbc/inc/include/rpc/auth_unix.h b/usr/src/lib/libbc/inc/include/rpc/auth_unix.h deleted file mode 100644 index e42e6ef936..0000000000 --- a/usr/src/lib/libbc/inc/include/rpc/auth_unix.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * auth_unix.h, Protocol for UNIX style authentication parameters for RPC - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef _rpc_auth_unix_h -#define _rpc_auth_unix_h - -/* - * The system is very weak. The client uses no encryption for it - * credentials and only sends null verifiers. The server sends backs - * null verifiers or optionally a verifier that suggests a new short hand - * for the credentials. - */ - -/* The machine name is part of a credential; it may not exceed 255 bytes */ -#define MAX_MACHINE_NAME 255 - -/* gids compose part of a credential; there may not be more than 16 of them */ -#define NGRPS 16 - -/* - * Unix style credentials. - */ -struct authunix_parms { - u_long aup_time; - char *aup_machname; - u_int aup_uid; - u_int aup_gid; - u_int aup_len; - u_int *aup_gids; -}; - -extern bool_t xdr_authunix_parms(); - -/* - * If a response verifier has flavor AUTH_SHORT, - * then the body of the response verifier encapsulates the following structure; - * again it is serialized in the obvious fashion. - */ -struct short_hand_verf { - struct opaque_auth new_cred; -}; - -#endif /*!_rpc_auth_unix_h*/ diff --git a/usr/src/lib/libbc/inc/include/rpc/clnt.h b/usr/src/lib/libbc/inc/include/rpc/clnt.h deleted file mode 100644 index bfd9dc8f7c..0000000000 --- a/usr/src/lib/libbc/inc/include/rpc/clnt.h +++ /dev/null @@ -1,383 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * clnt.h - Client side remote procedure call interface. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef _rpc_clnt_h -#define _rpc_clnt_h - -/* - * Rpc calls return an enum clnt_stat. This should be looked at more, - * since each implementation is required to live with this (implementation - * independent) list of errors. - */ -enum clnt_stat { - RPC_SUCCESS=0, /* call succeeded */ - /* - * local errors - */ - RPC_CANTENCODEARGS=1, /* can't encode arguments */ - RPC_CANTDECODERES=2, /* can't decode results */ - RPC_CANTSEND=3, /* failure in sending call */ - RPC_CANTRECV=4, /* failure in receiving result */ - RPC_TIMEDOUT=5, /* call timed out */ - RPC_INTR=18, /* call interrupted */ - /* - * remote errors - */ - RPC_VERSMISMATCH=6, /* rpc versions not compatible */ - RPC_AUTHERROR=7, /* authentication error */ - RPC_PROGUNAVAIL=8, /* program not available */ - RPC_PROGVERSMISMATCH=9, /* program version mismatched */ - RPC_PROCUNAVAIL=10, /* procedure unavailable */ - RPC_CANTDECODEARGS=11, /* decode arguments error */ - RPC_SYSTEMERROR=12, /* generic "other problem" */ - - /* - * callrpc & clnt_create errors - */ - RPC_UNKNOWNHOST=13, /* unknown host name */ - RPC_UNKNOWNPROTO=17, /* unkown protocol */ - - /* - * _ create errors - */ - RPC_PMAPFAILURE=14, /* the pmapper failed in its call */ - RPC_PROGNOTREGISTERED=15, /* remote program is not registered */ - /* - * unspecified error - */ - RPC_FAILED=16 -}; - - -/* - * Error info. - */ -struct rpc_err { - enum clnt_stat re_status; - union { - int RE_errno; /* realated system error */ - enum auth_stat RE_why; /* why the auth error occurred */ - struct { - u_long low; /* lowest verion supported */ - u_long high; /* highest verion supported */ - } RE_vers; - struct { /* maybe meaningful if RPC_FAILED */ - long s1; - long s2; - } RE_lb; /* life boot & debugging only */ - } ru; -#define re_errno ru.RE_errno -#define re_why ru.RE_why -#define re_vers ru.RE_vers -#define re_lb ru.RE_lb -}; - - -/* - * Client rpc handle. - * Created by individual implementations, see e.g. rpc_udp.c. - * Client is responsible for initializing auth, see e.g. auth_none.c. - */ -typedef struct { - AUTH *cl_auth; /* authenticator */ - struct clnt_ops { - enum clnt_stat (*cl_call)(); /* call remote procedure */ - void (*cl_abort)(); /* abort a call */ - void (*cl_geterr)(); /* get specific error code */ - bool_t (*cl_freeres)(); /* frees results */ - void (*cl_destroy)(); /* destroy this structure */ - bool_t (*cl_control)(); /* the ioctl() of rpc */ - } *cl_ops; - caddr_t cl_private; /* private stuff */ -} CLIENT; - - -/* - * client side rpc interface ops - * - * Parameter types are: - * - */ - -/* - * enum clnt_stat - * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout) - * CLIENT *rh; - * u_long proc; - * xdrproc_t xargs; - * caddr_t argsp; - * xdrproc_t xres; - * caddr_t resp; - * struct timeval timeout; - */ -#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \ - ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) -#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \ - ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) - -/* - * void - * CLNT_ABORT(rh); - * CLIENT *rh; - */ -#define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh)) -#define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) - -/* - * struct rpc_err - * CLNT_GETERR(rh); - * CLIENT *rh; - */ -#define CLNT_GETERR(rh, errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) -#define clnt_geterr(rh, errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) - - -/* - * bool_t - * CLNT_FREERES(rh, xres, resp); - * CLIENT *rh; - * xdrproc_t xres; - * caddr_t resp; - */ -#define CLNT_FREERES(rh, xres, resp) ((*(rh)->cl_ops->cl_freeres)\ - (rh, xres, resp)) -#define clnt_freeres(rh, xres, resp) ((*(rh)->cl_ops->cl_freeres)\ - (rh, xres, resp)) - -/* - * bool_t - * CLNT_CONTROL(cl, request, info) - * CLIENT *cl; - * u_int request; - * char *info; - */ -#define CLNT_CONTROL(cl, rq, in) ((*(cl)->cl_ops->cl_control)(cl, rq, in)) -#define clnt_control(cl, rq, in) ((*(cl)->cl_ops->cl_control)(cl, rq, in)) - -/* - * control operations that apply to both udp and tcp transports - */ -#define CLSET_TIMEOUT 1 /* set timeout (timeval) */ -#define CLGET_TIMEOUT 2 /* get timeout (timeval) */ -#define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */ -#define CLGET_FD 6 /* get connections file descriptor */ -#define CLSET_FD_CLOSE 8 /* close fd while clnt_destroy */ -#define CLSET_FD_NCLOSE 9 /* Do not close fd while clnt_destroy */ -/* - * udp only control operations - */ -#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */ -#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ - -/* - * void - * CLNT_DESTROY(rh); - * CLIENT *rh; - */ -#define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) -#define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) - - -/* - * RPCTEST is a test program which is accessable on every rpc - * transport/port. It is used for testing, performance evaluation, - * and network administration. - */ - -#define RPCTEST_PROGRAM ((u_long)1) -#define RPCTEST_VERSION ((u_long)1) -#define RPCTEST_NULL_PROC ((u_long)2) -#define RPCTEST_NULL_BATCH_PROC ((u_long)3) - -/* - * By convention, procedure 0 takes null arguments and returns them - */ - -#define NULLPROC ((u_long)0) - -/* - * Below are the client handle creation routines for the various - * implementations of client side rpc. They can return NULL if a - * creation failure occurs. - */ - -#ifndef KERNEL -/* - * Memory based rpc (for speed check and testing) - * CLIENT * - * clntraw_create(prog, vers) - * u_long prog; - * u_long vers; - */ -extern CLIENT *clntraw_create(); - - -/* - * Generic client creation routine. Supported protocols are "udp" and "tcp" - */ -extern CLIENT * -clnt_create(/*host, prog, vers, prot*/); /* - char *host; -- hostname - u_long prog; -- program number - u_long vers; -- version number - char *prot; -- protocol -*/ - -/* - * Generic client creation routine. Supported protocols are "udp" and "tcp" - */ -extern CLIENT * -clnt_create_vers(/*host, prog, vers_out, vers_low, vers_high, prot*/); -/* - char *host; -- hostname - u_long prog; -- program number - u_long *vers_out; -- servers best version number - u_long vers_low; -- low version number - u_long vers_high; -- high version number - char *prot; -- protocol -*/ - - - -/* - * TCP based rpc - * CLIENT * - * clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) - * struct sockaddr_in *raddr; - * u_long prog; - * u_long version; - * register int *sockp; - * u_int sendsz; - * u_int recvsz; - */ -extern CLIENT *clnttcp_create(); - -/* - * UDP based rpc. - * CLIENT * - * clntudp_create(raddr, program, version, wait, sockp) - * struct sockaddr_in *raddr; - * u_long program; - * u_long version; - * struct timeval wait; - * int *sockp; - * - * Same as above, but you specify max packet sizes. - * CLIENT * - * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz) - * struct sockaddr_in *raddr; - * u_long program; - * u_long version; - * struct timeval wait; - * int *sockp; - * u_int sendsz; - * u_int recvsz; - */ -extern CLIENT *clntudp_create(); -extern CLIENT *clntudp_bufcreate(); - -/* - * Print why creation failed - */ -void clnt_pcreateerror(/* char *msg */); /* stderr */ -char *clnt_spcreateerror(/* char *msg */); /* string */ - -/* - * Like clnt_perror(), but is more verbose in its output - */ -void clnt_perrno(/* enum clnt_stat num */); /* stderr */ - -/* - * Print an English error message, given the client error code - */ -void clnt_perror(/* CLIENT *clnt, char *msg */); /* stderr */ -char *clnt_sperror(/* CLIENT *clnt, char *msg */); /* string */ - -/* - * If a creation fails, the following allows the user to figure out why. - */ -struct rpc_createerr { - enum clnt_stat cf_stat; - struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */ -}; - -extern struct rpc_createerr rpc_createerr; - - -#endif /* !KERNEL */ - -/* - * Copy error message to buffer. - */ -char *clnt_sperrno(/* enum clnt_stat num */); /* string */ - - -#ifdef KERNEL -/* - * Kernel udp based rpc - * CLIENT * - * clntkudp_create(addr, pgm, vers) - * struct sockaddr_in *addr; - * u_long pgm; - * u_long vers; - */ -extern CLIENT *clntkudp_create(); -#endif - -/* - * Timers used for the pseudo-transport protocol when using datagrams - */ -struct rpc_timers { - u_short rt_srtt; /* smoothed round-trip time */ - u_short rt_deviate; /* estimated deviation */ - u_long rt_rtxcur; /* current (backed-off) rto */ -}; - -/* - * Feedback values used for possible congestion and rate control - */ -#define FEEDBACK_REXMIT1 1 /* first retransmit */ -#define FEEDBACK_OK 2 /* no retransmits */ - -#define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */ -#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ - -#ifdef KERNEL -/* - * Alloc_xid presents an interface which kernel RPC clients - * should use to allocate their XIDs. Its implementation - * may change over time (for example, to allow sharing of - * XIDs between the kernel and user-level applications, so - * all XID allocation should be done by calling alloc_xid(). - */ -extern u_long clntxid; -#define alloc_xid() (clntxid++) -#endif - -#endif /*!_rpc_clnt_h*/ diff --git a/usr/src/lib/libbc/inc/include/rpc/key_prot.h b/usr/src/lib/libbc/inc/include/rpc/key_prot.h deleted file mode 100644 index 4c9c320649..0000000000 --- a/usr/src/lib/libbc/inc/include/rpc/key_prot.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Compiled from key_prot.x using rpcgen. - * DO NOT EDIT THIS FILE! - * This is NOT source code! - */ - -#ifndef _rpc_key_prot_h -#define _rpc_key_prot_h - -#define KEY_PROG 100029 -#define KEY_VERS 1 -#define KEY_SET 1 -#define KEY_ENCRYPT 2 -#define KEY_DECRYPT 3 -#define KEY_GEN 4 -#define KEY_GETCRED 5 - -#define PROOT 3 -#define HEXMODULUS "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b" -#define HEXKEYBYTES 48 -#define KEYSIZE 192 -#define KEYBYTES 24 -#define KEYCHECKSUMSIZE 16 - -enum keystatus { - KEY_SUCCESS = 0, - KEY_NOSECRET = 1, - KEY_UNKNOWN = 2, - KEY_SYSTEMERR = 3, -}; -typedef enum keystatus keystatus; -bool_t xdr_keystatus(); - -#ifndef KERNEL - -typedef char keybuf[HEXKEYBYTES]; -bool_t xdr_keybuf(); - -#endif - -typedef char *netnamestr; -bool_t xdr_netnamestr(); - - -struct cryptkeyarg { - netnamestr remotename; - des_block deskey; -}; -typedef struct cryptkeyarg cryptkeyarg; -bool_t xdr_cryptkeyarg(); - - -struct cryptkeyres { - keystatus status; - union { - des_block deskey; - } cryptkeyres_u; -}; -typedef struct cryptkeyres cryptkeyres; -bool_t xdr_cryptkeyres(); - -#define MAXGIDS 16 - -struct unixcred { - u_int uid; - u_int gid; - struct { - u_int gids_len; - u_int *gids_val; - } gids; -}; -typedef struct unixcred unixcred; -bool_t xdr_unixcred(); - - -struct getcredres { - keystatus status; - union { - unixcred cred; - } getcredres_u; -}; -typedef struct getcredres getcredres; -bool_t xdr_getcredres(); - -#endif /*!_rpc_key_prot_h*/ diff --git a/usr/src/lib/libbc/inc/include/rpc/pmap_clnt.h b/usr/src/lib/libbc/inc/include/rpc/pmap_clnt.h deleted file mode 100644 index 885026ea83..0000000000 --- a/usr/src/lib/libbc/inc/include/rpc/pmap_clnt.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * pmap_clnt.h - * Supplies C routines to get to portmap services. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -/* - * Usage: - * success = pmap_set(program, version, protocol, port); - * success = pmap_unset(program, version); - * port = pmap_getport(address, program, version, protocol); - * head = pmap_getmaps(address); - * clnt_stat = pmap_rmtcall(address, program, version, procedure, - * xdrargs, argsp, xdrres, resp, tout, port_ptr) - * (works for udp only.) - * clnt_stat = clnt_broadcast(program, version, procedure, - * xdrargs, argsp, xdrres, resp, eachresult) - * (like pmap_rmtcall, except the call is broadcasted to all - * locally connected nets. For each valid response received, - * the procedure eachresult is called. Its form is: - * done = eachresult(resp, raddr) - * bool_t done; - * caddr_t resp; - * struct sockaddr_in raddr; - * where resp points to the results of the call and raddr is the - * address if the responder to the broadcast. - */ - -#ifndef _rpc_pmap_clnt_h -#define _rpc_pmap_clnt_h - -extern bool_t pmap_set(); -extern bool_t pmap_unset(); -extern struct pmaplist *pmap_getmaps(); -enum clnt_stat pmap_rmtcall(); -enum clnt_stat clnt_broadcast(); -extern u_short pmap_getport(); - -#endif /*!_rpc_pmap_clnt_h*/ diff --git a/usr/src/lib/libbc/inc/include/rpc/pmap_prot.h b/usr/src/lib/libbc/inc/include/rpc/pmap_prot.h deleted file mode 100644 index e40fbf15af..0000000000 --- a/usr/src/lib/libbc/inc/include/rpc/pmap_prot.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * pmap_prot.h - * Protocol for the local binder service, or pmap. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - * The following procedures are supported by the protocol: - * - * PMAPPROC_NULL() returns () - * takes nothing, returns nothing - * - * PMAPPROC_SET(struct pmap) returns (bool_t) - * TRUE is success, FALSE is failure. Registers the tuple - * [prog, vers, prot, port]. - * - * PMAPPROC_UNSET(struct pmap) returns (bool_t) - * TRUE is success, FALSE is failure. Un-registers pair - * [prog, vers]. prot and port are ignored. - * - * PMAPPROC_GETPORT(struct pmap) returns (long unsigned). - * 0 is failure. Otherwise returns the port number where the pair - * [prog, vers] is registered. It may lie! - * - * PMAPPROC_DUMP() RETURNS (struct pmaplist *) - * - * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>) - * RETURNS (port, string<>); - * usage: encapsulatedresults = - * PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs); - * Calls the procedure on the local machine. If it is not registered, - * this procedure is quite; ie it does not return error information!!! - * This procedure only is supported on rpc/udp and calls via - * rpc/udp. This routine only passes null authentication parameters. - * This file has no interface to xdr routines for PMAPPROC_CALLIT. - * - * The service supports remote procedure calls on udp/ip or tcp/ip socket 111. - */ - -#ifndef _rpc_pmap_prot_h -#define _rpc_pmap_prot_h - -#define PMAPPORT ((u_short)111) -#define PMAPPROG ((u_long)100000) -#define PMAPVERS ((u_long)2) -#define PMAPVERS_PROTO ((u_long)2) -#define PMAPVERS_ORIG ((u_long)1) -#define PMAPPROC_NULL ((u_long)0) -#define PMAPPROC_SET ((u_long)1) -#define PMAPPROC_UNSET ((u_long)2) -#define PMAPPROC_GETPORT ((u_long)3) -#define PMAPPROC_DUMP ((u_long)4) -#define PMAPPROC_CALLIT ((u_long)5) - -struct pmap { - long unsigned pm_prog; - long unsigned pm_vers; - long unsigned pm_prot; - long unsigned pm_port; -}; - -extern bool_t xdr_pmap(); - -struct pmaplist { - struct pmap pml_map; - struct pmaplist *pml_next; -}; - -#ifndef KERNEL -extern bool_t xdr_pmaplist(); -#endif /*!KERNEL*/ - -#endif /*!_rpc_pmap_prot_h*/ diff --git a/usr/src/lib/libbc/inc/include/rpc/pmap_rmt.h b/usr/src/lib/libbc/inc/include/rpc/pmap_rmt.h deleted file mode 100644 index 16a242def6..0000000000 --- a/usr/src/lib/libbc/inc/include/rpc/pmap_rmt.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Structures and XDR routines for parameters to and replies from - * the portmapper remote-call-service. - * - * Copyright (C) 1986, Sun Microsystems, Inc. - */ - -#ifndef _rpc_pmap_rmt_h -#define _rpc_pmap_rmt_h - -struct rmtcallargs { - u_long prog, vers, proc, arglen; - caddr_t args_ptr; - xdrproc_t xdr_args; -}; - -bool_t xdr_rmtcall_args(); - -struct rmtcallres { - u_long *port_ptr; - u_long resultslen; - caddr_t results_ptr; - xdrproc_t xdr_results; -}; - -bool_t xdr_rmtcallres(); - -#endif /*!_rpc_pmap_rmt_h*/ diff --git a/usr/src/lib/libbc/inc/include/rpc/raw.h b/usr/src/lib/libbc/inc/include/rpc/raw.h deleted file mode 100644 index 0314fa4a84..0000000000 --- a/usr/src/lib/libbc/inc/include/rpc/raw.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * raw.h - * - * Raw interface - * The common memory area over which they will communicate - * - * Copyright (C) 1989, Sun Microsystems, Inc. - */ - -#ifndef _RPC_RAW_H -#define _RPC_RAW_H - -char *_rpcrawcombuf; -#endif /* !_RPC_RAW_H */ diff --git a/usr/src/lib/libbc/inc/include/rpc/rpc.h b/usr/src/lib/libbc/inc/include/rpc/rpc.h deleted file mode 100644 index 38f301616f..0000000000 --- a/usr/src/lib/libbc/inc/include/rpc/rpc.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * rpc.h, Just includes the billions of rpc header files necessary to - * do remote procedure calling. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef _rpc_rpc_h -#define _rpc_rpc_h - -#include <rpc/types.h> /* some typedefs */ -#include <netinet/in.h> - -/* external data representation interfaces */ -#include <rpc/xdr.h> /* generic (de)serializer */ - -/* Client side only authentication */ -#include <rpc/auth.h> /* generic authenticator (client side) */ - -/* Client side (mostly) remote procedure call */ -#include <rpc/clnt.h> /* generic rpc stuff */ - -/* semi-private protocol headers */ -#include <rpc/rpc_msg.h> /* protocol for rpc messages */ -#include <rpc/auth_unix.h> /* protocol for unix style cred */ -#include <rpc/auth_des.h> /* protocol for des style cred */ - -/* Server side only remote procedure callee */ -#include <rpc/svc.h> /* service manager and multiplexer */ -#include <rpc/svc_auth.h> /* service side authenticator */ - -#endif /*!_rpc_rpc_h*/ diff --git a/usr/src/lib/libbc/inc/include/rpc/rpc_msg.h b/usr/src/lib/libbc/inc/include/rpc/rpc_msg.h deleted file mode 100644 index 650df38893..0000000000 --- a/usr/src/lib/libbc/inc/include/rpc/rpc_msg.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * rpc message definition - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef _rpc_rpc_msg_h -#define _rpc_rpc_msg_h - -#define RPC_MSG_VERSION ((u_long) 2) -#define RPC_SERVICE_PORT ((u_short) 2048) - -/* - * Bottom up definition of an rpc message. - * NOTE: call and reply use the same overall stuct but - * different parts of unions within it. - */ - -enum msg_type { - CALL=0, - REPLY=1 -}; - -enum reply_stat { - MSG_ACCEPTED=0, - MSG_DENIED=1 -}; - -enum accept_stat { - SUCCESS=0, - PROG_UNAVAIL=1, - PROG_MISMATCH=2, - PROC_UNAVAIL=3, - GARBAGE_ARGS=4, - SYSTEM_ERR=5 -}; - -enum reject_stat { - RPC_MISMATCH=0, - AUTH_ERROR=1 -}; - -/* - * Reply part of an rpc exchange - */ - -/* - * Reply to an rpc request that was accepted by the server. - * Note: there could be an error even though the request was - * accepted. - */ -struct accepted_reply { - struct opaque_auth ar_verf; - enum accept_stat ar_stat; - union { - struct { - u_long low; - u_long high; - } AR_versions; - struct { - caddr_t where; - xdrproc_t proc; - } AR_results; - /* and many other null cases */ - } ru; -#define ar_results ru.AR_results -#define ar_vers ru.AR_versions -}; - -/* - * Reply to an rpc request that was rejected by the server. - */ -struct rejected_reply { - enum reject_stat rj_stat; - union { - struct { - u_long low; - u_long high; - } RJ_versions; - enum auth_stat RJ_why; /* why authentication did not work */ - } ru; -#define rj_vers ru.RJ_versions -#define rj_why ru.RJ_why -}; - -/* - * Body of a reply to an rpc request. - */ -struct reply_body { - enum reply_stat rp_stat; - union { - struct accepted_reply RP_ar; - struct rejected_reply RP_dr; - } ru; -#define rp_acpt ru.RP_ar -#define rp_rjct ru.RP_dr -}; - -/* - * Body of an rpc request call. - */ -struct call_body { - u_long cb_rpcvers; /* must be equal to two */ - u_long cb_prog; - u_long cb_vers; - u_long cb_proc; - struct opaque_auth cb_cred; - struct opaque_auth cb_verf; /* protocol specific - provided by client */ -}; - -/* - * The rpc message - */ -struct rpc_msg { - u_long rm_xid; - enum msg_type rm_direction; - union { - struct call_body RM_cmb; - struct reply_body RM_rmb; - } ru; -#define rm_call ru.RM_cmb -#define rm_reply ru.RM_rmb -}; -#define acpted_rply ru.RM_rmb.ru.RP_ar -#define rjcted_rply ru.RM_rmb.ru.RP_dr - - -/* - * XDR routine to handle a rpc message. - * xdr_callmsg(xdrs, cmsg) - * XDR *xdrs; - * struct rpc_msg *cmsg; - */ -extern bool_t xdr_callmsg(); - -/* - * XDR routine to pre-serialize the static part of a rpc message. - * xdr_callhdr(xdrs, cmsg) - * XDR *xdrs; - * struct rpc_msg *cmsg; - */ -extern bool_t xdr_callhdr(); - -/* - * XDR routine to handle a rpc reply. - * xdr_replymsg(xdrs, rmsg) - * XDR *xdrs; - * struct rpc_msg *rmsg; - */ -extern bool_t xdr_replymsg(); - -/* - * Fills in the error part of a reply message. - * _seterr_reply(msg, error) - * struct rpc_msg *msg; - * struct rpc_err *error; - */ -extern void _seterr_reply(); - -#endif /*!_rpc_rpc_msg_h*/ diff --git a/usr/src/lib/libbc/inc/include/rpc/svc.h b/usr/src/lib/libbc/inc/include/rpc/svc.h deleted file mode 100644 index 757681f388..0000000000 --- a/usr/src/lib/libbc/inc/include/rpc/svc.h +++ /dev/null @@ -1,284 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1984 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _rpc_svc_h -#define _rpc_svc_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * svc.h, Server-side remote procedure call interface. - */ - -/* - * This interface must manage two items concerning remote procedure calling: - * - * 1) An arbitrary number of transport connections upon which rpc requests - * are received. The two most notable transports are TCP and UDP; they are - * created and registered by routines in svc_tcp.c and svc_udp.c, respectively; - * they in turn call xprt_register and xprt_unregister. - * - * 2) An arbitrary number of locally registered services. Services are - * described by the following four data: program number, version number, - * "service dispatch" function, a transport handle, and a boolean that - * indicates whether or not the exported program should be registered with a - * local binder service; if true the program's number and version and the - * port number from the transport handle are registered with the binder. - * These data are registered with the rpc svc system via svc_register. - * - * A service's dispatch function is called whenever an rpc request comes in - * on a transport. The request's program and version numbers must match - * those of the registered service. The dispatch function is passed two - * parameters, struct svc_req * and SVCXPRT *, defined below. - */ - -enum xprt_stat { - XPRT_DIED, - XPRT_MOREREQS, - XPRT_IDLE -}; - -/* - * Server side transport handle - */ -typedef struct { - int xp_sock; - u_short xp_port; /* associated port number */ - struct xp_ops { - bool_t (*xp_recv)(); /* receive incomming requests */ - enum xprt_stat (*xp_stat)(); /* get transport status */ - bool_t (*xp_getargs)(); /* get arguments */ - bool_t (*xp_reply)(); /* send reply */ - bool_t (*xp_freeargs)(); /* free mem allocated for args */ - void (*xp_destroy)(); /* destroy this struct */ - } *xp_ops; - int xp_addrlen; /* length of remote address */ - struct sockaddr_in xp_raddr; /* remote address */ - struct opaque_auth xp_verf; /* raw response verifier */ - caddr_t xp_p1; /* private: for use by svc ops */ - caddr_t xp_p2; /* private: for use by svc ops */ - caddr_t xp_p3; /* private: for use by svc lib */ -} SVCXPRT; - -/* - * Approved way of getting address of caller - */ -#define svc_getcaller(x) (&(x)->xp_raddr) - -/* - * Operations defined on an SVCXPRT handle - * - * SVCXPRT *xprt; - * struct rpc_msg *msg; - * xdrproc_t xargs; - * caddr_t argsp; - */ -#define SVC_RECV(xprt, msg) \ - (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) -#define svc_recv(xprt, msg) \ - (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) - -#define SVC_STAT(xprt) \ - (*(xprt)->xp_ops->xp_stat)(xprt) -#define svc_stat(xprt) \ - (*(xprt)->xp_ops->xp_stat)(xprt) - -#define SVC_GETARGS(xprt, xargs, argsp) \ - (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) -#define svc_getargs(xprt, xargs, argsp) \ - (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) - -#define SVC_REPLY(xprt, msg) \ - (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) -#define svc_reply(xprt, msg) \ - (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) - -#define SVC_FREEARGS(xprt, xargs, argsp) \ - (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) -#define svc_freeargs(xprt, xargs, argsp) \ - (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) - -#define SVC_DESTROY(xprt) \ - (*(xprt)->xp_ops->xp_destroy)(xprt) -#define svc_destroy(xprt) \ - (*(xprt)->xp_ops->xp_destroy)(xprt) - - -/* - * Service request - */ -struct svc_req { - u_long rq_prog; /* service program number */ - u_long rq_vers; /* service protocol version */ - u_long rq_proc; /* the desired procedure */ - struct opaque_auth rq_cred; /* raw creds from the wire */ - caddr_t rq_clntcred; /* read only cooked cred */ - SVCXPRT *rq_xprt; /* associated transport */ -}; - - -/* - * Service registration - * - * svc_register(xprt, prog, vers, dispatch, protocol) - * SVCXPRT *xprt; - * u_long prog; - * u_long vers; - * void (*dispatch)(); - * int protocol; like TCP or UDP, zero means do not register - */ -extern bool_t svc_register(); - -/* - * Service un-registration - * - * svc_unregister(prog, vers) - * u_long prog; - * u_long vers; - */ -extern void svc_unregister(); - -/* - * Transport registration. - * - * xprt_register(xprt) - * SVCXPRT *xprt; - */ -extern void xprt_register(); - -/* - * Transport un-register - * - * xprt_unregister(xprt) - * SVCXPRT *xprt; - */ -extern void xprt_unregister(); - - - - -/* - * When the service routine is called, it must first check to see if it - * knows about the procedure; if not, it should call svcerr_noproc - * and return. If so, it should deserialize its arguments via - * SVC_GETARGS (defined above). If the deserialization does not work, - * svcerr_decode should be called followed by a return. Successful - * decoding of the arguments should be followed the execution of the - * procedure's code and a call to svc_sendreply. - * - * Also, if the service refuses to execute the procedure due to too- - * weak authentication parameters, svcerr_weakauth should be called. - * Note: do not confuse access-control failure with weak authentication! - * - * NB: In pure implementations of rpc, the caller always waits for a reply - * msg. This message is sent when svc_sendreply is called. - * Therefore pure service implementations should always call - * svc_sendreply even if the function logically returns void; use - * xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows - * for the abuse of pure rpc via batched calling or pipelining. In the - * case of a batched call, svc_sendreply should NOT be called since - * this would send a return message, which is what batching tries to avoid. - * It is the service/protocol writer's responsibility to know which calls are - * batched and which are not. Warning: responding to batch calls may - * deadlock the caller and server processes! - */ - -extern bool_t svc_sendreply(); -extern void svcerr_decode(); -extern void svcerr_weakauth(); -extern void svcerr_noproc(); -extern void svcerr_progvers(); -extern void svcerr_auth(); -extern void svcerr_noprog(); -extern void svcerr_systemerr(); - -/* - * Lowest level dispatching -OR- who owns this process anyway. - * Somebody has to wait for incoming requests and then call the correct - * service routine. The routine svc_run does infinite waiting; i.e., - * svc_run never returns. - * Since another (co-existant) package may wish to selectively wait for - * incoming calls or other events outside of the rpc architecture, the - * routine svc_getreq is provided. It must be passed readfds, the - * "in-place" results of a select system call (see select, section 2). - */ - -/* - * Global keeper of rpc service descriptors in use - * dynamic; must be inspected before each call to select - */ -extern fd_set svc_fdset; -#define svc_fds svc_fdset.fds_bits[0] /* compatibility */ - -/* - * a small program implemented by the svc_rpc implementation itself; - * also see clnt.h for protocol numbers. - */ -extern void rpctest_service(); - -extern void svc_getreq(); -extern void svc_getreqset(); /* takes fdset instead of int */ -extern void svc_run(); /* never returns */ - -/* - * Socket to use on svcxxx_create call to get default socket - */ -#define RPC_ANYSOCK -1 - -/* - * These are the existing service side transport implementations - */ - -/* - * Memory based rpc for testing and timing. - */ -extern SVCXPRT *svcraw_create(); - -/* - * Udp based rpc. - */ -extern SVCXPRT *svcudp_create(); -extern SVCXPRT *svcudp_bufcreate(); - -/* - * Tcp based rpc. - */ -extern SVCXPRT *svctcp_create(); - -/* - * Like svtcp_create(), except the routine takes any *open* UNIX file - * descriptor as its first input. - */ -SVCXPRT *svcfd_create(); -#else - -/* - * Kernel udp based rpc. - */ -extern SVCXPRT *svckudp_create(); - - -#endif /* !_rpc_svc_h */ diff --git a/usr/src/lib/libbc/inc/include/rpc/svc_auth.h b/usr/src/lib/libbc/inc/include/rpc/svc_auth.h deleted file mode 100644 index af1d99cd33..0000000000 --- a/usr/src/lib/libbc/inc/include/rpc/svc_auth.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -/* - * Service side of rpc authentication. - */ - -#ifndef _rpc_svc_auth_h -#define _rpc_svc_auth_h - -extern enum auth_stat _authenticate(); - -#endif /*!_rpc_svc_auth_h*/ diff --git a/usr/src/lib/libbc/inc/include/rpc/types.h b/usr/src/lib/libbc/inc/include/rpc/types.h deleted file mode 100644 index 2eb5fc2e00..0000000000 --- a/usr/src/lib/libbc/inc/include/rpc/types.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Rpc additions to <sys/types.h> - */ - -#ifndef __rpc_types_h -#define __rpc_types_h - -#define bool_t int -#define enum_t int -#define __dontcare__ -1 - -#ifndef FALSE -# define FALSE (0) -#endif - -#ifndef TRUE -# define TRUE (1) -#endif - -#ifndef NULL -# define NULL 0 -#endif - -#ifndef KERNEL -#include <malloc.h> -#define mem_alloc(bsize) malloc(bsize) -#define mem_free(ptr, bsize) free(ptr) -#else -extern char *kmem_alloc(); -#define mem_alloc(bsize) kmem_alloc((u_int)bsize) -#define mem_free(ptr, bsize) kmem_free((caddr_t)(ptr), (u_int)(bsize)) -#endif - -#include <sys/types.h> -#include <sys/time.h> - -#endif /* !__rpc_types_h */ diff --git a/usr/src/lib/libbc/inc/include/rpc/xdr.h b/usr/src/lib/libbc/inc/include/rpc/xdr.h deleted file mode 100644 index b64bcb2c59..0000000000 --- a/usr/src/lib/libbc/inc/include/rpc/xdr.h +++ /dev/null @@ -1,265 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1984 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _rpc_xdr_h -#define _rpc_xdr_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * xdr.h, External Data Representation Serialization Routines. - */ - -#include <rpc/types.h> -/* - * XDR provides a conventional way for converting between C data - * types and an external bit-string representation. Library supplied - * routines provide for the conversion on built-in C data types. These - * routines and utility routines defined here are used to help implement - * a type encode/decode routine for each user-defined type. - * - * Each data type provides a single procedure which takes two arguments: - * - * bool_t - * xdrproc(xdrs, argresp) - * XDR *xdrs; - * <type> *argresp; - * - * xdrs is an instance of a XDR handle, to which or from which the data - * type is to be converted. argresp is a pointer to the structure to be - * converted. The XDR handle contains an operation field which indicates - * which of the operations (ENCODE, DECODE * or FREE) is to be performed. - * - * XDR_DECODE may allocate space if the pointer argresp is null. This - * data can be freed with the XDR_FREE operation. - * - * We write only one procedure per data type to make it easy - * to keep the encode and decode procedures for a data type consistent. - * In many cases the same code performs all operations on a user defined type, - * because all the hard work is done in the component type routines. - * decode as a series of calls on the nested data types. - */ - -/* - * Xdr operations. XDR_ENCODE causes the type to be encoded into the - * stream. XDR_DECODE causes the type to be extracted from the stream. - * XDR_FREE can be used to release the space allocated by an XDR_DECODE - * request. - */ -enum xdr_op { - XDR_ENCODE=0, - XDR_DECODE=1, - XDR_FREE=2 -}; - -/* - * This is the number of bytes per unit of external data. - */ -#define BYTES_PER_XDR_UNIT (4) -#define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \ - * BYTES_PER_XDR_UNIT) - -/* - * A xdrproc_t exists for each data type which is to be encoded or decoded. - * - * The second argument to the xdrproc_t is a pointer to an opaque pointer. - * The opaque pointer generally points to a structure of the data type - * to be decoded. If this pointer is 0, then the type routines should - * allocate dynamic storage of the appropriate size and return it. - * bool_t (*xdrproc_t)(XDR *, caddr_t *); - */ -typedef bool_t (*xdrproc_t)(); - -/* - * The XDR handle. - * Contains operation which is being applied to the stream, - * an operations vector for the paticular implementation (e.g. see xdr_mem.c), - * and two private fields for the use of the particular impelementation. - */ -typedef struct { - enum xdr_op x_op; /* operation; fast additional param */ - struct xdr_ops { - bool_t (*x_getlong)(); /* get a long from underlying stream */ - bool_t (*x_putlong)(); /* put a long to " */ - bool_t (*x_getbytes)(); /* get some bytes from " */ - bool_t (*x_putbytes)(); /* put some bytes to " */ - u_int (*x_getpostn)(); /* returns bytes off from beginning */ - bool_t (*x_setpostn)(); /* lets you reposition the stream */ - long * (*x_inline)(); /* buf quick ptr to buffered data */ - void (*x_destroy)(); /* free privates of this xdr_stream */ - } *x_ops; - caddr_t x_public; /* users' data */ - caddr_t x_private; /* pointer to private data */ - caddr_t x_base; /* private used for position info */ - int x_handy; /* extra private word */ -} XDR; - -/* - * Operations defined on a XDR handle - * - * XDR *xdrs; - * long *longp; - * caddr_t addr; - * u_int len; - * u_int pos; - */ -#define XDR_GETLONG(xdrs, longp) \ - (*(xdrs)->x_ops->x_getlong)(xdrs, longp) -#define xdr_getlong(xdrs, longp) \ - (*(xdrs)->x_ops->x_getlong)(xdrs, longp) - -#define XDR_PUTLONG(xdrs, longp) \ - (*(xdrs)->x_ops->x_putlong)(xdrs, longp) -#define xdr_putlong(xdrs, longp) \ - (*(xdrs)->x_ops->x_putlong)(xdrs, longp) - -#define XDR_GETBYTES(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) -#define xdr_getbytes(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) - -#define XDR_PUTBYTES(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) -#define xdr_putbytes(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) - -#define XDR_GETPOS(xdrs) \ - (*(xdrs)->x_ops->x_getpostn)(xdrs) -#define xdr_getpos(xdrs) \ - (*(xdrs)->x_ops->x_getpostn)(xdrs) - -#define XDR_SETPOS(xdrs, pos) \ - (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) -#define xdr_setpos(xdrs, pos) \ - (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) - -#define XDR_INLINE(xdrs, len) \ - (*(xdrs)->x_ops->x_inline)(xdrs, len) -#define xdr_inline(xdrs, len) \ - (*(xdrs)->x_ops->x_inline)(xdrs, len) - -#define XDR_DESTROY(xdrs) \ - (*(xdrs)->x_ops->x_destroy)(xdrs) -#define xdr_destroy(xdrs) XDR_DESTROY(xdrs) - -/* - * Support struct for discriminated unions. - * You create an array of xdrdiscrim structures, terminated with - * a entry with a null procedure pointer. The xdr_union routine gets - * the discriminant value and then searches the array of structures - * for a matching value. If a match is found the associated xdr routine - * is called to handle that part of the union. If there is - * no match, then a default routine may be called. - * If there is no match and no default routine it is an error. - */ -#define NULL_xdrproc_t ((xdrproc_t)0) -struct xdr_discrim { - int value; - xdrproc_t proc; -}; - -/* - * In-line routines for fast encode/decode of primitve data types. - * Caveat emptor: these use single memory cycles to get the - * data from the underlying buffer, and will fail to operate - * properly if the data is not aligned. The standard way to use these - * is to say: - * if ((buf = XDR_INLINE(xdrs, count)) == NULL) - * return (FALSE); - * <<< macro calls >>> - * where ``count'' is the number of bytes of data occupied - * by the primitive data types. - * - * N.B. and frozen for all time: each data type here uses 4 bytes - * of external representation. - */ -#define IXDR_GET_LONG(buf) ((long)ntohl((u_long)*(buf)++)) -#define IXDR_PUT_LONG(buf, v) (*(buf)++ = (long)htonl((u_long)v)) - -#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf)) -#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf)) -#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf)) -#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf)) -#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf)) - -#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) -#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) -#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) -#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) -#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) - -/* - * These are the "generic" xdr routines. - */ -extern bool_t xdr_void(); -extern bool_t xdr_int(); -extern bool_t xdr_u_int(); -extern bool_t xdr_long(); -extern bool_t xdr_u_long(); -extern bool_t xdr_short(); -extern bool_t xdr_u_short(); -extern bool_t xdr_bool(); -extern bool_t xdr_enum(); -extern bool_t xdr_array(); -extern bool_t xdr_bytes(); -extern bool_t xdr_opaque(); -extern bool_t xdr_string(); -extern bool_t xdr_union(); -extern void xdr_free(); -extern bool_t xdr_char(); -extern bool_t xdr_u_char(); -extern bool_t xdr_vector(); -extern bool_t xdr_float(); -extern bool_t xdr_double(); -extern bool_t xdr_reference(); -extern bool_t xdr_pointer(); -extern bool_t xdr_wrapstring(); - -/* - * Common opaque bytes objects used by many rpc protocols; - * declared here due to commonality. - */ -#define MAX_NETOBJ_SZ 1024 -struct netobj { - u_int n_len; - char *n_bytes; -}; -typedef struct netobj netobj; -extern bool_t xdr_netobj(); - -/* - * These are the public routines for the various implementations of - * xdr streams. - */ -extern void xdrmem_create(); /* XDR using memory buffers */ -extern void xdrstdio_create(); /* XDR using stdio library */ -extern void xdrrec_create(); /* XDR pseudo records for tcp */ -extern bool_t xdrrec_endofrecord(); /* make end of xdr record */ -extern int xdrrec_readbytes(); /* like a read on a pipe */ -extern bool_t xdrrec_skiprecord(); /* move to beginning of next record */ -extern bool_t xdrrec_eof(); /* true if no more input */ - -#endif /* !_rpc_xdr_h */ diff --git a/usr/src/lib/libbc/inc/include/rpcsvc/pwdnm.h b/usr/src/lib/libbc/inc/include/rpcsvc/pwdnm.h deleted file mode 100644 index 69b38ede81..0000000000 --- a/usr/src/lib/libbc/inc/include/rpcsvc/pwdnm.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef _rpcsvc_pwdnm_h -#define _rpcsvc_pwdnm_h - -struct pwdnm { - char *name; - char *password; -}; -typedef struct pwdnm pwdnm; - - -#define PWDAUTH_PROG 100036 -#define PWDAUTH_VERS 1 -#define PWDAUTHSRV 1 -#define GRPAUTHSRV 2 - -bool_t xdr_pwdnm(); - -#endif /*!_rpcsvc_pwdnm_h*/ diff --git a/usr/src/lib/libbc/inc/include/rpcsvc/ypclnt.h b/usr/src/lib/libbc/inc/include/rpcsvc/ypclnt.h deleted file mode 100644 index c4970194fa..0000000000 --- a/usr/src/lib/libbc/inc/include/rpcsvc/ypclnt.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * ypclnt.h - * This defines the symbols used in the c language - * interface to the NIS client functions. A description of this interface - * can be read in ypclnt(3N). - */ - -/* - * Failure reason codes. The success condition is indicated by a functional - * value of "0". - */ -#define YPERR_BADARGS 1 /* Args to function are bad */ -#define YPERR_RPC 2 /* RPC failure */ -#define YPERR_DOMAIN 3 /* Can't bind to a server which serves - * this domain. */ -#define YPERR_MAP 4 /* No such map in server's domain */ -#define YPERR_KEY 5 /* No such key in map */ -#define YPERR_YPERR 6 /* Internal NIS server or client - * interface error */ -#define YPERR_RESRC 7 /* Local resource allocation failure */ -#define YPERR_NOMORE 8 /* No more records in map database */ -#define YPERR_PMAP 9 /* Can't communicate with portmapper */ -#define YPERR_YPBIND 10 /* Can't communicate with ypbind */ -#define YPERR_YPSERV 11 /* Can't communicate with ypserv */ -#define YPERR_NODOM 12 /* Local domain name not set */ -#define YPERR_BADDB 13 /* NIS data base is bad */ -#define YPERR_VERS 14 /* NIS version mismatch */ -#define YPERR_ACCESS 15 /* Access violation */ -#define YPERR_BUSY 16 /* Database is busy */ - -/* - * Types of update operations - */ -#define YPOP_CHANGE 1 /* change, do not add */ -#define YPOP_INSERT 2 /* add, do not change */ -#define YPOP_DELETE 3 /* delete this entry */ -#define YPOP_STORE 4 /* add, or change */ - - - -/* - * Data definitions - */ - -/* - * struct ypall_callback * is the arg which must be passed to yp_all - */ - -struct ypall_callback { - int (*foreach)(); /* Return non-0 to stop getting - * called */ - char *data; /* Opaque pointer for use of callback - * function */ -}; - -/* - * External NIS client function references. - */ -extern int yp_bind(); -extern int _yp_dobind(); -extern void yp_unbind(); -extern int yp_get_default_domain (); -extern int yp_match (); -extern int yp_first (); -extern int yp_next(); -extern int yp_master(); -extern int yp_order(); -extern int yp_all(); -extern int yp_match(); -extern char *yperr_string(); -extern int ypprot_err(); - -/* - * Global NIS data structures - */ diff --git a/usr/src/lib/libbc/inc/include/scsi/impl/uscsi.h b/usr/src/lib/libbc/inc/include/scsi/impl/uscsi.h deleted file mode 100644 index 17e0af91ae..0000000000 --- a/usr/src/lib/libbc/inc/include/scsi/impl/uscsi.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SCSI_IMPL_USCSI_H -#define _SCSI_IMPL_USCSI_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Defines for user SCSI commands - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * definition for user-scsi command structure - */ -struct uscsi_cmd { - caddr_t uscsi_cdb; - int uscsi_cdblen; - caddr_t uscsi_bufaddr; - int uscsi_buflen; - unsigned char uscsi_status; - int uscsi_flags; -}; - -/* - * flags for uscsi_flags field - */ -#define USCSI_SILENT 0x01 /* no error messages */ -#define USCSI_DIAGNOSE 0x02 /* fail if any error occurs */ -#define USCSI_ISOLATE 0x04 /* isolate from normal commands */ -#define USCSI_READ 0x08 /* get data from device */ -#define USCSI_WRITE 0xFFF7 /* use to zero the READ bit in uscsi_flags */ - -/* - * User SCSI io control command - */ -#define USCSICMD _IOWR('u', 1, struct uscsi_cmd) /* user scsi command */ - -/* - * user scsi status bit masks - */ - -#define USCSI_STATUS_GOOD 0x00 -#define USCSI_STATUS_CHECK 0x02 -#define USCSI_STATUS_MET 0x04 -#define USCSI_STATUS_BUSY 0x08 -#define USCSI_STATUS_INTERMEDIATE 0x10 -#define USCSI_STATUS_RESERVATION_CONFLICT \ - (USCSI_STATUS_INTERMEDIATE | USCSI_STATUS_BUSY) - -#ifdef __cplusplus -} -#endif - -#endif /* _SCSI_IMPL_USCSI_H */ diff --git a/usr/src/lib/libbc/inc/include/search.h b/usr/src/lib/libbc/inc/include/search.h deleted file mode 100644 index bd06d6df00..0000000000 --- a/usr/src/lib/libbc/inc/include/search.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef _search_h -#define _search_h - -/* HSEARCH(3C) */ -typedef struct entry { char *key, *data; } ENTRY; -typedef enum { FIND, ENTER } ACTION; - -/* TSEARCH(3C) */ -typedef enum { preorder, postorder, endorder, leaf } VISIT; - -#endif /*!_search_h*/ diff --git a/usr/src/lib/libbc/inc/include/sgtty.h b/usr/src/lib/libbc/inc/include/sgtty.h deleted file mode 100644 index a753fb7c23..0000000000 --- a/usr/src/lib/libbc/inc/include/sgtty.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef _sgtty_h -#define _sgtty_h - -#include <sys/ioctl.h> - -#endif /*!_sgtty_h*/ diff --git a/usr/src/lib/libbc/inc/include/signal.h b/usr/src/lib/libbc/inc/include/signal.h deleted file mode 100644 index c2bf4cc78f..0000000000 --- a/usr/src/lib/libbc/inc/include/signal.h +++ /dev/null @@ -1,91 +0,0 @@ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1982 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - * - * Copyright (c) 1987 by Sun Microsystems, Inc. - */ - -#ifndef __signal_h -#define __signal_h - -#ifndef _POSIX_SOURCE -#include <sys/signal.h> -#else -/* - * All of the below is drawn from sys/signal.h. Adding anything here means you - * add it in sys/signal.h as well. - */ -#define SIGHUP 1 /* hangup */ -#define SIGINT 2 /* interrupt */ -#define SIGQUIT 3 /* quit */ -#define SIGILL 4 /* illegal instruction (not reset when caught) */ -#define SIGTRAP 5 /* trace trap (not reset when caught) */ -#define SIGIOT 6 /* IOT instruction */ -#define SIGABRT 6 /* used by abort, replace SIGIOT in the future */ -#define SIGEMT 7 /* EMT instruction */ -#define SIGFPE 8 /* floating point exception */ -#define SIGKILL 9 /* kill (cannot be caught or ignored) */ -#define SIGBUS 10 /* bus error */ -#define SIGSEGV 11 /* segmentation violation */ -#define SIGSYS 12 /* bad argument to system call */ -#define SIGPIPE 13 /* write on a pipe with no one to read it */ -#define SIGALRM 14 /* alarm clock */ -#define SIGTERM 15 /* software termination signal from kill */ -#define SIGURG 16 /* urgent condition on IO channel */ -#define SIGSTOP 17 /* sendable stop signal not from tty */ -#define SIGTSTP 18 /* stop signal from tty */ -#define SIGCONT 19 /* continue a stopped process */ -#define SIGCHLD 20 /* to parent on child stop or exit */ -#define SIGCLD 20 /* System V name for SIGCHLD */ -#define SIGTTIN 21 /* to readers pgrp upon background tty read */ -#define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ -#define SIGIO 23 /* input/output possible signal */ -#define SIGPOLL SIGIO /* System V name for SIGIO */ -#define SIGXCPU 24 /* exceeded CPU time limit */ -#define SIGXFSZ 25 /* exceeded file size limit */ -#define SIGVTALRM 26 /* virtual time alarm */ -#define SIGPROF 27 /* profiling time alarm */ -#define SIGWINCH 28 /* window changed */ -#define SIGLOST 29 /* resource lost (eg, record-lock lost) */ -#define SIGUSR1 30 /* user defined signal 1 */ -#define SIGUSR2 31 /* user defined signal 2 */ - -/* signal() args & returns */ -#define SIG_ERR (void (*)())-1 -#define SIG_DFL (void (*)())0 -#define SIG_IGN (void (*)())1 -#define SIG_HOLD (void (*)())3 - -/* sigprocmask flags */ -#define SIG_BLOCK 0x0001 -#define SIG_UNBLOCK 0x0002 -#define SIG_SETMASK 0x0004 - -/* sa_flags flag; also supports all the sigvec flags in sys/signal.h */ -#define SA_NOCLDSTOP 0x0008 /* don't send a SIGCHLD on child stop */ - -#include <sys/stdtypes.h> /* for sigset_t */ - -struct sigaction { - void (*sa_handler)(); - sigset_t sa_mask; - int sa_flags; -}; -void (*signal())(); -int kill(/* pid_t p, int sig */); -int sigaction(/* int signo, - struct sigaction *act, struct sigaction *oldact */); -int sigaddset(/* sigset_t *mask, int signo */); -int sigdelset(/* sigset_t *mask, int signo */); -int sigemptyset(/* sigset_t *mask */); -int sigfillset(/* sigset_t *mask */); -int sigismember(/* sigset_t *mask, int signo */); -int sigpending(/* sigset_t *set */); -int sigprocmask(/* int how, sigset_t *set, *oldset */); -int sigsuspend(/* sigset_t *mask */); - -#endif /* _POSIX_SOURCE */ -#endif /* !__signal_h */ diff --git a/usr/src/lib/libbc/inc/include/stdio.h b/usr/src/lib/libbc/inc/include/stdio.h deleted file mode 100644 index f334762635..0000000000 --- a/usr/src/lib/libbc/inc/include/stdio.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1998 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef __include_stdio_h -#define __include_stdio_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -#define BUFSIZ 1024 -#define _SBFSIZ 8 -extern struct _iobuf { - int _cnt; - unsigned char *_ptr; - unsigned char *_base; - int _bufsiz; - short _flag; - char _file; /* should be short */ -} _iob[]; - -#define _IOFBF 0 -#define _IOREAD 01 -#define _IOWRT 02 -#define _IONBF 04 -#define _IOMYBUF 010 -#define _IOEOF 020 -#define _IOERR 040 -#define _IOSTRG 0100 -#define _IOLBF 0200 -#define _IORW 0400 -#define NULL 0 -#define FILE struct _iobuf -#define EOF (-1) - -#define stdin (&_iob[0]) -#define stdout (&_iob[1]) -#define stderr (&_iob[2]) - -#if defined(__lint) /* so that lint likes (void)putc(a,b) */ -extern int putc(int, FILE *); -extern int getc(FILE *); -#else -#define getc(p) (--(p)->_cnt>=0? ((int)*(p)->_ptr++):_filbuf(p)) -#define putc(x, p) (--(p)->_cnt >= 0 ?\ - (int)(*(p)->_ptr++ = (unsigned char)(x)) :\ - (((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\ - ((*(p)->_ptr = (unsigned char)(x)) != '\n' ?\ - (int)(*(p)->_ptr++) :\ - _flsbuf(*(unsigned char *)(p)->_ptr, p)) :\ - _flsbuf((unsigned char)(x), p))) -#endif - -#define getchar() getc(stdin) -#define putchar(x) putc((x),stdout) -#define feof(p) (((p)->_flag&_IOEOF)!=0) -#define ferror(p) (((p)->_flag&_IOERR)!=0) -#define clearerr(p) (void) ((p)->_flag &= ~(_IOERR|_IOEOF)) - -extern FILE *fopen(char *, char *); -extern FILE *fdopen(int, char *); -extern FILE *freopen(char *, char *, FILE *); -extern FILE *popen(char *, char *); -extern FILE *tmpfile(void); -extern long ftell(FILE *); -extern char *fgets(char *, int, FILE *); -extern char *gets(char *); -extern char *sprintf(char *, char *, ...); -extern char *ctermid(char *); -extern char *cuserid(char *); -extern char *tempnam(char *, char *); -extern char *tmpnam(char *); -extern int fileno(FILE *); - -#define L_ctermid 9 -#define L_cuserid 9 -#define P_tmpdir "/usr/tmp/" -#define L_tmpnam 25 /* (sizeof(P_tmpdir) + 15) */ - -#endif /* !__include_stdio_h */ diff --git a/usr/src/lib/libbc/inc/include/stdlib.h b/usr/src/lib/libbc/inc/include/stdlib.h deleted file mode 100644 index c97f9981a0..0000000000 --- a/usr/src/lib/libbc/inc/include/stdlib.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * stdlib.h - */ - -#ifndef __stdlib_h -#define __stdlib_h - -#include <sys/stdtypes.h> /* to get size_t */ - -extern unsigned int _mb_cur_max; -#define MB_CUR_MAX _mb_cur_max - -#define mblen(s, n) mbtowc((wchar_t *)0, s, n) - -/* declaration of various libc functions */ -extern int abort(/* void */); -extern int abs(/* int j */); -extern double atof(/* const char *nptr */); -extern int atoi(/* const char *nptr */); -extern long int atol(/* const char *nptr */); -extern char * bsearch(/* const void *key, const void *base, size_t nmemb, - size_t size, int (*compar)(const void *, const void *) */); -extern char * calloc(/* size_t nmemb, size_t size */); -extern int exit(/* int status */); -extern int free(/* void *ptr */); -extern char * getenv(/* const char *name */); -extern char * malloc(/* size_t size */); -extern int qsort(/* void *base, size_t nmemb, size_t size, - int (*compar)(const void *, const void *) */); -extern int rand(/* void */); -extern char * realloc(/* void *ptr, size_t size */); -extern int srand(/* unsigned int seed */); - -extern int mbtowc(/* wchar_t *pwc, const char *s, size_t n */); -extern int wctomb(/* char *s, wchar_t wchar */); -extern size_t mbstowcs(/* wchar_t *pwcs, const char *s, size_t n */); -extern size_t wcstombs(/* char *s, const wchar_t *pwcs, size_t n */); - -#endif diff --git a/usr/src/lib/libbc/inc/include/string.h b/usr/src/lib/libbc/inc/include/string.h deleted file mode 100644 index dd064fec74..0000000000 --- a/usr/src/lib/libbc/inc/include/string.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef __string_h -#define __string_h - -#include <sys/stdtypes.h> /* for size_t */ - -#ifndef NULL -#define NULL 0 -#endif - -extern char * strcat(/* char *s1, const char *s2 */); -extern char * strchr(/* const char *s, int c */); -extern int strcmp(/* const char *s1, const char *s2 */); -extern char * strcpy(/* char *s1, const char *s2 */); -extern size_t strcspn(/* const char *s1, const char *s2 */); -#ifndef _POSIX_SOURCE -extern char * strdup(/* char *s1 */); -#endif -extern size_t strlen(/* const char *s */); -extern char * strncat(/* char *s1, const char *s2, size_t n */); -extern int strncmp(/* const char *s1, const char *s2, size_t n */); -extern char * strncpy(/* char *s1, const char *s2, size_t n */); -extern char * strpbrk(/* const char *s1, const char *s2 */); -extern char * strrchr(/* const char *s, int c */); -extern size_t strspn(/* const char *s1, const char *s2 */); -extern char * strstr(/* const char *s1, const char *s2 */); -extern char * strtok(/* char *s1, const char *s2 */); - -#endif /* !__string_h */ diff --git a/usr/src/lib/libbc/inc/include/strings.h b/usr/src/lib/libbc/inc/include/strings.h deleted file mode 100644 index 665c2b534a..0000000000 --- a/usr/src/lib/libbc/inc/include/strings.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * External function definitions - * for routines described in string(3). - */ - -#ifndef _strings_h -#define _strings_h - -char *strcat(); -char *strncat(); -int strcmp(); -int strncmp(); -int strcasecmp(); -char *strcpy(); -char *strncpy(); -int strlen(); -char *index(); -char *rindex(); - -#endif /*!_strings_h*/ diff --git a/usr/src/lib/libbc/inc/include/sun/dkio.h b/usr/src/lib/libbc/inc/include/sun/dkio.h deleted file mode 100644 index 3fe34e0f74..0000000000 --- a/usr/src/lib/libbc/inc/include/sun/dkio.h +++ /dev/null @@ -1,361 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _sun_dkio_h -#define _sun_dkio_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* #include <sys/ioctl.h> not needed? */ -#include <sun/dklabel.h> - -/* - * Structures and definitions for disk io control commands - */ - -/* - * Structures used as data by ioctl calls. - */ - -/* - * Used for controller info - */ -struct dk_info { - int dki_ctlr; /* controller address */ - short dki_unit; /* unit (slave) address */ - short dki_ctype; /* controller type */ - short dki_flags; /* flags */ -}; - -#define DK_DEVLEN 16 /* device name max length, including */ - /* unit # & NULL (ie - "xyc1") */ -/* - * Used for configuration info - */ -struct dk_conf { - char dkc_cname[DK_DEVLEN]; /* controller name (no unit #) */ - u_short dkc_ctype; /* controller type */ - u_short dkc_flags; /* flags */ - short dkc_cnum; /* controller number */ - int dkc_addr; /* controller address */ - u_int dkc_space; /* controller bus type */ - int dkc_prio; /* interrupt priority */ - int dkc_vec; /* interrupt vector */ - char dkc_dname[DK_DEVLEN]; /* drive name (no unit #) */ - short dkc_unit; /* unit number */ - short dkc_slave; /* slave number */ -}; - -/* - * Controller types - */ -#define DKC_UNKNOWN 0 -/* 1 used to be Interphase 2180 */ -#define DKC_WDC2880 2 -/* 3 used to be Interphase 2181 */ -/* 4 used to be Xylogics 440 */ -#define DKC_DSD5215 5 -#define DKC_XY450 6 -#define DKC_ACB4000 7 -#define DKC_MD21 8 -/* 9 used to be Xylogics 751 */ -#define DKC_NCRFLOPPY 10 -/* #define DKC_XB1401 10 does not match dkinfo.c*/ -#define DKC_XD7053 11 -#define DKC_SMSFLOPPY 12 -#define DKC_SCSI_CCS 13 -#define DKC_INTEL82072 14 /* floppy ctlr on campus and hydra */ -#define DKC_PANTHER 15 -#define DKC_SUN_IPI1 DKC_PANTHER /* Sun Panther VME/IPI controller */ -#define DKC_MD 16 /* meta-disk (virtual-disk) driver */ -#define DKC_CDC_9057 17 /* CDC 9057-321 (CM-3) IPI String Controller */ -#define DKC_FJ_M1060 18 /* Fujitsu/Intellistor M1060 IPI-3 SC */ - -/* - * Flags - */ -#define DKI_BAD144 0x01 /* use DEC std 144 bad sector fwding */ -#define DKI_MAPTRK 0x02 /* controller does track mapping */ -#define DKI_FMTTRK 0x04 /* formats only full track at a time */ -#define DKI_FMTVOL 0x08 /* formats only full volume at a time */ -#define DKI_FMTCYL 0x10 /* formats only full cylinders at a time */ -#define DKI_HEXUNIT 0x20 /* unit number is printed as 3 hex digits */ - -/* - * Used for drive info - */ -struct dk_type { - u_short dkt_hsect; /* hard sector count (read only) */ - u_short dkt_promrev; /* prom revision (read only) */ - u_char dkt_drtype; /* drive type (ctlr specific) */ - u_char dkt_drstat; /* drive status (ctlr specific, ro) */ -}; - -/* - * Used for all partitions - */ -struct dk_allmap { - struct dk_map dka_map[NDKMAP]; -}; - -/* - * Used for bad sector map - */ -struct dk_badmap { - caddr_t dkb_bufaddr; /* address of user's map buffer */ -}; - -/* - * Definition of a disk's geometry - */ -struct dk_geom { - unsigned short dkg_ncyl; /* # of data cylinders */ - unsigned short dkg_acyl; /* # of alternate cylinders */ - unsigned short dkg_bcyl; /* cyl offset (for fixed head area) */ - unsigned short dkg_nhead; /* # of heads */ - unsigned short dkg_obs1; /* obsolete */ - unsigned short dkg_nsect; /* # of data sectors per track */ - unsigned short dkg_intrlv; /* interleave factor */ - unsigned short dkg_obs2; /* obsolete */ - unsigned short dkg_obs3; /* obsolete */ - unsigned short dkg_apc; /* alternates per cyl (SCSI only) */ - unsigned short dkg_rpm; /* revolutions per minute */ - unsigned short dkg_pcyl; /* # of physical cylinders */ - unsigned short dkg_extra[7]; /* for compatible expansion */ -}; -/* - * These defines are for historic compatibility with old drivers. - */ -#define dkg_bhead dkg_obs1 /* used to be head offset */ -#define dkg_gap1 dkg_obs2 /* used to be gap1 */ -#define dkg_gap2 dkg_obs3 /* used to be gap2 */ - -/* - * Used for generic commands - */ -struct dk_cmd { - u_short dkc_cmd; /* command to be executed */ - int dkc_flags; /* execution flags */ - daddr_t dkc_blkno; /* disk address for command */ - int dkc_secnt; /* sector count for command */ - caddr_t dkc_bufaddr; /* user's buffer address */ - u_int dkc_buflen; /* size of user's buffer */ -}; - -/* - * Execution flags. - */ -#define DK_SILENT 0x01 /* no error messages */ -#define DK_DIAGNOSE 0x02 /* fail if any error occurs */ -#define DK_ISOLATE 0x04 /* isolate from normal commands */ -#define DK_READ 0x08 /* read from device */ -#define DK_WRITE 0x10 /* write to device */ - -/* - * Used for disk diagnostics - */ -struct dk_diag { - u_short dkd_errcmd; /* most recent command in error */ - daddr_t dkd_errsect; /* most recent sector in error */ - u_char dkd_errno; /* most recent error number */ - u_char dkd_severe; /* severity of most recent error */ -}; - -/* - * Used for getting disk error log. - */ -struct dk_loghdr { - long dkl_entries; /* number of dk_log entries */ - long dkl_max_size; /* max. size of dk_log table */ - caddr_t dkl_logbfr; /* pointer to dk_log table */ -}; - -/* - * Disk error log table entry. - */ -struct dk_log { - daddr_t block; /* location of block in error */ - u_long count; /* number of failures */ - short type; /* type of error (e.g. soft error) */ - short err1; /* primary error code (e.g sense key) */ - short err2; /* secondary error code */ -}; - -/* - * Dk_log type flags. - * - * FIXME: Really should specify dkd_errno error codes. - * For some reason they're specified in the drivers - * instead of here?? Should also use those here for - * dk_log.type too. - */ -#define DKL_SOFT 0x01 /* recoverable erro */ -#define DKL_HARD 0x02 /* unrecoverable error */ - -/* - * Used for floppies - */ -struct fdk_char{ - u_char medium; /* medium type. Unused, why have it? history! */ - int transfer_rate; /* transfer rate */ - int ncyl; /* number of cylinders */ - int nhead; /* number of heads */ - int sec_size; /* sector size */ - int secptrack; /* sectors per track */ - int steps; /* number of steps per */ -}; - -struct fdk_state { - int fkc_bsec; /* bytes per sector */ - int fkc_strack; /* sectors per track */ - int fkc_step; /* step rate */ - int fkc_rate; /* data rate */ - int fkc_error; /* error returned by controller */ -}; - -struct fdk_cmd { /* used by generic command */ - struct dk_cmd dcmd; /* disk command info */ - struct fdk_state fstate; /* floppy state info */ -}; - -/* - * Floppy commands - */ -#define FKWRITE 1 -#define FKREAD 2 -#define FKSEEK 3 -#define FKREZERO 4 -#define FKFORMAT_UNIT 5 -#define FKFORMAT_TRACK 6 - -/* - * Used by FDKGETCHANGE, return state of the sense disk change bit. - */ -#define FDKGC_HISTORY 0x01 /* disk has changed since last call */ -#define FDKGC_CURRENT 0x02 /* current state of disk change */ - -/* - * Used by FDK{G, S}ETDRIVECHAR - */ -struct fdk_drive { - int fdd_ejectable; /* does the drive support eject? */ - int fdd_maxsearch; /* size of per-unit search table */ - - int fdd_writeprecomp; /* cyl to start write prcompensation */ - int fdd_writereduce; /* cyl to start recucing write current */ - int fdd_stepwidth; /* width of step pulse in 1 us units */ - int fdd_steprate; /* step rate in 100 us units */ - int fdd_headsettle; /* delay, in 100 us units */ - int fdd_headload; /* delay, in 100 us units */ - int fdd_headunload; /* delay, in 100 us units */ - int fdd_motoron; /* delay, in 100 ms units */ - int fdd_motoroff; /* delay, in 100 ms units */ - int fdd_precomplevel; /* bit shift, in nano-secs */ - int fdd_pins; /* defines meaning of pin 1, 2, 4, and 34 */ - int fdd_flags; /* TRUE READY, Starting Sector #, & Motor On */ -}; - -/* - * Used by FDK{G, S}ETSEARCH - */ -struct fdk_search { - int fdk_numentries; /* number of elements in the table */ - struct fdk_char *fdk_search; -}; - -/* - * Used by F_RAW - */ -struct fdraw { - char fr_cmd[10]; /* user-supplied command bytes */ - short fr_cnum; /* number of command bytes */ - char fr_result[10]; /* controller-supplied result bytes */ - short fr_nbytes; /* number to transfer if read/write command */ - char *fr_addr; /* where to transfer if read/write command */ -}; - -/* - * Floppy raw commands - */ -#define FRAW_SPECIFY 0x03 -#define FRAW_READID 0x0a -#define FRAW_SENSE_DRV 0x04 -#define FRAW_REZERO 0x07 -#define FRAW_SEEK 0x0f -#define FRAW_SENSE_INT 0x08 -#define FRAW_FORMAT 0x0d -#define FRAW_READTRACK 0x02 -#define FRAW_WRCMD 0x05 -#define FRAW_RDCMD 0x06 -#define FRAW_WRITEDEL 0x09 -#define FRAW_READDEL 0x0c - -/* - * Severity values - */ -#define DK_NOERROR 0 -#define DK_CORRECTED 1 -#define DK_RECOVERED 2 -#define DK_FATAL 3 - -/* - * Error types - */ -#define DK_NONMEDIA 0 /* not caused by a media defect */ -#define DK_ISMEDIA 1 /* caused by a media defect */ - - -/* - * Disk io control commands - */ -#define DKIOCGGEOM _IOR('d', 2, struct dk_geom) /* Get geometry */ -#define DKIOCSGEOM _IOW('d', 3, struct dk_geom) /* Set geometry */ -#define DKIOCGPART _IOR('d', 4, struct dk_map) /* Get partition info */ -#define DKIOCSPART _IOW('d', 5, struct dk_map) /* Set partition info */ -#define DKIOCINFO _IOR('d', 8, struct dk_info) /* Get info */ -#define DKIOCGCONF _IOR('d', 126, struct dk_conf) /* Get conf info */ -#define DKIOCSTYPE _IOW('d', 125, struct dk_type) /* Set drive info */ -#define DKIOCGTYPE _IOR('d', 124, struct dk_type) /* Get drive info */ -#define DKIOCSAPART _IOW('d', 123, struct dk_allmap) /* Set all partitions */ -#define DKIOCGAPART _IOR('d', 122, struct dk_allmap) /* Get all partitions */ -#define DKIOCSBAD _IOW('d', 121, struct dk_badmap) /* Set bad sector map */ -#define DKIOCGBAD _IOW('d', 120, struct dk_badmap) /* Get bad sector map */ -#define DKIOCSCMD _IOW('d', 119, struct dk_cmd) /* Set generic cmd */ -#define DKIOCGLOG _IOR('d', 118, struct dk_loghdr) /* Get error log */ -#define DKIOCGDIAG _IOR('d', 116, struct dk_diag) /* Get diagnostics */ -#define DKIOCWCHK _IOWR('d', 115, int) /* Toggle write check */ -#define FDKIOGCHAR _IOR('d', 114, struct fdk_char) /* GetCharacteristics */ -#define FDKIOSCHAR _IOW('d', 113, struct fdk_char) /* SetCharacteristics */ -#define FDKEJECT _IO('d', 112) /* Eject floppy disk */ -#define FDKGETCHANGE _IOR('d', 111, int) /* Get diskchng stat */ -#define FDKGETDRIVECHAR _IOR('d', 110, struct fdk_drive) /* Get drivechar */ -#define FDKSETDRIVECHAR _IOW('d', 109, struct fdk_drive) /* Set drivechar */ -#define FDKGETSEARCH _IOR('d', 108, struct fdk_search) /* Get search tbl */ -#define FDKSETSEARCH _IOW('d', 107, struct fdk_search) /* Set search tbl */ -#define FDKIOCSCMD _IOWR('d', 106, struct fdk_cmd) /* Floppy command */ -#define F_RAW _IOWR('d', 105, struct fdraw) /* ECDstyle genericcmd*/ - -#endif /* !_sun_dkio_h */ diff --git a/usr/src/lib/libbc/inc/include/sun/dklabel.h b/usr/src/lib/libbc/inc/include/sun/dklabel.h deleted file mode 100644 index 7f31835c06..0000000000 --- a/usr/src/lib/libbc/inc/include/sun/dklabel.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1987 by Sun Microsystems, Inc. - */ - -#ifndef _sun_dklabel_h -#define _sun_dklabel_h - -/* - * Miscellaneous defines - */ -#define DKL_MAGIC 0xDABE /* magic number */ -#define FKL_MAGIC 0xff /* magic number for DOS floppies */ -#define NDKMAP 8 /* # of logical partitions */ - -/* - * Format of a Sun SMD disk label. - * Resides in cylinder 0, head 0, sector 0. - * - * sizeof (struct dk_label) should be 512 (sector size) - */ -struct dk_label { - char dkl_asciilabel[128]; /* for compatibility */ - char dkl_pad[512-(128+NDKMAP*8+14*2)]; - unsigned short dkl_rpm; /* rotations per minute */ - unsigned short dkl_pcyl; /* # physical cylinders */ - unsigned short dkl_apc; /* alternates per cylinder */ - unsigned short dkl_obs1; /* obsolete */ - unsigned short dkl_obs2; /* obsolete */ - unsigned short dkl_intrlv; /* interleave factor */ - unsigned short dkl_ncyl; /* # of data cylinders */ - unsigned short dkl_acyl; /* # of alternate cylinders */ - unsigned short dkl_nhead; /* # of heads in this partition */ - unsigned short dkl_nsect; /* # of 512 byte sectors per track */ - unsigned short dkl_obs3; /* obsolete */ - unsigned short dkl_obs4; /* obsolete */ - /* */ - struct dk_map { /* logical partitions */ - daddr_t dkl_cylno; /* starting cylinder */ - daddr_t dkl_nblk; /* number of blocks */ - } dkl_map[NDKMAP]; - unsigned short dkl_magic; /* identifies this label format */ - unsigned short dkl_cksum; /* xor checksum of sector */ -}; - -/* - * These defines are for historic compatibility with old drivers. - */ -#define dkl_gap1 dkl_obs1 /* used to be gap1 */ -#define dkl_gap2 dkl_obs2 /* used to be gap2 */ -#define dkl_bhead dkl_obs3 /* used to be label head offset */ -#define dkl_ppart dkl_obs4 /* used to by physical partition */ - -struct fk_label { /* DOS floppy label */ - u_char fkl_type; - u_char fkl_magich; - u_char fkl_magicl; - u_char filler; -}; - -#endif /*!_sun_dklabel_h*/ diff --git a/usr/src/lib/libbc/inc/include/sun4/a.out.h b/usr/src/lib/libbc/inc/include/sun4/a.out.h deleted file mode 100644 index f44a30d256..0000000000 --- a/usr/src/lib/libbc/inc/include/sun4/a.out.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef _sparc_a_out_h -#define _sparc_a_out_h - -#include <sys/exec.h> - -/* - * memory management parameters - */ - -#define PAGSIZ 0x02000 -#define SEGSIZ PAGSIZ -#define OLD_PAGSIZ 0x00800 /* Page size under Release 2.0 */ -#define OLD_SEGSIZ 0x08000 /* Segment size under Release 2.0 */ - -/* - * returns 1 if an object file type is invalid, i.e., if the other macros - * defined below will not yield the correct offsets. Note that a file may - * have N_BADMAG(x) = 0 and may be fully linked, but still may not be - * executable. - */ - -#define N_BADMAG(x) \ - ((x).a_magic!=OMAGIC && (x).a_magic!=NMAGIC && (x).a_magic!=ZMAGIC) - -/* - * relocation parameters. These are architecture-dependent - * and can be deduced from the machine type. They are used - * to calculate offsets of segments within the object file; - * See N_TXTOFF(x), etc. below. - */ - -#define N_PAGSIZ(x) \ - ((x).a_machtype == M_OLDSUN2? OLD_PAGSIZ : PAGSIZ) -#define N_SEGSIZ(x) \ - ((x).a_machtype == M_OLDSUN2? OLD_SEGSIZ : SEGSIZ) - -/* - * offsets of various sections of an object file. - */ - -#define N_TXTOFF(x) \ - /* text segment */ \ - ( (x).a_machtype == M_OLDSUN2 \ - ? ((x).a_magic==ZMAGIC ? N_PAGSIZ(x) : sizeof (struct exec)) \ - : ((x).a_magic==ZMAGIC ? 0 : sizeof (struct exec)) ) - -#define N_DATOFF(x) /* data segment */ \ - (N_TXTOFF(x) + (x).a_text) - -#define N_TRELOFF(x) /* text reloc'n */ \ - (N_DATOFF(x) + (x).a_data) - -#define N_DRELOFF(x) /* data relocation*/ \ - (N_TRELOFF(x) + (x).a_trsize) - -#define N_SYMOFF(x) \ - /* symbol table */ \ - (N_TXTOFF(x)+(x).a_text+(x).a_data+(x).a_trsize+(x).a_drsize) - -#define N_STROFF(x) \ - /* string table */ \ - (N_SYMOFF(x) + (x).a_syms) - -/* - * Macros which take exec structures as arguments and tell where the - * various pieces will be loaded. - */ - -#define _N_BASEADDR(x) \ - (((x).a_magic == ZMAGIC) && ((x).a_entry < N_PAGSIZ(x)) ? \ - 0 : N_PAGSIZ(x)) - -#define N_TXTADDR(x) \ - ((x).a_machtype == M_OLDSUN2 ? N_SEGSIZ(x) : _N_BASEADDR(x)) - -#define N_DATADDR(x) \ - (((x).a_magic==OMAGIC)? (N_TXTADDR(x)+(x).a_text) \ - : (N_SEGSIZ(x)+((N_TXTADDR(x)+(x).a_text-1) & ~(N_SEGSIZ(x)-1)))) - -#define N_BSSADDR(x) (N_DATADDR(x)+(x).a_data) - -/* - * Format of a relocation datum. - */ - -/* - * Sparc relocation types - */ - -enum reloc_type -{ - RELOC_8, RELOC_16, RELOC_32, /* simplest relocs */ - RELOC_DISP8, RELOC_DISP16, RELOC_DISP32, /* Disp's (pc-rel) */ - RELOC_WDISP30, RELOC_WDISP22, /* SR word disp's */ - RELOC_HI22, RELOC_22, /* SR 22-bit relocs */ - RELOC_13, RELOC_LO10, /* SR 13&10-bit relocs*/ - RELOC_SFA_BASE, RELOC_SFA_OFF13, /* SR S.F.A. relocs */ - RELOC_BASE10, RELOC_BASE13, RELOC_BASE22, /* base_relative pic */ - RELOC_PC10, RELOC_PC22, /* special pc-rel pic*/ - RELOC_JMP_TBL, /* jmp_tbl_rel in pic */ - RELOC_SEGOFF16, /* ShLib offset-in-seg*/ - RELOC_GLOB_DAT, RELOC_JMP_SLOT, RELOC_RELATIVE, /* rtld relocs */ -}; - -/* - * Format of a relocation datum. - */ - -struct reloc_info_sparc /* used when header.a_machtype == M_SPARC */ -{ - unsigned long int r_address; /* relocation addr (offset in segment)*/ - unsigned int r_index :24; /* segment index or symbol index */ - unsigned int r_extern : 1; /* if F, r_index==SEG#; if T, SYM idx */ - int : 2; /* <unused> */ - enum reloc_type r_type : 5; /* type of relocation to perform */ - long int r_addend; /* addend for relocation value */ -}; - - - -/* - * Format of a symbol table entry - */ -struct nlist { - union { - char *n_name; /* for use when in-core */ - long n_strx; /* index into file string table */ - } n_un; - unsigned char n_type; /* type flag (N_TEXT,..) */ - char n_other; /* unused */ - short n_desc; /* see <stab.h> */ - unsigned long n_value; /* value of symbol (or sdb offset) */ -}; - -/* - * Simple values for n_type. - */ -#define N_UNDF 0x0 /* undefined */ -#define N_ABS 0x2 /* absolute */ -#define N_TEXT 0x4 /* text */ -#define N_DATA 0x6 /* data */ -#define N_BSS 0x8 /* bss */ -#define N_COMM 0x12 /* common (internal to ld) */ -#define N_FN 0x1e /* file name symbol */ - -#define N_EXT 01 /* external bit, or'ed in */ -#define N_TYPE 0x1e /* mask for all the type bits */ - -/* - * Dbx entries have some of the N_STAB bits set. - * These are given in <stab.h> - */ -#define N_STAB 0xe0 /* if any of these bits set, a dbx symbol */ - -/* - * Format for namelist values. - */ -#define N_FORMAT "%08x" - -/* - * secondary sections. - * this stuff follows the string table. - * not even its presence or absence is noted in the - * exec header (?). the secondary header gives - * the number of sections. following it is an - * array of "extra_nsects" int's which give the - * sizeof of the individual sections. the presence of - * even the header is optional. - */ - -#define EXTRA_MAGIC 1040 /* taxing concept */ -#define EXTRA_IDENT 0 /* ident's in 0th extra section */ - -struct extra_sections { - int extra_magic; /* should be EXTRA_MAGIC */ - int extra_nsects; /* number of extra sections */ -}; - -#endif /*!_sparc_a_out_h*/ diff --git a/usr/src/lib/libbc/inc/include/sun4/mmu.h b/usr/src/lib/libbc/inc/include/sun4/mmu.h deleted file mode 100644 index a18c4ea8c4..0000000000 --- a/usr/src/lib/libbc/inc/include/sun4/mmu.h +++ /dev/null @@ -1,282 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SUN4_MMU_H -#define _SUN4_MMU_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Sun-4 memory management unit. - * All sun-4 implementations use 32 bits of address. - * A particular implementation may implement a smaller MMU. - * If so, the missing addresses are in the "middle" of the - * 32 bit address space. All accesses in this range behave - * as if there was an invalid page map entry correspronding - * to the address. - * - * There are two types of MMUs a 2 level MMU and a 3 level MMU. - * Three level MMUs do not have holes. - */ - -/* - * Hardware context and segment information - * Mnemonic decoding: - * PMENT - Page Map ENTry - * PMGRP - Group of PMENTs (aka "segment") - * SMENT - Segment Map ENTry - 3 level MMU only - * SMGRP - Group of SMENTs (aka "region") - 3 level MMU only - */ -/* fixed SUN4 constants */ -#define NPMENTPERPMGRP 32 -#define NPMENTPERPMGRPSHIFT 5 /* log2(NPMENTPERPMGRP) */ -#define PMGRPSIZE (NPMENTPERPMGRP * PAGESIZE) -#define PMGRPOFFSET (PMGRPSIZE - 1) -#define PMGRPSHIFT (PAGESHIFT + NPMENTPERPMGRPSHIFT) -#define PMGRPMASK (~PMGRPOFFSET) - -#define NSMENTPERSMGRP 64 -#define NSMENTPERSMGRPSHIFT 6 /* log2(NSMENTPERSMGRP) */ -#define SMGRPSIZE (NSMENTPERSMGRP * PMGRPSIZE) -#define SMGRPOFFSET (SMGRPSIZE - 1) -#define SMGRPSHIFT (PMGRPSHIFT + NSMENTPERSMGRPSHIFT) -#define SMGRPMASK (~SMGRPOFFSET) - -#define NSMGRPPERCTX 256 - -/* - * Useful defines for hat constants, - * Every implementation seems to have its own set - * they are set at boot time by setcputype() - */ -#define NCTXS nctxs -#define NPMGRPS npmgrps -#define NSMGRPS nsmgrps - -/* - * Variables set at boot time to reflect cpu type. - */ -#ifndef LOCORE -#include <sys/types.h> - -extern uint_t nctxs; /* number of implemented contexts */ -extern uint_t npmgrps; /* number of pmgrps in page map */ -#ifdef MMU_3LEVEL -extern uint_t nsmgrps; /* number of smgrps in segment map (3 level) */ -#endif /* MMU_3LEVEL */ -extern uint_t segmask; /* mask for segment number */ -extern addr_t hole_start; /* addr of start of MMU "hole" */ -extern addr_t hole_end; /* addr of end of MMU "hole" */ -extern uint_t shm_alignment; /* VAC address consistency modulus */ - -#ifdef MMU_3LEVEL -extern int mmu_3level; /* indicates 3 level MMU can exist */ -#endif /* MMU_3LEVEL */ - -#define PMGRP_INVALID (NPMGRPS - 1) -#define SMGRP_INVALID (NSMGRPS - 1) - -/* - * Macro to determine whether an address is within the range of the MMU. - */ -#ifdef MMU_3LEVEL -#define good_addr(a) \ - (mmu_3level || (addr_t)(a) < hole_start || (addr_t)(a) >= hole_end) -#else -#define good_addr(a) \ - ((addr_t)(a) < hole_start || (addr_t)(a) >= hole_end) -#endif /* MMU_3LEVEL */ -#endif /* !LOCORE */ - -/* - * Address space identifiers. - */ -#define ASI_CTL 0x2 /* control space */ -#define ASI_SM 0x3 /* segment map */ -#define ASI_PM 0x4 /* page map */ -#define ASI_BC 0x5 /* block copy */ -#define ASI_RM 0x6 /* region map */ -#define ASI_FCR 0x7 /* flush cache region */ -#define ASI_UP 0x8 /* user program */ -#define ASI_SP 0x9 /* supervisor program */ -#define ASI_UD 0xA /* user data */ -#define ASI_SD 0xB /* supervisor data */ -#define ASI_FCS 0xC /* flush cache segment */ -#define ASI_FCP 0xD /* flush cache page */ -#define ASI_FCC 0xE /* flush cache context */ -#define ASI_FCU 0xF /* flush cache user, sunray */ - -#define ASI_CD 0xF /* cache data, sunrise */ - -/* - * ASI_CTL addresses - */ -#define ID_PROM 0x00000000 -#define CONTEXT_REG 0x30000000 -#define SYSTEM_ENABLE 0x40000000 -#define BUS_ERROR_REG 0x60000000 -#define DIAGNOSTIC_REG 0x70000000 -#define CACHE_TAGS 0x80000000 -#define CACHE_DATA 0x90000000 /* cache data, sunray */ -#define VME_INT_VEC 0xE0000000 -#define UART_BYPASS 0xF0000000 - -#define IDPROMSIZE 0x20 /* size of id prom in bytes */ - -/* - * Constants for cache operations. - * XXX - should be deleted but the standalones (boot) use them. - */ -#define VAC_SIZE 0x20000 /* 128K */ -#define VAC_LINESIZE_SUNRISE 16 /* 16 bytes per line */ -#define VAC_LINESIZE_SUNRAY 32 /* 32 bytes per line */ -#define NPMGRPPERCTX_110 4096 -#define NPMGRPPERCTX_260 4096 -#define NPMGRPPERCTX_330 4096 -#define NPMGRPS_110 256 -#define NPMGRPS_260 512 -#define NPMGRPS_330 256 -#define NPMGRPS_470 1024 - -/* - * Various I/O space related constants - */ -#define VME16_BASE 0xFFFF0000 -#define VME16_SIZE (1<<16) -#define VME16_MASK (VME16_SIZE-1) - -#define VME24_BASE 0xFF000000 -#define VME24_SIZE (1<<24) -#define VME24_MASK (VME24_SIZE-1) - -/* - * Virtual address where dvma starts. - */ -#define DVMABASE (0-(1024*1024)) - -/* - * Context for kernel. On a Sun-4 the kernel is in every address space, - * but KCONTEXT is magic in that there is never any user context there. - */ -#define KCONTEXT 0 - -/* - * MDEVBASE is a virtual segment reserved for mapping misc. obio devices. - * The base address and the number of devices mapped should not cause the - * device mappings to cross a segment boundary. We use the segment - * immediately before SYSBASE - */ -#define MDEVBASE (SYSBASE - PMGRPSIZE) - -/* - * SEGTEMP & SEGTEMP2 are virtual segments reserved for temporary operations. - * We use the segments immediately before the start of debugger area. - */ -#define SEGTEMP ((addr_t)(DEBUGSTART - (2 * PMGRPSIZE))) -#define SEGTEMP2 ((addr_t)(DEBUGSTART - PMGRPSIZE)) - -/* - * REGTEMP is only during intialization, we use the - * REGION immediately before KERNELBASE, it is invalidated - * after use - */ -#define REGTEMP ((KERNELBASE-SMGRPSIZE)&SMGRPMASK) - -#if defined(KERNEL) && !defined(LOCORE) - -#ifdef VAC -void vac_dontcache(); -/* - * cache related constants set at boot time - */ -extern int vac_size; /* size of cache in bytes */ -extern int vac_linesize; /* cache linesize */ -extern int vac_nlines; /* number of lines in cache */ -extern int vac_pglines; /* number of cache lines in a page */ -#endif /* VAC */ - -/* - * Low level mmu-specific functions - */ -struct ctx *mmu_getctx(); -void mmu_setctx(/* ctx */); -void mmu_setpmg(/* base, pmg */); -void mmu_settpmg(/* base, pmg */); -struct pmgrp *mmu_getpmg(/* base */); -void mmu_setpte(/* base, pte */); -void mmu_getpte(/* base, ppte */); -void mmu_getkpte(/* base, ppte */); -void mmu_pmginval(/* pmg */); -#ifdef MMU_3LEVEL -struct smgrp *mmu_getsmg(/* base */); -void mmu_setsmg(/* base, smg */); -void mmu_settsmg(/* base, smg */); -void mmu_smginval(/* smg */); -#endif /* MMU_3LEVEL */ - -/* - * Cache specific routines - ifdef'ed out if there is no chance - * of running on a machine with a virtual address cache. - */ -#ifdef VAC -void vac_init(); -void vac_tagsinit(); -void vac_flushall(); -void vac_ctxflush(); -#ifdef MMU_3LEVEL -void vac_usrflush(); -void vac_rgnflush(/* base */); -#endif /* MMU_3LEVEL */ -void vac_segflush(/* base */); -void vac_pageflush(/* base */); -void vac_flush(/* base, len */); -int bp_alloc(/* map, bp, size */); -#else /* VAC */ -#define vac_init() -#define vac_tagsinit() -#define vac_flushall() -#define vac_usrflush() -#define vac_ctxflush() -#define vac_rgnflush(base) -#define vac_segflush(base) -#define vac_pageflush(base) -#define vac_flush(base, len) -#define bp_alloc(map, bp, size) (int)rmalloc((map), (long)(size)) -#endif /* VAC */ - -int valid_va_range(/* basep, lenp, minlen, dir */); - -#endif /* defined(KERNEL) && !defined(LOCORE) */ - -#ifdef __cplusplus -} -#endif - -#endif /* !_SUN4_MMU_H */ diff --git a/usr/src/lib/libbc/inc/include/sun4/param.h b/usr/src/lib/libbc/inc/include/sun4/param.h deleted file mode 100644 index 75327f65b4..0000000000 --- a/usr/src/lib/libbc/inc/include/sun4/param.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _sun4_param_h -#define _sun4_param_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * This file is intended to contain the basic - * specific details of a given architecture. - */ - -/* - * Machine dependent constants for Sun4. - */ - -/* - * Define the VAC symbol if we could run on a machine - * which has a Virtual Address Cache (e.g. SUN4_260) - */ -#if defined(SUN4_260) || defined(SUN4_470) || defined(SUN4_330) -#define VAC -#else -#undef VAC -#endif /* SUN4_260 || SUN4_470 || SUN4_330 */ - -/* - * Define the FPU symbol if we could run on a machine with an external - * FPU (i.e. not integrated with the normal machine state like the vax). - */ -#define FPU - -/* - * Define the MMU_3LEVEL symbol if we could run on a machine with - * a three level mmu. We also assume these machines have region - * and user cache flush operations. - */ -#ifdef SUN4_470 -#define MMU_3LEVEL -#else -#undef MMU_3LEVEL -#endif /* SUN4_470 */ - -/* - * Define IOC if we could run on machines that have an I/O cache. - */ -#ifdef SUN4_470 -#define IOC -#else -#undef IOC -#endif /* SUN4_470 */ - -/* - * Define BCOPY_BUF if we could run on machines that have a bcopy buffer. - */ -#ifdef SUN4_470 -#define BCOPY_BUF -#else -#undef BCOPY_BUF -#endif /* SUN4_470 */ - -/* - * Define VA_HOLE for machines that have a hole in the virtual address space. - */ -#if defined(SUN4_260) || defined(SUN4_110) || defined(SUN4_330) -#define VA_HOLE -#else -#undef VA_HOLE -#endif /* SUN4_260 || SUN4_110 || SUN4_330 */ - -/* - * MMU_PAGES* describes the physical page size used by the mapping hardware. - * PAGES* describes the logical page size used by the system. - */ - -#define MMU_PAGESIZE 0x2000 /* 8192 bytes */ -#define MMU_PAGESHIFT 13 /* log2(MMU_PAGESIZE) */ -#define MMU_PAGEOFFSET (MMU_PAGESIZE-1)/* Mask of address bits in page */ -#define MMU_PAGEMASK (~MMU_PAGEOFFSET) - -#define PAGESIZE 0x2000 /* All of the above, for logical */ -#define PAGESHIFT 13 -#define PAGEOFFSET (PAGESIZE - 1) -#define PAGEMASK (~PAGEOFFSET) - -/* - * DATA_ALIGN is used to define the alignment of the Unix data segment. - */ -#define DATA_ALIGN 0x2000 - -/* - * Some random macros for units conversion. - */ - -/* - * MMU pages to bytes, and back (with and without rounding) - */ -#define mmu_ptob(x) ((x) << MMU_PAGESHIFT) -#define mmu_btop(x) (((unsigned)(x)) >> MMU_PAGESHIFT) -#define mmu_btopr(x) ((((unsigned)(x) + MMU_PAGEOFFSET) >> MMU_PAGESHIFT)) - -/* - * pages to bytes, and back (with and without rounding) - */ -#define ptob(x) ((x) << PAGESHIFT) -#define btop(x) (((unsigned)(x)) >> PAGESHIFT) -#define btopr(x) ((((unsigned)(x) + PAGEOFFSET) >> PAGESHIFT)) - -/* - * 2 versions of pages to disk blocks - */ -#define mmu_ptod(x) ((x) << (MMU_PAGESHIFT - DEV_BSHIFT)) -#define ptod(x) ((x) << (PAGESHIFT - DEV_BSHIFT)) - -/* - * Delay units are in microseconds. - */ -#define DELAY(n) usec_delay(n) -#define CDELAY(c, n) \ -{ \ - register int N = n; \ - while (--N > 0) { \ - if (c) \ - break; \ - usec_delay(1); \ - } \ -} - -#define UPAGES 2 /* pages of u-area, NOT including red zone */ -#define KERNSTACK 0x3000 /* size of kernel stack in u-area */ - -/* - * KERNSIZE the amount of vitual address space the kernel - * uses in all contexts. - */ -#define KERNELSIZE (128*1024*1024) - -/* - * KERNELBASE is the virtual address which - * the kernel text/data mapping starts in all contexts. - */ -#define KERNELBASE (0-KERNELSIZE) - -/* - * SYSBASE is the virtual address which - * the kernel allocated memory mapping starts in all contexts. - */ -#define SYSBASE (0-(16*1024*1024)) - -/* - * Msgbuf size. - */ -#define MSG_BSIZE ((7 * 1024) - sizeof (struct msgbuf_hd)) - -/* - * XXX - Macros for compatibility - */ -/* Clicks (MMU PAGES) to disk blocks */ -#define ctod(x) mmu_ptod(x) - -/* Clicks (MMU PAGES) to bytes, and back (with rounding) */ -#define ctob(x) mmu_ptob(x) -#define btoc(x) mmu_btopr(x) - -/* - * XXX - Old names for some backwards compatibility - */ -#define NBPG MMU_PAGESIZE -#define PGOFSET MMU_PAGEOFFSET -#define PGSHIFT MMU_PAGESHIFT - -#define CLSIZE 1 -#define CLSIZELOG2 0 -#define CLBYTES PAGESIZE -#define CLOFSET PAGEOFFSET -#define CLSHIFT PAGESHIFT -#define clrnd(i) (i) - -#endif /* !_sun4_param_h */ diff --git a/usr/src/lib/libbc/inc/include/sun4/trap.h b/usr/src/lib/libbc/inc/include/sun4/trap.h deleted file mode 100644 index 69248c7662..0000000000 --- a/usr/src/lib/libbc/inc/include/sun4/trap.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1985 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _sparc_trap_h -#define _sparc_trap_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Trap type values. - */ -#define TT(X) ((X)<<4) - -/* - * The Coprocessor bit. - */ -#define CP_BIT 0x20 - -/* - * Hardware traps. - */ -#define T_RESET 0x00 -#define T_TEXT_FAULT 0x01 -#define T_UNIMP_INSTR 0x02 -#define T_PRIV_INSTR 0x03 -#define T_FP_DISABLED 0x04 -#define T_CP_DISABLED (0x4 | CP_BIT) -#define T_WIN_OVERFLOW 0x05 -#define T_WIN_UNDERFLOW 0x06 -#define T_ALIGNMENT 0x07 -#define T_FP_EXCEPTION 0x08 -#define T_CP_EXCEPTION (0x8 | CP_BIT) -#define T_DATA_FAULT 0x09 -#define T_TAG_OVERFLOW 0x0A -#define T_INT 0x10 -#define T_INT_LEVEL 0x0F -#define T_INT_LEVEL_1 0x11 -#define T_INT_LEVEL_2 0x12 -#define T_INT_LEVEL_3 0x13 -#define T_INT_LEVEL_4 0x14 -#define T_INT_LEVEL_5 0x15 -#define T_INT_LEVEL_6 0x16 -#define T_INT_LEVEL_7 0x17 -#define T_INT_LEVEL_8 0x18 -#define T_INT_LEVEL_9 0x19 -#define T_INT_LEVEL_10 0x1A -#define T_INT_LEVEL_11 0x1B -#define T_INT_LEVEL_12 0x1C -#define T_INT_LEVEL_13 0x1D -#define T_INT_LEVEL_14 0x1E -#define T_INT_LEVEL_15 0x1F - -/* - * Software traps (ticc instructions). - */ -#define ST_SYSCALL 0x00 -#define ST_BREAKPOINT 0x01 -#define ST_DIV0 0x02 -#define ST_FLUSH_WINDOWS 0x03 -#define ST_CLEAN_WINDOWS 0x04 -#define ST_RANGE_CHECK 0x05 -#define ST_FIX_ALIGN 0x06 -#define ST_INT_OVERFLOW 0x07 - -#define ST_GETCC 0x20 -#define ST_SETCC 0x21 -#define ST_MON_BREAKPOINT 0x7F - -/* - * Software trap vectors 16 - 31 are reserved for use by the user - * and will not be usurped by Sun. - */ - -/* - * Software trap type values. - */ -#define T_SOFTWARE_TRAP 0x80 -#define T_ESOFTWARE_TRAP 0xFF -#define T_SYSCALL (T_SOFTWARE_TRAP + ST_SYSCALL) -#define T_BREAKPOINT (T_SOFTWARE_TRAP + ST_BREAKPOINT) -#define T_DIV0 (T_SOFTWARE_TRAP + ST_DIV0) -#define T_FLUSH_WINDOWS (T_SOFTWARE_TRAP + ST_FLUSH_WINDOWS) -#define T_CLEAN_WINDOWS (T_SOFTWARE_TRAP + ST_CLEAN_WINDOWS) -#define T_RANGE_CHECK (T_SOFTWARE_TRAP + ST_RANGE_CHECK) -#define T_FIX_ALIGN (T_SOFTWARE_TRAP + ST_FIX_ALIGN) -#define T_INT_OVERFLOW (T_SOFTWARE_TRAP + ST_INT_OVERFLOW) - -#define T_GETCC (T_SOFTWARE_TRAP + ST_GETCC) -#define T_SETCC (T_SOFTWARE_TRAP + ST_SETCC) - -/* - * Pseudo traps. - */ -#define T_INTERRUPT 0x100 -#define T_SPURIOUS (T_INTERRUPT | T_INT) -#define T_FAULT 0x200 -#define T_AST 0x400 -#define T_ZERO 0x00 - -#endif /* !_sparc_trap_h */ diff --git a/usr/src/lib/libbc/inc/include/sun4/vmparam.h b/usr/src/lib/libbc/inc/include/sun4/vmparam.h deleted file mode 100644 index 0204a7d333..0000000000 --- a/usr/src/lib/libbc/inc/include/sun4/vmparam.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1987-1998,2001 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ifndef _SUN4_VMPARAM_H -#define _SUN4_VMPARAM_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sun4/param.h> - -/* - * Machine dependent constants for Sun-4 - */ - -/* - * USRTEXT is the start of the user text/data space, while USRSTACK - * is the top (end) of the user stack. - */ -#define USRTEXT 0x2000 -#define USRSTACK KERNELBASE - -/* - * Virtual memory related constants for UNIX resource control, all in bytes - * The default stack size of 8M allows an optimization of mmu mapping - * resources so that in normal use a single mmu region map entry (smeg) - * can be used to map both the stack and shared libraries - */ -#define DFLSSIZ (8*1024*1024) /* initial stack size limit */ - -#define DFLDSIZ_260 ((512*1024*1024)-USRTEXT) /* initial data size limit */ -#define MAXDSIZ_260 ((512*1024*1024)-USRTEXT) /* max data size limit */ -#define MAXSSIZ_260 ((512*1024*1024)-KERNELSIZE) /* max stack size limit */ - -#define DFLDSIZ_470 ((2048*1024*1024)-USRTEXT) /* initial data size limit */ -#define MAXDSIZ_470 ((2048*1024*1024)-USRTEXT) /* max data size limit */ -#define MAXSSIZ_470 ((2048*1024*1024)-KERNELSIZE) /* max stack size limit */ - -#define DFLDSIZ dfldsiz -#define MAXDSIZ maxdsiz -#define MAXSSIZ maxssiz - -#ifndef LOCORE -extern unsigned int dfldsiz; -extern unsigned int maxdsiz; -extern unsigned int maxssiz; -#endif /* !LOCORE */ - -#define SSIZE 1 /* initial stack size */ -#define SINCR 1 /* increment of stack */ - -/* - * Size of the kernel segkmem system pte table. This virtual - * space is controlled by the resource map "kernelmap". - */ -#define SYSPTSIZE (0x640000 / MMU_PAGESIZE) - -/* - * Minimum allowable virtual address space to be used - * by the seg_map segment driver for fast kernel mappings. - */ -#define MINMAPSIZE 0x200000 - -/* - * The time for a process to be blocked before being very swappable. - * This is a number of seconds which the system takes as being a non-trivial - * amount of real time. You probably shouldn't change this; - * it is used in subtle ways (fractions and multiples of it are, that is, like - * half of a ``long time'', almost a long time, etc.) - * It is related to human patience and other factors which don't really - * change over time. - */ -#define MAXSLP 20 - -/* - * A swapped in process is given a small amount of core without being bothered - * by the page replacement algorithm. Basically this says that if you are - * swapped in you deserve some resources. We protect the last SAFERSS - * pages against paging and will just swap you out rather than paging you. - * Note that each process has at least UPAGES pages which are not - * paged anyways so this number just means a swapped in process is - * given around 32k bytes. - */ -#define SAFERSS 3 - -/* - * DISKRPM is used to estimate the number of paging i/o operations - * which one can expect from a single disk controller. - */ -#define DISKRPM 60 - -/* - * Paging thresholds (see vm_pageout.c). - * Strategy of 3/17/83: - * lotsfree is 256k bytes, but at most 1/8 of memory - * desfree is 100k bytes, but at most 1/16 of memory - * minfree is 32k bytes, but at most 1/2 of desfree - */ -#define LOTSFREE (256 * 1024) -#define LOTSFREEFRACT 8 -#define DESFREE (100 * 1024) -#define DESFREEFRACT 16 -#define MINFREE (32 * 1024) -#define MINFREEFRACT 2 - -/* - * There are two clock hands, initially separated by HANDSPREAD bytes - * (but at most all of user memory). The amount of time to reclaim - * a page once the pageout process examines it increases with this - * distance and decreases as the scan rate rises. - */ -#define HANDSPREAD (2 * 1024 * 1024) - -/* - * Paged text files that are less than PGTHRESH bytes - * may be "prefaulted in" instead of demand paged. - */ -#define PGTHRESH (280 * 1024) - -#ifdef __cplusplus -} -#endif - -#endif /* !_SUN4_VMPARAM_H */ diff --git a/usr/src/lib/libbc/inc/include/sys/audit.h b/usr/src/lib/libbc/inc/include/sys/audit.h deleted file mode 100644 index a3ba237f20..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/audit.h +++ /dev/null @@ -1,233 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" -/* - * Audit trail structures; - */ - -#ifndef _sys_audit_h -#define _sys_audit_h - -/* - * Maximum size for audit data passed from the audit system call - * This value is arbitrary, so offers of better numbers are invited. - */ - -#define AUP_USER (0x8000) -#define MAXAUDITDATA (AUP_USER - 1) -#define AUDITMAGIC 0x00070009 - -/* - * Audit conditions, statements reguarding what's to be done with - * audit records. - */ -#define AUC_UNSET 0 /* on/off hasn't been decided */ -#define AUC_AUDITING 1 /* auditing is being done */ -#define AUC_NOAUDIT 2 /* auditing is not being done */ -#define AUC_FCHDONE 3 /* no auditing, and you never can */ - -/* - * Minimum and maximum record type values. Change AUR_MAXRECTYPE when - * adding new record types. - */ -#define AUR_MINRECTYPE 1 -#define AUR_MAXRECTYPE 63 - -/* - * Audit record type codes - */ -#define AUR_ACCESS 1 -#define AUR_CHMOD 2 -#define AUR_CHOWN 3 -#define AUR_CREAT 4 -#define AUR_FCHMOD 5 -#define AUR_FCHOWN 6 -#define AUR_FTRUNCATE 7 -#define AUR_LINK 8 -#define AUR_MKDIR 9 -#define AUR_MKNOD 10 -#define AUR_OPEN 11 -#define AUR_RMDIR 12 -#define AUR_RENAME 13 -#define AUR_STAT 14 -#define AUR_SYMLINK 15 -#define AUR_TRUNCATE 16 -#define AUR_UNLINK 17 -#define AUR_UTIMES 18 -#define AUR_EXECV 19 -#define AUR_MSGCONV 20 -#define AUR_MSGCTL 21 -#define AUR_MSGGET 22 -#define AUR_MSGRCV 23 -#define AUR_MSGSND 24 -#define AUR_SEMCTL 25 -#define AUR_SEMGET 26 -#define AUR_SEMOP 27 -#define AUR_SHMAT 28 -#define AUR_SHMCTL 29 -#define AUR_SHMDT 30 -#define AUR_SHMGET 31 -#define AUR_SOCKET 32 -#define AUR_PTRACE 33 -#define AUR_KILL 34 -#define AUR_KILLPG 35 -#define AUR_EXECVE 36 -#define AUR_CORE 37 -#define AUR_ADJTIME 38 -#define AUR_SETTIMEOFDAY 39 -#define AUR_SETHOSTNAME 40 -#define AUR_SETDOMAINNAME 41 -#define AUR_REBOOT 42 -#define AUR_REBOOTFAIL 43 -#define AUR_SYSACCT 44 -#define AUR_MOUNT_UFS 45 -#define AUR_MOUNT_NFS 46 -#define AUR_MOUNT 47 -#define AUR_UNMOUNT 48 -#define AUR_READLINK 49 -#define AUR_QUOTA_ON 50 -#define AUR_QUOTA_OFF 51 -#define AUR_QUOTA_SET 52 -#define AUR_QUOTA_LIM 53 -#define AUR_QUOTA_SYNC 54 -#define AUR_QUOTA 55 -#define AUR_STATFS 56 -#define AUR_CHROOT 57 -#define AUR_TEXT 58 -#define AUR_CHDIR 59 -#define AUR_MSGCTLRMID 60 -#define AUR_SEMCTL3 61 -#define AUR_SEMCTLALL 62 -#define AUR_SHMCTLRMID 63 - -#define AUR_TRAILER 1000 - -/* - * The classes of audit events - */ -#define AU_DREAD 0x00000001 -#define AU_DWRITE 0x00000002 -#define AU_DACCESS 0x00000004 -#define AU_DCREATE 0x00000008 -#define AU_LOGIN 0x00000010 -#define AU_SREAD 0x00000020 -#define AU_SCTL 0x00000040 -#define AU_MINPRIV 0x00000080 -#define AU_MAJPRIV 0x00000100 -#define AU_ADMIN 0x00000200 -#define AU_ASSIGN 0x00000400 - -/* - * Success and failure are defined here because not everyone agrees on - * which values rate success and which failure. - */ -#define AU_EITHER -1 -#define AU_SUCCESS 0 -#define AU_FAILURE 1 - -/* - * The user id -2(0xfffe) is never audited - in fact, a setauid(AU_NOAUDITID) - * will turn off auditing. - */ -#define AU_NOAUDITID -2 - -/* - * The sturcture of the audit state - */ -struct audit_state { - unsigned int as_success; /* success bits */ - unsigned int as_failure; /* failure bits */ -}; -typedef struct audit_state audit_state_t; - -/* - * The audit file header structure. - * In the file it will be followed by a path name, the length of which is - * kept in the ah_namelen field. - */ -struct audit_header { - int ah_magic; /* magic number */ - time_t ah_time; /* the time */ - short ah_namelen; /* length of file name */ -}; -typedef struct audit_header audit_header_t; - -/* - * The audit file trailer record structure. - * In the file it will be followed by a path name, the length of which is - * kept in the at_namelen field. - */ -struct audit_trailer { - short at_record_size; /* size of this */ - short at_record_type; /* its type, a trailer */ - time_t at_time; /* the time */ - short at_namelen; /* length of file name */ -}; -typedef struct audit_trailer audit_trailer_t; - -/* - * The audit file record structure. - * au_record_size is the size of the entire record. - * au_param_count is the number of data items which follow the record. - * There is a short ( 16 bit ) length for each of the following - * parameters, then the parameters themselves. There is no way to know - * what the parameters are from the data, unless the au_record_type - * is understood. - * The first parameter is the group list, hence au_param_count will - * always be at least one. - */ -struct audit_record { - short au_record_size; /* size of this */ - short au_record_type; /* its type */ - unsigned int au_event; /* the event */ - time_t au_time; /* the time */ - uid_t au_uid; /* real uid */ - uid_t au_auid; /* audit uid */ - uid_t au_euid; /* effective */ - gid_t au_gid; /* real group */ - short au_pid; /* process id */ - int au_errno; /* error code */ - int au_return; /* a return value */ - blabel_t au_label; /* also ... */ - short au_param_count; /* # of parameters */ -}; -typedef struct audit_record audit_record_t; - -/* - * This structure controls a buffer for generating full pathnames - * for filenames. - */ -struct au_path_s { - u_int ap_size; /* Size of buffer */ - caddr_t ap_buf; /* Address of buffer */ - caddr_t ap_ptr; /* Current position */ -}; -typedef struct au_path_s au_path_t; - -#define AU_ALIGN(x) (((x) + 1) & ~1) - -#endif /*!_sys_audit_h*/ diff --git a/usr/src/lib/libbc/inc/include/sys/des.h b/usr/src/lib/libbc/inc/include/sys/des.h deleted file mode 100644 index 795e3b0544..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/des.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _sys_des_h -#define _sys_des_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Generic DES driver interface - * Keep this file hardware independent! - */ - -#define DES_MAXLEN 65536 /* maximum # of bytes to encrypt */ -#define DES_QUICKLEN 16 /* maximum # of bytes to encrypt quickly */ - -enum desdir { ENCRYPT, DECRYPT }; -enum desmode { CBC, ECB }; - -/* - * parameters to ioctl call - */ -struct desparams { - u_char des_key[8]; /* key (with low bit parity) */ - enum desdir des_dir; /* direction */ - enum desmode des_mode; /* mode */ - u_char des_ivec[8]; /* input vector */ - unsigned des_len; /* number of bytes to crypt */ - union { - u_char UDES_data[DES_QUICKLEN]; - u_char *UDES_buf; - } UDES; -#define des_data UDES.UDES_data /* direct data here if quick */ -#define des_buf UDES.UDES_buf /* otherwise, pointer to data */ -}; - -/* - * Encrypt an arbitrary sized buffer - */ -#define DESIOCBLOCK _IOWR('d', 6, struct desparams) - -/* - * Encrypt of small amount of data, quickly - */ -#define DESIOCQUICK _IOWR('d', 7, struct desparams) - -#endif /* !_sys_des_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/dir.h b/usr/src/lib/libbc/inc/include/sys/dir.h deleted file mode 100644 index afc1f77fd0..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/dir.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Filesystem-independent directory information. - * Directory entry structures are of variable length. - * Each directory entry is a struct direct containing its file number, the - * offset of the next entry (a cookie interpretable only the filesystem - * type that generated it), the length of the entry, and the length of the - * name contained in the entry. These are followed by the name. The - * entire entry is padded with null bytes to a 4 byte boundary. All names - * are guaranteed null terminated. The maximum length of a name in a - * directory is MAXNAMLEN, plus a null byte. - * Note: this file is present only for backwards compatibility. It is superseded - * by the files /usr/include/dirent.h and /usr/include/sys/dirent.h. It will - * disappear in a future major release. - */ - -#ifndef _sys_dir_h -#define _sys_dir_h - -#define MAXNAMLEN 255 - -struct direct { - off_t d_off; /* offset of next disk directory entry */ - u_long d_fileno; /* file number of entry */ - u_short d_reclen; /* length of this record */ - u_short d_namlen; /* length of string in d_name */ - char d_name[MAXNAMLEN + 1]; /* name (up to MAXNAMLEN + 1) */ -}; - -/* - * The macro DIRSIZ(dp) gives the minimum amount of space required to represent - * a directory entry. For any directory entry dp->d_reclen >= DIRSIZ(dp). - * Specific filesystem typesm may use this macro to construct the value - * for d_reclen. - */ -#undef DIRSIZ -#define DIRSIZ(dp) \ - (((sizeof (struct direct) - (MAXNAMLEN+1) + ((dp)->d_namlen+1)) + 3) & ~3) - -#ifndef KERNEL -#define d_ino d_fileno /* compatability */ - - -/* - * Definitions for library routines operating on directories. - */ - -typedef struct _dirdesc { - int dd_fd; /* file descriptor */ - long dd_loc; /* buf offset of entry from last readddir() */ - long dd_size; /* amount of valid data in buffer */ - long dd_bsize; /* amount of entries read at a time */ - long dd_off; /* Current offset in dir (for telldir) */ - char *dd_buf; /* directory data buffer */ -} DIR; - -#ifndef NULL -#define NULL 0 -#endif -extern DIR *opendir(); -extern struct direct *readdir(); -extern long telldir(); -extern void seekdir(); -#define rewinddir(dirp) seekdir((dirp), (long)0) -extern int closedir(); -#endif - -#endif /*!_sys_dir_h*/ diff --git a/usr/src/lib/libbc/inc/include/sys/dirent.h b/usr/src/lib/libbc/inc/include/sys/dirent.h deleted file mode 100644 index f4a154290a..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/dirent.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Filesystem-independent directory information. - * Directory entry structures are of variable length. - * Each directory entry is a struct dirent containing its file number, the - * offset of the next entry (a cookie interpretable only the filesystem - * type that generated it), the length of the entry, and the length of the - * name contained in the entry. These are followed by the name. The - * entire entry is padded with null bytes to a 4 byte boundary. All names - * are guaranteed null terminated. The maximum length of a name in a - * directory is MAXNAMLEN, plus a null byte. - */ - -#ifndef __sys_dirent_h -#define __sys_dirent_h - -struct dirent { - off_t d_off; /* offset of next disk dir entry */ - unsigned long d_fileno; /* file number of entry */ - unsigned short d_reclen; /* length of this record */ - unsigned short d_namlen; /* length of string in d_name */ - char d_name[255+1]; /* name (up to MAXNAMLEN + 1) */ -}; - -#ifndef _POSIX_SOURCE -/* - * It's unlikely to change, but make sure that sizeof d_name above is - * at least MAXNAMLEN + 1 (more may be added for padding). - */ -#define MAXNAMLEN 255 -/* - * The macro DIRSIZ(dp) gives the minimum amount of space required to represent - * a directory entry. For any directory entry dp->d_reclen >= DIRSIZ(dp). - * Specific filesystem types may use this macro to construct the value - * for d_reclen. - */ -#undef DIRSIZ -#define DIRSIZ(dp) \ - (((sizeof(struct dirent) - (MAXNAMLEN+1) + ((dp)->d_namlen+1)) +3) & ~3) - -#endif /* !_POSIX_SOURCE */ -#endif /* !__sys_dirent_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/errno.h b/usr/src/lib/libbc/inc/include/sys/errno.h deleted file mode 100644 index 5d45616601..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/errno.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1993 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * If error codes are added or changed here, they should be updated in - * /usr/src/lib/libc/gen/common/errlst.c as well. - */ - -/* - * Error codes - */ - -#ifndef _sys_errno_h -#define _sys_errno_h - -#define EPERM 1 /* Not owner */ -#define ENOENT 2 /* No such file or directory */ -#define ESRCH 3 /* No such process */ -#define EINTR 4 /* Interrupted system call */ -#define EIO 5 /* I/O error */ -#define ENXIO 6 /* No such device or address */ -#define E2BIG 7 /* Arg list too long */ -#define ENOEXEC 8 /* Exec format error */ -#define EBADF 9 /* Bad file number */ -#define ECHILD 10 /* No children */ -#define EAGAIN 11 /* No more processes */ -#define ENOMEM 12 /* Not enough core */ -#define EACCES 13 /* Permission denied */ -#define EFAULT 14 /* Bad address */ -#define ENOTBLK 15 /* Block device required */ -#define EBUSY 16 /* Mount device busy */ -#define EEXIST 17 /* File exists */ -#define EXDEV 18 /* Cross-device link */ -#define ENODEV 19 /* No such device */ -#define ENOTDIR 20 /* Not a directory*/ -#define EISDIR 21 /* Is a directory */ -#define EINVAL 22 /* Invalid argument */ -#define ENFILE 23 /* File table overflow */ -#define EMFILE 24 /* Too many open files */ -#define ENOTTY 25 /* Not a typewriter */ -#define ETXTBSY 26 /* Text file busy */ -#define EFBIG 27 /* File too large */ -#define ENOSPC 28 /* No space left on device */ -#define ESPIPE 29 /* Illegal seek */ -#define EROFS 30 /* Read-only file system */ -#define EMLINK 31 /* Too many links */ -#define EPIPE 32 /* Broken pipe */ - -/* math software */ -#define EDOM 33 /* Argument too large */ -#define ERANGE 34 /* Result too large */ - -/* non-blocking and interrupt i/o */ -#define EWOULDBLOCK 35 /* Operation would block */ -#define EINPROGRESS 36 /* Operation now in progress */ -#define EALREADY 37 /* Operation already in progress */ -/* ipc/network software */ - - /* argument errors */ -#define ENOTSOCK 38 /* Socket operation on non-socket */ -#define EDESTADDRREQ 39 /* Destination address required */ -#define EMSGSIZE 40 /* Message too long */ -#define EPROTOTYPE 41 /* Protocol wrong type for socket */ -#define ENOPROTOOPT 42 /* Protocol not available */ -#define EPROTONOSUPPORT 43 /* Protocol not supported */ -#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ -#define EOPNOTSUPP 45 /* Operation not supported on socket */ -#define EPFNOSUPPORT 46 /* Protocol family not supported */ -#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */ -#define EADDRINUSE 48 /* Address already in use */ -#define EADDRNOTAVAIL 49 /* Can't assign requested address */ - - /* operational errors */ -#define ENETDOWN 50 /* Network is down */ -#define ENETUNREACH 51 /* Network is unreachable */ -#define ENETRESET 52 /* Network dropped connection on reset */ -#define ECONNABORTED 53 /* Software caused connection abort */ -#define ECONNRESET 54 /* Connection reset by peer */ -#define ENOBUFS 55 /* No buffer space available */ -#define EISCONN 56 /* Socket is already connected */ -#define ENOTCONN 57 /* Socket is not connected */ -#define ESHUTDOWN 58 /* Can't send after socket shutdown */ -#define ETOOMANYREFS 59 /* Too many references: can't splice */ -#define ETIMEDOUT 60 /* Connection timed out */ -#define ECONNREFUSED 61 /* Connection refused */ - - /* */ -#define ELOOP 62 /* Too many levels of symbolic links */ -#define ENAMETOOLONG 63 /* File name too long */ - -/* should be rearranged */ -#define EHOSTDOWN 64 /* Host is down */ -#define EHOSTUNREACH 65 /* No route to host */ -#define ENOTEMPTY 66 /* Directory not empty */ - -/* quotas & mush */ -#define EPROCLIM 67 /* Too many processes */ -#define EUSERS 68 /* Too many users */ -#define EDQUOT 69 /* Disc quota exceeded */ - -/* Network File System */ -#define ESTALE 70 /* Stale NFS file handle */ -#define EREMOTE 71 /* Too many levels of remote in path */ - -/* streams */ -#define ENOSTR 72 /* Device is not a stream */ -#define ETIME 73 /* Timer expired */ -#define ENOSR 74 /* Out of streams resources */ -#define ENOMSG 75 /* No message of desired type */ -#define EBADMSG 76 /* Trying to read unreadable message */ - -/* SystemV IPC */ -#define EIDRM 77 /* Identifier removed */ - -/* SystemV Record Locking */ -#define EDEADLK 78 /* Deadlock condition. */ -#define ENOLCK 79 /* No record locks available. */ - -/* POSIX */ -#define ENOSYS 90 /* function not implemented */ - -#endif /*!_sys_errno_h*/ diff --git a/usr/src/lib/libbc/inc/include/sys/exec.h b/usr/src/lib/libbc/inc/include/sys/exec.h deleted file mode 100644 index bb0b450dd4..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/exec.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1985 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _sys_exec_h -#define _sys_exec_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * format of the exec header - * known by kernel and by user programs - */ -struct exec { - unsigned char a_dynamic:1; /* has a __DYNAMIC */ - unsigned char a_toolversion:7;/* version of toolset used to create this file */ - unsigned char a_machtype; /* machine type */ - unsigned short a_magic; /* magic number */ - unsigned long a_text; /* size of text segment */ - unsigned long a_data; /* size of initialized data */ - unsigned long a_bss; /* size of uninitialized data */ - unsigned long a_syms; /* size of symbol table */ - unsigned long a_entry; /* entry point */ - unsigned long a_trsize; /* size of text relocation */ - unsigned long a_drsize; /* size of data relocation */ -}; - -#define OMAGIC 0407 /* old impure format */ -#define NMAGIC 0410 /* read-only text */ -#define ZMAGIC 0413 /* demand load format */ - -/* machine types */ - -#define M_OLDSUN2 0 /* old sun-2 executable files */ -#define M_68010 1 /* runs on either 68010 or 68020 */ -#define M_68020 2 /* runs only on 68020 */ -#define M_SPARC 3 /* runs only on SPARC */ - -#define TV_SUN2_SUN3 0 -#define TV_SUN4 1 - -#endif /* !_sys_exec_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/fcntl.h b/usr/src/lib/libbc/inc/include/sys/fcntl.h deleted file mode 100644 index 9bdb987b35..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/fcntl.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* @(#)fcntl.h 1.6 88/02/08 SMI */ - -#ifndef _FCNTL_ -#define _FCNTL_ - -#include <sys/fcntlcom.h> - -#define O_NDELAY _FNDELAY /* Non-blocking I/O (4.2 style) */ - -#endif /* !_FCNTL_ */ diff --git a/usr/src/lib/libbc/inc/include/sys/fcntlcom.h b/usr/src/lib/libbc/inc/include/sys/fcntlcom.h deleted file mode 100644 index 8caf65e2a3..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/fcntlcom.h +++ /dev/null @@ -1,193 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2016 Gary Mills - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef __SYS_FCNTLCOM_H -#define __SYS_FCNTLCOM_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Rewack the FXXXXX values as _FXXXX so that _POSIX_SOURCE works. - */ -#define _FOPEN (-1) /* from sys/file.h, kernel use only */ -#define _FREAD 0x0001 /* read enabled */ -#define _FWRITE 0x0002 /* write enabled */ -#define _FNDELAY 0x0004 /* non blocking I/O (4.2 style) */ -#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */ -#define _FMARK 0x0010 /* internal; mark during gc() */ -#define _FDEFER 0x0020 /* internal; defer for next gc pass */ -#define _FASYNC 0x0040 /* signal pgrp when data ready */ -#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */ -#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */ -#define _FCREAT 0x0200 /* open with file create */ -#define _FTRUNC 0x0400 /* open with truncation */ -#define _FEXCL 0x0800 /* error on open if file exists */ -#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */ -#define _FSYNC 0x2000 /* do all writes synchronously */ -#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */ -#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */ - -#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) - -/* - * Flag values for open(2) and fcntl(2) - * The kernel adds 1 to the open modes to turn it into some - * combination of FREAD and FWRITE. - */ -#define O_RDONLY 0 /* +1 == FREAD */ -#define O_WRONLY 1 /* +1 == FWRITE */ -#define O_RDWR 2 /* +1 == FREAD|FWRITE */ -#define O_APPEND _FAPPEND -#define O_CREAT _FCREAT -#define O_TRUNC _FTRUNC -#define O_EXCL _FEXCL -/* O_SYNC _FSYNC not posix, defined below */ -/* O_NDELAY _FNDELAY set in include/fcntl.h */ -/* O_NDELAY _FNBIO set in 5include/fcntl.h */ -#define O_NONBLOCK _FNONBLOCK -#define O_NOCTTY _FNOCTTY - -#ifndef _POSIX_SOURCE - -#define O_SYNC _FSYNC - -/* - * Flags that work for fcntl(fd, F_SETFL, FXXXX) - */ -#define FAPPEND _FAPPEND -#define FSYNC _FSYNC -#define FASYNC _FASYNC -#define FNBIO _FNBIO -#define FNONBIO _FNONBLOCK /* XXX fix to be NONBLOCK everywhere */ -#define FNDELAY _FNDELAY - -/* - * Flags that are disallowed for fcntl's (FCNTLCANT); - * used for opens, internal state, or locking. - */ -#define FREAD _FREAD -#define FWRITE _FWRITE -#define FMARK _FMARK -#define FDEFER _FDEFER -#define FSHLOCK _FSHLOCK -#define FEXLOCK _FEXLOCK - -/* - * The rest of the flags, used only for opens - */ -#define FOPEN _FOPEN -#define FCREAT _FCREAT -#define FTRUNC _FTRUNC -#define FEXCL _FEXCL -#define FNOCTTY _FNOCTTY - -#endif /* !_POSIX_SOURCE */ - -/* XXX close on exec request; must match UF_EXCLOSE in user.h */ -#define FD_CLOEXEC 1 /* posix */ - -/* fcntl(2) requests */ -#define F_DUPFD 0 /* Duplicate fildes */ -#define F_GETFD 1 /* Get fildes flags (close on exec) */ -#define F_SETFD 2 /* Set fildes flags (close on exec) */ -#define F_GETFL 3 /* Get file flags */ -#define F_SETFL 4 /* Set file flags */ -#ifndef _POSIX_SOURCE -#define F_GETOWN 5 /* Get owner - for ASYNC */ -#define F_SETOWN 6 /* Set owner - for ASYNC */ -#endif /* !_POSIX_SOURCE */ -#define F_GETLK 7 /* Get record-locking information */ -#define F_SETLK 8 /* Set or Clear a record-lock (Non-Blocking) */ -#define F_SETLKW 9 /* Set or Clear a record-lock (Blocking) */ -#ifndef _POSIX_SOURCE -#define F_CNVT 12 /* Convert a fhandle to an open fd */ -#endif /* !_POSIX_SOURCE */ - -/* Needed by flock.c */ -#define F_FLOCKW F_SETLKW -#define F_FLOCK F_SETLK - -/* fcntl(2) flags (l_type field of flock structure) */ -#define F_RDLCK 1 /* read lock */ -#define F_WRLCK 2 /* write lock */ -#define F_UNLCK 3 /* remove lock(s) */ -#ifndef _POSIX_SOURCE -#define F_UNLKSYS 4 /* remove remote locks for a given system */ -#endif /* !_POSIX_SOURCE */ - -/* needed for _syscall(SYS_openat, AT_FDCWD, ...) */ -#define AT_FDCWD 0xffd19553 -#define AT_SYMLINK_NOFOLLOW 0x1000 -#define AT_REMOVEDIR 0x1 - -#include <sys/stdtypes.h> - -/* file segment locking set data type - information passed to system by user */ -struct flock { - short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */ - short l_whence; /* flag to choose starting offset */ - long l_start; /* relative offset, in bytes */ - long l_len; /* length, in bytes; 0 means lock to EOF */ - short l_pid; /* returned with F_GETLK */ - short l_xxx; /* reserved for future use */ -}; - -#ifndef _POSIX_SOURCE -/* extended file segment locking set data type */ -struct eflock { - short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */ - short l_whence; /* flag to choose starting offset */ - long l_start; /* relative offset, in bytes */ - long l_len; /* length, in bytes; 0 means lock to EOF */ - short l_pid; /* returned with F_GETLK */ - short l_xxx; /* reserved for future use */ - long l_rpid; /* Remote process id wanting this lock */ - long l_rsys; /* Remote system id wanting this lock */ -}; -#endif /* !_POSIX_SOURCE */ - -#ifndef KERNEL -#include <sys/stat.h> /* sigh. for the mode bits for open/creat */ - -int open(/* char *path, int flags, mode_t modes */); -int creat(/* char *path, mode_t modes */); -int fcntl(/* int fd, cmd, ... */); -#endif /* !KERNEL */ - -#ifdef __cplusplus -} -#endif - -#endif /* __SYS_FCNTLCOM_H */ diff --git a/usr/src/lib/libbc/inc/include/sys/file.h b/usr/src/lib/libbc/inc/include/sys/file.h deleted file mode 100644 index 60105370d2..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/file.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. - */ - -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef __SYS_FILE_H -#define __SYS_FILE_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef KERNEL -/* - * Descriptor table entry. - * One for each kernel object. - */ -struct file { - int f_flag; /* see below */ - short f_type; /* descriptor type */ - short f_count; /* reference count */ - short f_msgcount; /* references from message queue */ - struct fileops { - int (*fo_rw)(); - int (*fo_ioctl)(); - int (*fo_select)(); - int (*fo_close)(); - } *f_ops; - caddr_t f_data; /* ptr to file specific struct (vnode/socket) */ - off_t f_offset; - struct ucred *f_cred; /* credentials of user who opened file */ -}; - -struct file *file, *fileNFILE; -int nfile; -struct file *getf(); -struct file *falloc(); -#endif /* KERNEL */ - -#include <sys/fcntlcom.h> - -/* - * bits to save after an open. The no delay bits mean "don't wait for - * carrier at open" in all cases. Sys5 & POSIX save the no delay bits, - * using them to also mean "don't block on reads"; BSD has you reset it - * with an fcntl() if you want the "don't block on reads" behavior. - */ -#define FMASK (FREAD|FWRITE|FAPPEND|FSYNC|FNBIO|FNONBIO) -#define FCNTLCANT (FREAD|FWRITE|FMARK|FDEFER|FSHLOCK|FEXLOCK) - -/* - * User definitions. - */ - -/* - * Flock call. - */ -#define LOCK_SH 1 /* shared lock */ -#define LOCK_EX 2 /* exclusive lock */ -#define LOCK_NB 4 /* don't block when locking */ -#define LOCK_UN 8 /* unlock */ - -/* - * Access call. Also maintained in unistd.h - */ -#define F_OK 0 /* does file exist */ -#define X_OK 1 /* is it executable by caller */ -#define W_OK 2 /* writable by caller */ -#define R_OK 4 /* readable by caller */ - -/* - * Lseek call. Also maintained in 5include/stdio.h and sys/unistd.h as SEEK_* - */ -#define L_SET 0 /* absolute offset */ -#define L_INCR 1 /* relative to current offset */ -#define L_XTND 2 /* relative to end of file */ - -#ifdef KERNEL -#define GETF(fp, fd) { \ - if ((fd) < 0 || (fd) > u.u_lastfile || \ - ((fp) = u.u_ofile[fd]) == NULL) { \ - u.u_error = EBADF; \ - return; \ - } \ -} - -#define DTYPE_VNODE 1 /* file */ -#define DTYPE_SOCKET 2 /* communications endpoint */ -#endif /* KERNEL */ - -#ifdef __cplusplus -} -#endif - -#endif /* __SYS_FILE_H */ diff --git a/usr/src/lib/libbc/inc/include/sys/filio.h b/usr/src/lib/libbc/inc/include/sys/filio.h deleted file mode 100644 index 4e87bf2494..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/filio.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef _sys_filio_h -#define _sys_filio_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * General file ioctl definitions. - */ - -#include <sys/ioccom.h> - -#define FIOCLEX _IO('f', 1) /* set exclusive use on fd */ -#define FIONCLEX _IO('f', 2) /* remove exclusive use */ -/* another local */ -#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */ -#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */ -#define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */ -#define FIOSETOWN _IOW('f', 124, int) /* set owner */ -#define FIOGETOWN _IOR('f', 123, int) /* get owner */ - -#endif /* !_sys_filio_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/ieeefp.h b/usr/src/lib/libbc/inc/include/sys/ieeefp.h deleted file mode 100644 index 1f7b26f7e8..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/ieeefp.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1987 by Sun Microsystems, Inc. - */ - -/* - * Definitions for constants and types for IEEE floating point. - */ - -#ifndef _sys_ieeefp_h -#define _sys_ieeefp_h - - -/* Sun TYPES for IEEE floating point. */ - -#ifdef sparc -enum fp_direction_type /* rounding direction */ - { - fp_nearest = 0, - fp_tozero = 1, - fp_positive = 2, - fp_negative = 3 - } ; -#endif -#ifdef i386 -enum fp_direction_type /* rounding direction */ - { - fp_nearest = 0, - fp_negative = 1, - fp_positive = 2, - fp_tozero = 3 - } ; -#endif -#ifdef mc68000 -enum fp_direction_type /* rounding direction */ - { - fp_nearest = 0, - fp_tozero = 1, - fp_negative = 2, - fp_positive = 3 - } ; -#endif - -#ifdef i386 -enum fp_precision_type /* extended rounding precision */ - { - fp_single = 0, - fp_precision_3 = 1, - fp_double = 2, - fp_extended = 3 - } ; -#else -enum fp_precision_type /* extended rounding precision */ - { - fp_extended = 0, - fp_single = 1, - fp_double = 2, - fp_precision_3 = 3 - } ; -#endif - -#ifdef i386 -enum fp_exception_type /* exceptions according to bit number */ - { - fp_invalid = 0, - fp_denormalized = 1, - fp_division = 2, - fp_overflow = 3, - fp_underflow = 4, - fp_inexact = 5 - } ; -#else -enum fp_exception_type /* exceptions according to bit number */ - { - fp_inexact = 0, - fp_division = 1, - fp_underflow = 2, - fp_overflow = 3, - fp_invalid = 4 - } ; -#endif - -enum fp_class_type /* floating-point classes */ - { - fp_zero = 0, - fp_subnormal = 1, - fp_normal = 2, - fp_infinity = 3, - fp_quiet = 4, - fp_signaling = 5 - } ; - -#endif /*!_sys_ieeefp_h*/ diff --git a/usr/src/lib/libbc/inc/include/sys/ioccom.h b/usr/src/lib/libbc/inc/include/sys/ioccom.h deleted file mode 100644 index 0d7029ae4b..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/ioccom.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef __sys_ioccom_h -#define __sys_ioccom_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Ioctl's have the command encoded in the lower word, - * and the size of any in or out parameters in the upper - * word. The high 2 bits of the upper word are used - * to encode the in/out status of the parameter; for now - * we restrict parameters to at most 255 bytes. - */ -#define _IOCPARM_MASK 0xff /* parameters must be < 256 bytes */ -#define _IOC_VOID 0x20000000 /* no parameters */ -#define _IOC_OUT 0x40000000 /* copy out parameters */ -#define _IOC_IN 0x80000000 /* copy in parameters */ -#define _IOC_INOUT (_IOC_IN|_IOC_OUT) - -/* the 0x20000000 is so we can distinguish new ioctl's from old */ -#define _IO(x,y) (_IOC_VOID|(x<<8)|y) -#define _IOR(x,y,t) (_IOC_OUT|((sizeof(t)&_IOCPARM_MASK)<<16)|(x<<8)|y) -#define _IORN(x,y,t) (_IOC_OUT|(((t)&_IOCPARM_MASK)<<16)|(x<<8)|y) -#define _IOW(x,y,t) (_IOC_IN|((sizeof(t)&_IOCPARM_MASK)<<16)|(x<<8)|y) -#define _IOWN(x,y,t) (_IOC_IN|(((t)&_IOCPARM_MASK)<<16)|(x<<8)|y) -/* this should be _IORW, but stdio got there first */ -#define _IOWR(x,y,t) (_IOC_INOUT|((sizeof(t)&_IOCPARM_MASK)<<16)|(x<<8)|y) -#define _IOWRN(x,y,t) (_IOC_INOUT|(((t)&_IOCPARM_MASK)<<16)|(x<<8)|y) - -/* - * Registry of ioctl characters, culled from system sources - * - * char file where defined notes - * ---- ------------------ ----- - * F sun/fbio.h - * G sun/gpio.h - * H vaxif/if_hy.h - * M sundev/mcpcmd.h *overlap* - * M sys/modem.h *overlap* - * S sys/stropts.h - * T sys/termio.h -no overlap- - * T sys/termios.h -no overlap- - * V sundev/mdreg.h - * a vaxuba/adreg.h - * d sun/dkio.h -no overlap with sys/des.h- - * d sys/des.h (possible overlap) - * d vax/dkio.h (possible overlap) - * d vaxuba/rxreg.h (possible overlap) - * f sys/filio.h - * g sunwindow/win_ioctl.h -no overlap- - * g sunwindowdev/winioctl.c !no manifest constant! -no overlap- - * h sundev/hrc_common.h - * i sys/sockio.h *overlap* - * i vaxuba/ikreg.h *overlap* - * k sundev/kbio.h - * m sundev/msio.h (possible overlap) - * m sundev/msreg.h (possible overlap) - * m sys/mtio.h (possible overlap) - * n sun/ndio.h - * p net/nit_buf.h (possible overlap) - * p net/nit_if.h (possible overlap) - * p net/nit_pf.h (possible overlap) - * p sundev/fpareg.h (possible overlap) - * p sys/sockio.h (possible overlap) - * p vaxuba/psreg.h (possible overlap) - * q sun/sqz.h - * r sys/sockio.h - * s sys/sockio.h - * t sys/ttold.h (possible overlap) - * t sys/ttycom.h (possible overlap) - * v sundev/vuid_event.h *overlap* - * v sys/vcmd.h *overlap* - * - * End of Registry - */ - -#endif /* !__sys_ioccom_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/ioctl.h b/usr/src/lib/libbc/inc/include/sys/ioctl.h deleted file mode 100644 index 1920418ae5..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/ioctl.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -/* - * Ioctl definitions - */ - -#ifndef _sys_ioctl_h -#define _sys_ioctl_h - -#include <sys/ttychars.h> -#include <sys/ttydev.h> -#include <sys/ttold.h> - -#define TANDEM O_TANDEM -#define CBREAK O_CBREAK -#define LCASE O_LCASE -#define ECHO O_ECHO -#define CRMOD O_CRMOD -#define RAW O_RAW -#define ODDP O_ODDP -#define EVENP O_EVENP -#define ANYP O_ANYP -#define NLDELAY O_NLDELAY -#define NL0 O_NL0 -#define NL1 O_NL1 -#define NL2 O_NL2 -#define NL3 O_NL3 -#define TBDELAY O_TBDELAY -#define TAB0 O_TAB0 -#define TAB1 O_TAB1 -#define TAB2 O_TAB2 -#define XTABS O_XTABS -#define CRDELAY O_CRDELAY -#define CR0 O_CR0 -#define CR1 O_CR1 -#define CR2 O_CR2 -#define CR3 O_CR3 -#define VTDELAY O_VTDELAY -#define FF0 O_FF0 -#define FF1 O_FF1 -#define BSDELAY O_BSDELAY -#define BS0 O_BS0 -#define BS1 O_BS1 -#define ALLDELAY O_ALLDELAY -#define CRTBS O_CRTBS -#define PRTERA O_PRTERA -#define CRTERA O_CRTERA -#define TILDE O_TILDE -#define MDMBUF O_MDMBUF -#define LITOUT O_LITOUT -#define TOSTOP O_TOSTOP -#define FLUSHO O_FLUSHO -#define NOHANG O_NOHANG -#define L001000 O_L001000 -#define CRTKIL O_CRTKIL -#define PASS8 O_PASS8 -#define CTLECH O_CTLECH -#define PENDIN O_PENDIN -#define DECCTQ O_DECCTQ -#define NOFLSH O_NOFLSH - -#include <sys/filio.h> - -#include <sys/sockio.h> - -#endif /*!_sys_ioctl_h*/ diff --git a/usr/src/lib/libbc/inc/include/sys/ipc.h b/usr/src/lib/libbc/inc/include/sys/ipc.h deleted file mode 100644 index e0d545b10f..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/ipc.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* Common IPC Access Structure */ - -#ifndef _sys_ipc_h -#define _sys_ipc_h - -struct ipc_perm { - ushort uid; /* owner's user id */ - ushort gid; /* owner's group id */ - ushort cuid; /* creator's user id */ - ushort cgid; /* creator's group id */ - ushort mode; /* access modes */ - ushort seq; /* slot usage sequence number */ - key_t key; /* key */ -}; - -/* Common IPC Definitions. */ -/* Mode bits. */ -#define IPC_ALLOC 0100000 /* entry currently allocated */ -#define IPC_CREAT 0001000 /* create entry if key doesn't exist */ -#define IPC_EXCL 0002000 /* fail if key exists */ -#define IPC_NOWAIT 0004000 /* error if request must wait */ - -/* Keys. */ -#define IPC_PRIVATE (key_t)0 /* private key */ - -/* Control Commands. */ -#define IPC_RMID 0 /* remove identifier */ -#define IPC_SET 1 /* set options */ -#define IPC_STAT 2 /* get options */ - -#endif /*!_sys_ipc_h*/ diff --git a/usr/src/lib/libbc/inc/include/sys/label.h b/usr/src/lib/libbc/inc/include/sys/label.h deleted file mode 100644 index c89f157b3d..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/label.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * label - the security label structure - */ - -#ifndef _sys_label_h -#define _sys_label_h - -struct binary_label { - short sl_level; - char sl_categories[16]; - char sl_unused[14]; -}; - -typedef struct binary_label blabel_t; - -#endif /*!_sys_label_h*/ diff --git a/usr/src/lib/libbc/inc/include/sys/lock.h b/usr/src/lib/libbc/inc/include/sys/lock.h deleted file mode 100644 index 980761a50c..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/lock.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * flags for locking procs and texts - */ - -#ifndef _sys_lock_h -#define _sys_lock_h - -#define UNLOCK 0 -#define PROCLOCK 1 -#define TXTLOCK 2 -#define DATLOCK 4 - -#endif /*!_sys_lock_h*/ diff --git a/usr/src/lib/libbc/inc/include/sys/mman.h b/usr/src/lib/libbc/inc/include/sys/mman.h deleted file mode 100644 index b8bdd27db1..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/mman.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _sys_mman_h -#define _sys_mman_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Protections are chosen from these bits, or-ed together. - * Note - not all implementations literally provide all possible - * combinations. PROT_WRITE is often implemented as (PROT_READ | - * PROT_WRITE) and (PROT_EXECUTE as PROT_READ | PROT_EXECUTE). - * However, no implementation will permit a write to succeed - * where PROT_WRITE has not been set. Also, no implementation will - * allow any access to succeed where prot is specified as PROT_NONE. - */ -#define PROT_READ 0x1 /* pages can be read */ -#define PROT_WRITE 0x2 /* pages can be written */ -#define PROT_EXEC 0x4 /* pages can be executed */ - -#define PROT_NONE 0x0 /* pages cannot be accessed */ - -/* sharing types: must choose either SHARED or PRIVATE */ -#define MAP_SHARED 1 /* share changes */ -#define MAP_PRIVATE 2 /* changes are private */ -#define MAP_TYPE 0xf /* mask for share type */ - -/* other flags to mmap (or-ed in to MAP_SHARED or MAP_PRIVATE) */ -#define MAP_FIXED 0x10 /* user assigns address */ - -/* these flags not yet implemented */ -#define MAP_RENAME 0x20 /* rename private pages to file */ -#define MAP_NORESERVE 0x40 /* don't reserve needed swap area */ - -/* - * For the sake of backward object compatibility, we use the _MAP_NEW flag. - * This flag will be automatically or'ed in by the C library for all - * new mmap calls. Previous binaries with old mmap calls with continue - * to get 0 or -1 for return values. New mmap calls will get the mapped - * address as the return value if successful and -1 on errors. By default, - * new mmap calls automatically have the kernel assign the map address - * unless the MAP_FIXED flag is given. - */ -#define _MAP_NEW 0x80000000 /* user's should not need to use this */ - -#if !defined(LOCORE) && !defined(KERNEL) -#include <sys/types.h> - -/* - * Except for old binaries mmap() will return the resultant - * address of mapping on success and (caddr_t)-1 on error. - */ -extern caddr_t mmap(); -#endif /* !LOCORE && !KERNEL */ - -/* advice to madvise */ -#define MADV_NORMAL 0 /* no further special treatment */ -#define MADV_RANDOM 1 /* expect random page references */ -#define MADV_SEQUENTIAL 2 /* expect sequential page references */ -#define MADV_WILLNEED 3 /* will need these pages */ -#define MADV_DONTNEED 4 /* don't need these pages */ - -/* flags to msync */ -#define MS_ASYNC 0x1 /* return immediately */ -#define MS_INVALIDATE 0x2 /* invalidate caches */ - -/* functions to mctl */ -#define MC_SYNC 1 /* sync with backing store */ -#define MC_LOCK 2 /* lock pages in memory */ -#define MC_UNLOCK 3 /* unlock pages from memory */ -#define MC_ADVISE 4 /* give advice to management */ -#define MC_LOCKAS 5 /* lock address space in memory */ -#define MC_UNLOCKAS 6 /* unlock address space from memory */ - -/* flags to mlockall */ -#define MCL_CURRENT 0x1 /* lock current mappings */ -#define MCL_FUTURE 0x2 /* lock future mappings */ - -#endif /* !_sys_mman_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/mount.h b/usr/src/lib/libbc/inc/include/sys/mount.h deleted file mode 100644 index 5a087d4c80..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/mount.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1993 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _sys_mount_h -#define _sys_mount_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * mount options - */ - -#define M_RDONLY 0x01 /* mount fs read only */ -#define M_NOSUID 0x02 /* mount fs with setuid not allowed */ -#define M_NEWTYPE 0x04 /* use type string instead of int */ -#define M_GRPID 0x08 /* Old BSD group-id on create */ -#define M_REMOUNT 0x10 /* change options on an existing mount */ -#define M_NOSUB 0x20 /* Disallow mounts beneath this mount */ -#define M_MULTI 0x40 /* Do multi-component lookup on files */ -#define M_SYS5 0x80 /* Mount with Sys 5-specific semantics */ - -struct ufs_args { - char *fspec; -}; - - -#define _PC_LAST 9 /* highest value of any _PC_ */ -#define _BITS (8 * sizeof(short)) -#define _PC_N ((_PC_LAST + _BITS - 1) / _BITS) -#define _PC_ISSET(n, a) (a[(n) / _BITS] & (1 << ((n) % _BITS))) -#define _PC_SET(n, a) (a[(n) / _BITS] |= (1 << ((n) % _BITS))) -#define _PC_ERROR 0 - -struct pathcnf { - /* - * pathconf() information - */ - int pc_link_max; /* max links allowed */ - short pc_max_canon; /* max line len for a tty */ - short pc_max_input; /* input a tty can eat all once */ - short pc_name_max; /* max file name length (dir entry) */ - short pc_path_max; /* path name len (/x/y/z/...) */ - short pc_pipe_buf; /* size of a pipe (bytes) */ - cc_t pc_vdisable; /* safe char to turn off c_cc[i] */ - char pc_xxx; /* alignment padding; cc_t == char */ - short pc_mask[_PC_N]; /* see below */ -}; - - -struct nfs_args { - struct sockaddr_in *addr; /* file server address */ - caddr_t fh; /* File handle to be mounted */ - int flags; /* flags */ - int wsize; /* write size in bytes */ - int rsize; /* read size in bytes */ - int timeo; /* initial timeout in .1 secs */ - int retrans; /* times to retry send */ - char *hostname; /* server's hostname */ - int acregmin; /* attr cache file min secs */ - int acregmax; /* attr cache file max secs */ - int acdirmin; /* attr cache dir min secs */ - int acdirmax; /* attr cache dir max secs */ - char *netname; /* server's netname */ - struct pathcnf *pathconf; /* static pathconf kludge */ -}; - -/* - * NFS mount option flags - */ -#define NFSMNT_SOFT 0x001 /* soft mount (hard is default) */ -#define NFSMNT_WSIZE 0x002 /* set write size */ -#define NFSMNT_RSIZE 0x004 /* set read size */ -#define NFSMNT_TIMEO 0x008 /* set initial timeout */ -#define NFSMNT_RETRANS 0x010 /* set number of request retrys */ -#define NFSMNT_HOSTNAME 0x020 /* set hostname for error printf */ -#define NFSMNT_INT 0x040 /* allow interrupts on hard mount */ -#define NFSMNT_NOAC 0x080 /* don't cache attributes */ -#define NFSMNT_ACREGMIN 0x0100 /* set min secs for file attr cache */ -#define NFSMNT_ACREGMAX 0x0200 /* set max secs for file attr cache */ -#define NFSMNT_ACDIRMIN 0x0400 /* set min secs for dir attr cache */ -#define NFSMNT_ACDIRMAX 0x0800 /* set max secs for dir attr cache */ -#define NFSMNT_SECURE 0x1000 /* secure mount */ -#define NFSMNT_NOCTO 0x2000 /* no close-to-open consistency */ -#define NFSMNT_POSIX 0x4000 /* static pathconf kludge info */ - -#endif /* !_sys_mount_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/msg.h b/usr/src/lib/libbc/inc/include/sys/msg.h deleted file mode 100644 index e5f73a2686..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/msg.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#ifndef _sys_msg_h -#define _sys_msg_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * IPC Message Facility. - */ - -/* - * Message Operation Flags. - */ -#define MSG_NOERROR 010000 /* no error if big message */ - -/* - * Structure Definitions. - */ - -/* - * There is one msg queue id data structure for each q in the system. - */ - -struct msqid_ds { - struct ipc_perm msg_perm; /* operation permission struct */ - struct msg *msg_first; /* ptr to first message on q */ - struct msg *msg_last; /* ptr to last message on q */ - ushort msg_cbytes; /* current # bytes on q */ - ushort msg_qnum; /* # of messages on q */ - ushort msg_qbytes; /* max # of bytes on q */ - ushort msg_lspid; /* pid of last msgsnd */ - ushort msg_lrpid; /* pid of last msgrcv */ - time_t msg_stime; /* last msgsnd time */ - time_t msg_rtime; /* last msgrcv time */ - time_t msg_ctime; /* last change time */ -}; - -/* - * User message buffer template for msgsnd and msgrcv system calls. - */ - -/* HACK :: change the name when compiling the kernel to avoid conflicts */ -struct msgbuf { - long mtype; /* message type */ - char mtext[1]; /* message text */ -}; - -/* - * There is one msg structure for each message that may be in the system. - */ - -struct msg { - struct msg *msg_next; /* ptr to next message on q */ - long msg_type; /* message type */ - ushort msg_ts; /* message text size */ - ushort msg_spot; /* message text map address */ -}; - -#endif /* !_sys_msg_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/msio.h b/usr/src/lib/libbc/inc/include/sys/msio.h deleted file mode 100644 index 2fdc4a1795..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/msio.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _sundev_msio_h -#define _sundev_msio_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Mouse related ioctls - */ -#include <sys/ioccom.h> - -typedef struct { - int jitter_thresh; - int speed_law; - int speed_limit; -} Ms_parms; - -#define MSIOGETPARMS _IOR('m', 2, Ms_parms) /* get / set jitter, speed */ -#define MSIOSETPARMS _IOW('m', 3, Ms_parms) /* law, or speed limit */ - -#endif /* !_sundev_msio_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/param.h b/usr/src/lib/libbc/inc/include/sys/param.h deleted file mode 100644 index 4ac91fcb79..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/param.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef __sys_param_h -#define __sys_param_h - -/* - * Machine type dependent parameters. - */ -#include <machine/param.h> - -#define NPTEPG (NBPG/(sizeof (struct pte))) - -/* - * Machine-independent constants - */ -#define NMOUNT 40 /* est. of # mountable fs for quota calc */ -#define MSWAPX 15 /* pseudo mount table index for swapdev */ -#define MAXUPRC 25 /* max processes per user */ -#define NOFILE 256 /* max open files per process */ -#define MAXPID 30000 /* max process id */ -#define MAXUID 0xfffd /* max user id (from 60000) */ -#define MAXLINK 32767 /* max links */ -#define CANBSIZ 256 /* max size of typewriter line */ -#define VDISABLE 0 /* use this to turn off c_cc[i] */ -#define PIPE_BUF 4096 /* pipe buffer size */ -#ifndef KERNEL -/* - * HZ defines the ticks/second for system calls, eg, times(), which - * return values just in ticks; but not for getrusage(), which returns - * values in ticks*pages. HZ *must* be 60 for compatibility reasons. - */ -#define HZ 60 -#endif -#define NCARGS 0x100000 /* (absolute) max # characters in exec arglist */ -/* If NGROUPS changes, change <sys/limits.h> NGROUPS_MAX at the same time. */ -#define NGROUPS 16 /* max number groups */ - -#define NOGROUP -1 /* marker for empty group set member */ - -#ifdef KERNEL -/* - * Priorities - */ -#define PMASK 0177 -#define PCATCH 0400 /* return if sleep interrupted, don't longjmp */ -#define PSWP 0 -#define PINOD 10 -#define PAMAP 10 -#define PRIBIO 20 -#define PRIUBA 24 -#define PZERO 25 -#define PPIPE 26 -#define PVFS 27 -#define PWAIT 30 -#define PLOCK 35 -#define PSLEP 40 - -#ifdef VPIX -#define PV86 41 -#endif - -#define PFLCK 42 /* File/Record lock */ - -#define PUSER 50 - -#define NZERO 20 -#endif /* KERNEL */ - -/* - * Signals - */ -#include <sys/signal.h> - -#define ISSIG(p, flag) \ - ((p)->p_sig && ((p)->p_flag&STRC || \ - ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig(flag)) - -#define NBPW sizeof (int) /* number of bytes in an integer */ - -#ifndef NULL -#define NULL 0 -#endif -#define CMASK 0 /* default mask for file creation */ -#define NODEV (dev_t)(-1) - -#ifndef INTRLVE -/* macros replacing interleaving functions */ -#define dkblock(bp) ((bp)->b_blkno) -#define dkunit(bp) (minor((bp)->b_dev) >> 3) -#endif - -#define CBSIZE 28 /* number of chars in a clist block */ -#define CROUND 0x1F /* clist rounding; sizeof (int *) + CBSIZE-1 */ - -#if !defined(LOCORE) || !defined(KERNEL) -#include <sys/types.h> -#endif - -/* - * File system parameters and macros. - * - * The file system is made out of blocks of at most MAXBSIZE units, - * with smaller units (fragments) only in the last direct block. - * MAXBSIZE primarily determines the size of buffers in the buffer - * pool. It may be made larger without any effect on existing - * file systems; however making it smaller make make some file - * systems unmountable. - * - * Note that the blocked devices are assumed to have DEV_BSIZE - * "sectors" and that fragments must be some multiple of this size. - */ -#define MAXBSIZE 8192 -#define DEV_BSIZE 512 -#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ -#define MAXFRAG 8 - -#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ - ((unsigned)(bytes) >> DEV_BSHIFT) -#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ - ((unsigned)(db) << DEV_BSHIFT) - -/* - * Map a ``block device block'' to a file system block. - * XXX - this is currently only being used for tape drives. - */ -#define BLKDEV_IOSIZE 2048 -#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) - -/* - * MAXPATHLEN defines the longest permissable path length, - * including the terminating null, after expanding symbolic links. - * MAXSYMLINKS defines the maximum number of symbolic links - * that may be expanded in a path name. It should be set high - * enough to allow all legitimate uses, but halt infinite loops - * reasonably quickly. - */ -#define MAXPATHLEN 1024 -#define MAXSYMLINKS 20 - -/* - * bit map related macros - */ -#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) -#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) -#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) -#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) - -/* - * Macros for fast min/max. - */ -#ifndef MIN -#define MIN(a,b) (((a)<(b))?(a):(b)) -#endif -#ifndef MAX -#define MAX(a,b) (((a)>(b))?(a):(b)) -#endif - -/* - * Macros for counting and rounding. - */ -#ifdef sun386 -#define howmany(x, y) ((((u_int)(x))+(((u_int)(y))-1))/((u_int)(y))) -#define roundup(x, y) ((((u_int)(x)+((u_int)(y)-1))/(u_int)(y))*(u_int)(y)) -#else -#define howmany(x, y) (((x)+((y)-1))/(y)) -#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) -#endif - -/* - * Scale factor for scaled integers used to count - * %cpu time and load averages. - */ -#define FSHIFT 8 /* bits to right of fixed binary point */ -#define FSCALE (1<<FSHIFT) - -/* - * Maximum size of hostname recognized and stored in the kernel. - */ -#define MAXHOSTNAMELEN 64 - -#endif /* !__sys_param_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/resource.h b/usr/src/lib/libbc/inc/include/sys/resource.h deleted file mode 100644 index 33faf90733..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/resource.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef _sys_resource_h -#define _sys_resource_h - -/* - * Process priority specifications to get/setpriority. - */ -#define PRIO_MIN -20 -#define PRIO_MAX 20 - -#define PRIO_PROCESS 0 -#define PRIO_PGRP 1 -#define PRIO_USER 2 - -/* - * Resource utilization information. - */ - -#define RUSAGE_SELF 0 -#define RUSAGE_CHILDREN -1 - -struct rusage { - struct timeval ru_utime; /* user time used */ - struct timeval ru_stime; /* system time used */ - long ru_maxrss; -#define ru_first ru_ixrss - long ru_ixrss; /* XXX: 0 */ - long ru_idrss; /* XXX: sum of rm_asrss */ - long ru_isrss; /* XXX: 0 */ - long ru_minflt; /* any page faults not requiring I/O */ - long ru_majflt; /* any page faults requiring I/O */ - long ru_nswap; /* swaps */ - long ru_inblock; /* block input operations */ - long ru_oublock; /* block output operations */ - long ru_msgsnd; /* messages sent */ - long ru_msgrcv; /* messages received */ - long ru_nsignals; /* signals received */ - long ru_nvcsw; /* voluntary context switches */ - long ru_nivcsw; /* involuntary " */ -#define ru_last ru_nivcsw -}; - -/* - * Resource limits - */ -#define RLIMIT_CPU 0 /* cpu time in milliseconds */ -#define RLIMIT_FSIZE 1 /* maximum file size */ -#define RLIMIT_DATA 2 /* data size */ -#define RLIMIT_STACK 3 /* stack size */ -#define RLIMIT_CORE 4 /* core file size */ -#define RLIMIT_RSS 5 /* resident set size */ -#define RLIMIT_NOFILE 6 /* maximum descriptor index + 1 */ - -#define RLIM_NLIMITS 7 /* number of resource limits */ - -#define RLIM_INFINITY 0x7fffffff - -struct rlimit { - int rlim_cur; /* current (soft) limit */ - int rlim_max; /* maximum value for rlim_cur */ -}; - -#endif /*!_sys_resource_h*/ diff --git a/usr/src/lib/libbc/inc/include/sys/sem.h b/usr/src/lib/libbc/inc/include/sys/sem.h deleted file mode 100644 index be304cc724..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/sem.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1986 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#ifndef _sys_sem_h -#define _sys_sem_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * IPC Semaphore Facility. - */ - -/* - * Semaphore Operation Flags. - */ -#define SEM_UNDO 010000 /* set up adjust on exit entry */ - -/* - * Semctl Command Definitions. - */ - -#define GETNCNT 3 /* get semncnt */ -#define GETPID 4 /* get sempid */ -#define GETVAL 5 /* get semval */ -#define GETALL 6 /* get all semval's */ -#define GETZCNT 7 /* get semzcnt */ -#define SETVAL 8 /* set semval */ -#define SETALL 9 /* set all semval's */ - -/* - * Structure Definitions. - */ - -/* - * There is one semaphore id data structure for each set of semaphores - * in the system. - */ - -struct semid_ds { - struct ipc_perm sem_perm; /* operation permission struct */ - struct sem *sem_base; /* ptr to first semaphore in set */ - ushort sem_nsems; /* # of semaphores in set */ - time_t sem_otime; /* last semop time */ - time_t sem_ctime; /* last change time */ -}; - -/* - * There is one semaphore structure for each semaphore in the system. - */ - -struct sem { - ushort semval; /* semaphore text map address */ - short sempid; /* pid of last operation */ - ushort semncnt; /* # awaiting semval > cval */ - ushort semzcnt; /* # awaiting semval = 0 */ -}; - -/* - * User semaphore template for semop system calls. - */ - -struct sembuf { - short sem_num; /* semaphore # */ - short sem_op; /* semaphore operation */ - short sem_flg; /* operation flags */ -}; - -/* - * 'arg' argument template for semctl system calls. - */ -union semun { - int val; /* value for SETVAL */ - struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */ - ushort *array; /* array for GETALL & SETALL */ -}; - -#endif /* !_sys_sem_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/setjmp.h b/usr/src/lib/libbc/inc/include/sys/setjmp.h deleted file mode 100644 index 1954bdd08c..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/setjmp.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* from UCB 4.1 83/05/03 */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef __sparc_setjmp_h -#define __sparc_setjmp_h - -/* - * onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext). - * All else recovered by under/over(flow) handling. - */ -#define _JBLEN 9 - -typedef int jmp_buf[_JBLEN]; - -/* - * One extra word for the "signal mask saved here" flag. - */ -typedef int sigjmp_buf[_JBLEN+1]; - -int setjmp(/* jmp_buf env */); -int _setjmp(/* jmp_buf env */); -int sigsetjmp(/* sigjmp_buf env, int savemask */); -void longjmp(/* jmp_buf env, int val */); -void _longjmp(/* jmp_buf env, int val */); -void siglongjmp(/* sigjmp_buf env, int val */); - -/* - * Routines that call setjmp have strange control flow graphs, - * since a call to a routine that calls resume/longjmp will eventually - * return at the setjmp site, not the original call site. This - * utterly wrecks control flow analysis. - */ -#pragma unknown_control_flow(sigsetjmp, setjmp, _setjmp) - -#endif /* !__sparc_setjmp_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/shm.h b/usr/src/lib/libbc/inc/include/sys/shm.h deleted file mode 100644 index bf3bf80eac..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/shm.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#ifndef _sys_shm_h -#define _sys_shm_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * IPC Shared Memory Facility. - */ - -#include <sys/param.h> -/* #include <machine/mmu.h> */ - -/* - * Shared Memory Operation Flags. - */ - -#define SHM_RDONLY 010000 /* attach read-only (else read-write) */ -#define SHM_RND 020000 /* round attach address to SHMLBA */ - -/* - * Shmctl Command Definitions. - */ - -#define SHM_LOCK 3 /* Lock segment in core */ -#define SHM_UNLOCK 4 /* Unlock segment */ - -/* - * Implementation Constants. - */ -#define SHMLBA PAGESIZE /* segment low boundary address multiple */ - /* (SHMLBA must be a power of 2) */ - -/* - * Structure Definitions. - */ - -/* - * There is a shared mem id data structure for each segment in the system. - */ - -struct shmid_ds { - struct ipc_perm shm_perm; /* operation permission struct */ - uint shm_segsz; /* size of segment in bytes */ - ushort shm_lpid; /* pid of last shmop */ - ushort shm_cpid; /* pid of creator */ - ushort shm_nattch; /* number of current attaches */ - time_t shm_atime; /* last shmat time */ - time_t shm_dtime; /* last shmdt time */ - time_t shm_ctime; /* last change time */ - struct anon_map *shm_amp; /* segment anon_map pointer */ -}; - -#endif /* !_sys_shm_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/signal.h b/usr/src/lib/libbc/inc/include/sys/signal.h deleted file mode 100644 index 586222b541..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/signal.h +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1982 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef __sys_signal_h -#define __sys_signal_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <vm/faultcode.h> -#define NSIG 32 - -/* - * If any signal defines (SIG*) are added, deleted, or changed, the same - * changes must be made in /usr/include/signal.h as well. - */ -#define SIGHUP 1 /* hangup */ -#define SIGINT 2 /* interrupt */ -#define SIGQUIT 3 /* quit */ -#define SIGILL 4 /* illegal instruction (not reset when caught) */ - -#define ILL_STACK 0x00 /* bad stack */ -#define ILL_ILLINSTR_FAULT 0x02 /* illegal instruction fault */ -#define ILL_PRIVINSTR_FAULT 0x03 /* privileged instruction fault */ -/* codes from 0x80 to 0xff are software traps */ -#define ILL_TRAP_FAULT(n) ((n)+0x80) /* trap n fault */ - -#define SIGTRAP 5 /* trace trap (not reset when caught) */ -#define SIGIOT 6 /* IOT instruction */ -#define SIGABRT 6 /* used by abort, replace SIGIOT in the future */ -#define SIGEMT 7 /* EMT instruction */ - -#define EMT_TAG 0x0a /* tag overflow */ - -#define SIGFPE 8 /* floating point exception */ - -#define FPE_INTOVF_TRAP 0x1 /* integer overflow */ -#define FPE_STARTSIG_TRAP 0x2 /* process using fp */ -#define FPE_INTDIV_TRAP 0x14 /* integer divide by zero */ -#define FPE_FLTINEX_TRAP 0xc4 /* [floating inexact result] */ -#define FPE_FLTDIV_TRAP 0xc8 /* [floating divide by zero] */ -#define FPE_FLTUND_TRAP 0xcc /* [floating underflow] */ -#define FPE_FLTOPERR_TRAP 0xd0 /* [floating operand error] */ -#define FPE_FLTOVF_TRAP 0xd4 /* [floating overflow] */ - -#define SIGKILL 9 /* kill (cannot be caught or ignored) */ -/* - * The codes for SIGBUS and SIGSEGV are described in <vm/faultcode.h> - */ -#define SIGBUS 10 /* bus error */ -#define BUS_HWERR FC_HWERR /* misc hardware error (e.g. timeout) */ -#define BUS_ALIGN FC_ALIGN /* hardware alignment error */ -#define BUS_OBJERR FC_OBJERR /* object returned errno value */ -/* - * The BUS_CODE(code) will be one of the above. In the BUS_OBJERR case, - * doing a BUS_ERRNO(code) gives an errno value reported by the underlying - * file object mapped at the fault address. Note that this appears to be - * duplicated with the segmentation fault case below -- unfortunate, since - * the specification has always claimed that such errors produce SIGBUS. - * The segmentation cases are left defined as a transition aid. - */ -#define BUS_CODE(C) FC_CODE(C) -#define BUS_ERRNO(C) FC_ERRNO(C) -#define SIGSEGV 11 /* segmentation violation */ -#define SEGV_NOMAP FC_NOMAP /* no mapping at the fault address */ -#define SEGV_PROT FC_PROT /* access exceeded protections */ -#define SEGV_OBJERR FC_OBJERR /* object returned errno value */ -/* - * The SEGV_CODE(code) will be SEGV_NOMAP, SEGV_PROT, or SEGV_OBJERR. - * In the SEGV_OBJERR case, doing a SEGV_ERRNO(code) gives an errno value - * reported by the underlying file object mapped at the fault address. - */ -#define SEGV_CODE(C) FC_CODE(C) -#define SEGV_ERRNO(C) FC_ERRNO(C) -#define SIGSYS 12 /* bad argument to system call */ -#define SIGPIPE 13 /* write on a pipe with no one to read it */ -#define SIGALRM 14 /* alarm clock */ -#define SIGTERM 15 /* software termination signal from kill */ -#define SIGURG 16 /* urgent condition on IO channel */ -#define SIGSTOP 17 /* sendable stop signal not from tty */ -#define SIGTSTP 18 /* stop signal from tty */ -#define SIGCONT 19 /* continue a stopped process */ -#define SIGCHLD 20 /* to parent on child stop or exit */ -#define SIGCLD 20 /* System V name for SIGCHLD */ -#define SIGTTIN 21 /* to readers pgrp upon background tty read */ -#define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ -#define SIGIO 23 /* input/output possible signal */ -#define SIGPOLL SIGIO /* System V name for SIGIO */ -#define SIGXCPU 24 /* exceeded CPU time limit */ -#define SIGXFSZ 25 /* exceeded file size limit */ -#define SIGVTALRM 26 /* virtual time alarm */ -#define SIGPROF 27 /* profiling time alarm */ -#define SIGWINCH 28 /* window changed */ -#define SIGLOST 29 /* resource lost (eg, record-lock lost) */ -#define SIGUSR1 30 /* user defined signal 1 */ -#define SIGUSR2 31 /* user defined signal 2 */ -/* - * If addr cannot be computed it is set to SIG_NOADDR. - */ -#define SIG_NOADDR ((char *)~0) - -#if !defined(KERNEL) && !defined(LOCORE) -void (*signal())(); -/* - * Define BSD 4.1 reliable signals for SVID compatibility. - * These functions may go away in a future release. - */ -void (*sigset())(); -int sighold(); -int sigrelse(); -int sigignore(); -#endif /* !KERNEL && !LOCORE */ - -#ifndef LOCORE -/* - * Signal vector "template" used in sigvec call. - */ -struct sigvec { - void (*sv_handler)(); /* signal handler */ - int sv_mask; /* signal mask to apply */ - int sv_flags; /* see signal options below */ -}; -#define SV_ONSTACK 0x0001 /* take signal on signal stack */ -#define SV_INTERRUPT 0x0002 /* do not restart system on signal return */ -#define SV_RESETHAND 0x0004 /* reset signal handler to SIG_DFL when signal taken */ -/* - * If any SA_NOCLDSTOP or SV_NOCLDSTOP is change, the same - * changes must be made in /usr/include/signal.h as well. - */ -#define SV_NOCLDSTOP 0x0008 /* don't send a SIGCHLD on child stop */ -#define SA_ONSTACK SV_ONSTACK -#define SA_INTERRUPT SV_INTERRUPT -#define SA_RESETHAND SV_RESETHAND - -#define SA_NOCLDSTOP SV_NOCLDSTOP -#define sv_onstack sv_flags /* isn't compatibility wonderful! */ - -/* - * Structure used in sigstack call. - */ -struct sigstack { - char *ss_sp; /* signal stack pointer */ - int ss_onstack; /* current status */ -}; - -/* - * Information pushed on stack when a signal is delivered. - * This is used by the kernel to restore state following - * execution of the signal handler. It is also made available - * to the handler to allow it to properly restore state if - * a non-standard exit is performed. - */ -struct sigcontext { - int sc_onstack; /* sigstack state to restore */ - int sc_mask; /* signal mask to restore */ -#define SPARC_MAXREGWINDOW 31 /* max usable windows in sparc */ - int sc_sp; /* sp to restore */ - int sc_pc; /* pc to retore */ - int sc_npc; /* next pc to restore */ - int sc_psr; /* psr to restore */ - int sc_g1; /* register that must be restored */ - int sc_o0; - int sc_wbcnt; /* number of outstanding windows */ - char *sc_spbuf[SPARC_MAXREGWINDOW]; /* sp's for each wbuf */ - int sc_wbuf[SPARC_MAXREGWINDOW][16]; /* window save buf */ -}; -#endif /* !LOCORE */ - -#define BADSIG (void (*)())-1 - -/* - * If SIG_ERR, SIG_DFL, SIG_IGN, or SIG_HOLD are changed, the same changes - * must be made in /usr/include/signal.h as well. - */ -#define SIG_ERR (void (*)())-1 -#define SIG_DFL (void (*)())0 -#define SIG_IGN (void (*)())1 - -#define SIG_HOLD (void (*)())3 - -/* - * Macro for converting signal number to a mask suitable for sigblock(). - */ -#define sigmask(m) (1 << ((m)-1)) -/* - * signals that can't caught, blocked, or ignored - */ - -/* - * If SIG_BLOCK, SIG_UNBLOCK, or SIG_SETMASK are changed, the same changes - * must be made in /usr/include/signal.h as well. - */ -#define SIG_BLOCK 0x0001 -#define SIG_UNBLOCK 0x0002 -#define SIG_SETMASK 0x0004 - -#if !defined(LOCORE) && !defined(KERNEL) - -/* - * If changes are made to sigset_t or struct sigaction, the same changes - * must be made in /usr/include/signal.h as well. - */ -#include <sys/stdtypes.h> - -struct sigaction { - void (*sa_handler)(); - sigset_t sa_mask; - int sa_flags; -}; - -/* - * If changes are made to the function prototypes, the same changes - * must be made in /usr/include/signal.h as well. - */ -void (*signal())(); -int kill(/* pid_t p, int sig */); -int sigaction(/* int signo, - struct sigaction *act, struct sigaction *oldact */); -int sigaddset(/* sigset_t *mask, int signo */); -int sigdelset(/* sigset_t *mask, int signo */); -int sigemptyset(/* sigset_t *mask */); -int sigfillset(/* sigset_t *mask */); -int sigismember(/* sigset_t *mask, int signo */); -int sigpending(/* sigset_t *set */); -int sigprocmask(/* int how, sigset_t *set, *oldset */); -int sigsuspend(/* sigset_t *mask */); - -#endif /* !LOCORE && !KERNEL */ -#endif /* !__sys_signal_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/socket.h b/usr/src/lib/libbc/inc/include/sys/socket.h deleted file mode 100644 index 6607721e62..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/socket.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1982, 1985, 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef _sys_socket_h -#define _sys_socket_h - -/* - * Definitions related to sockets: types, address families, options. - */ - -/* - * Types - */ -#define SOCK_STREAM 1 /* stream socket */ -#define SOCK_DGRAM 2 /* datagram socket */ -#define SOCK_RAW 3 /* raw-protocol interface */ -#define SOCK_RDM 4 /* reliably-delivered message */ -#define SOCK_SEQPACKET 5 /* sequenced packet stream */ - -/* - * Option flags per-socket. - */ -#define SO_DEBUG 0x0001 /* turn on debugging info recording */ -#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ -#define SO_REUSEADDR 0x0004 /* allow local address reuse */ -#define SO_KEEPALIVE 0x0008 /* keep connections alive */ -#define SO_DONTROUTE 0x0010 /* just use interface addresses */ -#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ -#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ -#define SO_LINGER 0x0080 /* linger on close if data present */ -#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ -/* - * N.B.: The following definition is present only for compatibility - * with release 3.0. It will disappear in later releases. - */ -#define SO_DONTLINGER (~SO_LINGER) /* ~SO_LINGER */ - -/* - * Additional options, not kept in so_options. - */ -#define SO_SNDBUF 0x1001 /* send buffer size */ -#define SO_RCVBUF 0x1002 /* receive buffer size */ -#define SO_SNDLOWAT 0x1003 /* send low-water mark */ -#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ -#define SO_SNDTIMEO 0x1005 /* send timeout */ -#define SO_RCVTIMEO 0x1006 /* receive timeout */ -#define SO_ERROR 0x1007 /* get error status and clear */ -#define SO_TYPE 0x1008 /* get socket type */ - -/* - * Structure used for manipulating linger option. - */ -struct linger { - int l_onoff; /* option on/off */ - int l_linger; /* linger time */ -}; - -/* - * Level number for (get/set)sockopt() to apply to socket itself. - */ -#define SOL_SOCKET 0xffff /* options for socket level */ - -/* - * Address families. - */ -#define AF_UNSPEC 0 /* unspecified */ -#define AF_UNIX 1 /* local to host (pipes, portals) */ -#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ -#define AF_IMPLINK 3 /* arpanet imp addresses */ -#define AF_PUP 4 /* pup protocols: e.g. BSP */ -#define AF_CHAOS 5 /* mit CHAOS protocols */ -#define AF_NS 6 /* XEROX NS protocols */ -#define AF_NBS 7 /* nbs protocols */ -#define AF_ECMA 8 /* european computer manufacturers */ -#define AF_DATAKIT 9 /* datakit protocols */ -#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ -#define AF_SNA 11 /* IBM SNA */ -#define AF_DECnet 12 /* DECnet */ -#define AF_DLI 13 /* Direct data link interface */ -#define AF_LAT 14 /* LAT */ -#define AF_HYLINK 15 /* NSC Hyperchannel */ -#define AF_APPLETALK 16 /* Apple Talk */ - -#define AF_NIT 17 /* Network Interface Tap */ -#define AF_802 18 /* IEEE 802.2, also ISO 8802 */ -#define AF_OSI 19 /* umbrella for all families used - * by OSI (e.g. protosw lookup) */ -#define AF_X25 20 /* CCITT X.25 in particular */ -#define AF_OSINET 21 /* AFI = 47, IDI = 4 */ -#define AF_GOSIP 22 /* U.S. Government OSI */ - -#define AF_MAX 21 - -/* - * Structure used by kernel to store most - * addresses. - */ -struct sockaddr { - u_short sa_family; /* address family */ - char sa_data[14]; /* up to 14 bytes of direct address */ -}; - -/* - * Structure used by kernel to pass protocol - * information in raw sockets. - */ -struct sockproto { - u_short sp_family; /* address family */ - u_short sp_protocol; /* protocol */ -}; - -/* - * Protocol families, same as address families for now. - */ -#define PF_UNSPEC AF_UNSPEC -#define PF_UNIX AF_UNIX -#define PF_INET AF_INET -#define PF_IMPLINK AF_IMPLINK -#define PF_PUP AF_PUP -#define PF_CHAOS AF_CHAOS -#define PF_NS AF_NS -#define PF_NBS AF_NBS -#define PF_ECMA AF_ECMA -#define PF_DATAKIT AF_DATAKIT -#define PF_CCITT AF_CCITT -#define PF_SNA AF_SNA -#define PF_DECnet AF_DECnet -#define PF_DLI AF_DLI -#define PF_LAT AF_LAT -#define PF_HYLINK AF_HYLINK -#define PF_APPLETALK AF_APPLETALK -#define PF_NIT AF_NIT -#define PF_802 AF_802 -#define PF_OSI AF_OSI -#define PF_X25 AF_X25 -#define PF_OSINET AF_OSINET -#define PF_GOSIP AF_GOSIP - -#define PF_MAX AF_MAX - -/* - * Maximum queue length specifiable by listen. - */ -#define SOMAXCONN 5 - -/* - * Message header for recvmsg and sendmsg calls. - */ -struct msghdr { - caddr_t msg_name; /* optional address */ - int msg_namelen; /* size of address */ - struct iovec *msg_iov; /* scatter/gather array */ - int msg_iovlen; /* # elements in msg_iov */ - caddr_t msg_accrights; /* access rights sent/received */ - int msg_accrightslen; -}; - -#define MSG_OOB 0x1 /* process out-of-band data */ -#define MSG_PEEK 0x2 /* peek at incoming message */ -#define MSG_DONTROUTE 0x4 /* send without using routing tables */ - -#endif /*!_sys_socket_h*/ diff --git a/usr/src/lib/libbc/inc/include/sys/socketvar.h b/usr/src/lib/libbc/inc/include/sys/socketvar.h deleted file mode 100644 index 35e8677e20..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/socketvar.h +++ /dev/null @@ -1,176 +0,0 @@ -/* from UCB 7.3 12/30/87 */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef _sys_socketvar_h -#define _sys_socketvar_h - -/* - * Kernel structure per socket. - * Contains send and receive buffer queues, - * handle on protocol and pointer to protocol - * private data and error information. - */ -struct socket { - short so_type; /* generic type, see socket.h */ - short so_options; /* from socket call, see socket.h */ - short so_linger; /* time to linger while closing */ - short so_state; /* internal state flags SS_*, below */ - caddr_t so_pcb; /* protocol control block */ - struct protosw *so_proto; /* protocol handle */ -/* - * Variables for connection queueing. - * Socket where accepts occur is so_head in all subsidiary sockets. - * If so_head is 0, socket is not related to an accept. - * For head socket so_q0 queues partially completed connections, - * while so_q is a queue of connections ready to be accepted. - * If a connection is aborted and it has so_head set, then - * it has to be pulled out of either so_q0 or so_q. - * We allow connections to queue up based on current queue lengths - * and limit on number of queued connections for this socket. - */ - struct socket *so_head; /* back pointer to accept socket */ - struct socket *so_q0; /* queue of partial connections */ - struct socket *so_q; /* queue of incoming connections */ - short so_q0len; /* partials on so_q0 */ - short so_qlen; /* number of connections on so_q */ - short so_qlimit; /* max number queued connections */ - short so_timeo; /* connection timeout */ - u_short so_error; /* error affecting connection */ - short so_pgrp; /* pgrp for signals */ - u_long so_oobmark; /* chars to oob mark */ -/* - * Variables for socket buffering. - */ - struct sockbuf { - u_long sb_cc; /* actual chars in buffer */ - u_long sb_hiwat; /* max actual char count */ - u_long sb_mbcnt; /* chars of mbufs used */ - u_long sb_mbmax; /* max chars of mbufs to use */ - u_long sb_lowat; /* low water mark (not used yet) */ - struct mbuf *sb_mb; /* the mbuf chain */ - struct proc *sb_sel; /* process selecting read/write */ - short sb_timeo; /* timeout (not used yet) */ - short sb_flags; /* flags, see below */ - } so_rcv, so_snd; -#define SB_MAX (64*1024) /* max chars in sockbuf */ -#define SB_LOCK 0x01 /* lock on data queue (so_rcv only) */ -#define SB_WANT 0x02 /* someone is waiting to lock */ -#define SB_WAIT 0x04 /* someone is waiting for data/space */ -#define SB_SEL 0x08 /* buffer is selected */ -#define SB_COLL 0x10 /* collision selecting */ -/* - * Hooks for alternative wakeup strategies. - * These are used by kernel subsystems wishing to access the socket - * abstraction. If so_wupfunc is nonnull, it is called in place of - * wakeup any time that wakeup would otherwise be called with an - * argument whose value is an address lying within a socket structure. - */ - struct wupalt *so_wupalt; -}; - -struct wupalt { - int (*wup_func)(); /* function to call instead of wakeup */ - caddr_t wup_arg; /* argument for so_wupfunc */ - /* - * Other state information here, for example, for a stream - * connected to a socket. - */ -}; - -/* - * Socket state bits. - */ -#define SS_NOFDREF 0x001 /* no file table ref any more */ -#define SS_ISCONNECTED 0x002 /* socket connected to a peer */ -#define SS_ISCONNECTING 0x004 /* in process of connecting to peer */ -#define SS_ISDISCONNECTING 0x008 /* in process of disconnecting */ -#define SS_CANTSENDMORE 0x010 /* can't send more data to peer */ -#define SS_CANTRCVMORE 0x020 /* can't receive more data from peer */ -#define SS_RCVATMARK 0x040 /* at mark on input */ - -#define SS_PRIV 0x080 /* privileged for broadcast, raw... */ -#define SS_NBIO 0x100 /* non-blocking ops */ -#define SS_ASYNC 0x200 /* async i/o notify */ -#define SS_PIPE 0x400 /* pipe behavior for POSIX & SVID */ - - -/* - * Macros for sockets and socket buffering. - */ - -/* how much space is there in a socket buffer (so->so_snd or so->so_rcv) */ -#define sbspace(sb) \ - (MIN((int)((sb)->sb_hiwat - (sb)->sb_cc),\ - (int)((sb)->sb_mbmax - (sb)->sb_mbcnt))) - -/* do we have to send all at once on a socket? */ -#define sosendallatonce(so) \ - ((so)->so_proto->pr_flags & PR_ATOMIC) - -/* can we read something from so? */ -#define soreadable(so) \ - ((so)->so_rcv.sb_cc || ((so)->so_state & SS_CANTRCVMORE) || \ - (so)->so_qlen || (so)->so_error) - -/* can we write something to so? */ -#define sowriteable(so) \ - (sbspace(&(so)->so_snd) > 0 && \ - (((so)->so_state&SS_ISCONNECTED) || \ - ((so)->so_proto->pr_flags&PR_CONNREQUIRED)==0) || \ - ((so)->so_state & SS_CANTSENDMORE) || \ - (so)->so_error) - -/* adjust counters in sb reflecting allocation of m */ -#define sballoc(sb, m) { \ - (sb)->sb_cc += (m)->m_len; \ - (sb)->sb_mbcnt += MSIZE; \ - if ((m)->m_off > MMAXOFF) \ - (sb)->sb_mbcnt += MCLBYTES; \ -} - -/* adjust counters in sb reflecting freeing of m */ -#define sbfree(sb, m) { \ - (sb)->sb_cc -= (m)->m_len; \ - (sb)->sb_mbcnt -= MSIZE; \ - if ((m)->m_off > MMAXOFF) \ - (sb)->sb_mbcnt -= MCLBYTES; \ -} - -/* set lock on sockbuf sb */ -#define sblock(so, sb) { \ - while ((sb)->sb_flags & SB_LOCK) { \ - (sb)->sb_flags |= SB_WANT; \ - (void) sleep((caddr_t)&(sb)->sb_flags, PZERO+1); \ - } \ - (sb)->sb_flags |= SB_LOCK; \ -} - -/* release lock on sockbuf sb */ -#define sbunlock(so, sb) { \ - (sb)->sb_flags &= ~SB_LOCK; \ - if ((sb)->sb_flags & SB_WANT) { \ - (sb)->sb_flags &= ~SB_WANT; \ - if ((so)->so_wupalt) \ - (*(so)->so_wupalt->wup_func)(so, \ - (caddr_t)&(sb)->sb_flags, \ - (so)->so_wupalt->wup_arg);\ - else \ - wakeup((caddr_t)&(sb)->sb_flags); \ - } \ -} - -#define sorwakeup(so) sowakeup((so), &(so)->so_rcv) -#define sowwakeup(so) sowakeup((so), &(so)->so_snd) - -#ifdef KERNEL -struct socket *sonewconn(); -#endif - -#endif /*!_sys_socketvar_h*/ diff --git a/usr/src/lib/libbc/inc/include/sys/sockio.h b/usr/src/lib/libbc/inc/include/sys/sockio.h deleted file mode 100644 index 884399c44f..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/sockio.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef _sys_sockio_h -#define _sys_sockio_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * General socket ioctl definitions. - */ - -#include <sys/ioccom.h> - -/* socket i/o controls */ -#define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */ -#define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */ -#define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */ -#define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */ -#define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */ -#define SIOCSPGRP _IOW('s', 8, int) /* set process group */ -#define SIOCGPGRP _IOR('s', 9, int) /* get process group */ - -#define SIOCADDRT _IOW('r', 10, struct rtentry) /* add route */ -#define SIOCDELRT _IOW('r', 11, struct rtentry) /* delete route */ - -#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */ -#define SIOCGIFADDR _IOWR('i',13, struct ifreq) /* get ifnet address */ -#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */ -#define SIOCGIFDSTADDR _IOWR('i',15, struct ifreq) /* get p-p address */ -#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */ -#define SIOCGIFFLAGS _IOWR('i',17, struct ifreq) /* get ifnet flags */ -#define SIOCSIFMEM _IOW('i', 18, struct ifreq) /* set interface mem */ -#define SIOCGIFMEM _IOWR('i',19, struct ifreq) /* get interface mem */ -#define SIOCGIFCONF _IOWR('i',20, struct ifconf) /* get ifnet list */ -#define SIOCSIFMTU _IOW('i', 21, struct ifreq) /* set if_mtu */ -#define SIOCGIFMTU _IOWR('i',22, struct ifreq) /* get if_mtu */ - - /* from 4.3BSD */ -#define SIOCGIFBRDADDR _IOWR('i',23, struct ifreq) /* get broadcast addr */ -#define SIOCSIFBRDADDR _IOW('i',24, struct ifreq) /* set broadcast addr */ -#define SIOCGIFNETMASK _IOWR('i',25, struct ifreq) /* get net addr mask */ -#define SIOCSIFNETMASK _IOW('i',26, struct ifreq) /* set net addr mask */ -#define SIOCGIFMETRIC _IOWR('i',27, struct ifreq) /* get IF metric */ -#define SIOCSIFMETRIC _IOW('i',28, struct ifreq) /* set IF metric */ - -#define SIOCSARP _IOW('i', 30, struct arpreq) /* set arp entry */ -#define SIOCGARP _IOWR('i',31, struct arpreq) /* get arp entry */ -#define SIOCDARP _IOW('i', 32, struct arpreq) /* delete arp entry */ -#define SIOCUPPER _IOW('i', 40, struct ifreq) /* attach upper layer */ -#define SIOCLOWER _IOW('i', 41, struct ifreq) /* attach lower layer */ -#define SIOCSETSYNC _IOW('i', 44, struct ifreq) /* set syncmode */ -#define SIOCGETSYNC _IOWR('i', 45, struct ifreq) /* get syncmode */ -#define SIOCSSDSTATS _IOWR('i', 46, struct ifreq) /* sync data stats */ -#define SIOCSSESTATS _IOWR('i', 47, struct ifreq) /* sync error stats */ - -#define SIOCSPROMISC _IOW('i', 48, int) /* request promisc mode - on/off */ -#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* set m/c address */ -#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* clr m/c address */ - -/* FDDI controls */ -#define SIOCFDRESET _IOW('i', 51, struct ifreq) /* Reset FDDI */ -#define SIOCFDSLEEP _IOW('i', 52, struct ifreq) /* Sleep until next dnld req */ -#define SIOCSTRTFMWAR _IOW('i', 53, struct ifreq) /* Start FW at an addr */ -#define SIOCLDNSTRTFW _IOW('i', 54, struct ifreq) /* Load the shared memory */ -#define SIOCGETFDSTAT _IOW('i', 55, struct ifreq) /* Get FDDI stats */ -#define SIOCFDNMIINT _IOW('i', 56, struct ifreq) /* NMI to fddi */ -#define SIOCFDEXUSER _IOW('i', 57, struct ifreq) /* Exec in user mode */ -#define SIOCFDGNETMAP _IOW('i', 58, struct ifreq) /* Get a netmap entry */ -#define SIOCFDGIOCTL _IOW('i', 59, struct ifreq) /* Generic ioctl for fddi */ - -/* protocol i/o controls */ -#define SIOCSNIT _IOW('p', 0, struct nit_ioc) /* set nit modes */ -#define SIOCGNIT _IOWR('p', 1, struct nit_ioc) /* get nit modes */ - -#endif /* !_sys_sockio_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/stat.h b/usr/src/lib/libbc/inc/include/sys/stat.h deleted file mode 100644 index 53c80c69dd..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/stat.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2001 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef __SYS_STAT_H -#define __SYS_STAT_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * NOTE: changes to this file should also be made to xpg2include/sys/stat.h - */ - -#include <sys/types.h> - -#ifdef __cplusplus -extern "C" { -#endif - -struct stat { - dev_t st_dev; - ino_t st_ino; - mode_t st_mode; - short st_nlink; - uid_t st_uid; - gid_t st_gid; - dev_t st_rdev; - off_t st_size; - time_t st_atime; - int st_spare1; - time_t st_mtime; - int st_spare2; - time_t st_ctime; - int st_spare3; - long st_blksize; - long st_blocks; - long st_spare4[2]; -}; - -#define _IFMT 0170000 /* type of file */ -#define _IFDIR 0040000 /* directory */ -#define _IFCHR 0020000 /* character special */ -#define _IFBLK 0060000 /* block special */ -#define _IFREG 0100000 /* regular */ -#define _IFLNK 0120000 /* symbolic link */ -#define _IFSOCK 0140000 /* socket */ -#define _IFIFO 0010000 /* fifo */ - -#define S_ISUID 0004000 /* set user id on execution */ -#define S_ISGID 0002000 /* set group id on execution */ -#ifndef _POSIX_SOURCE -#define S_ISVTX 0001000 /* save swapped text even after use */ -#define S_IREAD 0000400 /* read permission, owner */ -#define S_IWRITE 0000200 /* write permission, owner */ -#define S_IEXEC 0000100 /* execute/search permission, owner */ - -#define S_ENFMT 0002000 /* enforcement-mode locking */ - -#define S_IFMT _IFMT -#define S_IFDIR _IFDIR -#define S_IFCHR _IFCHR -#define S_IFBLK _IFBLK -#define S_IFREG _IFREG -#define S_IFLNK _IFLNK -#define S_IFSOCK _IFSOCK -#define S_IFIFO _IFIFO -#endif /* !_POSIX_SOURCE */ - -#define S_IRWXU 0000700 /* rwx, owner */ -#define S_IRUSR 0000400 /* read permission, owner */ -#define S_IWUSR 0000200 /* write permission, owner */ -#define S_IXUSR 0000100 /* execute/search permission, owner */ -#define S_IRWXG 0000070 /* rwx, group */ -#define S_IRGRP 0000040 /* read permission, group */ -#define S_IWGRP 0000020 /* write permission, grougroup */ -#define S_IXGRP 0000010 /* execute/search permission, group */ -#define S_IRWXO 0000007 /* rwx, other */ -#define S_IROTH 0000004 /* read permission, other */ -#define S_IWOTH 0000002 /* write permission, other */ -#define S_IXOTH 0000001 /* execute/search permission, other */ - -#define S_ISBLK(m) (((m)&_IFMT) == _IFBLK) -#define S_ISCHR(m) (((m)&_IFMT) == _IFCHR) -#define S_ISDIR(m) (((m)&_IFMT) == _IFDIR) -#define S_ISFIFO(m) (((m)&_IFMT) == _IFIFO) -#define S_ISREG(m) (((m)&_IFMT) == _IFREG) -#ifndef _POSIX_SOURCE -#define S_ISLNK(m) (((m)&_IFMT) == _IFLNK) -#define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK) -#endif - -int chmod(char *, mode_t); -int fstat(int, struct stat *); -int mkdir(char *, mode_t); -int mkfifo(char *, mode_t); -int stat(char *, struct stat *); -mode_t umask(mode_t); - -#ifdef __cplusplus -} -#endif - -#endif /* __SYS_STAT_H */ diff --git a/usr/src/lib/libbc/inc/include/sys/stdtypes.h b/usr/src/lib/libbc/inc/include/sys/stdtypes.h deleted file mode 100644 index 687932cbb3..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/stdtypes.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1997-1998 by Sun Microsystems, Inc. - * All rights reserved. - */ - -/* - * Suppose you have an ANSI C or POSIX thingy that needs a typedef - * for thingy_t. Put it here and include this file wherever you - * define the thingy. This is used so that we don't have size_t in - * N (N > 1) different places and so that we don't have to have - * types.h included all the time and so that we can include this in - * the lint libs instead of termios.h which conflicts with ioctl.h. - */ - -#ifndef __SYS_STDTYPES_H -#define __SYS_STDTYPES_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef int sigset_t; /* signal mask - may change */ - -typedef unsigned int speed_t; /* tty speeds */ -typedef unsigned long tcflag_t; /* tty line disc modes */ -typedef unsigned char cc_t; /* tty control char */ -typedef int pid_t; /* process id */ - -typedef unsigned short mode_t; /* file mode bits */ -typedef short nlink_t; /* links to a file */ - -typedef long clock_t; /* units=ticks (typically 60/sec) */ -typedef long time_t; /* value = secs since epoch */ - -typedef int size_t; /* ??? */ -typedef int ptrdiff_t; /* result of subtracting two pointers */ - -typedef unsigned short wchar_t; /* big enough for biggest char set */ - -/* - * POSIX Extensions - */ -typedef unsigned char uchar_t; -typedef unsigned short ushort_t; -typedef unsigned int uint_t; -typedef unsigned long ulong_t; - -#ifdef __cplusplus -} -#endif - -#endif /* __SYS_STDTYPES_H */ diff --git a/usr/src/lib/libbc/inc/include/sys/stropts.h b/usr/src/lib/libbc/inc/include/sys/stropts.h deleted file mode 100644 index 20418dc439..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/stropts.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#ifndef _sys_stropts_h -#define _sys_stropts_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Read options - */ -#define RNORM 0 /* read msg norm */ -#define RMSGD 1 /* read msg discard */ -#define RMSGN 2 /* read msg no discard */ - -/* - * Flush options - */ - -#define FLUSHR 1 /* flush read queue */ -#define FLUSHW 2 /* flush write queue */ -#define FLUSHRW 3 /* flush both queues */ - -/* - * Events for which to be sent SIGPOLL signal - */ -#define S_INPUT 001 /* regular priority msg on read Q */ -#define S_HIPRI 002 /* high priority msg on read Q */ -#define S_OUTPUT 004 /* write Q no longer full */ -#define S_MSG 010 /* signal msg at front of read Q */ - -/* - * Flags for recv() and send() syscall arguments - */ -#define RS_HIPRI 1 /* send/recv high priority message */ - -/* - * Flags returned as value of recv() syscall - */ -#define MORECTL 1 /* more ctl info is left in message */ -#define MOREDATA 2 /* more data is left in message */ - -#ifndef FMNAMESZ -#define FMNAMESZ 8 -#endif - -#include <sys/ioccom.h> - -/* - * Stream Ioctl defines - */ -#define I_NREAD _IOR('S',01,int) -#define I_PUSH _IOWN('S',02,FMNAMESZ+1) -#define I_POP _IO('S',03) -#define I_LOOK _IORN('S',04,FMNAMESZ+1) -#define I_FLUSH _IO('S',05) -#define I_SRDOPT _IO('S',06) -#define I_GRDOPT _IOR('S',07,int) -#define I_STR _IOWR('S',010,struct strioctl) -#define I_SETSIG _IO('S',011) -#define I_GETSIG _IOR('S',012,int) -#define I_FIND _IOWN('S',013,FMNAMESZ+1) -#define I_LINK _IO('S',014) -#define I_UNLINK _IO('S',015) -#define I_PEEK _IOWR('S',017,struct strpeek) -#define I_FDINSERT _IOW('S',020,struct strfdinsert) -#define I_SENDFD _IO('S',021) -#define I_RECVFD _IOR('S',022,struct strrecvfd) -#define I_PLINK _IO('S',023) -#define I_PUNLINK _IO('S',024) - - -/* - * User level ioctl format for ioctl that go downstream I_STR - */ -struct strioctl { - int ic_cmd; /* command */ - int ic_timout; /* timeout value */ - int ic_len; /* length of data */ - char *ic_dp; /* pointer to data */ -}; - - -/* - * Value for timeouts (ioctl, select) that denotes infinity - */ -#define INFTIM -1 - - -/* - * Stream buffer structure for send and recv system calls - */ -struct strbuf { - int maxlen; /* no. of bytes in buffer */ - int len; /* no. of bytes returned */ - char *buf; /* pointer to data */ -}; - - -/* - * stream I_PEEK ioctl format - */ - -struct strpeek { - struct strbuf ctlbuf; - struct strbuf databuf; - long flags; -}; - -/* - * stream I_FDINSERT ioctl format - */ -struct strfdinsert { - struct strbuf ctlbuf; - struct strbuf databuf; - long flags; - int fildes; - int offset; -}; - - -/* - * receive file descriptor structure - */ -struct strrecvfd { - int fd; - unsigned short uid; - unsigned short gid; - char fill[8]; -}; - -#endif /* !_sys_stropts_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/syslog.h b/usr/src/lib/libbc/inc/include/sys/syslog.h deleted file mode 100644 index 2d8690fb53..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/syslog.h +++ /dev/null @@ -1,70 +0,0 @@ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef _sys_syslog_h -#define _sys_syslog_h - -/* - * Facility codes - */ -#define LOG_KERN (0<<3) /* kernel messages */ -#define LOG_USER (1<<3) /* random user-level messages */ -#define LOG_MAIL (2<<3) /* mail system */ -#define LOG_DAEMON (3<<3) /* system daemons */ -#define LOG_AUTH (4<<3) /* security/authorization messages */ -#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ -#define LOG_LPR (6<<3) /* line printer subsystem */ -#define LOG_NEWS (7<<3) /* netnews subsystem */ -#define LOG_UUCP (8<<3) /* uucp subsystem */ -#define LOG_CRON (15<<3) /* cron/at subsystem */ - /* other codes through 15 reserved for system use */ -#define LOG_LOCAL0 (16<<3) /* reserved for local use */ -#define LOG_LOCAL1 (17<<3) /* reserved for local use */ -#define LOG_LOCAL2 (18<<3) /* reserved for local use */ -#define LOG_LOCAL3 (19<<3) /* reserved for local use */ -#define LOG_LOCAL4 (20<<3) /* reserved for local use */ -#define LOG_LOCAL5 (21<<3) /* reserved for local use */ -#define LOG_LOCAL6 (22<<3) /* reserved for local use */ -#define LOG_LOCAL7 (23<<3) /* reserved for local use */ - -#define LOG_NFACILITIES 24 /* maximum number of facilities */ -#define LOG_FACMASK 0x03f8 /* mask to extract facility part */ - -/* - * Priorities (these are ordered) - */ -#define LOG_EMERG 0 /* system is unusable */ -#define LOG_ALERT 1 /* action must be taken immediately */ -#define LOG_CRIT 2 /* critical conditions */ -#define LOG_ERR 3 /* error conditions */ -#define LOG_WARNING 4 /* warning conditions */ -#define LOG_NOTICE 5 /* normal but signification condition */ -#define LOG_INFO 6 /* informational */ -#define LOG_DEBUG 7 /* debug-level messages */ - -#define LOG_PRIMASK 0x0007 /* mask to extract priority part (internal) */ - -/* - * arguments to setlogmask. - */ -#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ -#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ - -/* - * Option flags for openlog. - * - * LOG_ODELAY no longer does anything; LOG_NDELAY is the - * inverse of what it used to be. - */ -#define LOG_PID 0x01 /* log the pid with each message */ -#define LOG_CONS 0x02 /* log on the console if errors in sending */ -#define LOG_ODELAY 0x04 /* delay open until syslog() is called */ -#define LOG_NDELAY 0x08 /* don't delay open */ -#define LOG_NOWAIT 0x10 /* if forking to log on console, don't wait() */ - -#endif /*!_sys_syslog_h*/ diff --git a/usr/src/lib/libbc/inc/include/sys/sysmacros.h b/usr/src/lib/libbc/inc/include/sys/sysmacros.h deleted file mode 100644 index 1482b87c03..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/sysmacros.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1986 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -/* - * Portions of this source code were derived from Berkeley 4.3 BSD - * under license from the Regents of the University of California. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Major/minor device constructing/busting macros. - */ - -#ifndef _sys_sysmacros_h -#define _sys_sysmacros_h - -/* major part of a device */ -#define major(x) ((int)(((unsigned)(x)>>8)&0377)) - -/* minor part of a device */ -#define minor(x) ((int)((x)&0377)) - -/* make a device number */ -#define makedev(x,y) ((dev_t)(((x)<<8) | (y))) - -#endif /*!_sys_sysmacros_h*/ diff --git a/usr/src/lib/libbc/inc/include/sys/termio.h b/usr/src/lib/libbc/inc/include/sys/termio.h deleted file mode 100644 index 7d159ae53f..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/termio.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#ifndef _sys_termio_h -#define _sys_termio_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/ioccom.h> -#include <sys/termios.h> - -#define NCC 8 - -#define SSPEED 7 /* default speed: 300 baud */ - -/* - * Ioctl control packet - */ -struct termio { - unsigned short c_iflag; /* input modes */ - unsigned short c_oflag; /* output modes */ - unsigned short c_cflag; /* control modes */ - unsigned short c_lflag; /* line discipline modes */ - char c_line; /* line discipline */ - unsigned char c_cc[NCC]; /* control chars */ -}; - -#define TCGETA _IOR('T', 1, struct termio) -#define TCSETA _IOW('T', 2, struct termio) -#define TCSETAW _IOW('T', 3, struct termio) -#define TCSETAF _IOW('T', 4, struct termio) -#define TCSBRK _IO('T', 5) - -#endif /* !_sys_termio_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/termios.h b/usr/src/lib/libbc/inc/include/sys/termios.h deleted file mode 100644 index 6182f49fd5..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/termios.h +++ /dev/null @@ -1,278 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef __SYS_TERMIOS_H -#define __SYS_TERMIOS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/stdtypes.h> -#include <sys/ioccom.h> -#include <sys/ttydev.h> -#include <sys/ttycom.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define NCCS 17 - -/* - * control characters - * the following are not (yet) posix - * VEOL2, VSWTCH, VDSUSP, VREPRINT, VDISCARD, VWERASE, VLNEXT, VSTATUS - */ -#define VINTR 0 -#define VQUIT 1 -#define VERASE 2 -#define VKILL 3 -#define VEOF 4 -#define VEOL 5 -#ifndef _POSIX_SOURCE -#define VEOL2 6 -#define VSWTCH 7 -#endif -#define VSTART 8 -#define VSTOP 9 -#define VSUSP 10 -#ifndef _POSIX_SOURCE -#define VDSUSP 11 -#define VREPRINT 12 -#define VDISCARD 13 -#define VWERASE 14 -#define VLNEXT 15 -#define VSTATUS 16 -#endif - -#define VMIN VEOF -#define VTIME VEOL - -#ifndef _POSIX_SOURCE -#define _CTRL(c) ('c'&037) - -/* - * default control chars. - * guarded for ttychars.h. - */ -#ifndef CINTR -#define CINTR _CTRL(c) -#define CQUIT 034 /* FS, ^\ */ -#define CERASE 0177 /* DEL, ^? */ -#define CKILL _CTRL(u) -#define CEOF _CTRL(d) -#define CEOT CEOF -#define CEOL 0 -#define CEOL2 0 -#define CSWTCH 0 -#define CNSWTCH 0 -#define CSTART _CTRL(q) -#define CSTOP _CTRL(s) -#define CSUSP _CTRL(z) -#define CDSUSP _CTRL(y) -#define CRPRNT _CTRL(r) -#define CFLUSH _CTRL(o) -#define CWERASE _CTRL(w) -#define CLNEXT _CTRL(v) -#endif /* !CINTR */ - -#define CESC '\\' -#define CNUL 0 -#define CDEL 0377 -#endif /* !_POSIX_SOURCE */ - -/* input modes */ -#define IGNBRK 0x00000001 -#define BRKINT 0x00000002 -#define IGNPAR 0x00000004 -#define PARMRK 0x00000008 -#define INPCK 0x00000010 -#define ISTRIP 0x00000020 -#define INLCR 0x00000040 -#define IGNCR 0x00000080 -#define ICRNL 0x00000100 -/* IUCLC 0x00000200 not posix, defined below */ -#define IXON 0x00000400 -/* IXANY 0x00000800 not posix, defined below */ -#define IXOFF 0x00001000 -/* IMAXBEL 0x00002000 not posix, defined below */ - -#ifndef _POSIX_SOURCE -#define IUCLC 0x00000200 -#define IXANY 0x00000800 -#define IMAXBEL 0x00002000 -#endif /* !_POSIX_SOURCE */ - -/* output modes */ -#define OPOST 0x00000001 -#ifndef _POSIX_SOURCE -#define OLCUC 0x00000002 -#define ONLCR 0x00000004 -#define OCRNL 0x00000008 -#define ONOCR 0x00000010 -#define ONLRET 0x00000020 -#define OFILL 0x00000040 -#define OFDEL 0x00000080 -#define NLDLY 0x00000100 -#define NL0 0 -#define NL1 0x00000100 -#define CRDLY 0x00000600 -#define CR0 0 -#define CR1 0x00000200 -#define CR2 0x00000400 -#define CR3 0x00000600 -#define TABDLY 0x00001800 -#define TAB0 0 -#define TAB1 0x00000800 -#define TAB2 0x00001000 -#define XTABS 0x00001800 -#define TAB3 XTABS -#define BSDLY 0x00002000 -#define BS0 0 -#define BS1 0x00002000 -#define VTDLY 0x00004000 -#define VT0 0 -#define VT1 0x00004000 -#define FFDLY 0x00008000 -#define FF0 0 -#define FF1 0x00008000 -#define PAGEOUT 0x00010000 -#define WRAP 0x00020000 -#endif /* !_POSIX_SOURCE */ - -/* control modes */ -#ifndef _POSIX_SOURCE -#define CBAUD 0x0000000f -#endif -#define CSIZE 0x00000030 -#define CS5 0 -#define CS6 0x00000010 -#define CS7 0x00000020 -#define CS8 0x00000030 -#define CSTOPB 0x00000040 -#define CREAD 0x00000080 -#define PARENB 0x00000100 -#define PARODD 0x00000200 -#define HUPCL 0x00000400 -#define CLOCAL 0x00000800 -#ifndef _POSIX_SOURCE -#define LOBLK 0x00001000 -#define CIBAUD 0x000f0000 -#define CRTSXOFF 0x40000000 -#define CRTSCTS 0x80000000 -#define CBAUDEXT 0x200000 -#define CIBAUDEXT 0x400000 - -/* - * 4.4BSD flags for hardware flow control - */ -#define CRTS_IFLOW 0x40000000 -#define CCTS_OFLOW 0x80000000 - -#define IBSHIFT 16 -#endif /* !_POSIX_SOURCE */ - -/* line discipline 0 modes */ -#define ISIG 0x00000001 -#define ICANON 0x00000002 -/* XCASE 0x00000004 not posix, defined below */ -#define ECHO 0x00000008 -#define ECHOE 0x00000010 -#define ECHOK 0x00000020 -#define ECHONL 0x00000040 -#define NOFLSH 0x00000080 -#define TOSTOP 0x00000100 -/* ECHOCTL 0x00000200 not posix, defined below */ -/* ECHOPRT 0x00000400 not posix, defined below */ -/* ECHOKE 0x00000800 not posix, defined below */ -/* DEFECHO 0x00001000 not posix, defined below */ -/* FLUSHO 0x00002000 not posix, defined below */ -/* PENDIN 0x00004000 not posix, defined below */ -#define IEXTEN 0x00008000 - -#ifndef _POSIX_SOURCE -#define XCASE 0x00000004 -#define ECHOCTL 0x00000200 -#define ECHOPRT 0x00000400 -#define ECHOKE 0x00000800 -#define DEFECHO 0x00001000 -#define FLUSHO 0x00002000 -#define PENDIN 0x00004000 -#endif /* !_POSIX_SOURCE */ - -#ifndef _POSIX_SOURCE -/* - * codes 1 through 5, not shown here, are old "termio" calls - */ -#define TCXONC _IO('T', 6) -#define TCFLSH _IO('T', 7) -#define TCGETS _IOR('T', 8, struct termios) -#define TCSETS _IOW('T', 9, struct termios) -#define TCSETSW _IOW('T', 10, struct termios) -#define TCSETSF _IOW('T', 11, struct termios) -#endif /* !_POSIX_SOURCE */ - -#define TCOOFF 0 /* arg to TCXONC & tcflow() */ -#define TCOON 1 /* arg to TCXONC & tcflow() */ -#define TCIOFF 2 /* arg to TCXONC & tcflow() */ -#define TCION 3 /* arg to TCXONC & tcflow() */ -#define TCIFLUSH 0 /* arg to TCFLSH & tcflush() */ -#define TCOFLUSH 1 /* arg to TCFLSH & tcflush() */ -#define TCIOFLUSH 2 /* arg to TCFLSH & tcflush() */ -#define TCSANOW 0 /* arg to tcsetattr() */ -#define TCSADRAIN 1 /* arg to tcsetattr() */ -#define TCSAFLUSH 2 /* arg to tcsetattr() */ - -/* - * Ioctl control packet - */ -struct termios { - tcflag_t c_iflag; /* input modes */ - tcflag_t c_oflag; /* output modes */ - tcflag_t c_cflag; /* control modes */ - tcflag_t c_lflag; /* line discipline modes */ - char c_line; /* line discipline XXX */ - cc_t c_cc[NCCS]; /* control chars */ -}; - - -#ifndef KERNEL -speed_t cfgetispeed(/* struct termios *termios_p */); -speed_t cfgetospeed(/* struct termios *termios_p */); -int cfsetispeed(/* struct termios *termios_p, speed_t speed */); -int cfsetospeed(/* struct termios *termios_p, speed_t speed */); -int tcdrain(/* int fildes */); -int tcflow(/* int fildes, int action */); -int tcflush(/* int fildes, int queue_selector */); -int tcgetattr(/* int fildes, struct termios *termios_p */); -int tcsendbreak(/* int fildes, int duration */); -int tcsetattr(/* int fildes, int optional_actions, struct *termios_p */); -#endif /* !KERNEL */ - -#ifdef __cplusplus -} -#endif - -#endif /* __SYS_TERMIOS_H */ diff --git a/usr/src/lib/libbc/inc/include/sys/time.h b/usr/src/lib/libbc/inc/include/sys/time.h deleted file mode 100644 index a79fb2df9f..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/time.h +++ /dev/null @@ -1,65 +0,0 @@ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef _sys_time_h -#define _sys_time_h - -/* - * Structure returned by gettimeofday(2) system call, - * and used in other calls. - */ -struct timeval { - long tv_sec; /* seconds */ - long tv_usec; /* and microseconds */ -}; - -struct timezone { - int tz_minuteswest; /* minutes west of Greenwich */ - int tz_dsttime; /* type of dst correction */ -}; -#define DST_NONE 0 /* not on dst */ -#define DST_USA 1 /* USA style dst */ -#define DST_AUST 2 /* Australian style dst */ -#define DST_WET 3 /* Western European dst */ -#define DST_MET 4 /* Middle European dst */ -#define DST_EET 5 /* Eastern European dst */ -#define DST_CAN 6 /* Canada */ -#define DST_GB 7 /* Great Britain and Eire */ -#define DST_RUM 8 /* Rumania */ -#define DST_TUR 9 /* Turkey */ -#define DST_AUSTALT 10 /* Australian style with shift in 1986 */ - -/* - * Operations on timevals. - * - * NB: timercmp does not work for >= or <=. - */ -#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) -#define timercmp(tvp, uvp, cmp) \ - ((tvp)->tv_sec cmp (uvp)->tv_sec || \ - (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec) -#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 - -/* - * Names of the interval timers, and structure - * defining a timer setting. - */ -#define ITIMER_REAL 0 -#define ITIMER_VIRTUAL 1 -#define ITIMER_PROF 2 - -struct itimerval { - struct timeval it_interval; /* timer interval */ - struct timeval it_value; /* current value */ -}; - -#ifndef KERNEL -#include <time.h> -#endif - -#endif /*!_sys_time_h*/ diff --git a/usr/src/lib/libbc/inc/include/sys/times.h b/usr/src/lib/libbc/inc/include/sys/times.h deleted file mode 100644 index 392d2a25d3..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/times.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Structure returned by times() - */ - -#ifndef __sys_times_h -#define __sys_times_h - -#include <sys/types.h> - -struct tms { - clock_t tms_utime; /* user time */ - clock_t tms_stime; /* system time */ - clock_t tms_cutime; /* user time, children */ - clock_t tms_cstime; /* system time, children */ -}; - -#ifndef KERNEL -clock_t times(/* struct tms *tmsp */); -#endif - -#endif /* !__sys_times_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/ttold.h b/usr/src/lib/libbc/inc/include/sys/ttold.h deleted file mode 100644 index baf4817108..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/ttold.h +++ /dev/null @@ -1,198 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#ifndef _sys_ttold_h -#define _sys_ttold_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -struct tchars { - char t_intrc; /* interrupt */ - char t_quitc; /* quit */ - char t_startc; /* start output */ - char t_stopc; /* stop output */ - char t_eofc; /* end-of-file */ - char t_brkc; /* input delimiter (like nl) */ -}; - -struct ltchars { - char t_suspc; /* stop process signal */ - char t_dsuspc; /* delayed stop process signal */ - char t_rprntc; /* reprint line */ - char t_flushc; /* flush output (toggles) */ - char t_werasc; /* word erase */ - char t_lnextc; /* literal next character */ -}; - -/* - * Structure for TIOCGETP and TIOCSETP ioctls. - */ - -#ifndef _SGTTYB_ -#define _SGTTYB_ -struct sgttyb { - char sg_ispeed; /* input speed */ - char sg_ospeed; /* output speed */ - char sg_erase; /* erase character */ - char sg_kill; /* kill character */ - short sg_flags; /* mode flags */ -}; -#endif - -#include <sys/ioccom.h> - -/* - * 4.3BSD tty ioctl commands that are either: - * 1) deprecated - * 2) not implemented (and never were implemented) - * 3) implemented on top of new-style "ioctl"s. - */ -#define TIOCGETD _IOR('t', 0, int) /* get line discipline */ -#define TIOCSETD _IOW('t', 1, int) /* set line discipline */ -#define TIOCHPCL _IO('t', 2) /* hang up on last close */ -#define TIOCMODG _IOR('t', 3, int) /* get modem state - OBSOLETE */ -#define TIOCMODS _IOW('t', 4, int) /* set modem state - OBSOLETE */ -#define TIOCGETP _IOR('t', 8,struct sgttyb)/* get parameters -- gtty */ -#define TIOCSETP _IOW('t', 9,struct sgttyb)/* set parameters -- stty */ -#define TIOCSETN _IOW('t',10,struct sgttyb)/* as above, but no flushtty */ -#define TIOCEXCL _IO('t', 13) /* set exclusive use of tty */ -#define TIOCNXCL _IO('t', 14) /* reset exclusive use of tty */ -#define TIOCFLUSH _IOW('t', 16, int) /* flush buffers */ -#define TIOCSETC _IOW('t',17,struct tchars)/* set special characters */ -#define TIOCGETC _IOR('t',18,struct tchars)/* get special characters */ -#define O_TANDEM 0x00000001 /* send stopc on out q full */ -#define O_CBREAK 0x00000002 /* half-cooked mode */ -#define O_LCASE 0x00000004 /* simulate lower case */ -#define O_ECHO 0x00000008 /* echo input */ -#define O_CRMOD 0x00000010 /* map \r to \r\n on output */ -#define O_RAW 0x00000020 /* no i/o processing */ -#define O_ODDP 0x00000040 /* get/send odd parity */ -#define O_EVENP 0x00000080 /* get/send even parity */ -#define O_ANYP 0x000000c0 /* get any parity/send none */ -#define O_NLDELAY 0x00000300 /* \n delay */ -#define O_NL0 0x00000000 -#define O_NL1 0x00000100 /* tty 37 */ -#define O_NL2 0x00000200 /* vt05 */ -#define O_NL3 0x00000300 -#define O_TBDELAY 0x00000c00 /* horizontal tab delay */ -#define O_TAB0 0x00000000 -#define O_TAB1 0x00000400 /* tty 37 */ -#define O_TAB2 0x00000800 -#define O_XTABS 0x00000c00 /* expand tabs on output */ -#define O_CRDELAY 0x00003000 /* \r delay */ -#define O_CR0 0x00000000 -#define O_CR1 0x00001000 /* tn 300 */ -#define O_CR2 0x00002000 /* tty 37 */ -#define O_CR3 0x00003000 /* concept 100 */ -#define O_VTDELAY 0x00004000 /* vertical tab delay */ -#define O_FF0 0x00000000 -#define O_FF1 0x00004000 /* tty 37 */ -#define O_BSDELAY 0x00008000 /* \b delay */ -#define O_BS0 0x00000000 -#define O_BS1 0x00008000 -#define O_ALLDELAY (O_NLDELAY|O_TBDELAY|O_CRDELAY|O_VTDELAY|O_BSDELAY) -#define O_CRTBS 0x00010000 /* do backspacing for crt */ -#define O_PRTERA 0x00020000 /* \ ... / erase */ -#define O_CRTERA 0x00040000 /* " \b " to wipe out char */ -#define O_TILDE 0x00080000 /* hazeltine tilde kludge */ -#define O_MDMBUF 0x00100000 /* start/stop output on carrier intr */ -#define O_LITOUT 0x00200000 /* literal output */ -#define O_TOSTOP 0x00400000 /* SIGSTOP on background output */ -#define O_FLUSHO 0x00800000 /* flush output to terminal */ -#define O_NOHANG 0x01000000 /* no SIGHUP on carrier drop */ -#define O_L001000 0x02000000 -#define O_CRTKIL 0x04000000 /* kill line with " \b " */ -#define O_PASS8 0x08000000 -#define O_CTLECH 0x10000000 /* echo control chars as ^X */ -#define O_PENDIN 0x20000000 /* tp->t_rawq needs reread */ -#define O_DECCTQ 0x40000000 /* only ^Q starts after ^S */ -#define O_NOFLSH 0x80000000 /* no output flush on signal */ -/* locals, from 127 down */ -#define TIOCLBIS _IOW('t', 127, int) /* bis local mode bits */ -#define TIOCLBIC _IOW('t', 126, int) /* bic local mode bits */ -#define TIOCLSET _IOW('t', 125, int) /* set entire local mode word */ -#define TIOCLGET _IOR('t', 124, int) /* get local modes */ -#define LCRTBS (O_CRTBS>>16) -#define LPRTERA (O_PRTERA>>16) -#define LCRTERA (O_CRTERA>>16) -#define LTILDE (O_TILDE>>16) -#define LMDMBUF (O_MDMBUF>>16) -#define LLITOUT (O_LITOUT>>16) -#define LTOSTOP (O_TOSTOP>>16) -#define LFLUSHO (O_FLUSHO>>16) -#define LNOHANG (O_NOHANG>>16) -#define LCRTKIL (O_CRTKIL>>16) -#define LPASS8 (O_PASS8>>16) -#define LCTLECH (O_CTLECH>>16) -#define LPENDIN (O_PENDIN>>16) -#define LDECCTQ (O_DECCTQ>>16) -#define LNOFLSH (O_NOFLSH>>16) -#define TIOCSBRK _IO('t', 123) /* set break bit */ -#define TIOCCBRK _IO('t', 122) /* clear break bit */ -#define TIOCSDTR _IO('t', 121) /* set data terminal ready */ -#define TIOCCDTR _IO('t', 120) /* clear data terminal ready */ -#define TIOCSLTC _IOW('t',117,struct ltchars)/* set local special chars */ -#define TIOCGLTC _IOR('t',116,struct ltchars)/* get local special chars */ -#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ -#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ - -/* - * Sun-specific ioctls, which have been moved to the Sun-specific range. - * The old codes will be kept around for binary compatibility; the - * codes for TIOCCONS and TIOCGSIZE don't collide with the 4.3BSD codes - * because the structure size and copy direction fields are different. - * Unfortunately, the old TIOCSSIZE code does collide with TIOCSWINSZ, - * but they can be disambiguated by checking whether a "struct ttysize" - * structure's "ts_lines" field is greater than 64K or not. If so, - * it's almost certainly a "struct winsize" instead. - */ -#define _O_TIOCCONS _IO('t', 104) /* get console I/O */ -#define _O_TIOCSSIZE _IOW('t',103,struct ttysize)/* get tty size */ -#define _O_TIOCGSIZE _IOR('t',102,struct ttysize)/* get tty size */ - -/* - * Sun-specific ioctls. - */ -#define TIOCSETX _IOW('t', 34, int) /* set extra modes for S5 compatibility */ -#define TIOCGETX _IOR('t', 35, int) /* get extra modes for S5 compatibility */ -#define NOPOST 0x00000001 /* no processing on output (LITOUT with 7 bits + parity) */ -#define NOISIG 0x00000002 /* disable all signal-generating characters */ -#define STOPB 0x00000004 /* two stop bits */ - -#define OTTYDISC 0 /* old, v7 std tty driver */ -#define NETLDISC 1 /* line discip for berk net */ -#define NTTYDISC 2 /* new tty discipline */ -#define TABLDISC 3 /* hitachi tablet discipline */ -#define NTABLDISC 4 /* gtco tablet discipline */ -#define MOUSELDISC 5 /* mouse discipline */ -#define KBDLDISC 6 /* up/down keyboard trans (console) */ - -#include <sys/ttycom.h> - -#endif /* !_sys_ttold_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/ttychars.h b/usr/src/lib/libbc/inc/include/sys/ttychars.h deleted file mode 100644 index 8ab232d3d2..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/ttychars.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * User visible structures and constants - * related to terminal handling. - */ - -#ifndef _sys_ttychars_h -#define _sys_ttychars_h - -struct ttychars { - char tc_erase; /* erase last character */ - char tc_kill; /* erase entire line */ - char tc_intrc; /* interrupt */ - char tc_quitc; /* quit */ - char tc_startc; /* start output */ - char tc_stopc; /* stop output */ - char tc_eofc; /* end-of-file */ - char tc_brkc; /* input delimiter (like nl) */ - char tc_suspc; /* stop process signal */ - char tc_dsuspc; /* delayed stop process signal */ - char tc_rprntc; /* reprint line */ - char tc_flushc; /* flush output (toggles) */ - char tc_werasc; /* word erase */ - char tc_lnextc; /* literal next character */ -}; - -#ifndef CTRL -#define CTRL(c) ('c'&037) -#endif - -/* - * default special characters. - * guarded because termio[s].h also define these. - */ -#ifndef CERASE -#define CERASE 0177 -#define CKILL CTRL(u) -#define CINTR CTRL(c) -#define CQUIT 034 /* FS, ^\ */ -#define CSTART CTRL(q) -#define CSTOP CTRL(s) -#define CEOF CTRL(d) -#define CEOT CEOF -#define CBRK 0377 -#define CSUSP CTRL(z) -#define CDSUSP CTRL(y) -#define CRPRNT CTRL(r) -#define CFLUSH CTRL(o) -#define CWERASE CTRL(w) -#define CLNEXT CTRL(v) -#endif /* !CERASE */ - -#endif /* !_sys_ttychars_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/ttycom.h b/usr/src/lib/libbc/inc/include/sys/ttycom.h deleted file mode 100644 index de4d7a97bd..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/ttycom.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef __sys_ttycom_h -#define __sys_ttycom_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef _POSIX_SOURCE - -/* - * Window/terminal size structure. - * This information is stored by the kernel - * in order to provide a consistent interface, - * but is not used by the kernel. - * - * Type must be "unsigned short" so that types.h not required. - */ -struct winsize { - unsigned short ws_row; /* rows, in characters */ - unsigned short ws_col; /* columns, in characters */ - unsigned short ws_xpixel; /* horizontal size, pixels - not used */ - unsigned short ws_ypixel; /* vertical size, pixels - not used */ -}; - -#define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */ -#define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */ - -/* - * Sun version of same. - */ -struct ttysize { - int ts_lines; /* number of lines on terminal */ - int ts_cols; /* number of columns on terminal */ -}; - -#define TIOCSSIZE _IOW('t',37,struct ttysize)/* set tty size */ -#define TIOCGSIZE _IOR('t',38,struct ttysize)/* get tty size */ - -/* - * 4.3BSD and SunOS terminal "ioctl"s with no "termios" equivalents. - * This file is included by <sys/termios.h> and indirectly by <sys/ioctl.h> - * so that programs that include either one have these "ioctl"s defined. - */ -#define TIOCSCTTY _IO('t', 132) /* get a ctty */ -#define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */ -#define TIOCGETPGRP _IOR('t', 131, int) /* get pgrp of tty (posix) */ -#define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */ -#define TIOCSETPGRP _IOW('t', 130, int) /* set pgrp of tty (posix) */ -#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ -#define TIOCSTI _IOW('t', 114, char) /* simulate terminal input */ -#define TIOCNOTTY _IO('t', 113) /* void tty association */ -#define TIOCPKT _IOW('t', 112, int) /* pty: set/clear packet mode */ -#define TIOCPKT_DATA 0x00 /* data packet */ -#define TIOCPKT_FLUSHREAD 0x01 /* flush data not yet written to controller */ -#define TIOCPKT_FLUSHWRITE 0x02 /* flush data read from controller but not yet processed */ -#define TIOCPKT_STOP 0x04 /* stop output */ -#define TIOCPKT_START 0x08 /* start output */ -#define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */ -#define TIOCPKT_DOSTOP 0x20 /* now do ^S, ^Q */ -#define TIOCPKT_IOCTL 0x40 /* "ioctl" packet */ -#define TIOCMSET _IOW('t', 109, int) /* set all modem bits */ -#define TIOCMBIS _IOW('t', 108, int) /* bis modem bits */ -#define TIOCMBIC _IOW('t', 107, int) /* bic modem bits */ -#define TIOCMGET _IOR('t', 106, int) /* get all modem bits */ -#define TIOCM_LE 0001 /* line enable */ -#define TIOCM_DTR 0002 /* data terminal ready */ -#define TIOCM_RTS 0004 /* request to send */ -#define TIOCM_ST 0010 /* secondary transmit */ -#define TIOCM_SR 0020 /* secondary receive */ -#define TIOCM_CTS 0040 /* clear to send */ -#define TIOCM_CAR 0100 /* carrier detect */ -#define TIOCM_CD TIOCM_CAR -#define TIOCM_RNG 0200 /* ring */ -#define TIOCM_RI TIOCM_RNG -#define TIOCM_DSR 0400 /* data set ready */ - -#define TIOCREMOTE _IOW('t', 105, int) /* remote input editing */ -#define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */ - -/* - * Sun-specific ioctls with no "termios" equivalents. - */ -#define TIOCTCNTL _IOW('t', 32, int) /* pty: set/clr intercept ioctl mode */ -#define TIOCSIGNAL _IOW('t', 33, int) /* pty: send signal to slave */ -#define TIOCCONS _IO('t', 36) /* get console I/O */ -#define TIOCSSOFTCAR _IOW('t', 101, int) /* set soft carrier flag */ -#define TIOCGSOFTCAR _IOR('t', 100, int) /* get soft carrier flag */ -#define TIOCISPACE _IOR('t', 128, int) /* space left in input queue */ -#define TIOCISIZE _IOR('t', 129, int) /* size of input queue */ - -#endif /* !_POSIX_SOURCE */ -#endif /* !__sys_ttycom_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/ttydev.h b/usr/src/lib/libbc/inc/include/sys/ttydev.h deleted file mode 100644 index 567db2853e..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/ttydev.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Terminal definitions related to underlying hardware. - */ - -#ifndef __sys_ttydev_h -#define __sys_ttydev_h - -/* - * Speeds - */ -#define B0 0 -#define B50 1 -#define B75 2 -#define B110 3 -#define B134 4 -#define B150 5 -#define B200 6 -#define B300 7 -#define B600 8 -#define B1200 9 -#define B1800 10 -#define B2400 11 -#define B4800 12 -#define B9600 13 -#define B19200 14 -#define B38400 15 -#ifndef _POSIX_SOURCE -#define EXTA 14 -#define EXTB 15 -#endif - -#ifdef KERNEL -/* - * Hardware bits. - * SHOULD NOT BE HERE. - */ -#define DONE 0200 -#define IENABLE 0100 - -/* - * Modem control commands. - */ -#define DMSET 0 -#define DMBIS 1 -#define DMBIC 2 -#define DMGET 3 -#endif /* KERNEL */ - -#endif /* !__sys_ttydev_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/types.h b/usr/src/lib/libbc/inc/include/sys/types.h deleted file mode 100644 index 765d3ea55e..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/types.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef __sys_types_h -#define __sys_types_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Basic system types. - */ - -#include <sys/stdtypes.h> /* ANSI & POSIX types */ - -#ifndef _POSIX_SOURCE -#include <sys/sysmacros.h> - -#define physadr physadr_t -#define quad quad_t - -typedef unsigned char u_char; -typedef unsigned short u_short; -typedef unsigned int u_int; -typedef unsigned long u_long; -typedef unsigned short ushort; /* System V compatibility */ -typedef unsigned int uint; /* System V compatibility */ -#endif /* !_POSIX_SOURCE */ - -typedef struct _physadr_t { int r[1]; } *physadr_t; -typedef struct label_t { - int val[2]; -} label_t; -typedef struct _quad_t { long val[2]; } quad_t; -typedef long daddr_t; -typedef char * caddr_t; -typedef unsigned long ino_t; -typedef short dev_t; -typedef long off_t; -typedef unsigned short uid_t; -typedef unsigned short gid_t; -typedef long key_t; -typedef char * addr_t; - -#ifndef _POSIX_SOURCE - -#define NBBY 8 /* number of bits in a byte */ -/* - * Select uses bit masks of file descriptors in longs. - * These macros manipulate such bit fields (the filesystem macros use chars). - * FD_SETSIZE may be defined by the user, but the default here - * should be >= NOFILE (param.h). - */ -#ifndef FD_SETSIZE -#define FD_SETSIZE 256 -#endif - -typedef long fd_mask; -#define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ -#ifndef howmany -#define howmany(x, y) (((x)+((y)-1))/(y)) -#endif - -typedef struct fd_set { - fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; -} fd_set; - - -#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) -#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) -#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) -#define FD_ZERO(p) bzero((char *)(p), sizeof (*(p))) - -#endif /* !_POSIX_SOURCE */ -#endif /* !__sys_types_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/uio.h b/usr/src/lib/libbc/inc/include/sys/uio.h deleted file mode 100644 index 3509436478..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/uio.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef _sys_uio_h -#define _sys_uio_h - -struct iovec { - caddr_t iov_base; - int iov_len; -}; - -/* - * The uio_seg define below is obsolete and is included only - * for compatibility with previous releases. New code should - * use the uio_segflg field. - */ -struct uio { - struct iovec *uio_iov; - int uio_iovcnt; - off_t uio_offset; - short uio_segflg; -#define uio_seg uio_segflg /* obsolete */ - short uio_fmode; /* careful what you put here, the file - * bits that fill this are an int. */ - int uio_resid; -}; - -enum uio_rw { UIO_READ, UIO_WRITE }; - -/* - * Segment flag values (should be enum). - * - * The UIOSEG_* defines are obsolete and are included only - * for compatibility with previous releases. New code should - * use the UIO_* definitions. - */ -#define UIO_USERSPACE 0 /* from user data space */ -#define UIO_SYSSPACE 1 /* from system space */ -#define UIO_USERISPACE 2 /* from user I space */ - -#define UIOSEG_USER 0 /* obsolete */ -#define UIOSEG_KERNEL 1 /* obsolete */ - -#endif /*!_sys_uio_h*/ diff --git a/usr/src/lib/libbc/inc/include/sys/utsname.h b/usr/src/lib/libbc/inc/include/sys/utsname.h deleted file mode 100644 index 623dc23119..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/utsname.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ -/* from S5R2 6.1 */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef __sys_utsname_h -#define __sys_utsname_h - -struct utsname { - char sysname[9]; - char nodename[9]; - char nodeext[65-9]; /* extends nodename to MAXHOSTNAMELEN+1 chars */ - char release[9]; - char version[9]; - char machine[9]; -}; - -#ifdef KERNEL -extern struct utsname utsname; -#else -int uname(/* struct utsname *name */); -#endif - -#endif /* !__sys_utsname_h */ diff --git a/usr/src/lib/libbc/inc/include/sys/vfs.h b/usr/src/lib/libbc/inc/include/sys/vfs.h deleted file mode 100644 index b593914bfe..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/vfs.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * File system identifier. Should be unique (at least per machine). - */ - -#ifndef _sys_vfs_h -#define _sys_vfs_h - -typedef struct { - long val[2]; /* file system id type */ -} fsid_t; - -/* - * File identifier. Should be unique per filesystem on a single machine. - */ -#define MAXFIDSZ 16 -#define freefid(fidp) \ - kmem_free((caddr_t)(fidp), sizeof (struct fid) - MAXFIDSZ + (fidp)->fid_len) - -struct fid { - u_short fid_len; /* length of data in bytes */ - char fid_data[MAXFIDSZ]; /* data (variable length) */ -}; - -/* - * Structure per mounted file system. - * Each mounted file system has an array of - * operations and an instance record. - * The file systems are put on a singly linked list. - * If vfs_stats is non-NULL statistics are gathered, see vfs_stat.h - */ -struct vfs { - struct vfs *vfs_next; /* next vfs in vfs list */ - struct vfsops *vfs_op; /* operations on vfs */ - struct vnode *vfs_vnodecovered; /* vnode we mounted on */ - int vfs_flag; /* flags */ - int vfs_bsize; /* native block size */ - fsid_t vfs_fsid; /* file system id */ - caddr_t vfs_stats; /* filesystem statistics */ - caddr_t vfs_data; /* private data */ -}; - -/* - * vfs flags. - * VFS_MLOCK lock the vfs so that name lookup cannot proceed past the vfs. - * This keeps the subtree stable during mounts and unmounts. - */ -#define VFS_RDONLY 0x01 /* read only vfs */ -#define VFS_MLOCK 0x02 /* lock vfs so that subtree is stable */ -#define VFS_MWAIT 0x04 /* someone is waiting for lock */ -#define VFS_NOSUID 0x08 /* turn off set-uid on exec */ -#define VFS_GRPID 0x10 /* Old BSD group-id on create */ -#define VFS_NOSUB 0x20 /* No mounts allowed beneath this fs */ -#define VFS_REMOUNT 0x40 /* modify mount otions only */ -#define VFS_MULTI 0x80 /* Do multi-component lookup on files */ - -/* - * Operations supported on virtual file system. - */ -struct vfsops { - int (*vfs_mount)(); /* mount file system */ - int (*vfs_unmount)(); /* unmount file system */ - int (*vfs_root)(); /* get root vnode */ - int (*vfs_statfs)(); /* get fs statistics */ - int (*vfs_sync)(); /* flush fs buffers */ - int (*vfs_vget)(); /* get vnode from fid */ - int (*vfs_mountroot)(); /* mount the root filesystem */ - int (*vfs_swapvp)(); /* return vnode for swap */ -}; - -#define VFS_MOUNT(VFSP, PATH, DATA) \ - (*(VFSP)->vfs_op->vfs_mount)(VFSP, PATH, DATA) -#define VFS_UNMOUNT(VFSP) (*(VFSP)->vfs_op->vfs_unmount)(VFSP) -#define VFS_ROOT(VFSP, VPP) (*(VFSP)->vfs_op->vfs_root)(VFSP,VPP) -#define VFS_STATFS(VFSP, SBP) (*(VFSP)->vfs_op->vfs_statfs)(VFSP,SBP) -#define VFS_SYNC(VFSP) (*(VFSP)->vfs_op->vfs_sync)(VFSP) -#define VFS_VGET(VFSP, VPP, FIDP) (*(VFSP)->vfs_op->vfs_vget)(VFSP, VPP, FIDP) -#define VFS_MOUNTROOT(VFSP, VPP, NM) \ - (*(VFSP)->vfs_op->vfs_mountroot)(VFSP, VPP, NM) -#define VFS_SWAPVP(VFSP, VPP, NM) (*(VFSP)->vfs_op->vfs_swapvp)(VFSP, VPP, NM) - -/* - * file system statistics - */ -struct statfs { - long f_type; /* type of info, zero for now */ - long f_bsize; /* fundamental file system block size */ - long f_blocks; /* total blocks in file system */ - long f_bfree; /* free block in fs */ - long f_bavail; /* free blocks avail to non-superuser */ - long f_files; /* total file nodes in file system */ - long f_ffree; /* free file nodes in fs */ - fsid_t f_fsid; /* file system id */ - long f_spare[7]; /* spare for later */ -}; - -#ifdef KERNEL -/* - * Filesystem type switch table - */ -struct vfssw { - char *vsw_name; /* type name string */ - struct vfsops *vsw_ops; /* filesystem operations vector */ -}; - -/* - * public operations - */ -extern void vfs_mountroot(); /* mount the root */ -extern int vfs_add(); /* add a new vfs to mounted vfs list */ -extern void vfs_remove(); /* remove a vfs from mounted vfs list */ -extern int vfs_lock(); /* lock a vfs */ -extern void vfs_unlock(); /* unlock a vfs */ -extern struct vfs *getvfs(); /* return vfs given fsid */ -extern struct vfssw *getfstype(); /* find default filesystem type */ -extern int vfs_getmajor(); /* get major device # for an fs type */ -extern void vfs_putmajor(); /* free major device # for an fs type */ -extern int vfs_getnum(); /* get device # for an fs type */ -extern void vfs_putnum(); /* release device # for an fs type */ - -#define VFS_INIT(VFSP, OP, DATA) { \ - (VFSP)->vfs_next = (struct vfs *)0; \ - (VFSP)->vfs_op = (OP); \ - (VFSP)->vfs_flag = 0; \ - (VFSP)->vfs_stats = NULL; \ - (VFSP)->vfs_data = (DATA); \ -} - -/* - * globals - */ -extern struct vfs *rootvfs; /* ptr to root vfs structure */ -extern struct vfssw vfssw[]; /* table of filesystem types */ -extern struct vfssw *vfsNVFS; /* vfs switch table end marker */ -#endif - -#endif /*!_sys_vfs_h*/ diff --git a/usr/src/lib/libbc/inc/include/sys/wait.h b/usr/src/lib/libbc/inc/include/sys/wait.h deleted file mode 100644 index e374f677f6..0000000000 --- a/usr/src/lib/libbc/inc/include/sys/wait.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef __sys_wait_h -#define __sys_wait_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * This file holds definitions relevant to the wait system call. - * Some of the options here are available only through the ``wait3'' - * entry point; the old entry point with one argument has more fixed - * semantics, never returning status of unstopped children, hanging until - * a process terminates if any are outstanding, and never returns - * detailed information about process resource utilization (<vtimes.h>). - */ - -#ifndef _POSIX_SOURCE -#define __wait wait -#define w_termsig __w_termsig -#define w_coredump __w_coredump -#define w_retcode __w_retcode -#define w_stopval __w_stopval -#define w_stopsig __w_stopsig -#define WSTOPPED _WSTOPPED -#endif /* !_POSIX_SOURCE */ - -/* - * Structure of the information in the first word returned by both - * wait and wait3. If w_stopval==WSTOPPED, then the second structure - * describes the information returned, else the first. See WUNTRACED below. - */ -union __wait { - int w_status; /* used in syscall */ - /* - * Terminated process status. - */ - struct { - unsigned short w_Fill1:16; /* high 16 bits unused */ - unsigned short w_Retcode:8; /* exit code if w_termsig==0 */ - unsigned short w_Coredump:1; /* core dump indicator */ - unsigned short w_Termsig:7; /* termination signal */ - } w_T; - /* - * Stopped process status. Returned - * only for traced children unless requested - * with the WUNTRACED option bit. - */ - struct { - unsigned short w_Fill2:16; /* high 16 bits unused */ - unsigned short w_Stopsig:8; /* signal that stopped us */ - unsigned short w_Stopval:8; /* == W_STOPPED if stopped */ - } w_S; -}; -#define __w_termsig w_T.w_Termsig -#define __w_coredump w_T.w_Coredump -#define __w_retcode w_T.w_Retcode -#define __w_stopval w_S.w_Stopval -#define __w_stopsig w_S.w_Stopsig -#define _WSTOPPED 0177 /* value of s.stopval if process is stopped */ - -/* - * Option bits for the second argument of wait3. WNOHANG causes the - * wait to not hang if there are no stopped or terminated processes, rather - * returning an error indication in this case (pid==0). WUNTRACED - * indicates that the caller should receive status about untraced children - * which stop due to signals. If children are stopped and a wait without - * this option is done, it is as though they were still running... nothing - * about them is returned. - */ -#define WNOHANG 1 /* dont hang in wait */ -#define WUNTRACED 2 /* tell about stopped, untraced children */ - -#define WIFSTOPPED(x) (((union __wait*)&(x))->__w_stopval == _WSTOPPED) -#define WIFSIGNALED(x) (((union __wait*)&(x))->__w_stopval != _WSTOPPED && \ - ((union __wait*)&(x))->__w_termsig != 0) -#define WIFEXITED(x) (((union __wait*)&(x))->__w_stopval != _WSTOPPED && \ - ((union __wait*)&(x))->__w_termsig == 0) -#define WEXITSTATUS(x) (((union __wait*)&(x))->__w_retcode) -#define WTERMSIG(x) (((union __wait*)&(x))->__w_termsig) -#define WSTOPSIG(x) (((union __wait*)&(x))->__w_stopsig) - -#include <sys/stdtypes.h> - -pid_t wait(/* int *loc */); -pid_t waitpid(/* pid_t pid, int *loc, int opts */); - -#endif /* !__sys_wait_h */ diff --git a/usr/src/lib/libbc/inc/include/syslog.h b/usr/src/lib/libbc/inc/include/syslog.h deleted file mode 100644 index 13a84ae401..0000000000 --- a/usr/src/lib/libbc/inc/include/syslog.h +++ /dev/null @@ -1,72 +0,0 @@ -/* from UCB 7.1 6/5/86 */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef _sys_syslog_h -#define _sys_syslog_h - -/* - * Facility codes - */ -#define LOG_KERN (0<<3) /* kernel messages */ -#define LOG_USER (1<<3) /* random user-level messages */ -#define LOG_MAIL (2<<3) /* mail system */ -#define LOG_DAEMON (3<<3) /* system daemons */ -#define LOG_AUTH (4<<3) /* security/authorization messages */ -#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ -#define LOG_LPR (6<<3) /* line printer subsystem */ -#define LOG_NEWS (7<<3) /* netnews subsystem */ -#define LOG_UUCP (8<<3) /* uucp subsystem */ -#define LOG_CRON (15<<3) /* cron/at subsystem */ - /* other codes through 15 reserved for system use */ -#define LOG_LOCAL0 (16<<3) /* reserved for local use */ -#define LOG_LOCAL1 (17<<3) /* reserved for local use */ -#define LOG_LOCAL2 (18<<3) /* reserved for local use */ -#define LOG_LOCAL3 (19<<3) /* reserved for local use */ -#define LOG_LOCAL4 (20<<3) /* reserved for local use */ -#define LOG_LOCAL5 (21<<3) /* reserved for local use */ -#define LOG_LOCAL6 (22<<3) /* reserved for local use */ -#define LOG_LOCAL7 (23<<3) /* reserved for local use */ - -#define LOG_NFACILITIES 24 /* maximum number of facilities */ -#define LOG_FACMASK 0x03f8 /* mask to extract facility part */ - -/* - * Priorities (these are ordered) - */ -#define LOG_EMERG 0 /* system is unusable */ -#define LOG_ALERT 1 /* action must be taken immediately */ -#define LOG_CRIT 2 /* critical conditions */ -#define LOG_ERR 3 /* error conditions */ -#define LOG_WARNING 4 /* warning conditions */ -#define LOG_NOTICE 5 /* normal but signification condition */ -#define LOG_INFO 6 /* informational */ -#define LOG_DEBUG 7 /* debug-level messages */ - -#define LOG_PRIMASK 0x0007 /* mask to extract priority part (internal) */ - -/* - * arguments to setlogmask. - */ -#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ -#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ - -/* - * Option flags for openlog. - * - * LOG_ODELAY no longer does anything; LOG_NDELAY is the - * inverse of what it used to be. - */ -#define LOG_PID 0x01 /* log the pid with each message */ -#define LOG_CONS 0x02 /* log on the console if errors in sending */ -#define LOG_ODELAY 0x04 /* delay open until syslog() is called */ -#define LOG_NDELAY 0x08 /* don't delay open */ -#define LOG_NOWAIT 0x10 /* if forking to log on console, don't wait() */ - -#endif /*!_sys_syslog_h*/ diff --git a/usr/src/lib/libbc/inc/include/termio.h b/usr/src/lib/libbc/inc/include/termio.h deleted file mode 100644 index 7d159ae53f..0000000000 --- a/usr/src/lib/libbc/inc/include/termio.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#ifndef _sys_termio_h -#define _sys_termio_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/ioccom.h> -#include <sys/termios.h> - -#define NCC 8 - -#define SSPEED 7 /* default speed: 300 baud */ - -/* - * Ioctl control packet - */ -struct termio { - unsigned short c_iflag; /* input modes */ - unsigned short c_oflag; /* output modes */ - unsigned short c_cflag; /* control modes */ - unsigned short c_lflag; /* line discipline modes */ - char c_line; /* line discipline */ - unsigned char c_cc[NCC]; /* control chars */ -}; - -#define TCGETA _IOR('T', 1, struct termio) -#define TCSETA _IOW('T', 2, struct termio) -#define TCSETAW _IOW('T', 3, struct termio) -#define TCSETAF _IOW('T', 4, struct termio) -#define TCSBRK _IO('T', 5) - -#endif /* !_sys_termio_h */ diff --git a/usr/src/lib/libbc/inc/include/termios.h b/usr/src/lib/libbc/inc/include/termios.h deleted file mode 100644 index 6182f49fd5..0000000000 --- a/usr/src/lib/libbc/inc/include/termios.h +++ /dev/null @@ -1,278 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef __SYS_TERMIOS_H -#define __SYS_TERMIOS_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/stdtypes.h> -#include <sys/ioccom.h> -#include <sys/ttydev.h> -#include <sys/ttycom.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define NCCS 17 - -/* - * control characters - * the following are not (yet) posix - * VEOL2, VSWTCH, VDSUSP, VREPRINT, VDISCARD, VWERASE, VLNEXT, VSTATUS - */ -#define VINTR 0 -#define VQUIT 1 -#define VERASE 2 -#define VKILL 3 -#define VEOF 4 -#define VEOL 5 -#ifndef _POSIX_SOURCE -#define VEOL2 6 -#define VSWTCH 7 -#endif -#define VSTART 8 -#define VSTOP 9 -#define VSUSP 10 -#ifndef _POSIX_SOURCE -#define VDSUSP 11 -#define VREPRINT 12 -#define VDISCARD 13 -#define VWERASE 14 -#define VLNEXT 15 -#define VSTATUS 16 -#endif - -#define VMIN VEOF -#define VTIME VEOL - -#ifndef _POSIX_SOURCE -#define _CTRL(c) ('c'&037) - -/* - * default control chars. - * guarded for ttychars.h. - */ -#ifndef CINTR -#define CINTR _CTRL(c) -#define CQUIT 034 /* FS, ^\ */ -#define CERASE 0177 /* DEL, ^? */ -#define CKILL _CTRL(u) -#define CEOF _CTRL(d) -#define CEOT CEOF -#define CEOL 0 -#define CEOL2 0 -#define CSWTCH 0 -#define CNSWTCH 0 -#define CSTART _CTRL(q) -#define CSTOP _CTRL(s) -#define CSUSP _CTRL(z) -#define CDSUSP _CTRL(y) -#define CRPRNT _CTRL(r) -#define CFLUSH _CTRL(o) -#define CWERASE _CTRL(w) -#define CLNEXT _CTRL(v) -#endif /* !CINTR */ - -#define CESC '\\' -#define CNUL 0 -#define CDEL 0377 -#endif /* !_POSIX_SOURCE */ - -/* input modes */ -#define IGNBRK 0x00000001 -#define BRKINT 0x00000002 -#define IGNPAR 0x00000004 -#define PARMRK 0x00000008 -#define INPCK 0x00000010 -#define ISTRIP 0x00000020 -#define INLCR 0x00000040 -#define IGNCR 0x00000080 -#define ICRNL 0x00000100 -/* IUCLC 0x00000200 not posix, defined below */ -#define IXON 0x00000400 -/* IXANY 0x00000800 not posix, defined below */ -#define IXOFF 0x00001000 -/* IMAXBEL 0x00002000 not posix, defined below */ - -#ifndef _POSIX_SOURCE -#define IUCLC 0x00000200 -#define IXANY 0x00000800 -#define IMAXBEL 0x00002000 -#endif /* !_POSIX_SOURCE */ - -/* output modes */ -#define OPOST 0x00000001 -#ifndef _POSIX_SOURCE -#define OLCUC 0x00000002 -#define ONLCR 0x00000004 -#define OCRNL 0x00000008 -#define ONOCR 0x00000010 -#define ONLRET 0x00000020 -#define OFILL 0x00000040 -#define OFDEL 0x00000080 -#define NLDLY 0x00000100 -#define NL0 0 -#define NL1 0x00000100 -#define CRDLY 0x00000600 -#define CR0 0 -#define CR1 0x00000200 -#define CR2 0x00000400 -#define CR3 0x00000600 -#define TABDLY 0x00001800 -#define TAB0 0 -#define TAB1 0x00000800 -#define TAB2 0x00001000 -#define XTABS 0x00001800 -#define TAB3 XTABS -#define BSDLY 0x00002000 -#define BS0 0 -#define BS1 0x00002000 -#define VTDLY 0x00004000 -#define VT0 0 -#define VT1 0x00004000 -#define FFDLY 0x00008000 -#define FF0 0 -#define FF1 0x00008000 -#define PAGEOUT 0x00010000 -#define WRAP 0x00020000 -#endif /* !_POSIX_SOURCE */ - -/* control modes */ -#ifndef _POSIX_SOURCE -#define CBAUD 0x0000000f -#endif -#define CSIZE 0x00000030 -#define CS5 0 -#define CS6 0x00000010 -#define CS7 0x00000020 -#define CS8 0x00000030 -#define CSTOPB 0x00000040 -#define CREAD 0x00000080 -#define PARENB 0x00000100 -#define PARODD 0x00000200 -#define HUPCL 0x00000400 -#define CLOCAL 0x00000800 -#ifndef _POSIX_SOURCE -#define LOBLK 0x00001000 -#define CIBAUD 0x000f0000 -#define CRTSXOFF 0x40000000 -#define CRTSCTS 0x80000000 -#define CBAUDEXT 0x200000 -#define CIBAUDEXT 0x400000 - -/* - * 4.4BSD flags for hardware flow control - */ -#define CRTS_IFLOW 0x40000000 -#define CCTS_OFLOW 0x80000000 - -#define IBSHIFT 16 -#endif /* !_POSIX_SOURCE */ - -/* line discipline 0 modes */ -#define ISIG 0x00000001 -#define ICANON 0x00000002 -/* XCASE 0x00000004 not posix, defined below */ -#define ECHO 0x00000008 -#define ECHOE 0x00000010 -#define ECHOK 0x00000020 -#define ECHONL 0x00000040 -#define NOFLSH 0x00000080 -#define TOSTOP 0x00000100 -/* ECHOCTL 0x00000200 not posix, defined below */ -/* ECHOPRT 0x00000400 not posix, defined below */ -/* ECHOKE 0x00000800 not posix, defined below */ -/* DEFECHO 0x00001000 not posix, defined below */ -/* FLUSHO 0x00002000 not posix, defined below */ -/* PENDIN 0x00004000 not posix, defined below */ -#define IEXTEN 0x00008000 - -#ifndef _POSIX_SOURCE -#define XCASE 0x00000004 -#define ECHOCTL 0x00000200 -#define ECHOPRT 0x00000400 -#define ECHOKE 0x00000800 -#define DEFECHO 0x00001000 -#define FLUSHO 0x00002000 -#define PENDIN 0x00004000 -#endif /* !_POSIX_SOURCE */ - -#ifndef _POSIX_SOURCE -/* - * codes 1 through 5, not shown here, are old "termio" calls - */ -#define TCXONC _IO('T', 6) -#define TCFLSH _IO('T', 7) -#define TCGETS _IOR('T', 8, struct termios) -#define TCSETS _IOW('T', 9, struct termios) -#define TCSETSW _IOW('T', 10, struct termios) -#define TCSETSF _IOW('T', 11, struct termios) -#endif /* !_POSIX_SOURCE */ - -#define TCOOFF 0 /* arg to TCXONC & tcflow() */ -#define TCOON 1 /* arg to TCXONC & tcflow() */ -#define TCIOFF 2 /* arg to TCXONC & tcflow() */ -#define TCION 3 /* arg to TCXONC & tcflow() */ -#define TCIFLUSH 0 /* arg to TCFLSH & tcflush() */ -#define TCOFLUSH 1 /* arg to TCFLSH & tcflush() */ -#define TCIOFLUSH 2 /* arg to TCFLSH & tcflush() */ -#define TCSANOW 0 /* arg to tcsetattr() */ -#define TCSADRAIN 1 /* arg to tcsetattr() */ -#define TCSAFLUSH 2 /* arg to tcsetattr() */ - -/* - * Ioctl control packet - */ -struct termios { - tcflag_t c_iflag; /* input modes */ - tcflag_t c_oflag; /* output modes */ - tcflag_t c_cflag; /* control modes */ - tcflag_t c_lflag; /* line discipline modes */ - char c_line; /* line discipline XXX */ - cc_t c_cc[NCCS]; /* control chars */ -}; - - -#ifndef KERNEL -speed_t cfgetispeed(/* struct termios *termios_p */); -speed_t cfgetospeed(/* struct termios *termios_p */); -int cfsetispeed(/* struct termios *termios_p, speed_t speed */); -int cfsetospeed(/* struct termios *termios_p, speed_t speed */); -int tcdrain(/* int fildes */); -int tcflow(/* int fildes, int action */); -int tcflush(/* int fildes, int queue_selector */); -int tcgetattr(/* int fildes, struct termios *termios_p */); -int tcsendbreak(/* int fildes, int duration */); -int tcsetattr(/* int fildes, int optional_actions, struct *termios_p */); -#endif /* !KERNEL */ - -#ifdef __cplusplus -} -#endif - -#endif /* __SYS_TERMIOS_H */ diff --git a/usr/src/lib/libbc/inc/include/time.h b/usr/src/lib/libbc/inc/include/time.h deleted file mode 100644 index 8affc15e78..0000000000 --- a/usr/src/lib/libbc/inc/include/time.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef __time_h -#define __time_h - -#include <sys/stdtypes.h> -/* - * Structure returned by gmtime and localtime calls (see ctime(3)). - */ -struct tm { - int tm_sec; - int tm_min; - int tm_hour; - int tm_mday; - int tm_mon; - int tm_year; - int tm_wday; - int tm_yday; - int tm_isdst; - char *tm_zone; - long tm_gmtoff; -}; - -extern struct tm *gmtime(), *localtime(); -extern char *asctime(), *ctime(); -extern void tzset(), tzsetwall(); -extern int dysize(); -extern time_t timelocal(), timegm(); - -#endif /* !__time_h */ diff --git a/usr/src/lib/libbc/inc/include/ttyent.h b/usr/src/lib/libbc/inc/include/ttyent.h deleted file mode 100644 index 1ae6271d14..0000000000 --- a/usr/src/lib/libbc/inc/include/ttyent.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#ifndef _ttyent_h -#define _ttyent_h - -struct ttyent { /* see getttyent(3) */ - char *ty_name; /* terminal device name */ - char *ty_getty; /* command to execute, usually getty */ - char *ty_type; /* terminal type for termcap (3X) */ - int ty_status; /* status flags (see below for defines) */ - char *ty_window; /* command to start up window manager */ - char *ty_comment; /* usually the location of the terminal */ -}; - -#define TTY_ON 0x1 /* enable logins (startup getty) */ -#define TTY_SECURE 0x2 /* allow root to login */ -#define TTY_LOCAL 0x4 /* local tty, supply software carrier */ - -extern struct ttyent *getttyent(); -extern struct ttyent *getttynam(); - -#endif /*!_ttyent_h*/ diff --git a/usr/src/lib/libbc/inc/include/tzfile.h b/usr/src/lib/libbc/inc/include/tzfile.h deleted file mode 100644 index b094236256..0000000000 --- a/usr/src/lib/libbc/inc/include/tzfile.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* from Arthur Olson's 6.1 */ - -#ifndef _TZFILE_H -#define _TZFILE_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/tzfile.h> - -#endif /* _TZFILE_H */ diff --git a/usr/src/lib/libbc/inc/include/unistd.h b/usr/src/lib/libbc/inc/include/unistd.h deleted file mode 100644 index 921d3cb27d..0000000000 --- a/usr/src/lib/libbc/inc/include/unistd.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2001 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#ifndef _BC_SYS_UNISTD_H -#define _BC_SYS_UNISTD_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* WARNING: _SC_CLK_TCK and sysconf() are also defined/declared in <time.h>. */ -#define _SC_ARG_MAX 1 /* space for argv & envp */ -#define _SC_CHILD_MAX 2 /* maximum children per process??? */ -#define _SC_CLK_TCK 3 /* clock ticks/sec */ -#define _SC_NGROUPS_MAX 4 /* number of groups if multple supp. */ -#define _SC_OPEN_MAX 5 /* max open files per process */ -#define _SC_JOB_CONTROL 6 /* do we have job control */ -#define _SC_SAVED_IDS 7 /* do we have saved uid/gids */ -#define _SC_VERSION 8 /* POSIX version supported */ - -#define _POSIX_JOB_CONTROL 1 -#define _POSIX_SAVED_IDS 1 -#define _POSIX_VERSION 198808 - -#define _PC_LINK_MAX 1 /* max links to file/dir */ -#define _PC_MAX_CANON 2 /* max line length */ -#define _PC_MAX_INPUT 3 /* max "packet" to a tty device */ -#define _PC_NAME_MAX 4 /* max pathname component length */ -#define _PC_PATH_MAX 5 /* max pathname length */ -#define _PC_PIPE_BUF 6 /* size of a pipe */ -#define _PC_CHOWN_RESTRICTED 7 /* can we give away files */ -#define _PC_NO_TRUNC 8 /* trunc or error on >NAME_MAX */ -#define _PC_VDISABLE 9 /* best char to shut off tty c_cc */ -#define _PC_LAST 9 /* highest value of any _PC_* */ - -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 - -#ifndef NULL -#define NULL 0 -#endif - -#ifndef _POSIX_SOURCE -/* - * SVID lockf() requests - */ -#define F_ULOCK 0 /* Unlock a previously locked region */ -#define F_LOCK 1 /* Lock a region for exclusive use */ -#define F_TLOCK 2 /* Test and lock a region for exclusive use */ -#define F_TEST 3 /* Test a region for other processes locks */ - -/* Path names: */ -#define GF_PATH "/etc/group" -#define PF_PATH "/etc/passwd" - -#endif /* !_POSIX_SOURCE */ - -/* - * lseek & access args - * - * SEEK_* have to track L_* in sys/file.h & SEEK_* in 5include/stdio.h - * ?_OK have to track ?_OK in sys/file.h - */ -#ifndef SEEK_SET -#define SEEK_SET 0 /* Set file pointer to "offset" */ -#define SEEK_CUR 1 /* Set file pointer to current plus "offset" */ -#define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif - -#define F_OK 0 /* does file exist */ -#define X_OK 1 /* is it executable by caller */ -#define W_OK 2 /* is it writable by caller */ -#define R_OK 4 /* is it readable by caller */ - -#include <sys/types.h> - -extern void _exit(int); -extern int access(char *, int); -extern unsigned alarm(unsigned); -extern int chdir(char *); -extern int chmod(char *, mode_t); -extern int chown(char *, uid_t, gid_t); -extern int close(int); -extern char *ctermid(char *); -extern char *cuserid(char *); -extern int dup(int); -extern int dup2(int, int); -extern int execl(char *, ...); -extern int execle(char *, ...); -extern int execlp(char *, ...); -extern int execv(char *, char *[]); -extern int execve(char *, char *[], char *[]); -extern int execvp(char *, char *[]); -extern pid_t fork(void); -extern long fpathconf(int, int); -extern char *getcwd(char *, int); -extern gid_t getegid(void); -extern uid_t geteuid(void); -extern gid_t getgid(void); -extern int getgroups(int, gid_t []); -extern char *getlogin(void); -extern pid_t getpgrp(void); -extern pid_t getpid(void); -extern pid_t getppid(void); -extern uid_t getuid(void); -extern int isatty(int); -extern int link(char *, char *); -extern off_t lseek(int, off_t, int); -extern long pathconf(char *, int); -extern int pause(void); -extern int pipe(int [2]); -extern int read(int, char *, int); -extern int rmdir(char *); -extern int setgid(gid_t); -extern int setpgid(pid_t, pid_t); -extern pid_t setsid(void); -extern int setuid(uid_t); -extern unsigned sleep(unsigned int); -extern long sysconf(int); -extern pid_t tcgetpgrp(int); -extern int tcsetpgrp(int, pid_t); -extern char *ttyname(int); -extern int unlink(char *); -extern int write(int, char *, int); - -#ifdef __cplusplus -} -#endif - -#endif /* _BC_SYS_UNISTD_H */ diff --git a/usr/src/lib/libbc/inc/include/utmp.h b/usr/src/lib/libbc/inc/include/utmp.h deleted file mode 100644 index 195f035d2b..0000000000 --- a/usr/src/lib/libbc/inc/include/utmp.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef _utmp_h -#define _utmp_h - -/* - * Structure of utmp and wtmp files. - * - * XXX - Assuming the number 8 is unwise. - */ -struct utmp { - char ut_line[8]; /* tty name */ - char ut_name[8]; /* user id */ - char ut_host[16]; /* host name, if remote */ - long ut_time; /* time on */ -}; - -/* - * This is a utmp entry that does not correspond to a genuine user - */ -#define nonuser(ut) ((ut).ut_host[0] == 0 && \ - strncmp((ut).ut_line, "tty", 3) == 0 && ((ut).ut_line[3] == 'p' \ - || (ut).ut_line[3] == 'q' \ - || (ut).ut_line[3] == 'r' \ - || (ut).ut_line[3] == 's')) - -#endif /*!_utmp_h*/ diff --git a/usr/src/lib/libbc/inc/include/values.h b/usr/src/lib/libbc/inc/include/values.h deleted file mode 100644 index ce1bc43299..0000000000 --- a/usr/src/lib/libbc/inc/include/values.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef _values_h -#define _values_h - -/* These values work with any binary representation of integers - * where the high-order bit contains the sign. */ - -/* a number used normally for size of a shift */ -#if gcos -#define BITSPERBYTE 9 -#else -#define BITSPERBYTE 8 -#endif -#define BITS(type) (BITSPERBYTE * (int)sizeof(type)) - -/* short, regular and long ints with only the high-order bit turned on */ -#define HIBITS ((short)(1 << BITS(short) - 1)) -#define HIBITI (1U << BITS(int) - 1) -#define HIBITL (1UL << BITS(long) - 1) - -/* largest short, regular and long int */ -#define MAXSHORT ((short)~HIBITS) -#define MAXINT ((int)~HIBITI) -#define MAXLONG ((long)~HIBITL) - -/* various values that describe the binary floating-point representation - * _EXPBASE - the exponent base - * DMAXEXP - the maximum exponent of a double (as returned by frexp()) - * FMAXEXP - the maximum exponent of a float (as returned by frexp()) - * DMINEXP - the minimum exponent of a double (as returned by frexp()) - * FMINEXP - the minimum exponent of a float (as returned by frexp()) - * MAXDOUBLE - the largest double - ((_EXPBASE ** DMAXEXP) * (1 - (_EXPBASE ** -DSIGNIF))) - * MAXFLOAT - the largest float - ((_EXPBASE ** FMAXEXP) * (1 - (_EXPBASE ** -FSIGNIF))) - * MINDOUBLE - the smallest double (_EXPBASE ** (DMINEXP - 1)) - * MINFLOAT - the smallest float (_EXPBASE ** (FMINEXP - 1)) - * DSIGNIF - the number of significant bits in a double - * FSIGNIF - the number of significant bits in a float - * DMAXPOWTWO - the largest power of two exactly representable as a double - * FMAXPOWTWO - the largest power of two exactly representable as a float - * _IEEE - 1 if IEEE standard representation is used - * _DEXPLEN - the number of bits for the exponent of a double - * _FEXPLEN - the number of bits for the exponent of a float - * _HIDDENBIT - 1 if high-significance bit of mantissa is implicit - * LN_MAXDOUBLE - the natural log of the largest double -- log(MAXDOUBLE) - * LN_MINDOUBLE - the natural log of the smallest double -- log(MINDOUBLE) - * LN_MAXFLOAT - the natural log of the largest float - * LN_MINFLOAT - the natural log of the smallest float - */ -#if u3b || u3b5 || sun -#define MAXDOUBLE 1.797693134862315708e+308 -#define MAXFLOAT ((float)3.40282346638528860e+38) -#define MINDOUBLE 4.94065645841246544e-324 -#define MINFLOAT ((float)1.40129846432481707e-45) -#define _IEEE 1 -#define _DEXPLEN 11 -#define _HIDDENBIT 1 -#define DMINEXP (-(DMAXEXP + DSIGNIF - _HIDDENBIT - 3)) -#define FMINEXP (-(FMAXEXP + FSIGNIF - _HIDDENBIT - 3)) -#define LN_MAXFLOAT 8.8722839052068e+01 -#define LN_MINFLOAT -1.03278929903432e+02 -#endif -#if pdp11 || vax -#define MAXDOUBLE 1.701411834604692293e+38 -#define MAXFLOAT ((float)1.701411733192644299e+38) -/* The following is kludged because the PDP-11 compilers botch the simple form. - The kludge causes the constant to be computed at run-time on the PDP-11, - even though it is still "folded" at compile-time on the VAX. */ -#define MINDOUBLE (0.01 * 2.938735877055718770e-37) -#define MINFLOAT ((float)MINDOUBLE) -#define _IEEE 0 -#define _DEXPLEN 8 -#define _HIDDENBIT 1 -#define DMINEXP (-DMAXEXP) -#define FMINEXP (-FMAXEXP) -#endif -#if gcos -#define MAXDOUBLE 1.7014118346046923171e+38 -#define MAXFLOAT ((float)1.7014118219281863150e+38) -#define MINDOUBLE 2.9387358770557187699e-39 -#define MINFLOAT ((float)MINDOUBLE) -#define _IEEE 0 -#define _DEXPLEN 8 -#define _HIDDENBIT 0 -#define DMINEXP (-(DMAXEXP + 1)) -#define FMINEXP (-(FMAXEXP + 1)) -#endif -#if u370 -#define _LENBASE 4 -#else -#define _LENBASE 1 -#endif -#define _EXPBASE (1 << _LENBASE) -#define _FEXPLEN 8 -#define DSIGNIF (BITS(double) - _DEXPLEN + _HIDDENBIT - 1) -#define FSIGNIF (BITS(float) - _FEXPLEN + _HIDDENBIT - 1) -#define DMAXPOWTWO ((double)(1L << BITS(long) - 2) * \ - (1L << DSIGNIF - BITS(long) + 1)) -#define FMAXPOWTWO ((float)(1L << FSIGNIF - 1)) -#define DMAXEXP ((1 << _DEXPLEN - 1) - 1 + _IEEE) -#define FMAXEXP ((1 << _FEXPLEN - 1) - 1 + _IEEE) -#define LN_MAXDOUBLE (M_LN2 * DMAXEXP) -#define LN_MINDOUBLE (M_LN2 * (DMINEXP - 1)) - -#define H_PREC (DSIGNIF % 2 ? (1L << DSIGNIF/2) * M_SQRT2 : 1L << DSIGNIF/2) -#define X_EPS (1.0/H_PREC) -#define X_PLOSS ((double)(long)(M_PI * H_PREC)) -#define X_TLOSS (M_PI * DMAXPOWTWO) -#define M_LN2 0.69314718055994530942 -#define M_PI 3.14159265358979323846 -#define M_SQRT2 1.41421356237309504880 -#define MAXBEXP DMAXEXP /* for backward compatibility */ -#define MINBEXP DMINEXP /* for backward compatibility */ -#define MAXPOWTWO DMAXPOWTWO /* for backward compatibility */ - -#endif /*!_values_h*/ diff --git a/usr/src/lib/libbc/inc/include/vfork.h b/usr/src/lib/libbc/inc/include/vfork.h deleted file mode 100644 index 20bf11f0d4..0000000000 --- a/usr/src/lib/libbc/inc/include/vfork.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1986 by Sun Microsystems, Inc. - */ - -/* - * this atrocity is necessary on sparc because registers modified - * by the child get propagated back to the parent via the window - * save/restore mechanism. - */ - -#ifndef _vfork_h -#define _vfork_h - -extern int vfork(); - -#ifdef sparc -#pragma unknown_control_flow(vfork) -#endif - -#endif /*!_vfork_h*/ diff --git a/usr/src/lib/libbc/inc/include/vm/faultcode.h b/usr/src/lib/libbc/inc/include/vm/faultcode.h deleted file mode 100644 index 0b6d54bb9b..0000000000 --- a/usr/src/lib/libbc/inc/include/vm/faultcode.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _vm_faultcode_h -#define _vm_faultcode_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * This file describes the "code" that is delivered during - * SIGBUS and SIGSEGV exceptions. It also describes the data - * type returned by vm routines which handle faults. - * - * If FC_CODE(fc) == FC_OBJERR, then FC_ERRNO(fc) contains the errno value - * returned by the underlying object mapped at the fault address. - */ -#define FC_HWERR 0x1 /* misc hardware error (e.g. bus timeout) */ -#define FC_ALIGN 0x2 /* hardware alignment error */ -#define FC_NOMAP 0x3 /* no mapping at the fault address */ -#define FC_PROT 0x4 /* access exceeded current protections */ -#define FC_OBJERR 0x5 /* underlying object returned errno value */ - -#define FC_MAKE_ERR(e) (((e) << 8) | FC_OBJERR) - -#define FC_CODE(fc) ((fc) & 0xff) -#define FC_ERRNO(fc) ((unsigned)(fc) >> 8) - -#ifndef LOCORE -typedef int faultcode_t; /* type returned by vm fault routines */ -#endif /* LOCORE */ - -#endif /* !_vm_faultcode_h */ diff --git a/usr/src/lib/libbc/libc/compat/4.1/ftime.c b/usr/src/lib/libbc/libc/compat/4.1/ftime.c deleted file mode 100644 index 0d3a625620..0000000000 --- a/usr/src/lib/libbc/libc/compat/4.1/ftime.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1998 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/time.h> - -/* - * Backwards compatible ftime. - */ -/* these two ints are from libc */ -extern int _timezone; -extern int _daylight; - - -/* from old timeb.h */ -struct timeb { - time_t time; - u_short millitm; - short timezone; - short dstflag; -}; - -int -ftime(struct timeb *tp) -{ - struct timeval t; - - if (_gettimeofday(&t) < 0) - return (-1); - - _ltzset(t.tv_sec); - - tp->time = t.tv_sec; - tp->millitm = t.tv_usec / 1000; - tp->timezone = _timezone / 60; - tp->dstflag = _daylight; - - return (0); -} diff --git a/usr/src/lib/libbc/libc/compat/4.1/getpw.c b/usr/src/lib/libbc/libc/compat/4.1/getpw.c deleted file mode 100644 index 27839574b0..0000000000 --- a/usr/src/lib/libbc/libc/compat/4.1/getpw.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1984 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <pwd.h> - -int -getpw(int uid, char buf[]) -{ - struct passwd *pw; - char numbuf[20]; - - pw = getpwuid(uid); - if(pw == 0) - return (1); - strcpy(buf, pw->pw_name); - strcat(buf, ":"); - strcat(buf, pw->pw_passwd); - strcat(buf, ":"); - sprintf(numbuf, "%d", pw->pw_uid); - strcat(buf, numbuf); - strcat(buf, ":"); - sprintf(numbuf, "%d", pw->pw_gid); - strcat(buf, numbuf); - strcat(buf, ":"); - strcat(buf, pw->pw_gecos); - strcat(buf, ":"); - strcat(buf, pw->pw_dir); - strcat(buf, ":"); - strcat(buf, pw->pw_shell); - return (0); -} diff --git a/usr/src/lib/libbc/libc/compat/4.1/nice.c b/usr/src/lib/libbc/libc/compat/4.1/nice.c deleted file mode 100644 index e78077b956..0000000000 --- a/usr/src/lib/libbc/libc/compat/4.1/nice.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1986 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 4.1 83/05/30 */ - -#include <sys/time.h> -#include <sys/resource.h> - -/* - * Backwards compatible nice. - */ -int -nice(incr) - int incr; -{ - int prio; - extern int errno; - int serrno; - - serrno = errno; - errno = 0; - prio = getpriority(PRIO_PROCESS, 0); - if (prio == -1 && errno) - return (-1); - if (setpriority(PRIO_PROCESS, 0, prio + incr) == -1) - return (-1); - errno = serrno; - return (0); -} diff --git a/usr/src/lib/libbc/libc/compat/4.1/rand.c b/usr/src/lib/libbc/libc/compat/4.1/rand.c deleted file mode 100644 index 31f3682f59..0000000000 --- a/usr/src/lib/libbc/libc/compat/4.1/rand.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -static long randx = 1; - -void -srand(unsigned x) -{ - randx = x; -} - -int -rand(void) -{ - return ((randx = randx * 1103515245 + 12345) & 0x7fffffff); -} diff --git a/usr/src/lib/libbc/libc/compat/4.1/times.c b/usr/src/lib/libbc/libc/compat/4.1/times.c deleted file mode 100644 index 8d25509ef6..0000000000 --- a/usr/src/lib/libbc/libc/compat/4.1/times.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1993 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/time.h> -#include <sys/times.h> -#include <unistd.h> - -clock_t -times(tmsp) - register struct tms *tmsp; -{ - int ret; - - ret = _times(tmsp); - - if (ret == -1) - return(ret * _sysconf(_SC_CLK_TCK) / 60); - else - return(0); -} diff --git a/usr/src/lib/libbc/libc/compat/4.1/vlimit.c b/usr/src/lib/libbc/libc/compat/4.1/vlimit.c deleted file mode 100644 index ef5d90d41a..0000000000 --- a/usr/src/lib/libbc/libc/compat/4.1/vlimit.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * (Almost) backwards compatible vlimit. - */ -#include <sys/time.h> -#include <sys/resource.h> -#include <errno.h> - -/* LIM_NORAISE is not emulated */ -#define LIM_NORAISE 0 /* if <> 0, can't raise limits */ -#define LIM_CPU 1 /* max secs cpu time */ -#define LIM_FSIZE 2 /* max size of file created */ -#define LIM_DATA 3 /* max growth of data space */ -#define LIM_STACK 4 /* max growth of stack */ -#define LIM_CORE 5 /* max size of ``core'' file */ -#define LIM_MAXRSS 6 /* max desired data+stack core usage */ - -#define NLIMITS 6 - -int -vlimit(int limit, int value) -{ - struct rlimit rlim; - - if (limit <= 0 || limit > NLIMITS) - return (EINVAL); - if (value == -1) { - if (getrlimit(limit - 1, &rlim) < 0) - return (-1); - return (rlim.rlim_cur); - } - rlim.rlim_cur = value; - rlim.rlim_max = RLIM_INFINITY; - return (setrlimit(limit - 1, &rlim)); -} diff --git a/usr/src/lib/libbc/libc/compat/4.1/vtimes.c b/usr/src/lib/libbc/libc/compat/4.1/vtimes.c deleted file mode 100644 index 2e497c4620..0000000000 --- a/usr/src/lib/libbc/libc/compat/4.1/vtimes.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/time.h> -#include <sys/resource.h> - -/* - * Backwards compatible vtimes. - */ -struct vtimes { - int vm_utime; /* user time (60'ths) */ - int vm_stime; /* system time (60'ths) */ - /* divide next two by utime+stime to get averages */ - unsigned vm_idsrss; /* integral of d+s rss */ - unsigned vm_ixrss; /* integral of text rss */ - int vm_maxrss; /* maximum rss */ - int vm_majflt; /* major page faults */ - int vm_minflt; /* minor page faults */ - int vm_nswap; /* number of swaps */ - int vm_inblk; /* block reads */ - int vm_oublk; /* block writes */ -}; - -static void getvtimes(struct rusage *, struct vtimes *); -static int scale60(struct timeval *); - -int -vtimes(struct vtimes *par, struct vtimes *chi) -{ - struct rusage ru; - - if (par) { - if (getrusage(RUSAGE_SELF, &ru) < 0) - return (-1); - getvtimes(&ru, par); - } - if (chi) { - if (getrusage(RUSAGE_CHILDREN, &ru) < 0) - return (-1); - getvtimes(&ru, chi); - } - return (0); -} - -static void -getvtimes(struct rusage *aru, struct vtimes *avt) -{ - - avt->vm_utime = scale60(&aru->ru_utime); - avt->vm_stime = scale60(&aru->ru_stime); - avt->vm_idsrss = ((aru->ru_idrss+aru->ru_isrss) / 100) * 60; - avt->vm_ixrss = aru->ru_ixrss / 100 * 60; - avt->vm_maxrss = aru->ru_maxrss; - avt->vm_majflt = aru->ru_majflt; - avt->vm_minflt = aru->ru_minflt; - avt->vm_nswap = aru->ru_nswap; - avt->vm_inblk = aru->ru_inblock; - avt->vm_oublk = aru->ru_oublock; -} - -static int -scale60(struct timeval *tvp) -{ - - return (tvp->tv_sec * 60 + tvp->tv_usec / 16667); -} diff --git a/usr/src/lib/libbc/libc/compat/common/gtty.c b/usr/src/lib/libbc/libc/compat/common/gtty.c deleted file mode 100644 index 7252a50cf2..0000000000 --- a/usr/src/lib/libbc/libc/compat/common/gtty.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1983 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Writearound to old gtty system call. - */ - -#include <sgtty.h> - -int -gtty(int fd, struct sgttyb *ap) -{ - - return (ioctl(fd, TIOCGETP, ap)); -} diff --git a/usr/src/lib/libbc/libc/compat/common/lockf.c b/usr/src/lib/libbc/libc/compat/common/lockf.c deleted file mode 100644 index b93300c70d..0000000000 --- a/usr/src/lib/libbc/libc/compat/common/lockf.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <fcntl.h> -#include <unistd.h> -#include <errno.h> -#include <sys/syscall.h> - -/* - * convert lockf() into fcntl() for SystemV compatibility - */ - -/* New SVR4 values */ -#define SV_GETLK 5 -#define SV_SETLK 6 -#define SV_SETLKW 7 - -int -lockf(int fildes, int function, long size) -{ - struct flock ld; - int cmd; - - cmd = SV_SETLK; /* assume non-blocking operation */ - ld.l_type = F_WRLCK; /* lockf() only deals with exclusive locks */ - ld.l_whence = 1; /* lock always starts at current position */ - if (size < 0) { - ld.l_start = size; - ld.l_len = -size; - } else { - ld.l_start = 0L; - ld.l_len = size; - } - - switch (function) { - case F_TEST: - if (_syscall(SYS_fcntl, fildes, SV_GETLK, &ld) != -1) { - if (ld.l_type == F_UNLCK) { - ld.l_pid = ld.l_xxx; - /* l_pid is the last field in the - SVr3 flock structure */ - return (0); - } else - errno = EACCES; /* EAGAIN ?? */ - } - return (-1); - - default: - errno = EINVAL; - return (-1); - - /* the rest fall thru to the fcntl() at the end */ - case F_ULOCK: - ld.l_type = F_UNLCK; - break; - - case F_LOCK: - cmd = SV_SETLKW; /* block, if not available */ - break; - - case F_TLOCK: - break; - } - if (_syscall(SYS_fcntl, fildes, cmd, &ld) == -1) { - switch (errno) { - /* this hack is purported to be for /usr/group compatibility */ - case ENOLCK: - errno = EDEADLK; - } - return(-1); - } else { - ld.l_pid = ld.l_xxx; /* l_pid is the last field in the - SVr3 flock structure */ - return(0); - } -} diff --git a/usr/src/lib/libbc/libc/compat/common/pause.c b/usr/src/lib/libbc/libc/compat/common/pause.c deleted file mode 100644 index 9a38959550..0000000000 --- a/usr/src/lib/libbc/libc/compat/common/pause.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1983 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Backwards compatible pause. - */ -int -pause(void) -{ - - sigpause(sigblock(0)); - return (-1); -} diff --git a/usr/src/lib/libbc/libc/compat/common/stty.c b/usr/src/lib/libbc/libc/compat/common/stty.c deleted file mode 100644 index 4cb2e8ebdb..0000000000 --- a/usr/src/lib/libbc/libc/compat/common/stty.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1983 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Writearound to old stty system call. - */ - -#include <sgtty.h> - -int -stty(int fd, struct sgttyb *ap) -{ - - return(ioctl(fd, TIOCSETP, ap)); -} diff --git a/usr/src/lib/libbc/libc/compat/common/tell.c b/usr/src/lib/libbc/libc/compat/common/tell.c deleted file mode 100644 index dbdf3f36e5..0000000000 --- a/usr/src/lib/libbc/libc/compat/common/tell.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 4.1 80/12/21 */ - -/* - * return offset in file. - */ - -long lseek(); - -long tell(f) -{ - return(lseek(f, 0L, 1)); -} diff --git a/usr/src/lib/libbc/libc/compat/common/ulimit.c b/usr/src/lib/libbc/libc/compat/common/ulimit.c deleted file mode 100644 index 622c292d2a..0000000000 --- a/usr/src/lib/libbc/libc/compat/common/ulimit.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/time.h> -#include <sys/resource.h> -#include <errno.h> - -long -ulimit(int cmd, long newlimit) -{ - struct rlimit rlimit; - - switch (cmd) { - - case 1: - if (getrlimit(RLIMIT_FSIZE, &rlimit) < 0) - return(-1); - return (rlimit.rlim_cur / 512); - - case 2: - rlimit.rlim_cur = rlimit.rlim_max = newlimit * 512; - return (setrlimit(RLIMIT_FSIZE, &rlimit)); - - case 3: - if (getrlimit(RLIMIT_DATA, &rlimit) < 0) - return(-1); - return (rlimit.rlim_cur); - - case 4: - return (getdtablesize()); - - default: - errno = EINVAL; - return (-1); - } -} diff --git a/usr/src/lib/libbc/libc/compat/common/utime.c b/usr/src/lib/libbc/libc/compat/common/utime.c deleted file mode 100644 index 868dada150..0000000000 --- a/usr/src/lib/libbc/libc/compat/common/utime.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/time.h> - -/* - * Backwards compatible utime. - * - * The System V system call allows any user with write permission - * on a file to set the accessed and modified times to the current - * time; they specify this by passing a null pointer to "utime". - * This is done to simulate reading one byte from a file and - * overwriting that byte with itself, which is the technique used - * by older versions of the "touch" command. The advantage of this - * hack in the system call is that it works correctly even if the file - * is zero-length. - * - * The BSD system call never allowed a null pointer so there should - * be no compatibility problem there. - */ - -int -utime(char *name, time_t otv[2]) -{ - struct timeval tv[2]; - - if (otv == 0) { - return (utimes(name, (struct timeval *)0)); - } else { - tv[0].tv_sec = (long)otv[0]; - tv[0].tv_usec = 0; - tv[1].tv_sec = (long)otv[1]; - tv[1].tv_usec = 0; - } - return (utimes(name, tv)); -} diff --git a/usr/src/lib/libbc/libc/compat/sys5/getpw.c b/usr/src/lib/libbc/libc/compat/sys5/getpw.c deleted file mode 100644 index 8449707c58..0000000000 --- a/usr/src/lib/libbc/libc/compat/sys5/getpw.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1984 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <pwd.h> - -int -getpw(int uid, char buf[]) -{ - struct passwd *pw; - char numbuf[20]; - - pw = getpwuid(uid); - if(pw == 0) - return (1); - strcpy(buf, pw->pw_name); - strcat(buf, ":"); - strcat(buf, pw->pw_passwd); - if (*pw->pw_age != '\0') { - strcat(buf, ","); - strcat(buf, pw->pw_age); - } - strcat(buf, ":"); - sprintf(numbuf, "%d", pw->pw_uid); - strcat(buf, numbuf); - strcat(buf, ":"); - sprintf(numbuf, "%d", pw->pw_gid); - strcat(buf, numbuf); - strcat(buf, ":"); - strcat(buf, pw->pw_gecos); - strcat(buf, ":"); - strcat(buf, pw->pw_dir); - strcat(buf, ":"); - strcat(buf, pw->pw_shell); - return (0); -} diff --git a/usr/src/lib/libbc/libc/compat/sys5/mkepoch.c b/usr/src/lib/libbc/libc/compat/sys5/mkepoch.c deleted file mode 100644 index 1eacd8bbd9..0000000000 --- a/usr/src/lib/libbc/libc/compat/sys5/mkepoch.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1986 Sun Microsystems Inc. - */ - -/* - * Put out a C declaration which initializes "epoch" to the time ("tv_sec" - * portion) when this program was run. - */ - -#include <stdio.h> -#include <sys/time.h> - -int gettimeofday(); -void perror(); -void exit(); - -/*ARGSUSED*/ -int -main(argc, argv) - int argc; - char **argv; -{ - struct timeval now; - - if (gettimeofday(&now, (struct timezone *)NULL) < 0) { - perror("mkepoch: gettimeofday failed"); - exit(1); - } - - if (printf("static long epoch = %ld;\n", now.tv_sec) == EOF) { - perror("mkepoch: can't write output"); - exit(1); - } - - return (0); -} diff --git a/usr/src/lib/libbc/libc/compat/sys5/nice.c b/usr/src/lib/libbc/libc/compat/sys5/nice.c deleted file mode 100644 index 926e79eb10..0000000000 --- a/usr/src/lib/libbc/libc/compat/sys5/nice.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1986 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 4.1 83/05/30 */ - -#include <sys/time.h> -#include <sys/resource.h> -#include <errno.h> - -/* - * Backwards compatible nice. - */ -int -nice(incr) - int incr; -{ - register int prio; - int serrno; - - /* put in brain-damaged upper range checking */ - if ((incr > 40) && (geteuid() != 0)) { - errno = EPERM; - return (-1); - } - - serrno = errno; - errno = 0; - prio = getpriority(PRIO_PROCESS, 0); - if (prio == -1 && errno) - return (-1); - prio += incr; - if (prio < -20) - prio = -20; - else if (prio > 19) - prio = 19; - if (setpriority(PRIO_PROCESS, 0, prio) == -1) { - /* - * 4.3BSD stupidly returns EACCES on an attempt by a - * non-super-user process to lower a priority; map - * it to EPERM. - */ - if (errno == EACCES) - errno = EPERM; - return (-1); - } - errno = serrno; - return (prio); -} diff --git a/usr/src/lib/libbc/libc/compat/sys5/rand.c b/usr/src/lib/libbc/libc/compat/sys5/rand.c deleted file mode 100644 index 1d9390ce71..0000000000 --- a/usr/src/lib/libbc/libc/compat/sys5/rand.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -/* - * Portions of this source code were derived from Berkeley 4.3 BSD - * under license from the Regents of the University of California. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ - -static long randx=1; - -void -srand(x) -unsigned x; -{ - randx = x; -} - -int -rand() -{ - return(((randx = randx * 1103515245L + 12345)>>16) & 0x7fff); -} diff --git a/usr/src/lib/libbc/libc/compat/sys5/times.c b/usr/src/lib/libbc/libc/compat/sys5/times.c deleted file mode 100644 index 94a8ee0aa3..0000000000 --- a/usr/src/lib/libbc/libc/compat/sys5/times.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1993 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/time.h> -#include <sys/times.h> - -clock_t -times(tmsp) - register struct tms *tmsp; -{ - int ret; - - ret = _times(tmsp); - - if (ret == -1) - return(ret * _sysconf(_SC_CLK_TCK) / 60); - else - return(0); -} diff --git a/usr/src/lib/libbc/libc/crt/sparc/_ftou.c b/usr/src/lib/libbc/libc/crt/sparc/_ftou.c deleted file mode 100644 index 44c5d7f7eb..0000000000 --- a/usr/src/lib/libbc/libc/crt/sparc/_ftou.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1987 by Sun Microsystems, Inc. - */ - -unsigned -_dtou(d) - double d; -{ - /* Convert double to unsigned. */ - - int id; - - /* - * id = d is correct if 0 <= d < 2**31, and good enough if d is NaN - * or d < 0 or d >= 2**32. Otherwise, since the result (int) d of - * converting 2**31 <= d < 2**32 is unknown, adjust d before the - * conversion. - */ - - if (d >= 2147483648.0) - id = 0x80000000 | (int) (d - 2147483648.0); - else - id = (int) d; - return (unsigned) id; -} - -unsigned -_ftou(dd) - int dd; /* really float */ -{ - /* Convert float to unsigned. */ - - int id; - double d = (double) *((float *)(&dd)); - /* - * id = d is correct if 0 <= d < 2**31, and good enough if d is NaN - * or d < 0 or d >= 2**32. Otherwise, since the result (int) d of - * converting 2**31 <= d < 2**32 is unknown, adjust d before the - * conversion. - */ - - if (d >= 2147483648.0) - id = 0x80000000 | (int) (d - 2147483648.0); - else - id = (int) d; - return (unsigned) id; -} diff --git a/usr/src/lib/libbc/libc/crt/sparc/misalign.s b/usr/src/lib/libbc/libc/crt/sparc/misalign.s deleted file mode 100644 index d497c953db..0000000000 --- a/usr/src/lib/libbc/libc/crt/sparc/misalign.s +++ /dev/null @@ -1,363 +0,0 @@ -! .text -! .asciz ident "%Z%%M% %I% %E% SMI" -! .align 4 -! .seg "text" - -! Copyright 2005 Sun Microsystems, Inc. All rights reserved. -! Use is subject to license terms. -! -! CDDL HEADER START -! -! The contents of this file are subject to the terms of the -! Common Development and Distribution License, Version 1.0 only -! (the "License"). You may not use this file except in compliance -! with the License. -! -! You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -! or http://www.opensolaris.org/os/licensing. -! See the License for the specific language governing permissions -! and limitations under the License. -! -! When distributing Covered Code, include this CDDL HEADER in each -! file and include the License file at usr/src/OPENSOLARIS.LICENSE. -! If applicable, add the following below this CDDL HEADER, with the -! fields enclosed by brackets "[]" replaced with your own identifying -! information: Portions Copyright [yyyy] [name of copyright owner] -! -! CDDL HEADER END -! - -! -! C library routines for compiler support of misaligned memory -! references. These are called when an in-line test reveals a -! misaligned address. -! - - .file "misalign.s" - -#include <SYS.h> - -!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -! -! int ld_int(p) -! char *p; -! { -! /* -! * load 32-bit int from misaligned address -! * cost(16-bit aligned case): 9 cycles -! * cost(8-bit aligned case): 18 cycles -! */ -! } -! - RTENTRY(.ld_int) - andcc %o0,1,%g0 ! test 16-bit alignment - be,a 1f ! fast case: two loads; - lduh [%o0+2],%o1 ! do first one in delay slot -! - ldub [%o0+3],%o3 ! slow case: load 4 bytes in <o0,o1,o2,o3> - ldub [%o0+2],%o2 - ldub [%o0+1],%o1 - ldub [%o0],%o0 ! note this has to be done last. - sll %o2,8,%o2 - sll %o1,16,%o1 - sll %o0,24,%o0 - or %o1,%o0,%o0 ! put the pieces together. - or %o2,%o0,%o0 - retl - or %o3,%o0,%o0 -1: - lduh [%o0],%o0 ! 2nd half of fast case - sll %o0,16,%o0 ! shift, concat, done. - retl - or %o0,%o1,%o0 - SET_SIZE(.ld_int) - -!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -! -! float ld_float(p) -! char *p; -! { -! /* load 32-bit float (not double!) from misaligned address */ -! } -! - RTENTRY(.ld_float) - save %sp,-SA(MINFRAME+8),%sp - andcc %i0,1,%g0 ! test for short alignment - be,a 1f - lduh [%i0],%o0 ! short aligned case: 2 loads, 2 stores -! - ldub [%i0],%o0 ! byte aligned case: 4 loads, 4 stores - ldub [%i0+1],%o1 - ldub [%i0+2],%o2 - ldub [%i0+3],%o3 - stb %o0,[%fp-4] - stb %o1,[%fp-3] - stb %o2,[%fp-2] - b 2f - stb %o3,[%fp-1] -1: - lduh [%i0+2],%o1 ! rest of short aligned case - sth %o0,[%fp-4] - sth %o1,[%fp-2] -2: - ld [%fp-4],%f0 ! load FPU reg, done - ret - restore - SET_SIZE(.ld_float) - -!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -! -! double ld_double(p) -! char *p; -! { -! /* load 64-bit float from misaligned address */ -! } -! - RTENTRY(.ld_double) - save %sp,-SA(MINFRAME+8),%sp - andcc %i0,3,%g0 ! test for long alignment - be,a 1f ! long aligned case: 2 loads, no stores - ld [%i0],%f0 -! - andcc %i0,1,%g0 ! test for short alignment - be,a 2f ! short aligned case: 4 loads, 4 stores - lduh [%i0],%o0 -! - ldub [%i0],%o0 ! worst case: byte alignment - ldub [%i0+1],%o1 ! 8 loads, 8 stores - ldub [%i0+2],%o2 - ldub [%i0+3],%o3 - stb %o0,[%fp-8] - stb %o1,[%fp-7] - stb %o2,[%fp-6] - stb %o3,[%fp-5] - ldub [%i0+4],%o0 - ldub [%i0+5],%o1 - ldub [%i0+6],%o2 - ldub [%i0+7],%o3 - stb %o0,[%fp-4] - stb %o1,[%fp-3] - stb %o2,[%fp-2] - stb %o3,[%fp-1] - ldd [%fp-8],%f0 ! load f0-f1, done - ret - restore -2: - lduh [%i0+2],%o1 ! rest of short aligned case - lduh [%i0+4],%o2 - lduh [%i0+6],%o3 - sth %o0,[%fp-8] - sth %o1,[%fp-6] - sth %o2,[%fp-4] - sth %o3,[%fp-2] - ldd [%fp-8],%f0 ! load f0-f1, done - ret - restore -1: - ld [%i0+4],%f1 ! rest of long aligned case - ret - restore - SET_SIZE(.ld_double) - -!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -! -! int st_int(x,p) -! int x; -! char *p; -! { -! /* store 32-bit int from misaligned address; -! return stored value */ -! } -! - RTENTRY(.st_int) - andcc %o1,1,%g0 ! test for short alignment - be,a 1f - srl %o0,16,%o4 -! - srl %o0,24,%o5 ! byte aligned case - stb %o5,[%o1] - srl %o0,16,%o2 - stb %o2,[%o1+1] - srl %o0,8,%o3 - stb %o3,[%o1+2] - retl - stb %o0,[%o1+3] -1: - sth %o4,[%o1] ! rest of short aligned case - retl - sth %o0,[%o1+2] - SET_SIZE(.st_int) - -!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -! -! float st_float(x,p) -! float x; -! char *p; -! { -! /* store 32-bit float from misaligned address; -! return stored value */ -! } -! - RTENTRY(.st_float) - save %sp,-SA(MINFRAME+8),%sp - andcc %i1,1,%g0 ! test for short alignment - be,a 1f ! short aligned case - srl %i0,16,%o0 -! - srl %i0,24,%o0 ! byte aligned case - srl %i0,16,%o1 - srl %i0,8,%o2 - stb %o0,[%i1] - stb %o1,[%i1+1] - stb %o2,[%i1+2] - stb %i0,[%i1+3] - st %i0,[%fp-4] ! store temp, load f0, done - ld [%fp-4],%f0 - ret - restore -1: - sth %o0,[%i1] ! rest of short aligned case - sth %i0,[%i1+2] - st %i0,[%fp-4] - ld [%fp-4],%f0 - ret - restore - SET_SIZE(.st_float) - -!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -! -! double st_double(x,p) -! double x; -! char *p; -! { -! /* store 64-bit float from misaligned address; -! return stored value */ -! } -! - RTENTRY(.st_double) - save %sp,-SA(MINFRAME+8),%sp - andcc %i2,3,%g0 ! test for long alignment - be,a 1f ! long aligned case: 2 stores, 2 loads - st %i0,[%i2] -! - andcc %i2,1,%g0 ! test for short alignment - be,a 2f ! short aligned case: 4 stores, 4 loads - srl %i0,16,%o0 -! ! byte aligned case: the pits - srl %i0,24,%o0 - srl %i0,16,%o1 - srl %i0,8,%o2 - stb %o0,[%i2] ! store first word, a byte at a time - stb %o1,[%i2+1] - stb %o2,[%i2+2] - stb %i0,[%i2+3] - srl %i1,24,%o0 - srl %i1,16,%o1 - srl %i1,8,%o2 - stb %o0,[%i2+4] ! store second word, a byte at a time - stb %o1,[%i2+5] - stb %o2,[%i2+6] - stb %i1,[%i2+7] - std %i0,[%fp-8] ! since dest is misaligned, must use temp - ldd [%fp-8],%f0 ! load f0,f1 from double-aligned temp, done - ret - restore -2: ! rest of short aligned case - srl %i1,16,%o1 - sth %o0,[%i2] ! store two words, a half word at a time - sth %i0,[%i2+2] - sth %o1,[%i2+4] - sth %i1,[%i2+6] - std %i0,[%fp-8] ! since dest is misaligned, must use temp - ldd [%fp-8],%f0 ! load f0,f1 from double-aligned temp, done - ret - restore -1: ! rest of long aligned case - st %i1,[%i2+4] - ld [%i2],%f0 ! load f0,f1 from long-aligned memory, done - ld [%i2+4],%f1 - ret - restore - SET_SIZE(.st_double) - -!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -! -! void st_float_foreff(x,p) -! float x; -! char *p; -! { -! /* store 32-bit float from misaligned address */ -! } -! - RTENTRY(.st_float_foreff) - andcc %o1,1,%g0 ! test for short alignment - be,a 1f - srl %o0,16,%o2 -! - srl %o0,24,%o2 ! byte aligned case - srl %o0,16,%o3 - srl %o0,8,%o4 - stb %o2,[%o1] - stb %o3,[%o1+1] - stb %o4,[%o1+2] - retl - stb %o0,[%o1+3] -1: ! rest of short aligned case - sth %o2,[%o1] - retl - sth %o0,[%o1+2] - SET_SIZE(.st_float_foreff) - -!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -! -! void st_double_foreff(x,p) -! double x; -! char *p; -! { -! /* store 64-bit float from misaligned address; -! return stored value */ -! } -! - RTENTRY(.st_double_foreff) - andcc %o2,3,%g0 ! test for long alignment - be,a 1f ! long aligned case: 2 stores - st %o0,[%o2] -! - andcc %o2,1,%g0 ! test for short alignment - be,a 2f ! short aligned case: 4 stores - srl %o0,16,%o3 -! - srl %o0,24,%o3 ! byte aligned case: 8 stores - srl %o0,16,%o4 - srl %o0,8,%o5 - stb %o3,[%o2] - stb %o4,[%o2+1] - stb %o5,[%o2+2] - stb %o0,[%o2+3] - srl %o1,24,%o3 - srl %o1,16,%o4 - srl %o1,8,%o5 - stb %o3,[%o2+4] - stb %o4,[%o2+5] - stb %o5,[%o2+6] - retl - stb %o1,[%o2+7] -2: ! rest of short aligned case - srl %o1,16,%o4 - sth %o3,[%o2] - sth %o0,[%o2+2] - sth %o4,[%o2+4] - retl - sth %o1,[%o2+6] -1: ! rest of long aligned case - retl - st %o1,[%o2+4] - SET_SIZE(.st_double_foreff) diff --git a/usr/src/lib/libbc/libc/crt/sparc/muldiv.s b/usr/src/lib/libbc/libc/crt/sparc/muldiv.s deleted file mode 100644 index 65a752a4dd..0000000000 --- a/usr/src/lib/libbc/libc/crt/sparc/muldiv.s +++ /dev/null @@ -1,58 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - .ident "%Z%%M% %I% %E% SMI" - - .file "muldiv.s" - -#include <SYS.h> - - ENTRY(.udiv) - wr %g0, %g0, %y - nop - nop - mov %o0, %o3 ! o3 gets remainder - udiv %o0, %o1, %o0 ! o0 contains quotient a/b - umul %o0, %o1, %o4 ! o4 contains q*b - retl - sub %o3, %o4, %o3 ! o3 gets a-q*b - SET_SIZE(.udiv) - - ENTRY(.div) - sra %o0,31,%o4 ! extend sign - wr %o4,%g0,%y - cmp %o1,0xffffffff ! is divisor -1? - be,a 1f ! if yes - subcc %g0,%o0,%o0 ! simply negate dividend - mov %o0,%o3 ! o3 gets remainder - sdiv %o0,%o1,%o0 ! o0 contains quotient a/b - smul %o0,%o1,%o4 ! o4 contains q*b - retl - sub %o3,%o4,%o3 ! o3 gets a-q*b -1: - retl - mov %g0,%o3 ! remainder is 0 - SET_SIZE(.div) diff --git a/usr/src/lib/libbc/libc/crt/sparc/ptr_call.s b/usr/src/lib/libbc/libc/crt/sparc/ptr_call.s deleted file mode 100644 index 559b0ec563..0000000000 --- a/usr/src/lib/libbc/libc/crt/sparc/ptr_call.s +++ /dev/null @@ -1,41 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1992 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -! .seg "data" -! .asciz "Copyr 1992 Sun Micro" - .seg ".text" - - -/* - * Indirect procedure call. - * just jump to whatever's in %g1 - */ - .global .ptr_call -.ptr_call: - jmp %g1 - nop diff --git a/usr/src/lib/libbc/libc/crt/sparc/start_float.s b/usr/src/lib/libbc/libc/crt/sparc/start_float.s deleted file mode 100644 index 5a816604b9..0000000000 --- a/usr/src/lib/libbc/libc/crt/sparc/start_float.s +++ /dev/null @@ -1,36 +0,0 @@ -! .data -! .asciz ident "%Z%%M% %I% %E% SMI" - -! Copyright 2005 Sun Microsystems, Inc. All rights reserved. -! Use is subject to license terms. -! -! CDDL HEADER START -! -! The contents of this file are subject to the terms of the -! Common Development and Distribution License, Version 1.0 only -! (the "License"). You may not use this file except in compliance -! with the License. -! -! You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -! or http://www.opensolaris.org/os/licensing. -! See the License for the specific language governing permissions -! and limitations under the License. -! -! When distributing Covered Code, include this CDDL HEADER in each -! file and include the License file at usr/src/OPENSOLARIS.LICENSE. -! If applicable, add the following below this CDDL HEADER, with the -! fields enclosed by brackets "[]" replaced with your own identifying -! information: Portions Copyright [yyyy] [name of copyright owner] -! -! CDDL HEADER END -! - - .file "start_float.s" - -#include <SYS.h> - - ENTRY(.start_float) - retl - nop ! [internal] - - SET_SIZE(.start_float) diff --git a/usr/src/lib/libbc/libc/gen/4.2/nlist.c b/usr/src/lib/libbc/libc/gen/4.2/nlist.c deleted file mode 100644 index 923c1378d4..0000000000 --- a/usr/src/lib/libbc/libc/gen/4.2/nlist.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/file.h> -#include <a.out.h> - -/* - * nlist - retreive attributes from name list (string table version) - * [The actual work is done in ../common/_nlist.c] - */ -int -nlist(char *name, struct nlist *list) -{ - int fd; - int e; - - fd = open(name, O_RDONLY, 0); - e = _nlist(fd, list); - close(fd); - return (e); -} diff --git a/usr/src/lib/libbc/libc/gen/4.2/sleep.c b/usr/src/lib/libbc/libc/gen/4.2/sleep.c deleted file mode 100644 index 4ec54f23e4..0000000000 --- a/usr/src/lib/libbc/libc/gen/4.2/sleep.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * copyright (c) 1980 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/time.h> -#include <signal.h> - -#define setvec(vec, a) \ - vec.sv_handler = a; vec.sv_mask = vec.sv_onstack = 0 - -static int ringring; - -static void sleepx(void); - -void -sleep(unsigned n) -{ - int omask; - struct itimerval itv, oitv; - struct itimerval *itp = &itv; - struct sigvec vec, ovec; - - if (n == 0) - return; - timerclear(&itp->it_interval); - timerclear(&itp->it_value); - if (setitimer(ITIMER_REAL, itp, &oitv) < 0) - return; - itp->it_value.tv_sec = n; - if (timerisset(&oitv.it_value)) { - if (timercmp(&oitv.it_value, &itp->it_value, >)) - oitv.it_value.tv_sec -= itp->it_value.tv_sec; - else { - itp->it_value = oitv.it_value; - /* - * This is a hack, but we must have time to - * return from the setitimer after the alarm - * or else it'll be restarted. And, anyway, - * sleep never did anything more than this before. - */ - oitv.it_value.tv_sec = 1; - oitv.it_value.tv_usec = 0; - } - } - setvec(vec, sleepx); - (void) sigvec(SIGALRM, &vec, &ovec); - omask = sigblock(sigmask(SIGALRM)); - ringring = 0; - (void) setitimer(ITIMER_REAL, itp, (struct itimerval *)0); - while (!ringring) - sigpause(omask &~ sigmask(SIGALRM)); - (void) sigvec(SIGALRM, &ovec, (struct sigvec *)0); - (void) sigsetmask(omask); - (void) setitimer(ITIMER_REAL, &oitv, (struct itimerval *)0); -} - -static void -sleepx(void) -{ - - ringring = 1; -} diff --git a/usr/src/lib/libbc/libc/gen/4.2/system.c b/usr/src/lib/libbc/libc/gen/4.2/system.c deleted file mode 100644 index 295413f620..0000000000 --- a/usr/src/lib/libbc/libc/gen/4.2/system.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1992 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -#include <signal.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <string.h> -#include <sys/file.h> - -extern int execl(); - -int -system(s) -char *s; -{ - int status; - pid_t pid, w; - register void (*istat)(), (*qstat)(); - char path[256]; - char *c; - - while (*s == ' ' || *s == '\t') - s++; - - if (strncmp(s, "/usr/ucb", strlen("/usr/ucb")) == 0) { - /* check if command is under /usr/ucb, if not - * replace /usr/ucb with /usr/bin. - */ - strcpy(path, s); - if ((c = strchr(path, ' ')) != NULL) - *c ='\0'; - if (access(path, F_OK) == -1) { - strncpy(path, "/usr/bin", strlen("/usr/bin")); - if (c != NULL) *c = ' '; - s = path; - } - } - else if (strncmp(s, "/bin", strlen("/bin")) == 0 || - strncmp(s, "/usr/bin", strlen("/usr/bin")) == 0) { - /* if /usr/bin is specified, first check if a command - * with the same name exists under /usr/ucb */ - strcpy(path, "/usr/ucb"); - if (strncmp(s, "/bin", strlen("/bin")) == 0) - strcat(path, strchr(s+1, '/')); - else { - c = strchr(s+1, '/'); - strcat(path, strchr(c+1, '/')); - } - if ((c = strchr(path, ' ')) != NULL) - *c ='\0'; - if (access(path, F_OK) == 0) { - if (c != NULL) *c = ' '; - s = path; - } - } - - if ((pid = vfork()) == 0) { - (void) execl("/bin/sh", "sh", "-c", s, (char *)0); - _exit(127); - } - if (pid == -1) { - return (-1); - } - istat = signal(SIGINT, SIG_IGN); - qstat = signal(SIGQUIT, SIG_IGN); - w = waitpid(pid, &status, 0); - (void) signal(SIGINT, istat); - (void) signal(SIGQUIT, qstat); - return ((w == -1) ? -1: status); -} diff --git a/usr/src/lib/libbc/libc/gen/4.2/timezone.c b/usr/src/lib/libbc/libc/gen/4.2/timezone.c deleted file mode 100644 index d1795123a1..0000000000 --- a/usr/src/lib/libbc/libc/gen/4.2/timezone.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1986 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 4.4 83/09/25 */ - -/* - * The arguments are the number of minutes of time - * you are westward from Greenwich and whether DST is in effect. - * It returns a string - * giving the name of the local timezone. - * - * Sorry, I don't know all the names. - */ - -static struct zone { - int offset; - char *stdzone; - char *dlzone; -} zonetab[] = { - -12*60, "NZST", "NZDT", /* New Zealand */ - -10*60, "EST", "EST", /* Aust: Eastern */ - -10*60+30, "CST", "CST", /* Aust: Central */ - -8*60, "WST", 0, /* Aust: Western */ - -9*60, "JST", 0, /* Japanese */ - 0*60, "GMT", "BST", /* Great Britain and Eire */ - -1*60, "MET", "MET DST", /* Middle European */ - -2*60, "EET", "EET DST", /* Eastern European */ - 3*60+30, "NST", "NDT", /* Newfoundland */ - 4*60, "AST", "ADT", /* Atlantic */ - 5*60, "EST", "EDT", /* Eastern */ - 6*60, "CST", "CDT", /* Central */ - 7*60, "MST", "MDT", /* Mountain */ - 8*60, "PST", "PDT", /* Pacific */ - 9*60, "YST", "YDT", /* Yukon */ - 10*60, "HST", "HDT", /* Hawaiian */ - -1 -}; - -char *timezone(zone, dst) -{ - register struct zone *zp; - static char czone[10]; - char *sign; - register char *p, *q; - char *getenv(), *index(); - - if (p = getenv("TZNAME")) { - if (q = index(p, ',')) { - if (dst) - return(++q); - else { - *q = '\0'; - strncpy(czone, p, sizeof(czone)-1); - czone[sizeof(czone)-1] = '\0'; - *q = ','; - return (czone); - } - } - return(p); - } - for (zp=zonetab; zp->offset!=-1; zp++) - if (zp->offset==zone) { - if (dst && zp->dlzone) - return(zp->dlzone); - if (!dst && zp->stdzone) - return(zp->stdzone); - } - if (zone<0) { - zone = -zone; - sign = "+"; - } else - sign = "-"; - sprintf(czone, "GMT%s%d:%02d", sign, zone/60, zone%60); - return(czone); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Q_add.c b/usr/src/lib/libbc/libc/gen/common/_Q_add.c deleted file mode 100644 index 1234196eb7..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Q_add.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "_Qquad.h" -#include "_Qglobals.h" - -static double zero = 0.0, tiny = 1.0e-300, huge = 1.0e300; -static void dummy(double); - -QUAD -_Q_add(QUAD x, QUAD y) -{ - unpacked px,py,pz; - QUAD z; - _fp_current_exceptions = 0; - _Q_get_rp_rd(); /* get fp_precision, fp_direction */ - _fp_unpack(&px,(int *)&x,fp_op_extended); - _fp_unpack(&py,(int *)&y,fp_op_extended); - _fp_add(&px,&py,&pz); - _fp_pack(&pz,(int *)&z,fp_op_extended); - _Q_set_exception(_fp_current_exceptions); - return (z); -} - -void -_Q_set_exception(unsigned ex) -{ - /* simulate exceptions using double arithmetic */ - double t; - if((ex&(1<<fp_invalid))!=0) t = (zero/zero); - if((ex&(1<<fp_overflow))!=0) t = (huge*huge); - if((ex&(1<<fp_underflow))!=0) t = (tiny*tiny); - if((ex&(1<<fp_division))!=0) t = (tiny/zero); - if((ex&(1<<fp_inexact))!=0) t = (huge+tiny); - dummy(t); /* prevent optimizer eliminating previous expression */ -} - -static void -dummy(double x) -{ -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Q_cmp.c b/usr/src/lib/libbc/libc/gen/common/_Q_cmp.c deleted file mode 100644 index 79679ab61e..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Q_cmp.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "_Qquad.h" -#include "_Qglobals.h" - -enum fcc_type -_Q_cmp(QUAD x, QUAD y) -{ - unpacked px,py,pz; - enum fcc_type fcc; - _fp_current_exceptions = 0; - _fp_unpack(&px, (int *)&x,fp_op_extended); - _fp_unpack(&py, (int *)&y,fp_op_extended); - fcc = _fp_compare(&px,&py,0); /* quiet NaN unexceptional */ - _Q_set_exception(_fp_current_exceptions); - return (fcc); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Q_cmpe.c b/usr/src/lib/libbc/libc/gen/common/_Q_cmpe.c deleted file mode 100644 index ee1f16cd66..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Q_cmpe.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "_Qquad.h" -#include "_Qglobals.h" - -enum fcc_type -_Q_cmpe(QUAD x, QUAD y) -{ - unpacked px,py,pz; - enum fcc_type fcc; - _fp_current_exceptions = 0; - _fp_unpack(&px, (int *)&x,fp_op_extended); - _fp_unpack(&py, (int *)&y,fp_op_extended); - fcc = _fp_compare(&px,&py,1); /* quiet NaN exceptional */ - _Q_set_exception(_fp_current_exceptions); - return (fcc); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Q_div.c b/usr/src/lib/libbc/libc/gen/common/_Q_div.c deleted file mode 100644 index 3e8686426b..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Q_div.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "_Qquad.h" -#include "_Qglobals.h" - -QUAD -_Q_div(QUAD x, QUAD y) -{ - unpacked px,py,pz; - QUAD z; - _fp_current_exceptions = 0; - _Q_get_rp_rd(); - _fp_unpack(&px, (int *)&x,fp_op_extended); - _fp_unpack(&py, (int *)&y,fp_op_extended); - _fp_div(&px,&py,&pz); - _fp_pack(&pz, (int *)&z,fp_op_extended); - _Q_set_exception(_fp_current_exceptions); - return (z); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Q_dtoq.c b/usr/src/lib/libbc/libc/gen/common/_Q_dtoq.c deleted file mode 100644 index b07ca5757b..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Q_dtoq.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "_Qquad.h" -#include "_Qglobals.h" - -QUAD -_Q_dtoq(double x) -{ - unpacked px; - QUAD q; - _fp_current_exceptions = 0; - _fp_unpack(&px, (int *)&x,fp_op_double); - _fp_pack(&px, (int *)&q,fp_op_extended); - _Q_set_exception(_fp_current_exceptions); - return (q); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Q_fcc.c b/usr/src/lib/libbc/libc/gen/common/_Q_fcc.c deleted file mode 100644 index 4734b34881..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Q_fcc.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* integer function _Q_feq, _Q_fne, _Q_fgt, _Q_fge, _Q_flt, _Q_fle */ - -#include "_Qquad.h" - -int -_Q_feq(QUAD x, QUAD y) -{ - enum fcc_type fcc; - fcc = _Q_cmp(x,y); - return (fcc_equal==fcc); -} - -int -_Q_fne(QUAD x, QUAD y) -{ - enum fcc_type fcc; - fcc = _Q_cmp(x,y); - return (fcc_equal!=fcc); -} - -int -_Q_fgt(QUAD x, QUAD y) -{ - enum fcc_type fcc; - fcc = _Q_cmpe(x,y); - return (fcc_greater==fcc); -} - -int -_Q_fge(QUAD x, QUAD y) -{ - enum fcc_type fcc; - fcc = _Q_cmpe(x,y); - return (fcc_greater==fcc||fcc_equal==fcc); -} - -int -_Q_flt(QUAD x, QUAD y) -{ - enum fcc_type fcc; - fcc = _Q_cmpe(x,y); - return (fcc_less==fcc); -} - -int -_Q_fle(QUAD x, QUAD y) -{ - enum fcc_type fcc; - fcc = _Q_cmpe(x,y); - return (fcc_less==fcc||fcc_equal==fcc); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Q_get_rp_rd.S b/usr/src/lib/libbc/libc/gen/common/_Q_get_rp_rd.S deleted file mode 100644 index b8409bed81..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Q_get_rp_rd.S +++ /dev/null @@ -1,55 +0,0 @@ -! -! #ident "%Z%%M% %I% %E% SMI" -! -! Copyright 2005 Sun Microsystems, Inc. All rights reserved. -! Use is subject to license terms. -! -! CDDL HEADER START -! -! The contents of this file are subject to the terms of the -! Common Development and Distribution License, Version 1.0 only -! (the "License"). You may not use this file except in compliance -! with the License. -! -! You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -! or http://www.opensolaris.org/os/licensing. -! See the License for the specific language governing permissions -! and limitations under the License. -! -! When distributing Covered Code, include this CDDL HEADER in each -! file and include the License file at usr/src/OPENSOLARIS.LICENSE. -! If applicable, add the following below this CDDL HEADER, with the -! fields enclosed by brackets "[]" replaced with your own identifying -! information: Portions Copyright [yyyy] [name of copyright owner] -! -! CDDL HEADER END -! - -#include "SYS.h" - - ENTRY(_Q_get_rp_rd) - .global fp_precision, fp_direction -__Q_get_rp_rd: -#ifdef PIC - PIC_SETUP(o5) - ld [%o5+fp_direction],%o3 -#else - set fp_direction,%o3 -#endif - set 0xc0000000,%o4 ! mask of rounding direction bits - st %fsr,[%sp+0x44] - ld [%sp+0x44],%o0 ! o0 = fsr - and %o0,%o4,%o1 - srl %o1,30,%o1 - st %o1,[%o3] -#ifdef PIC - ld [%o5+fp_precision],%o3 -#else - set fp_precision,%o3 -#endif - set 0x30000000,%o4 - and %o0,%o4,%o1 - srl %o1,28,%o1 - retl - st %o1,[%o3] - SET_SIZE(_Q_get_rp_rd) diff --git a/usr/src/lib/libbc/libc/gen/common/_Q_itoq.c b/usr/src/lib/libbc/libc/gen/common/_Q_itoq.c deleted file mode 100644 index 31ca813b97..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Q_itoq.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "_Qquad.h" -#include "_Qglobals.h" - - -QUAD -_Q_itoq(int x) -{ - unpacked px; - QUAD q; - _fp_unpack(&px, (int *)&x,fp_op_integer); - _fp_pack(&px, (int *)&q,fp_op_extended); - return (q); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Q_mul.c b/usr/src/lib/libbc/libc/gen/common/_Q_mul.c deleted file mode 100644 index 9b80392317..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Q_mul.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "_Qquad.h" -#include "_Qglobals.h" - -QUAD -_Q_mul(QUAD x, QUAD y) -{ - unpacked px,py,pz; - QUAD z; - _fp_current_exceptions = 0; - _Q_get_rp_rd(); - _fp_unpack(&px, (int *)&x,fp_op_extended); - _fp_unpack(&py, (int *)&y,fp_op_extended); - _fp_mul(&px,&py,&pz); - _fp_pack(&pz, (int *)&z,fp_op_extended); - _Q_set_exception(_fp_current_exceptions); - return (z); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Q_neg.c b/usr/src/lib/libbc/libc/gen/common/_Q_neg.c deleted file mode 100644 index 9c19c980eb..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Q_neg.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "_Qquad.h" - -QUAD -_Q_neg(QUAD x) -{ - QUAD z; - int *pz = (int*) &z; - double dummy = 1.0; - z = x; - if((*(int*)&dummy)!=0) { - pz[0] ^= 0x80000000; - } else { - pz[3] ^= 0x80000000; - } - return (z); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Q_qtod.c b/usr/src/lib/libbc/libc/gen/common/_Q_qtod.c deleted file mode 100644 index e10417e8b3..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Q_qtod.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "_Qquad.h" -#include "_Qglobals.h" - -double -_Q_qtod(QUAD x) -{ - unpacked px; - double d; - _fp_current_exceptions = 0; - _Q_get_rp_rd(); - _fp_unpack(&px, (int *)&x,fp_op_extended); - _fp_pack(&px, (int *)&d,fp_op_double); - _Q_set_exception(_fp_current_exceptions); - return (d); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Q_qtoi.c b/usr/src/lib/libbc/libc/gen/common/_Q_qtoi.c deleted file mode 100644 index 1858c29c34..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Q_qtoi.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1995 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "_Qquad.h" -#include "_Qglobals.h" - -int -_Q_qtoi(QUAD x) -{ - unpacked px; - int i; - enum fp_direction_type saved_fp_direction = fp_direction; - - _fp_current_exceptions = 0; - fp_direction = fp_tozero; - _fp_unpack(&px, (int *)&x,fp_op_extended); - _fp_pack(&px,&i,fp_op_integer); - _Q_set_exception(_fp_current_exceptions); - fp_direction = saved_fp_direction; - return (i); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Q_qtos.c b/usr/src/lib/libbc/libc/gen/common/_Q_qtos.c deleted file mode 100644 index f034e87aed..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Q_qtos.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "_Qquad.h" -#include "_Qglobals.h" - -SINGLERESULT -_Q_qtos(QUAD x) -{ - unpacked px; - float s; - _fp_current_exceptions = 0; - _Q_get_rp_rd(); - _fp_unpack(&px, (int *)&x,fp_op_extended); - _fp_pack(&px, (int *)&s,fp_op_single); - _Q_set_exception(_fp_current_exceptions); - RETURNSINGLE(s); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Q_qtou.c b/usr/src/lib/libbc/libc/gen/common/_Q_qtou.c deleted file mode 100644 index 599d0dfdc1..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Q_qtou.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1995 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "_Qquad.h" -#include "_Qglobals.h" - -unsigned -_Q_qtou(QUAD x) -{ - unpacked px; - QUAD c; - unsigned u,*pc = (unsigned*)&c,r; - enum fp_direction_type saved_fp_direction = fp_direction; - - pc[0] = 0x401e0000; pc[1]=pc[2]=pc[3]=0; /* c = 2^31 */ - r = 0; - u = *(int*)&x; /* high part of x */ - if(u>=0x401e0000&&u<0x401f0000) { - r = 0x80000000; - x = _Q_sub(x,c); - } - - _fp_current_exceptions = 0; - fp_direction = fp_tozero; - _fp_unpack(&px, (int *)&x,fp_op_extended); - _fp_pack(&px, (int *)&u,fp_op_integer); - _Q_set_exception(_fp_current_exceptions); - fp_direction = saved_fp_direction; - return (u|r); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Q_sqrt.c b/usr/src/lib/libbc/libc/gen/common/_Q_sqrt.c deleted file mode 100644 index 15860abe8b..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Q_sqrt.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "_Qquad.h" -#include "_Qglobals.h" - -QUAD -_Q_sqrt(QUAD x) -{ - unpacked px,pz; - QUAD z; - _fp_current_exceptions = 0; - _Q_get_rp_rd(); - _fp_unpack(&px, (int *)&x,fp_op_extended); - _fp_sqrt(&px,&pz); - _fp_pack(&pz, (int *)&z,fp_op_extended); - _Q_set_exception(_fp_current_exceptions); - return (z); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Q_stoq.c b/usr/src/lib/libbc/libc/gen/common/_Q_stoq.c deleted file mode 100644 index c33f328414..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Q_stoq.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "_Qquad.h" -#include "_Qglobals.h" - -QUAD -_Q_stoq(SINGLE x) -{ - unpacked px; - QUAD q; - _fp_current_exceptions = 0; - _fp_unpack(&px, (int *)&x,fp_op_single); - _fp_pack(&px, (int *)&q,fp_op_extended); - _Q_set_exception(_fp_current_exceptions); - return (q); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Q_sub.c b/usr/src/lib/libbc/libc/gen/common/_Q_sub.c deleted file mode 100644 index 71497dbccb..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Q_sub.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "_Qquad.h" -#include "_Qglobals.h" - -QUAD -_Q_sub(QUAD x, QUAD y) -{ - unpacked px,py,pz; - QUAD z; - _fp_current_exceptions = 0; - _Q_get_rp_rd(); - _fp_unpack(&px,(int *)&x,fp_op_extended); - _fp_unpack(&py,(int *)&y,fp_op_extended); - _fp_sub(&px,&py,&pz); - _fp_pack(&pz,(int *)&z,fp_op_extended); - _Q_set_exception(_fp_current_exceptions); - return (z); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Q_utoq.c b/usr/src/lib/libbc/libc/gen/common/_Q_utoq.c deleted file mode 100644 index 7779ee4c4f..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Q_utoq.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "_Qquad.h" -#include "_Qglobals.h" - -QUAD -_Q_utoq(unsigned x) -{ - unpacked px; - QUAD q,c; - int *pc =(int*)&c; - pc[0] = 0x401e0000; pc[1]=pc[2]=pc[3]=0; /* pc = 2^31 */ - if((x&0x80000000)!=0) { - x ^= 0x80000000; - _fp_unpack(&px, (int *)&x,fp_op_integer); - _fp_pack(&px, (int *)&q,fp_op_extended); - q = _Q_add(q,c); - } else { - _fp_unpack(&px, (int *)&x,fp_op_integer); - _fp_pack(&px, (int *)&q,fp_op_extended); - } - return (q); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Qfaddsub.c b/usr/src/lib/libbc/libc/gen/common/_Qfaddsub.c deleted file mode 100644 index c9bc64f49e..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Qfaddsub.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -#include "_Qquad.h" -#include "_Qglobals.h" - -PRIVATE void -true_add(px, py, pz) - unpacked *px, *py, *pz; - -{ - unsigned c; - unpacked *pt; - - if ((int) px->fpclass < (int) py->fpclass) { /* Reverse. */ - pt = py; - py = px; - px = pt; - } - /* Now class(x) >= class(y). */ - switch (px->fpclass) { - case fp_quiet: /* NaN + x -> NaN */ - case fp_signaling: /* NaN + x -> NaN */ - case fp_infinity: /* Inf + x -> Inf */ - case fp_zero: /* 0 + 0 -> 0 */ - *pz = *px; - return; - default: - if (py->fpclass == fp_zero) { - *pz = *px; - return; - } - } - /* Now z is normal or subnormal. */ - /* Now y is normal or subnormal. */ - if (px->exponent < py->exponent) { /* Reverse. */ - pt = py; - py = px; - px = pt; - } - /* Now class(x) >= class(y). */ - pz->fpclass = px->fpclass; - pz->sign = px->sign; - pz->exponent = px->exponent; - pz->rounded = pz->sticky = 0; - - if (px->exponent != py->exponent) { /* pre-alignment required */ - fpu_rightshift(py, pz->exponent - py->exponent); - pz->rounded = py->rounded; - pz->sticky = py->sticky; - } - c = 0; - c = fpu_add3wc(&(pz->significand[3]),px->significand[3], - py->significand[3],c); - c = fpu_add3wc(&(pz->significand[2]),px->significand[2], - py->significand[2],c); - c = fpu_add3wc(&(pz->significand[1]),px->significand[1], - py->significand[1],c); - c = fpu_add3wc(&(pz->significand[0]),px->significand[0], - py->significand[0],c); - - /* Handle carry out of msb. */ - if(pz->significand[0]>=0x20000) { - fpu_rightshift(pz, 1); /* Carried out bit. */ - pz->exponent ++; /* Renormalize. */ - } - return; -} - -PRIVATE void -true_sub(px, py, pz) - unpacked *px, *py, *pz; - -{ - unsigned *z,g,s,r,c; - int n; - unpacked *pt; - - if ((int) px->fpclass < (int) py->fpclass) { /* Reverse. */ - pt = py; - py = px; - px = pt; - } - /* Now class(x) >= class(y). */ - *pz = *px; /* Tentative difference: x. */ - switch (pz->fpclass) { - case fp_quiet: /* NaN - x -> NaN */ - case fp_signaling: /* NaN - x -> NaN */ - return; - case fp_infinity: /* Inf - x -> Inf */ - if (py->fpclass == fp_infinity) { - fpu_error_nan(pz); /* Inf - Inf -> NaN */ - pz->fpclass = fp_quiet; - } - return; - case fp_zero: /* 0 - 0 -> 0 */ - pz->sign = (fp_direction == fp_negative); - return; - default: - if (py->fpclass == fp_zero) - return; - } - - /* x and y are both normal or subnormal. */ - - if (px->exponent < py->exponent) { /* Reverse. */ - pt = py; - py = px; - px = pt; - } - /* Now exp(x) >= exp(y). */ - pz->fpclass = px->fpclass; - pz->sign = px->sign; - pz->exponent = px->exponent; - pz->rounded = 0; - pz->sticky = 0; - z = pz->significand; - - if (px->exponent == py->exponent) { /* no pre-alignment required */ - c = 0; - c = fpu_sub3wc(&z[3],px->significand[3],py->significand[3],c); - c = fpu_sub3wc(&z[2],px->significand[2],py->significand[2],c); - c = fpu_sub3wc(&z[1],px->significand[1],py->significand[1],c); - c = fpu_sub3wc(&z[0],px->significand[0],py->significand[0],c); - if((z[0]|z[1]|z[2]|z[3])==0) { /* exact zero result */ - pz->sign = (fp_direction == fp_negative); - pz->fpclass = fp_zero; - return; - } - if(z[0]>=0x20000) { /* sign reversal occurred */ - pz->sign = py->sign; - c = 0; - c = fpu_neg2wc(&z[3],z[3],c); - c = fpu_neg2wc(&z[2],z[2],c); - c = fpu_neg2wc(&z[1],z[1],c); - c = fpu_neg2wc(&z[0],z[0],c); - } - fpu_normalize(pz); - return; - } else { /* pre-alignment required */ - fpu_rightshift(py, pz->exponent - py->exponent - 1); - r = py->rounded; /* rounded bit */ - s = py->sticky; /* sticky bit */ - fpu_rightshift(py, 1); - g = py->rounded; /* guard bit */ - if(s!=0) r = (r==0); - if((r|s)!=0) g = (g==0);/* guard and rounded bits of z */ - c = ((g|r|s)!=0); - c = fpu_sub3wc(&z[3],px->significand[3],py->significand[3],c); - c = fpu_sub3wc(&z[2],px->significand[2],py->significand[2],c); - c = fpu_sub3wc(&z[1],px->significand[1],py->significand[1],c); - c = fpu_sub3wc(&z[0],px->significand[0],py->significand[0],c); - - if(z[0]>=0x10000) { /* don't need post-shifted */ - pz->sticky = s|r; - pz->rounded = g; - } else { /* post-shifted left 1 bit */ - pz->sticky = s; - pz->rounded = r; - pz->significand[0] = (z[0]<<1)|((z[1]&0x80000000)>>31); - pz->significand[1] = (z[1]<<1)|((z[2]&0x80000000)>>31); - pz->significand[2] = (z[2]<<1)|((z[3]&0x80000000)>>31); - pz->significand[3] = (z[3]<<1)|g; - pz->exponent -= 1; - if(z[0]<0x10000) fpu_normalize(pz); - } - return; - } -} - -void -_fp_add(px, py, pz) - unpacked *px, *py, *pz; - -{ - if (px->sign == py->sign) - true_add(px, py, pz); - else - true_sub(px, py, pz); -} - -void -_fp_sub(px, py, pz) - unpacked *px, *py, *pz; - -{ - py->sign = 1 - py->sign; - if (px->sign == py->sign) - true_add(px, py, pz); - else - true_sub(px, py, pz); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Qfcompare.c b/usr/src/lib/libbc/libc/gen/common/_Qfcompare.c deleted file mode 100644 index 7b1a3136eb..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Qfcompare.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -#include "_Qquad.h" -#include "_Qglobals.h" - -enum fcc_type -_fp_compare(px, py, strict) - unpacked *px, *py; - int strict; /* 0 if quiet NaN unexceptional, 1 if - * exceptional */ - -{ - enum fcc_type cc; - int k,n; - - if ((px->fpclass == fp_quiet) || (py->fpclass == fp_quiet) || - (px->fpclass == fp_signaling) || (py->fpclass == fp_signaling)) { - if (strict) /* NaN */ - fpu_set_exception(fp_invalid); - cc = fcc_unordered; - } else if ((px->fpclass == fp_zero) && (py->fpclass == fp_zero)) - cc = fcc_equal; - /* both zeros */ - else if (px->sign < py->sign) - cc = fcc_greater; - else if (px->sign > py->sign) - cc = fcc_less; - else { /* signs the same, compute magnitude cc */ - if ((int) px->fpclass > (int) py->fpclass) - cc = fcc_greater; - else if ((int) px->fpclass < (int) py->fpclass) - cc = fcc_less; - else - /* same classes */ if (px->fpclass == fp_infinity) - cc = fcc_equal; /* same infinity */ - else if (px->exponent > py->exponent) - cc = fcc_greater; - else if (px->exponent < py->exponent) - cc = fcc_less; - else { /* equal exponents */ - n = fpu_cmpli(px->significand,py->significand,4); - if(n>0) cc = fcc_greater; - else if(n<0) cc = fcc_less; - else cc = fcc_equal; - } - if (px->sign) - switch (cc) { /* negative numbers */ - case fcc_less: - cc = fcc_greater; - break; - case fcc_greater: - cc = fcc_less; - break; - } - } - return (cc); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Qfdiv.c b/usr/src/lib/libbc/libc/gen/common/_Qfdiv.c deleted file mode 100644 index 90b408686b..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Qfdiv.c +++ /dev/null @@ -1,295 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -#include "_Qquad.h" -#include "_Qglobals.h" - -void -_fp_div(px, py, pz) - unpacked *px, *py, *pz; - -{ - unsigned r[4],*y,q,c; - int n; - - *pz = *px; - pz->sign = px->sign ^ py->sign; - - if ((py->fpclass == fp_quiet) || (py->fpclass == fp_signaling)) { - *pz = *py; - return; - } - switch (px->fpclass) { - case fp_quiet: - case fp_signaling: - return; - case fp_zero: - case fp_infinity: - if (px->fpclass == py->fpclass) { /* 0/0 or inf/inf */ - fpu_error_nan(pz); - pz->fpclass = fp_quiet; - } - return; - case fp_normal: - switch (py->fpclass) { - case fp_zero: /* number/0 */ - fpu_set_exception(fp_division); - pz->fpclass = fp_infinity; - return; - case fp_infinity: /* number/inf */ - pz->fpclass = fp_zero; - return; - } - } - - /* Now x and y are both normal or subnormal. */ - - r[0] = px->significand[0]; - r[1] = px->significand[1]; - r[2] = px->significand[2]; - r[3] = px->significand[3]; - y = py->significand; - - if(fpu_cmpli(r,y,4)>=0) - pz->exponent = px->exponent - py->exponent; - else - pz->exponent = px->exponent - py->exponent - 1; - - q=0; - while(q<0x10000) { /* generate quo[0] */ - q<<=1; - if(fpu_cmpli(r,y,4)>=0) { - q += 1; /* if r>y do r-=y and q+=1 */ - c = 0; - c = fpu_sub3wc(&r[3],r[3],y[3],c); - c = fpu_sub3wc(&r[2],r[2],y[2],c); - c = fpu_sub3wc(&r[1],r[1],y[1],c); - c = fpu_sub3wc(&r[0],r[0],y[0],c); - } - r[0] = (r[0]<<1)|((r[1]&0x80000000)>>31); /* r << 1 */ - r[1] = (r[1]<<1)|((r[2]&0x80000000)>>31); - r[2] = (r[2]<<1)|((r[3]&0x80000000)>>31); - r[3] = (r[3]<<1); - } - pz->significand[0]=q; - q=0; /* generate quo[1] */ - n = 32; - while(n--) { - q<<=1; - if(fpu_cmpli(r,y,4)>=0) { - q += 1; /* if r>y do r-=y and q+=1 */ - c = 0; - c = fpu_sub3wc(&r[3],r[3],y[3],c); - c = fpu_sub3wc(&r[2],r[2],y[2],c); - c = fpu_sub3wc(&r[1],r[1],y[1],c); - c = fpu_sub3wc(&r[0],r[0],y[0],c); - } - r[0] = (r[0]<<1)|((r[1]&0x80000000)>>31); /* r << 1 */ - r[1] = (r[1]<<1)|((r[2]&0x80000000)>>31); - r[2] = (r[2]<<1)|((r[3]&0x80000000)>>31); - r[3] = (r[3]<<1); - } - pz->significand[1] = q; - q=0; /* generate quo[2] */ - n = 32; - while(n--) { - q<<=1; - if(fpu_cmpli(r,y,4)>=0) { - q += 1; /* if r>y do r-=y and q+=1 */ - c = 0; - c = fpu_sub3wc(&r[3],r[3],y[3],c); - c = fpu_sub3wc(&r[2],r[2],y[2],c); - c = fpu_sub3wc(&r[1],r[1],y[1],c); - c = fpu_sub3wc(&r[0],r[0],y[0],c); - } - r[0] = (r[0]<<1)|((r[1]&0x80000000)>>31); /* r << 1 */ - r[1] = (r[1]<<1)|((r[2]&0x80000000)>>31); - r[2] = (r[2]<<1)|((r[3]&0x80000000)>>31); - r[3] = (r[3]<<1); - } - pz->significand[2] = q; - q=0; /* generate quo[3] */ - n = 32; - while(n--) { - q<<=1; - if(fpu_cmpli(r,y,4)>=0) { - q += 1; /* if r>y do r-=y and q+=1 */ - c = 0; - c = fpu_sub3wc(&r[3],r[3],y[3],c); - c = fpu_sub3wc(&r[2],r[2],y[2],c); - c = fpu_sub3wc(&r[1],r[1],y[1],c); - c = fpu_sub3wc(&r[0],r[0],y[0],c); - } - r[0] = (r[0]<<1)|((r[1]&0x80000000)>>31); /* r << 1 */ - r[1] = (r[1]<<1)|((r[2]&0x80000000)>>31); - r[2] = (r[2]<<1)|((r[3]&0x80000000)>>31); - r[3] = (r[3]<<1); - } - pz->significand[3] = q; - if((r[0]|r[1]|r[2]|r[3])==0) pz->sticky = pz->rounded = 0; - else { - pz->sticky = 1; /* half way case won't occur */ - if(fpu_cmpli(r,y,4)>=0) pz->rounded = 1; - } -} - -void -_fp_sqrt(px, pz) - unpacked *px, *pz; - -{ /* *pz gets sqrt(*px) */ - - unsigned *x,r,c,q,t[4],s[4]; - *pz = *px; - switch (px->fpclass) { - case fp_quiet: - case fp_signaling: - case fp_zero: - return; - case fp_infinity: - if (px->sign == 1) { /* sqrt(-inf) */ - fpu_error_nan(pz); - pz->fpclass = fp_quiet; - } - return; - case fp_normal: - if (px->sign == 1) { /* sqrt(-norm) */ - fpu_error_nan(pz); - pz->fpclass = fp_quiet; - return; - } - } - - /* Now x is normal. */ - x = px->significand; - if (px->exponent & 1) { /* sqrt(1.f * 2**odd) = sqrt (2.+2f) * - * 2**(odd-1)/2 */ - pz->exponent = (px->exponent - 1) / 2; - x[0] = (x[0]<<1)|((x[1]&0x80000000)>>31); /* x<<1 */ - x[1] = (x[1]<<1)|((x[2]&0x80000000)>>31); - x[2] = (x[2]<<1)|((x[3]&0x80000000)>>31); - x[3] = (x[3]<<1); - } else { /* sqrt(1.f * 2**even) = sqrt (1.f) * - * 2**(even)/2 */ - pz->exponent = px->exponent / 2; - } - s[0]=s[1]=s[2]=s[3]=t[0]=t[1]=t[2]=t[3]=0; - q = 0; - r = 0x00010000; - while(r!=0) { /* compute sqrt[0] */ - t[0] = s[0]+r; - if(t[0]<=x[0]) { - s[0] = t[0]+r; - x[0] -= t[0]; - q += r; - } - x[0] = (x[0]<<1)|((x[1]&0x80000000)>>31); /* x<<1 */ - x[1] = (x[1]<<1)|((x[2]&0x80000000)>>31); - x[2] = (x[2]<<1)|((x[3]&0x80000000)>>31); - x[3] = (x[3]<<1); - r>>=1; - } - pz->significand[0] = q; - q = 0; - r = 0x80000000; - while(r!=0) { /* compute sqrt[1] */ - t[1] = s[1]+r; /* no carry */ - t[0] = s[0]; - if(fpu_cmpli(t,x,2)<=0) { - c = 0; - c = fpu_add3wc(&s[1],t[1],r,c); - c = fpu_add3wc(&s[0],t[0],0,c); - c = 0; - c = fpu_sub3wc(&x[1],x[1],t[1],c); - c = fpu_sub3wc(&x[0],x[0],t[0],c); - q += r; - } - x[0] = (x[0]<<1)|((x[1]&0x80000000)>>31); /* x<<1 */ - x[1] = (x[1]<<1)|((x[2]&0x80000000)>>31); - x[2] = (x[2]<<1)|((x[3]&0x80000000)>>31); - x[3] = (x[3]<<1); - r>>=1; - } - pz->significand[1] = q; - q = 0; - r = 0x80000000; - while(r!=0) { /* compute sqrt[2] */ - t[2] = s[2]+r; /* no carry */ - t[1] = s[1]; - t[0] = s[0]; - if(fpu_cmpli(t,x,3)<=0) { - c = 0; - c = fpu_add3wc(&s[2],t[2],r,c); - c = fpu_add3wc(&s[1],t[1],0,c); - c = fpu_add3wc(&s[0],t[0],0,c); - c = 0; - c = fpu_sub3wc(&x[2],x[2],t[2],c); - c = fpu_sub3wc(&x[1],x[1],t[1],c); - c = fpu_sub3wc(&x[0],x[0],t[0],c); - q += r; - } - x[0] = (x[0]<<1)|((x[1]&0x80000000)>>31); /* x<<1 */ - x[1] = (x[1]<<1)|((x[2]&0x80000000)>>31); - x[2] = (x[2]<<1)|((x[3]&0x80000000)>>31); - x[3] = (x[3]<<1); - r>>=1; - } - pz->significand[2] = q; - q = 0; - r = 0x80000000; - while(r!=0) { /* compute sqrt[3] */ - t[3] = s[3]+r; /* no carry */ - t[2] = s[2]; - t[1] = s[1]; - t[0] = s[0]; - if(fpu_cmpli(t,x,4)<=0) { - c = 0; - c = fpu_add3wc(&s[3],t[3],r,c); - c = fpu_add3wc(&s[2],t[2],0,c); - c = fpu_add3wc(&s[1],t[1],0,c); - c = fpu_add3wc(&s[0],t[0],0,c); - c = 0; - c = fpu_sub3wc(&x[3],x[3],t[3],c); - c = fpu_sub3wc(&x[2],x[2],t[2],c); - c = fpu_sub3wc(&x[1],x[1],t[1],c); - c = fpu_sub3wc(&x[0],x[0],t[0],c); - q += r; - } - x[0] = (x[0]<<1)|((x[1]&0x80000000)>>31); /* x<<1 */ - x[1] = (x[1]<<1)|((x[2]&0x80000000)>>31); - x[2] = (x[2]<<1)|((x[3]&0x80000000)>>31); - x[3] = (x[3]<<1); - r>>=1; - } - pz->significand[3] = q; - if((x[0]|x[1]|x[2]|x[3])==0) { - pz->sticky = pz->rounded = 0; - } else { - pz->sticky = 1; - if(fpu_cmpli(s,x,4)<0) pz->rounded=1; else pz->rounded = 0; - } -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Qfmul.c b/usr/src/lib/libbc/libc/gen/common/_Qfmul.c deleted file mode 100644 index bd55bedd7c..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Qfmul.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -#include "_Qquad.h" -#include "_Qglobals.h" - - -void -_fp_mul(px, py, pz) - unpacked *px, *py, *pz; - -{ - unpacked *pt; - unsigned acc[4]; /* Product accumulator. */ - unsigned i,j,y,*x,s,r,c; - - if ((int) px->fpclass < (int) py->fpclass) { - pt = px; - px = py; - py = pt; - } - /* Now class(x) >= class(y). */ - - *pz = *px; - pz->sign = px->sign ^ py->sign; - - switch (px->fpclass) { - case fp_quiet: - case fp_signaling: - case fp_zero: - return; - case fp_infinity: - if (py->fpclass == fp_zero) { - fpu_error_nan(pz); - pz->fpclass = fp_quiet; - } - return; - case fp_normal: - if (py->fpclass == fp_zero) { - pz->fpclass = fp_zero; - return; - } - } - - /* Now x and y are both normal or subnormal. */ - - x = px->significand; /* save typing */ - - s=r=acc[0]=acc[1]=acc[2]=acc[3]=0; /* intialize acc to zero */ - - y = py->significand[3]; /* py->significand[3] * x */ - if(y!=0) { - j=1; - do { - s |= r; /* shift acc right one bit */ - r = acc[3]&1; - acc[3] = ((acc[2]&1)<<31)|(acc[3]>>1); - acc[2] = ((acc[1]&1)<<31)|(acc[2]>>1); - acc[1] = ((acc[0]&1)<<31)|(acc[1]>>1); - acc[0] = (acc[0]>>1); - if(j&y) { /* bit i of y != 0, add x to acc */ - c = 0; - c = fpu_add3wc(&acc[3],acc[3],x[3],c); - c = fpu_add3wc(&acc[2],acc[2],x[2],c); - c = fpu_add3wc(&acc[1],acc[1],x[1],c); - c = fpu_add3wc(&acc[0],acc[0],x[0],c); - } - j += j; - } while (j!=0); - } - - y = py->significand[2]; /* py->significand[2] * x */ - if(y!=0) { - j=1; - do { - s |= r; /* shift acc right one bit */ - r = acc[3]&1; - acc[3] = ((acc[2]&1)<<31)|(acc[3]>>1); - acc[2] = ((acc[1]&1)<<31)|(acc[2]>>1); - acc[1] = ((acc[0]&1)<<31)|(acc[1]>>1); - acc[0] = (acc[0]>>1); - if(j&y) { /* bit i of y != 0, add x to acc */ - c = 0; - c = fpu_add3wc(&acc[3],acc[3],x[3],c); - c = fpu_add3wc(&acc[2],acc[2],x[2],c); - c = fpu_add3wc(&acc[1],acc[1],x[1],c); - c = fpu_add3wc(&acc[0],acc[0],x[0],c); - } - j += j; - } while (j!=0); - } else { - s |= r|(acc[3]&0x7fffffff); - r = (acc[3]&0x80000000)>>31; - acc[3]=acc[2];acc[2]=acc[1];acc[1]=acc[0];acc[0]=0; - } - - y = py->significand[1]; /* py->significand[1] * x */ - if(y!=0) { - j=1; - do { - s |= r; /* shift acc right one bit */ - r = acc[3]&1; - acc[3] = ((acc[2]&1)<<31)|(acc[3]>>1); - acc[2] = ((acc[1]&1)<<31)|(acc[2]>>1); - acc[1] = ((acc[0]&1)<<31)|(acc[1]>>1); - acc[0] = (acc[0]>>1); - if(j&y) { /* bit i of y != 0, add x to acc */ - c = 0; - c = fpu_add3wc(&acc[3],acc[3],x[3],c); - c = fpu_add3wc(&acc[2],acc[2],x[2],c); - c = fpu_add3wc(&acc[1],acc[1],x[1],c); - c = fpu_add3wc(&acc[0],acc[0],x[0],c); - } - j += j; - } while (j!=0); - } else { - s |= r|(acc[3]&0x7fffffff); - r = (acc[3]&0x80000000)>>31; - acc[3]=acc[2];acc[2]=acc[1];acc[1]=acc[0];acc[0]=0; - } - - /* py->significand[0] * x */ - y = py->significand[0]; /* y is of form 0x0001???? */ - j=1; - do { - s |= r; /* shift acc right one bit */ - r = acc[3]&1; - acc[3] = ((acc[2]&1)<<31)|(acc[3]>>1); - acc[2] = ((acc[1]&1)<<31)|(acc[2]>>1); - acc[1] = ((acc[0]&1)<<31)|(acc[1]>>1); - acc[0] = (acc[0]>>1); - if(j&y) { /* bit i of y != 0, add x to acc */ - c = 0; - c = fpu_add3wc(&acc[3],acc[3],x[3],c); - c = fpu_add3wc(&acc[2],acc[2],x[2],c); - c = fpu_add3wc(&acc[1],acc[1],x[1],c); - c = fpu_add3wc(&acc[0],acc[0],x[0],c); - } - j += j; - } while (j<=y); - - if(acc[0]>=0x20000) { /* right shift one bit to normalize */ - pz->exponent = px->exponent + py->exponent + 1; - pz->sticky = s|r; - pz->rounded = acc[3]&1; - pz->significand[3]=((acc[2]&1)<<31)|(acc[3]>>1); - pz->significand[2]=((acc[1]&1)<<31)|(acc[2]>>1); - pz->significand[1]=((acc[0]&1)<<31)|(acc[1]>>1); - pz->significand[0]=(acc[0]>>1); - } else { - pz->exponent = px->exponent + py->exponent; - pz->sticky = s; - pz->rounded = r; - pz->significand[3]=acc[3]; - pz->significand[2]=acc[2]; - pz->significand[1]=acc[1]; - pz->significand[0]=acc[0]; - } -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Qfpack.c b/usr/src/lib/libbc/libc/gen/common/_Qfpack.c deleted file mode 100644 index f7462d9fc2..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Qfpack.c +++ /dev/null @@ -1,428 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -/* Pack procedures for Sparc FPU simulator. */ - -#include "_Qquad.h" -#include "_Qglobals.h" - -PRIVATE int -overflow_to_infinity(sign) - int sign; - -/* Returns 1 if overflow should go to infinity, 0 if to max finite. */ - -{ - int inf; - - switch (fp_direction) { - case fp_nearest: - inf = 1; - break; - case fp_tozero: - inf = 0; - break; - case fp_positive: - inf = !sign; - break; - case fp_negative: - inf = sign; - break; - } - return (inf); -} - -PRIVATE void -round(pu) - unpacked *pu; - -/* Round according to current rounding mode. */ - -{ - int increment; /* boolean to indicate round up */ - int sr; - sr = pu->sticky|pu->rounded; - - if (sr == 0) - return; - fpu_set_exception(fp_inexact); - switch (fp_direction) { - case fp_nearest: - increment = pu->rounded; - break; - case fp_tozero: - increment = 0; - break; - case fp_positive: - increment = (pu->sign == 0) & (sr != 0); - break; - case fp_negative: - increment = (pu->sign != 0) & (sr != 0); - break; - } - if (increment) { - pu->significand[3]++; - if (pu->significand[3] == 0) { - pu->significand[2]++; - if (pu->significand[2] == 0) { - pu->significand[1]++; - if (pu->significand[1] == 0) { - pu->significand[0]++; /* rounding carried out */ - if( pu->significand[0] == 0x20000) { - pu->exponent++; - pu->significand[0] = 0x10000; - } - } - } - } - } - if ((fp_direction == fp_nearest) && - (pu->sticky == 0) && increment!=0) { /* ambiguous case */ - pu->significand[3] &= 0xfffffffe; /* force round to even */ - } -} - -PRIVATE void -packinteger(pu, px) - unpacked *pu; /* unpacked result */ - int *px; /* packed integer */ -{ - switch (pu->fpclass) { - case fp_zero: - *px = 0; - break; - case fp_normal: - if (pu->exponent >= 32) - goto overflow; - fpu_rightshift(pu, 112 - pu->exponent); - round(pu); - if (pu->significand[3] >= 0x80000000) - if ((pu->sign == 0)||(pu->significand[3] > 0x80000000)) - goto overflow; - *px = pu->significand[3]; - if (pu->sign) - *px = -*px; - break; - case fp_infinity: - case fp_quiet: - case fp_signaling: -overflow: - if (pu->sign) - *px = 0x80000000; - else - *px = 0x7fffffff; - _fp_current_exceptions &= ~(1 << (int) fp_inexact); - fpu_set_exception(fp_invalid); - break; - } -} - -PRIVATE void -packsingle(pu, px) - unpacked *pu; /* unpacked result */ - single_type *px; /* packed single */ -{ - px->sign = pu->sign; - switch (pu->fpclass) { - case fp_zero: - px->exponent = 0; - px->significand = 0; - break; - case fp_infinity: -infinity: - px->exponent = 0xff; - px->significand = 0; - break; - case fp_quiet: - case fp_signaling: - fpu_rightshift(pu, 113-24); - px->exponent = 0xff; - px->significand = 0x400000|(0x3fffff&pu->significand[3]); - break; - case fp_normal: - fpu_rightshift(pu, 113-24); - pu->exponent += SINGLE_BIAS; - if (pu->exponent <= 0) { - px->exponent = 0; - fpu_rightshift(pu, 1 - pu->exponent); - round(pu); - if (pu->significand[3] == 0x800000) { /* rounded - * back up to - * normal */ - px->exponent = 1; - px->significand = 0; - return; - } - if (_fp_current_exceptions & (1 << fp_inexact)) - fpu_set_exception(fp_underflow); - px->significand = 0x7fffff & pu->significand[3]; - return; - } - round(pu); - if (pu->significand[3] == 0x1000000) { /* rounding overflow */ - pu->significand[3] = 0x800000; - pu->exponent += 1; - } - if (pu->exponent >= 0xff) { - fpu_set_exception(fp_overflow); - fpu_set_exception(fp_inexact); - if (overflow_to_infinity(pu->sign)) - goto infinity; - px->exponent = 0xfe; - px->significand = 0x7fffff; - return; - } - px->exponent = pu->exponent; - px->significand = 0x7fffff & pu->significand[3]; - } -} - -PRIVATE void -packdouble(pu, px, py) - unpacked *pu; /* unpacked result */ - double_type *px; /* packed double */ - unsigned *py; -{ - px->sign = pu->sign; - switch (pu->fpclass) { - case fp_zero: - px->exponent = 0; - px->significand = 0; - *py = 0; - break; - case fp_infinity: -infinity: - px->exponent = 0x7ff; - px->significand = 0; - *py = 0; - break; - case fp_quiet: - case fp_signaling: - fpu_rightshift(pu, 113-53); - px->exponent = 0x7ff; - px->significand = 0x80000 | (0x7ffff & pu->significand[2]); - *py = pu->significand[3]; - break; - case fp_normal: - fpu_rightshift(pu, 113-53); - pu->exponent += DOUBLE_BIAS; - if (pu->exponent <= 0) { /* underflow */ - px->exponent = 0; - fpu_rightshift(pu, 1 - pu->exponent); - round(pu); - if (pu->significand[2] == 0x100000) { /* rounded - * back up to - * normal */ - px->exponent = 1; - px->significand = 0; - *py = 0; - return; - } - if (_fp_current_exceptions & (1 << fp_inexact)) - fpu_set_exception(fp_underflow); - px->exponent = 0; - px->significand = 0xfffff & pu->significand[2]; - *py = pu->significand[3]; - return; - } - round(pu); - if (pu->significand[2] == 0x200000) { /* rounding overflow */ - pu->significand[2] = 0x100000; - pu->exponent += 1; - } - if (pu->exponent >= 0x7ff) { /* overflow */ - fpu_set_exception(fp_overflow); - fpu_set_exception(fp_inexact); - if (overflow_to_infinity(pu->sign)) - goto infinity; - px->exponent = 0x7fe; - px->significand = 0xfffff; - *py = 0xffffffff; - return; - } - px->exponent = pu->exponent; - px->significand = 0xfffff & pu->significand[2]; - *py = pu->significand[3]; - break; - } -} - -PRIVATE void -packextended(pu, px, py, pz, pw) - unpacked *pu; /* unpacked result */ - extended_type *px; /* packed extended */ - unsigned *py, *pz, *pw; -{ - px->sign = pu->sign; - switch (pu->fpclass) { - case fp_zero: - px->exponent = 0; - px->significand = 0; - *pz = 0; - *py = 0; - *pw = 0; - break; - case fp_infinity: -infinity: - px->exponent = 0x7fff; - px->significand = 0; - *pz = 0; - *py = 0; - *pw = 0; - break; - case fp_quiet: - case fp_signaling: - px->exponent = 0x7fff; - px->significand = 0x8000 | pu->significand[0]; /* Insure quiet - * nan. */ - *py = pu->significand[1]; - *pz = pu->significand[2]; - *pw = pu->significand[3]; - break; - case fp_normal: - pu->exponent += EXTENDED_BIAS; - if (pu->exponent <= 0) { /* underflow */ - fpu_rightshift(pu, 1-pu->exponent); - round(pu); - if (pu->significand[0] < 0x00010000) { /* not rounded - * back up - * to normal */ - if (_fp_current_exceptions & (1 << fp_inexact)) - fpu_set_exception(fp_underflow); - px->exponent = 0; - } else - px->exponent = 1; - px->significand = pu->significand[0]; - *py = pu->significand[1]; - *pz = pu->significand[2]; - *pw = pu->significand[3]; - return; - } - round(pu); /* rounding overflow handled in round() */ - if (pu->exponent >= 0x7fff) { /* overflow */ - fpu_set_exception(fp_overflow); - fpu_set_exception(fp_inexact); - if (overflow_to_infinity(pu->sign)) - goto infinity; - px->exponent = 0x7ffe; /* overflow to max norm */ - px->significand = 0xffff; - *py = 0xffffffff; - *pz = 0xffffffff; - *pw = 0xffffffff; - return; - } - px->exponent = pu->exponent; - px->significand = pu->significand[0]; - *py = pu->significand[1]; - *pz = pu->significand[2]; - *pw = pu->significand[3]; - break; - } -} - -void -_fp_pack(pu, n, type) - unpacked *pu; /* unpacked operand */ - int *n; /* output result's address */ - enum fp_op_type type; /* type of datum */ - -{ - switch (type) { - case fp_op_integer: - { - packinteger(pu, n); - break; - } - case fp_op_single: - { - single_type x; - packsingle(pu, &x); - n[0] = *(int*)&x; - break; - } - case fp_op_double: - { - double_type x; - double t=1.0; - int i0,i1; - if((*(int*)&t)!=0) {i0=0;i1=1;} else {i0=1;i1=0;} - packdouble(pu, &x,&n[i1]); - n[i0] = *(int*)&x; - break; - } - case fp_op_extended: - { - extended_type x; - unsigned y, z, w; - unpacked u; - int k; - switch (fp_precision) { /* Implement extended - * rounding precision mode. */ - case fp_single: - { - single_type tx; - packsingle(pu, &tx); - pu = &u; - unpacksingle(pu, tx); - break; - } - case fp_double: - { - double_type tx; - unsigned ty; - packdouble(pu, &tx, &ty); - pu = &u; - unpackdouble(pu, tx, ty); - break; - } - case fp_precision_3: /* rounded to 64 bits */ - { - k = pu->exponent+ EXTENDED_BIAS; - if(k>=0) k = 113-64; - else k = 113-64-k; - fpu_rightshift(pu,113-64); - round(pu); - pu->sticky=pu->rounded=0; - pu->exponent += k; - fpu_normalize(pu); - break; - } - } - { - int i0,i1,i2,i3; - double t = 1.0; - if((*(int*)&t)!=0) {i0=0;i1=1;i2=2;i3=3;} - else {i0=3;i1=2;i2=1;i3=0;} - packextended(pu, &x, &n[i1], &n[i2], &n[i3]); - n[i0] = *(int*)&x; - } - - break; - } - } -} - diff --git a/usr/src/lib/libbc/libc/gen/common/_Qfunpack.c b/usr/src/lib/libbc/libc/gen/common/_Qfunpack.c deleted file mode 100644 index 1e744d94ef..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Qfunpack.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -/* Unpack procedures for Sparc FPU simulator. */ - -#include "_Qquad.h" -#include "_Qglobals.h" - -PRIVATE void -unpackinteger(pu, x) - unpacked *pu; /* unpacked result */ - int x; /* packed integer */ -{ - unsigned ux; - pu->sticky = pu->rounded = 0; - if (x == 0) { - pu->sign = 0; - pu->fpclass = fp_zero; - } else { - (*pu).sign = x < 0; - (*pu).fpclass = fp_normal; - (*pu).exponent = INTEGER_BIAS; - if(x<0) ux = -x; else ux = x; - (*pu).significand[0] = ux>>15; - (*pu).significand[1] = (ux&0x7fff)<<17; - (*pu).significand[2] = 0; - (*pu).significand[3] = 0; - fpu_normalize(pu); - } -} - -void -unpacksingle(pu, x) - unpacked *pu; /* unpacked result */ - single_type x; /* packed single */ -{ - unsigned u; - pu->sticky = pu->rounded = 0; - u = x.significand; - (*pu).sign = x.sign; - pu->significand[1] = 0; - pu->significand[2] = 0; - pu->significand[3] = 0; - if (x.exponent == 0) { /* zero or sub */ - if (x.significand == 0) { /* zero */ - pu->fpclass = fp_zero; - return; - } else { /* subnormal */ - pu->fpclass = fp_normal; - pu->exponent = -SINGLE_BIAS-6; - pu->significand[0]=u; - fpu_normalize(pu); - return; - } - } else if (x.exponent == 0xff) { /* inf or nan */ - if (x.significand == 0) { /* inf */ - pu->fpclass = fp_infinity; - return; - } else { /* nan */ - if ((u & 0x400000) != 0) { /* quiet */ - pu->fpclass = fp_quiet; - } else {/* signaling */ - pu->fpclass = fp_signaling; - fpu_set_exception(fp_invalid); - } - pu->significand[0] = 0x18000 | (u >> 7); - (*pu).significand[1]=((u&0x7f)<<25); - return; - } - } - (*pu).exponent = x.exponent - SINGLE_BIAS; - (*pu).fpclass = fp_normal; - (*pu).significand[0]=0x10000|(u>>7); - (*pu).significand[1]=((u&0x7f)<<25); -} - -void -unpackdouble(pu, x, y) - unpacked *pu; /* unpacked result */ - double_type x; /* packed double */ - unsigned y; -{ - unsigned u; - pu->sticky = pu->rounded = 0; - u = x.significand; - (*pu).sign = x.sign; - pu->significand[1] = y; - pu->significand[2] = 0; - pu->significand[3] = 0; - if (x.exponent == 0) { /* zero or sub */ - if ((x.significand == 0) && (y == 0)) { /* zero */ - pu->fpclass = fp_zero; - return; - } else { /* subnormal */ - pu->fpclass = fp_normal; - pu->exponent = -DOUBLE_BIAS-3; - pu->significand[0] = u; - fpu_normalize(pu); - return; - } - } else if (x.exponent == 0x7ff) { /* inf or nan */ - if ((u|y) == 0) { /* inf */ - pu->fpclass = fp_infinity; - return; - } else { /* nan */ - if ((u & 0x80000) != 0) { /* quiet */ - pu->fpclass = fp_quiet; - } else {/* signaling */ - pu->fpclass = fp_signaling; - fpu_set_exception(fp_invalid); - } - pu->significand[0] = 0x18000 | (u >> 4); - (*pu).significand[1]=((u&0xf)<<28)|(y>>4); - (*pu).significand[2]=((y&0xf)<<28); - return; - } - } - (*pu).exponent = x.exponent - DOUBLE_BIAS; - (*pu).fpclass = fp_normal; - (*pu).significand[0]=0x10000|(u>>4); - (*pu).significand[1]=((u&0xf)<<28)|(y>>4); - (*pu).significand[2]=((y&0xf)<<28); -} - -PRIVATE void -unpackextended(pu, x, y, z, w) - unpacked *pu; /* unpacked result */ - extended_type x; /* packed extended */ - unsigned y, z, w; -{ - unsigned u; - pu->sticky = pu->rounded = 0; - u = x.significand; - (*pu).sign = x.sign; - (*pu).fpclass = fp_normal; - (*pu).exponent = x.exponent - EXTENDED_BIAS; - (*pu).significand[0] = (x.exponent==0)? u:0x10000|u; - (*pu).significand[1] = y; - (*pu).significand[2] = z; - (*pu).significand[3] = w; - if (x.exponent < 0x7fff) { /* zero, normal, or subnormal */ - if ((z|y|w|pu->significand[0]) == 0) { /* zero */ - pu->fpclass = fp_zero; - return; - } else { /* normal or subnormal */ - if(x.exponent==0) { - fpu_normalize(pu); - pu->exponent += 1; - } - return; - } - } else { /* inf or nan */ - if ((u|z|y|w) == 0) { /* inf */ - pu->fpclass = fp_infinity; - return; - } else { /* nan */ - if ((u & 0x00008000) != 0) { /* quiet */ - pu->fpclass = fp_quiet; - } else {/* signaling */ - pu->fpclass = fp_signaling; - fpu_set_exception(fp_invalid); - } - pu->significand[0] |= 0x8000; /* make quiet */ - return; - } -} -} - -void -_fp_unpack(pu, n, dtype) - unpacked *pu; /* unpacked result */ - int *n; /* input array */ - enum fp_op_type dtype; /* type of datum */ - -{ - switch ((int) dtype) { - case fp_op_integer: - unpackinteger(pu, n[0]); - break; - case fp_op_single: - { - single_type x; - *(int*)&x = n[0]; - unpacksingle(pu, x); - break; - } - case fp_op_double: - { - double_type x; - double t=1.0; int i0,i1; - if((*(int*)&t)!=0) {i0=0;i1=1;} else {i0=1;i1=0;} - *(int*)&x = n[i0]; - unpackdouble(pu, x, n[i1]); - break; - } - case fp_op_extended: - { - extended_type x; - double t=1.0; int i0,i1,i2,i3; - if((*(int*)&t)!=0) {i0=0;i1=1;i2=2;i3=3;} - else {i0=3;i1=2;i2=1;i3=0;} - *(int*)&x = n[i0]; - unpackextended(pu, x, n[i1], n[i2], n[i3]); - break; - } - } -} diff --git a/usr/src/lib/libbc/libc/gen/common/_Qfutility.c b/usr/src/lib/libbc/libc/gen/common/_Qfutility.c deleted file mode 100644 index ea8503bdf2..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Qfutility.c +++ /dev/null @@ -1,278 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -/* Utility functions for Sparc FPU simulator. */ - -#include "_Qquad.h" -#include "_Qglobals.h" - - -void -fpu_normalize(pu) - unpacked *pu; - -/* Normalize a number. Does not affect zeros, infs, or NaNs. */ -/* The number will be normalized to 113 bit extended: - * 0x0001####,0x########,0x########,0x########. - */ - -{ - unsigned u,u0,u1,u2,u3,m,n,k; - u0 = pu->significand[0]; - u1 = pu->significand[1]; - u2 = pu->significand[2]; - u3 = pu->significand[3]; - if ((*pu).fpclass == fp_normal) { - if ((u0|u1|u2|u3)==0) { - (*pu).fpclass = fp_zero; - return; - } - while (u0 == 0) { - u0 = u1; u1=u2; u2=u3; u3=0; - (*pu).exponent = (*pu).exponent - 32; - } - if (u0>=0x20000) { /* u3 should be zero */ - n=1; u = u0>>1; - while(u>=0x20000) {u >>= 1; n += 1;} - m = (1<<n)-1; - k = 32-n; - (*pu).exponent += n; - u3 = ((u2&m)<<k)|(u3>>n); - u2 = ((u1&m)<<k)|(u2>>n); - u1 = ((u0&m)<<k)|(u1>>n); - u0 = u; - } else if(u0<0x10000) { - n=1; u = u0<<1; - while(u<0x10000) {u <<= 1; n += 1;} - k = 32-n; - m = -(1<<k); - (*pu).exponent -= n; - u0 = (u0<<n)|((u1&m)>>k); - u1 = (u1<<n)|((u2&m)>>k); - u2 = (u2<<n)|((u3&m)>>k); - u3 = (u3<<n); - } - pu->significand[0] = u0; - pu->significand[1] = u1; - pu->significand[2] = u2; - pu->significand[3] = u3; - } -} - -void -fpu_rightshift(pu, n) - unpacked *pu; - int n; - -/* Right shift significand sticky by n bits. */ - -{ - unsigned m,k,j,u0,u1,u2,u3; - if (n > 113) { /* drastic */ - if (((*pu).significand[0] | (*pu).significand[1] - | (*pu).significand[2] | (*pu).significand[3]) == 0){ - /* really zero */ - pu->fpclass = fp_zero; - return; - } else { - pu->rounded = 0; - pu->sticky = 1; - pu->significand[3] = 0; - pu->significand[2] = 0; - pu->significand[1] = 0; - pu->significand[0] = 0; - return; - } - } - while (n >= 32) { /* big shift */ - pu->sticky |= pu->rounded | (pu->significand[3]&0x7fffffff); - pu->rounded = (*pu).significand[3]>>31; - (*pu).significand[3] = (*pu).significand[2]; - (*pu).significand[2] = (*pu).significand[1]; - (*pu).significand[1] = (*pu).significand[0]; - (*pu).significand[0] = 0; - n -= 32; - } - if (n > 0) { /* small shift */ - u0 = pu->significand[0]; - u1 = pu->significand[1]; - u2 = pu->significand[2]; - u3 = pu->significand[3]; - m = (1<<n)-1; - k = 32 - n; - j = (1<<(n-1))-1; - pu->sticky |= pu->rounded | (u3&j); - pu->rounded = (u3&m)>>(n-1); - pu->significand[3] = ((u2&m)<<k)|(u3>>n); - pu->significand[2] = ((u1&m)<<k)|(u2>>n); - pu->significand[1] = ((u0&m)<<k)|(u1>>n); - pu->significand[0] = u0>>n; - } -} - -void -fpu_set_exception(ex) - enum fp_exception_type ex; - -/* Set the exception bit in the current exception register. */ - -{ - _fp_current_exceptions |= 1 << (int) ex; -} - -void -fpu_error_nan(pu) - unpacked *pu; - -{ /* Set invalid exception and error nan in *pu */ - - fpu_set_exception(fp_invalid); - pu->significand[0] = 0x7fffffff|((pu->sign)<<31); - pu->significand[1] = 0xffffffff; - pu->significand[2] = 0xffffffff; - pu->significand[3] = 0xffffffff; -} - -/* the following fpu_add3wc should be inlined as - * .inline _fpu_add3wc,3 - * ld [%o1],%o4 ! sum = x - * addcc -1,%o3,%g0 ! restore last carry in cc reg - * addxcc %o4,%o2,%o4 ! sum = sum + y + last carry - * st %o4,[%o0] ! *z = sum - * addx %g0,%g0,%o0 ! return new carry - * .end - */ - -unsigned -fpu_add3wc(z,x,y,carry) - unsigned *z,x,y,carry; -{ /* *z = x + y + carry, set carry; */ - if(carry==0) { - *z = x+y; - return (*z<y); - } else { - *z = x+y+1; - return (*z<=y); - } -} - -/* the following fpu_sub3wc should be inlined as - * .inline _fpu_sub3wc,3 - * ld [%o1],%o4 ! sum = *x - * addcc -1,%o3,%g0 ! restore last carry in cc reg - * subxcc %o4,%o2,%o4 ! sum = sum - y - last carry - * st %o4,[%o0] ! *x = sum - * addx %g0,%g0,%o0 ! return new carry - * .end - */ - -unsigned -fpu_sub3wc(z,x,y,carry) - unsigned *z,x,y,carry; -{ /* *z = x - y - carry, set carry; */ - if(carry==0) { - *z = x-y; - return (*z>x); - } else { - *z = x-y-1; - return (*z>=x); - } -} - -/* the following fpu_neg2wc should be inlined as - * .inline _fpu_neg2wc,2 - * ld [%o1],%o3 ! tmp = *x - * addcc -1,%o2,%g0 ! restore last carry in cc reg - * subxcc %g0,%o3,%o3 ! sum = 0 - tmp - last carry - * st %o3,[%o0] ! *x = sum - * addx %g0,%g0,%o0 ! return new carry - * .end - */ - -unsigned -fpu_neg2wc(z,x,carry) - unsigned *z,x,carry; -{ /* *x = 0 - *x - carry, set carry; */ - if(carry==0) { - *z = -x; - return ((*z)!=0); - } else { - *z = -x-1; - return 1; - } -} - -int -fpu_cmpli(x,y,n) - unsigned x[],y[]; int n; -{ /* compare two unsigned array */ - int i; - i=0; - while(i<n) { - if(x[i]>y[i]) return 1; - else if(x[i]<y[i]) return -1; - i++; - } - return 0; -} - -#ifdef DEBUG -void -display_unpacked(pu) - unpacked *pu; - -/* Print out unpacked record. */ - -{ - (void) printf(" unpacked "); - if (pu->sign) - (void) printf("-"); - else - (void) printf("+"); - - switch (pu->fpclass) { - case fp_zero: - (void) printf("0 "); - break; - case fp_normal: - (void) printf("normal"); - break; - case fp_infinity: - (void) printf("Inf "); - break; - case fp_quiet: - case fp_signaling: - (void) printf("nan "); - break; - } - (void) printf(" %X %X %X %X (%X,%X) exponent %X \n", - pu->significand[0], pu->significand[1],pu->significand[2], - pu->significand[3], (pu->rounded!=0), - (pu->sticky!=0),pu->exponent); -} -#endif - diff --git a/usr/src/lib/libbc/libc/gen/common/_Qglobals.h b/usr/src/lib/libbc/libc/gen/common/_Qglobals.h deleted file mode 100644 index f836353fe9..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Qglobals.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _qglobals_h -#define _qglobals_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* Sparc floating-point simulator PRIVATE include file. */ - -/* PRIVATE CONSTANTS */ -#define INTEGER_BIAS 31 -#define SINGLE_BIAS 127 -#define DOUBLE_BIAS 1023 -#define EXTENDED_BIAS 16383 - -/* PRIVATE TYPES */ -#ifdef DEBUG -#define PRIVATE -#else -#define PRIVATE static -#endif - -typedef struct { - int sign ; - enum fp_class_type fpclass ; - int exponent ; /* Unbiased exponent. */ - unsigned significand[4] ; /* Four significand word . */ - int rounded; /* rounded bit */ - int sticky; /* stick bit */ -} unpacked ; - -/* PRIVATE GLOBAL VARIABLES */ - -enum fp_direction_type fp_direction ; /* Current rounding direction. */ -enum fp_precision_type fp_precision ; /* Current extended rounding precision. */ - -unsigned _fp_current_exceptions ; /* Current floating-point exceptions. */ - -extern void _fp_unpack(unpacked *, int *, enum fp_op_type); -/* unpacked *pu ; */ /* unpacked result */ -/* int *n ; */ /* register where data starts */ -/* fp_op_type type ;*/ /* type of datum */ - -extern void _fp_pack(unpacked *, int *, enum fp_op_type); -/* unpacked *pu ; */ /* unpacked result */ -/* int *n ; */ /* register where data starts */ -/* fp_op_type type ; */ /* type of datum */ - -extern void fpu_normalize(unpacked *); -/* unpacked *pu ; */ /* unpacked operand and result */ - -extern void fpu_rightshift(unpacked *, int); -/* unpacked *pu ; unsigned n ; */ -/* Right shift significand sticky by n bits. */ - -extern unsigned fpu_add3wc(unsigned *, unsigned, unsigned, unsigned); -/* unsigned *z,x,y,c; */ /* *z = x+y+carry; return new carry */ - -extern unsigned fpu_sub3wc(unsigned *, unsigned, unsigned, unsigned); -/* unsigned *z,x,y,c; */ /* *z = x-y-carry; return new carry */ - -extern unsigned fpu_neg2wc(unsigned *, unsigned, unsigned); -/* unsigned *z,x,c; */ /* *z = 0-x-carry; return new carry */ - -extern int fpu_cmpli(unsigned [], unsigned [], int); -/* unsigned x[],y[],n; */ /* n-word compare */ - -extern void fpu_set_exception(enum fp_exception_type); -/* enum fp_exception_type ex ; */ /* exception to be set in curexcep */ - -extern void fpu_error_nan(unpacked *); -/* unpacked *pu ; */ /* Set invalid exception and error nan in *pu */ - -extern void unpacksingle(unpacked *, single_type); -/* unpacked *pu; */ /* packed result */ -/* single_type x; */ /* packed single */ - -extern void unpackdouble(unpacked *, double_type, unsigned); -/* unpacked *pu; */ /* unpacked result */ -/* double_type x; */ /* packed double */ -/* unsigned y; */ - -extern enum fcc_type _fp_compare(unpacked *, unpacked *, int); - -extern void _fp_add(unpacked *, unpacked *, unpacked *); -extern void _fp_sub(unpacked *, unpacked *, unpacked *); -extern void _fp_mul(unpacked *, unpacked *, unpacked *); -extern void _fp_div(unpacked *, unpacked *, unpacked *); -extern void _fp_sqrt(unpacked *, unpacked *); - -#endif /* _qglobals_h */ diff --git a/usr/src/lib/libbc/libc/gen/common/_Qquad.h b/usr/src/lib/libbc/libc/gen/common/_Qquad.h deleted file mode 100644 index d506e0ae70..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_Qquad.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _QUAD_INCLUDED_ -#define _QUAD_INCLUDED_ /* Render harmless multiple inclusions. */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Header file for long double == quadruple-precision run-time support. C - * "long double" and Fortran "real*16" are implemented identically on all - * architectures. - * - * Thus the quad run-time support is intentionally coded as C-callable routines - * for portability. - * - * Mixed-case identifiers with leading _ are intentionally chosen to minimize - * conflicts with user-defined C and Fortran identifiers. - */ - -#include <math.h> /* to get float macros */ - -#ifdef __STDC__ /* are we there yet */ - -#define QUAD long double -#define SINGLE float -#define SINGLERESULT float -#define RETURNSINGLE(x) return x -#define ASSIGNSINGLERESULT(x,y) x = y - -#else - -struct quadstruct { - unsigned parts[4] -}; - -#define QUAD struct quadstruct - -#define SINGLE FLOATPARAMETER -#define SINGLERESULT FLOATFUNCTIONTYPE -#define RETURNSINGLE(x) RETURNFLOAT(x) -#define ASSIGNSINGLERESULT(x,y) {SINGLERESULT _kug = y; *(int *)&x = *(int*)&_kug;} - -#endif - -/****** Phase I Quad support: C run-time in libc/crt *****/ - -extern QUAD _Q_neg(QUAD); /* returns -x */ -extern QUAD _Q_add(QUAD, QUAD); /* returns x + y */ -extern QUAD _Q_sub(QUAD, QUAD); /* returns x - y */ -extern QUAD _Q_mul(QUAD, QUAD); /* returns x * y */ -extern QUAD _Q_div(QUAD, QUAD); /* returns x / y */ -extern QUAD _Q_sqrt(QUAD); /* return sqrt(x) */ -extern enum fcc_type - _Q_cmp(QUAD, QUAD); /* x compare y , exception */ - /* only on signaling NaN */ -extern enum fcc_type - _Q_cmpe(QUAD, QUAD); /* x compare y , exception */ - /* on quiet NaN */ -extern int _Q_feq(QUAD, QUAD); /* return TRUE if x == y */ -extern int _Q_fne(QUAD, QUAD); /* return TRUE if x != y */ -extern int _Q_fgt(QUAD, QUAD); /* return TRUE if x > y */ -extern int _Q_fge(QUAD, QUAD); /* return TRUE if x >= y */ -extern int _Q_flt(QUAD, QUAD); /* return TRUE if x < y */ -extern int _Q_fle(QUAD, QUAD); /* return TRUE if x <= y */ - -/* Conversion routines are pretty straightforward. */ - -extern QUAD _Q_stoq(SINGLE); -extern QUAD _Q_dtoq(double); -extern QUAD _Q_itoq(int); -extern QUAD _Q_utoq(unsigned); -extern SINGLERESULT _Q_qtos(QUAD); -extern double _Q_qtod(QUAD); -extern int _Q_qtoi(QUAD); -extern unsigned _Q_qtou(QUAD); - -/****** - Phase I Quad support: scanf/printf support in libc/gen/common -*****/ - -enum fcc_type /* relationships for loading into cc */ - { - fcc_equal = 0, - fcc_less = 1, - fcc_greater = 2, - fcc_unordered = 3 - } ; - -typedef /* FPU register viewed as single components. */ - struct - { - unsigned sign : 1 ; - unsigned exponent : 8 ; - unsigned significand : 23 ; - } - single_type ; - -typedef /* FPU register viewed as double components. */ - struct - { - unsigned sign : 1 ; - unsigned exponent : 11 ; - unsigned significand : 20 ; - } - double_type ; -typedef /* FPU register viewed as extended components. */ - struct - { - unsigned sign : 1 ; - unsigned exponent : 15 ; - unsigned significand : 16 ; - } - extended_type ; - -enum fp_op_type /* Type specifiers in FPU instructions. */ - { - fp_op_integer = 0, /* Not in hardware, but convenient to define. */ - fp_op_single = 1, - fp_op_double = 2, - fp_op_extended = 3 - } ; - - -extern void _Q_get_rp_rd(void); -extern void _Q_set_exception(unsigned); - -#endif /* QUAD_INCLUDED */ diff --git a/usr/src/lib/libbc/libc/gen/common/_base_S.c b/usr/src/lib/libbc/libc/gen/common/_base_S.c deleted file mode 100644 index ee7999d539..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_base_S.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "base_conversion.h" - -/* Fundamental utilities for base conversion that should be recoded as assembly language subprograms or as inline expansion templates. */ - -/* Converts t < 10000 into four ascii digits at *pc. */ -void -_fourdigitsquick(short unsigned t, char *d) -{ - short i; - - i = 3; - do { - d[i] = '0' + t % 10; - t = t / 10; - } - while (--i != -1); -} - -void -_multiply_base_two_vector(short unsigned n, _BIG_FLOAT_DIGIT *px, - short unsigned *py, _BIG_FLOAT_DIGIT product[3]) -{ - /* - * Given xi and yi, base 2**16 vectors of length n, computes dot - * product - * - * sum (i=0,n-1) of x[i]*y[n-1-i] - * - * Product may fill as many as three short-unsigned buckets. Product[0] - * is least significant, product[2] most. - */ - - unsigned long acc, p; - short unsigned carry; - int i; - - acc = 0; - carry = 0; - for (i = 0; i < n; i++) { - p=_umac(px[i],py[n - 1 - i],acc); - if (p < acc) - carry++; - acc = p; - } - product[0] = (_BIG_FLOAT_DIGIT) (acc & 0xffff); - product[1] = (_BIG_FLOAT_DIGIT) (acc >> 16); - product[2] = (_BIG_FLOAT_DIGIT) (carry); -} - -void -_multiply_base_ten_vector(short unsigned n, _BIG_FLOAT_DIGIT *px, - short unsigned *py, _BIG_FLOAT_DIGIT product[3]) -{ - /* - * Given xi and yi, base 10**4 vectors of length n, computes dot - * product - * - * sum (i=0,n-1) of x[i]*y[n-1-i] - * - * Product may fill as many as three short-unsigned buckets. Product[0] - * is least significant, product[2] most. - */ - -#define ABASE 3000000000U /* Base of accumulator. */ - - unsigned long acc; - short unsigned carry; - int i; - - acc = 0; - carry = 0; - for (i = 0; i < n; i++) { - acc=_umac(px[i],py[n - 1 - i],acc); - if (acc >= (unsigned long) ABASE) { - carry++; - acc -= ABASE; - } - } - /* - NOTE: because - acc * <= ABASE-1, - acc/10000 <= 299999 - which would overflow a short unsigned - */ - product[0] = (_BIG_FLOAT_DIGIT) (acc % 10000); - acc /= 10000; - product[1] = (_BIG_FLOAT_DIGIT) (acc % 10000); - acc /= 10000; - product[2] = (_BIG_FLOAT_DIGIT) (acc + (ABASE / 100000000) * carry); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_base_il.c b/usr/src/lib/libbc/libc/gen/common/_base_il.c deleted file mode 100644 index 45a1b875da..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_base_il.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "base_conversion.h" - -/* The following should be coded as inline expansion templates. */ - -/* - * Fundamental utilities that multiply two shorts into a unsigned long, add - * carry, compute quotient and remainder in underlying base, and return - * quo<<16 | rem as a unsigned long. - */ - -/* - * C compilers tend to generate bad code - forcing full unsigned long by - * unsigned long multiplies when what is really wanted is the unsigned long - * product of half-long operands. Similarly the quotient and remainder are - * all half-long. So these functions should really be implemented by inline - * expansion templates. - */ - -/* p = x * y + c ; return p */ -unsigned long -_umac(_BIG_FLOAT_DIGIT x, _BIG_FLOAT_DIGIT y, unsigned long c) -{ - return (x * (unsigned long) y + c); -} - -/* p = x + c ; return (p/10000 << 16 | p%10000) */ -unsigned long -_carry_in_b10000(_BIG_FLOAT_DIGIT x, long unsigned c) -{ - unsigned long p = x + c ; - - return ((p / 10000) << 16) | (p % 10000); -} - -void -_carry_propagate_two(unsigned long carry, _BIG_FLOAT_DIGIT *psignificand) -{ - /* - * Propagate carries in a base-2**16 significand. - */ - - long unsigned p; - int j; - - j = 0; - while (carry != 0) { - p = _carry_in_b65536(psignificand[j],carry); - psignificand[j++] = (_BIG_FLOAT_DIGIT) (p & 0xffff); - carry = p >> 16; - } -} - -void -_carry_propagate_ten(unsigned long carry, _BIG_FLOAT_DIGIT *psignificand) -{ - /* - * Propagate carries in a base-10**4 significand. - */ - - int j; - unsigned long p; - - j = 0; - while (carry != 0) { - p = _carry_in_b10000(psignificand[j],carry); - psignificand[j++] = (_BIG_FLOAT_DIGIT) (p & 0xffff); - carry = p >> 16; - } -} diff --git a/usr/src/lib/libbc/libc/gen/common/_base_sup.c b/usr/src/lib/libbc/libc/gen/common/_base_sup.c deleted file mode 100644 index e9995ab61f..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_base_sup.c +++ /dev/null @@ -1,307 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "base_conversion.h" - -#ifdef DEBUG - -void -_display_big_float(_big_float *pbf, unsigned base) -{ - int i; - - for (i = 0; i < pbf->blength; i++) { - switch (base) { - case 2: - printf(" + %d * 2** %d", pbf->bsignificand[i], (16 * i + pbf->bexponent)); - break; - case 10: - printf(" + %d * 10** %d", pbf->bsignificand[i], (4 * i + pbf->bexponent)); - break; - } - if ((i % 4) == 3) - printf("\n"); - } - printf("\n"); -} - -#endif - -void -_integerstring_to_big_decimal(char ds[], unsigned ndigs, unsigned nzin, - unsigned *pnzout, _big_float *pd) -{ - /* - * Convert ndigs decimal digits from ds, and up to 3 trailing zeros, - * into a decimal big_float in *pd. nzin tells how many implicit - * trailing zeros may be used, while *pnzout tells how many were - * actually absorbed. Up to 3 are used if available so that - * (ndigs+*pnzout) % 4 = 0. - */ - - int extras, taken, id, ids; - -#ifdef DEBUG - printf(" _integerstring_to_big_decimal: ndigs %d nzin %d ds %s \n", ndigs, nzin, ds); -#endif - - /* Compute how many trailing zeros we're going to put in *pd. */ - - extras = ndigs % 4; - if ((extras > 0) && (nzin != 0)) { - taken = 4 - extras; - if (taken > nzin) - taken = nzin; - } else - taken = 0; - - *pnzout = nzin - taken; - -#define IDIGIT(i) ((i < 0) ? 0 : ((i < ndigs) ? (ds[i] - '0') : 0)) - - pd->bexponent = 0; - pd->blength = (ndigs + taken + 3) / 4; - - ids = (ndigs + taken) - 4 * pd->blength; - id = pd->blength - 1; - -#ifdef DEBUG - printf(" _integerstring_to_big_decimal exponent %d ids %d id %d \n", pd->bexponent, ids, id); -#endif - - pd->bsignificand[id] = 1000 * IDIGIT(ids) + 100 * IDIGIT(ids + 1) + 10 * IDIGIT(ids + 2) + IDIGIT(ids + 3); - ids += 4; - - for (; ids < (int) (ndigs + taken - 4); ids += 4) { /* Additional digits to - * be found. Main loop. */ - id--; - pd->bsignificand[id] = 1000 * ds[ids] + 100 * ds[ids + 1] + 10 * ds[ids + 2] + ds[ids + 3] - 1111 * '0'; - } - -#ifdef DEBUG - assert((id == 1) || (id == 0)); -#endif - if (id != 0) - pd->bsignificand[0] = 1000 * IDIGIT(ids) + 100 * IDIGIT(ids + 1) + 10 * IDIGIT(ids + 2) + IDIGIT(ids + 3); - -#ifdef DEBUG - printf(" _integerstring_to_big_decimal: "); - _display_big_float(pd, 10); -#endif -} - -void -_fractionstring_to_big_decimal(char ds[], unsigned ndigs, unsigned nzin, - _big_float *pbf) -{ - /* - * Converts a decimal string containing an implicit point, nzin - * leading implicit zeros, and ndigs explicit digits, into a big - * float. - */ - - int ids, ibf; - -#ifdef DEBUG - printf(" _fractionstring_to_big_decimal ndigs %d nzin %d s %s \n", ndigs, nzin, ds); -#endif - - pbf->bexponent = -(int) (nzin + ndigs); - pbf->blength = (ndigs + 3) / 4; - - ids = nzin + ndigs - 4 * pbf->blength; - ibf = pbf->blength - 1; - -#ifdef DEBUG - printf(" _fractionstring_to_big_decimal exponent %d ids %d ibf %d \n", pbf->bexponent, ids, ibf); -#endif - -#define FDIGIT(i) ((i < nzin) ? 0 : ((i < (nzin+ndigs)) ? (ds[i-nzin] - '0') : 0)) - - pbf->bsignificand[ibf] = 1000 * FDIGIT(ids) + 100 * FDIGIT(ids + 1) + 10 * FDIGIT(ids + 2) + FDIGIT(ids + 3); - ids += 4; - - for (; ids < (int) (nzin + ndigs - 4); ids += 4) { /* Additional digits to - * be found. Main loop. */ - ibf--; - pbf->bsignificand[ibf] = 1000 * ds[ids - nzin] + 100 * ds[ids + 1 - nzin] + 10 * ds[ids + 2 - nzin] + ds[ids + 3 - nzin] - 1111 * '0'; - } - - if (ibf > 0) { -#ifdef DEBUG - assert(ibf == 1); -#endif - pbf->bsignificand[0] = 1000 * FDIGIT(ids) + 100 * FDIGIT(ids + 1) + 10 * FDIGIT(ids + 2) + FDIGIT(ids + 3); - } else { -#ifdef DEBUG - assert(ibf == 0); -#endif - } - -#ifdef DEBUG - printf(" _fractionstring_to_big_decimal: "); - _display_big_float(pbf, 10); -#endif -} - -void -_mul_10000short(_big_float *pbf, long unsigned carry) -{ - int j; - long unsigned p; - - for (j = 0; j < pbf->blength; j++) { - p = _prod_10000_b65536(pbf->bsignificand[j], carry); - pbf->bsignificand[j] = (_BIG_FLOAT_DIGIT) (p & 0xffff); - carry = p >> 16; - } - while (carry != 0) { - p = _carry_out_b10000(carry); - pbf->bsignificand[j++] = (_BIG_FLOAT_DIGIT) (p & 0xffff); - carry = p >> 16; - } - pbf->blength = j; -} - -void -_big_decimal_to_big_binary(_big_float *pd, _big_float *pb) -{ - /* Convert _big_float from decimal form to binary form. */ - - int id, idbound; - _BIG_FLOAT_DIGIT sticky, carry; - _BIG_FLOAT_DIGIT multiplier; - -#ifdef DEBUG - assert(pd->bexponent >= -3); - assert(pd->bexponent <= 3); -#endif - pb->bexponent = 0; - pb->blength = 1; - id = pd->blength - 1; - if ((id == 0) && (pd->bexponent < 0)) { - pb->bsignificand[0] = 0; - } else { - pb->bsignificand[0] = pd->bsignificand[id--]; - idbound = (pd->bexponent < 0) ? 1 : 0; /* How far to carry next - * for loop depends on - * whether last digit - * requires special - * treatment. */ - for (; id >= idbound; id--) { - _mul_10000short(pb, (long unsigned) pd->bsignificand[id]); - } - } - if (pd->bexponent < 0) {/* Have to save some integer bits, discard - * and stick some fraction bits at the end. */ -#ifdef DEBUG - assert(id == 0); -#endif - sticky = 0; - carry = pd->bsignificand[0]; - multiplier = 10000; - switch (pd->bexponent) { - case -1: - sticky = carry % 10; - carry /= 10; - multiplier = 1000; - break; - case -2: - sticky = carry % 100; - carry /= 100; - multiplier = 100; - break; - case -3: - sticky = carry % 1000; - carry /= 1000; - multiplier = 10; - break; - } - _multiply_base_two(pb, multiplier, (long unsigned) carry); - if (sticky != 0) - pb->bsignificand[0] |= 1; /* Save lost bits. */ - } else if (pd->bexponent > 0) { /* Have to append some zeros. */ - switch (pd->bexponent) { - case 1: - multiplier = 10; - break; - case 2: - multiplier = 100; - break; - case 3: - multiplier = 1000; - break; - } - carry = 0; - _multiply_base_two(pb, multiplier, (long unsigned) carry); - } -#ifdef DEBUG - printf(" _big_decimal_to_big_binary "); - _display_big_float(pb, 2); -#endif -} - -void -_big_binary_to_unpacked(_big_float *pb, unpacked *pu) -{ - /* Convert a binary big_float to a binary_unpacked. */ - - int ib, iu; - -#ifdef DEBUG - assert(pb->bsignificand[pb->blength - 1] != 0); /* Assert pb is - * normalized. */ -#endif - - iu = 0; - for (ib = pb->blength - 1; ((ib - 1) >= 0) && (iu < UNPACKED_SIZE); ib -= 2) { - pu->significand[iu++] = pb->bsignificand[ib] << 16 | pb->bsignificand[ib - 1]; - } - if (iu < UNPACKED_SIZE) { /* The big float fits in the unpacked - * with no rounding. */ - if (ib == 0) - pu->significand[iu++] = pb->bsignificand[ib] << 16; - for (; iu < UNPACKED_SIZE; iu++) - pu->significand[iu] = 0; - } else { /* The big float is too big; chop, stick, and - * normalize. */ - while (pb->bsignificand[ib] == 0) - ib--; - if (ib >= 0) - pu->significand[UNPACKED_SIZE - 1] |= 1; /* Stick lsb if nonzero - * found. */ - } - - pu->exponent = 16 * pb->blength + pb->bexponent - 1; - _fp_normalize(pu); - -#ifdef DEBUG - printf(" _big_binary_to_unpacked \n"); - _display_unpacked(pu); -#endif -} diff --git a/usr/src/lib/libbc/libc/gen/common/_big_power.c b/usr/src/lib/libbc/libc/gen/common/_big_power.c deleted file mode 100644 index 994bcdc092..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_big_power.c +++ /dev/null @@ -1,1772 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -#include "base_conversion.h" - -unsigned short _max_big_powers_ten = 1260; -unsigned short _big_powers_ten[] = {1, /* begin powers of 10000 in - * base 65536 */ - /* 10000**90 = 65536**22 * */ 24832, 26544, 2586, 53761, 57792, 53253, 29499, 56082, - 11839, 41887, 40418, 25010, 56546, 10851, 1212, 37926, - 54683, 24944, 9622, 49891, 30137, 5131, 11297, 7965, - 27232, 47123, 15266, 35282, 32115, 24817, 55263, 50890, - 57131, 1641, 34615, 9400, 1773, 26259, 28395, 6473, - 56175, 37773, 33397, 24180, 39478, 50542, 46897, 13968, - 17093, 51240, 31118, 9390, 3806, /* * 65536**74 */ - /* 10000**180 = 65536**45 * */ 33985, 7059, 50023, 49495, 50123, 42743, 46480, 57582, - 11318, 19673, 45663, 3344, 38612, 23984, 46968, 53347, - 1637, 11314, 39569, 11385, 46514, 18737, 254, 8488, - 51985, 44900, 30372, 57670, 35, 2423, 21277, 52736, - 17783, 36546, 57005, 52994, 11764, 34186, 38967, 29573, - 31609, 52884, 35484, 5862, 37331, 46285, 3552, 17166, - 23884, 16123, 63828, 64220, 40233, 60185, 35113, 44957, - 62568, 31869, 62842, 20359, 37122, 26110, 39645, 20711, - 5066, 62485, 7570, 43880, 25252, 32872, 25424, 17843, - 18779, 28712, 52721, 12061, 37011, 17182, 18688, 41694, - 9744, 49728, 27156, 3092, 40688, 48751, 18433, 52160, - 33601, 24318, 57448, 65020, 26274, 17344, 47654, 41401, - 62950, 31535, 27325, 4701, 11581, 64161, 47399, 3270, - 221, /* * 65536**149 */ - /* 10000**270 = 65536**67 * */ 8448, 53501, 26337, 31473, 40957, 40631, 48909, 53457, - 20735, 15028, 5789, 54161, 14411, 54948, 58612, 16703, - 60933, 37416, 13759, 21647, 15992, 8158, 21322, 49916, - 50899, 10500, 61546, 64808, 24885, 47894, 22543, 7780, - 30293, 45924, 12217, 38801, 56975, 28948, 9918, 42159, - 64774, 9810, 51572, 22988, 21827, 9461, 13137, 48930, - 33891, 51044, 37035, 25332, 1280, 56459, 12584, 48754, - 40019, 43829, 8962, 15530, 62271, 18344, 6657, 19593, - 44745, 58787, 40668, 52192, 32657, 12973, 31749, 56817, - 44085, 36894, 57738, 47056, 63832, 3276, 5478, 58665, - 57346, 40249, 28227, 21581, 12301, 31946, 358, 8638, - 19457, 56089, 7233, 5275, 49953, 53412, 34142, 32827, - 37650, 65359, 31247, 34120, 46664, 57489, 20280, 30130, - 28614, 21249, 30833, 40373, 44196, 8194, 36189, 58466, - 2574, 44938, 8814, 109, 18128, 7521, 47937, 57918, - 37532, 54663, 2577, 9044, 22665, 25537, 10764, 19087, - 7004, 2179, 41422, 5651, 26207, 17993, 50256, 38597, - 3449, 61115, 20807, 44005, 28834, 13215, 7913, 53059, - 4484, 48600, 17162, 35297, 4759, 49174, 43511, 60182, - 5836, 31015, 22479, 40680, 54915, 12, /* * 65536**224 */ - /* 10000**360 = 65536**90 * */ 39297, 28797, 19536, 11545, 64015, 52591, 13876, 58921, - 23682, 1986, 56989, 18252, 21209, 33745, 52547, 51178, - 2782, 19350, 6109, 37173, 53626, 3048, 1461, 55725, - 51369, 18035, 53937, 17798, 33511, 50816, 46721, 45035, - 58118, 27037, 24312, 45764, 42900, 63148, 16576, 11767, - 46031, 6789, 47345, 858, 43692, 25905, 7147, 29400, - 28424, 54349, 52149, 60542, 63221, 7749, 51852, 6952, - 25762, 29494, 20486, 45960, 32833, 26932, 18753, 55669, - 15583, 21202, 32441, 16038, 60580, 44361, 9748, 61294, - 59477, 43384, 56673, 48473, 14732, 25204, 62875, 17232, - 55644, 40058, 18129, 397, 49816, 27626, 60216, 25306, - 38110, 10732, 35472, 39607, 16165, 62410, 7086, 27496, - 50158, 41865, 47027, 43707, 3983, 64460, 53739, 28189, - 875, 42538, 58391, 18282, 8861, 45795, 10907, 36476, - 20935, 50159, 63428, 22377, 35199, 22005, 58273, 27559, - 40171, 2536, 15354, 53038, 32599, 8294, 43881, 6890, - 4104, 39477, 3416, 14231, 63716, 58698, 8871, 28387, - 43094, 28276, 49866, 44118, 58895, 28174, 4918, 14393, - 4723, 25333, 55124, 30906, 58587, 29493, 21770, 496, - 22682, 20698, 63098, 29331, 42083, 17816, 23787, 43214, - 2135, 41163, 59940, 47651, 37571, 35042, 16945, 53313, - 47751, 5968, 61004, 51568, 25849, 56505, 61289, 33232, - 55259, 50253, 35550, 46938, 19022, 14950, 37908, 18484, - 19143, 12648, 11973, 7740, 15947, 57462, 5693, 21228, - 11590, 15884, 57998, 31222, 14304, 59938, 39970, 1254, - 5177, 25824, 46245, 44888, 46972, 27017, 60069, 4030, - 48863, /* * 65536**298 */ - /* 10000**450 = 65536**112 * */ 57600, 1753, 64214, 10939, 52713, 57114, 47498, 12718, - 65226, 52478, 17581, 45728, 40296, 17124, 22976, 7882, - 59829, 9678, 48006, 42769, 33867, 59105, 40007, 33681, - 62758, 12880, 7653, 19018, 42114, 60278, 48185, 24533, - 7865, 16338, 28648, 55791, 6926, 17250, 39828, 40360, - 3146, 9794, 29068, 10091, 31954, 10861, 174, 9952, - 30118, 38130, 10042, 27126, 56412, 40935, 47114, 38430, - 26489, 15830, 50460, 58142, 53729, 28445, 34585, 11908, - 54573, 17947, 9765, 11260, 4075, 58984, 37064, 3346, - 57974, 57633, 26781, 41340, 61062, 3241, 44773, 47277, - 24897, 34071, 18673, 27883, 6091, 16551, 28150, 8364, - 61856, 64804, 11090, 50777, 18722, 53215, 55972, 60192, - 45393, 21503, 15047, 51201, 21232, 3696, 22906, 29678, - 36725, 62961, 55329, 45203, 36089, 61516, 18075, 29511, - 26330, 20863, 5232, 942, 52303, 1329, 7169, 16407, - 23511, 28002, 27861, 39195, 36757, 29288, 52738, 31621, - 59210, 51984, 42640, 5659, 47418, 7854, 11002, 58823, - 59570, 36949, 22019, 59119, 41882, 20539, 877, 50827, - 37562, 38614, 43945, 48560, 55615, 11703, 51736, 56400, - 53305, 18317, 58518, 38512, 29906, 60122, 44314, 46596, - 19166, 62123, 52578, 15091, 61001, 5047, 22701, 14755, - 18755, 47468, 31041, 14196, 42158, 21968, 3373, 44915, - 57195, 47466, 25892, 61074, 29817, 54, 64515, 27653, - 57344, 1463, 29300, 40052, 16841, 42643, 59474, 15330, - 16570, 6014, 44041, 19131, 29244, 50031, 55233, 44818, - 47712, 45727, 952, 34593, 60454, 19073, 4703, 4072, - 20111, 54979, 12176, 32868, 27943, 49668, 5088, 3807, - 49956, 5296, 3481, 21434, 32644, 61933, 14474, 15724, - 10598, 63757, 8203, 57593, 35835, 35825, 54421, 10282, - 58911, 46419, 7408, 59548, 56341, 21421, 19169, 40562, - 34398, 32643, 48732, 2508, 2467, 37998, 64620, 58696, - 45958, 12921, 53097, 62410, 8256, 16357, 3350, 63594, - 35148, 3705, 63330, 36057, 54181, 2837, /* * 65536**373 */ - /* 10000**540 = 65536**135 * */ 15937, 20970, 57308, 46022, 51974, 28228, 49601, 21388, - 40296, 55589, 44307, 42834, 398, 65459, 29106, 36117, - 58627, 55677, 12574, 29537, 16367, 36210, 27724, 17412, - 18304, 13827, 20066, 27247, 827, 4058, 41496, 20247, - 51620, 1082, 40533, 21160, 34685, 20554, 43988, 59273, - 34265, 55478, 129, 12039, 16053, 54781, 10914, 47279, - 59144, 13059, 239, 57141, 24079, 42596, 19598, 19025, - 42888, 9118, 45324, 12662, 14300, 23767, 3983, 64928, - 23773, 48090, 61417, 45026, 31449, 8952, 13451, 50205, - 9133, 1606, 29283, 16751, 52783, 25986, 27202, 64448, - 7976, 36045, 65419, 18289, 6687, 58459, 2696, 64771, - 59103, 11898, 15922, 1849, 13696, 18721, 51962, 60276, - 33088, 13618, 33835, 955, 54730, 30753, 42953, 7375, - 61463, 55489, 54327, 58832, 30130, 14445, 27383, 2532, - 60622, 8764, 27263, 20809, 29172, 10746, 27493, 19018, - 21323, 2715, 51634, 13711, 18305, 64990, 61883, 29593, - 30164, 37070, 50170, 17727, 64571, 25429, 8567, 42658, - 41690, 25244, 38225, 58617, 37108, 46866, 41447, 12452, - 41201, 46696, 36226, 58260, 6808, 60813, 3511, 42132, - 2464, 20759, 17487, 10188, 15270, 14266, 25609, 58137, - 57931, 2205, 6443, 37431, 12405, 58845, 33285, 16573, - 14071, 5820, 16529, 58780, 31569, 52734, 18992, 50695, - 46732, 20912, 5076, 48345, 22472, 23041, 64294, 52141, - 22442, 392, 26740, 43057, 11860, 14356, 63434, 15374, - 14772, 28670, 41433, 1974, 54122, 17046, 50870, 58582, - 5398, 17662, 56622, 53433, 51651, 8826, 50675, 27415, - 59006, 31726, 3039, 15225, 1797, 30657, 62118, 31964, - 11409, 19519, 46289, 51026, 63766, 51506, 6721, 28612, - 43824, 40432, 28241, 27448, 45638, 22197, 9841, 39482, - 9863, 39609, 40744, 38597, 41001, 28616, 32806, 21219, - 8559, 63020, 56887, 1918, 19985, 9540, 10554, 43907, - 50615, 38633, 61885, 47235, 60236, 61683, 13384, 60276, - 39709, 37164, 11604, 48681, 49626, 35185, 43726, 49403, - 29356, 30785, 4575, 1193, 43617, 38640, 17416, 6671, - 7232, 27443, 26406, 41752, 6566, 25930, 62643, 18778, - 54032, 30217, 3010, 58389, 63320, 30362, 35000, 19530, - 13024, 51771, 54380, 9543, 4082, 11961, 11867, 45471, - 30275, 39318, 40920, 8938, 25475, 57521, 52508, 58089, - 24296, 24154, 27196, 31838, 56076, 47056, 45743, 14112, - 53271, 164, /* * 65536**448 */ - /* 10000**630 = 65536**157 * */ 41216, 46406, 59322, 61369, 51512, 20872, 33344, 41848, - 43840, 47477, 17497, 55908, 2232, 55500, 37020, 51781, - 22444, 37436, 7404, 2929, 57789, 15841, 61447, 35446, - 61753, 33940, 20974, 40070, 32303, 24165, 35623, 37205, - 10896, 16123, 6081, 4131, 29524, 1872, 8494, 27926, - 37845, 23806, 62637, 1365, 6521, 39715, 46011, 60077, - 9346, 51026, 41457, 9861, 44621, 22494, 64632, 15645, - 7424, 61517, 4626, 23178, 34013, 8518, 49315, 57860, - 32895, 17307, 57060, 28216, 27297, 61081, 36199, 59774, - 44595, 28382, 55034, 12516, 60988, 3506, 50799, 38145, - 54391, 63230, 20695, 45368, 10226, 3270, 24994, 56899, - 31459, 18314, 32368, 51902, 33323, 63009, 59011, 29737, - 29075, 49025, 4282, 31052, 15197, 60533, 9381, 32019, - 50249, 61190, 24684, 34675, 46264, 42435, 53411, 31868, - 38459, 40070, 61396, 19036, 30012, 23474, 3616, 19739, - 9343, 27372, 23783, 53650, 37433, 59240, 38132, 41049, - 45152, 8725, 51544, 34525, 36550, 16360, 27941, 7440, - 35100, 54826, 64859, 13997, 4890, 53899, 54048, 35700, - 10798, 26647, 1271, 49433, 25744, 53858, 31178, 14919, - 937, 30111, 55552, 58717, 17286, 37081, 34938, 9745, - 24865, 45841, 34340, 43224, 22583, 5991, 64792, 16894, - 50876, 18240, 63281, 5032, 50942, 44113, 38789, 36691, - 51395, 8802, 13454, 56366, 32520, 61447, 35750, 63344, - 37142, 50639, 5722, 37943, 60442, 51591, 43337, 64200, - 64641, 57845, 46520, 36321, 44691, 5976, 53935, 32798, - 18551, 30652, 17368, 30219, 17859, 32537, 43934, 44612, - 43162, 55927, 7118, 44489, 276, 17010, 19651, 59717, - 37728, 13644, 63771, 16530, 51265, 23961, 51401, 39975, - 37696, 39126, 60849, 22425, 21035, 9611, 64833, 55092, - 17850, 19413, 53650, 61853, 22584, 14070, 18779, 41400, - 29164, 23227, 47530, 25123, 4816, 10016, 33069, 3061, - 50950, 15317, 22406, 5087, 51471, 51986, 21623, 53924, - 56665, 20549, 54909, 13520, 40440, 5926, 58434, 18, - 50925, 8063, 35498, 15845, 51871, 7543, 20521, 27848, - 48972, 24508, 61119, 46506, 34938, 10016, 61223, 2437, - 18604, 57378, 59677, 26266, 31802, 20692, 53429, 64574, - 20518, 2425, 41617, 57694, 62360, 47901, 142, 34172, - 5481, 48289, 53305, 12663, 37332, 46869, 144, 52762, - 35315, 13067, 41549, 63950, 10274, 26507, 13044, 60707, - 31640, 20218, 11020, 6092, 31125, 46895, 40706, 13301, - 33249, 14254, 13694, 14182, 44179, 19002, 10953, 42206, - 2912, 61112, 21006, 46700, 45041, 13788, 37984, 61123, - 2920, 53910, 22103, 46791, 35691, 26534, 59183, 6629, - 38284, 40141, 33801, 45081, 40582, 63304, 9780, 38978, - 37040, 33628, 42029, 7586, 6756, 27120, 50939, 17873, - 34198, 43080, 58421, 36335, 22204, 37477, 9, /* * 65536**523 */ - /* 10000**720 = 65536**180 * */ 29441, 9221, 44176, 26692, 60846, 31847, 29090, 25339, - 35930, 20844, 8043, 17725, 25927, 13288, 32521, 8126, - 50775, 44966, 15361, 9307, 64745, 7612, 24764, 29669, - 13555, 50864, 44391, 48083, 58573, 42556, 61204, 64477, - 11986, 42790, 52174, 42952, 53031, 54270, 20286, 8768, - 22341, 61349, 63774, 14080, 60374, 62747, 7402, 25223, - 28052, 46846, 46980, 8609, 9078, 33609, 53505, 34930, - 32968, 30589, 32788, 43651, 14971, 17775, 57203, 12298, - 62205, 17626, 9672, 31691, 63216, 49734, 40541, 6402, - 22005, 30587, 13054, 10329, 31904, 3172, 13622, 45858, - 46301, 10464, 15293, 17945, 17536, 61782, 57231, 38296, - 45404, 38204, 18123, 28934, 2342, 37881, 10854, 32095, - 4987, 56042, 25984, 9019, 45858, 6236, 46121, 45379, - 18810, 26175, 50282, 21223, 50027, 12893, 65320, 5925, - 50383, 43903, 42003, 15205, 5093, 41037, 60929, 42849, - 11522, 14113, 15252, 27792, 31752, 2747, 32751, 24967, - 11946, 51822, 33949, 61093, 54336, 61377, 44704, 51071, - 52508, 36736, 35998, 31965, 32400, 38483, 30039, 39655, - 12271, 53350, 3018, 27056, 52286, 4241, 2469, 12591, - 57208, 5539, 59538, 57279, 51412, 4367, 51194, 63224, - 42879, 57531, 5593, 36875, 3222, 36878, 8834, 58841, - 50736, 22072, 2883, 64310, 30818, 10755, 8048, 27469, - 32380, 287, 25978, 8932, 22638, 42123, 54687, 38020, - 54046, 34026, 2495, 20815, 13295, 60567, 18045, 38166, - 27324, 23540, 61061, 18019, 41556, 19312, 21205, 18355, - 4165, 36131, 36155, 63114, 1178, 4578, 57389, 10680, - 64688, 3879, 48569, 34056, 47861, 11495, 20055, 59999, - 8785, 16819, 48092, 5275, 39435, 62427, 11880, 55745, - 40370, 22261, 23222, 37349, 25595, 44199, 47928, 8827, - 33878, 10592, 29893, 58929, 55559, 62526, 3540, 28795, - 45772, 44601, 30551, 23900, 47810, 48207, 38046, 45993, - 54951, 42424, 37459, 26441, 64051, 39949, 15873, 48249, - 18153, 33377, 31324, 46745, 57720, 38661, 25484, 2856, - 27871, 57992, 32210, 39775, 27415, 49689, 12774, 39695, - 54026, 8851, 64076, 45346, 30440, 4954, 43827, 59588, - 26458, 35245, 6276, 9866, 19606, 17051, 10101, 42987, - 13096, 65041, 11754, 60180, 40909, 8317, 52670, 33992, - 60144, 23815, 64633, 10803, 13953, 41749, 52611, 55862, - 19561, 29527, 2011, 60830, 46093, 11917, 17017, 8948, - 6256, 43842, 30373, 60280, 24957, 58414, 59183, 55358, - 58102, 26713, 8531, 36657, 63486, 13580, 4866, 34860, - 64464, 17306, 43397, 37920, 15862, 59273, 3367, 51941, - 23330, 41718, 46765, 17746, 54707, 19066, 17076, 30414, - 2252, 63321, 11865, 11828, 30996, 63021, 12032, 19445, - 18188, 27359, 23050, 15348, 3491, 46691, 51491, 36848, - 33160, 12581, 63320, 56725, 1821, 43960, 39997, 18740, - 48805, 41842, 24120, 15890, 54968, 55258, 61757, 32921, - 9505, 55385, 18647, 48173, 26532, 22866, 2391, 60301, - 4042, 25640, 2549, 20478, 51618, 41943, 15933, 49899, - 41880, 50809, 7605, 15053, 44692, 26691, 4504, 56850, - 53475, 704, 51873, 61228, 29198, 50857, 6149, 26788, - 1987, 17697, 41116, 7369, 23359, 53572, 17078, 54242, - 56763, 36431, /* * 65536**597 */ - /* 10000**810 = 65536**202 * */ 24832, 34883, 19140, 51974, 19534, 493, 52319, 13085, - 44094, 53939, 13943, 21197, 17741, 12809, 17083, 47879, - 44152, 35922, 40786, 5096, 8680, 9278, 44616, 38504, - 36424, 51297, 47600, 4593, 4526, 149, 59298, 44171, - 44964, 25078, 37864, 13646, 63055, 58238, 37926, 35586, - 10600, 3464, 53122, 28369, 17593, 3852, 29481, 59844, - 27408, 27200, 56105, 64110, 48332, 50180, 19869, 47629, - 55510, 63058, 63565, 15060, 30626, 63856, 56518, 46308, - 39745, 24691, 36420, 55961, 36063, 63197, 60888, 53216, - 16582, 21061, 31362, 31969, 40126, 63351, 10808, 40164, - 30133, 43848, 10633, 38149, 14270, 53620, 35996, 7377, - 31064, 14168, 27656, 8304, 9433, 48523, 18453, 35684, - 59897, 45916, 24972, 15325, 2090, 26144, 25610, 31629, - 32660, 38294, 23250, 17832, 48733, 50586, 41084, 47429, - 31712, 34017, 19793, 62777, 45378, 44102, 8716, 29657, - 11066, 8490, 21653, 65497, 54560, 34995, 45742, 29639, - 47537, 31847, 50867, 52761, 21881, 37741, 50563, 52577, - 19856, 51512, 7692, 58548, 21610, 63516, 13279, 10470, - 25956, 22794, 15559, 37617, 47777, 14198, 59911, 38144, - 48165, 43003, 1866, 15531, 29396, 63328, 5477, 46307, - 7420, 63290, 9773, 16965, 24790, 59750, 55367, 43061, - 40717, 39703, 31857, 13914, 10833, 9318, 46436, 41858, - 33725, 2693, 48237, 15973, 39351, 1385, 60479, 8159, - 36758, 43662, 65499, 30448, 36485, 14023, 16129, 56629, - 11037, 14727, 56695, 61224, 10018, 61924, 17039, 58813, - 51177, 7002, 14025, 34593, 12170, 14808, 16590, 42794, - 54486, 23047, 40628, 57635, 49464, 47344, 56582, 36349, - 43317, 39710, 36166, 49702, 43150, 50620, 52026, 12306, - 14900, 24719, 32561, 23469, 56363, 58169, 29717, 62860, - 5914, 30326, 36935, 6904, 10575, 39528, 43903, 45125, - 45571, 20883, 10642, 49940, 49906, 46725, 33540, 15427, - 54802, 23586, 6422, 34110, 28513, 24672, 55236, 59300, - 18103, 8071, 343, 46748, 44955, 44719, 46329, 45518, - 64515, 53685, 49458, 57239, 26923, 63817, 49998, 82, - 48162, 49280, 36045, 52738, 55278, 52109, 36659, 28664, - 54266, 36879, 7837, 33525, 38888, 43635, 3373, 31635, - 39148, 20248, 61282, 48866, 43029, 19598, 35185, 15499, - 29972, 51650, 46352, 17452, 27329, 41299, 61120, 41483, - 63249, 41810, 38435, 63667, 39939, 54741, 6587, 14314, - 2969, 13087, 5872, 55217, 56115, 62553, 44160, 49781, - 42336, 33771, 30218, 31267, 4033, 42958, 21612, 41303, - 34647, 1810, 28901, 41550, 40209, 11769, 4586, 22182, - 26502, 5719, 30640, 11452, 12437, 21544, 2884, 63001, - 2124, 35767, 51047, 27970, 13456, 60413, 51818, 58535, - 47850, 36522, 31614, 53268, 52691, 2465, 9577, 57821, - 34723, 14832, 5857, 29536, 54171, 49780, 47615, 47261, - 30128, 62107, 57931, 31222, 38520, 25994, 3823, 15723, - 16547, 17305, 49713, 43099, 51610, 41171, 23658, 34248, - 13535, 21991, 43596, 26442, 58160, 23695, 3544, 34778, - 18047, 45877, 18286, 24355, 51158, 26871, 58388, 26582, - 47810, 41235, 7058, 10487, 40836, 51818, 20367, 52775, - 5736, 33296, 60350, 61028, 33129, 22124, 2553, 40846, - 49426, 30198, 41206, 31906, 2268, 23375, 26363, 25951, - 25327, 21358, 4872, 53366, 58360, 57573, 39684, 22204, - 14446, 39744, 2602, 5841, 58903, 33209, 16767, 10211, - 61495, 8426, 33859, 133, 24228, 7746, 3317, 39266, - 40762, 27964, 33156, 57057, 37827, 18835, 48966, 45870, - 59270, 1291, 59568, 53631, 7193, 56246, 21395, 738, - 4375, 22741, 15183, 23729, 51074, 56262, 2115, /* * 65536**672 */ - /* 10000**900 = 65536**225 * */ 14273, 7163, 46567, 51827, 50089, 10023, 55949, 245, - 1159, 17037, 51278, 44226, 51648, 35729, 25509, 4403, - 15277, 58952, 2800, 32557, 39271, 9423, 24984, 39140, - 57089, 23151, 3062, 50830, 59291, 867, 53101, 7095, - 19611, 35795, 41060, 9674, 47969, 12545, 38874, 29165, - 11512, 41264, 63581, 29168, 53103, 21505, 38999, 33701, - 54139, 9676, 37916, 53588, 50017, 6515, 42130, 2532, - 36284, 38864, 44500, 4466, 55531, 50755, 15508, 146, - 28502, 38791, 21688, 26877, 52133, 54811, 29308, 24528, - 20734, 17408, 49222, 26459, 17409, 64821, 4200, 39238, - 64979, 29921, 33627, 35459, 36916, 51567, 33008, 1628, - 6279, 54380, 30133, 5936, 17139, 52719, 46819, 42853, - 41752, 31544, 1462, 57857, 44269, 5290, 12763, 55500, - 39832, 27225, 48368, 61922, 40176, 40270, 5222, 2985, - 26859, 21907, 20962, 63398, 54831, 61348, 11462, 26890, - 43826, 50193, 60034, 50174, 47495, 52289, 11971, 42857, - 8385, 26684, 23657, 10379, 54996, 40463, 25724, 21824, - 57970, 19757, 19307, 26592, 34085, 58605, 6778, 23721, - 51260, 28842, 5296, 13158, 47821, 847, 16832, 60766, - 40427, 3841, 28863, 20200, 1138, 3729, 22912, 46234, - 33780, 41281, 39777, 35382, 6550, 55549, 44803, 54984, - 41452, 20025, 49044, 15289, 39110, 28891, 12771, 9774, - 12295, 20992, 36634, 40705, 61898, 9178, 25519, 22203, - 50236, 10613, 5567, 27529, 13389, 798, 40083, 55933, - 29668, 42166, 48813, 57826, 5693, 61199, 24917, 35398, - 55081, 28044, 10934, 490, 44922, 45359, 60589, 21808, - 6223, 60886, 55947, 15636, 18202, 12652, 47001, 33715, - 1784, 10522, 3250, 23010, 53423, 13029, 14613, 14582, - 65496, 51185, 8470, 26681, 63330, 65425, 32413, 51168, - 32060, 54007, 60139, 17653, 53407, 8189, 34606, 61688, - 13850, 35471, 27651, 37005, 61499, 55526, 56224, 41600, - 60040, 857, 42303, 38156, 38085, 44751, 16609, 54544, - 38471, 14234, 8060, 31105, 63558, 7269, 31069, 36939, - 42433, 13862, 40368, 37119, 25856, 65017, 20549, 36357, - 64397, 17712, 38575, 49805, 59582, 22005, 40440, 19428, - 51467, 17010, 36430, 58855, 2452, 2695, 44580, 46065, - 30873, 60279, 54935, 34216, 22695, 58545, 48440, 15018, - 27887, 23637, 63051, 4534, 13378, 51603, 40257, 52604, - 691, 51699, 15786, 21724, 13278, 55833, 44434, 30861, - 51287, 5897, 10147, 58856, 38101, 14294, 17815, 47872, - 28393, 15890, 20928, 62986, 42962, 56890, 979, 15681, - 47673, 38922, 36092, 57686, 64599, 33633, 28338, 34918, - 57465, 49865, 18528, 54552, 57036, 7276, 11198, 57630, - 22789, 16017, 10059, 23237, 21681, 41524, 46643, 24961, - 44147, 48940, 62394, 7143, 9385, 11046, 65044, 57878, - 57160, 47316, 45445, 2750, 58598, 9603, 42454, 30694, - 52059, 29206, 18204, 40173, 25648, 6014, 61497, 56963, - 26048, 57723, 8838, 62072, 11570, 12733, 36026, 31434, - 3840, 46987, 33053, 832, 52289, 60589, 40187, 10691, - 45021, 57479, 35352, 44144, 11407, 18748, 20537, 37568, - 37950, 36743, 62914, 48316, 55419, 772, 17111, 43564, - 6290, 40888, 38291, 40921, 20680, 48207, 42217, 38503, - 730, 2822, 22255, 43137, 41848, 58326, 23670, 15109, - 5304, 37155, 44928, 50110, 44814, 1337, 31179, 31519, - 53369, 16421, 43531, 23933, 45501, 33542, 14548, 41770, - 5329, 24587, 36163, 13284, 26154, 26979, 58480, 55123, - 27153, 35641, 19702, 30180, 24988, 59627, 49160, 35901, - 53053, 26775, 49062, 44985, 39819, 25504, 32870, 50542, - 63631, 62927, 32094, 334, 21162, 62179, 40136, 13124, - 27741, 9876, 3165, 29681, 27682, 30484, 38671, 4766, - 48626, 12961, 26759, 53270, 6514, 16672, 17944, 11173, - 54309, 18987, 19908, 62166, 55133, 64931, 34429, 19375, - 40200, 22618, 12904, 18863, 56035, 50621, 8647, 4914, - 56531, 52460, 17908, 38068, 9533, 24082, 12137, 56181, - 52161, 1403, 43630, 37617, 47129, 31272, 12184, 10307, - 41534, 57868, 122, /* * 65536**747 */ - /* 10000**990 = 65536**247 * */ 8448, 11216, 5465, 5252, 13691, 62777, 24660, 63602, - 11742, 63994, 26533, 6198, 64453, 64762, 15022, 11560, - 57999, 1346, 43073, 12670, 29299, 41692, 40405, 12003, - 9686, 58196, 51539, 5057, 17555, 47938, 13325, 47771, - 18543, 44041, 7371, 42873, 64950, 38189, 47026, 40574, - 537, 46950, 53263, 23417, 20499, 12622, 63037, 21674, - 48336, 5244, 44671, 30812, 22163, 9040, 9255, 65488, - 41576, 18286, 31279, 38058, 36504, 1777, 41531, 32231, - 45969, 61787, 5163, 19977, 41699, 14970, 29550, 50366, - 57333, 24146, 56484, 10557, 6318, 5085, 19553, 12503, - 43553, 41906, 1510, 18184, 26688, 55056, 6458, 8707, - 11358, 14113, 9658, 9531, 38165, 19586, 46404, 23885, - 31549, 25819, 31379, 53700, 15570, 44506, 9573, 8610, - 37474, 23712, 41571, 42241, 62359, 3173, 48388, 35115, - 13886, 29265, 13202, 39660, 17261, 57603, 53509, 30252, - 3049, 31534, 42061, 10178, 10072, 42133, 19531, 5512, - 22011, 20317, 60832, 45754, 23861, 8803, 8024, 9300, - 8189, 56661, 19449, 40072, 10395, 51816, 45325, 21642, - 40617, 4397, 40831, 53612, 3720, 26816, 21980, 49486, - 19775, 28607, 30907, 20380, 59273, 64398, 56231, 48013, - 32960, 6029, 14723, 17302, 7319, 55312, 16409, 27905, - 10307, 20664, 26193, 33375, 29613, 47129, 6833, 57131, - 38357, 56322, 30287, 21069, 29634, 17545, 54322, 46630, - 59448, 27103, 63182, 30298, 48945, 39899, 34349, 14202, - 9978, 9256, 11625, 18019, 44700, 31588, 9709, 17067, - 2480, 10551, 52262, 59626, 5719, 22611, 2829, 47524, - 4751, 61315, 1190, 28590, 40756, 50116, 968, 39757, - 59488, 152, 10598, 9539, 42089, 34440, 21330, 35753, - 57353, 65382, 61232, 47818, 19428, 4893, 4284, 12072, - 10649, 29127, 34573, 16717, 42170, 60771, 8829, 1181, - 54700, 28796, 64820, 9014, 65265, 31595, 45949, 58747, - 15945, 20377, 21475, 59780, 50806, 49411, 51255, 36905, - 12430, 20303, 34553, 47326, 21884, 63330, 16073, 51001, - 5581, 9735, 30854, 43394, 26578, 29424, 49994, 36100, - 23634, 20809, 64072, 61243, 52060, 29913, 33631, 16296, - 32437, 6349, 52749, 15700, 39620, 46399, 24489, 6483, - 17702, 4372, 49283, 33988, 57337, 23019, 50643, 4364, - 1804, 2490, 53301, 55512, 15361, 57965, 43339, 53049, - 20703, 30461, 65186, 1853, 40917, 13989, 32509, 65014, - 57041, 36741, 42577, 10428, 33201, 2351, 43760, 450, - 18475, 4148, 40810, 1574, 45201, 54811, 9696, 18240, - 4281, 814, 28703, 27646, 50507, 42975, 30223, 13460, - 10852, 61914, 38691, 12727, 45042, 53605, 54025, 59128, - 14779, 11283, 46064, 12505, 43685, 23386, 14520, 29358, - 4627, 44117, 55001, 34108, 6241, 49319, 18776, 49487, - 42437, 35867, 3921, 48818, 61712, 3800, 7816, 56515, - 1495, 29296, 8713, 35840, 43635, 26808, 13132, 16233, - 2497, 3233, 44848, 48144, 53724, 1894, 2759, 63597, - 29964, 63225, 43350, 56438, 29890, 64077, 2120, 45261, - 4371, 14786, 41470, 17466, 55157, 32471, 62494, 38002, - 23407, 2940, 57644, 42903, 4020, 53587, 3318, 47999, - 5161, 32029, 30737, 54071, 2557, 50689, 53234, 36175, - 40961, 32172, 3909, 19016, 61625, 34111, 14144, 24936, - 16896, 62818, 12372, 59457, 1887, 645, 63537, 17392, - 1114, 50039, 2686, 34251, 9674, 21696, 13228, 40036, - 54714, 47286, 2182, 22144, 44868, 31758, 23861, 11525, - 21730, 3665, 26632, 58312, 32064, 33523, 30267, 40799, - 36724, 54784, 38117, 5204, 9016, 64205, 17027, 48311, - 33725, 42192, 59162, 43755, 36462, 12221, 8743, 63827, - 16782, 28240, 33067, 53442, 64633, 16828, 53744, 17998, - 37175, 47644, 57936, 1832, 6528, 14825, 46409, 1977, - 17054, 36191, 14793, 17786, 41401, 29332, 13834, 6240, - 59939, 25580, 16725, 50035, 43728, 33886, 35213, 22229, - 24861, 38719, 3055, 3061, 58000, 6125, 41860, 31265, - 49348, 46603, 9764, 35877, 30160, 49410, 7100, 47807, - 10718, 5537, 45289, 36196, 32331, 64349, 61700, 5981, - 6649, 6342, 2822, 52677, 22254, 39294, 58122, 35925, - 22310, 1603, 14936, 42974, 12624, 31289, 1266, 10913, - 8274, 37729, 49689, 38262, 24455, 55587, 6913, 50313, - 30337, 55817, 64980, 41358, 51940, 10242, 19280, 13531, - 23954, 15839, 46833, 1614, 46746, 42892, 58742, 44714, - 44748, 23250, 2673, 2661, 56547, 21341, 8958, 7, - /* * 65536**822 */ - /* 10000**1080 = 65536**270 * */ 35969, 65527, 20338, 12242, 57030, 27483, 20925, 34866, - 37995, 62473, 1330, 16007, 26899, 34993, 53763, 13986, - 26884, 65400, 55901, 12138, 53839, 8515, 45230, 37130, - 30737, 40433, 16575, 47085, 45034, 5302, 28335, 57005, - 22440, 10619, 59258, 6861, 41500, 62167, 57844, 4133, - 35839, 22712, 27192, 42174, 46754, 26624, 61306, 60061, - 12433, 10121, 6313, 37820, 6007, 61184, 13391, 25383, - 49031, 38668, 43505, 15089, 64994, 4879, 11070, 22631, - 6207, 65503, 28118, 36679, 35922, 20644, 38606, 32825, - 9233, 56150, 1583, 51096, 45352, 60012, 2115, 41832, - 60619, 29484, 25747, 59731, 50215, 33401, 9777, 33356, - 4545, 41181, 60374, 15690, 35095, 63846, 4140, 8324, - 13904, 48649, 35456, 8116, 42157, 50206, 40063, 45872, - 7599, 18962, 48417, 39625, 19385, 7183, 39285, 25477, - 31918, 34075, 2973, 20304, 3869, 40907, 6283, 53285, - 21565, 54800, 3099, 63351, 19428, 2283, 59341, 9996, - 48252, 48814, 54345, 22150, 21613, 40202, 43876, 38944, - 64604, 6563, 30994, 2553, 44916, 42593, 29298, 37038, - 45249, 11025, 48205, 9383, 16918, 37853, 32410, 31440, - 29243, 60387, 34792, 54085, 7280, 64745, 6242, 42678, - 55653, 7950, 56873, 4902, 52836, 43897, 639, 9280, - 60008, 46619, 32011, 25081, 52076, 28983, 47306, 61838, - 19535, 24464, 41653, 25843, 43561, 48725, 41247, 44966, - 53302, 43814, 7367, 9458, 13869, 31476, 12767, 55594, - 30824, 63935, 9696, 6667, 31999, 50893, 55234, 42913, - 19496, 12880, 54616, 37680, 47181, 15774, 42091, 48571, - 41189, 56906, 44069, 19494, 61417, 47627, 49626, 52385, - 19434, 65511, 16820, 2643, 49943, 35149, 43140, 3439, - 65423, 7246, 36543, 9896, 3582, 10149, 23496, 35541, - 2582, 11269, 42535, 44767, 50152, 61980, 39561, 56609, - 37061, 8334, 45130, 14096, 40278, 15114, 49471, 56808, - 15632, 54413, 64099, 46435, 36467, 53419, 10772, 11521, - 43612, 64772, 20299, 52506, 17748, 39569, 60365, 21251, - 34284, 10636, 44072, 26904, 45857, 43639, 24318, 61907, - 7878, 33513, 15616, 62983, 46136, 7313, 21547, 37227, - 46503, 24860, 48549, 21798, 22342, 14131, 22033, 52279, - 61857, 16311, 50989, 36484, 56525, 24361, 51738, 39047, - 44213, 30533, 50080, 52323, 16437, 46793, 4846, 62968, - 35862, 43889, 2791, 18111, 16134, 36985, 43534, 1666, - 2970, 12365, 38432, 6777, 44929, 12920, 34750, 5142, - 239, 43658, 42039, 14776, 35110, 9559, 45088, 53364, - 38362, 42460, 43246, 8437, 16032, 36097, 55193, 24167, - 59792, 8093, 36288, 38140, 6056, 32401, 1144, 16797, - 24474, 23434, 37962, 30049, 52725, 56110, 58340, 36802, - 24828, 48521, 19413, 25682, 45914, 55, 12190, 42713, - 60387, 16852, 63593, 27607, 55260, 27802, 54479, 29187, - 8748, 34352, 5241, 45524, 60050, 405, 46704, 41046, - 26477, 45891, 60022, 51904, 33611, 44204, 30580, 60004, - 18775, 32340, 28622, 45538, 49045, 63367, 23219, 51168, - 42982, 41136, 63410, 31213, 43173, 37726, 19222, 29370, - 44402, 19495, 23168, 12370, 17208, 15786, 47477, 27836, - 19826, 28477, 5719, 24067, 5087, 35305, 16911, 20735, - 54257, 4741, 23273, 14332, 37147, 18175, 45630, 40503, - 24950, 18113, 9135, 9501, 21821, 12582, 11139, 62854, - 464, 12572, 57428, 13531, 28477, 18522, 10541, 26505, - 47692, 53471, 25747, 53782, 13544, 8182, 45875, 48127, - 54948, 29352, 17720, 43079, 19041, 62187, 64838, 33792, - 47137, 49136, 38397, 48247, 2603, 30425, 51397, 24949, - 30697, 22370, 53700, 21914, 65294, 30144, 34466, 24897, - 9592, 158, 24612, 13665, 38859, 58457, 23999, 40845, - 19152, 14012, 21212, 22737, 36399, 8307, 28748, 2060, - 7589, 17249, 362, 41692, 8612, 51819, 58869, 4455, - 53139, 21737, 37335, 5624, 59010, 36579, 36223, 36932, - 17544, 4121, 41032, 28204, 45035, 63366, 26317, 7171, - 33739, 4399, 61606, 57877, 21760, 61384, 19819, 2133, - 21109, 34777, 25708, 22613, 46696, 44052, 51710, 23536, - 17871, 32203, 8966, 41282, 22625, 20237, 16347, 22565, - 3942, 25598, 47178, 3759, 63556, 22918, 62263, 51106, - 11270, 3902, 54133, 5238, 58847, 3357, 60086, 28063, - 40717, 9011, 38024, 1066, 18471, 2339, 9331, 40412, - 1959, 22572, 45730, 53351, 36637, 31458, 11444, 30555, - 52969, 30098, 1350, 49651, 16400, 55522, 61620, 8113, - 3029, 39240, 39252, 23947, 60404, 24211, 16221, 11621, - 54989, 62562, 8457, 57734, 61481, 33303, 53947, 23929, - 10226, 29099, 38390, 60716, 10264, 58142, 33253, 35683, - 32668, 52365, 37839, 21035, 30530, 65294, 20410, 33214, - 33927, 59639, 51510, 55225, 60899, 32713, 55680, 22427, - 18934, 50901, 55499, 18342, 34273, 48413, 15059, 1856, - 23957, 18148, 27163, /* * 65536**896 */ - /* 10000**1170 = 65536**292 * */ 57600, 19436, 30159, 40265, 63827, 34677, 48744, 35442, - 44746, 27137, 10696, 50059, 49688, 55567, 48021, 27347, - 12423, 52843, 52579, 6439, 46139, 58036, 63895, 50521, - 2639, 35617, 15101, 35359, 52213, 33998, 64533, 60211, - 25245, 54062, 27178, 8474, 26829, 10437, 19695, 1050, - 25311, 10258, 7964, 35543, 40907, 25898, 18812, 4362, - 32146, 61326, 31532, 50972, 12327, 46814, 65349, 13080, - 49055, 60452, 4498, 43691, 45804, 4764, 48417, 10341, - 49321, 56403, 59480, 9205, 62814, 39328, 32280, 35768, - 7313, 28486, 27160, 31200, 26934, 46241, 57455, 24222, - 15734, 51453, 37567, 57333, 38064, 48913, 61530, 26786, - 43961, 12101, 40131, 46639, 11918, 42601, 32832, 61279, - 40551, 44553, 26324, 59251, 53986, 50472, 36564, 36026, - 57448, 33095, 56484, 52713, 37122, 10150, 7602, 12809, - 1704, 30364, 65439, 11312, 44484, 9736, 64030, 3053, - 58942, 31227, 6957, 3662, 46800, 22475, 19542, 51939, - 50569, 63911, 48766, 59192, 23248, 58323, 8099, 33672, - 20857, 60081, 54343, 36309, 14110, 31124, 35564, 44710, - 59463, 54102, 32666, 52080, 35270, 27597, 2521, 7800, - 15502, 15199, 31684, 15860, 43249, 35670, 23980, 26978, - 1778, 59009, 47962, 37281, 9450, 60769, 8063, 64424, - 36596, 53977, 5301, 15655, 13812, 53130, 42429, 16208, - 12103, 19916, 37755, 53157, 63374, 6767, 46635, 50715, - 33492, 18514, 53655, 37278, 6138, 29099, 17136, 6795, - 51046, 43083, 31957, 8875, 46491, 32531, 18588, 6232, - 53334, 14070, 5211, 29319, 34016, 52582, 9454, 15404, - 39941, 14707, 54612, 25892, 17481, 984, 48580, 31799, - 30800, 16827, 8558, 16278, 65451, 40259, 46308, 50697, - 39993, 52045, 56233, 47481, 31161, 388, 53391, 37511, - 60369, 8391, 34809, 36357, 458, 53784, 44568, 33556, - 13954, 49150, 5041, 54584, 60304, 21022, 41788, 36261, - 41549, 65179, 40541, 51127, 9883, 21359, 32861, 22699, - 14405, 39846, 25772, 63294, 16861, 39665, 16819, 32781, - 16146, 20361, 49368, 48805, 11794, 18538, 59056, 48282, - 34943, 15871, 28426, 53226, 11855, 45462, 30124, 60860, - 28055, 9267, 43021, 46094, 42638, 38870, 1321, 55408, - 37034, 45963, 41870, 38539, 60271, 41848, 30287, 44532, - 15544, 26752, 39819, 41330, 28662, 32340, 35342, 45264, - 53173, 39672, 13627, 16487, 47378, 56815, 64338, 38261, - 55537, 33663, 9483, 51506, 57269, 63848, 63177, 4795, - 39218, 41025, 28259, 47624, 23486, 30665, 7272, 2830, - 39617, 10425, 47029, 61323, 62933, 44477, 30007, 43020, - 52077, 30725, 38435, 57638, 16462, 27056, 64988, 16566, - 50537, 20493, 9906, 21492, 43895, 374, 44515, 56769, - 8223, 48380, 40760, 14257, 39656, 34630, 41285, 15246, - 62411, 47824, 48336, 36913, 6976, 16512, 57714, 42313, - 13979, 48088, 60, 24912, 62211, 28151, 35752, 36701, - 50052, 24618, 59132, 20255, 12497, 59698, 29577, 51569, - 12798, 42198, 53790, 23570, 19875, 61970, 10800, 48176, - 24589, 6893, 31612, 57636, 10610, 30282, 22215, 44024, - 31263, 34518, 45043, 32436, 12262, 46765, 52624, 16321, - 4114, 59087, 54751, 49164, 37820, 64012, 27438, 25871, - 11204, 15290, 26961, 38400, 20759, 64316, 9621, 64020, - 46909, 20691, 52647, 33348, 11576, 17066, 14015, 49566, - 40538, 63664, 14944, 20687, 39074, 25856, 38268, 47873, - 30505, 1498, 37095, 13677, 9292, 30643, 49306, 2970, - 34675, 26586, 4470, 13882, 62018, 42647, 14650, 32179, - 31724, 63540, 6422, 45588, 48883, 16175, 17479, 7982, - 51335, 3705, 24447, 24326, 21497, 52371, 25062, 24894, - 15989, 3109, 50876, 27200, 8648, 32174, 20005, 8719, - 61318, 38490, 117, 58091, 45689, 24069, 39959, 30543, - 2616, 64752, 62632, 16639, 3681, 44725, 9996, 35120, - 41225, 47680, 31561, 303, 57460, 13392, 15823, 14403, - 48491, 10280, 30164, 63874, 53006, 38217, 29855, 29272, - 24594, 7725, 18809, 57474, 55413, 58819, 52259, 8574, - 28330, 5615, 47921, 11575, 1337, 37725, 18350, 20197, - 59722, 7403, 55547, 56424, 54478, 9683, 30498, 4876, - 11569, 8650, 7196, 1998, 22300, 6472, 53770, 18940, - 8345, 3191, 3892, 35925, 31490, 15746, 63659, 19136, - 40591, 38919, 7939, 18832, 4632, 51547, 58229, 27339, - 25497, 1691, 51106, 275, 61634, 48153, 48098, 6661, - 63928, 58037, 26688, 5855, 11436, 61191, 44893, 42901, - 60804, 42379, 26937, 11543, 23770, 16000, 49890, 22438, - 57970, 3854, 64957, 3519, 40127, 20002, 45185, 39487, - 35298, 55263, 46570, 8685, 55848, 35560, 19389, 27707, - 13058, 28900, 15944, 7688, 37021, 39815, 30190, 44862, - 23598, 35229, 62820, 2996, 20461, 46976, 9001, 27879, - 48268, 46227, 49321, 49454, 63850, 61735, 54794, 42907, - 23571, 26334, 53654, 65360, 25489, 6468, 53678, 42675, - 52954, 59402, 4235, 63352, 24939, 48637, 61250, 26806, - 49629, 9768, 42381, 54045, 9937, 12168, 37664, 4615, - 55658, 1123, 65351, 60196, 45320, 56318, 30654, 20203, - 33201, 41697, 44590, 23892, 65277, 21327, 25805, 61616, - 58532, 8858, 28723, 13551, 44996, 22985, 48164, 17401, - 48762, 63463, 10663, 40820, 44187, 7691, 37052, 1577, - /* * 65536**971 */ -0}; /* end powers of 10000 in base 65536 */ - -unsigned short _start_big_powers_ten[] = { - 0, 1, 54, 159, 317, 526, 788, 1102, - 1469, 1887, 2358, 2881, 3457, 4084, 4764, -0}; /* end _start_big_powers_ten */ - -unsigned short _leading_zeros_big_powers_ten[] = { - 0, 22, 45, 67, 90, 112, 135, 157, - 180, 202, 225, 247, 270, 292, -0}; /* end _leading_zeros_big_powers_ten */ - -unsigned short _max_big_powers_two = 1050; -unsigned short _big_powers_two[] = {1, /* begin powers of 65536 in - * base 10000 */ - /* 65536**70 = */ 4576, 5330, 2659, 2634, 2700, 241, 736, 6118, - 2918, 4420, 4263, 834, 7879, 7750, 4507, 3089, - 9485, 9709, 7384, 3707, 3230, 3352, 7721, 5033, - 2406, 9107, 3228, 6941, 8819, 1325, 5084, 9353, - 9449, 2435, 6704, 9445, 4261, 3162, 5528, 9548, - 4853, 5551, 7153, 8634, 6800, 2062, 51, 2591, - 4400, 2943, 1099, 5223, 667, 7222, 3974, 9347, - 6550, 4000, 3007, 556, 1451, 904, 8812, 7639, - 1900, 4787, 3415, 4511, 6120, 1037, 2997, 97, - 403, 7164, 4093, 5216, 3246, 5134, 8480, 6291, - 8881, 3964, 9238, 2427, 14, /* * 10000**84 */ - /* 65536**140 = */ 9776, 2253, 8946, 6582, 4366, 1230, 5988, 5994, - 4986, 2332, 3133, 9676, 4549, 5629, 4568, 9179, - 3036, 9197, 7169, 3119, 9828, 5638, 3796, 4617, - 6421, 5990, 9499, 523, 5203, 2152, 7290, 6879, - 9813, 4441, 5925, 798, 7236, 4019, 6307, 8398, - 157, 2516, 6143, 8646, 7492, 9583, 9938, 5152, - 6847, 8006, 683, 244, 8006, 1196, 3758, 9532, - 452, 401, 5992, 7450, 1493, 753, 9827, 1126, - 2835, 5738, 7741, 3443, 881, 2236, 1741, 4233, - 5279, 3671, 2940, 5294, 7898, 9852, 7504, 8508, - 3953, 2527, 3546, 2712, 2847, 3048, 7420, 3799, - 6771, 8202, 4354, 7186, 8190, 4570, 6440, 5511, - 8549, 5153, 5490, 7918, 620, 5243, 5543, 3873, - 6356, 9078, 5386, 1591, 7111, 4159, 2320, 8196, - 6569, 6064, 290, 9978, 187, 8976, 8722, 4655, - 482, 8111, 4070, 76, 2883, 9619, 7217, 7027, - 5806, 3289, 7545, 7242, 8353, 2644, 8452, 1680, - 1123, 8161, 4848, 8635, 987, 5726, 9071, 3094, - 2436, 6472, 1303, 2224, 7305, 1464, 2855, 9906, - 1460, 1230, 6481, 9106, 631, 3182, 966, 9732, - 3988, 7802, 5403, 4445, 2222, 2728, 3489, 8571, - 202, /* * 10000**168 */ - /* 65536**210 = */ 4976, 281, 6012, 17, 8847, 4796, 3320, 9840, - 359, 4031, 4266, 8224, 5040, 9010, 6606, 8362, - 3870, 2803, 1299, 2790, 5573, 8496, 7425, 3329, - 7000, 497, 2926, 2886, 5811, 7267, 4596, 9031, - 6264, 3836, 4739, 2863, 3432, 4432, 9069, 2431, - 2863, 4311, 2750, 4609, 1868, 9838, 8459, 363, - 1809, 2581, 5504, 2024, 6298, 5674, 9180, 4725, - 8486, 7668, 2709, 289, 3360, 275, 2585, 2205, - 4105, 2770, 7940, 4706, 8653, 4347, 7154, 3676, - 6577, 340, 6463, 2121, 2672, 6305, 8022, 7840, - 5602, 9571, 4312, 3466, 8020, 1916, 4070, 2988, - 3457, 6416, 9812, 2174, 8930, 9173, 6076, 8312, - 857, 1096, 1180, 620, 4859, 152, 1092, 7491, - 4745, 3889, 3900, 2599, 4401, 3692, 4364, 2736, - 4341, 1761, 6723, 5419, 7347, 3190, 5989, 9396, - 3021, 918, 8083, 7208, 5461, 1098, 6917, 8071, - 5616, 7722, 7108, 9396, 2863, 1362, 9097, 9696, - 5896, 164, 8909, 555, 434, 8445, 4953, 6921, - 2368, 285, 1641, 6713, 6744, 9989, 6930, 9850, - 2475, 71, 4925, 5299, 4396, 8984, 4026, 8373, - 1527, 940, 5824, 5337, 6969, 4236, 2973, 2267, - 2558, 6780, 186, 2173, 5244, 6671, 3833, 9623, - 4375, 6327, 6339, 7965, 6106, 2682, 9003, 9739, - 1314, 50, 4056, 4385, 7946, 1430, 6097, 9714, - 449, 6659, 5844, 1707, 5755, 2108, 2981, 3824, - 2297, 8807, 4920, 5469, 831, 2922, 9193, 2194, - 8297, 6119, 2088, 3045, 6641, 4977, 2769, 7282, - 4848, 6251, 1477, 1725, 9884, 3400, 123, 4489, - 8747, 9422, 2934, 2294, 9954, 3692, 8377, 1570, - 4011, 7220, 3419, 4810, 5449, 2242, 1, 507, - 7969, 5364, 7835, 8911, 8206, 8810, 1515, 9401, - 4940, 3087, 5588, 2520, 2889, /* * 10000**252 */ - /* 65536**280 = */ 176, 213, 2607, 9939, 341, 6807, 5102, 2207, - 8576, 9910, 5541, 1756, 3100, 5881, 2766, 1754, - 7165, 678, 8260, 2609, 5249, 4119, 911, 2853, - 5944, 1955, 7766, 4398, 7425, 6034, 2902, 1670, - 5261, 6752, 8696, 8901, 723, 2061, 1185, 4361, - 1220, 6295, 9342, 3745, 2770, 2245, 9517, 8616, - 519, 326, 4902, 2510, 240, 2817, 6116, 7267, - 5696, 5673, 4758, 400, 7924, 2433, 2768, 7115, - 9889, 8056, 4872, 3379, 6347, 188, 2900, 3628, - 718, 2601, 569, 4493, 9471, 7751, 6734, 4229, - 7350, 4570, 3539, 9964, 7318, 2925, 7285, 5044, - 910, 1170, 6902, 9479, 5846, 4587, 2066, 9718, - 2024, 9598, 9786, 6834, 9788, 878, 8515, 479, - 3827, 7717, 2467, 4862, 6342, 6429, 1755, 8575, - 9653, 7658, 6064, 8500, 3739, 6705, 9709, 8727, - 7188, 3920, 643, 3538, 9196, 2044, 2512, 4030, - 4742, 8858, 2798, 5421, 9449, 4493, 7923, 7811, - 8000, 9466, 893, 2451, 2464, 595, 648, 4712, - 9685, 1069, 6432, 5712, 9366, 2291, 8285, 9673, - 963, 797, 3759, 8730, 9787, 3118, 6175, 6888, - 7340, 5804, 1787, 4499, 9274, 5600, 8623, 2000, - 3012, 7525, 3772, 5832, 8776, 8233, 8819, 4186, - 8839, 1243, 3757, 6603, 38, 8988, 1689, 9475, - 2656, 4308, 2757, 1617, 8483, 7419, 4432, 422, - 3379, 9379, 7941, 4832, 6397, 4864, 132, 4744, - 5018, 2249, 3186, 7947, 8711, 5661, 7136, 1949, - 9827, 4135, 7566, 106, 1785, 6344, 6462, 5900, - 9559, 1743, 8759, 9815, 2766, 2726, 8889, 1178, - 6042, 1337, 2344, 758, 2262, 9853, 9870, 320, - 3981, 2791, 3735, 1192, 7971, 6202, 2032, 4478, - 7712, 7807, 4055, 1262, 7318, 4267, 551, 2405, - 7480, 3657, 1175, 4133, 614, 4983, 3622, 729, - 1553, 3186, 1015, 1134, 6445, 3169, 9873, 4821, - 19, 2947, 3314, 1074, 2191, 3683, 9534, 9977, - 1274, 6156, 5112, 1886, 5073, 7996, 4769, 5584, - 4236, 2031, 7148, 3026, 7816, 3827, 5170, 7265, - 7348, 9775, 6826, 6117, 8322, 5389, 723, 3879, - 7766, 2144, 1642, 5480, 4291, 6302, 1317, 4356, - 5214, 6696, 1438, 768, 8736, 6532, 2848, 9268, - 1403, 1103, 9555, 2274, 4988, 1270, 6107, 5515, - 8883, 2507, 275, 8187, 4670, 975, 165, 6868, - 1973, 902, 9995, 1421, 78, 6534, 7688, 171, - 1151, 4, /* * 10000**337 */ - /* 65536**350 = */ 5376, 2848, 3097, 7478, 9581, 4767, 564, 7416, - 2894, 9542, 726, 2535, 6568, 6434, 5775, 8334, - 6660, 8109, 768, 4381, 7948, 832, 9727, 6736, - 4371, 7686, 8518, 332, 173, 8241, 8498, 4, - 6562, 3493, 3112, 4998, 660, 1524, 6823, 6242, - 6475, 8178, 7929, 8298, 9439, 9161, 2065, 5021, - 3388, 6887, 6511, 6683, 4151, 1208, 8005, 4130, - 3692, 6948, 2189, 805, 1154, 133, 4169, 6639, - 1811, 990, 5508, 8629, 300, 2310, 3518, 5017, - 5358, 5850, 8671, 6573, 49, 5520, 5528, 8064, - 3441, 5935, 5356, 5963, 5632, 5922, 9287, 2478, - 1595, 8827, 1212, 9835, 4848, 2573, 8854, 6317, - 8300, 7144, 3193, 6224, 2297, 6291, 2094, 9274, - 3829, 9250, 3608, 9224, 6286, 3559, 7081, 5126, - 7724, 2849, 7390, 9500, 2307, 2908, 641, 5630, - 1271, 2165, 7588, 4861, 9441, 7062, 2062, 3854, - 259, 5391, 1477, 3176, 5832, 3351, 3779, 3495, - 6085, 9743, 1068, 4149, 3738, 9737, 2761, 6395, - 1575, 6136, 9570, 419, 8912, 4743, 139, 5106, - 9429, 6354, 6639, 2016, 32, 6503, 2688, 253, - 3072, 8438, 1809, 3605, 7429, 6407, 3523, 3194, - 3301, 3415, 8083, 7442, 13, 6376, 3587, 9852, - 3230, 915, 6344, 8098, 9192, 4127, 1359, 3713, - 5754, 6880, 2667, 3981, 1681, 155, 2793, 6465, - 6334, 7863, 2526, 4075, 2560, 5031, 1170, 77, - 6463, 1877, 5427, 7978, 2699, 301, 4894, 2316, - 6716, 9859, 235, 6316, 9834, 5965, 4481, 9083, - 6291, 8558, 9362, 8075, 9932, 6405, 6902, 3829, - 6056, 2529, 691, 6770, 1761, 3187, 8874, 7283, - 6080, 7420, 5693, 4501, 1471, 9833, 6366, 4679, - 4737, 3318, 5819, 5229, 5279, 6659, 9858, 424, - 4410, 35, 645, 8191, 9263, 5668, 2513, 5232, - 5091, 8185, 1986, 8716, 5718, 7585, 3116, 2732, - 2118, 7247, 3777, 6391, 5165, 5421, 8223, 4033, - 3829, 5689, 9637, 4867, 4761, 5856, 4362, 9352, - 5900, 8005, 2560, 3264, 8131, 5834, 2535, 8375, - 3975, 593, 6644, 5831, 1577, 4428, 8434, 1205, - 8880, 3712, 4093, 5790, 74, 5755, 5356, 421, - 1541, 652, 668, 5683, 1879, 3825, 122, 8887, - 6501, 9684, 829, 1335, 1784, 3655, 6775, 3013, - 7584, 8971, 8943, 4562, 3406, 4808, 2970, 4085, - 7148, 5625, 5979, 2961, 1398, 3067, 2645, 2510, - 1070, 2790, 850, 8698, 3506, 1221, 7240, 683, - 2748, 3836, 5782, 3889, 4328, 8462, 5594, 6692, - 2708, 6983, 5135, 6812, 3321, 5822, 1915, 2109, - 500, 5493, 5883, 7103, 3947, 841, 8799, 7661, - 617, 2921, 2247, 125, 6758, 8415, 1893, 2050, - 9160, 7931, 7846, 8933, 827, 3462, 7938, 8842, - 5671, 8291, 2242, 395, 8090, 1762, 8081, 8357, - 6877, 1775, 3990, 2665, 4244, 3538, 9877, 5469, - 4185, 7179, 1956, 8820, 4442, 1034, 950, 5064, - 5290, 45, 4563, 1743, 7448, 4025, 9091, 9971, - 5877, 7819, 3936, 3940, 6105, 58, /* * 10000**421 */ - /* 65536**420 = */ 576, 8988, 664, 3919, 9397, 8633, 7900, 5633, - 778, 481, 1888, 1204, 5101, 7862, 7589, 9191, - 9710, 2689, 4485, 1804, 6343, 4331, 3074, 8357, - 5813, 3262, 9731, 3649, 2080, 2864, 5674, 77, - 9082, 6281, 981, 3039, 4540, 5146, 1654, 4127, - 3199, 1398, 5247, 1783, 9163, 5185, 706, 2750, - 8430, 9896, 2547, 2815, 2509, 3404, 2669, 3713, - 2722, 1799, 138, 926, 9118, 8525, 4454, 8668, - 6336, 9770, 8685, 9548, 997, 5846, 7559, 9483, - 8362, 1665, 2765, 9093, 8253, 1725, 9810, 213, - 7885, 2853, 1411, 2276, 6384, 8329, 4969, 5285, - 2251, 6643, 9833, 2982, 9239, 927, 6645, 1456, - 7982, 8688, 6067, 7858, 2076, 6104, 5217, 644, - 3517, 5939, 7126, 7571, 4858, 4602, 2878, 9362, - 6694, 1240, 50, 8423, 6113, 5386, 9069, 6622, - 2139, 1576, 1299, 3779, 4071, 6783, 4160, 4975, - 1015, 3216, 5541, 4822, 2752, 7525, 532, 1015, - 3436, 6112, 6964, 1057, 5338, 1449, 5575, 127, - 7502, 6613, 7556, 5345, 1136, 4662, 1741, 2461, - 5108, 8880, 4068, 7622, 9910, 1884, 6898, 3514, - 5504, 3849, 4888, 1780, 9861, 1304, 3382, 2005, - 7315, 1614, 7822, 5275, 9537, 1118, 3830, 1889, - 3342, 8466, 6400, 254, 2618, 9653, 6474, 4960, - 397, 2576, 7484, 9275, 8232, 199, 8566, 161, - 6360, 6573, 5545, 1958, 3067, 5263, 559, 4958, - 315, 1554, 8857, 7186, 8622, 3782, 7740, 3278, - 1794, 7268, 2632, 5501, 9618, 8738, 3643, 6277, - 6012, 3610, 288, 4206, 5796, 3475, 7174, 4912, - 8758, 6323, 3905, 9152, 7953, 4361, 4463, 3095, - 3554, 1683, 6030, 1929, 7375, 6258, 2152, 6562, - 5846, 3295, 3906, 621, 3967, 5512, 6962, 5184, - 8037, 2555, 6225, 7071, 7488, 1212, 4898, 2473, - 7328, 3716, 5825, 9672, 9639, 7120, 443, 7612, - 8465, 6114, 8131, 5825, 3200, 7748, 9274, 4311, - 9358, 4668, 7300, 8736, 3949, 584, 9431, 5922, - 6761, 5835, 1402, 9894, 7088, 2458, 2112, 5215, - 1778, 6588, 9991, 9956, 9148, 6733, 5266, 3544, - 6437, 9631, 1618, 5442, 3963, 2241, 6525, 5097, - 6792, 8765, 5631, 4038, 1736, 3256, 8351, 5314, - 9979, 6884, 6015, 1122, 5239, 8501, 5776, 6649, - 5114, 6880, 460, 475, 1329, 2777, 8032, 6562, - 7846, 7018, 9893, 9391, 3793, 9834, 4199, 3843, - 627, 9689, 2149, 160, 1327, 9674, 8560, 9299, - 8965, 7349, 8187, 6017, 7068, 8093, 5757, 7606, - 2423, 135, 372, 6302, 4605, 2027, 9171, 1324, - 5511, 9099, 8850, 8994, 8232, 4470, 7980, 8005, - 7216, 4482, 6124, 297, 1049, 6980, 9621, 311, - 8951, 8883, 5978, 4077, 9581, 2508, 4711, 4428, - 3341, 3531, 523, 9142, 7401, 8003, 950, 3295, - 419, 7685, 2793, 4628, 1466, 9344, 1694, 9744, - 592, 3901, 7624, 5300, 607, 2830, 7331, 3324, - 7412, 9343, 1002, 9334, 400, 485, 9954, 1257, - 52, 7039, 3202, 2626, 5007, 3291, 4237, 9444, - 6860, 5339, 7508, 1175, 9228, 4913, 9145, 1340, - 306, 2129, 9924, 8112, 991, 7118, 5675, 6906, - 6348, 2476, 1269, 8053, 650, 3578, 7757, 1877, - 7566, 604, 1036, 8177, 8169, 1777, 7586, 4055, - 1745, 2700, 8005, 1, 372, 843, 3229, 5851, - 5704, 3752, 2409, 8356, 4838, 930, 4075, 8149, - 2620, 6567, 3302, 6988, 8270, 757, 3275, 3899, - 7832, 488, 7302, 9455, 2508, 8718, 7517, 8654, - 6925, 3559, 8617, 5973, 8089, 9073, 5897, 6014, - 3039, 4038, 3131, 8979, 8916, 7739, 2464, 4424, - 7777, 834, /* * 10000**505 */ - /* 65536**490 = */ 5776, 9431, 507, 3988, 8799, 5719, 9020, 3099, - 7523, 4041, 2773, 7913, 8546, 6090, 6505, 6324, - 678, 5416, 5566, 9267, 5891, 2562, 106, 1954, - 5018, 2963, 9753, 1086, 574, 9248, 8457, 7833, - 5151, 9537, 3506, 9829, 7272, 920, 8588, 5032, - 9739, 9592, 8917, 8333, 8413, 7860, 3589, 8574, - 3040, 7813, 4386, 28, 1593, 4394, 1358, 4985, - 8871, 9096, 7462, 836, 3458, 9265, 9262, 3279, - 912, 290, 1497, 4428, 5919, 4146, 4003, 5874, - 8647, 167, 8364, 2483, 6932, 5005, 6519, 2592, - 536, 2731, 193, 7398, 2945, 7802, 785, 4094, - 4184, 1213, 8852, 1686, 4541, 6405, 3357, 6423, - 1506, 6089, 1213, 1133, 5118, 3415, 1077, 1958, - 6675, 7423, 6153, 7034, 5831, 1338, 1066, 1935, - 583, 96, 8781, 3076, 4800, 7302, 1310, 6858, - 6070, 9182, 3912, 3432, 5149, 677, 7501, 1001, - 3691, 1492, 2816, 7033, 4083, 5163, 3022, 2024, - 5952, 3985, 8572, 2595, 5985, 5333, 212, 4524, - 2671, 5416, 7327, 8839, 2754, 6826, 8335, 6676, - 5653, 9426, 1185, 1908, 1677, 7014, 9493, 6814, - 2015, 4170, 7520, 9097, 2581, 7181, 8159, 8204, - 1452, 6864, 9467, 5347, 9830, 4403, 5856, 3087, - 6043, 7312, 4115, 990, 889, 8356, 7923, 7708, - 3107, 8295, 8873, 4976, 5777, 3831, 4188, 835, - 8231, 3690, 3524, 9390, 7023, 1876, 7236, 4427, - 514, 6350, 5016, 519, 151, 1119, 1920, 7165, - 137, 5736, 9277, 2526, 8000, 4638, 7675, 3197, - 8010, 7236, 9027, 3052, 429, 4251, 621, 4687, - 580, 9670, 8660, 7852, 6291, 8441, 4969, 2407, - 460, 7339, 6761, 6500, 9983, 805, 915, 8696, - 4445, 56, 9303, 6908, 3917, 8292, 6104, 9779, - 3567, 692, 1259, 292, 833, 3190, 9406, 3740, - 275, 1099, 1482, 6853, 1080, 8559, 8139, 1396, - 4902, 2874, 9613, 5810, 236, 8443, 5416, 8393, - 8751, 3616, 102, 6320, 4005, 809, 2349, 7262, - 1060, 927, 6212, 1845, 2309, 6601, 234, 7023, - 1037, 8076, 4278, 8787, 1111, 2785, 5347, 9174, - 4866, 8543, 1979, 9701, 8951, 2955, 1607, 317, - 508, 4607, 9658, 4672, 6840, 1896, 1259, 9832, - 7398, 176, 317, 3185, 5585, 2848, 1431, 545, - 8514, 9260, 9054, 4691, 4722, 2396, 4080, 1438, - 7161, 38, 2373, 2081, 359, 5634, 8412, 7366, - 1617, 1042, 9842, 492, 426, 5456, 9432, 5831, - 6293, 3455, 895, 9218, 307, 3951, 18, 7350, - 1858, 1805, 352, 8085, 3566, 9921, 3839, 8974, - 7501, 3634, 8467, 8370, 4209, 3242, 617, 38, - 5947, 3376, 6638, 1543, 4303, 6258, 2008, 8965, - 5607, 4777, 5725, 4908, 4312, 5484, 6276, 4939, - 2969, 1989, 8160, 2323, 3613, 5872, 6195, 1051, - 2368, 5130, 5114, 4157, 8861, 3505, 8475, 5251, - 1312, 9694, 9803, 6432, 350, 7092, 8507, 6429, - 4896, 4256, 953, 5869, 4820, 6006, 5260, 8523, - 905, 2152, 7727, 2873, 4262, 9943, 2468, 6602, - 299, 1975, 3745, 9332, 4535, 4221, 4273, 7144, - 297, 4009, 8535, 451, 3773, 2948, 5922, 5956, - 4079, 5527, 687, 9259, 9230, 6868, 4982, 8161, - 1559, 5930, 8859, 3745, 9346, 3511, 3694, 1580, - 6169, 323, 5558, 3735, 8840, 8377, 6888, 1528, - 3427, 9648, 7158, 7572, 8821, 3085, 1542, 5127, - 4430, 6826, 7402, 9291, 562, 1246, 8624, 2794, - 6256, 7655, 1083, 8826, 4414, 1460, 2278, 7861, - 8341, 3677, 2984, 4691, 451, 3560, 1580, 7583, - 6509, 4045, 7972, 321, 4512, 1662, 9186, 371, - 7919, 1240, 8982, 997, 1836, 9492, 5360, 5448, - 6025, 4174, 4995, 3474, 7970, 2139, 1951, 7419, - 8942, 6697, 4438, 3559, 2076, 8885, 2256, 6627, - 543, 164, 5853, 4856, 7906, 2129, 1724, 3786, - 8533, 3135, 3539, 2300, 6945, 7244, 4342, 4067, - 890, 7697, 9580, 7680, 61, 6007, 8870, 7700, - 8996, 6715, 3370, 1992, 889, 3860, 6590, 5603, - 2020, 9641, 1761, 2911, 576, 4742, 4317, 2007, - 5876, 2778, 8887, 2860, 2104, 1998, 8765, 3094, - 540, 3195, 9389, 5556, 3538, 4926, 3190, 7472, - 609, 5522, 9966, 9799, 5660, 1889, 1, /* * 10000**590 */ - /* 65536**560 = */ 976, 4979, 3040, 9206, 955, 4391, 2817, 938, - 1112, 5523, 5387, 1306, 5954, 1973, 9036, 8492, - 5961, 9057, 4333, 4301, 583, 4235, 3509, 9051, - 920, 2693, 5406, 961, 5945, 2876, 5973, 8416, - 1345, 265, 9047, 1241, 3361, 9657, 5675, 7186, - 6284, 4664, 9707, 5178, 8714, 3055, 9424, 8160, - 3540, 2285, 3000, 83, 4995, 4114, 2049, 3255, - 8318, 6178, 1394, 1626, 8128, 5450, 1000, 7325, - 954, 3111, 9095, 6175, 1638, 7210, 4996, 5422, - 2210, 9768, 129, 952, 7035, 3095, 2545, 68, - 2121, 5895, 5840, 8038, 6233, 8454, 4819, 41, - 9659, 756, 5166, 4451, 6171, 828, 6973, 381, - 5405, 8524, 5788, 8040, 5624, 9949, 4079, 8021, - 9909, 5434, 9374, 9549, 4519, 3315, 9843, 3053, - 936, 2227, 1563, 8987, 4406, 3206, 3672, 5667, - 4927, 3654, 3143, 8371, 3840, 3751, 6085, 6065, - 7371, 2891, 5391, 340, 2817, 4181, 8243, 2568, - 4276, 5037, 5579, 4087, 9881, 3156, 7618, 738, - 4561, 1917, 5475, 356, 8296, 541, 939, 4009, - 4945, 7654, 9014, 5190, 1958, 8762, 8536, 2515, - 6041, 1430, 8447, 7896, 4976, 5974, 1848, 2061, - 848, 2128, 9096, 8336, 5768, 1268, 2744, 2445, - 1997, 547, 5266, 2066, 2785, 6457, 7035, 5368, - 7618, 1389, 1304, 4119, 899, 4551, 3877, 3140, - 3879, 3564, 3844, 3066, 2279, 7763, 4159, 3714, - 7863, 6139, 516, 4075, 3813, 411, 6837, 7570, - 863, 6397, 2306, 9709, 5957, 1883, 2460, 1164, - 7907, 8462, 6278, 2391, 1205, 9618, 8604, 7140, - 5742, 5884, 9887, 3539, 9756, 6773, 1783, 3234, - 7128, 2285, 7327, 5364, 9023, 4212, 1005, 1827, - 4830, 6992, 6679, 2761, 8465, 8923, 6697, 2139, - 8041, 1978, 8857, 3050, 3862, 4736, 7727, 9356, - 7020, 8064, 840, 7255, 2415, 925, 5770, 8623, - 8843, 1722, 7152, 5061, 1193, 5878, 4483, 8654, - 5757, 9025, 998, 8067, 6265, 832, 4047, 3221, - 6466, 2287, 9674, 5520, 1293, 7456, 3458, 5767, - 755, 3752, 6416, 7411, 6410, 1693, 3423, 9206, - 7864, 5888, 8614, 4425, 4627, 5663, 5784, 6655, - 643, 3172, 1929, 8595, 420, 6586, 6985, 3036, - 6496, 6346, 5234, 1163, 9945, 300, 800, 7684, - 8060, 6753, 6778, 4600, 6518, 2929, 5468, 4077, - 5824, 431, 7782, 841, 2968, 1032, 7716, 9390, - 9987, 2069, 2135, 4678, 113, 7300, 3384, 8798, - 4109, 1841, 6669, 6689, 5687, 795, 4836, 8859, - 9130, 1137, 557, 3551, 4205, 4030, 2660, 5896, - 2006, 6595, 1224, 6297, 2619, 5306, 4522, 550, - 2776, 5836, 9778, 1076, 3355, 6338, 8670, 7630, - 3713, 7476, 1252, 6054, 9540, 5558, 2803, 8396, - 3948, 5582, 105, 3026, 9555, 138, 1654, 7788, - 9819, 9821, 3618, 582, 6614, 1325, 7741, 530, - 2492, 3387, 950, 3424, 4823, 7442, 9865, 9714, - 1796, 5099, 2964, 4613, 3652, 4807, 6659, 7494, - 4223, 8782, 8155, 1636, 2192, 1810, 2642, 3661, - 9096, 8284, 7796, 9482, 9920, 6951, 6355, 8988, - 350, 3480, 1984, 768, 5747, 4435, 2898, 8288, - 967, 1866, 4451, 8747, 7626, 3684, 6476, 4752, - 6604, 558, 2385, 9001, 2462, 5150, 5259, 6616, - 2390, 4184, 9526, 5941, 3138, 3861, 3482, 19, - 6341, 7036, 6369, 227, 5578, 9777, 4200, 538, - 6718, 2752, 1338, 4237, 2048, 5785, 5899, 4648, - 2755, 2819, 9492, 9450, 9570, 1581, 954, 3311, - 3691, 9510, 4695, 9790, 4907, 2502, 6597, 8365, - 4396, 3170, 92, 3169, 9407, 870, 9168, 7108, - 90, 5103, 4276, 5344, 4920, 7045, 1679, 1520, - 7051, 8893, 6973, 6818, 2512, 574, 6179, 5618, - 225, 1644, 2951, 1314, 9901, 1499, 2582, 3814, - 2485, 8706, 3433, 9669, 3891, 469, 6359, 8382, - 5455, 5542, 6754, 4380, 271, 4014, 867, 8095, - 6721, 914, 2408, 2133, 7283, 9336, 5715, 9709, - 2233, 3472, 3873, 9891, 5910, 5471, 6346, 222, - 8177, 9547, 1543, 7347, 1126, 4978, 2536, 6994, - 5877, 8981, 9413, 1542, 9992, 7496, 7307, 6635, - 831, 6332, 3769, 394, 1877, 37, 4545, 2982, - 5374, 7892, 9053, 6562, 2197, 6380, 8510, 2259, - 1952, 2956, 8378, 1486, 6599, 3860, 1054, 381, - 653, 3946, 8672, 8801, 9960, 5721, 3028, 6761, - 5872, 1570, 2165, 2319, 6451, 7788, 265, 5408, - 5369, 67, 8748, 2202, 6405, 5114, 2663, 4433, - 6258, 3883, 9615, 4072, 7588, 4059, 2415, 4238, - 8235, 2561, 9582, 4274, 4141, 5656, 1887, 8922, - 8452, 1792, 498, 6663, 2697, 5907, 6270, 9502, - 7239, 988, 5148, 5593, 9033, 6819, 2688, 7212, - 8656, 4307, 2183, 8071, 4878, 895, 5360, 6555, - 225, 6796, 7011, 1301, 1281, 7342, 1056, 6924, - 6214, 9340, 16, /* * 10000**674 */ - /* 65536**630 = */ 6176, 6430, 7092, 4105, 8720, 5723, 5981, 9910, - 5297, 4110, 3651, 4988, 5821, 4616, 4727, 5734, - 8042, 9496, 1397, 4266, 7433, 391, 738, 3945, - 4598, 4271, 7578, 529, 472, 6685, 9791, 6802, - 3226, 7385, 7662, 6806, 1919, 9525, 6729, 7962, - 5888, 9669, 2636, 7607, 7516, 8780, 6202, 3965, - 112, 1209, 5491, 2643, 2462, 5963, 2515, 1230, - 4121, 4054, 2940, 582, 5240, 8210, 1080, 9217, - 1033, 602, 7441, 2065, 6998, 3379, 489, 658, - 7501, 6167, 3242, 2737, 9556, 1554, 242, 2323, - 3353, 779, 5274, 3089, 6341, 24, 1328, 8441, - 1217, 2901, 9907, 9097, 3783, 3841, 3212, 1283, - 5332, 7926, 4527, 4103, 1597, 7221, 5369, 9156, - 4301, 8902, 3951, 9950, 6527, 2132, 6719, 2566, - 5427, 2526, 4888, 1869, 1785, 3119, 5644, 9918, - 1783, 5055, 2971, 6210, 2536, 6963, 3318, 1938, - 1884, 5924, 8977, 2428, 8311, 3225, 1210, 2846, - 4884, 7409, 5288, 5889, 3103, 3776, 3574, 7832, - 1546, 680, 9682, 9901, 1161, 4236, 893, 9012, - 9788, 3335, 620, 6581, 941, 8694, 462, 3523, - 6654, 1481, 9845, 7439, 7476, 5821, 3819, 9038, - 1144, 6471, 9971, 5535, 9048, 3965, 9361, 1496, - 3009, 6969, 2693, 5755, 2330, 6810, 2352, 1512, - 2523, 9719, 7464, 7771, 8431, 3033, 751, 7904, - 7402, 4660, 2761, 5357, 2617, 5937, 2788, 5153, - 4719, 8910, 4078, 2261, 8892, 8638, 523, 6944, - 2764, 4273, 8230, 3796, 8416, 6433, 7600, 6223, - 3477, 9222, 8330, 8551, 61, 9175, 7442, 4076, - 8823, 9894, 4097, 8187, 9873, 9573, 3391, 4457, - 2092, 2354, 9874, 6178, 6230, 8587, 583, 4119, - 2196, 8390, 9503, 8332, 9211, 1596, 3306, 7433, - 9397, 231, 7884, 9555, 83, 4747, 4305, 5408, - 3811, 4850, 1772, 2406, 1877, 3578, 6173, 7833, - 14, 8328, 2596, 5975, 5184, 5562, 387, 5768, - 3222, 1877, 2477, 8064, 5842, 6208, 4771, 6956, - 5542, 7513, 9381, 7844, 3531, 2747, 5733, 713, - 2053, 2655, 7472, 5000, 4903, 8819, 4211, 9930, - 4030, 1341, 2835, 1622, 12, 8582, 5178, 8384, - 6232, 4624, 9277, 1178, 7232, 4849, 887, 1037, - 4858, 8575, 6772, 5980, 7295, 7449, 9758, 9866, - 709, 3994, 799, 1400, 2397, 7707, 7902, 1208, - 3204, 8039, 8612, 7645, 1835, 8956, 5657, 2088, - 189, 2316, 6271, 218, 6153, 5436, 1, 194, - 2726, 9535, 4441, 3603, 3399, 9412, 4862, 8591, - 9976, 1486, 2073, 3543, 2316, 841, 5016, 4073, - 6014, 6689, 3912, 7333, 9067, 9942, 8796, 7745, - 9452, 8145, 2207, 5872, 3731, 9353, 9948, 9187, - 6536, 8425, 8829, 6688, 6100, 4022, 9374, 4893, - 5752, 13, 5691, 2233, 4334, 5630, 6246, 434, - 1221, 7461, 2426, 5642, 4710, 2812, 1033, 4356, - 3089, 1587, 1993, 6607, 4931, 7635, 1098, 4997, - 23, 2333, 5751, 7215, 2503, 5703, 293, 1194, - 1899, 427, 5631, 1081, 3676, 556, 9765, 5256, - 7616, 7431, 8935, 5493, 652, 6013, 9659, 3691, - 6652, 1760, 4298, 2524, 758, 6723, 9665, 3205, - 9325, 9890, 7705, 8841, 3106, 4116, 3348, 2963, - 7234, 63, 3671, 4198, 1691, 5227, 9985, 6405, - 8748, 830, 6348, 5353, 3024, 5032, 7552, 7653, - 1768, 2704, 6335, 4599, 243, 8332, 3602, 9120, - 9092, 4163, 1618, 9591, 9048, 5124, 6084, 9117, - 6114, 4589, 462, 745, 7286, 6528, 7139, 6347, - 1825, 932, 1067, 293, 443, 6679, 65, 3780, - 4351, 751, 9603, 8711, 5504, 8908, 7748, 8541, - 4250, 7889, 9317, 7250, 2112, 3173, 4267, 5986, - 4804, 1066, 4792, 7231, 1488, 661, 9538, 4177, - 9074, 656, 2338, 5296, 1871, 4347, 8386, 8313, - 2884, 5370, 5220, 7582, 2797, 8578, 8049, 5674, - 3977, 9693, 2366, 545, 869, 6824, 8706, 3830, - 2164, 5089, 2472, 2628, 1004, 2701, 1638, 7113, - 8101, 4748, 929, 8775, 9272, 1560, 8789, 5664, - 8258, 9613, 5486, 4613, 9863, 9005, 5112, 1799, - 4345, 8645, 570, 9967, 6500, 832, 8592, 838, - 9031, 7856, 5907, 381, 2763, 8153, 8398, 995, - 5801, 6346, 1214, 5007, 5316, 6928, 416, 4825, - 5944, 1297, 7549, 1499, 839, 1928, 5878, 5745, - 3272, 2572, 5248, 1460, 3905, 4288, 6818, 2388, - 7859, 9256, 1185, 2181, 3363, 8050, 8380, 9891, - 439, 5568, 8003, 5852, 1229, 9602, 7847, 5969, - 9057, 5525, 970, 1188, 372, 4928, 2344, 9662, - 9190, 1151, 8943, 5226, 1228, 2502, 8609, 9922, - 8201, 8724, 7651, 4046, 9691, 9904, 1535, 8250, - 4015, 5963, 9786, 6581, 8264, 4230, 7914, 2186, - 9235, 6295, 4350, 2794, 3271, 3552, 7515, 6223, - 2140, 4314, 2250, 1975, 627, 4462, 5690, 3413, - 3619, 4409, 8546, 2810, 6451, 8042, 6981, 5847, - 6670, 8620, 6057, 2985, 520, 3854, 5227, 9175, - 7632, 2479, 2790, 9594, 8713, 9800, 6204, 804, - 8244, 513, 650, 8472, 3103, 8833, 3041, 1162, - 1267, 7884, 8114, 5632, 7241, 3921, 9695, 2345, - 756, 9724, 9477, 2820, 7004, 2987, 1515, 6371, - 7318, 7495, 8174, 1492, 1502, 2107, 9841, 9638, - 7642, 9871, 8621, 6991, 2350, 4862, 9372, 1741, - 9751, 3844, 4708, 9941, 942, 865, 2781, 5447, - 15, 528, 3632, 5878, 351, 0, 1393, 8028, - 4688, 8018, 7552, 5798, 3137, 1883, 241, /* * 10000**758 */ - /* 65536**700 = */ 1376, 4586, 3110, 8109, 813, 2413, 7374, 4459, - 7631, 8946, 4454, 2451, 688, 5867, 8242, 3361, - 8832, 4437, 5519, 3061, 364, 4012, 8341, 4231, - 8360, 5724, 6055, 1955, 7486, 8472, 2328, 9617, - 1395, 8211, 2562, 3881, 804, 5684, 1580, 5622, - 253, 2116, 7361, 6279, 8846, 9490, 3076, 6714, - 859, 4921, 470, 1568, 3914, 3534, 5861, 68, - 2260, 9838, 1745, 6725, 9675, 3197, 369, 9299, - 6927, 6882, 1999, 4319, 1994, 6604, 8141, 2440, - 2345, 7443, 449, 202, 4032, 490, 5338, 8768, - 7265, 5012, 8672, 5900, 5541, 4891, 6096, 4383, - 6323, 5870, 1524, 7638, 3400, 6366, 6213, 428, - 1872, 5107, 6186, 2421, 5576, 1881, 8804, 9572, - 7734, 3881, 9595, 2628, 7760, 5058, 7924, 5553, - 5156, 4098, 9186, 269, 8189, 3581, 8233, 6224, - 2891, 7680, 3446, 8138, 7568, 9843, 8204, 1986, - 6126, 3468, 9198, 8388, 1316, 8387, 9313, 3728, - 6889, 9813, 4372, 1967, 8561, 6099, 8106, 4100, - 5281, 3861, 9375, 9097, 9704, 7224, 1961, 2569, - 3683, 6468, 2169, 2345, 5718, 8692, 5385, 7056, - 3147, 1978, 9445, 4762, 5390, 6541, 6663, 8522, - 8775, 8245, 1022, 4, 7451, 1623, 4426, 5431, - 2700, 3478, 216, 8713, 9146, 9152, 9543, 2348, - 201, 5303, 5894, 5551, 3564, 1811, 148, 5018, - 5783, 3415, 2654, 4387, 5930, 7241, 822, 304, - 5280, 4874, 8619, 3871, 6573, 1810, 8121, 6109, - 1252, 8884, 9457, 3422, 7107, 4752, 5692, 3659, - 2111, 406, 6917, 6654, 9902, 5175, 1115, 7073, - 5448, 9436, 637, 3031, 4610, 2213, 8584, 6608, - 8221, 6999, 5789, 9499, 119, 4379, 8719, 2495, - 9433, 5245, 6219, 6585, 1470, 7864, 17, 8133, - 1623, 4331, 9120, 7601, 2788, 4753, 1113, 3304, - 9695, 2285, 9289, 9894, 6930, 3596, 3553, 8327, - 3702, 8520, 952, 6437, 1794, 9348, 2373, 8042, - 9623, 4687, 852, 7710, 2830, 712, 6949, 4962, - 7564, 845, 325, 8598, 5915, 7846, 134, 4092, - 8320, 2594, 3361, 3486, 2148, 3874, 1167, 7721, - 2997, 4766, 7956, 2990, 3706, 6230, 7158, 2270, - 7383, 7156, 220, 461, 4389, 6761, 3391, 7669, - 3533, 4179, 4452, 1983, 96, 4861, 4969, 1955, - 1730, 5804, 2690, 480, 5521, 8307, 9407, 5267, - 5224, 5589, 354, 8171, 1931, 9270, 5338, 6469, - 3134, 2294, 7509, 6092, 7856, 4817, 9694, 9938, - 1734, 183, 3086, 8839, 1378, 1696, 6749, 5189, - 6701, 1425, 6429, 2989, 6291, 4557, 2441, 8383, - 3238, 4712, 9405, 2934, 2351, 5480, 7183, 2544, - 7983, 7358, 4167, 1710, 3735, 3718, 8737, 7750, - 2985, 1040, 7766, 2755, 6766, 6331, 9095, 6047, - 5580, 5501, 6305, 1682, 9474, 461, 3990, 4426, - 8734, 2562, 3942, 9748, 6939, 150, 6359, 7682, - 3379, 1328, 8128, 5972, 6892, 4860, 2107, 3330, - 3704, 1205, 115, 5648, 8256, 3308, 374, 9011, - 8758, 5046, 5154, 5092, 5698, 6810, 7156, 9533, - 3113, 3809, 4000, 4964, 7395, 6816, 1282, 9606, - 9471, 9830, 9937, 3567, 8703, 2376, 6893, 5218, - 7293, 3215, 3398, 8549, 2494, 1587, 3804, 2858, - 9019, 5968, 7835, 5821, 7483, 7121, 544, 9024, - 8399, 7510, 4571, 2094, 3538, 1577, 7130, 5822, - 1996, 1483, 1700, 5527, 570, 791, 2578, 3080, - 4903, 4771, 7320, 1545, 9454, 7539, 4331, 3864, - 9802, 6872, 8528, 3996, 7125, 5732, 9571, 790, - 7470, 9665, 219, 7307, 2199, 2311, 8669, 5264, - 8130, 5497, 6322, 7105, 571, 2920, 8273, 7186, - 9789, 3904, 5074, 2746, 1540, 9054, 395, 3472, - 3313, 2272, 5600, 1972, 5374, 5315, 7487, 3887, - 8919, 1379, 4867, 9911, 159, 1775, 2502, 5278, - 8189, 1751, 649, 4827, 5636, 5922, 8085, 7978, - 3876, 953, 91, 5265, 586, 8369, 1331, 3073, - 5441, 2656, 756, 3750, 5065, 3432, 5601, 2925, - 4324, 3109, 1584, 4244, 9847, 6788, 5544, 6780, - 875, 2974, 1407, 5026, 2485, 3708, 2179, 5846, - 6041, 6243, 9491, 4441, 8586, 1275, 6189, 8674, - 40, 4704, 5642, 9795, 88, 3425, 6010, 8541, - 5143, 7969, 9303, 6803, 2653, 5277, 1220, 2598, - 1511, 617, 5980, 8438, 428, 2439, 9102, 4813, - 534, 1182, 9186, 8299, 9546, 6675, 1047, 6804, - 1680, 2682, 3261, 8008, 6770, 7586, 2977, 4414, - 9460, 434, 7519, 615, 9068, 5178, 7915, 2666, - 3944, 4924, 7855, 2223, 8572, 5298, 1552, 8389, - 4271, 7406, 6363, 7646, 8398, 8160, 2069, 539, - 5033, 7604, 1436, 5275, 482, 4351, 9141, 7999, - 6490, 1856, 3788, 4972, 5139, 4359, 6807, 1250, - 8357, 3359, 3649, 6754, 7053, 8789, 3562, 3793, - 4146, 60, 5998, 7979, 8575, 592, 4584, 4106, - 3404, 7617, 6881, 2697, 3152, 8488, 6329, 3043, - 6970, 9232, 1885, 3130, 4859, 6188, 3885, 1044, - 822, 8498, 6408, 1921, 6737, 8743, 431, 6405, - 7340, 7105, 1238, 6695, 9100, 4467, 5128, 4391, - 4528, 5406, 1064, 8420, 754, 3135, 359, 634, - 5146, 7439, 1807, 1138, 5941, 52, 1554, 8214, - 8509, 3041, 4027, 4222, 1102, 2485, 3258, 3872, - 7554, 6844, 3183, 3660, 6015, 2150, 1179, 4086, - 3006, 5648, 1070, 7839, 9394, 417, 4476, 5914, - 3153, 8151, 8754, 4566, 7354, 2266, 2595, 9675, - 9849, 2561, 3843, 3783, 4417, 1091, 6860, 7239, - 776, 8822, 6599, 1796, 4964, 6626, 1710, 4832, - 1737, 4985, 9724, 500, 8824, 4870, 4557, 3357, - 2631, 1898, 8659, 6055, 6063, 1360, 3880, 6129, - 6219, 2248, 3427, 3819, 9834, 529, 8694, 5071, - 4713, 9682, 7120, 1400, 1385, 3033, 9416, 7959, - 232, 7154, 1288, 5060, 4686, 6550, 9634, 4993, - 3244, 3205, 2668, 4768, 7732, 5099, 1453, 8980, - 281, 144, 5597, 4066, 5746, 2220, 2838, 9818, - 910, 3708, 5565, 8463, 8273, 2742, 3946, 304, - 6406, 1028, 9203, 2140, 3691, 2406, 1882, 426, - 2922, 1953, 3435, /* * 10000**842 */ - /* 65536**770 = */ 6576, 245, 6356, 5875, 2422, 9666, 6333, 951, - 150, 2145, 7477, 5966, 1410, 2763, 307, 9452, - 5802, 5729, 1339, 3258, 2063, 9970, 6176, 1754, - 4757, 3297, 966, 8543, 8894, 117, 6213, 2274, - 4313, 8739, 3420, 691, 5977, 4505, 2536, 2997, - 3881, 3568, 1510, 5728, 6781, 9126, 7767, 1593, - 9017, 7864, 1976, 3746, 7862, 5273, 5257, 3301, - 8551, 2783, 2395, 7645, 315, 6447, 7429, 2440, - 943, 3567, 1927, 4649, 8911, 9014, 7172, 1994, - 6157, 4143, 8757, 2551, 3648, 9689, 5687, 6387, - 9358, 3878, 3632, 3984, 7237, 2547, 9700, 993, - 2278, 5799, 2100, 1748, 7385, 9669, 7791, 8150, - 6319, 2225, 9870, 9690, 884, 2677, 3804, 2903, - 2175, 5452, 7358, 8961, 7445, 515, 9507, 2931, - 7139, 9066, 276, 3657, 4963, 1907, 2044, 603, - 5124, 7175, 7031, 7712, 4449, 9865, 5262, 5849, - 9041, 3705, 6218, 4092, 1255, 2007, 9678, 3624, - 5180, 3538, 8771, 8142, 5087, 8757, 6817, 3082, - 3769, 7244, 4883, 4619, 4167, 1699, 9115, 9182, - 1348, 2906, 6991, 5382, 3461, 8628, 7028, 9325, - 3587, 7188, 4383, 9966, 7798, 105, 2955, 7538, - 2950, 3988, 9142, 6793, 5340, 3555, 1117, 5218, - 6349, 7006, 3785, 9480, 9839, 4795, 7464, 9682, - 7006, 4058, 4110, 4069, 1190, 4288, 2430, 8454, - 3076, 1395, 6594, 9163, 7479, 8065, 4755, 4874, - 647, 6200, 3270, 4761, 1485, 8860, 4861, 2395, - 1448, 8327, 776, 9899, 8277, 9220, 3382, 2782, - 3123, 5194, 3714, 4997, 1538, 2611, 9158, 9311, - 8857, 2483, 4214, 3062, 4880, 7846, 8772, 8092, - 3695, 7541, 9097, 667, 7806, 5727, 2261, 5090, - 5471, 9091, 3406, 422, 3994, 6902, 5228, 1216, - 1965, 375, 2757, 996, 4155, 1371, 5076, 7668, - 940, 2295, 8732, 9059, 8808, 6358, 2737, 8179, - 5344, 4418, 7027, 3631, 7129, 1789, 96, 7192, - 1246, 891, 8740, 2336, 4936, 2213, 1414, 7793, - 3041, 8231, 6528, 7078, 299, 7293, 1683, 8208, - 8097, 1670, 6643, 7366, 5146, 9629, 9972, 2977, - 9684, 1445, 2334, 7490, 1104, 6613, 6778, 2262, - 517, 4530, 4411, 8052, 2891, 5782, 3582, 7797, - 2650, 7112, 9324, 6077, 1036, 217, 980, 5753, - 9082, 1275, 6766, 2989, 6223, 2611, 2289, 9995, - 0, 7007, 3794, 3507, 9401, 7170, 8065, 7505, - 5429, 8108, 57, 4816, 6308, 795, 5172, 9799, - 514, 8369, 6605, 2125, 8482, 4855, 5695, 7116, - 2726, 6596, 5449, 1018, 7187, 8663, 6383, 5434, - 5472, 111, 1133, 7483, 572, 2642, 7374, 3672, - 6578, 1601, 5038, 1935, 8108, 8112, 219, 5137, - 9883, 1208, 4391, 872, 4997, 9658, 6156, 4152, - 247, 7022, 1720, 3435, 3669, 892, 3328, 3906, - 9750, 9679, 3130, 1096, 2598, 8077, 5644, 9251, - 4790, 7079, 4824, 248, 6992, 13, 4271, 385, - 2690, 2875, 7987, 6637, 9248, 6579, 9888, 4147, - 5376, 4578, 8170, 9261, 7266, 9739, 5526, 3243, - 1271, 6280, 134, 2294, 1169, 6079, 629, 2541, - 571, 1074, 4067, 6219, 6141, 4059, 7791, 6269, - 4370, 504, 2106, 4204, 12, 396, 8296, 6851, - 5299, 1980, 2205, 6099, 7526, 8617, 1275, 7304, - 4306, 3079, 7189, 7371, 5846, 1884, 1101, 8229, - 73, 4440, 531, 5649, 4927, 9063, 6529, 6352, - 1199, 4855, 1212, 9365, 1939, 4630, 8322, 1252, - 9242, 2296, 6277, 3508, 6969, 8655, 5338, 8780, - 7263, 603, 9464, 7296, 5563, 9966, 3937, 7009, - 529, 8557, 2752, 5988, 9040, 1872, 541, 8295, - 4144, 2418, 3603, 269, 8858, 9362, 2376, 1882, - 225, 7448, 2381, 1931, 426, 2059, 3337, 7981, - 6221, 8665, 5603, 2085, 651, 6853, 1798, 5910, - 8799, 3888, 1917, 5075, 7299, 2087, 4433, 5613, - 437, 8893, 3374, 5536, 8180, 2413, 3805, 4782, - 5355, 7634, 833, 828, 4318, 6069, 1943, 6953, - 3331, 9719, 1055, 7989, 8882, 7868, 3167, 1941, - 5715, 9354, 8646, 6553, 8643, 2581, 3241, 6665, - 3936, 5677, 776, 8961, 2596, 1404, 8448, 3466, - 8374, 6407, 9540, 3608, 8614, 6021, 573, 949, - 8416, 7147, 8621, 2691, 6429, 8691, 7634, 772, - 89, 2786, 7169, 6823, 9486, 7807, 1554, 1429, - 8278, 3688, 5352, 4658, 8852, 9013, 9163, 5624, - 2363, 8992, 7480, 9099, 5429, 8079, 1235, 1177, - 8441, 9443, 8841, 1526, 899, 4690, 7947, 9598, - 210, 8061, 5363, 8632, 8660, 3791, 7135, 5744, - 3939, 5190, 4819, 8291, 1515, 7886, 3114, 6952, - 2498, 5758, 245, 1104, 6047, 2056, 3379, 7991, - 6993, 7720, 1746, 4440, 7800, 3194, 2512, 4296, - 3072, 8662, 1929, 7680, 4080, 4999, 7253, 6706, - 65, 8144, 5567, 3131, 3500, 8032, 3210, 8721, - 9733, 246, 3335, 8139, 2564, 2307, 5130, 7685, - 6143, 2690, 4963, 9028, 3967, 8385, 6454, 3020, - 3844, 1893, 2889, 5541, 8504, 374, 7689, 2068, - 4199, 6632, 6003, 4161, 7427, 5366, 3837, 7481, - 4184, 4059, 6669, 2982, 6572, 7942, 6892, 3090, - 9143, 4052, 988, 8996, 7508, 2430, 3054, 6349, - 4014, 4949, 6171, 2648, 9933, 1038, 3046, 8955, - 3754, 4123, 3175, 3938, 2682, 3831, 9513, 1213, - 394, 783, 5094, 8043, 4966, 3131, 6018, 9166, - 7031, 7139, 5518, 4981, 5179, 8622, 2757, 9262, - 3635, 2899, 5093, 9238, 8975, 2374, 4244, 8814, - 31, 6851, 2453, 7638, 528, 6045, 3521, 4686, - 5415, 6689, 4342, 4629, 1928, 2182, 968, 3344, - 7654, 6088, 5259, 9531, 2122, 8346, 4173, 735, - 9159, 4533, 7493, 6745, 2635, 6334, 7907, 7916, - 2572, 478, 8063, 2679, 4777, 1168, 5397, 5514, - 1663, 2579, 6615, 1964, 8593, 5498, 6036, 7463, - 8815, 1208, 5069, 5234, 609, 8966, 4552, 1157, - 2099, 44, 1001, 9393, 8254, 196, 1517, 113, - 3557, 5894, 6684, 6020, 2640, 3565, 672, 5834, - 8844, 3245, 3912, 4242, 480, 3940, 3700, 9274, - 4416, 2558, 4846, 4828, 5599, 9101, 6419, 1439, - 5164, 5219, 3056, 2619, 5510, 7513, 2339, 2952, - 7539, 2728, 6880, 2140, 406, 3032, 5314, 2592, - 6889, 4490, 2748, 8871, 3996, 3202, 6519, 2460, - 7927, 8324, 2242, 7373, 9534, 7626, 7641, 4965, - 3972, 5369, 3904, 2053, 8744, 8630, 124, 1431, - 1643, 5368, 7730, 1757, 2613, 7414, 225, 9158, - 7726, 197, 2648, 9531, 7062, 2318, 8972, 433, - 458, 7883, 8832, 2662, 3314, 8091, 6748, 5703, - 5124, 7447, 8008, 9237, 6696, 7880, 28, 8663, - 525, 2906, 7521, 2442, 7245, 7738, 8926, 4, - /* * 10000**927 */ - /* 65536**840 = */ 1776, 4209, 107, 8907, 5829, 8291, 3792, 7140, - 8690, 5729, 1980, 8333, 6343, 4729, 4891, 6613, - 1876, 7120, 2857, 4433, 4445, 5275, 7171, 48, - 9321, 7844, 7123, 2851, 7177, 8795, 9744, 9639, - 2481, 2561, 4398, 8938, 6005, 3603, 9539, 4851, - 6380, 6376, 5478, 9062, 2258, 8093, 4242, 3610, - 6371, 1120, 9049, 432, 8580, 9844, 443, 4598, - 4973, 845, 5958, 5061, 7948, 9512, 9145, 8386, - 7212, 126, 1672, 1176, 9349, 4654, 4602, 814, - 7191, 2008, 4459, 5745, 7526, 646, 5999, 9963, - 8550, 9791, 7786, 277, 6598, 7600, 901, 3352, - 8074, 3157, 3661, 6470, 905, 3657, 4173, 4804, - 6683, 9857, 4353, 1123, 8293, 669, 6879, 594, - 353, 1428, 3387, 5667, 8085, 1175, 4243, 393, - 6238, 449, 5931, 3907, 1424, 3236, 205, 3023, - 6171, 188, 7723, 9095, 1359, 1890, 1791, 8386, - 444, 162, 2509, 3757, 3354, 2757, 231, 6664, - 6929, 6426, 9025, 937, 1175, 7815, 5138, 5412, - 9050, 8921, 9895, 949, 2682, 909, 9622, 5279, - 1797, 7274, 4291, 3764, 3575, 9282, 6469, 2980, - 3245, 4850, 6847, 3690, 5293, 5479, 8362, 264, - 8983, 2738, 1503, 6814, 1557, 2719, 9253, 5235, - 9351, 1013, 8631, 7562, 7326, 2565, 5343, 3416, - 3876, 2749, 5448, 9776, 3548, 2345, 8095, 5557, - 5994, 1001, 201, 6028, 4903, 5273, 4875, 3387, - 9854, 5952, 8239, 532, 4892, 4540, 9787, 1357, - 2935, 7540, 7254, 295, 3020, 4145, 9693, 3272, - 4423, 6528, 7824, 9108, 8383, 6625, 3156, 5428, - 8091, 1867, 6682, 7034, 7554, 883, 4275, 763, - 4093, 692, 7649, 4523, 2587, 8443, 2065, 5289, - 9385, 6198, 7308, 5388, 4113, 3746, 2214, 4397, - 4402, 6210, 4346, 199, 1021, 9899, 5375, 5990, - 9027, 7089, 3338, 5270, 1537, 9622, 1888, 1494, - 9477, 8020, 3438, 4614, 5382, 9984, 8216, 4446, - 3556, 3442, 1354, 3210, 5823, 5800, 6798, 3366, - 2968, 1726, 7017, 5620, 5685, 7769, 1878, 7500, - 6906, 3901, 6414, 5479, 2752, 711, 1004, 8708, - 4338, 9854, 8760, 1031, 3150, 743, 967, 684, - 7982, 5422, 6089, 7801, 1017, 3190, 1700, 5919, - 5483, 6599, 7922, 2498, 3262, 4877, 2088, 1374, - 4022, 8151, 1697, 2456, 6997, 7997, 7193, 4662, - 7068, 6463, 3470, 8660, 3199, 7435, 5453, 1076, - 419, 2619, 1406, 6533, 9911, 5996, 9877, 4978, - 7672, 1304, 822, 4811, 7474, 9591, 1426, 9125, - 9955, 1525, 5834, 5706, 5982, 3518, 5423, 6252, - 1064, 2787, 605, 1021, 4464, 1705, 4838, 9614, - 319, 2323, 8396, 3547, 53, 6057, 9843, 4142, - 9535, 8053, 2223, 5879, 8446, 8236, 5036, 8137, - 9073, 2448, 8498, 6342, 6345, 9231, 4639, 9982, - 1217, 5858, 1892, 9155, 8981, 1331, 5526, 8429, - 7349, 9100, 8885, 3800, 9082, 5906, 8711, 8499, - 5398, 2333, 2499, 1358, 5396, 4550, 5870, 8484, - 5564, 9294, 9792, 6786, 1836, 6702, 1679, 9666, - 135, 7422, 5626, 6295, 7828, 7080, 3345, 185, - 3703, 6082, 2495, 8876, 5184, 3822, 7532, 8564, - 2685, 1624, 5515, 9775, 308, 9383, 8733, 3077, - 7284, 7302, 35, 9581, 4927, 7462, 4845, 3331, - 5693, 4714, 8522, 2192, 964, 8033, 2145, 732, - 5792, 9066, 856, 2601, 577, 8527, 5526, 5967, - 8391, 3060, 4344, 853, 3311, 6918, 8370, 5791, - 6755, 9258, 1964, 3862, 7326, 2755, 1576, 1675, - 119, 386, 2571, 8189, 3370, 701, 3281, 710, - 8885, 6139, 9961, 8922, 8174, 8375, 6138, 9847, - 4854, 5777, 8551, 7930, 7401, 3457, 3143, 1508, - 5753, 3694, 5993, 5228, 5480, 2515, 6763, 8335, - 9088, 4979, 7987, 5760, 3039, 5766, 5868, 1932, - 3435, 8274, 1667, 8305, 9678, 5741, 5193, 9322, - 9946, 2433, 928, 3582, 8437, 5169, 7521, 9860, - 9741, 840, 26, 7364, 2620, 7373, 1114, 7601, - 7048, 5289, 8616, 2816, 9703, 3595, 2060, 5086, - 2673, 3530, 1359, 1861, 4220, 3700, 899, 1352, - 5551, 1020, 5759, 8483, 992, 8250, 9411, 3180, - 6634, 856, 6254, 6194, 3917, 9296, 9035, 2348, - 9174, 7872, 3374, 8845, 3908, 3210, 8206, 3901, - 1083, 2442, 6626, 7538, 1519, 2002, 5375, 1211, - 4597, 1027, 8913, 2970, 5316, 2039, 3828, 9530, - 8672, 1290, 6243, 8398, 7670, 584, 8554, 9782, - 4689, 2322, 3891, 5570, 2441, 3620, 2995, 7453, - 7493, 7524, 9193, 1840, 8562, 7087, 8880, 1692, - 9390, 2120, 6310, 1186, 3800, 4528, 2717, 3715, - 4188, 848, 3877, 973, 8688, 171, 3610, 1814, - 4226, 8168, 4374, 640, 1652, 9149, 1983, 7776, - 5724, 8085, 7642, 4732, 4416, 6266, 5192, 6489, - 4151, 5721, 1778, 2708, 6310, 8698, 8896, 1888, - 8171, 3950, 4756, 4292, 2005, 4487, 6940, 3027, - 8680, 4280, 8169, 7400, 8615, 848, 4686, 4370, - 1307, 1776, 7336, 6208, 5860, 6436, 695, 2444, - 2655, 2326, 4144, 5741, 3920, 5873, 4979, 7768, - 5503, 7203, 2283, 7788, 2037, 9131, 2916, 8724, - 4754, 8308, 2395, 6739, 485, 8073, 7861, 1191, - 981, 1998, 4277, 2306, 5509, 2861, 676, 5039, - 4515, 6900, 2085, 7407, 2948, 4810, 7243, 8107, - 6124, 3955, 3517, 1027, 1467, 8102, 4121, 3754, - 9510, 2956, 3027, 944, 8889, 8388, 2269, 8781, - 8941, 503, 1588, 7452, 9731, 7045, 9086, 8895, - 90, 3144, 5569, 1415, 3996, 8866, 4640, 3533, - 3634, 4686, 8961, 5342, 8259, 8604, 9081, 9368, - 7927, 6117, 7509, 8903, 3256, 7008, 3099, 3508, - 3273, 9709, 9373, 1374, 8944, 3639, 8505, 4042, - 12, 530, 9273, 4801, 761, 4913, 6606, 6739, - 5605, 5637, 719, 6984, 1130, 1078, 8796, 4411, - 7204, 8668, 5225, 1596, 8800, 8083, 5620, 910, - 8022, 8753, 5414, 3163, 9797, 2492, 2109, 9440, - 9737, 3659, 2952, 913, 4297, 3855, 6891, 6867, - 5392, 9757, 9361, 4312, 5415, 3533, 5994, 513, - 3224, 3486, 346, 4150, 2752, 5895, 3247, 2275, - 5137, 5424, 6854, 9918, 2273, 7434, 6655, 2269, - 9720, 3915, 9785, 8604, 3799, 6065, 4070, 2204, - 2145, 4721, 6743, 8533, 4504, 4512, 8547, 8199, - 8506, 3184, 2829, 8578, 5963, 9629, 3319, 1411, - 784, 9160, 3925, 2117, 8216, 8156, 5230, 1021, - 8468, 9979, 199, 6132, 4556, 3388, 4447, 1503, - 9203, 4028, 4633, 4537, 9846, 7104, 966, 9786, - 2402, 6280, 8393, 3514, 3675, 5066, 45, 5484, - 8185, 6376, 6151, 3773, 8101, 8363, 7257, 2164, - 3548, 1215, 4667, 559, 511, 5707, 5787, 7552, - 6589, 8935, 2179, 1088, 2297, 2033, 1133, 574, - 8896, 3265, 2681, 3424, 2090, 7972, 4505, 1357, - 7108, 8543, 9500, 3580, 1116, 5400, 236, 7512, - 4229, 8918, 1198, 544, 6951, 1621, 3290, 8406, - 6135, 1400, 78, 9094, 1289, 9849, 4254, 3557, - 696, 483, 5400, 2399, 2703, 409, 1518, 1043, - 8505, 1877, 6060, 3483, 9219, 914, 4416, 2185, - 6440, 7397, 2019, 4889, 9143, 6834, 3063, 8356, - 3821, 7035, 1972, 8312, 1494, 4774, 9537, 8837, - 5645, 2248, 9105, 2307, 8597, 8588, 1190, 7930, - 8253, 8822, 6853, 69, /* * 10000**1011 */ - /* 65536**910 = */ 6976, 7276, 8858, 1221, 9753, 5084, 4453, 1746, - 2564, 5306, 1580, 9569, 1433, 6440, 9350, 1312, - 163, 2607, 7092, 9083, 4624, 8203, 8919, 7749, - 3440, 6823, 6182, 2031, 7548, 5547, 4636, 5050, - 5758, 7923, 4655, 1010, 9987, 772, 7430, 7397, - 8813, 2398, 8251, 2488, 2603, 118, 1294, 227, - 9376, 9951, 3868, 1075, 5311, 7911, 4461, 8224, - 274, 2903, 9270, 3359, 2746, 3671, 2503, 7591, - 6718, 4357, 8995, 4873, 2301, 2009, 7763, 4513, - 4937, 3992, 1217, 3614, 7118, 5669, 5378, 1265, - 1379, 7102, 7925, 1319, 1768, 3234, 8757, 2335, - 3113, 1722, 6896, 563, 7461, 4313, 9102, 1117, - 9118, 9666, 6719, 1369, 4573, 3534, 3090, 3498, - 7834, 2943, 8466, 9411, 6501, 9251, 2604, 892, - 466, 4658, 6553, 3949, 377, 2602, 284, 99, - 2675, 9445, 2191, 5520, 5423, 3134, 7131, 8653, - 4866, 284, 5986, 9313, 3557, 1286, 1602, 1116, - 2596, 5249, 6799, 8663, 1549, 7218, 8045, 5368, - 8620, 85, 8305, 8144, 6653, 4913, 796, 5668, - 471, 8853, 7640, 5428, 3341, 4658, 7712, 5801, - 3405, 3699, 207, 6821, 3089, 3959, 5917, 1322, - 7214, 438, 7617, 1547, 4391, 183, 4965, 5172, - 8933, 4752, 479, 9733, 950, 7810, 5681, 3581, - 4162, 4049, 3572, 3884, 1211, 7627, 6099, 4410, - 7572, 7868, 229, 3452, 1679, 6516, 782, 9064, - 5097, 4056, 5308, 424, 847, 8447, 1214, 4563, - 763, 7166, 8506, 1912, 4796, 2775, 3847, 35, - 5471, 2069, 3525, 3321, 4709, 8304, 3015, 3633, - 1027, 9475, 4081, 15, 9395, 7495, 5293, 1385, - 707, 4543, 4533, 15, 2282, 6080, 6456, 7843, - 8776, 2104, 5874, 3666, 3846, 6178, 7517, 9013, - 1282, 5177, 3730, 5068, 2562, 1258, 266, 4640, - 9320, 2217, 1078, 8299, 3147, 5444, 2258, 6110, - 5603, 4852, 4268, 8378, 1360, 7766, 3834, 2833, - 2966, 498, 1814, 5324, 8535, 3968, 4782, 6038, - 5348, 5378, 8407, 7004, 3934, 5886, 6509, 4476, - 2518, 942, 387, 7880, 310, 2194, 789, 9524, - 3994, 6498, 4676, 2194, 7029, 1471, 7694, 9214, - 4989, 807, 9958, 2955, 1408, 9697, 9369, 4043, - 690, 8441, 3288, 8437, 1376, 4984, 1291, 8808, - 8585, 9792, 8599, 7985, 2883, 8551, 9600, 8612, - 8145, 8093, 5364, 7581, 6825, 892, 9161, 7353, - 5283, 6962, 4767, 4665, 8637, 8511, 8351, 9611, - 3276, 9081, 4325, 3128, 7232, 9014, 9828, 7083, - 2200, 3406, 4976, 3646, 4736, 5100, 1263, 7919, - 1368, 83, 7397, 8019, 626, 1181, 8554, 9738, - 9409, 5766, 9788, 6858, 6925, 6625, 9783, 5868, - 6651, 3983, 8582, 2528, 9149, 186, 7976, 295, - 4158, 4110, 3783, 1155, 1983, 4097, 2663, 3665, - 5049, 8310, 2361, 5778, 8997, 1458, 2437, 3930, - 1459, 3258, 8915, 5745, 9011, 1080, 8782, 2896, - 4877, 3522, 7368, 8059, 9387, 4871, 3417, 9118, - 6149, 5578, 2863, 325, 4461, 7766, 3619, 6858, - 6849, 1017, 9989, 7450, 1635, 5741, 6046, 8153, - 1705, 7337, 1343, 4508, 2940, 2177, 8291, 3668, - 3988, 7230, 9741, 9276, 1492, 9060, 5831, 1915, - 4323, 3327, 5156, 7634, 5667, 93, 1615, 7146, - 384, 1403, 7450, 648, 397, 3380, 8248, 1488, - 8379, 2229, 9203, 481, 9153, 8241, 705, 9533, - 7505, 3015, 9070, 125, 4603, 8425, 5131, 8879, - 2839, 4140, 6128, 5688, 1555, 2700, 6136, 9704, - 8254, 4678, 981, 264, 9401, 7255, 3538, 8116, - 2324, 280, 7020, 4111, 5298, 9315, 3155, 4012, - 8476, 2668, 2959, 543, 8033, 1389, 3592, 5881, - 3970, 1845, 1091, 1032, 5505, 9360, 7060, 667, - 6498, 9986, 6028, 6059, 2489, 6376, 6771, 8583, - 4217, 3978, 6537, 2508, 9228, 9830, 2933, 2459, - 8427, 1706, 8995, 5630, 4841, 5215, 6392, 6342, - 5770, 4998, 9239, 6236, 9028, 5774, 6114, 3192, - 5621, 2678, 2250, 3881, 2567, 9124, 9573, 1676, - 2312, 1368, 6964, 3234, 4195, 9740, 5063, 9313, - 8299, 611, 4657, 6404, 1343, 7887, 8822, 8197, - 5746, 7804, 5463, 2033, 3102, 6063, 2280, 6637, - 1051, 2474, 4788, 2287, 7937, 9814, 3499, 7309, - 1637, 7193, 6908, 5451, 3257, 2935, 3737, 3206, - 8537, 9857, 2923, 667, 1218, 3142, 9336, 5960, - 8995, 7527, 2049, 7522, 8223, 5862, 1222, 9496, - 2180, 3866, 8448, 6658, 9447, 819, 9613, 5574, - 9317, 1802, 3131, 3030, 8763, 4072, 4076, 7598, - 8667, 3937, 1660, 5038, 187, 5592, 840, 8447, - 9967, 4635, 9237, 7598, 9848, 2653, 3049, 3750, - 5699, 501, 3604, 2456, 8654, 9459, 3750, 2733, - 7222, 5883, 5306, 5175, 8727, 2434, 4666, 8910, - 7732, 2483, 1128, 8416, 8276, 4920, 5230, 732, - 264, 4622, 4744, 4607, 1765, 7218, 6301, 5284, - 5847, 9294, 9827, 7152, 5212, 7979, 7615, 346, - 9431, 9390, 6846, 4592, 3987, 9010, 6105, 7017, - 2309, 1668, 8732, 7920, 4915, 189, 4196, 2592, - 6493, 6397, 7470, 8439, 500, 7208, 5090, 7817, - 3410, 1055, 3293, 8207, 7000, 3912, 627, 465, - 5905, 6474, 2596, 2542, 778, 300, 5879, 416, - 4448, 209, 6162, 8063, 3755, 7192, 5775, 3507, - 2520, 9838, 7927, 343, 7467, 8024, 3848, 1883, - 5174, 5680, 8899, 7719, 4619, 5499, 6810, 6724, - 7123, 6290, 1740, 8554, 5207, 1737, 757, 8732, - 1574, 1745, 1252, 107, 5059, 759, 6479, 2507, - 9607, 6267, 6763, 9485, 1818, 1684, 8360, 6300, - 4553, 7822, 2597, 1854, 1975, 4238, 7314, 8224, - 6705, 8199, 4727, 7715, 2855, 6660, 1739, 3406, - 6535, 43, 1242, 296, 7753, 2009, 5291, 821, - 18, 1348, 6704, 5226, 437, 3221, 1962, 4528, - 1858, 284, 7106, 560, 2332, 416, 6562, 6435, - 2683, 5055, 1485, 3514, 9627, 1215, 6205, 1477, - 6555, 4687, 3258, 3747, 9818, 9762, 1986, 7259, - 28, 2493, 9870, 9052, 1720, 8645, 1800, 5327, - 7511, 658, 2621, 7002, 8181, 8866, 1088, 5519, - 209, 1740, 7793, 3014, 1175, 5203, 4023, 6554, - 2270, 5199, 858, 1103, 1175, 9769, 833, 2917, - 7007, 2643, 2767, 8226, 4073, 6218, 6074, 1207, - 6949, 4017, 6636, 5655, 8096, 9055, 2536, 9186, - 8843, 1363, 5220, 3307, 2440, 6009, 9620, 6050, - 1115, 4676, 3791, 977, 9909, 7363, 8927, 6256, - 62, 559, 5329, 6245, 5692, 5519, 2414, 5324, - 8526, 6190, 9466, 3871, 6430, 5570, 8518, 3076, - 4532, 8548, 1161, 3916, 9511, 356, 1491, 1877, - 5183, 6069, 4894, 9405, 3707, 6403, 8855, 6093, - 6422, 9704, 8695, 3494, 2905, 1988, 3599, 945, - 635, 4691, 3183, 3024, 9662, 835, 6925, 3011, - 3908, 2017, 5279, 8224, 4096, 9738, 901, 1320, - 2166, 1263, 9773, 1622, 5610, 5924, 4911, 7663, - 5610, 524, 6658, 5441, 179, 749, 4203, 4005, - 5667, 9337, 33, 8313, 262, 2359, 9623, 8540, - 7893, 8663, 7047, 8786, 4550, 3678, 3447, 1408, - 7314, 8285, 3199, 1835, 5737, 7556, 7294, 8703, - 8128, 9057, 8403, 4123, 6700, 6751, 1483, 9449, - 473, 4244, 8907, 6359, 5562, 1974, 3050, 8446, - 8917, 251, 6614, 7901, 1243, 9635, 3181, 8615, - 5248, 5140, 9350, 5142, 76, 6633, 8022, 4730, - 1918, 6607, 7956, 7681, 8077, 1116, 271, 5575, - 3878, 500, 2472, 7001, 5866, 7249, 1797, 9779, - 6083, 6938, 6244, 6041, 5725, 4592, 9808, 346, - 7514, 8583, 4325, 4357, 2303, 7553, 2057, 7873, - 731, 3634, 4935, 6612, 993, 341, 4071, 9185, - 9884, 4686, 1924, 487, 2122, 3551, 8157, 4261, - 5804, 9007, 3999, 7058, 2929, 3813, 6266, 9248, - 3732, 7720, 2932, 4846, 9009, 5513, 386, 5866, - 6709, 1187, 3069, 5947, 1009, 1673, 5145, 992, - /* * 10000**1095 */ - /* 65536**980 = */ 2176, 248, 1520, 1891, 317, 4171, 757, 8470, - 652, 7083, 8338, 6493, 4307, 8339, 1485, 8274, - 9486, 5402, 7939, 165, 7113, 9646, 2927, 6165, - 5955, 9620, 9187, 4373, 6839, 1506, 6488, 8229, - 4865, 6749, 5419, 1020, 7004, 8972, 3246, 7404, - 935, 2842, 1856, 9433, 2067, 6350, 9296, 492, - 9336, 8036, 7456, 4970, 3370, 6744, 9291, 1339, - 3023, 9520, 6938, 491, 7452, 8359, 9349, 6900, - 9125, 4234, 4245, 4886, 8311, 2065, 9189, 8952, - 303, 5958, 7274, 6088, 2313, 4527, 7803, 2173, - 3259, 8336, 7826, 2669, 367, 1056, 4270, 5660, - 9691, 4897, 3869, 7976, 41, 1111, 2781, 7089, - 4609, 8652, 164, 7944, 9031, 1555, 5491, 3585, - 2999, 3852, 8420, 7772, 969, 8120, 5102, 4406, - 1136, 1437, 3008, 2149, 599, 7074, 9892, 5579, - 9743, 5835, 8891, 5006, 5570, 2243, 384, 6609, - 1133, 7279, 8904, 2863, 3066, 2014, 8748, 4461, - 2650, 1866, 288, 6998, 5516, 3897, 1166, 9797, - 8531, 8250, 7831, 3696, 870, 7023, 389, 7558, - 1999, 8258, 2046, 7513, 2811, 8238, 1173, 5128, - 122, 4675, 7237, 8182, 9434, 3240, 8220, 7546, - 8358, 9730, 9714, 8782, 2992, 8324, 9009, 9726, - 7008, 9997, 5661, 2033, 1192, 761, 4021, 7857, - 8964, 6300, 3078, 4631, 3885, 8829, 5412, 8533, - 4943, 9925, 503, 4646, 296, 8615, 1814, 2856, - 7475, 6102, 8949, 418, 9540, 2480, 2129, 7414, - 9899, 4415, 2420, 2374, 8697, 8448, 8389, 7107, - 1253, 1244, 5943, 7751, 5903, 2021, 1474, 7634, - 7301, 718, 3185, 8741, 2753, 2589, 7111, 6699, - 2626, 2326, 3628, 9551, 9923, 2100, 4313, 7508, - 9937, 857, 1179, 1855, 629, 1816, 5015, 4599, - 2703, 2364, 5149, 2416, 7588, 8446, 9864, 9747, - 852, 1958, 6390, 9211, 613, 3992, 2800, 79, - 6870, 5815, 7821, 8733, 9913, 4655, 3430, 5757, - 986, 8621, 7406, 8629, 7657, 9176, 9632, 1725, - 1371, 2317, 8136, 3049, 6937, 4684, 9733, 1710, - 5797, 5178, 3269, 189, 2095, 3335, 4981, 5396, - 4385, 4817, 1469, 2289, 4091, 2694, 7790, 8184, - 3667, 4975, 6886, 9264, 718, 8665, 388, 712, - 2259, 1874, 3031, 5644, 9660, 8683, 8488, 5076, - 9643, 9501, 1888, 5081, 1651, 4604, 4374, 8112, - 2414, 6612, 9929, 6241, 5596, 1128, 2103, 4114, - 6934, 3602, 1823, 2207, 5530, 2980, 2658, 5633, - 6674, 7776, 5101, 8530, 1935, 7744, 1424, 8220, - 8128, 4931, 1355, 7845, 6170, 9867, 6584, 6935, - 6795, 5163, 7645, 7867, 4345, 344, 1026, 2615, - 2625, 8149, 5050, 6811, 7299, 8987, 7386, 8553, - 7549, 2918, 4748, 950, 8418, 2389, 7522, 2261, - 255, 8942, 7767, 6011, 820, 8949, 5517, 490, - 5373, 781, 9901, 6177, 3439, 4703, 1761, 5121, - 7534, 7327, 4637, 4787, 4313, 3097, 3202, 1610, - 2764, 3750, 4394, 8205, 1931, 1077, 5151, 1179, - 4549, 5279, 8522, 4711, 3315, 4642, 5964, 6940, - 6983, 6916, 5068, 9367, 1156, 9702, 6608, 670, - 195, 1247, 328, 7188, 4002, 5834, 5307, 684, - 8962, 2762, 7862, 5007, 9687, 9931, 7972, 6337, - 4225, 5619, 4964, 8533, 6248, 7185, 4312, 6265, - 5874, 6340, 5018, 6652, 8458, 5872, 770, 554, - 1302, 4058, 8248, 4358, 4652, 6024, 890, 4875, - 2705, 5584, 7538, 976, 5571, 360, 1820, 3412, - 6038, 6315, 9315, 6561, 4197, 4690, 9422, 9752, - 3733, 7172, 9556, 3042, 4647, 5338, 6505, 5121, - 2219, 6640, 8273, 1078, 8827, 2091, 623, 6853, - 6117, 9542, 8504, 5937, 2070, 8902, 4059, 8539, - 8624, 8109, 4590, 1628, 6268, 9461, 7165, 9491, - 4033, 4220, 8426, 396, 2679, 1851, 8628, 3905, - 1106, 4994, 2277, 6769, 4436, 3506, 5218, 8859, - 7428, 7126, 4193, 6588, 1522, 6658, 2167, 4533, - 2632, 8226, 468, 5175, 8409, 9024, 9564, 1863, - 4504, 9182, 2197, 8657, 8529, 1546, 4264, 9014, - 6824, 106, 5357, 8213, 8963, 3340, 638, 1656, - 9952, 4541, 1058, 8801, 9759, 2222, 2920, 1735, - 5882, 321, 1602, 2695, 8764, 2383, 9357, 6416, - 6598, 2886, 4225, 3840, 2473, 2140, 3062, 7970, - 8073, 9445, 2112, 8917, 2596, 171, 5587, 524, - 8222, 6139, 3895, 9767, 2438, 2422, 2005, 5505, - 4947, 4718, 5294, 2535, 7980, 951, 8984, 1407, - 1440, 3542, 2134, 3317, 4770, 128, 8450, 1947, - 1460, 3424, 5633, 2582, 649, 519, 8207, 6121, - 6139, 9894, 9980, 1710, 9769, 5225, 284, 7703, - 2624, 8299, 8939, 3596, 6656, 2936, 4770, 147, - 2739, 1940, 8867, 4694, 9518, 867, 3069, 9403, - 9348, 2490, 1169, 8508, 853, 8050, 131, 3801, - 3028, 6506, 5448, 2260, 8910, 5919, 670, 1208, - 1218, 228, 6106, 2550, 9642, 6253, 1298, 6945, - 9839, 7653, 3981, 9028, 4597, 4675, 4894, 9260, - 6700, 9025, 5944, 4541, 5170, 3888, 2026, 1647, - 8420, 4215, 2651, 1370, 5805, 7668, 9641, 8292, - 4721, 5231, 8320, 3, 8444, 2102, 1581, 3061, - 1034, 5466, 910, 9717, 9852, 6767, 317, 2826, - 4926, 9635, 1398, 9416, 1139, 6713, 1096, 9345, - 6737, 548, 7124, 4403, 2439, 8806, 9365, 5021, - 9528, 9613, 6181, 4633, 9610, 2617, 9828, 3195, - 3306, 9236, 1650, 1103, 5701, 2131, 2941, 5509, - 5556, 1853, 1247, 2983, 5129, 8837, 2623, 9853, - 8119, 5778, 9731, 5106, 6842, 7995, 301, 6820, - 2110, 7373, 8539, 3599, 6848, 5821, 5314, 3069, - 9753, 5159, 8600, 7729, 5936, 924, 3160, 4973, - 3849, 5006, 3502, 9551, 5341, 1601, 1092, 433, - 1572, 5946, 6038, 3545, 5322, 2411, 9889, 7641, - 8900, 6192, 9858, 1043, 4811, 3308, 7779, 2545, - 7963, 6558, 74, 8987, 5722, 5026, 2881, 4719, - 5084, 9274, 5489, 1330, 1686, 9460, 4437, 8446, - 2075, 4792, 6219, 9685, 612, 5747, 4490, 3931, - 5705, 3583, 4775, 5449, 1695, 6443, 8344, 8509, - 9209, 6503, 2965, 6959, 2726, 1628, 296, 2447, - 1438, 1914, 5386, 8362, 4148, 4979, 9400, 8414, - 9300, 8354, 7531, 9950, 5125, 8849, 2939, 1847, - 7962, 1124, 851, 2943, 9872, 5655, 797, 4552, - 7777, 7723, 8476, 5346, 977, 3644, 9120, 7364, - 4835, 8669, 9157, 9672, 7818, 8654, 9068, 7482, - 1642, 6578, 7998, 1898, 9438, 1015, 8315, 7132, - 1764, 8202, 5622, 1460, 8768, 3457, 111, 8793, - 6904, 8641, 1212, 6691, 5575, 2788, 7815, 646, - 3034, 3167, 1541, 3614, 162, 7023, 3217, 8610, - 4669, 346, 9747, 4128, 7411, 53, 1844, 2454, - 5512, 4377, 5549, 9197, 2988, 5800, 7230, 6270, - 9887, 4439, 1073, 2705, 9696, 4646, 7107, 9250, - 4806, 9598, 6577, 1310, 9339, 8418, 8519, 5917, - 2358, 1093, 9989, 8004, 3372, 6136, 4321, 4657, - 6000, 5693, 2462, 3856, 4089, 2522, 6144, 8267, - 3376, 9923, 9328, 5582, 2740, 8429, 3047, 511, - 9284, 6246, 5686, 7135, 4976, 1175, 4120, 9157, - 8525, 7158, 4119, 8361, 1810, 4566, 666, 6241, - 3896, 4733, 3696, 9610, 5365, 9852, 8767, 1301, - 5871, 8539, 682, 4994, 1086, 7813, 851, 5979, - 2648, 3138, 9995, 4591, 263, 5236, 8753, 7364, - 3999, 461, 2585, 7108, 306, 5152, 2741, 1754, - 4543, 9288, 1672, 2058, 6221, 4785, 1733, 909, - 6084, 7208, 7617, 673, 3060, 8661, 4417, 2233, - 8342, 9571, 6460, 6889, 2706, 3929, 5167, 967, - 6966, 9916, 6571, 6214, 6145, 9200, 1010, 2198, - 9079, 2821, 7049, 6905, 8235, 6461, 4953, 8649, - 905, 407, 9711, 2323, 2666, 2091, 1025, 5391, - 1241, 6737, 9248, 9298, 8450, 9319, 1462, 9150, - 1607, 4170, 6541, 7781, 1467, 8420, 5376, 194, - 6651, 7415, 513, 3578, 2889, 6835, 4776, 4085, - 538, 8155, 3194, 9467, 2105, 8505, 7369, 4793, - 4217, 9718, 8891, 3626, 1771, 8721, 116, 5540, - 7326, 3918, 6894, 8012, 4180, 7138, 5236, 5303, - 2602, 3564, 9007, 5662, 4729, 6969, 4493, 4929, - 1502, 5857, 8687, 97, 3912, 4519, 8216, 5498, - 4214, 8063, 1746, 8592, 9702, 9017, 1531, 1223, - 4247, 820, 4218, 1186, 3587, 9973, 1734, 1297, - 8275, 2024, 9920, 6071, 5908, 4298, 895, 3902, - 2619, 2039, 8559, 2462, 332, 8129, 2696, 7156, - 5009, 5726, 4366, 8780, 2654, 2723, 4871, 244, - 1015, 9987, 1781, 4136, 1, /* * 10000**1180 */ -0}; /* end powers of 65536 in base 10000 */ - -unsigned short _start_big_powers_two[] = { - 0, 1, 86, 255, 508, 846, 1268, 1774, - 2365, 3040, 3799, 4642, 5570, 6582, 7678, 8859, - -0}; /* end _start_big_powers_two */ diff --git a/usr/src/lib/libbc/libc/gen/common/_crypt.c b/usr/src/lib/libbc/libc/gen/common/_crypt.c deleted file mode 100644 index 4a4edca281..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_crypt.c +++ /dev/null @@ -1,470 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984,1988 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -/* - * This program implements the - * Proposed Federal Information Processing - * Data Encryption Standard. - * See Federal Register, March 17, 1975 (40FR12134) - */ - -/* - * Initial permutation, - */ -static char IP[] = { - 58,50,42,34,26,18,10, 2, - 60,52,44,36,28,20,12, 4, - 62,54,46,38,30,22,14, 6, - 64,56,48,40,32,24,16, 8, - 57,49,41,33,25,17, 9, 1, - 59,51,43,35,27,19,11, 3, - 61,53,45,37,29,21,13, 5, - 63,55,47,39,31,23,15, 7, -}; - -/* - * Final permutation, FP = IP^(-1) - */ -static char FP[] = { - 40, 8,48,16,56,24,64,32, - 39, 7,47,15,55,23,63,31, - 38, 6,46,14,54,22,62,30, - 37, 5,45,13,53,21,61,29, - 36, 4,44,12,52,20,60,28, - 35, 3,43,11,51,19,59,27, - 34, 2,42,10,50,18,58,26, - 33, 1,41, 9,49,17,57,25, -}; - -/* - * Permuted-choice 1 from the key bits - * to yield C and D. - * Note that bits 8,16... are left out: - * They are intended for a parity check. - */ -static char PC1_C[] = { - 57,49,41,33,25,17, 9, - 1,58,50,42,34,26,18, - 10, 2,59,51,43,35,27, - 19,11, 3,60,52,44,36, -}; - -static char PC1_D[] = { - 63,55,47,39,31,23,15, - 7,62,54,46,38,30,22, - 14, 6,61,53,45,37,29, - 21,13, 5,28,20,12, 4, -}; - -/* - * Sequence of shifts used for the key schedule. - */ -static char shifts[] = { - 1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1, -}; - -/* - * Permuted-choice 2, to pick out the bits from - * the CD array that generate the key schedule. - */ -static char PC2_C[] = { - 14,17,11,24, 1, 5, - 3,28,15, 6,21,10, - 23,19,12, 4,26, 8, - 16, 7,27,20,13, 2, -}; - -static char PC2_D[] = { - 41,52,31,37,47,55, - 30,40,51,45,33,48, - 44,49,39,56,34,53, - 46,42,50,36,29,32, -}; - -static struct _crypt { - /* - * The C and D arrays used to calculate the key schedule. - */ - char _C[28]; - char _D[28]; - /* - * The key schedule. - * Generated from the key. - */ - char _KS[16][48]; - /* - * The E bit-selection table. - */ - char _E[48]; - /* - * The current block, divided into 2 halves. - */ - char _L[32], _R[32]; - char _tempL[32]; - char _f[32]; - /* - * The combination of the key and the input, before selection. - */ - char _preS[48]; - /* - * Temps for crypt - */ - char _ablock[66], _iobuf[16]; -} *__crypt; -#define C (_c->_C) -#define D (_c->_D) -#define KS (_c->_KS) -#define E (_c->_E) -#define L (_c->_L) -#define R (_c->_R) -#define tempL (_c->_tempL) -#define f (_c->_f) -#define preS (_c->_preS) -#define ablock (_c->_ablock) -#define iobuf (_c->_iobuf) - -static void _cryptinit(void); - -/* - * Set up the key schedule from the key. - */ - -#ifndef CRYPT -static -#endif -void -setkey(char *key) -{ - int i, j, k; - int t; - struct _crypt *_c = __crypt; - - if (!_c) { - _cryptinit(); - _c = __crypt; - } - /* - * First, generate C and D by permuting - * the key. The low order bit of each - * 8-bit char is not used, so C and D are only 28 - * bits apiece. - */ - for (i=0; i<28; i++) { - C[i] = key[PC1_C[i]-1]; - D[i] = key[PC1_D[i]-1]; - } - /* - * To generate Ki, rotate C and D according - * to schedule and pick up a permutation - * using PC2. - */ - for (i=0; i<16; i++) { - /* - * rotate. - */ - for (k=0; k<shifts[i]; k++) { - t = C[0]; - for (j=0; j<28-1; j++) - C[j] = C[j+1]; - C[27] = t; - t = D[0]; - for (j=0; j<28-1; j++) - D[j] = D[j+1]; - D[27] = t; - } - /* - * get Ki. Note C and D are concatenated. - */ - for (j=0; j<24; j++) { - KS[i][j] = C[PC2_C[j]-1]; - KS[i][j+24] = D[PC2_D[j]-28-1]; - } - } -} - -/* - * The E bit-selection table. - */ -static char e[] = { - 32, 1, 2, 3, 4, 5, - 4, 5, 6, 7, 8, 9, - 8, 9,10,11,12,13, - 12,13,14,15,16,17, - 16,17,18,19,20,21, - 20,21,22,23,24,25, - 24,25,26,27,28,29, - 28,29,30,31,32, 1, -}; - -/* - * The 8 selection functions. - * For some reason, they give a 0-origin - * index, unlike everything else. - */ -static char S[8][64] = { - 14, 4,13, 1, 2,15,11, 8, 3,10, 6,12, 5, 9, 0, 7, - 0,15, 7, 4,14, 2,13, 1,10, 6,12,11, 9, 5, 3, 8, - 4, 1,14, 8,13, 6, 2,11,15,12, 9, 7, 3,10, 5, 0, - 15,12, 8, 2, 4, 9, 1, 7, 5,11, 3,14,10, 0, 6,13, - - 15, 1, 8,14, 6,11, 3, 4, 9, 7, 2,13,12, 0, 5,10, - 3,13, 4, 7,15, 2, 8,14,12, 0, 1,10, 6, 9,11, 5, - 0,14, 7,11,10, 4,13, 1, 5, 8,12, 6, 9, 3, 2,15, - 13, 8,10, 1, 3,15, 4, 2,11, 6, 7,12, 0, 5,14, 9, - - 10, 0, 9,14, 6, 3,15, 5, 1,13,12, 7,11, 4, 2, 8, - 13, 7, 0, 9, 3, 4, 6,10, 2, 8, 5,14,12,11,15, 1, - 13, 6, 4, 9, 8,15, 3, 0,11, 1, 2,12, 5,10,14, 7, - 1,10,13, 0, 6, 9, 8, 7, 4,15,14, 3,11, 5, 2,12, - - 7,13,14, 3, 0, 6, 9,10, 1, 2, 8, 5,11,12, 4,15, - 13, 8,11, 5, 6,15, 0, 3, 4, 7, 2,12, 1,10,14, 9, - 10, 6, 9, 0,12,11, 7,13,15, 1, 3,14, 5, 2, 8, 4, - 3,15, 0, 6,10, 1,13, 8, 9, 4, 5,11,12, 7, 2,14, - - 2,12, 4, 1, 7,10,11, 6, 8, 5, 3,15,13, 0,14, 9, - 14,11, 2,12, 4, 7,13, 1, 5, 0,15,10, 3, 9, 8, 6, - 4, 2, 1,11,10,13, 7, 8,15, 9,12, 5, 6, 3, 0,14, - 11, 8,12, 7, 1,14, 2,13, 6,15, 0, 9,10, 4, 5, 3, - - 12, 1,10,15, 9, 2, 6, 8, 0,13, 3, 4,14, 7, 5,11, - 10,15, 4, 2, 7,12, 9, 5, 6, 1,13,14, 0,11, 3, 8, - 9,14,15, 5, 2, 8,12, 3, 7, 0, 4,10, 1,13,11, 6, - 4, 3, 2,12, 9, 5,15,10,11,14, 1, 7, 6, 0, 8,13, - - 4,11, 2,14,15, 0, 8,13, 3,12, 9, 7, 5,10, 6, 1, - 13, 0,11, 7, 4, 9, 1,10,14, 3, 5,12, 2,15, 8, 6, - 1, 4,11,13,12, 3, 7,14,10,15, 6, 8, 0, 5, 9, 2, - 6,11,13, 8, 1, 4,10, 7, 9, 5, 0,15,14, 2, 3,12, - - 13, 2, 8, 4, 6,15,11, 1,10, 9, 3,14, 5, 0,12, 7, - 1,15,13, 8,10, 3, 7, 4,12, 5, 6,11, 0,14, 9, 2, - 7,11, 4, 1, 9,12,14, 2, 0, 6,10,13,15, 3, 5, 8, - 2, 1,14, 7, 4,10, 8,13,15,12, 9, 0, 3, 5, 6,11, -}; - -/* - * P is a permutation on the selected combination - * of the current L and key. - */ -static char P[] = { - 16, 7,20,21, - 29,12,28,17, - 1,15,23,26, - 5,18,31,10, - 2, 8,24,14, - 32,27, 3, 9, - 19,13,30, 6, - 22,11, 4,25, -}; - - -/* - * The payoff: encrypt a block. - */ - -void -encrypt(char *block, int edflag) -{ - int i, ii; - int t, j, k; - struct _crypt *_c = __crypt; - - if (!_c) { - _cryptinit(); - _c = __crypt; - } - /* - * First, permute the bits in the input - */ - for (j=0; j<64; j++) - L[j] = block[IP[j]-1]; - /* - * Perform an encryption operation 16 times. - */ - for (ii=0; ii<16; ii++) { - /* - * Set direction - */ -#ifdef CRYPT - if (edflag) - i = 15-ii; - else -#endif - i = ii; - /* - * Save the R array, - * which will be the new L. - */ - for (j=0; j<32; j++) - tempL[j] = R[j]; - /* - * Expand R to 48 bits using the E selector; - * exclusive-or with the current key bits. - */ - for (j=0; j<48; j++) - preS[j] = R[E[j]-1] ^ KS[i][j]; - /* - * The pre-select bits are now considered - * in 8 groups of 6 bits each. - * The 8 selection functions map these - * 6-bit quantities into 4-bit quantities - * and the results permuted - * to make an f(R, K). - * The indexing into the selection functions - * is peculiar; it could be simplified by - * rewriting the tables. - */ - for (j=0; j<8; j++) { - t = 6*j; - k = S[j][(preS[t+0]<<5)+ - (preS[t+1]<<3)+ - (preS[t+2]<<2)+ - (preS[t+3]<<1)+ - (preS[t+4]<<0)+ - (preS[t+5]<<4)]; - t = 4*j; - f[t+0] = (k>>3)&01; - f[t+1] = (k>>2)&01; - f[t+2] = (k>>1)&01; - f[t+3] = (k>>0)&01; - } - /* - * The new R is L ^ f(R, K). - * The f here has to be permuted first, though. - */ - for (j=0; j<32; j++) - R[j] = L[j] ^ f[P[j]-1]; - /* - * Finally, the new L (the original R) - * is copied back. - */ - for (j=0; j<32; j++) - L[j] = tempL[j]; - } - /* - * The output L and R are reversed. - */ - for (j=0; j<32; j++) { - t = L[j]; - L[j] = R[j]; - R[j] = t; - } - /* - * The final output - * gets the inverse permutation of the very original. - */ - for (j=0; j<64; j++) - block[j] = L[FP[j]-1]; -} - -char * -_crypt(char *pw, char *salt) -{ - int i, j, c; - int temp; - struct _crypt *_c = __crypt; - - if (!_c) { - _cryptinit(); - _c = __crypt; - } - for(i=0; i<66; i++) - ablock[i] = 0; - for(i=0; (c= *pw) && i<64; pw++){ - for(j=0; j<7; j++, i++) - ablock[i] = (c>>(6-j)) & 01; - i++; - } - - setkey(ablock); - - for(i=0; i<66; i++) - ablock[i] = 0; - - for(i=0;i<48;i++) - E[i] = e[i]; - - for(i=0;i<2;i++){ - c = *salt++; - iobuf[i] = c; - if(c > 'Z') - c -= 6; - if(c > '9') - c -= 7; - c -= '.'; - for(j=0;j<6;j++){ - if((c>>j) & 01){ - temp = E[6*i+j]; - E[6*i+j] = E[6*i+j+24]; - E[6*i+j+24] = temp; - } - } - } - - for(i=0; i<25; i++) - encrypt(ablock,0); - - for(i=0; i < 11; i++) { - c = 0; - for(j=0; j<6; j++){ - c <<= 1; - c |= ablock[6*i+j]; - } - c += '.'; - if(c > '9') - c += 7; - if(c > 'Z') - c += 6; - iobuf[i+2] = c; - } - iobuf[i+2] = 0; - if(iobuf[1]==0) - iobuf[1] = iobuf[0]; - return(iobuf); -} - -static void -_cryptinit(void) -{ - struct _crypt *_c = __crypt; - int i; - - if (_c) - return; - _c = __crypt = (struct _crypt *)calloc(1, sizeof (struct _crypt)); - if (_c == 0) - abort(); - - for(i=0;i<48;i++) - E[i] = e[i]; -} diff --git a/usr/src/lib/libbc/libc/gen/common/_nlist.c b/usr/src/lib/libbc/libc/gen/common/_nlist.c deleted file mode 100644 index a865401729..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_nlist.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1980 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/param.h> -#include <a.out.h> - -#define BSIZ 8*1024 /* size of local buffers */ - -/* - * _nlist - retreive attributes from name list (string table version) - * - * Note: This is a modified form of the original nlist() function. - * It takes a file descriptor instead of a filename argument - * and is intended to be called by nlist(3) and kvmnlist(3K). - * The algorithm has been modified from the original to use local - * (rather than stdio) buffering and issues considerably fewer lseeks. - */ -int -_nlist(int fd, struct nlist *list) -{ - struct nlist *p, *q; - char *s1, *s2; - int soff; - int stroff = 0; - int n, m; - int maxlen, nreq; - long sa; /* symbol address */ - long ss; /* start of strings */ - struct exec buf; - struct nlist space[BSIZ/sizeof (struct nlist)]; - char strs[BSIZ]; - - maxlen = 0; - for (q = list, nreq = 0; q->n_un.n_name && q->n_un.n_name[0]; - q++, nreq++) { - q->n_type = 0; - q->n_value = 0; - q->n_desc = 0; - q->n_other = 0; - n = strlen(q->n_un.n_name); - if (n > maxlen) - maxlen = n; - } - if ((fd == -1) || (lseek(fd, 0L, 0) == -1) || - (read(fd, (char*)&buf, sizeof buf) != sizeof buf) || N_BADMAG(buf)) - return (-1); - sa = N_SYMOFF(buf); - ss = sa + buf.a_syms; - n = buf.a_syms; - while (n) { - m = MIN(n, sizeof (space)); - lseek(fd, sa, 0); - if (read(fd, (char *)space, m) != m) - break; - sa += m; - n -= m; - for (q = space; (m -= sizeof (struct nlist)) >= 0; q++) { - soff = q->n_un.n_strx; - if (soff == 0 || q->n_type & N_STAB) - continue; - if ((soff + maxlen + 1) >= stroff) { - /* - * Read strings into local cache. - * Assumes (maxlen < sizeof (strs)). - */ - lseek(fd, ss+soff, 0); - read(fd, strs, sizeof strs); - stroff = soff + sizeof (strs); - } - for (p = list; - p->n_un.n_name && p->n_un.n_name[0]; - p++) { - if (p->n_type != 0) - continue; - s1 = p->n_un.n_name; - s2 = &strs[soff-(stroff-sizeof (strs))]; - while (*s1) { - if (*s1++ != *s2++) - goto cont; - } - if (*s2) - goto cont; - p->n_value = q->n_value; - p->n_type = q->n_type; - p->n_desc = q->n_desc; - p->n_other = q->n_other; - if (--nreq == 0) - goto alldone; - break; -cont: ; - } - } - } -alldone: - return (nreq); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_perror.c b/usr/src/lib/libbc/libc/gen/common/_perror.c deleted file mode 100644 index ea9cac5cb5..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_perror.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 4.2 83/06/30 */ -/* - * Print the error indicated - * in the cerror cell. - */ -#include <sys/types.h> -#include <sys/uio.h> - -extern int errno; -extern int sys_nerr; -extern char *sys_errlist[]; -extern int strlen(); -extern int writev(); - -void -_perror(s) - char *s; -{ - struct iovec iov[4]; - register struct iovec *v = iov; - - if (s && *s) { - v->iov_base = s; - v->iov_len = strlen(s); - v++; - v->iov_base = ": "; - v->iov_len = 2; - v++; - } - v->iov_base = - (unsigned)errno < sys_nerr ? sys_errlist[errno] : "Unknown error"; - v->iov_len = strlen(v->iov_base); - v++; - v->iov_base = "\n"; - v->iov_len = 1; - writev(2, iov, (v - iov) + 1); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_psignal.c b/usr/src/lib/libbc/libc/gen/common/_psignal.c deleted file mode 100644 index d28a9be0ea..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_psignal.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 4.1 83/02/10 */ - -/* - * Print the name of the signal indicated - * along with the supplied message. - */ -#include <sys/types.h> -#include <sys/uio.h> -#include <signal.h> - -extern char *sys_siglist[]; -extern int strlen(); -extern int writev(); - -void -_psignal(sig, s) - unsigned sig; - char *s; -{ - struct iovec iov[4]; - register struct iovec *v = iov; - - if (s && *s) { - v->iov_base = s; - v->iov_len = strlen(s); - v++; - v->iov_base = ": "; - v->iov_len = 2; - v++; - } - v->iov_base = - (unsigned)sig < NSIG ? sys_siglist[sig] : "Unknown signal"; - v->iov_len = strlen(v->iov_base); - v++; - v->iov_base = "\n"; - v->iov_len = 1; - writev(2, iov, (v - iov) + 1); -} diff --git a/usr/src/lib/libbc/libc/gen/common/_small_power.c b/usr/src/lib/libbc/libc/gen/common/_small_power.c deleted file mode 100644 index 1cb4f32a61..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_small_power.c +++ /dev/null @@ -1,878 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -#include "base_conversion.h" - -unsigned short _max_tiny_powers_ten = 4; -unsigned short _tiny_powers_ten[] = {1, /* begin powers of 10 in - * base 65536 */ - /* 10**1 = */ 10, /* * 65536**0 */ - /* 10**2 = */ 100, /* * 65536**1 */ - /* 10**3 = */ 1000, /* * 65536**1 */ -0 } ; - -unsigned short _start_tiny_powers_ten[] = { - 0, 1, 2, 3, 4, -0}; /* end _start_tiny_powers_ten */ - -unsigned short _leading_zeros_tiny_powers_ten[] = { - 0, 0, 0, 0, -0}; /* end _leading_zeros_tiny_powers_ten */ - -unsigned short _max_tiny_powers_two = 16; -unsigned short _tiny_powers_two[] = {1, /* begin powers of 2 in - * base 10000 */ - /* 2**1 = */ 2, /* * 10000**0 */ - /* 2**2 = */ 4, /* * 10000**0 */ - /* 2**3 = */ 8, /* * 10000**0 */ - /* 2**4 = */ 16, /* * 10000**0 */ - /* 2**5 = */ 32, /* * 10000**0 */ - /* 2**6 = */ 64, /* * 10000**0 */ - /* 2**7 = */ 128, /* * 10000**0 */ - /* 2**8 = */ 256, /* * 10000**0 */ - /* 2**9 = */ 512, /* * 10000**0 */ - /* 2**10 = */ 1024, /* * 10000**0 */ - /* 2**11 = */ 2048, /* * 10000**0 */ - /* 2**12 = */ 4096, /* * 10000**0 */ - /* 2**13 = */ 8192, /* * 10000**0 */ - /* 2**14 = */ 6384, 1, /* * 10000**1 */ - /* 2**15 = */ 2768, 3, /* * 10000**1 */ -0}; - -unsigned short _start_tiny_powers_two[] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 18, -0}; /* end _start_tiny_powers_two */ - -unsigned short _max_small_powers_ten = 90; -unsigned short _small_powers_ten[] = {1, /* begin powers of 10000 in - * base 65536 */ - /* 10000**1 = */ 10000, /* * 65536**0 */ - /* 10000**2 = */ 57600, 1525, /* * 65536**1 */ - /* 10000**3 = */ 4096, 54437, 232, /* * 65536**2 */ - /* 10000**4 = 65536**1 * */ 28609, 34546, 35, /* * 65536**3 */ - /* 10000**5 = 65536**1 * */ 25360, 24109, 27591, 5, /* * 65536**4 */ - /* 10000**6 = 65536**1 * */ 41216, 52461, 7118, 54210, /* * 65536**4 */ - /* 10000**7 = 65536**1 * */ 4096, 609, 15909, 52830, 8271, /* * 65536**5 */ - /* 10000**8 = 65536**2 * */ 61313, 34220, 16731, 11629, 1262, /* * 65536**6 */ - /* 10000**9 = 65536**2 * */ 40720, 45899, 1813, 31689, 38862, 192, /* * 65536**7 */ - /* 10000**10 = 65536**2 * */ 24832, 47605, 49067, 23716, 61891, 25385, 29, /* * 65536**8 */ - /* 10000**11 = 65536**2 * */ 4096, 285, 9232, 58239, 57170, 38515, 31729, 4, - /* * 65536**9 */ - /* 10000**12 = 65536**3 * */ 32577, 45355, 38512, 38358, 3651, 36101, 44841, /* * 65536**9 */ - /* 10000**13 = 65536**3 * */ 56080, 45850, 37384, 3668, 12301, 38269, 18196, 6842, - /* * 65536**10 */ - /* 10000**14 = 65536**3 * */ 8448, 18701, 29652, 51080, 65023, 27172, 37903, 3192, - 1044, /* * 65536**11 */ - /* 10000**15 = 65536**3 * */ 4096, 37081, 37989, 16940, 55138, 17665, 39458, 9751, - 20263, 159, /* * 65536**12 */ - /* 10000**16 = 65536**4 * */ 7937, 49002, 60772, 28216, 38893, 55975, 63988, 59711, - 20227, 24, /* * 65536**13 */ - /* 10000**17 = 65536**4 * */ 5904, 8539, 12149, 36793, 43681, 12958, 60573, 21267, - 35015, 46478, 3, /* * 65536**14 */ - /* 10000**18 = 65536**4 * */ 57600, 63028, 53094, 12749, 18174, 21993, 48265, 14922, - 59933, 4030, 37092, /* * 65536**14 */ - /* 10000**19 = 65536**4 * */ 4096, 29077, 42481, 30581, 10617, 59493, 46251, 1892, - 5557, 4505, 52391, 5659,/* * 65536**15 */ - /* 10000**20 = 65536**5 * */ 52929, 10084, 25506, 6346, 61348, 31525, 52689, 61296, - 27615, 15903, 40426, 863, /* * 65536**16 */ - /* 10000**21 = 65536**5 * */ 21264, 53708, 60962, 25043, 64008, 31200, 50906, 9831, - 56185, 43877, 36378, 50952, 131, /* * 65536**17 */ - /* 10000**22 = 65536**5 * */ 41216, 15724, 12323, 26246, 59245, 58406, 46648, 13767, - 11372, 15053, 61895, 48686, 7054, 20, /* * 65536**18 */ - /* 10000**23 = 65536**5 * */ 4096, 25425, 24719, 55736, 8564, 12208, 3664, 51518, - 17140, 61079, 30312, 2500, 30693, 4468, 3, /* * 65536**19 */ - /* 10000**24 = 65536**6 * */ 36481, 57623, 45627, 58488, 53274, 7238, 2063, 31221, - 62631, 25319, 35409, 25293, 54667, 30681, /* * 65536**19 */ - /* 10000**25 = 65536**6 * */ 36624, 43054, 17160, 43698, 6780, 36385, 52800, 62346, - 52747, 33988, 2855, 31979, 38083, 44325, 4681, /* * 65536**20 */ - /* 10000**26 = 65536**6 * */ 24832, 39604, 33321, 54106, 42443, 60698, 47535, 24088, - 45785, 18352, 47026, 40291, 5183, 35843, 24059, 714, - /* * 65536**21 */ - /* 10000**27 = 65536**6 * */ 4096, 9741, 31019, 65404, 27119, 57580, 26653, 42453, - 19179, 26186, 42000, 1847, 62708, 14406, 12813, 247, - 109, /* * 65536**22 */ - /* 10000**28 = 65536**7 * */ 24129, 9598, 60989, 12011, 4842, 3874, 57395, 38141, - 46606, 49307, 60792, 31833, 21440, 9318, 47123, 41461, - 16, /* * 65536**23 */ - /* 10000**29 = 65536**7 * */ 51984, 38977, 13448, 57354, 56264, 8962, 51839, 64773, - 39323, 49783, 15587, 30924, 36601, 56615, 27581, 36454, - 35254, 2, /* * 65536**24 */ - /* 10000**30 = 65536**7 * */ 8448, 35340, 6075, 36516, 22191, 40873, 1607, 45622, - 23883, 24544, 32988, 43530, 61694, 55616, 43150, 32976, - 27418, 25379, /* * 65536**24 */ - /* 10000**31 = 65536**7 * */ 4096, 31177, 3520, 59871, 10675, 50890, 19916, 24149, - 23777, 11324, 41057, 14921, 56274, 30917, 19462, 54968, - 47943, 38791, 3872, /* * 65536**25 */ - /* 10000**32 = 65536**8 * */ 15873, 11925, 39177, 991, 14589, 3861, 58415, 9076, - 62956, 54223, 56328, 50180, 45274, 48333, 32537, 42547, - 9731, 59679, 590, /* * 65536**26 */ - /* 10000**33 = 65536**8 * */ 1808, 42438, 63147, 20041, 7015, 11522, 28221, 1553, - 22569, 60278, 6353, 64979, 24968, 8908, 56671, 15252, - 61068, 20668, 10866, 90,/* * 65536**27 */ - /* 10000**34 = 65536**8 * */ 57600, 34675, 37115, 10547, 29538, 8782, 13742, 2274, - 49789, 48851, 34813, 1529, 63291, 20385, 21567, 26375, - 17879, 54310, 4465, 49690, 13, /* * 65536**28 */ - /* 10000**35 = 65536**8 * */ 4096, 7813, 24923, 28239, 10857, 6267, 57884, 1104, - 13355, 12253, 10222, 25424, 29081, 42697, 59670, 36426, - 11816, 5896, 28271, 6729, 6510, 2, /* * 65536**29 */ - /* 10000**36 = 65536**9 * */ 11713, 63320, 64714, 46692, 19240, 27004, 38784, 53336, - 45253, 51245, 27415, 30647, 7397, 1235, 20017, 4150, - 44939, 54131, 54377, 23778, 20993, /* * 65536**29 */ - /* 10000**37 = 65536**9 * */ 17168, 58491, 47197, 51410, 58964, 34615, 2072, 33950, - 12058, 30921, 20731, 27847, 50068, 30360, 23244, 18766, - 10281, 55033, 26067, 23689, 21820, 3203, /* * 65536**30 */ - /* 10000**38 = 65536**9 * */ 41216, 3819, 54189, 42817, 20452, 63381, 15905, 23836, - 64476, 12991, 24350, 10699, 54745, 44887, 53976, 33978, - 52415, 25776, 41725, 46873, 34270, 51761, 488, /* * 65536**31 */ - /* 10000**39 = 65536**9 * */ 4096, 54337, 38934, 31580, 54213, 14464, 3799, 7995, - 20469, 27486, 35742, 38963, 29424, 22289, 12353, 49612, - 63792, 14909, 51757, 22894, 19408, 11901, 38234, 74, - /* * 65536**32 */ - /* 10000**40 = 65536**10 * */ 11649, 64451, 53492, 21026, 10320, 46863, 62195, 22291, - 5139, 56386, 23933, 54841, 6553, 63577, 14364, 146, - 5334, 34483, 30649, 31397, 65121, 4791, 24938, 11, - /* * 65536**33 */ - /* 10000**41 = 65536**10 * */ 32528, 30753, 25002, 28674, 49544, 49174, 20510, 31554, - 13177, 54576, 1131, 8404, 2368, 6264, 60325, 20399, - 59254, 45917, 48925, 57236, 49094, 13120, 16251, 48269, - 1, /* * 65536**34 */ - /* 10000**42 = 65536**10 * */ 24832, 40051, 4852, 23815, 57751, 30951, 45359, 52825, - 47454, 43738, 46135, 23020, 22786, 53481, 57611, 51172, - 32136, 33825, 30766, 41577, 18557, 4419, 48258, 19839, - 17365, /* * 65536**34 */ - /* 10000**43 = 65536**10 * */ 4096, 23293, 29471, 58452, 10401, 57820, 20066, 36761, - 1884, 65513, 48769, 44607, 60376, 39716, 56720, 23702, - 44800, 23607, 39177, 14310, 43928, 21567, 39106, 19891, - 48163, 2649, /* * 65536**35 */ - /* 10000**44 = 65536**11 * */ 15681, 63698, 8912, 13287, 42995, 63126, 21637, 36777, - 32431, 46620, 39425, 49174, 21052, 57516, 50478, 65056, - 16163, 64930, 40889, 59911, 63262, 9978, 14207, 8971, - 20805, 404, /* * 65536**36 */ - /* 10000**45 = 65536**11 * */ 47888, 38008, 759, 29888, 35867, 23808, 45296, 50805, - 43483, 47380, 58073, 29407, 25871, 19276, 30504, 57366, - 28150, 37314, 20803, 51663, 10133, 43861, 55010, 58919, - 40104, 45478, 61, /* * 65536**37 */ - /* 10000**46 = 65536**11 * */ 8448, 44043, 59159, 35955, 61568, 58720, 44336, 21839, - 6392, 46891, 22733, 18829, 43895, 22571, 38397, 28046, - 31633, 47847, 24429, 12886, 19227, 44634, 63044, 29753, - 34206, 31815, 27115, 9, /* * 65536**38 */ - /* 10000**47 = 65536**11 * */ 4096, 29369, 3248, 28531, 40302, 6834, 17920, 30813, - 25732, 895, 58307, 8540, 58281, 10713, 63556, 37314, - 57543, 62026, 44628, 19951, 54878, 42773, 56026, 6179, - 32156, 43475, 32422, 28601, 1, /* * 65536**39 */ - /* 10000**48 = 65536**12 * */ 23809, 44161, 32287, 43489, 57637, 25618, 47998, 30365, - 41030, 61880, 15488, 65191, 53068, 59042, 53249, 29613, - 36076, 54840, 25225, 50116, 50437, 64798, 63636, 41326, - 54618, 20041, 15843, 14364, /* * 65536**39 */ - /* 10000**49 = 65536**12 * */ 63248, 32064, 46402, 63566, 53051, 8570, 63781, 29035, - 49273, 15348, 27874, 25771, 44955, 14273, 19009, 46477, - 54374, 256, 10304, 10057, 12591, 33264, 15327, 65230, - 9281, 9246, 32546, 53041, 2191, /* * 65536**40 */ - /* 10000**50 = 65536**12 * */ 57600, 47538, 30012, 33416, 5779, 52543, 14955, 35252, - 34782, 2206, 17734, 26701, 42508, 64987, 37777, 57124, - 60435, 12392, 17447, 39348, 16878, 46721, 51907, 22530, - 20977, 55656, 9634, 32118, 29069, 334, /* * 65536**41 */ - /* 10000**51 = 65536**12 * */ 4096, 56181, 37909, 62051, 57882, 28769, 4865, 4138, - 25827, 45211, 65456, 19041, 17578, 21510, 30412, 33988, - 51260, 645, 15059, 4518, 30804, 6431, 32009, 60688, - 58237, 31488, 10572, 55070, 42740, 2099, 51, /* * 65536**42 */ - /* 10000**52 = 65536**13 * */ 36033, 38348, 20936, 15516, 61328, 26677, 27526, 58791, - 46612, 58866, 37907, 15353, 13530, 36242, 14944, 48130, - 35293, 53906, 27993, 21489, 23884, 13157, 21524, 26364, - 53942, 15236, 2605, 48147, 25001, 51568, 7, /* * 65536**43 */ - /* 10000**53 = 65536**13 * */ 13072, 34362, 43867, 39482, 62015, 47837, 12870, 56280, - 36938, 22760, 18758, 50472, 36038, 7984, 23450, 5896, - 25984, 31785, 33969, 1727, 30095, 42892, 21783, 57492, - 62742, 62566, 34532, 42941, 63042, 46566, 12332, 1, - /* * 65536**44 */ - /* 10000**54 = 65536**13 * */ 41216, 16746, 42795, 37829, 54392, 32198, 60131, 44331, - 27691, 64644, 19440, 30126, 5237, 22651, 13410, 46714, - 56195, 4364, 21762, 39215, 8951, 57008, 60416, 41531, - 52644, 62917, 20362, 23397, 35768, 36339, 53889, 11881, - /* * 65536**44 */ - /* 10000**55 = 65536**13 * */ 4096, 21809, 2475, 22738, 42508, 9931, 22113, 33671, - 27164, 62657, 30087, 59510, 11332, 18383, 16800, 1438, - 51464, 1598, 41146, 51432, 59343, 49237, 57850, 17586, - 61185, 32432, 9248, 9587, 53618, 63873, 58552, 1454, - 1813, /* * 65536**45 */ - /* 10000**56 = 65536**14 * */ 52353, 46255, 35993, 16973, 29446, 13051, 54942, 63953, - 49984, 3784, 37711, 17336, 3249, 34037, 30179, 51547, - 62604, 25235, 65286, 9367, 7087, 21241, 35739, 8587, - 57208, 13652, 57779, 31446, 24325, 31122, 65478, 42285, - 276, /* * 65536**46 */ - /* 10000**57 = 65536**14 * */ 28432, 4900, 13346, 62788, 9341, 32317, 33703, 38095, - 6686, 33355, 16433, 23034, 52325, 42047, 1913, 33965, - 47993, 45952, 59754, 29017, 27013, 8905, 25433, 23293, - 17566, 17241, 26707, 27088, 50702, 58783, 14572, 21719, - 13940, 42, /* * 65536**47 */ - /* 10000**58 = 65536**14 * */ 24832, 48946, 29451, 47156, 30780, 13409, 48819, 59910, - 19092, 38316, 36337, 49003, 14090, 64544, 65439, 42739, - 15054, 54427, 55299, 51245, 60571, 56233, 51678, 18936, - 27074, 53000, 13430, 23787, 37637, 45352, 42441, 5919, - 8242, 28911, 6, /* * 65536**48 */ - /* 10000**59 = 65536**14 * */ 4096, 40941, 64220, 32973, 50139, 8040, 14382, 42873, - 22773, 39457, 44262, 22872, 5077, 43622, 22888, 39729, - 10329, 61353, 5536, 32454, 34107, 40362, 37220, 34381, - 13673, 14499, 24823, 41905, 381, 16623, 5784, 17468, - 42151, 31961, 64411, /* * 65536**48 */ - /* 10000**60 = 65536**15 * */ 7233, 18983, 28183, 44631, 60514, 35242, 61218, 64477, - 46754, 61412, 6113, 48626, 13158, 34944, 14260, 11326, - 49080, 56977, 6572, 25608, 54516, 27214, 13823, 27150, - 26454, 47380, 16603, 15306, 30762, 39784, 27442, 50649, - 62895, 27068, 9828, /* * 65536**49 */ - /* 10000**61 = 65536**15 * */ 43792, 38847, 28096, 14140, 52922, 42161, 13601, 36173, - 16014, 54814, 59818, 49348, 56667, 4055, 64532, 15967, - 2624, 7505, 61622, 31850, 35459, 42846, 18728, 51997, - 40846, 44292, 34541, 35973, 61887, 41173, 26838, 31979, - 8736, 25917, 45666, 1499, /* * 65536**50 */ - /* 10000**62 = 65536**15 * */ 8448, 44810, 13095, 43135, 18957, 24987, 29233, 38891, - 41071, 64875, 41291, 3047, 53274, 57398, 53162, 34150, - 28036, 11680, 51673, 4442, 45100, 56578, 50185, 10233, - 47582, 33944, 42038, 8166, 19041, 42291, 16362, 43951, - 5391, 41989, 9106, 54760, 228, /* * 65536**51 */ - /* 10000**63 = 65536**15 * */ 4096, 31657, 15909, 59582, 46469, 49660, 43252, 23836, - 1822, 15403, 43099, 2060, 63857, 23840, 726, 16, - 2203, 19126, 45958, 60012, 47461, 14593, 49481, 35961, - 30201, 36316, 37275, 8558, 29166, 9097, 48597, 28080, - 46114, 1670, 36903, 48109, 60131, 34, /* * 65536**52 */ - /* 10000**64 = 65536**16 * */ 31745, 38958, 34651, 48851, 40818, 55513, 12167, 4629, - 20678, 27614, 28272, 53066, 55311, 54677, 29038, 9906, - 26288, 44486, 13860, 7445, 54106, 15426, 21518, 25599, - 29632, 52309, 61207, 26105, 10482, 21948, 51191, 32988, - 60892, 62574, 61390, 24540, 21495, 5, /* * 65536**53 */ - /* 10000**65 = 65536**16 * */ 59152, 38859, 27112, 9943, 29246, 46308, 43654, 23440, - 14626, 39987, 1909, 19322, 59793, 11591, 63863, 39534, - 16615, 5643, 63684, 3218, 61456, 62047, 27665, 9667, - 35650, 51705, 37277, 29451, 31919, 1535, 11653, 45123, - 30057, 11563, 33836, 42583, 61200, 53279, /* * 65536**53 */ - /* 10000**66 = 65536**16 * */ 57600, 36081, 3497, 16025, 39885, 7086, 11770, 49925, - 52760, 37095, 25125, 20163, 48020, 51475, 48984, 36592, - 22272, 6039, 27549, 11541, 29419, 50065, 32011, 8621, - 51171, 41935, 9121, 62440, 34173, 19446, 7226, 16418, - 28789, 29082, 64932, 47770, 31329, 57194, 8129, /* * 65536**54 */ - /* 10000**67 = 65536**16 * */ 4096, 43109, 44817, 15013, 349, 21670, 63961, 64083, - 42817, 24290, 56172, 45097, 20804, 37583, 31790, 39986, - 34255, 34742, 43113, 5307, 657, 24985, 39815, 35044, - 6227, 58480, 55822, 39919, 34823, 19902, 42295, 13422, - 58393, 41160, 59285, 18003, 35209, 12108, 34087, 1240, - /* * 65536**55 */ - /* 10000**68 = 65536**17 * */ 60353, 41409, 59398, 18882, 38037, 47482, 28751, 33090, - 30117, 14650, 25355, 35617, 49750, 56134, 29714, 64965, - 18890, 39493, 57954, 17209, 26868, 22612, 25083, 16147, - 23222, 58811, 18741, 43323, 58017, 49228, 8725, 6288, - 42830, 17624, 11654, 33355, 40380, 19111, 18897, 189, - /* * 65536**56 */ - /* 10000**69 = 65536**17 * */ 8976, 42761, 33550, 19847, 1937, 17484, 10813, 13123, - 37129, 31635, 58987, 51244, 21658, 31751, 8341, 61702, - 35160, 12946, 11178, 1307, 50562, 24899, 27178, 58659, - 28415, 59015, 51549, 39899, 51938, 47956, 29095, 32307, - 23199, 20231, 19681, 39074, 37793, 13185, 32628, 57875, - 28, /* * 65536**57 */ - /* 10000**70 = 65536**17 * */ 41216, 54505, 27740, 32111, 39908, 55783, 63803, 28577, - 30562, 13393, 50827, 23016, 56875, 56920, 53052, 65368, - 8774, 31765, 43095, 30041, 9959, 26451, 6007, 46947, - 60390, 2655, 58365, 14697, 13288, 41013, 43013, 47495, - 63025, 3907, 8479, 17371, 55386, 62870, 43803, 6562, - 26687, 4, /* * 65536**58 */ - /* 10000**71 = 65536**17 * */ 4096, 58913, 59964, 53368, 36195, 59193, 45551, 42775, - 29992, 44615, 40363, 5323, 32104, 28518, 14765, 32031, - 62806, 63882, 55646, 65087, 45399, 8223, 43060, 36548, - 58459, 17134, 52325, 47193, 40770, 7739, 23490, 17171, - 63071, 20160, 52548, 40893, 17914, 21603, 62505, 25147, - 8409, 44072, /* * 65536**58 */ - /* 10000**72 = 65536**18 * */ 27521, 60125, 29501, 2815, 14371, 43832, 3478, 33791, - 51024, 583, 20927, 45484, 37762, 1743, 37821, 33399, - 50191, 3571, 40475, 32059, 54783, 29734, 57834, 14456, - 37816, 13190, 13248, 7745, 63741, 20156, 9264, 59692, - 20887, 15428, 58914, 36351, 26077, 36464, 17905, 11149, - 57219, 6724, /* * 65536**59 */ - /* 10000**73 = 65536**18 * */ 24336, 26935, 41638, 39557, 55517, 17424, 52608, 6914, - 47396, 5081, 13641, 23353, 8508, 3186, 2010, 24315, - 40408, 538, 209, 59600, 19467, 11527, 54873, 61944, - 19485, 47338, 33756, 54005, 8045, 46526, 40707, 19525, - 15876, 11443, 39250, 56333, 7802, 1675, 11212, 15996, - 62421, 8794, 1026, /* * 65536**60 */ - /* 10000**74 = 65536**18 * */ 24832, 753, 33902, 1057, 20580, 53783, 25186, 7547, - 4703, 26832, 30359, 27313, 17835, 10802, 46470, 11746, - 54270, 12213, 58466, 15647, 37174, 60682, 64366, 2100, - 20924, 16445, 56823, 38510, 45568, 21163, 33003, 24467, - 34787, 6566, 6642, 54069, 40755, 39510, 53695, 53870, - 47576, 212, 37726, 156, /* * 65536**61 */ - /* 10000**75 = 65536**18 * */ 4096, 62685, 2386, 23877, 17121, 44724, 13358, 41907, - 41839, 16333, 31342, 46120, 30711, 19393, 51408, 26578, - 63712, 44712, 15207, 44489, 22195, 27848, 40203, 38301, - 49408, 23368, 35389, 19134, 14068, 21209, 59469, 29147, - 8645, 63772, 33033, 19013, 55402, 55210, 19580, 2273, - 42396, 30107, 34816, 58428, 23, /* * 65536**62 */ - /* 10000**76 = 65536**19 * */ 64321, 14460, 22716, 33611, 24948, 24456, 34854, 14570, - 20672, 29340, 27950, 15341, 13662, 18575, 39364, 48599, - 43129, 33302, 33952, 51892, 20922, 36425, 23750, 9940, - 51699, 64701, 45815, 42663, 17650, 19572, 40482, 12463, - 56039, 38290, 15104, 47093, 33189, 52392, 57531, 7962, - 4085, 37362, 31872, 42307, 3, /* * 65536**63 */ - /* 10000**77 = 65536**19 * */ 39696, 37398, 14430, 44858, 55112, 48990, 23283, 18790, - 21679, 64018, 58972, 60024, 45316, 23060, 33618, 46566, - 4999, 38165, 48601, 11132, 37006, 4104, 3094, 51048, - 43548, 46496, 63232, 63166, 18061, 32197, 7114, 52241, - 59101, 47238, 50898, 56144, 22881, 30280, 42986, 2538, - 22287, 65423, 24132, 39983, 36455, /* * 65536**63 */ - /* 10000**78 = 65536**19 * */ 8448, 37641, 60970, 53817, 34620, 26809, 53603, 11840, - 65315, 27659, 36840, 4774, 53255, 51266, 49374, 31849, - 58673, 34634, 847, 47288, 45442, 20110, 7634, 20568, - 1069, 54261, 35766, 33680, 2422, 59924, 38352, 23629, - 14323, 5530, 34632, 854, 32391, 27171, 13996, 24127, - 47987, 53048, 26430, 64082, 44868, 5562, /* * 65536**64 */ - /* 10000**79 = 65536**19 * */ 4096, 38041, 24335, 63207, 47059, 53042, 15146, 50163, - 20030, 38046, 26364, 35413, 5192, 45534, 65134, 58109, - 56587, 56728, 21140, 37889, 591, 42486, 59164, 29196, - 10770, 37619, 38327, 15953, 42355, 44721, 12471, 38572, - 37445, 55337, 28619, 25604, 31218, 2686, 44786, 34119, - 19089, 38938, 1406, 13025, 30322, 52318, 848, /* * 65536**65 */ - /* 10000**80 = 65536**20 * */ 39681, 20636, 44529, 51164, 44332, 14397, 19767, 29638, - 26576, 60013, 43014, 20891, 62200, 50179, 57762, 41042, - 9018, 55056, 29609, 17541, 55738, 53010, 6147, 28807, - 15003, 21212, 21224, 58802, 64334, 1815, 42543, 48717, - 55265, 2731, 60751, 35938, 60539, 52921, 16417, 54374, - 33536, 41237, 30182, 52451, 10738, 33839, 129, /* * 65536**66 */ - /* 10000**81 = 65536**20 * */ 55056, 58726, 41564, 7242, 42303, 59708, 15620, 29224, - 16042, 20903, 36389, 53331, 1011, 55875, 58888, 42381, - 8726, 58976, 6752, 40182, 64532, 53336, 5320, 40218, - 22491, 47793, 37668, 34246, 47596, 6344, 36101, 47403, - 57881, 55456, 57232, 55381, 39451, 16037, 10395, 55849, - 20584, 22605, 33012, 29997, 40035, 29270, 49979, 19, - /* * 65536**67 */ - /* 10000**82 = 65536**20 * */ 57600, 304, 19649, 9062, 61761, 53494, 36822, 17359, - 57867, 38143, 37317, 49120, 25593, 55754, 47565, 63209, - 38050, 2867, 26919, 19814, 58675, 37878, 58442, 51915, - 62120, 44919, 51900, 40147, 42793, 8414, 38680, 13620, - 3281, 3200, 2574, 39533, 57266, 9427, 12351, 59330, - 65481, 19476, 18617, 16765, 60689, 22332, 16930, 1018, - 3, /* * 65536**68 */ - /* 10000**83 = 65536**20 * */ 4096, 34133, 13118, 52246, 118, 44592, 46914, 56290, - 55304, 19309, 13836, 13374, 19415, 29153, 63755, 2537, - 7629, 36574, 34085, 28779, 9215, 56409, 41267, 48261, - 57713, 15734, 27270, 4383, 51582, 63841, 7811, 22094, - 44078, 18932, 50376, 17240, 12464, 37970, 41614, 4476, - 48877, 62535, 50731, 11752, 29198, 48108, 23919, 24503, - 30155, /* * 65536**68 */ - /* 10000**84 = 65536**21 * */ 19137, 47672, 9009, 8324, 13074, 40116, 18454, 55821, - 29382, 16450, 48671, 34408, 28834, 20240, 17296, 6483, - 50284, 2844, 26625, 10775, 23054, 63951, 9192, 27348, - 62406, 7104, 56113, 52348, 31694, 829, 19336, 53771, - 58757, 53192, 48006, 58694, 51853, 57729, 5261, 3195, - 12946, 5366, 21693, 18913, 50215, 56476, 60081, 22602, - 4601, /* * 65536**69 */ - /* 10000**85 = 65536**21 * */ 4880, 14056, 50810, 10654, 62486, 16138, 62281, 42703, - 30629, 9123, 42174, 23426, 52386, 29231, 13584, 17535, - 48797, 5048, 43202, 12878, 51532, 13229, 48286, 65210, - 30380, 8498, 11852, 52530, 15891, 37300, 28926, 55606, - 47964, 38789, 16916, 6909, 18124, 56824, 58936, 34770, - 26887, 53527, 6658, 61950, 16053, 43950, 50105, 61039, - 7176, 702, /* * 65536**70 */ - /* 10000**86 = 65536**21 * */ 41216, 51560, 1536, 51753, 41401, 39902, 23854, 6927, - 46788, 8561, 17232, 40771, 34326, 27433, 53868, 43272, - 57155, 24725, 7458, 8352, 12397, 46215, 58306, 24167, - 50590, 49979, 32208, 30768, 58751, 37048, 55323, 56989, - 56036, 55270, 17502, 17637, 34014, 45645, 3422, 40513, - 46633, 41590, 3591, 54744, 41788, 18033, 33986, 60877, - 7393, 8743, 107, /* * 65536**71 */ - /* 10000**87 = 65536**21 * */ 4096, 34577, 32443, 57978, 26984, 43149, 60584, 2087, - 19553, 27123, 27162, 13173, 54189, 1541, 43802, 59547, - 17146, 56929, 3804, 28274, 42698, 57555, 58795, 47664, - 31303, 20183, 43722, 58930, 49990, 13956, 46277, 62921, - 35895, 43462, 47313, 15294, 10851, 62486, 17172, 52506, - 47541, 15659, 2618, 18340, 30817, 46840, 58591, 11281, - 14681, 6104, 22758, 16, /* * 65536**72 */ - /* 10000**88 = 65536**22 * */ 2689, 32076, 53494, 37134, 5093, 31800, 38796, 36430, - 45015, 42954, 6784, 40362, 17308, 43147, 16587, 26910, - 46920, 37806, 18276, 17274, 19363, 35326, 5643, 37337, - 49432, 32423, 6959, 384, 41484, 22433, 5925, 18929, - 56261, 32247, 51731, 50253, 41431, 25214, 53724, 19867, - 31750, 33525, 30671, 22526, 18910, 25307, 31484, 11081, - 28224, 39939, 32400, 2, /* * 65536**73 */ - /* 10000**89 = 65536**22 * */ 20240, 27226, 40062, 21186, 14194, 20105, 57268, 56831, - 54310, 23924, 16794, 50347, 5582, 49153, 4967, 11715, - 31882, 55511, 51400, 55428, 39291, 23914, 8894, 12269, - 53185, 30950, 61251, 39973, 62714, 6601, 8879, 22936, - 51864, 41464, 39272, 7845, 64612, 29329, 45255, 38581, - 46647, 38204, 6635, 17448, 32077, 38389, 8917, 58964, - 43674, 17922, 61646, 24943, /* * 65536**73 */ -0}; /* end powers of 10000 in base 65536 */ - -unsigned short _start_small_powers_ten[] = { - 0, 1, 2, 4, 7, 10, 14, 18, - 23, 28, 34, 41, 49, 56, 64, 73, - 83, 93, 104, 115, 127, 139, 152, 166, - 181, 195, 210, 226, 243, 260, 278, 296, - 315, 334, 354, 375, 397, 418, 440, 463, - 487, 511, 536, 561, 587, 613, 640, 668, - 697, 725, 754, 784, 815, 846, 878, 910, - 943, 976, 1010, 1045, 1080, 1115, 1151, 1188, - 1226, 1264, 1302, 1341, 1381, 1421, 1462, 1504, - 1546, 1588, 1631, 1675, 1720, 1765, 1810, 1856, - 1903, 1950, 1998, 2047, 2096, 2145, 2195, 2246, - 2298, 2350, 2402, -0}; /* end _start_small_powers_ten */ - -unsigned short _leading_zeros_small_powers_ten[] = { - 0, 0, 0, 0, 1, 1, 1, 1, - 2, 2, 2, 2, 3, 3, 3, 3, - 4, 4, 4, 4, 5, 5, 5, 5, - 6, 6, 6, 6, 7, 7, 7, 7, - 8, 8, 8, 8, 9, 9, 9, 9, - 10, 10, 10, 10, 11, 11, 11, 11, - 12, 12, 12, 12, 13, 13, 13, 13, - 14, 14, 14, 14, 15, 15, 15, 15, - 16, 16, 16, 16, 17, 17, 17, 17, - 18, 18, 18, 18, 19, 19, 19, 19, - 20, 20, 20, 20, 21, 21, 21, 21, - 22, 22, -0}; /* end _leading_zeros_small_powers_ten */ - -unsigned short _max_small_powers_two = 70; -unsigned short _small_powers_two[] = {1, /* begin powers of 65536 in - * base 10000 */ - /* 65536**1 = */ 5536, 6, /* * 10000**1 */ - /* 65536**2 = */ 7296, 9496, 42, /* * 10000**2 */ - /* 65536**3 = */ 656, 7671, 4749, 281, /* * 10000**3 */ - /* 65536**4 = */ 1616, 955, 737, 6744, 1844, /* * 10000**4 */ - /* 65536**5 = */ 6176, 7470, 6291, 9614, 2581, 2089, 1, /* * 10000**6 */ - /* 65536**6 = */ 336, 4395, 5935, 4337, 1426, 1625, 9228, 7, - /* * 10000**7 */ - /* 65536**7 = */ 96, 2922, 4963, 8530, 2762, 5348, 6858, 9229, - 51, /* * 10000**8 */ - /* 65536**8 = */ 1456, 6821, 4317, 4607, 6337, 4634, 938, 6692, - 2823, 340, /* * 10000**9 */ - /* 65536**9 = */ 416, 598, 3615, 2648, 1827, 5357, 3141, 3062, - 1985, 745, 2230, /* * 10000**10 */ - /* 65536**10 = */ 2976, 3254, 6559, 3019, 1628, 8327, 3684, 1820, - 9029, 7330, 163, 4615, 1, /* * 10000**12 */ - /* 65536**11 = */ 5136, 3647, 1951, 6171, 2397, 8943, 9196, 9668, - 6473, 8053, 411, 9713, 5780, 9, /* * 10000**13 */ - /* 65536**12 = */ 2896, 3451, 4640, 5444, 235, 4161, 7666, 2320, - 7894, 3835, 8076, 3866, 1735, 7710, 62, /* * 10000**14 */ - /* 65536**13 = */ 2256, 3715, 9658, 8394, 6640, 6839, 6245, 3762, - 6393, 2295, 3874, 5105, 301, 3933, 3761, 411, - /* * 10000**15 */ - /* 65536**14 = */ 9216, 1024, 1036, 2481, 4057, 4225, 7144, 7363, - 6306, 7019, 1508, 6670, 9794, 5063, 6671, 9946, - 2695, /* * 10000**16 */ - /* 65536**15 = */ 9776, 9261, 2012, 1606, 5812, 6189, 6875, 8389, - 8274, 8515, 4291, 5007, 3297, 2958, 3843, 4778, - 4706, 7668, 1, /* * 10000**18 */ - /* 65536**16 = */ 9936, 2963, 9131, 4007, 5758, 394, 564, 6564, - 9846, 3269, 785, 6879, 5008, 7098, 4235, 6195, - 3731, 892, 5792, 11, /* * 10000**19 */ - /* 65536**17 = */ 5696, 8284, 8640, 2594, 2554, 8922, 4889, 2000, - 474, 1715, 7190, 7290, 9370, 7352, 1480, 3279, - 5418, 2567, 360, 8855, 75, /* * 10000**20 */ - /* 65536**18 = */ 3056, 7553, 5333, 7012, 5949, 8931, 3976, 4046, - 7174, 7347, 5079, 4561, 100, 2084, 1468, 2248, - 5538, 6421, 9786, 3640, 3232, 497, /* * 10000**21 */ - /* 65536**19 = */ 8016, 3435, 2989, 3387, 9621, 1007, 9670, 4718, - 1782, 10, 5498, 2986, 3494, 7682, 505, 4550, - 3101, 2951, 7380, 5177, 6213, 2575, 3259, /* * 10000**22 */ - /* 65536**20 = */ 6576, 8693, 9620, 22, 4055, 7806, 9725, 2221, - 6078, 7041, 6994, 6527, 2356, 452, 6027, 2114, - 6955, 7061, 5021, 8239, 9100, 5920, 8703, 1359, - 2, /* * 10000**24 */ - /* 65536**21 = */ 4736, 7544, 3294, 4843, 8630, 590, 8760, 9194, - 2369, 8810, 4931, 9312, 5595, 7716, 8435, 2602, - 6738, 5277, 2535, 4014, 1598, 2763, 8611, 463, - 9984, 13, /* * 10000**25 */ - /* 65536**22 = */ 8496, 4621, 5027, 2440, 7421, 2800, 9232, 5393, - 5043, 7691, 5754, 3553, 4950, 2449, 6731, 9956, - 8625, 7631, 8347, 8120, 2835, 6443, 8604, 9602, - 4463, 7399, 91, /* * 10000**26 */ - /* 65536**23 = */ 3856, 7535, 9761, 787, 8650, 9435, 6706, 6152, - 3397, 429, 4551, 7122, 6488, 106, 8869, 529, - 3252, 1747, 9008, 7027, 7780, 7032, 3970, 3063, - 101, 119, 2269, 601, /* * 10000**27 */ - /* 65536**24 = */ 6816, 9030, 6279, 806, 1564, 8849, 6254, 1426, - 6114, 7210, 7149, 7217, 4245, 9340, 9482, 6667, - 6544, 2704, 9739, 507, 6138, 143, 4010, 2790, - 9212, 9447, 1963, 2006, 3940, /* * 10000**28 */ - /* 65536**25 = */ 3376, 4749, 9727, 3171, 3590, 8314, 137, 5328, - 6453, 4629, 4119, 168, 7622, 4064, 3565, 659, - 1283, 2235, 2829, 579, 3297, 1874, 301, 1720, - 5919, 8965, 9085, 8086, 4987, 5822, 2, /* * 10000**30 */ - /* 65536**26 = */ 9536, 2588, 9797, 8405, 5027, 9833, 2920, 6711, - 8725, 8437, 3124, 7045, 6495, 8255, 2478, 1590, - 7009, 1368, 5992, 3885, 5988, 6071, 8619, 3893, - 8856, 9031, 3316, 3641, 1030, 3280, 9230, 16, - /* * 10000**31 */ - /* 65536**27 = */ 1296, 9663, 3158, 4287, 4561, 8438, 9564, 1238, - 5583, 4416, 9762, 1598, 2492, 2250, 2312, 8485, - 2245, 9183, 681, 6630, 5032, 8301, 4574, 8137, - 2334, 3657, 6567, 8313, 5943, 4832, 8776, 9067, - 110, /* * 10000**32 */ - /* 65536**28 = */ 4656, 2861, 6016, 3534, 7793, 2661, 1606, 6252, - 5607, 3565, 1376, 507, 6191, 2332, 3979, 8113, - 3928, 1806, 199, 8149, 602, 7318, 6068, 6413, - 4353, 453, 8880, 3807, 4932, 8905, 5606, 2429, - 8387, 726, /* * 10000**33 */ - /* 65536**29 = */ 5616, 9009, 3328, 3652, 5212, 2370, 8260, 1598, - 1326, 2590, 903, 5772, 6699, 525, 3031, 9646, - 8579, 3763, 3502, 4169, 6077, 6398, 407, 2140, - 240, 6340, 2651, 3748, 8507, 404, 3179, 3689, - 6354, 4102, 4763, /* * 10000**34 */ - /* 65536**30 = */ 176, 629, 2853, 9288, 7567, 4479, 2895, 662, - 1214, 6931, 5982, 9711, 3491, 306, 3061, 120, - 6562, 8197, 1738, 2537, 9596, 9156, 5085, 9711, - 2664, 9814, 7485, 6305, 9316, 2297, 1597, 3138, - 9922, 315, 4855, 1217, 3, /* * 10000**36 */ - /* 65536**31 = */ 4336, 3297, 8330, 7065, 1783, 5341, 6078, 3807, - 5044, 7972, 1775, 9304, 9821, 6900, 7703, 4380, - 8020, 1596, 5292, 6227, 83, 506, 571, 3427, - 1549, 7769, 1278, 3540, 4701, 7249, 6051, 2435, - 8758, 8866, 9350, 9129, 4586, 20, /* * 10000**37 */ - /* 65536**32 = */ 4096, 608, 6490, 6433, 6994, 9465, 2811, 5388, - 8537, 6050, 8648, 8581, 31, 2769, 9034, 8166, - 7429, 8018, 6976, 7354, 300, 1764, 4372, 5614, - 7723, 9337, 5923, 5820, 7936, 1274, 5846, 9820, - 249, 9574, 9709, 9425, 7929, 780, 134, /* * 10000**38 */ - /* 65536**33 = */ 5456, 2731, 2627, 5621, 947, 4080, 3730, 6396, - 6144, 8751, 4982, 1095, 7858, 9392, 370, 6183, - 466, 6340, 1687, 7467, 8999, 7474, 4952, 7757, - 1322, 249, 924, 8343, 1841, 4877, 1810, 1833, - 2824, 3302, 1768, 435, 6718, 49, 6941, 878, - /* * 10000**39 */ - /* 65536**34 = */ 4416, 4572, 973, 5074, 9431, 3089, 6019, 2703, - 5103, 5805, 7706, 4575, 9067, 5610, 9876, 1518, - 297, 1298, 782, 8372, 7400, 5044, 3259, 5210, - 9431, 7132, 6896, 2903, 6453, 1142, 2123, 9353, - 5677, 8380, 9289, 9748, 3699, 5291, 5701, 6096, - 5758, /* * 10000**40 */ - /* 65536**35 = */ 6976, 9532, 6493, 6043, 3269, 2514, 1434, 3256, - 7926, 9924, 8462, 7705, 4899, 6384, 307, 8375, - 4146, 7675, 7658, 2517, 1267, 2086, 4885, 3921, - 4162, 4562, 3002, 6206, 2837, 4404, 416, 2122, - 9169, 8890, 8826, 5809, 1554, 5224, 5413, 4821, - 6242, 7739, 3, /* * 10000**42 */ - /* 65536**36 = */ 9136, 4869, 7721, 6606, 6791, 8931, 5101, 4615, - 9675, 1209, 675, 343, 1365, 3935, 1393, 6016, - 7142, 5976, 4989, 4304, 612, 6401, 7031, 8671, - 6531, 2510, 8972, 6092, 6305, 9140, 1839, 121, - 3491, 5131, 9003, 6471, 1019, 252, 605, 4534, - 7310, 4014, 7330, 24, /* * 10000**43 */ - /* 65536**37 = */ 6896, 4657, 5371, 1419, 8274, 6525, 7670, 2075, - 1048, 6433, 4729, 3272, 8888, 3105, 7437, 3707, - 7539, 9945, 8272, 9643, 6241, 9949, 5565, 8738, - 2446, 8167, 5445, 4112, 4410, 364, 608, 1914, - 6970, 8094, 4236, 2461, 3598, 1754, 932, 4189, - 7874, 9413, 5190, 904, 162, /* * 10000**44 */ - /* 65536**38 = */ 6256, 6345, 4380, 786, 4167, 6625, 3887, 7470, - 5331, 9957, 1903, 4788, 5414, 7530, 1586, 693, - 203, 4930, 8972, 7865, 3377, 8571, 3045, 45, - 8325, 8547, 7044, 9721, 711, 4008, 8276, 9888, - 8463, 4063, 3545, 1862, 4659, 3725, 1049, 6413, - 7917, 1973, 3534, 8563, 2759, 1062, /* * 10000**45 */ - /* 65536**39 = */ 3216, 6919, 9266, 4, 3666, 3309, 1852, 9398, - 1373, 6894, 265, 8846, 3283, 1564, 9448, 6846, - 8350, 3810, 1301, 9442, 6621, 1192, 3293, 9081, - 7496, 750, 1603, 1625, 9808, 2953, 2203, 4208, - 5975, 8237, 1752, 1267, 4429, 2134, 1679, 9245, - 540, 4417, 7159, 7929, 9944, 7318, 6961, /* * 10000**46 */ - /* 65536**40 = */ 3776, 4660, 1922, 2874, 5008, 2649, 4360, 9467, - 2519, 4188, 2221, 3197, 2661, 9825, 4379, 1375, - 472, 6887, 7310, 9440, 5735, 2309, 7864, 3997, - 7371, 1131, 9128, 6505, 7738, 2086, 5167, 9927, - 5178, 9192, 3057, 5599, 7248, 2850, 8932, 1324, - 29, 6057, 1171, 1864, 1952, 7622, 4061, 5624, - 4, /* * 10000**48 */ - /* 65536**41 = */ 3936, 2506, 734, 3063, 3124, 7686, 4323, 7887, - 7229, 1282, 2904, 3150, 2249, 8641, 6534, 704, - 2006, 9526, 3294, 7751, 830, 215, 240, 8931, - 2055, 9525, 24, 1502, 205, 8812, 8187, 9735, - 468, 853, 3796, 6104, 1623, 5104, 6234, 8202, - 9226, 1742, 2351, 6782, 8488, 8185, 1648, 1083, - 9004, 29, /* * 10000**49 */ - /* 65536**42 = */ 9696, 9010, 9849, 1579, 4538, 171, 2501, 768, - 1435, 4533, 4950, 7432, 1109, 1317, 8855, 170, - 9834, 9082, 8014, 1129, 5679, 5684, 49, 3589, - 5010, 3873, 5288, 5235, 4723, 4576, 982, 6620, - 4652, 5281, 246, 6622, 4933, 6384, 4874, 7130, - 8892, 4180, 6558, 560, 4016, 7791, 6974, 6293, - 3242, 9553, 195, /* * 10000**50 */ - /* 65536**43 = */ 7056, 2903, 3118, 5896, 2722, 6397, 6659, 8038, - 9194, 4092, 2908, 5995, 8133, 8184, 9911, 9152, - 2143, 2400, 5030, 2670, 6348, 3842, 8518, 9028, - 8880, 3763, 9753, 5617, 839, 3692, 6344, 4758, - 6857, 6107, 6468, 1007, 2486, 4157, 4305, 3626, - 2842, 8759, 2487, 3141, 6250, 7295, 9125, 3757, - 8958, 6658, 2128, 1284, /* * 10000**51 */ - /* 65536**44 = */ 2016, 7250, 277, 692, 7634, 1634, 6149, 2012, - 666, 3571, 5511, 7380, 3578, 9928, 935, 430, - 3633, 450, 1810, 4086, 29, 916, 831, 4834, - 8851, 169, 7275, 9631, 1521, 4414, 4580, 1866, - 1538, 3293, 6875, 7144, 9099, 9444, 9724, 1751, - 7078, 8451, 5436, 4880, 586, 6082, 3812, 8558, - 6115, 7397, 4247, 2174, 8416, /* * 10000**52 */ - /* 65536**45 = */ 576, 9212, 986, 2732, 6359, 5854, 1577, 8731, - 165, 3422, 2299, 1799, 6177, 4861, 1226, 6614, - 5106, 5009, 3111, 1958, 7323, 1168, 6419, 6470, - 816, 3593, 5513, 4893, 3378, 5878, 3808, 194, - 6600, 128, 1582, 4242, 8887, 1619, 3962, 7269, - 5289, 1123, 9085, 1310, 6081, 3795, 3091, 2074, - 8728, 9872, 9872, 3101, 5226, 5156, 5, /* * 10000**54 */ - /* 65536**46 = */ 8736, 1406, 8868, 819, 1329, 9420, 8640, 5154, - 660, 5279, 9690, 4332, 7663, 978, 8997, 3141, - 162, 3291, 5326, 9879, 2961, 4041, 3243, 9988, - 9781, 6199, 3515, 3780, 2678, 2749, 9612, 8943, - 8873, 1861, 8795, 4079, 6233, 1028, 4248, 7150, - 7544, 1594, 1923, 1700, 3007, 8973, 6650, 1923, - 1802, 8593, 6094, 1839, 1465, 7867, 1473, 36, - /* * 10000**55 */ - /* 65536**47 = */ 2496, 868, 2468, 2102, 2717, 7830, 2775, 9173, - 7542, 8872, 8436, 5459, 764, 4431, 3806, 7539, - 7422, 39, 6304, 5050, 6842, 387, 9733, 4823, - 3075, 1771, 9672, 9119, 182, 6017, 49, 1443, - 9543, 651, 1322, 8984, 2625, 1859, 3669, 240, - 445, 3829, 6179, 3803, 7894, 4235, 3207, 9315, - 8478, 2658, 2700, 647, 2296, 1314, 6086, 8954, - 236, /* * 10000**56 */ - /* 65536**48 = */ 7856, 1605, 8538, 2846, 5089, 4687, 3716, 9919, - 2629, 4825, 9844, 6315, 5285, 5026, 9055, 849, - 7602, 4549, 9204, 8113, 411, 7275, 4428, 3914, - 4814, 4411, 5800, 6171, 7320, 1310, 697, 8773, - 9504, 6477, 2864, 4088, 878, 8633, 3768, 2686, - 5095, 260, 2038, 3905, 6111, 6696, 1711, 8860, - 5256, 255, 4625, 9488, 4897, 9351, 708, 9230, - 5180, 1552, /* * 10000**57 */ - /* 65536**49 = */ 816, 6765, 6891, 1411, 1361, 585, 2496, 5940, - 9151, 8435, 8006, 4356, 9152, 8575, 1421, 9410, - 241, 3085, 3161, 3890, 8471, 7098, 1085, 6928, - 5957, 847, 7711, 669, 3966, 136, 7182, 1896, - 1639, 8963, 7557, 9941, 7400, 8044, 6225, 4395, - 3525, 2752, 4075, 1436, 6089, 9107, 5982, 177, - 5282, 6131, 5674, 5878, 1975, 9235, 773, 1926, - 6970, 5825, 174, 1, /* * 10000**59 */ - /* 65536**50 = */ 7376, 6387, 2911, 6461, 3747, 7480, 1690, 198, - 8866, 6135, 6501, 7289, 4024, 1181, 2859, 3078, - 5846, 145, 9514, 5757, 951, 46, 3083, 523, - 3356, 8036, 3650, 4119, 165, 8888, 445, 3324, - 5934, 9910, 4292, 2907, 1554, 87, 4322, 1521, - 3207, 8176, 7237, 6403, 8117, 6257, 6039, 9081, - 2315, 5832, 1447, 7797, 2125, 7907, 9851, 7407, - 8542, 2879, 1443, 6680, 6, /* * 10000**60 */ - /* 65536**51 = */ 3536, 6771, 7158, 7177, 5736, 3840, 4863, 7208, - 3474, 1464, 9748, 4512, 4637, 4392, 5166, 8545, - 3629, 1034, 458, 3103, 2471, 892, 7790, 5532, - 2245, 9290, 9066, 6709, 436, 5052, 1768, 4586, - 2408, 651, 5462, 1286, 1998, 1818, 7163, 8580, - 3922, 3354, 7616, 4441, 7679, 1951, 2915, 1997, - 5357, 1129, 8814, 3678, 5099, 7083, 6956, 9716, - 7060, 4129, 7321, 9938, 6994, 43, /* * 10000**61 */ - /* 65536**52 = */ 5296, 7429, 1064, 8787, 1535, 5836, 6737, 5360, - 9305, 7475, 4524, 2317, 8, 4504, 7762, 8978, - 6147, 8012, 2266, 1210, 9792, 4307, 1287, 6205, - 4579, 4156, 260, 445, 7670, 733, 757, 9686, - 743, 9720, 1899, 5092, 9359, 7542, 6283, 5824, - 8426, 3452, 4159, 5290, 53, 1064, 231, 4497, - 9441, 5252, 1706, 9172, 2173, 4907, 4838, 3367, - 7839, 4418, 6120, 4749, 3918, 3890, 286, /* * 10000**62 */ - /* 65536**53 = */ 8656, 1651, 8994, 1809, 5347, 8161, 4279, 7115, - 7611, 2584, 3858, 6565, 9475, 4197, 9949, 3079, - 8635, 4722, 7087, 3415, 6443, 7725, 3064, 9317, - 9, 7629, 6599, 5226, 4036, 8154, 5560, 6657, - 6726, 4795, 6565, 1763, 4796, 3850, 2121, 2845, - 4508, 5496, 6852, 2698, 8079, 654, 5789, 6906, - 4847, 6947, 8841, 7375, 9838, 9398, 5327, 1421, - 8773, 9423, 9278, 574, 1175, 720, 8792, 1876, - /* * 10000**63 */ - /* 65536**54 = */ 9616, 6663, 1609, 3568, 2853, 4339, 2031, 6688, - 1127, 4908, 4827, 9125, 6626, 6691, 5175, 548, - 3545, 7584, 4583, 1888, 833, 7827, 2934, 8997, - 885, 4209, 2061, 4388, 7549, 6997, 3600, 9595, - 8766, 9203, 5268, 2995, 2214, 5032, 7090, 3822, - 4934, 5401, 8693, 1036, 3030, 3492, 2195, 9555, - 8254, 361, 9307, 5944, 1506, 1807, 1869, 1573, - 6644, 3223, 4768, 8474, 8567, 3620, 7231, 3155, - 2300, 1, /* * 10000**65 */ - /* 65536**55 = */ 4176, 9387, 1096, 2997, 7592, 9403, 2053, 8081, - 2903, 8078, 4437, 7637, 1340, 4806, 2654, 7647, - 8714, 8256, 1192, 2008, 3864, 5732, 3919, 6625, - 8324, 6829, 7280, 5477, 22, 4868, 5460, 1517, - 1460, 5263, 3966, 4850, 6335, 1663, 3219, 5060, - 9676, 2273, 9847, 2269, 875, 1570, 4407, 867, - 6765, 2595, 5923, 6978, 6176, 3425, 8627, 377, - 1494, 6071, 6774, 3313, 2450, 6470, 4545, 3471, - 3481, 611, 8, /* * 10000**66 */ - /* 65536**56 = */ 8336, 3799, 8977, 8580, 8953, 4764, 7036, 9876, - 3968, 8838, 6173, 7515, 8292, 4802, 4041, 1188, - 821, 2329, 3024, 4105, 4264, 7676, 3151, 1687, - 5084, 9900, 6839, 8386, 7690, 9395, 8462, 3897, - 2505, 5537, 268, 5595, 2347, 7888, 1286, 3257, - 9499, 6743, 7894, 5718, 8876, 7255, 7441, 8594, - 6724, 255, 6739, 9026, 6070, 1279, 1522, 3612, - 3260, 8847, 651, 5166, 4916, 3978, 3523, 5246, - 3566, 5311, 8294, 52, /* * 10000**67 */ - /* 65536**57 = */ 8096, 5894, 1574, 7714, 43, 2184, 2523, 9650, - 1575, 3179, 1651, 3501, 3766, 8219, 2451, 3254, - 2844, 8725, 6127, 5099, 2408, 2283, 4244, 9887, - 6081, 9719, 5587, 9722, 6802, 1122, 7208, 9254, - 3224, 9251, 9936, 5679, 9659, 3352, 992, 9185, - 7809, 1502, 5381, 6586, 5014, 1853, 928, 5154, - 390, 5752, 8779, 2100, 2677, 330, 4178, 6007, - 1032, 8359, 1917, 3248, 8832, 4428, 9401, 4946, - 5758, 5069, 392, 2231, 346, /* * 10000**68 */ - /* 65536**58 = */ 9456, 2241, 2296, 5023, 8603, 910, 1641, 8936, - 2443, 9272, 770, 2358, 1521, 5067, 2602, 212, - 5711, 240, 6254, 8223, 4108, 4472, 9747, 2246, - 9214, 4242, 3330, 7613, 9589, 5975, 845, 7383, - 8715, 4670, 6325, 4066, 9448, 9976, 3685, 4663, - 819, 6255, 9064, 5361, 669, 1072, 9555, 8626, - 2817, 5631, 8240, 3137, 3640, 4425, 1572, 2133, - 2522, 2191, 7294, 3496, 5239, 1291, 2961, 2669, - 8708, 9722, 3335, 3388, 77, 2269, /* * 10000**69 */ - /* 65536**59 = */ 8416, 8146, 5348, 2376, 9128, 4143, 545, 451, - 3012, 5808, 3486, 8940, 5709, 881, 7880, 687, - 7487, 6067, 3720, 3514, 5782, 3919, 8702, 7736, - 3429, 4098, 2686, 7394, 4598, 447, 7084, 7829, - 4625, 239, 5811, 830, 779, 9057, 5544, 8524, - 4545, 3050, 9297, 7901, 8723, 8979, 3505, 6156, - 1449, 1683, 3545, 437, 1604, 657, 1594, 8593, - 5771, 5905, 3944, 1659, 6020, 1312, 560, 4990, - 4981, 8062, 6279, 7830, 8477, 1690, 4870, 1, - /* * 10000**71 */ - /* 65536**60 = */ 976, 1411, 9919, 8589, 8182, 5470, 4277, 310, - 7388, 2827, 6561, 4689, 3615, 4636, 9457, 4874, - 2539, 5979, 3685, 7887, 2183, 3479, 9959, 3527, - 3648, 9005, 6554, 789, 2987, 4730, 9956, 7769, - 5312, 3419, 1265, 2963, 7987, 4657, 940, 5203, - 6986, 4591, 8183, 866, 2314, 4916, 2530, 2592, - 2010, 6588, 6150, 2465, 2610, 7664, 8690, 1294, - 4572, 7906, 2686, 75, 7595, 2685, 8762, 8310, - 7518, 3878, 3382, 8035, 9990, 1399, 1401, 7453, - 9, /* * 10000**72 */ - /* 65536**61 = */ 3136, 7692, 831, 3710, 1847, 5547, 3325, 4193, - 2002, 8690, 227, 1304, 3374, 8590, 4336, 4444, - 7852, 6386, 9345, 6585, 6778, 4055, 5825, 741, - 8449, 5589, 1961, 862, 1207, 4856, 7416, 4434, - 8153, 2401, 5450, 1460, 5451, 3497, 4365, 9971, - 8594, 1562, 1180, 7807, 5984, 141, 8299, 5895, - 4348, 4342, 9576, 6548, 5118, 5010, 8068, 539, - 9078, 7579, 1511, 2808, 6413, 3934, 4033, 1584, - 4114, 7883, 8171, 3926, 7300, 339, 5111, 8990, - 8668, 63, /* * 10000**73 */ - /* 65536**62 = */ 896, 3464, 828, 4011, 9306, 298, 3554, 4242, - 553, 963, 3624, 437, 7010, 6352, 393, 406, - 7799, 4357, 5776, 5807, 6169, 2904, 3779, 353, - 8524, 6075, 2729, 4887, 7602, 726, 6801, 5228, - 4071, 5370, 6940, 8278, 6307, 5116, 7561, 8064, - 1732, 3560, 2722, 7286, 8588, 9797, 4191, 9108, - 9166, 5810, 1194, 2488, 6167, 8905, 7284, 6781, - 9345, 6837, 4571, 4995, 771, 654, 2474, 5457, - 5487, 7250, 6320, 7890, 8534, 4547, 6722, 2135, - 4968, 5580, 418, /* * 10000**74 */ - /* 65536**63 = */ 256, 2576, 6510, 324, 4303, 718, 6903, 7003, - 9210, 4794, 8775, 2982, 226, 613, 7281, 195, - 7925, 1463, 4495, 5408, 9644, 6976, 9579, 8975, - 1179, 7063, 7562, 2320, 6701, 8959, 5098, 6779, - 1322, 5003, 5035, 2493, 9807, 3514, 1228, 1859, - 1205, 9516, 2323, 3137, 919, 2479, 5587, 9360, - 2668, 4236, 8066, 1396, 6818, 8497, 2587, 7358, - 8364, 879, 9869, 2280, 994, 5600, 350, 6166, - 1796, 1963, 5037, 463, 5936, 8125, 2796, 3416, - 6844, 3439, 620, 2743, /* * 10000**75 */ - /* 65536**64 = */ 7216, 2413, 6242, 6329, 3535, 3048, 9716, 3847, - 2459, 9947, 9823, 5862, 684, 5051, 1633, 7237, - 4082, 1105, 3913, 8147, 4628, 2342, 5068, 8381, - 5768, 8500, 9520, 3082, 1945, 941, 1246, 1960, - 3022, 5276, 6548, 4248, 7893, 7776, 1243, 9474, - 3063, 8474, 2492, 1662, 8144, 9768, 5878, 3576, - 1393, 7987, 1138, 1120, 3602, 4075, 7322, 847, - 1327, 963, 550, 6758, 7732, 8115, 4300, 7273, - 3065, 8942, 7697, 6179, 4733, 8902, 1907, 9305, - 772, 3159, 4862, 9313, 7976, 1, /* * 10000**77 */ - /* 65536**65 = */ 7776, 5658, 1530, 8253, 1241, 6899, 7753, 668, - 8242, 2709, 5318, 6414, 5047, 6822, 3390, 4737, - 5381, 4036, 9612, 7436, 4002, 5647, 1799, 431, - 6577, 3806, 8429, 4347, 7724, 2124, 4024, 8726, - 2637, 7742, 4306, 9844, 3491, 9666, 2213, 6215, - 8857, 2143, 1249, 7169, 6077, 9021, 4628, 5264, - 5087, 5163, 2312, 7783, 8012, 2806, 1300, 6980, - 1827, 9865, 1111, 5893, 8641, 5316, 7987, 1513, - 5507, 3003, 9196, 7392, 2387, 2494, 5495, 4983, - 4774, 3289, 6735, 8633, 6172, 7813, 11, /* * 10000**78 */ - /* 65536**66 = */ 7936, 3648, 7165, 8638, 4263, 1002, 5822, 8862, - 2094, 1039, 8207, 2757, 2230, 9672, 1751, 6253, - 262, 8564, 8485, 8691, 3810, 8024, 6274, 7809, - 3097, 3119, 7891, 234, 8558, 9086, 788, 3509, - 5621, 6999, 8755, 4608, 692, 3861, 4517, 749, - 3084, 1697, 8514, 5770, 9255, 86, 9732, 1839, - 6133, 5709, 3071, 1843, 5440, 6528, 5194, 9801, - 16, 4618, 5148, 935, 5197, 6009, 876, 8315, - 6672, 699, 8740, 2380, 2882, 2432, 6666, 1901, - 1524, 9194, 6517, 6428, 4773, 3222, 2103, 77, - /* * 10000**79 */ - /* 65536**67 = */ 3696, 7337, 9352, 6926, 6582, 5015, 7161, 8187, - 465, 5633, 762, 6538, 3353, 8808, 6923, 8089, - 1412, 2025, 9085, 8988, 9122, 5838, 5452, 1746, - 6173, 7085, 5018, 7140, 8626, 6181, 1919, 994, - 853, 3304, 3552, 7269, 1116, 9034, 1415, 6069, - 7935, 4803, 4627, 8518, 3499, 6753, 6921, 4483, - 4346, 5218, 8474, 2977, 7920, 4660, 6769, 2379, - 2811, 5359, 9592, 9900, 6722, 9883, 8919, 7584, - 685, 3395, 9225, 2958, 355, 2441, 8916, 7623, - 9326, 7972, 8366, 8123, 5458, 8276, 3326, 56, - 506, /* * 10000**80 */ - /* 65536**68 = */ 1056, 1854, 758, 3630, 3348, 6180, 6166, 165, - 7899, 7340, 5348, 9365, 5055, 3066, 3454, 6080, - 9848, 9658, 7831, 7108, 8301, 8955, 537, 1590, - 5174, 3016, 6084, 9930, 331, 4552, 4097, 5364, - 8723, 6534, 5525, 4464, 5816, 9542, 2645, 7263, - 7934, 1414, 6554, 5974, 6290, 7544, 8914, 3249, - 8840, 5332, 6263, 6210, 4635, 9666, 3728, 4508, - 7291, 5847, 6434, 9265, 7878, 6347, 357, 3482, - 1868, 9214, 1849, 5947, 4671, 5704, 4973, 9361, - 8699, 4115, 6427, 3760, 8728, 1710, 6977, 1818, - 1585, 3316, /* * 10000**81 */ - /* 65536**69 = */ 6016, 664, 8439, 648, 8318, 4423, 5479, 3853, - 9949, 6006, 4636, 9693, 5857, 6510, 1440, 1518, - 8376, 1231, 5717, 1215, 924, 9286, 1524, 5765, - 3684, 485, 793, 2354, 7497, 2047, 824, 1957, - 5684, 9394, 9226, 8916, 6634, 2630, 5258, 5308, - 224, 9905, 2215, 5017, 595, 4810, 7348, 4887, - 9538, 5887, 6917, 9608, 61, 1356, 1558, 726, - 2522, 6777, 6947, 3209, 3331, 8627, 7952, 8695, - 4067, 948, 6450, 4715, 7631, 7959, 7912, 5090, - 9015, 7655, 6845, 7482, 2853, 3762, 5884, 173, - 6479, 7764, 1732, 2, /* * 10000**83 */ -0}; /* end powers of 65536 in base 10000 */ - -unsigned short _start_small_powers_two[] = { - 0, 1, 3, 6, 10, 15, 22, 30, - 39, 49, 60, 73, 87, 102, 118, 135, - 154, 174, 195, 217, 240, 265, 291, 318, - 346, 375, 406, 438, 471, 505, 540, 577, - 615, 654, 694, 735, 778, 822, 867, 913, - 960, 1009, 1059, 1110, 1162, 1215, 1270, 1326, - 1383, 1441, 1501, 1562, 1624, 1687, 1751, 1817, - 1884, 1952, 2021, 2091, 2163, 2236, 2310, 2385, - 2461, 2539, 2618, 2698, 2779, 2861, 2945, -0}; /* end _start_small_powers_two */ diff --git a/usr/src/lib/libbc/libc/gen/common/_sprintf_sup.c b/usr/src/lib/libbc/libc/gen/common/_sprintf_sup.c deleted file mode 100644 index 676e7e342d..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_sprintf_sup.c +++ /dev/null @@ -1,324 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "base_conversion.h" - -/* - * Fundamental utilities of base conversion required for sprintf - but too - * complex or too seldom used to be worth assembly language coding. - */ - -/* p = x * y + c ; return (p/10000 << 16 | p%10000) */ -unsigned long -_prodc_b10000(_BIG_FLOAT_DIGIT x, _BIG_FLOAT_DIGIT y, unsigned long c) -{ - unsigned long p = x * (unsigned long) y + c; - - return ((p / 10000) << 16) | (p % 10000); -} - -/* p = x * y ; return p */ -unsigned long -_prod_b65536(_BIG_FLOAT_DIGIT x, _BIG_FLOAT_DIGIT y) -{ - return (x * (unsigned long)y); -} - -/* p = x * y ; return (p/10000 << 16 | p%10000) */ -unsigned long -_prod_b10000(_BIG_FLOAT_DIGIT x, _BIG_FLOAT_DIGIT y) -{ - unsigned long p = x * (unsigned long) y; - - return ((p / 10000) << 16) | (p % 10000); -} - -/* p = x << n + c ; return (p/10000 << 16 | p%10000) */ -unsigned long -_lshift_b10000(_BIG_FLOAT_DIGIT x, short unsigned n, long unsigned c) -{ - unsigned long p = (((unsigned long) x) << n) + c; - - return ((p / 10000) << 16) | (p % 10000); -} - -/* p = x * 10000 + c ; return p */ -unsigned long -_prod_10000_b65536(_BIG_FLOAT_DIGIT x, long unsigned c) -{ - return (x * (unsigned long) 10000 + c); -} - -/* p = x << 16 + c ; return (p/10000 << 16 | p%10000) */ -unsigned long -_prod_65536_b10000(_BIG_FLOAT_DIGIT x, long unsigned c) -{ - unsigned long p = (((unsigned long) x) << 16) + c; - - return ((p / 10000) << 16) | (p % 10000); -} - -/* p = c ; return (p/10000 << 16 | p%10000) */ -unsigned long -_carry_out_b10000(unsigned long c) -{ - return ((c / 10000) << 16) | (c % 10000); -} - -void -_left_shift_base_ten(_big_float *pbf, short unsigned multiplier) -{ - /* - * Multiply a base-10**4 significand by 2<<multiplier. Extend length - * as necessary to accommodate carries. - */ - - short unsigned length = pbf->blength; - int j; - unsigned long carry; - long p; - - carry = 0; - for (j = 0; j < length; j++) { - p = _lshift_b10000((_BIG_FLOAT_DIGIT) pbf->bsignificand[j], multiplier, carry); - pbf->bsignificand[j] = (_BIG_FLOAT_DIGIT) (p & 0xffff); - carry = p >> 16; - } - while (carry != 0) { - p = _carry_out_b10000(carry); - pbf->bsignificand[j++] = (_BIG_FLOAT_DIGIT) (p & 0xffff); - carry = p >> 16; - } - pbf->blength = j; -} - -void -_left_shift_base_two(_big_float *pbf, short unsigned multiplier) -{ - /* - * Multiply a base-2**16 significand by 2<<multiplier. Extend length - * as necessary to accommodate carries. - */ - - short unsigned length = pbf->blength; - long unsigned p; - int j; - unsigned long carry; - - carry = 0; - for (j = 0; j < length; j++) { - p = _lshift_b65536(pbf->bsignificand[j], multiplier, carry); - pbf->bsignificand[j] = (_BIG_FLOAT_DIGIT) (p & 0xffff); - carry = p >> 16; - } - if (carry != 0) { - pbf->bsignificand[j++] = (_BIG_FLOAT_DIGIT) (_carry_out_b65536(carry) & 0xffff); - } - pbf->blength = j; -} - -void -_right_shift_base_two(_big_float *pbf, short unsigned multiplier, - _BIG_FLOAT_DIGIT *sticky) -{ - /* *pb = *pb / 2**multiplier to normalize. 15 <= multiplier <= 1 */ - /* Any bits shifted out got to *sticky. */ - - long unsigned p; - int j; - unsigned long carry; - - carry = 0; - for (j = pbf->blength - 1; j >= 0; j--) { - p = _rshift_b65536(pbf->bsignificand[j], multiplier, carry); - pbf->bsignificand[j] = (_BIG_FLOAT_DIGIT) (p >> 16); - carry = p & 0xffff; - } - *sticky = (_BIG_FLOAT_DIGIT) carry; -} - -void -_multiply_base_ten(_big_float *pbf, _BIG_FLOAT_DIGIT multiplier) -{ - /* - * Multiply a base-10**4 significand by multiplier. Extend length as - * necessary to accommodate carries. - */ - - int j; - unsigned long carry; - long p; - - carry = 0; - for (j = 0; j < pbf->blength; j++) { - p = _prodc_b10000((_BIG_FLOAT_DIGIT) pbf->bsignificand[j], multiplier, carry); - pbf->bsignificand[j] = (_BIG_FLOAT_DIGIT) (p & 0xffff); - carry = p >> 16; - } - while (carry != 0) { - p = _carry_out_b10000(carry); - pbf->bsignificand[j++] = (_BIG_FLOAT_DIGIT) (p & 0xffff); - carry = p >> 16; - } - pbf->blength = j; -} - -void -_multiply_base_two(_big_float *pbf, _BIG_FLOAT_DIGIT multiplier, - long unsigned carry) -{ - /* - * Multiply a base-2**16 significand by multiplier. Extend length as - * necessary to accommodate carries. - */ - - short unsigned length = pbf->blength; - long unsigned p; - int j; - - for (j = 0; j < length; j++) { - p = _prodc_b65536(pbf->bsignificand[j], multiplier, carry); - pbf->bsignificand[j] = (_BIG_FLOAT_DIGIT) (p & 0xffff); - carry = p >> 16; - } - if (carry != 0) { - pbf->bsignificand[j++] = (_BIG_FLOAT_DIGIT) (_carry_out_b65536(carry) & 0xffff); - } - pbf->blength = j; -} - -void -_multiply_base_ten_by_two(_big_float *pbf, short unsigned multiplier) -{ - /* - * Multiply a base-10**4 significand by 2**multiplier. Extend length - * as necessary to accommodate carries. - */ - - short unsigned length = pbf->blength; - int j; - long unsigned carry, p; - - carry = 0; - for (j = 0; j < length; j++) { - p = _lshift_b10000(pbf->bsignificand[j], multiplier, carry); - pbf->bsignificand[j] = (_BIG_FLOAT_DIGIT) (p & 0xffff); - carry = p >> 16; - } - while (carry != 0) { - p = _carry_out_b10000(carry); - pbf->bsignificand[j++] = (_BIG_FLOAT_DIGIT) (p & 0xffff); - carry = p >> 16; - } - pbf->blength = j; -} - -void -_unpacked_to_big_float(unpacked *pu, _big_float *pb, int *pe) -{ - /* - * Converts pu into a bigfloat *pb of minimal length; exponent *pe - * such that pu = *pb * 2 ** *pe - */ - - int iz, it; - - for (iz = (UNPACKED_SIZE - 2); pu->significand[iz] == 0; iz--); /* Find lsw. */ - - for (it = 0; it <= iz; it++) { - pb->bsignificand[2 * (iz - it)] = pu->significand[it] & 0xffff; - pb->bsignificand[2 * (iz - it) + 1] = pu->significand[it] >> 16; - } - - pb->blength = 2 * iz + 2; - if (pb->bsignificand[0] == 0) { - for (it = 1; it < pb->blength; it++) - pb->bsignificand[it - 1] = pb->bsignificand[it]; - pb->blength--; - } - *pe = pu->exponent + 1 - 16 * pb->blength; - pb->bexponent = 0; - -#ifdef DEBUG - printf(" unpacked to big float 2**%d * ", *pe); - _display_big_float(pb, 2); -#endif -} - -void -_mul_65536short(_big_float *pbf, unsigned long carry) -{ - /* *pbf *= 65536 ; += carry ; */ - - long unsigned p; - int j; - - for (j = 0; j < pbf->blength; j++) { - p = _prod_65536_b10000(pbf->bsignificand[j], carry); - pbf->bsignificand[j] = (_BIG_FLOAT_DIGIT) (p & 0xffff); - carry = p >> 16; - } - while (carry != 0) { - p = _carry_out_b10000(carry); - pbf->bsignificand[j++] = (_BIG_FLOAT_DIGIT) (p & 0xffff); - carry = p >> 16; - } - pbf->blength = j; -} - -void -_big_binary_to_big_decimal(_big_float *pb, _big_float *pd) -{ - /* Convert _big_float from binary form to decimal form. */ - - int i; - - pd->bsignificand[0] = pb->bsignificand[pb->blength - 1] % 10000; - if (pd->bsignificand[0] == pb->bsignificand[pb->blength - 1]) { - pd->blength = 1; - } else { - pd->blength = 2; - pd->bsignificand[1] = pb->bsignificand[pb->blength - 1] / 10000; - } - for (i = pb->blength - 2; i >= 0; i--) { /* Multiply by 2**16 and - * add next significand. */ - _mul_65536short(pd, (unsigned long) pb->bsignificand[i]); - } - for (i = 0; i <= (pb->bexponent - 16); i += 16) { /* Multiply by 2**16 for - * each trailing zero. */ - _mul_65536short(pd, (unsigned long) 0); - } - if (pb->bexponent > i) - _left_shift_base_ten(pd, (short unsigned) (pb->bexponent - i)); - pd->bexponent = 0; - -#ifdef DEBUG - printf(" _big_binary_to_big_decimal "); - _display_big_float(pd, 10); -#endif -} diff --git a/usr/src/lib/libbc/libc/gen/common/_times_power.c b/usr/src/lib/libbc/libc/gen/common/_times_power.c deleted file mode 100644 index e0fb6ae9f1..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_times_power.c +++ /dev/null @@ -1,454 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1995 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include "base_conversion.h" -#include <malloc.h> - -void -_copy_big_float_digits(_BIG_FLOAT_DIGIT *p1, _BIG_FLOAT_DIGIT *p2, - short unsigned n) -{ /* Copies p1[n] = p2[n] */ - short unsigned i; - - for (i = 0; i < n; i++) - *p1++ = *p2++; -} - -void -_free_big_float(_big_float *p) -{ - /* Central routine to call free for base conversion. */ - - char *freearg = (char *) p; - - (void) free(freearg); -#ifdef DEBUG - printf(" free called with %X \n", freearg); -#endif -} - -void -_base_conversion_abort(int ern, char *bcastring) -{ - char pstring[160]; - - errno = ern; - (void) sprintf(pstring, " libc base conversion file %s line %d: %s", __FILE__, __LINE__, bcastring); - perror(pstring); - abort(); -} - -/* - * function to multiply a big_float times a positive power of two or ten. - * - * Arguments - * pbf: Operand x, to be replaced by the product x * mult ** n. - * mult: if mult is two, x is base 10**4; - * if mult is ten, x is base 2**16 - * n: - * precision: Number of bits of precision ultimately required - * (mult=10) or number of digits of precision ultimately - * required (mult=2). - * Extra bits are allowed internally to permit correct - * rounding. - * pnewbf: Return result *pnewbf is set to: pbf if uneventful - * BIG_FLOAT_TIMES_TOOBIG if n is bigger than the tables - * permit ; - * BIG_FLOAT_TIMES_NOMEM if pbf->blength was - * insufficient to hold the product, and malloc failed to - * produce a new block ; - * &newbf if pbf->blength was - * insufficient to hold the product, and a new _big_float - * was allocated by malloc. newbf holds the product. - * It's the caller's responsibility to free this space - * when no longer needed. - * - * if precision is < 0, then -pfb->bexponent/{4 or 16} digits are discarded - * on the last product. - */ - void -_big_float_times_power(_big_float *pbf, int mult, int n, int precision, - _big_float **pnewbf) -{ - short unsigned base, sumlz = 0; - unsigned short productsize, trailing_zeros_to_delete, needed_precision, *pp, *table[3], max[3], *start[3], *lz[3], tablepower[3]; - int i, j, itlast; - _big_float *pbfold = pbf; - int discard; - - if (precision >= 0) - discard = -1; - else { - precision = -precision; - discard = 0; - } - switch (mult) { - case 2: /* *pbf is in base 10**4 so multiply by a - * power of two */ - base = 10; - max[0] = _max_tiny_powers_two; - max[1] = _max_small_powers_two; - max[2] = _max_big_powers_two; - table[0] = _tiny_powers_two; - table[1] = _small_powers_two; - table[2] = _big_powers_two; - lz[0] = 0; - lz[1] = 0; - lz[2] = 0; - start[0] = _start_tiny_powers_two; - start[1] = _start_small_powers_two; - start[2] = _start_big_powers_two; - needed_precision = 2 + (precision + 1) / 4; /* Precision is in base - * ten; counts round and - * sticky. */ - break; - case 10: /* *pbf is in base 2**16 so multiply by a - * power of ten */ - base = 2; - max[0] = _max_tiny_powers_ten; - max[1] = _max_small_powers_ten; - max[2] = _max_big_powers_ten; - table[0] = _tiny_powers_ten; - table[1] = _small_powers_ten; - table[2] = _big_powers_ten; - start[0] = _start_tiny_powers_ten; - start[1] = _start_small_powers_ten; - start[2] = _start_big_powers_ten; - lz[0] = _leading_zeros_tiny_powers_ten; - lz[1] = _leading_zeros_small_powers_ten; - lz[2] = _leading_zeros_big_powers_ten; - needed_precision = 2 + (precision + 1) / 16; /* Precision is in base - * two; counts round and - * sticky. */ - break; - } - for (i = 0; i < 3; i++) { - tablepower[i] = n % max[i]; - n = n / max[i]; - } - for (itlast = 2; (itlast >= 0) && (tablepower[itlast] == 0); itlast--); - /* Determine last i; could be 0, 1, or 2. */ - if (n > 0) { /* The tables aren't big enough to accomodate - * mult**n, but it doesn't matter since the - * result would undoubtedly overflow even - * binary quadruple precision format. Return - * an error code. */ - (void) printf("\n _times_power failed due to exponent %d %d %d leftover: %d \n", tablepower[0], tablepower[1], tablepower[2], n); - *pnewbf = BIG_FLOAT_TIMES_TOOBIG; - goto ret; - } - productsize = pbf->blength; - for (i = 0; i < 3; i++) - productsize += (start[i])[tablepower[i] + 1] - (start[i])[tablepower[i]]; - - if (productsize < needed_precision) - needed_precision = productsize; - - if (productsize <= pbf->bsize) { - *pnewbf = pbf; /* Work with *pnewbf from now on. */ - } else { /* Need more significance than *pbf can hold. */ - char *mallocresult; - int mallocarg; - - mallocarg = sizeof(_big_float) + sizeof(_BIG_FLOAT_DIGIT) * (productsize - _BIG_FLOAT_SIZE); - mallocresult = malloc(mallocarg); -#ifdef DEBUG - printf(" malloc arg %X result %X \n", mallocarg, (int) mallocresult); -#endif - if (mallocresult == (char *) 0) { /* Not enough memory - * left, bail out. */ - *pnewbf = BIG_FLOAT_TIMES_NOMEM; - goto ret; - } - *pnewbf = (_big_float *) mallocresult; - _copy_big_float_digits((*pnewbf)->bsignificand, pbf->bsignificand, pbf->blength); - (*pnewbf)->blength = pbf->blength; - (*pnewbf)->bexponent = pbf->bexponent; - pbf = *pnewbf; - pbf->bsize = productsize; - } - - /* pbf now points to the input and the output big_floats. */ - - for (i = 0; i <= itlast; i++) - if (tablepower[i] != 0) { /* Step through each of the - * tables. */ - unsigned lengthx, lengthp; - - /* Powers of 10**4 have leading zeros in base 2**16. */ - lengthp = (start[i])[tablepower[i] + 1] - (start[i])[tablepower[i]]; - lengthx = pbf->blength; - - if (discard >= 0) - switch (base) { - case 2: - discard = (-pbf->bexponent) / 16; - break; - case 10: - discard = (-pbf->bexponent) / 4; - break; - } - -#ifdef DEBUG - { - long basexp; - int id; - - printf(" step %d x operand length %d \n", i, lengthx); - _display_big_float(pbf, base); - printf(" step %d p operand length %d power %d \n", i, lengthp, tablepower[i]); - basexp = (base == 2) ? (lz[i])[tablepower[i]] : 0; - for (id = 0; id < lengthp; id++) { - printf("+ %d * ", (table[i])[id + (start[i])[tablepower[i]]]); - if (base == 2) - printf("2**%d", 16 * (basexp + id)); - if (base == 10) - printf("10**%d", 4 * (basexp + id)); - if ((id % 4) == 3) - printf("\n"); - } - printf("\n"); - } - if ((i == itlast) && (discard >= 0)) - printf(" alternative discard %d digits \n", discard); -#endif - - if (base == 2) { - sumlz += (lz[i])[tablepower[i]]; - pbf->bexponent += 16 * (lz[i])[tablepower[i]]; - } - if (lengthp == 1) { /* Special case - multiply by - * <= 10**4 or 2**13 */ - switch (base) { - case 10: - _multiply_base_ten_by_two(pbf, tablepower[i]); - break; - case 2: - _multiply_base_two(pbf, (_BIG_FLOAT_DIGIT) ((table[i])[tablepower[i]]), (unsigned long) 0); - break; - } -#ifdef DEBUG - assert(pbf->blength <= pbf->bsize); -#endif - } else if (lengthx == 1) { /* Special case of short - * multiplicand. */ - _BIG_FLOAT_DIGIT multiplier = pbf->bsignificand[0]; - - _copy_big_float_digits(pbf->bsignificand, (unsigned short *) &((table[i])[(start[i])[tablepower[i]]]), lengthp); - pbf->blength = lengthp; - switch (base) { - case 10: - _multiply_base_ten(pbf, multiplier); - break; - case 2: - _multiply_base_two(pbf, multiplier, (unsigned long) 0); - break; - } -#ifdef DEBUG - assert(pbf->blength <= pbf->bsize); -#endif - } else {/* General case. */ - short unsigned canquit; - short unsigned excess; - - /* - * The result will be accumulated in *pbf - * from most significant to least - * significant. - */ - - /* Generate criterion for early termination. */ - switch (base) { - case 2: - canquit = (short unsigned)65536; - break; - case 10: - canquit = 10000; - break; - } - canquit -= 3 + ((lengthx < lengthp) ? lengthx : lengthp); - - pbf->bsignificand[lengthx + lengthp - 1] = 0; /* Only gets filled by - * carries. */ - for (j = lengthx + lengthp - 2; j >= 0; j--) { - int istart = j - lengthp + 1, istop = lengthx - 1; - short unsigned lengthprod; - _BIG_FLOAT_DIGIT product[3]; - - pp = (unsigned short *) &((table[i])[(start[i])[tablepower[i]]]); - if (j < istop) - istop = j; - if (0 > istart) - istart = 0; - - switch (base) { - case 2: - _multiply_base_two_vector((short unsigned) (istop - istart + 1), &(pbf->bsignificand[istart]), &(pp[j - istop]), product); - if (product[2] != 0) - _carry_propagate_two((unsigned long) product[2], &(pbf->bsignificand[j + 2])); - if (product[1] != 0) - _carry_propagate_two((unsigned long) product[1], &(pbf->bsignificand[j + 1])); - break; - case 10: - _multiply_base_ten_vector((short unsigned) (istop - istart + 1), &(pbf->bsignificand[istart]), &(pp[j - istop]), product); - if (product[2] != 0) - _carry_propagate_ten((unsigned long) product[2], &(pbf->bsignificand[j + 2])); - if (product[1] != 0) - _carry_propagate_ten((unsigned long) product[1], &(pbf->bsignificand[j + 1])); - break; - } - pbf->bsignificand[j] = product[0]; - lengthprod = lengthx + lengthp; - if (pbf->bsignificand[lengthprod - 1] == 0) - lengthprod--; - if (lengthprod > needed_precision) - excess = lengthprod - needed_precision; - else - excess = 0; - if ((i == itlast) && ((j + 2) <= excess) && (pbf->bsignificand[j + 1] <= canquit) - && ((pbf->bsignificand[j + 1] | pbf->bsignificand[j]) != 0)) { - /* - * On the last - * multiplication, it's not - * necessary to develop the - * entire product, if further - * digits can't possibly - * affect significant digits, - * unless there's a chance - * the product might be - * exact! - */ - /* - * Note that the product - * might be exact if the j - * and j+1 terms are zero; if - * they are non-zero, then it - * won't be after they're - * discarded. - */ - - excess = j + 2; /* Can discard j+1, j, - * ... 0 */ -#ifdef DEBUG - printf(" decided to quit early at j %d since s[j+1] is %d <= %d \n", j, pbf->bsignificand[j + 1], canquit); - printf(" s[j+2..j] are %d %d %d \n", pbf->bsignificand[j + 2], pbf->bsignificand[j + 1], pbf->bsignificand[j]); - printf(" requested precision %d needed_precision %d big digits out of %d \n", precision, needed_precision, lengthprod); -#endif - if ((discard >= 0) && ((j + 2) > (discard - (int) sumlz))) { -#ifdef DEBUG - printf(" early quit rejected because j+2 = %d > %d = discard \n", j + 2, discard); -#endif - goto pastdiscard; - } - pbf->bsignificand[excess] |= 1; /* Sticky bit on. */ -#ifdef DEBUG - printf(" discard %d digits - last gets %d \n", excess, pbf->bsignificand[excess]); -#endif - trailing_zeros_to_delete = excess; - goto donegeneral; - } - pastdiscard: ; -#ifdef DEBUG - /* - * else { printf(" early termination - * rejected at j %d since s[j+1] = - * %d, canquit = %d \n", j, - * pbf->bsignificand[j + 1], - * canquit); printf(" s[j+2..j] are - * %d %d %d \n", pbf->bsignificand[j - * + 2], pbf->bsignificand[j + 1], - * pbf->bsignificand[j]); printf(" - * requested precision %d - * needed_precision %d big digits out - * of %d \n", precision, - * needed_precision, lengthprod); } - */ -#endif - } - trailing_zeros_to_delete = 0; - donegeneral: - pbf->blength = lengthx + lengthp; - if (pbf->bsignificand[pbf->blength - 1] == 0) - pbf->blength--; - for (; pbf->bsignificand[trailing_zeros_to_delete] == 0; trailing_zeros_to_delete++); - /* - * Look for additional trailing zeros to - * delete. - */ - - /* - * fix for bug 1070565; if too many trailing - * zeroes are deleted, we'll violate the - * assertion that bexponent is in [-3,+4] - */ - if (base == 10) { - int deletelimit=(1-((pbf->bexponent+3)/4)); - - if ((int)trailing_zeros_to_delete > deletelimit) { -#ifdef DEBUG - printf("\n __x_power trailing zeros delete count lowered from %d to " - "%d \n", trailing_zeros_to_delete,deletelimit); -#endif - - trailing_zeros_to_delete = deletelimit; - } - } - - - if (trailing_zeros_to_delete != 0) { -#ifdef DEBUG - printf(" %d trailing zeros deleted \n", trailing_zeros_to_delete); -#endif - _copy_big_float_digits(pbf->bsignificand, &(pbf->bsignificand[trailing_zeros_to_delete]), pbf->blength - trailing_zeros_to_delete); - pbf->blength -= trailing_zeros_to_delete; - switch (base) { - case 2: - pbf->bexponent += 16 * trailing_zeros_to_delete; - break; - case 10: - pbf->bexponent += 4 * trailing_zeros_to_delete; - break; - } - } - } - } - if ((pbfold != pbf) && (pbf->blength <= pbfold->bsize)) { /* Don't need that huge - * buffer after all! */ -#ifdef DEBUG - printf(" free called from times_power because final length %d <= %d original size \n", pbf->blength, pbfold->bsize); -#endif - - /* Copy product to original buffer. */ - pbfold->blength = pbf->blength; - pbfold->bexponent = pbf->bexponent; - _copy_big_float_digits(pbfold->bsignificand, pbf->bsignificand, pbf->blength); - _free_big_float(*pnewbf); /* Free new buffer. */ - *pnewbf = pbfold; /* New buffer pointer now agrees with - * original. */ - } -ret: - return; -} diff --git a/usr/src/lib/libbc/libc/gen/common/_unpack_dble.c b/usr/src/lib/libbc/libc/gen/common/_unpack_dble.c deleted file mode 100644 index 6860502073..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/_unpack_dble.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "base_conversion.h" - -/* Normalize a number. Does not affect zeros, infs, or NaNs. */ -void -_fp_normalize(unpacked *pu) -{ - int i; - short unsigned nlzwords, nlzbits; - long unsigned t; - - if ((*pu).fpclass == fp_normal) { - for (nlzwords = 0; (pu->significand[nlzwords] == 0) && (nlzwords < UNPACKED_SIZE); nlzwords++); - if (nlzwords >= UNPACKED_SIZE) { - (*pu).fpclass = fp_zero; - return; - } - if (nlzwords > 0) { - for (i = 0; i < UNPACKED_SIZE - nlzwords; i++) - pu->significand[i] = pu->significand[i + nlzwords]; - for (; i < UNPACKED_SIZE; i++) - pu->significand[i] = 0; - pu->exponent -= 32 * nlzwords; - } - for (; pu->significand[UNPACKED_SIZE - 1 - nlzwords] == 0; nlzwords++); - /* nlzwords is now the count of trailing zero words. */ - - nlzbits = 0; - t = pu->significand[0]; - /* TESTS to determine normalize count. */ - -#define SHIFTMACRO(n) if (t <= (((unsigned long) 0xffffffff) >> n)) { t = t<<n ; nlzbits += n ; } - SHIFTMACRO(16); - SHIFTMACRO(8); - SHIFTMACRO(4); - SHIFTMACRO(2); - SHIFTMACRO(1); - pu->exponent -= nlzbits; - if (nlzbits >= 1) { /* small shift */ - unsigned long high, low, shiftout = 0; - for (i = UNPACKED_SIZE - 1 - nlzwords; i >= 0; i--) { - high = pu->significand[i] << nlzbits; - low = pu->significand[i] >> (32 - nlzbits); - pu->significand[i] = shiftout | high; - shiftout = low; - } - } - } -} - -/* Set the exception bit in the current exception register. */ -void -_fp_set_exception(enum fp_exception_type ex) -{ - _fp_current_exceptions |= 1 << (int) ex; -} - -enum fp_class_type -_class_double(double *x) -{ - double_equivalence kluge; - - kluge.x = *x; - if (kluge.f.msw.exponent == 0) { /* 0 or sub */ - if ((kluge.f.msw.significand == 0) && (kluge.f.significand2 == 0)) - return fp_zero; - else - return fp_subnormal; - } else if (kluge.f.msw.exponent == 0x7ff) { /* inf or nan */ - if ((kluge.f.msw.significand == 0) && (kluge.f.significand2 == 0)) - return fp_infinity; - else if (kluge.f.msw.significand >= 0x40000) - return fp_quiet; - else - return fp_signaling; - } else - return fp_normal; -} - - -/* Left shift significand by 11 <= n <= 16 bits. Affect all classes. */ -void -_fp_leftshift(unpacked *pu, unsigned n) -{ - int i; - - unsigned long high, low, shiftout = 0; - for (i = UNPACKED_SIZE - 1; i >= 0; i--) { - high = pu->significand[i] << n; - low = pu->significand[i] >> (32 - n); - pu->significand[i] = shiftout | high; - shiftout = low; - } -} - - -void -_unpack_double(unpacked *pu, double *px) -{ - double_equivalence x; - int i; - - x.x = *px; - (*pu).sign = x.f.msw.sign; - pu->significand[1] = x.f.significand2; - for (i = 2; i < UNPACKED_SIZE; i++) - pu->significand[i] = 0; - if (x.f.msw.exponent == 0) { /* zero or sub */ - if ((x.f.msw.significand == 0) && (x.f.significand2 == 0)) { /* zero */ - pu->fpclass = fp_zero; - return; - } else { /* subnormal */ - pu->fpclass = fp_normal; - pu->exponent = 12 - DOUBLE_BIAS; - pu->significand[0] = x.f.msw.significand; - _fp_normalize(pu); - return; - } - } else if (x.f.msw.exponent == 0x7ff) { /* inf or nan */ - if ((x.f.msw.significand == 0) && (x.f.significand2 == 0)) { /* inf */ - pu->fpclass = fp_infinity; - return; - } else { /* nan */ - if ((x.f.msw.significand & 0x80000) != 0) { /* quiet */ - pu->fpclass = fp_quiet; - } else {/* signaling */ - pu->fpclass = fp_quiet; - _fp_set_exception(fp_invalid); - } - pu->significand[0] = 0x80000 | x.f.msw.significand; - _fp_leftshift(pu, 11); - return; - } - } - (*pu).exponent = x.f.msw.exponent - DOUBLE_BIAS; - (*pu).fpclass = fp_normal; - (*pu).significand[0] = 0x100000 | x.f.msw.significand; - _fp_leftshift(pu, 11); -} - -enum fp_class_type -_class_quadruple(quadruple *x) -{ - quadruple_equivalence kluge; - int i; - - for (i = 0; i < 4; i++) -#ifdef __STDC__ - kluge.x = *x; -#else - kluge.x.u[i] = x->u[i]; -#endif - if (kluge.f.msw.exponent == 0) { /* 0 or sub */ - if ((kluge.f.msw.significand == 0) && (kluge.f.significand2 == 0) && (kluge.f.significand3 == 0) && (kluge.f.significand4 == 0)) - return fp_zero; - else - return fp_subnormal; - } else if (kluge.f.msw.exponent == 0x7fff) { /* inf or nan */ - if ((kluge.f.msw.significand == 0) && (kluge.f.significand2 == 0) && (kluge.f.significand3 == 0) && (kluge.f.significand4 == 0)) - return fp_infinity; - else if ((kluge.f.msw.significand & 0xffff) >= 0x8000) - return fp_quiet; - else - return fp_signaling; - } else - return fp_normal; -} - -void -_unpack_quadruple(unpacked *pu, quadruple *px) -{ - quadruple_equivalence x; - int i; - - for (i = 0; i < 4; i++) -#ifdef __STDC__ - x.x = *px; -#else - x.x.u[i] = px->u[i]; -#endif - (*pu).sign = x.f.msw.sign; - pu->significand[1] = x.f.significand2; - pu->significand[2] = x.f.significand3; - pu->significand[3] = x.f.significand4; - for (i = 4; i < UNPACKED_SIZE; i++) - pu->significand[i] = 0; - if (x.f.msw.exponent == 0) { /* zero or sub */ - if ((x.f.msw.significand | x.f.significand2 | x.f.significand3 | x.f.significand4) == 0) { /* zero */ - pu->fpclass = fp_zero; - goto ret; - } else { /* subnormal */ - pu->fpclass = fp_normal; - pu->exponent = 16 - QUAD_BIAS; - pu->significand[0] = x.f.msw.significand; - _fp_normalize(pu); - goto ret; - } - } else if (x.f.msw.exponent == 0x7fff) { /* inf or nan */ - if ((x.f.msw.significand | x.f.significand2 | x.f.significand3 | x.f.significand4) == 0) { /* inf */ - pu->fpclass = fp_infinity; - goto ret; - } else { /* nan */ - if ((x.f.msw.significand & 0x8000) != 0) { /* quiet */ - pu->fpclass = fp_quiet; - } else {/* signaling */ - pu->fpclass = fp_quiet; - _fp_set_exception(fp_invalid); - } - pu->significand[0] = 0x8000 | x.f.msw.significand; - _fp_leftshift(pu, 16); - goto ret; - } - } - (*pu).exponent = x.f.msw.exponent - QUAD_BIAS; - (*pu).fpclass = fp_normal; - (*pu).significand[0] = 0x10000 | x.f.msw.significand; - _fp_leftshift(pu, 15); -ret: - /* - * printf("/n _unpack_quadruple ") ; _display_unpacked(pu); - */ - return; -} diff --git a/usr/src/lib/libbc/libc/gen/common/a64l.c b/usr/src/lib/libbc/libc/gen/common/a64l.c deleted file mode 100644 index 86c694169f..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/a64l.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.5 */ - -/*LINTLIBRARY*/ -/* - * convert base 64 ascii to long int - * char set is [./0-9A-Za-z] - * - */ - -#define BITSPERCHAR 6 /* to hold entire character set */ - -long -a64l(s) -register char *s; -{ - register int i, c; - long lg = 0; - - for (i = 0; (c = *s++) != '\0'; i += BITSPERCHAR) { - if (c > 'Z') - c -= 'a' - 'Z' - 1; - if (c > '9') - c -= 'A' - '9' - 1; - lg |= (long)(c - ('0' - 2)) << i; - } - return (lg); -} diff --git a/usr/src/lib/libbc/libc/gen/common/abs.c b/usr/src/lib/libbc/libc/gen/common/abs.c deleted file mode 100644 index dde5f1b6cb..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/abs.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ - -int -abs(arg) -register int arg; -{ - return (arg >= 0 ? arg : -arg); -} diff --git a/usr/src/lib/libbc/libc/gen/common/alarm.c b/usr/src/lib/libbc/libc/gen/common/alarm.c deleted file mode 100644 index b16d671fde..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/alarm.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Backwards compatible alarm. - */ -#include <sys/time.h> - -unsigned int -alarm(unsigned int secs) -{ - struct itimerval it, oitv; - struct itimerval *itp = ⁢ - - timerclear(&itp->it_interval); - itp->it_value.tv_sec = secs; - itp->it_value.tv_usec = 0; - if (setitimer(ITIMER_REAL, itp, &oitv) < 0) - return (-1); - if (oitv.it_value.tv_usec) - oitv.it_value.tv_sec++; - return (oitv.it_value.tv_sec); -} diff --git a/usr/src/lib/libbc/libc/gen/common/asctime.c b/usr/src/lib/libbc/libc/gen/common/asctime.c deleted file mode 100644 index 92c9332531..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/asctime.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1980 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ - -#include <time.h> -#include <tzfile.h> - -static char cbuf[26]; - -static char *ct_numb(char *, int); - -char * -asctime(struct tm *t) -{ - char *cp, *ncp; - int *tp; - - cp = cbuf; - for (ncp = "Day Mon 00 00:00:00 1900\n"; *cp++ = *ncp++;); - ncp = &"SunMonTueWedThuFriSat"[3*t->tm_wday]; - cp = cbuf; - *cp++ = *ncp++; - *cp++ = *ncp++; - *cp++ = *ncp++; - cp++; - tp = &t->tm_mon; - ncp = &"JanFebMarAprMayJunJulAugSepOctNovDec"[(*tp)*3]; - *cp++ = *ncp++; - *cp++ = *ncp++; - *cp++ = *ncp++; - cp = ct_numb(cp, *--tp); - cp = ct_numb(cp, *--tp+100); - cp = ct_numb(cp, *--tp+100); - cp = ct_numb(cp, *--tp+100); - cp = ct_numb(cp, (t->tm_year + TM_YEAR_BASE)/100); - cp--; - cp = ct_numb(cp, t->tm_year+100); - return (cbuf); -} - -static char * -ct_numb(char *cp, int n) -{ - cp++; - if (n>=10) - *cp++ = (n/10)%10 + '0'; - else - *cp++ = ' '; - *cp++ = n%10 + '0'; - return (cp); -} diff --git a/usr/src/lib/libbc/libc/gen/common/atof.c b/usr/src/lib/libbc/libc/gen/common/atof.c deleted file mode 100644 index bfad17cd09..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/atof.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1986 by Sun Microsystems, Inc. - */ - -#include <stdio.h> - -extern double -strtod(); - -double -atof(cp) - char *cp; -{ - return strtod(cp, (char **) NULL); -} diff --git a/usr/src/lib/libbc/libc/gen/common/atoi.c b/usr/src/lib/libbc/libc/gen/common/atoi.c deleted file mode 100644 index 0ace01d68b..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/atoi.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 2.1 */ - -/*LINTLIBRARY*/ -#include <ctype.h> - -#define ATOI - -#ifdef ATOI -typedef int TYPE; -#define NAME atoi -#else -typedef long TYPE; -#define NAME atol -#endif - -TYPE -NAME(p) -register char *p; -{ - register TYPE n; - register int c, neg = 0; - - if (!isdigit(c = *p)) { - while (isspace(c)) - c = *++p; - switch (c) { - case '-': - neg++; - case '+': /* fall-through */ - c = *++p; - } - if (!isdigit(c)) - return (0); - } - for (n = '0' - c; isdigit(c = *++p); ) { - n *= 10; /* two steps to avoid unnecessary overflow */ - n += '0' - c; /* accum neg to avoid surprises at MAX */ - } - return (neg ? n : -n); -} diff --git a/usr/src/lib/libbc/libc/gen/common/atol.c b/usr/src/lib/libbc/libc/gen/common/atol.c deleted file mode 100644 index 5a2f88fab5..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/atol.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 2.1 */ - -/*LINTLIBRARY*/ -#include <ctype.h> - -#define ATOL - -#ifdef ATOI -typedef int TYPE; -#define NAME atoi -#else -typedef long TYPE; -#define NAME atol -#endif - -TYPE -NAME(p) -register char *p; -{ - register TYPE n; - register int c, neg = 0; - - if (!isdigit(c = *p)) { - while (isspace(c)) - c = *++p; - switch (c) { - case '-': - neg++; - case '+': /* fall-through */ - c = *++p; - } - if (!isdigit(c)) - return (0); - } - for (n = '0' - c; isdigit(c = *++p); ) { - n *= 10; /* two steps to avoid unnecessary overflow */ - n += '0' - c; /* accum neg to avoid surprises at MAX */ - } - return (neg ? n : -n); -} diff --git a/usr/src/lib/libbc/libc/gen/common/base_conversion.h b/usr/src/lib/libbc/libc/gen/common/base_conversion.h deleted file mode 100644 index b506e69143..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/base_conversion.h +++ /dev/null @@ -1,424 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1995 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _base_conversion_h -#define _base_conversion_h - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <errno.h> - -#include <floatingpoint.h> - -#ifdef DEBUG -#include <stdio.h> -#include <assert.h> -#endif - -/* Sun floating-point PRIVATE include file. */ - -/* PRIVATE MACROS */ - -#ifdef DEBUG -#define PRIVATE -#else -#define PRIVATE static -#endif - -/* PRIVATE CONSTANTS */ - -#define SINGLE_BIAS 127 -#define DOUBLE_BIAS 1023 -#define EXTENDED_BIAS 16383 -#define QUAD_BIAS 16383 - -#define SINGLE_MAXE 97 /* Maximum decimal exponent we need to - * consider. */ -#define DOUBLE_MAXE 771 /* Maximum decimal exponent we need to - * consider. */ -#define EXTENDED_MAXE 12330 /* Maximum decimal exponent we need to - * consider. */ -#define QUAD_MAXE 12330 /* Maximum decimal exponent we need to - * consider. */ - -#define UNPACKED_SIZE 5 /* Size of unpacked significand. */ - -/* PRIVATE TYPES */ - -/* - * Unpack floating-point internal format. - * Value is 0.s0s1..sn * 2**(1+exponent) - */ -typedef struct { - int sign; - enum fp_class_type fpclass; - int exponent; /* Unbiased exponent. */ - unsigned significand[UNPACKED_SIZE]; /* Last word is round */ - /* and sticky. */ -} unpacked; - -#ifdef i386 -typedef struct { /* Most significant word formats. */ - unsigned significand:23; - unsigned exponent:8; - unsigned sign:1; -} single_msw; - -typedef struct { - unsigned significand:20; - unsigned exponent:11; - unsigned sign:1; -} double_msw; - -typedef struct { - unsigned exponent:15; - unsigned sign:1; - unsigned unused:16; -} extended_msw; - -typedef struct { - unsigned significand:16; - unsigned exponent:15; - unsigned sign:1; -} quadruple_msw; - -typedef struct { /* Floating-point formats in detail. */ - single_msw msw; -} single_formatted; - -typedef struct { - unsigned significand2; - double_msw msw; -} double_formatted; - -typedef struct { - unsigned significand2; - unsigned significand; - extended_msw msw; -} extended_formatted; - -typedef struct { - unsigned significand4; - unsigned significand3; - unsigned significand2; - quadruple_msw msw; -} quadruple_formatted; -#else -typedef struct { /* Most significant word formats. */ - unsigned sign:1; - unsigned exponent:8; - unsigned significand:23; -} single_msw; - -typedef struct { - unsigned sign:1; - unsigned exponent:11; - unsigned significand:20; -} double_msw; - -typedef struct { - unsigned sign:1; - unsigned exponent:15; - unsigned unused:16; -} extended_msw; - -typedef struct { - unsigned sign:1; - unsigned exponent:15; - unsigned significand:16; -} quadruple_msw; - -typedef struct { /* Floating-point formats in detail. */ - single_msw msw; -} single_formatted; - -typedef struct { - double_msw msw; - unsigned significand2; -} double_formatted; - -typedef struct { - extended_msw msw; - unsigned significand; - unsigned significand2; -} extended_formatted; - -typedef struct { - quadruple_msw msw; - unsigned significand2; - unsigned significand3; - unsigned significand4; -} quadruple_formatted; -#endif - -typedef union { /* Floating-point formats equivalenced. */ - single_formatted f; - single x; -} single_equivalence; - -typedef union { - double_formatted f; - double x; -} double_equivalence; - -typedef union { - extended_formatted f; - extended x; -} extended_equivalence; - -typedef union { - quadruple_formatted f; - quadruple x; -} quadruple_equivalence; - -/* PRIVATE GLOBAL VARIABLES */ - -/* Current floating-point exceptions. */ -fp_exception_field_type _fp_current_exceptions; - -/* Current rounding direction. */ -enum fp_direction_type _fp_current_direction; - -/* Current rounding precision. */ -enum fp_precision_type _fp_current_precision; - -/* PRIVATE FUNCTIONS */ - -extern void _fp_set_exception(enum fp_exception_type); -/* enum fp_exception_type ex ; */ /* exception to be set in curexcep */ - -/* - * Default size for _big_float - suitable for single and double precision. - */ - -#define _BIG_FLOAT_SIZE (DECIMAL_STRING_LENGTH/2) -#define _BIG_FLOAT_DIGIT short unsigned /* big_float significand type */ - -/* Maximum number of integer digits in a representable extended or quad. */ -#define _INTEGER_SIZE 4932 - -typedef struct { /* Variable-precision floating-point type */ - /* used for intermediate results. */ - unsigned short bsize; /* Maximum allowable logical length of */ - /* significand. */ - unsigned short blength; /* Logical length of significand. */ - short int bexponent; /* - * Exponent to be attached to least - * significant word of significand. - * exponent >= 0 implies all integer, - * with decimal point to right of - * least significant word of - * significand, and is equivalent to - * number of omitted trailing zeros - * of significand. -length < exponent - * < 0 implies decimal point within - * significand. exponent = -length - * implies decimal point to left of - * most significand word. exponent < - * -length implies decimal point to - * left of most significant word with - * -length-exponent leading zeros. - */ - /* - * NOTE: bexponent represents a power of 2 or 10, even though big - * digits are powers of 2**16 or 10**4. - */ - _BIG_FLOAT_DIGIT bsignificand[_BIG_FLOAT_SIZE]; - /* - * Significand of digits in base 10**4 or 2**16. significand[0] is - * least significant, significand[length-1] is most significant. - */ -} _big_float; - -#define BIG_FLOAT_TIMES_NOMEM (_big_float *)0 -#define BIG_FLOAT_TIMES_TOOBIG (_big_float *)1 - -/* Internal functions defined in base conversion support routines. */ - -extern void _multiply_base_ten(_big_float *, _BIG_FLOAT_DIGIT); -extern void _multiply_base_ten_by_two(_big_float *, short unsigned); -extern void _multiply_base_two(_big_float *, _BIG_FLOAT_DIGIT, - long unsigned); -extern void _carry_propagate_two(unsigned long, _BIG_FLOAT_DIGIT *); -extern void _carry_propagate_ten(unsigned long, _BIG_FLOAT_DIGIT *); -extern void _multiply_base_two_vector(short unsigned, _BIG_FLOAT_DIGIT *, - short unsigned *, _BIG_FLOAT_DIGIT []); -extern void _multiply_base_ten_vector(short unsigned, _BIG_FLOAT_DIGIT *, - short unsigned *, _BIG_FLOAT_DIGIT []); -extern void _fourdigitsquick(short unsigned, char*); -extern void _unpacked_to_big_float(unpacked *, _big_float *, int *); -extern void _big_binary_to_big_decimal(_big_float *, _big_float *); -extern void _left_shift_base_ten(_big_float *, short unsigned); -extern void _left_shift_base_two(_big_float *, short unsigned); -extern void _right_shift_base_two(_big_float *, short unsigned, - _BIG_FLOAT_DIGIT *); -extern void _free_big_float(_big_float *); -extern void _base_conversion_abort(int, char *); -extern void _display_big_float(_big_float *, unsigned); -extern void _integerstring_to_big_decimal(char [], unsigned, unsigned, - unsigned *, _big_float *); -extern void _fractionstring_to_big_decimal(char [], unsigned, unsigned, - _big_float *); -extern void _big_decimal_to_big_binary(_big_float *, _big_float *); -extern void _fp_rightshift(unpacked *, int); -extern void _fp_leftshift(unpacked *, unsigned); -extern void _fp_normalize(unpacked *); -extern void _pack_single(unpacked *, single *); -extern void _pack_double(unpacked *, double *); -extern void _pack_extended(unpacked *, extended *); -extern void _pack_quadruple(unpacked *, quadruple *); -extern void _unpack_single(unpacked *, single *); -extern void _unpack_double(unpacked *, double *); -extern void _unpack_extended(unpacked *, extended *); -extern void _unpack_quadruple(unpacked *, quadruple *); -extern void _unpacked_to_decimal(unpacked *, decimal_mode *, - decimal_record *, fp_exception_field_type *); -extern enum fp_class_type _class_single(single *); -extern enum fp_class_type _class_double(double *); -extern enum fp_class_type _class_extended(extended *); -extern enum fp_class_type _class_quadruple(quadruple *); - -/* - * Fundamental utilities that multiply or add two shorts into a unsigned long, - * sometimes add an unsigned long carry, - * compute quotient and remainder in underlying base, and return - * quo<<16 | rem as a unsigned long. - */ - -extern unsigned long _umac(_BIG_FLOAT_DIGIT, _BIG_FLOAT_DIGIT, unsigned long); - /* p = x * y + c ; return p */ - -#define _prodc_b65536(x,y,c) (_umac((x),(y),(c))) - -extern unsigned long _prodc_b10000(_BIG_FLOAT_DIGIT, _BIG_FLOAT_DIGIT, - unsigned long); -/* p = x * y + c ; return (p/10000 << */ - -extern unsigned long _prod_b10000(_BIG_FLOAT_DIGIT, _BIG_FLOAT_DIGIT); -/* p = x * y ; return (p/10000 << 16 | p%10000) */ - -extern unsigned long _prod_10000_b65536(_BIG_FLOAT_DIGIT, long unsigned); -/* p = x * 10000 + c ; return p */ - -extern unsigned long _prod_65536_b10000(_BIG_FLOAT_DIGIT, long unsigned); -/* p = x * 65536 + c ; return (p/10000 << 16 | p%10000) */ - -#define _rshift_b65536(x,n,c) ((((unsigned long) (x)) << (16-(n))) + ((c)<<16)) - -#define _lshift_b65536(x,n,c) ((((unsigned long) (x)) << (n)) + (c)) - -extern unsigned long _lshift_b10000(_BIG_FLOAT_DIGIT, _BIG_FLOAT_DIGIT, - long unsigned); -/* p = x << n + c ; return (p/10000 << 16 | p%10000) */ - -#define _carry_in_b65536(x,c) ((x) + (c)) - -extern unsigned long _carry_in_b10000(_BIG_FLOAT_DIGIT, long unsigned); -/* p = x + c ; return (p/10000 << 16 | p%10000) */ - -#define _carry_out_b65536(c) (c) - -extern unsigned long _carry_out_b10000(unsigned long); -/* p = c ; return (p/10000 << 16 | p%10000) */ - -/* - * Header file for revised "fast" base conversion based upon table look-up - * methods. - */ - -extern void -_big_float_times_power(_big_float *, int, int, int, _big_float **); - -/* Variables defined in _small_powers.c and _big_powers.c */ -/* Used in base conversion. */ - -/* - * The run-time structure consists of two large tables of powers - either - * powers of 10**4 in base 2**16 or vice versa. - * - * Suppose it's powers of T in base B. Then - * - * _tiny_powers_T contains TTINY entries, T**0, T**1, ... T**TTINY-1 where - * T is 2 or 10, TTINY is 16 or 4 _small_powers_T contains TSMALL - * entries, T**0, T**1, ... T**TSMALL-1 where T is 2**TTINY or 10**TTINY - * _big_powers_T contains TBIG entries, T**0, T**1, ... T**TBIG-1 - * where T is (2**TTINY)**TSMALL or (10**TTINY)**TSMALL - * - * so that any power of T from 0 to T**(TTINY*TSMALL*TBIG-1) can be represented - * as a product of just two table entries. Since the powers vary greatly in - * size, the tables are condensed to exclude leading and trailing zeros. The - * following tables - * - * _max_tiny_powers_T contains one entry, TTINY - * _start_tiny_powers_T contains TTINY entries - * _leading_zeros_tiny_powers_T contains TTINY entries - * _max_small_powers_T contains one entry, TSMALL - * _start_small_powers_T contains TSMALL entries - * _leading_zeros_small_powers_T contains TSMALL entries - * _max_big_powers_T contains one entry, TBIG - * _start_big_powers_T contains TBIG entries - * _leading_zeros_big_powers_T contains TBIG entries - * - * The powers are maintained with x[start] less significant than x[start+1], so - * - * The powers are maintained with x[start] less significant than x[start+1], so - * that the interpretation of a _small_powers_T entry is that - * - * T**i = (B**leading_zeros[i]) * (x[start[i]] + x[start[i]+1] * B + ... - * x[start[i+1]-1] * B**(start[i+1]-start[i]) ) - * - * where B = (2 or 10)**TTINY - * - * The powers are listed consecutively in the tables, with start index and - * leading zero information retained and printed out at the end. - * - */ - -extern unsigned short _max_tiny_powers_ten; -extern unsigned short _tiny_powers_ten[]; -extern unsigned short _start_tiny_powers_ten[]; -extern unsigned short _leading_zeros_tiny_powers_ten[]; -extern unsigned short _max_tiny_powers_two; -extern unsigned short _tiny_powers_two[]; -extern unsigned short _start_tiny_powers_two[]; - -extern unsigned short _max_small_powers_ten; -extern unsigned short _small_powers_ten[]; -extern unsigned short _start_small_powers_ten[]; -extern unsigned short _leading_zeros_small_powers_ten[]; -extern unsigned short _max_small_powers_two; -extern unsigned short _small_powers_two[]; -extern unsigned short _start_small_powers_two[]; - -extern unsigned short _max_big_powers_ten; -extern unsigned short _big_powers_ten[]; -extern unsigned short _start_big_powers_ten[]; -extern unsigned short _leading_zeros_big_powers_ten[]; -extern unsigned short _max_big_powers_two; -extern unsigned short _big_powers_two[]; -extern unsigned short _start_big_powers_two[]; - -#endif /* _base_conversion_h */ diff --git a/usr/src/lib/libbc/libc/gen/common/bcmp.c b/usr/src/lib/libbc/libc/gen/common/bcmp.c deleted file mode 100644 index fd31198d17..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/bcmp.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -int -bcmp(char *s1, char *s2, int len) -{ - - while (len--) - if (*s1++ != *s2++) - return (1); - return (0); -} diff --git a/usr/src/lib/libbc/libc/gen/common/bsearch.c b/usr/src/lib/libbc/libc/gen/common/bsearch.c deleted file mode 100644 index d5ee461163..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/bsearch.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.5 */ - -/*LINTLIBRARY*/ -/* - * Binary search algorithm, generalized from Knuth (6.2.1) Algorithm B. - * - */ - -typedef char *POINTER; - -POINTER -bsearch(key, base, nel, width, compar) -POINTER key; /* Key to be located */ -POINTER base; /* Beginning of table */ -unsigned nel; /* Number of elements in the table */ -unsigned width; /* Width of an element (bytes) */ -int (*compar)(); /* Comparison function */ -{ - int two_width = width + width; - POINTER last = base + width * (nel - 1); /* Last element in table */ - - while (last >= base) { - - register POINTER p = base + width * ((last - base)/two_width); - register int res = (*compar)(key, p); - - if (res == 0) - return (p); /* Key found */ - if (res < 0) - last = p - width; - else - base = p + width; - } - return ((POINTER) 0); /* Key not found */ -} diff --git a/usr/src/lib/libbc/libc/gen/common/calloc.c b/usr/src/lib/libbc/libc/gen/common/calloc.c deleted file mode 100644 index 0fb54ebb80..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/calloc.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <malloc.h> - -/* - * calloc - allocate and clear memory block - */ -#define CHARPERINT (sizeof(int)/sizeof(char)) - -#ifdef S5EMUL -#define ptr_t void* -#define free_t void -#define free_return(x) (x) -#else -#define ptr_t char* -#define free_t int -#define free_return(x) return (x) -#endif - -ptr_t -calloc(unsigned num, unsigned size) -{ - ptr_t mp; - ptr_t malloc(); - - num *= size; - mp = malloc(num); - if (mp == NULL) - return(NULL); - bzero(mp, num); - return ((ptr_t)(mp)); -} - -free_t -cfree(ptr_t p, unsigned num, unsigned size) -{ - free_return(free(p)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/char_to_decimal.h b/usr/src/lib/libbc/libc/gen/common/char_to_decimal.h deleted file mode 100644 index e08f177d39..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/char_to_decimal.h +++ /dev/null @@ -1,532 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1990-1995, by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * This file contains the common part of string_to_decimal, func_to_decimal, - * and file_to_decimal. NEXT must be defined to cause CURRENT to contain the - * next input character. ATEOF must be defined to be == EOF if an input - * file is at EOF, != EOF otherwise. - */ - -{ - int sigfound; - int ids = 0; - int i; - int nzbp = 0, nzap = 0; /* Length of zero substring - * before point, after point. */ - char decpt; - int nfast, nfastlimit; - char *pfast; - - *pform = invalid_form; /* Invalid until we find something. */ - *pechar = NULL; /* No exponent field assumed. */ - pd->fpclass = fp_normal;/* Defaults. */ - pd->sign = 0; /* Positive. */ - pd->exponent = 0; - pd->more = 0; /* Assume no overflow of digits on NaN - * string. */ - if (fortran_conventions != 0) - decpt = '.'; - else -#ifdef PRE41 - decpt = '.'; -#else - decpt = *(localeconv()->decimal_point); -#endif - while (isspace(CURRENT)) { - NEXT; - } /* Skip white space. */ - if (fortran_conventions >= 2) { - /* - * All white space - valid zero for Fortran formatted input. - */ - *pform = whitespace_form; - if (isspace(*cp)) - good = cp; - else - good = cp - 1; - if ((nread >= nmax) && (CURRENT == NULL)) { /* Used up field width. */ - pd->fpclass = fp_zero; - goto done; - } - } - if (CURRENT == '+') { - NEXT; - } else if (CURRENT == '-') { /* Negative. */ - pd->sign = 1; - NEXT; - } - sigfound = -1; /* -1 = no digits found yet. */ - - if (('1' <= CURRENT) && (CURRENT <= '9')) { - good = cp; - *pform = fixed_int_form; - sigfound = 1; /* 1 = significant digits found. */ - pd->ds[ids++] = CURRENT; - NEXT; - goto number; - } else - switch (CURRENT) { - case ' ': - if (fortran_conventions < 2) - goto firstdefault; - case '0': - *pform = fixed_int_form; - while ((CURRENT == '0') || ((fortran_conventions >= 2) && (CURRENT == ' '))) { - NEXT; - } /* Ignore leading zeros. */ - if ((*cp == '0') || ((fortran_conventions >= 2) && (*cp == ' '))) - good = cp; - else - good = cp - 1; - sigfound = 0; /* 0 = only zeros found yet. */ - goto number; - case 'i': - case 'I': - { /* Try infinity. */ - static char *infstring = "INFINITY"; - int is, iagree; - -#define UCASE(c) ( (('a' <= c) && (c <= 'z')) ? c - 32 : c ) - - NEXT; - is = 1; - while (is <= 7 && - UCASE(CURRENT) == infstring[is]) { - NEXT; - is++; - } - iagree = is; - if (CURRENT != NULL) { - is++; /* To account for infstring - * indexing starting at 0. - */ - } - if (iagree >= 3) { /* Found syntactically - * valid infinity. */ - if (iagree < 8) { /* INFxxxx */ - if (iagree > 3) { - nmax++; /* 1083219 */ - CURRENT = EOF; /* 1083219 */ - } - good = cp - (is - 3); - *pform = inf_form; - } else { /* INFINITYxxx */ - good = cp - (is - 8); - *pform = infinity_form; - } - pd->fpclass = fp_infinity; - sigfound = iagree; - } - else { - nmax++; /* 1083219 */ - CURRENT = EOF; /* 1083219 */ - } - goto done; - } - case 'n': - case 'N': - { /* Try NaN. */ - static char *nanstring = "NAN("; - int is; - - NEXT; - is = 1; - while (is <= 3 && - UCASE(CURRENT) == nanstring[is]) { - NEXT; - is++; - } - if ((is == 3)) { /* Found syntactically - * valid NaN. */ - *pform = nan_form; - good = CURRENT == NULL ? cp : cp - 1; - pd->fpclass = fp_quiet; - sigfound = 1; - } - else if (is == 4) { /* Found NaN followed by - * parenthesis. */ - good = CURRENT == NULL ? cp - 1 : cp - 2; - *pform = nan_form; - pd->fpclass = fp_quiet; - sigfound = 1; - while ((CURRENT != 0) && (CURRENT != ')') && (ids < (DECIMAL_STRING_LENGTH - 1))) { - pd->ds[ids++] = CURRENT; - NEXT; - } - while ((CURRENT != 0) && (CURRENT != ')') && (ATEOF != EOF)) { /* Pick up rest of - * string. */ - pd->more = 1; - NEXT; - } - if (CURRENT == ')') { - good = cp; - NEXT; - *pform = nanstring_form; - } - else { - nmax++; /* 1083219 */ - CURRENT = EOF; /* 1083219 */ - } - } - else { - nmax++; /* 1083219 */ - CURRENT = EOF; /* 1083219 */ - } - goto done; - } - default: - if (CURRENT == decpt) { - NEXT; /* Try number. */ - goto afterpoint; - } - firstdefault: - goto done; - } - -number: - -nextnumber: - if (('1' <= CURRENT) && (CURRENT <= '9')) { - if ((ids + nzbp + 2) >= DECIMAL_STRING_LENGTH) { /* Not enough room to - * store it all: fake - * end of string. */ - pd->exponent += nzbp + 1; - pd->more = 1; - pd->ds[ids] = 0; /* Actual string termination. */ - ids = DECIMAL_STRING_LENGTH - 1; /* To allow end of - * program to terminate - * again. */ - } else { - for (i = 0; (i < nzbp); i++) - pd->ds[ids++] = '0'; - pd->ds[ids++] = CURRENT; - } - *pform = fixed_int_form; - sigfound = 1; - nzbp = 0; - NEXT; - nfastlimit = DECIMAL_STRING_LENGTH - 3 - ids; - if ((0 < nfastlimit) && ('1' <= CURRENT) && (CURRENT <= '9')) { /* Special handling for - * common case. */ - nfast = 0; - pfast = &(pd->ds[ids]); - do { - pfast[nfast++] = CURRENT; - NEXT; - } - while (('1' <= CURRENT) && (CURRENT <= '9') && (nfast < nfastlimit)); - ids += nfast; - } - if (CURRENT == '0') - goto nextnumberzero; /* common case */ - good = cp; - if (('1' > *good) || (*good > '9')) - good--; /* look out if we fell off end */ - goto nextnumber; - } else - switch (CURRENT) { - case ' ': - if (fortran_conventions < 2) - goto numberdefault; - if (fortran_conventions == 2) { - NEXT; - goto nextnumber; - } - case '0': - *pform = fixed_int_form; - nextnumberzero: - while ((CURRENT == '0') || (CURRENT == ' ')) { /* Accumulate zero - * substring. */ - if (CURRENT == ' ') { - if (fortran_conventions < 2) { - good = cp - 1; - goto numberdefault; - } - if (fortran_conventions == 2) { - nzbp--; /* Undo effect of - * following nzbp++ */ - } - } - good = cp; - nzbp++; - NEXT; - } - goto nextnumber; - - case 'E': - case 'e': - efound: - *pechar = cp; - if (sigfound == -1) /* exp following no digits? - * bad format */ - goto done; - if (sigfound > 0) - pd->exponent += nzbp; - goto exponent; - case '+': - case '-': - case 'D': - case 'd': - case 'Q': - case 'q': - if (fortran_conventions != 0) - goto efound; - default: - if (CURRENT == decpt) { - NEXT; - goto afterpoint; - } - numberdefault: - if (sigfound > 0) - pd->exponent += nzbp; - goto done; - } - -afterpoint: - if (sigfound >= 0) { /* Better accept the point as good, but don't - * accept the next character after. */ - good = cp - 1; /* Assume cp points past. */ - if (*good != decpt) /* If not, bump good. */ - good++; - } - switch (*pform) { /* Revise *pform now that point has been - * found. */ - case invalid_form: - case whitespace_form: - *pform = fixed_dotfrac_form; - break; - case fixed_int_form: - *pform = fixed_intdot_form; - break; - } -switchafterpoint: - if (('1' <= CURRENT) && (CURRENT <= '9')) { - if (*pform == fixed_intdot_form) - *pform = fixed_intdotfrac_form; - good = cp; - if (sigfound < 1) { /* No significant digits found so - * far. */ - sigfound = 1; - pd->ds[ids++] = CURRENT; - pd->exponent = -(nzap + 1); - } else { /* Significant digits have begun. */ - if ((ids + nzbp + nzap + 2) >= DECIMAL_STRING_LENGTH) { /* Not enough room to - * store it all: fake - * end of string. */ - pd->exponent += nzbp; - pd->more = 1; - pd->ds[ids] = 0; /* Actual string - * termination. */ - ids = DECIMAL_STRING_LENGTH - 1; /* To allow end of - * program to terminate - * again. */ - } else { - for (i = 0; (i < (nzbp + nzap)); i++) - pd->ds[ids++] = '0'; - pd->ds[ids++] = CURRENT; - pd->exponent -= nzap + 1; - } - } - nzbp = 0; - nzap = 0; - NEXT; - nfastlimit = DECIMAL_STRING_LENGTH - 3 - ids; - if ((0 < nfastlimit) && ('1' <= CURRENT) && (CURRENT <= '9')) { /* Special handling for - * common case. */ - nfast = 0; - pfast = &(pd->ds[ids]); - do { - pfast[nfast++] = CURRENT; - NEXT; - } - while (('1' <= CURRENT) && (CURRENT <= '9') && (nfast < nfastlimit)); - good = cp; - if (('1' > *good) || (*good > '9')) - good--; /* look out if we fell off end */ - ids += nfast; - pd->exponent -= nfast; - } - if (CURRENT == '0') - goto zeroafterpoint; - goto switchafterpoint; - } else - switch (CURRENT) { - case ' ': - if (fortran_conventions < 2) - goto afterpointdefault; - if (fortran_conventions == 2) { - /* - * To pass FCVS, all blanks after point must - * count as if zero seen. - */ - if (sigfound == -1) - sigfound = 0; - NEXT; - goto switchafterpoint; - } - case '0': - if (*pform == fixed_intdot_form) - *pform = fixed_intdotfrac_form; - if (sigfound == -1) - sigfound = 0; - zeroafterpoint: - good = cp; - nzap++; - NEXT; - while ((CURRENT == '0') || (CURRENT == ' ')) { - if (CURRENT == ' ') { /* Handle blanks and - * Fortran. */ - if (fortran_conventions < 2) { - good = cp - 1; - goto afterpointdefault; - } - if (fortran_conventions == 2) { - nzap--; /* Undo following nzap++ */ - } - } - nzap++; - NEXT; - } - good = cp; - if (*good != '0') - good--; - goto switchafterpoint; - - case 'E': - case 'e': - efound2: - *pechar = cp; - if (sigfound == -1) /* exp following no digits? - * bad! */ - goto done; - if (sigfound > 0) - pd->exponent += nzbp; - goto exponent; - case '+': - case '-': - case 'D': - case 'd': - case 'Q': - case 'q': - if (fortran_conventions != 0) - goto efound2; - - default: - afterpointdefault: - if (sigfound > 0) - pd->exponent += nzbp; - goto done; - } -exponent: - { - unsigned explicitsign = 0, explicitexponent = 0; - - if ((CURRENT != '+') && (CURRENT != '-')) { /* Skip EeDd and - * following blanks. */ - NEXT; /* Pass the EeDd. */ - if (fortran_conventions >= 2) - while (CURRENT == ' ') { - NEXT; - } - } - if (CURRENT == '+') { - NEXT; - } else if (CURRENT == '-') { /* Negative explicit - * exponent. */ - NEXT; - explicitsign = 1; - } - while ((('0' <= CURRENT) && (CURRENT <= '9')) || (CURRENT == ' ')) { /* Accumulate explicit - * exponent. */ - if (CURRENT == ' ') { /* Handle blanks and Fortran. */ - if (fortran_conventions < 2) - goto doneexp; - if (fortran_conventions == 2) { - NEXT; - goto exploop; - } - CURRENT = '0'; - } - good = cp; - if (explicitexponent <= 400000000) { - explicitexponent = 10 * explicitexponent + CURRENT - '0'; - } - NEXT; - switch (*pform) { - case whitespace_form: - case fixed_int_form: - *pform = floating_int_form; - break; - case fixed_intdot_form: - *pform = floating_intdot_form; - break; - case fixed_dotfrac_form: - *pform = floating_dotfrac_form; - break; - case fixed_intdotfrac_form: - *pform = floating_intdotfrac_form; - break; - } - exploop: ; - } -doneexp: - if (explicitsign == 1) - pd->exponent -= explicitexponent; - else - pd->exponent += explicitexponent; - } - -done: - if (fortran_conventions >= 2) { /* Fill up field width with extra - * blanks found. */ - if (good == (cp - 1)) - good = NULL; /* Flag that whole field was good up - * to now. */ - while (CURRENT == ' ') { - NEXT; - } - if (good == NULL) { - good = CURRENT == NULL ? cp : cp - 1; - } - } - if (sigfound < 1) - pd->fpclass = fp_zero; /* True zero found. */ - - pd->ds[ids] = 0; /* Terminate decimal string. */ - pd->ndigits = ids; /* Save string length in ndigits. */ - if (good >= cp0) { /* Valid token found. */ - *ppc = good + 1;/* token found - point one past. */ - } else { /* No valid token found. */ - *pform = invalid_form; - *ppc = cp0; /* No token found - revert to original value. */ - pd->sign = 0; - pd->fpclass = fp_signaling; /* If anyone looks, x will be - * nan. */ - } -} diff --git a/usr/src/lib/libbc/libc/gen/common/clock.c b/usr/src/lib/libbc/libc/gen/common/clock.c deleted file mode 100644 index 9045962263..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/clock.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.1 */ - -/*LINTLIBRARY*/ - -#include <sys/types.h> -#include <sys/times.h> -#include <sys/param.h> /* for HZ (clock frequency in Hz) */ -#define TIMES(B) (B.tms_utime+B.tms_stime+B.tms_cutime+B.tms_cstime) - -extern long times(); -static long first; - -long -clock() -{ - struct tms buffer; - - if (times(&buffer) == -1L) - return (0L); - if (first == 0L) - first = TIMES(buffer); - return ((TIMES(buffer) - first) * (1000000L/HZ)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/closedir.c b/usr/src/lib/libbc/libc/gen/common/closedir.c deleted file mode 100644 index 5aa8c21e0c..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/closedir.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/param.h> -#include <dirent.h> - -/* - * close a directory. - */ -int -closedir(dirp) - register DIR *dirp; -{ - int fd; - extern void free(); - extern int close(); - - fd = dirp->dd_fd; - dirp->dd_fd = -1; - dirp->dd_loc = 0; - free(dirp->dd_buf); - free((char *)dirp); - return (close(fd)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/codeset.h b/usr/src/lib/libbc/libc/gen/common/codeset.h deleted file mode 100644 index 9199780307..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/codeset.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * codeset information - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef lint -/* static char *sccsid = "%Z%%M% %I% %E% SMI"; */ -#endif - -#include <stdio.h> -#define NAME_SIZE 14 /* Length of the code set name */ - -struct _code_header { - char code_name[NAME_SIZE+1]; /* code set name */ - int code_id; /* code set id */ - int code_info_size; /* size of code set info */ -}; - -struct _code_set_info { - char code_name[NAME_SIZE+1]; /* code set name */ - int code_id; /* code ID */ - char *code_info; /* code information */ - int open_flag; /* Am I open library ? */ -}; - -#define EUC_SET "euc" -#define XCCS_SET "xccs" -#define ISO2022_SET "iso2022" - -#define CODESET_NONE 0 -#define CODESET_EUC 2 -#define CODESET_XCCS 3 -#define CODESET_ISO2022 4 -#define CODESET_USER 100 - -#define ERROR -1 -#define ERROR_NO_LIB -2 /* dlopen failed */ -#define ERROR_NO_SYM -3 /* dlsym failed */ - -#ifdef DEBUG -#define LIBRARY_PATH "/tmp/" -#else -#define LIBRARY_PATH "/usr/lib/" -#endif - -void *_ml_open_library(); diff --git a/usr/src/lib/libbc/libc/gen/common/crypt.c b/usr/src/lib/libbc/libc/gen/common/crypt.c deleted file mode 100644 index 037b9527b4..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/crypt.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.3 */ - -/*LINTLIBRARY*/ -/* The real crypt is now _crypt. This version performs automatic - * authentication via pwauth for special password entries, or simply - * calls _crypt for the usual case. - */ - -char * -crypt(pw, salt) -char *pw, *salt; -{ - static char *iobuf; - extern char *_crypt(); - extern char *malloc(); - - if (iobuf == 0) { - iobuf = malloc((unsigned)16); - if (iobuf == 0) - return (0); - } - /* handle the case where the password is really in passwd.adjunct. - * In this case, the salt will start with "##". We should call - * passauth to determine if pw is valid. If so, we should return - * the salt, and otherwise return NULL. If salt does not start with - * "##", crypt will act in the normal fashion. - */ - if (salt[0] == '#' && salt[1] == '#') { - if (pwdauth(salt+2, pw) == 0) - strcpy(iobuf, salt); - else - iobuf[0] = '\0'; - return(iobuf); - } - /* handle the case where the password is really in group.adjunct. - * In this case, the salt will start with "#$". We should call - * grpauth to determine if pw is valid. If so, we should return - * the salt, and otherwise return NULL. If salt does not start with - * "#$", crypt will act in the normal fashion. - */ - if (salt[0] == '#' && salt[1] == '$') { - if (grpauth(salt+2, pw) == 0) - strcpy(iobuf, salt); - else - iobuf[0] = '\0'; - return(iobuf); - } - return (_crypt(pw, salt)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/ctime.c b/usr/src/lib/libbc/libc/gen/common/ctime.c deleted file mode 100644 index 4ff04654ae..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/ctime.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 1987 Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Arthur Olson. - * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by the University of California, Berkeley. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - - -#pragma ident "%Z%%M% %I% %E% SMI" - /* from Arthur Olson's 3.1 */ - -/*LINTLIBRARY*/ - -#include <sys/types.h> -#include <time.h> - -char * -ctime(timep) -time_t * timep; -{ - return asctime(localtime(timep)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/ctype_.c b/usr/src/lib/libbc/libc/gen/common/ctype_.c deleted file mode 100644 index a46c969f72..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/ctype_.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 4.2 83/07/08 */ - -#include <ctype.h> -#include <stdlib.h> - - -char _ctype_[] = { 0, - -/* 0 1 2 3 4 5 6 7 */ - -/* 0*/ _C, _C, _C, _C, _C, _C, _C, _C, -/* 10*/ _C, _S|_C, _S|_C, _S|_C, _S|_C, _S|_C, _C, _C, -/* 20*/ _C, _C, _C, _C, _C, _C, _C, _C, -/* 30*/ _C, _C, _C, _C, _C, _C, _C, _C, -/* 40*/ (char)(_S|_B), _P, _P, _P, _P, _P, _P, _P, -/* 50*/ _P, _P, _P, _P, _P, _P, _P, _P, -/* 60*/ _N|_X, _N|_X, _N|_X, _N|_X, _N|_X, _N|_X, _N|_X, _N|_X, -/* 70*/ _N|_X, _N|_X, _P, _P, _P, _P, _P, _P, -/*100*/ _P, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U, -/*110*/ _U, _U, _U, _U, _U, _U, _U, _U, -/*120*/ _U, _U, _U, _U, _U, _U, _U, _U, -/*130*/ _U, _U, _U, _P, _P, _P, _P, _P, -/*140*/ _P, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L, -/*150*/ _L, _L, _L, _L, _L, _L, _L, _L, -/*160*/ _L, _L, _L, _L, _L, _L, _L, _L, -/*170*/ _L, _L, _L, _P, _P, _P, _P, _C, -/*200*/ 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -unsigned int _mb_cur_max; - -/* Now we also supply the functions in libc as well as the macros in - * ctype.h - */ - -#undef isalpha -#undef isupper -#undef islower -#undef isdigit -#undef isxdigit -#undef isspace -#undef ispunct -#undef isalnum -#undef isprint -#undef isgraph -#undef iscntrl -#undef isascii -#undef toascii - -extern int mbtowc(); - -int isalpha(c) -register int c; -{ - return((_ctype_+1)[c]&(_U|_L)); -} - -int isupper(c) -register int c; -{ - return((_ctype_+1)[c]&_U); -} - -int islower(c) -register int c; -{ - return((_ctype_+1)[c]&_L); -} - -int isdigit(c) -register int c; -{ - return((_ctype_+1)[c]&_N); -} - -int isxdigit(c) -register int c; -{ - return((_ctype_+1)[c]&_X); -} - - -int isspace(c) -register int c; -{ - return((_ctype_+1)[c]&_S); -} - - -int ispunct(c) -register int c; -{ - return((_ctype_+1)[c]&_P); -} - - -int isalnum(c) -register int c; -{ - return((_ctype_+1)[c]&(_U|_L|_N)); -} - - -int isprint(c) -register int c; -{ - return((_ctype_+1)[c]&(_P|_U|_L|_N|_B)); -} - - -int isgraph(c) -register int c; -{ - return((_ctype_+1)[c]&(_P|_U|_L|_N)); -} - - -int iscntrl(c) -register int c; -{ - return((_ctype_+1)[c]&_C); -} - -int isascii(c) -register int c; -{ - return((unsigned)(c)<=0177); -} - -int toascii(c) -register int c; -{ - return((c)&0177); -} - diff --git a/usr/src/lib/libbc/libc/gen/common/decimal_bin.c b/usr/src/lib/libbc/libc/gen/common/decimal_bin.c deleted file mode 100644 index c398f592b7..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/decimal_bin.c +++ /dev/null @@ -1,694 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1988-1995, by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* Conversion between binary and decimal floating point. */ - -#include "base_conversion.h" - -void -decimal_to_binary_integer(ds, ndigs, nzeros, nsig, pb) - char ds[]; /* Input decimal integer string. */ -unsigned ndigs; /* Input number of explicit digits in ds. */ -unsigned nzeros; /* Input number of implicit trailing zeros. */ -unsigned nsig; /* Input number of significant bits required. */ -_big_float *pb; /* Pointer to big_float to receive result. */ - -/* - * Converts a decimal integer string ds with ndigs explicit leading digits - * and nzeros implicit trailing zeros to a _big_float **pb, which only - * requires nsig significand bits. - */ -/* Inexactness is indicated by pb->bsignificand[0] |= 1. */ -/* - * If the input is too big for a big_float, pb->bexponent is set to 0x7fff. - */ - -{ - unsigned nzout; - _big_float d, *pbout; - - d.bsize = _BIG_FLOAT_SIZE; - _integerstring_to_big_decimal(ds, ndigs, nzeros, &nzout, &d); - _big_decimal_to_big_binary(&d, pb); - if (nzout != 0) { - _big_float_times_power(pb, 10, (int) nzout, (int) nsig, &pbout); - switch ((unsigned int)pbout) { - case ((unsigned int)BIG_FLOAT_TIMES_TOOBIG): -#ifdef DEBUG - (void) printf(" decimal_to_binary_integer: decimal exponent %d too large for tables ", nzout); -#endif - pb->bexponent = 0x7fff; - break; - case ((unsigned int)BIG_FLOAT_TIMES_NOMEM): - { - char bcastring[80]; - - (void) sprintf(bcastring, " decimal exponent %d ", nzout); - _base_conversion_abort(ENOMEM, bcastring); - break; - } - default: -#ifdef DEBUG - if (pbout != pb) - (void) printf(" decimal_to_binary_integer: large decimal exponent %d needs heap buffer \n", nzout); - printf(" decimal_to_binary_integer: product "); - _display_big_float(pb, 2); -#endif - if (pbout != pb) { /* We don't really need such - * a large product; the - * target can't be more than - * a quad! */ - int i, allweneed; - - allweneed = 2 + (nsig + 2) / 16; - for (i = 0; i < allweneed; i++) - pb->bsignificand[i] = pbout->bsignificand[i + pbout->blength - allweneed]; - for (i = 0; (pbout->bsignificand[i] == 0); i++); - if (i < (pbout->blength - allweneed)) - pb->bsignificand[0] |= 1; /* Stick discarded bits. */ - - pb->blength = allweneed; - pb->bexponent = pbout->bexponent + 16 * (pbout->blength - allweneed); -#ifdef DEBUG - printf(" decimal_to_binary_integer: removed %d excess digits from product \n", pbout->blength - allweneed); - _display_big_float(pb, 2); -#endif - _free_big_float(pbout); - } - break; - } - } -} - -void -decimal_to_binary_fraction(ds, ndigs, nzeros, nsig, pb) - char ds[]; /* Decimal integer string input. */ -unsigned ndigs; /* Number of explicit digits to read. */ -unsigned nzeros; /* Number of implicit leading zeros before - * digits. */ -unsigned nsig; /* Number of significant bits needed. */ -_big_float *pb; /* Pointer to intended big_float result. */ - -/* - * Converts an explicit decimal string *ds[0]..*ds[ndigs-1] preceded by - * nzeros implicit leading zeros after the point into a big_float at *pb. If - * the input does not fit exactly in a big_float, the least significant bit - * of pbout->significand is stuck on. If the input is too big for the base - * conversion tables, pb->bexponent is set to 0x7fff. - */ - -{ - unsigned twopower, twosig; - int i, excess; - _big_float d, *pdout; - - d.bsize = _BIG_FLOAT_SIZE; - _fractionstring_to_big_decimal(ds, ndigs, nzeros, &d); - - twopower = nsig + 3 + (((nzeros + 1) * (unsigned long) 217706) >> 16); - twosig = 1 + (((nsig + 2) * (unsigned long) 19729) >> 16); - -#ifdef DEBUG - printf(" decimal_to_binary_fraction sigbits %d twopower %d twosig %d \n", - nsig, twopower, twosig); -#endif - _big_float_times_power(&d, 2, (int) twopower, (int) twosig, &pdout); - switch ((unsigned int)pdout) { - case ((unsigned int)BIG_FLOAT_TIMES_TOOBIG): -#ifdef DEBUG - (void) printf(" decimal_to_binary_fraction binary exponent %d too large for tables ", twopower); -#endif - pb->bexponent = 0x7fff; - goto ret; - case ((unsigned int)BIG_FLOAT_TIMES_NOMEM): - { - char bcastring[80]; - - (void) sprintf(bcastring, " binary exponent %d ", twopower); - _base_conversion_abort(ENOMEM, bcastring); - break; - } - default: -#ifdef DEBUG - if (&d != pdout) - printf(" decimal_to_binary_fraction large binary exponent %d needs heap buffer \n", twopower); - printf(" product "); - _display_big_float(pdout, 10); -#endif - break; - } - - - if (pdout->bexponent <= -4) { - /* Have computed appropriate decimal part; now toss fraction. */ - excess = (-pdout->bexponent) / 4; -#ifdef DEBUG - printf(" discard %d excess fraction digits \n", 4 * excess); -#endif - for (i = 0; (i < excess) && ((pdout)->bsignificand[i] == 0); i++); - if (i < excess) - (pdout)->bsignificand[excess] |= 1; /* Sticky bit for - * discarded fraction. */ - for (i = excess; i < (pdout)->blength; i++) - (pdout)->bsignificand[i - excess] = (pdout)->bsignificand[i]; - - (pdout)->blength -= excess; - (pdout)->bexponent += 4 * excess; - } - _big_decimal_to_big_binary(pdout, pb); - if (pdout != &d) - _free_big_float(pdout); - pb->bexponent = -twopower; - -ret: - return; -} - -void -decimal_to_unpacked(px, pd, significant_bits) - unpacked *px; - decimal_record *pd; - unsigned significant_bits; - -/* - * Converts *pd to *px so that *px can be correctly rounded. significant_bits - * tells how many bits will be significant in the final result to avoid - * superfluous computation. Inexactness is communicated by sticking on the - * lsb of px->significand[UNPACKED_SIZE-1]. Integer buffer overflow is - * indicated with a huge positive exponent. - */ - -{ - int frac_bits, sigint; - unsigned length, ndigs, ntz, nlz, ifrac, nfrac; - _big_float bi, bf, *ptounpacked = &bi; - - px->sign = pd->sign; - px->fpclass = pd->fpclass; - if ((px->fpclass != fp_normal) && (px->fpclass != fp_subnormal)) - goto ret; - for (length = 0; pd->ds[length] != 0; length++); - if (length == 0) { /* A zero significand slipped by. */ - px->fpclass = fp_zero; - goto ret; - } - /* Length contains the number of explicit digits in string. */ - if (pd->exponent >= 0) {/* All integer digits. */ - ndigs = length; - ntz = pd->exponent; /* Trailing zeros. */ - ifrac = 0; - nfrac = 0; /* No fraction digits. */ - nlz = 0; - } else if (length <= -pd->exponent) { /* No integer digits. */ - ndigs = 0; - ntz = 0; - ifrac = 0; - nfrac = length; - nlz = -pd->exponent - length; /* Leading zeros. */ - } else { /* Some integer digits, some fraction digits. */ - ndigs = length + pd->exponent; - ntz = 0; - ifrac = ndigs; - nfrac = -pd->exponent; - nlz = 0; - while ((pd->ds[ifrac] == '0') && (nfrac != 0)) { - ifrac++; - nfrac--; - nlz++; - } /* Remove leading zeros. */ - } - if (ndigs != 0) { /* Convert integer digits. */ - - bi.bsize = _BIG_FLOAT_SIZE; - decimal_to_binary_integer(pd->ds, ndigs, ntz, significant_bits, &bi); - if (bi.bexponent == 0x7fff) { /* Too big for buffer. */ - px->exponent = 0x000fffff; - px->significand[0] = 0x80000000; - goto ret; - } - sigint = 16 * (bi.blength + bi.bexponent - 1); - if (sigint < 0) - sigint = 0; - } else { /* No integer digits. */ - bi.blength = 0; - bi.bsignificand[0] = 0; - bi.bexponent = 0; - sigint = 0; - } - frac_bits = significant_bits - sigint + 2; - bf.blength = 0; - if ((nfrac != 0) && (frac_bits > 0)) { /* Convert fraction digits, - * even if we only need a - * round or sticky. */ - - bf.bsize = _BIG_FLOAT_SIZE; - decimal_to_binary_fraction(&(pd->ds[ifrac]), nfrac, nlz, (unsigned) frac_bits, &bf); - } else { /* Only need fraction bits for sticky. */ - if (nfrac != 0) - bi.bsignificand[0] |= 1; /* Stick for fraction. */ - } - if (bi.blength == 0) { /* No integer digits; all fraction. */ - if (bf.bexponent == 0x7fff) { /* Buffer overflowed. */ - px->exponent = -0x000fffff; - px->significand[0] = 0x80000000; - goto ret; - } - ptounpacked = &bf; /* Exceptional case - all fraction. */ - goto punpack; - } - if (bf.blength != 0) { /* Combine integer and fraction bits. */ - int expdiff = bi.bexponent - (bf.bexponent + 16 * (bf.blength - 1)); /* Exponent difference. */ - int uneeded = 2 + (significant_bits + 2) / 16; /* Number of big float - * digits needed. */ - int nmove, leftshift, i, if0; - -#ifdef DEBUG - printf(" bi+bf exponent diff is %d \n", expdiff); - printf(" need %d big float digits \n", uneeded); - assert(bi.blength != 0); - assert(bf.blength != 0); - assert(bi.bsignificand[bi.blength - 1] != 0); /* Normalized bi. */ - assert(bf.bsignificand[bf.blength - 1] != 0); /* Normalized bf. */ - assert(bi.bexponent >= 0); /* bi is all integer */ - assert(((-bf.bexponent - 16 * (bf.blength - 1)) >= 16) || - ((bf.bsignificand[bf.blength - 1] >> (-bf.bexponent - 16 * (bf.blength - 1))) == 0)); - /* assert either bf << 1 or bf < 1 */ - /* - * Assert that integer and fraction parts don't overlap by - * more than one big digit. - */ - assert(expdiff > 0); - assert(uneeded <= (2 * UNPACKED_SIZE)); -#endif - - - if (bi.blength >= uneeded) { /* bi will overflow unpacked, - * so bf is just a sticky. */ - bi.bsignificand[0] |= 1; - goto punpack; - } - leftshift = 16 - (expdiff % 16); - if (leftshift > 0) { /* shift bf to align with bi. */ - expdiff += 16 * bf.blength; - _left_shift_base_two(&bf, (short unsigned) leftshift); - expdiff -= 16 * bf.blength; /* If bf.blength is - * longer, adjust - * expdiff. */ - } - expdiff += leftshift; - expdiff /= 16; /* Remaining expdiff in _BIG_FLOAT_DIGITS. */ - expdiff--; -#ifdef DEBUG - assert(expdiff >= 0); /* expdiff is now equal to the size - * of the hole between bi and bf. */ -#endif - nmove = uneeded - bi.blength; - /* nmove is the number of words to add to bi. */ - if (nmove < 0) - nmove = 0; - if (nmove > (expdiff + bf.blength)) - nmove = (expdiff + bf.blength); -#ifdef DEBUG - printf(" increase bi by %d words to merge \n", nmove); -#endif - if (nmove == 0) - i = -1; - else - for (i = (bi.blength - 1 + nmove); i >= nmove; i--) - bi.bsignificand[i] = bi.bsignificand[i - nmove]; - for (; (i >= 0) && (expdiff > 0); i--) { /* Fill hole with zeros. */ - expdiff--; - bi.bsignificand[i] = 0; - } - if0 = i; - for (; i >= 0; i--) - bi.bsignificand[i] = bf.bsignificand[i + bf.blength - 1 - if0]; - for (i = (bf.blength - 2 - if0); bf.bsignificand[i] == 0; i--); - /* Find first non-zero. */ - if (i >= 0) - bi.bsignificand[0] |= 1; /* If non-zero found, - * stick it. */ - bi.blength += nmove; - bi.bexponent -= 16 * nmove; - goto punpack; - } -punpack: - ptounpacked->bsignificand[0] |= pd->more; /* Stick in any lost - * digits. */ - -#ifdef DEBUG - printf(" merged bi and bf: "); - _display_big_float(ptounpacked, 2); -#endif - - _big_binary_to_unpacked(ptounpacked, px); - -ret: - return; -} - -/* PUBLIC FUNCTIONS */ - -/* - * decimal_to_floating routines convert the decimal record at *pd to the - * floating type item at *px, observing the modes specified in *pm and - * setting exceptions in *ps. - * - * pd->sign and pd->fpclass are always taken into account. - * - * pd->exponent, pd->ds and pd->ndigits are used when pd->fpclass is - * fp_normal or fp_subnormal. In these cases pd->ds is expected to - * contain one or more ascii digits followed by a null and pd->ndigits - * is assumed to be the length of the string pd->ds. Notice that for - * efficiency reasons, the assumption that pd->ndigits == strlen(pd->ds) - * is NEVER verified. - * - * px is set to a correctly rounded approximation to - * (sign)*(ds)*10**(exponent) If pd->more != 0 then additional nonzero digits - * are assumed to follow those in ds; fp_inexact is set accordingly. - * - * Thus if pd->exponent == -2 and pd->ds = "1234", *px will get 12.34 rounded to - * storage precision. - * - * px is correctly rounded according to the IEEE rounding modes in pm->rd. *ps - * is set to contain fp_inexact, fp_underflow, or fp_overflow if any of these - * arise. - * - * pm->df and pm->ndigits are never used. - * - */ - -void -decimal_to_single(px, pm, pd, ps) - single *px; - decimal_mode *pm; - decimal_record *pd; - fp_exception_field_type *ps; -{ - single_equivalence kluge; - unpacked u; - - *ps = 0; /* Initialize to no floating-point - * exceptions. */ - kluge.f.msw.sign = pd->sign ? 1 : 0; - switch (pd->fpclass) { - case fp_zero: - kluge.f.msw.exponent = 0; - kluge.f.msw.significand = 0; - break; - case fp_infinity: - kluge.f.msw.exponent = 0xff; - kluge.f.msw.significand = 0; - break; - case fp_quiet: - kluge.f.msw.exponent = 0xff; - kluge.f.msw.significand = 0x7fffff; - break; - case fp_signaling: - kluge.f.msw.exponent = 0xff; - kluge.f.msw.significand = 0x3fffff; - break; - default: - if (pd->exponent > SINGLE_MAXE) { /* Guaranteed overflow. */ - u.sign = pd->sign == 0 ? 0 : 1; - u.fpclass = fp_normal; - u.exponent = 0x000fffff; - u.significand[0] = 0x80000000; - } else if (pd->exponent >= -SINGLE_MAXE) { /* Guaranteed in range. */ - goto inrange; - } else if (pd->exponent <= (-SINGLE_MAXE - DECIMAL_STRING_LENGTH)) { /* Guaranteed deep - * underflow. */ - goto underflow; - } else { /* Deep underflow possible, depending on - * string length. */ - int i; - - for (i = 0; (pd->ds[i] != 0) && (i < (-pd->exponent - SINGLE_MAXE)); i++); - if (i < (-pd->exponent - SINGLE_MAXE)) { /* Deep underflow */ - underflow: - u.sign = pd->sign == 0 ? 0 : 1; - u.fpclass = fp_normal; - u.exponent = -0x000fffff; - u.significand[0] = 0x80000000; - } else {/* In range. */ - inrange: - decimal_to_unpacked(&u, pd, 24); - } - } - _fp_current_exceptions = 0; - _fp_current_direction = pm->rd; - _pack_single(&u, &kluge.x); - *ps = _fp_current_exceptions; - } - *px = kluge.x; -} - -void -decimal_to_double(px, pm, pd, ps) - double *px; - decimal_mode *pm; - decimal_record *pd; - fp_exception_field_type *ps; -{ - double_equivalence kluge; - unpacked u; - - *ps = 0; /* Initialize to no floating-point - * exceptions. */ - kluge.f.msw.sign = pd->sign ? 1 : 0; - switch (pd->fpclass) { - case fp_zero: - kluge.f.msw.exponent = 0; - kluge.f.msw.significand = 0; - kluge.f.significand2 = 0; - break; - case fp_infinity: - kluge.f.msw.exponent = 0x7ff; - kluge.f.msw.significand = 0; - kluge.f.significand2 = 0; - break; - case fp_quiet: - kluge.f.msw.exponent = 0x7ff; - kluge.f.msw.significand = 0xfffff; - kluge.f.significand2 = 0xffffffff; - break; - case fp_signaling: - kluge.f.msw.exponent = 0x7ff; - kluge.f.msw.significand = 0x7ffff; - kluge.f.significand2 = 0xffffffff; - break; - default: - if (pd->exponent > DOUBLE_MAXE) { /* Guaranteed overflow. */ - u.sign = pd->sign == 0 ? 0 : 1; - u.fpclass = fp_normal; - u.exponent = 0x000fffff; - u.significand[0] = 0x80000000; - } else if (pd->exponent >= -DOUBLE_MAXE) { /* Guaranteed in range. */ - goto inrange; - } else if (pd->exponent <= (-DOUBLE_MAXE - DECIMAL_STRING_LENGTH)) { /* Guaranteed deep - * underflow. */ - goto underflow; - } else { /* Deep underflow possible, depending on - * string length. */ - int i; - - for (i = 0; (pd->ds[i] != 0) && (i < (-pd->exponent - DOUBLE_MAXE)); i++); - if (i < (-pd->exponent - DOUBLE_MAXE)) { /* Deep underflow */ - underflow: - u.sign = pd->sign == 0 ? 0 : 1; - u.fpclass = fp_normal; - u.exponent = -0x000fffff; - u.significand[0] = 0x80000000; - } else {/* In range. */ - inrange: - decimal_to_unpacked(&u, pd, 53); - } - } - _fp_current_exceptions = 0; - _fp_current_direction = pm->rd; - _pack_double(&u, &kluge.x); - *ps = _fp_current_exceptions; - } - *px = kluge.x; -} - -void -decimal_to_extended(px, pm, pd, ps) - extended *px; - decimal_mode *pm; - decimal_record *pd; - fp_exception_field_type *ps; -{ - extended_equivalence kluge; - unpacked u; - - *ps = 0; /* Initialize to no floating-point - * exceptions. */ - kluge.f.msw.sign = pd->sign ? 1 : 0; - switch (pd->fpclass) { - case fp_zero: - kluge.f.msw.exponent = 0; - kluge.f.significand = 0; - kluge.f.significand2 = 0; - break; - case fp_infinity: - kluge.f.msw.exponent = 0x7fff; - kluge.f.significand = 0; - kluge.f.significand2 = 0; - break; - case fp_quiet: - kluge.f.msw.exponent = 0x7fff; - kluge.f.significand = 0xffffffff; - kluge.f.significand2 = 0xffffffff; - break; - case fp_signaling: - kluge.f.msw.exponent = 0x7fff; - kluge.f.significand = 0x3fffffff; - kluge.f.significand2 = 0xffffffff; - break; - default: - if (pd->exponent > EXTENDED_MAXE) { /* Guaranteed overflow. */ - u.sign = pd->sign == 0 ? 0 : 1; - u.fpclass = fp_normal; - u.exponent = 0x000fffff; - u.significand[0] = 0x80000000; - } else if (pd->exponent >= -EXTENDED_MAXE) { /* Guaranteed in range. */ - goto inrange; - } else if (pd->exponent <= (-EXTENDED_MAXE - DECIMAL_STRING_LENGTH)) { /* Guaranteed deep - * underflow. */ - goto underflow; - } else { /* Deep underflow possible, depending on - * string length. */ - int i; - - for (i = 0; (pd->ds[i] != 0) && (i < (-pd->exponent - EXTENDED_MAXE)); i++); - if (i < (-pd->exponent - EXTENDED_MAXE)) { /* Deep underflow */ - underflow: - u.sign = pd->sign == 0 ? 0 : 1; - u.fpclass = fp_normal; - u.exponent = -0x000fffff; - u.significand[0] = 0x80000000; - } else {/* In range. */ - inrange: - decimal_to_unpacked(&u, pd, 64); - } - } - _fp_current_exceptions = 0; - _fp_current_direction = pm->rd; - _fp_current_precision = fp_extended; - _pack_extended(&u, px); - *ps = _fp_current_exceptions; - return; - } - (*px)[0] = kluge.x[0]; - (*px)[1] = kluge.x[1]; - (*px)[2] = kluge.x[2]; -} - -void -decimal_to_quadruple(px, pm, pd, ps) - quadruple *px; - decimal_mode *pm; - decimal_record *pd; - fp_exception_field_type *ps; -{ - quadruple_equivalence kluge; - unpacked u; - int i; - - *ps = 0; /* Initialize to no floating-point - * exceptions. */ - kluge.f.msw.sign = pd->sign ? 1 : 0; - switch (pd->fpclass) { - case fp_zero: - kluge.f.msw.exponent = 0; - kluge.f.msw.significand = 0; - kluge.f.significand2 = 0; - kluge.f.significand3 = 0; - kluge.f.significand4 = 0; - break; - case fp_infinity: - kluge.f.msw.exponent = 0x7fff; - kluge.f.msw.significand = 0; - kluge.f.significand2 = 0; - kluge.f.significand3 = 0; - kluge.f.significand4 = 0; - break; - case fp_quiet: - kluge.f.msw.exponent = 0x7fff; - kluge.f.msw.significand = 0xffff; - kluge.f.significand2 = 0xffffffff; - kluge.f.significand3 = 0xffffffff; - kluge.f.significand4 = 0xffffffff; - break; - case fp_signaling: - kluge.f.msw.exponent = 0x7fff; - kluge.f.msw.significand = 0x7fff; - kluge.f.significand2 = 0xffffffff; - kluge.f.significand3 = 0xffffffff; - kluge.f.significand4 = 0xffffffff; - break; - default: - if (pd->exponent > QUAD_MAXE) { /* Guaranteed overflow. */ - u.sign = pd->sign == 0 ? 0 : 1; - u.fpclass = fp_normal; - u.exponent = 0x000fffff; - u.significand[0] = 0x80000000; - } else if (pd->exponent >= -QUAD_MAXE) { /* Guaranteed in range. */ - goto inrange; - } else if (pd->exponent <= (-QUAD_MAXE - DECIMAL_STRING_LENGTH)) { /* Guaranteed deep - * underflow. */ - goto underflow; - } else { /* Deep underflow possible, depending on - * string length. */ - - for (i = 0; (pd->ds[i] != 0) && (i < (-pd->exponent - QUAD_MAXE)); i++); - if (i < (-pd->exponent - QUAD_MAXE)) { /* Deep underflow */ - underflow: - u.sign = pd->sign == 0 ? 0 : 1; - u.fpclass = fp_normal; - u.exponent = -0x000fffff; - u.significand[0] = 0x80000000; - } else {/* In range. */ - inrange: - decimal_to_unpacked(&u, pd, 113); - } - } - _fp_current_exceptions = 0; - _fp_current_direction = pm->rd; - _pack_quadruple(&u, px); - *ps = _fp_current_exceptions; - return; - } -#ifdef __STDC__ - *px = kluge.x; -#else - for (i = 0; i < 4; i++) - px->u[i] = kluge.x.u[i]; -#endif -} diff --git a/usr/src/lib/libbc/libc/gen/common/double_decim.c b/usr/src/lib/libbc/libc/gen/common/double_decim.c deleted file mode 100644 index 53be17331b..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/double_decim.c +++ /dev/null @@ -1,697 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* Conversion between binary and decimal floating point. */ - -#include "base_conversion.h" - -/* PRIVATE FUNCTIONS */ - -/* - * Rounds decimal record *pd according to modes in *pm, recording exceptions - * for inexact or overflow in *ps. round is the round digit and sticky is 0 - * or non-zero to indicate exact or inexact. pd->ndigits is expected to be - * correctly set. - */ -void -decimal_round(decimal_mode *pm, decimal_record *pd, fp_exception_field_type *ps, - char round, unsigned sticky) -{ - int lsd, i; - - if ((round == '0') && (sticky == 0)) { /* Exact. */ - goto done; - } - *ps |= 1 << fp_inexact; - - switch (pm->rd) { - case fp_nearest: - if (round < '5') - goto done; - if (round > '5') - goto roundup; - if (sticky != 0) - goto roundup; - /* Now in ambiguous case; round up if lsd is odd. */ - if (pd->ndigits <= 0) - goto done; /* Presumed 0. */ - lsd = pd->ds[pd->ndigits - 1] - '0'; - if ((lsd % 2) == 0) - goto done; - goto roundup; - case fp_positive: - if (pd->sign != 0) - goto done; - goto roundup; - case fp_negative: - if (pd->sign == 0) - goto done; - goto roundup; - case fp_tozero: - goto done; - } -roundup: - for (i = (pd->ndigits - 1); (pd->ds[i] == '9') && (i >= 0); i--) - pd->ds[i] = '0'; - if (i >= 0) - (pd->ds[i])++; - else { /* Rounding carry out has occurred. */ - pd->ds[0] = '1'; - if (pm->df == floating_form) { /* For E format, simply - * adjust exponent. */ - pd->exponent++; - } else { /* For F format, increase length of string. */ - if (pd->ndigits > 0) - pd->ds[pd->ndigits] = '0'; - pd->ndigits++; - } - } - goto ret; -done: - if (pd->ndigits <= 0) { /* Create zero string. */ - pd->ds[0] = '0'; - pd->ndigits = 1; - } -ret: - pd->ds[pd->ndigits] = 0;/* Terminate string. */ - return; -} - -/* - * Converts an unpacked integer value *pu into a decimal string in *ds, of - * length returned in *ndigs. Inexactness is indicated by setting - * ds[ndigs-1] odd. - * - * Arguments - * pu: Input unpacked integer value input. - * nsig: Input number of significant digits required. - * ds: Output decimal integer string output - * must be large enough. - * nzeros: Output number of implicit trailing zeros - * produced. - * ndigs: Output number of explicit digits produced - * in ds. - */ -void -binary_to_decimal_integer(unpacked *pu, unsigned nsig, char ds[], - unsigned *nzeros, unsigned *ndigs) -{ - - _big_float *pd, b, d; - int e, i, is; - _BIG_FLOAT_DIGIT stickyshift; - char s[4]; - - b.bsize = _BIG_FLOAT_SIZE; /* Initialize sizes of big floats. */ - d.bsize = _BIG_FLOAT_SIZE; - _unpacked_to_big_float(pu, &b, &e); - if (e < 0) { - _right_shift_base_two(&b, (short unsigned) -e, &stickyshift); -#ifdef DEBUG - assert(stickyshift == 0); -#endif - } - _big_binary_to_big_decimal(&b, &d); - if (e <= 0) - pd = &d; - else { - _big_float_times_power(&d, 2, e, (int) nsig, &pd); - switch ((unsigned int)pd) { - case ((unsigned int)BIG_FLOAT_TIMES_TOOBIG): - { - char bcastring[80]; - - (void) sprintf(bcastring, " binary exponent %d ", e); - _base_conversion_abort(ERANGE, bcastring); - break; - } - case ((unsigned int)BIG_FLOAT_TIMES_NOMEM): - { - char bcastring[80]; - - (void) sprintf(bcastring, " binary exponent %d ", e); - _base_conversion_abort(ENOMEM, bcastring); - break; - } - default: -#ifdef DEBUG - if (pd != &d) - (void) printf(" large binary exponent %d needs heap buffer \n", e); - printf(" product "); - _display_big_float(pd, 10); -#endif - break; - } - } - _fourdigitsquick((short unsigned) pd->bsignificand[pd->blength - 1], s); - for (i = 0; s[i] == '0'; i++); /* Find first non-zero digit. */ - for (is = 0; i <= 3;) - ds[is++] = s[i++]; /* Copy subsequent digits. */ - - for (i = (pd->blength - 2); i >= 0; i--) { /* Convert powers of - * 10**4 to decimal - * digits. */ - _fourdigitsquick((short unsigned) pd->bsignificand[i], &(ds[is])); - is += 4; - } - - ds[is] = 0; - *ndigs = is; - *nzeros = pd->bexponent; - if (pd != &d) - _free_big_float(pd); - -#ifdef DEBUG - printf(" binary to decimal integer result %s * 10**%d \n", ds, *nzeros); -#endif -} - -/* - * Converts an unpacked fraction value *pu into a decimal string consisting - * of a) an implicit '.' b) *nzeros implicit leading zeros c) *ndigs explicit - * digits in ds ds contains at least nsig significant digits. nzeros + * - * *ndigs is at least nfrac digits after the point. Inexactness is indicated - * by sticking to the lsb. - * - * Arguments - * - * pu: Input unpacked fraction value output < 1 - * in magnitude. - * nsig: Input number of significant digits - * required. - * nfrac: Input number of digits after point - * required. - * ds: Output decimal integer string output - - * must be large enough. - * nzeros: Output number of implicit leading zeros - * produced. - * ndigs: Output number of explicit digits produced - * in ds. - */ - void -binary_to_decimal_fraction(unpacked *pu, unsigned nsig, unsigned nfrac, - char ds[], int *nzeros, int *ndigs) -{ - _big_float *pb, b, d; - int e, i, j, is, excess; - char s[4]; - int tensig, tenpower; - _BIG_FLOAT_DIGIT stickyshift; - - *nzeros = 0; - if (pu->fpclass == fp_zero) { /* Exact zero. */ - for (i = 0; i <= nfrac; i++) - ds[i] = '0'; - for (; i <= nsig; i++) - ds[i] = '0'; - *ndigs = i; - return; - } - b.bsize = _BIG_FLOAT_SIZE; /* Initialize sizes of big floats. */ - d.bsize = _BIG_FLOAT_SIZE; - _unpacked_to_big_float(pu, &b, &e); - /* - * e < 0 always - */ - b.bexponent = e; - tenpower = nsig + (int) (((17 - e - 16 * b.blength) * (unsigned long) 19729) >> 16); - if (tenpower < nfrac) - tenpower = nfrac; - tensig = nfrac; - if (nsig > tensig) - tensig = nsig; - tensig = 1 + (((tensig + 2) * 217706) >> 16); - tensig = -tensig; - -#ifdef DEBUG - printf(" binary to decimal fraction exponent 2**%d \n", e); - printf(" binary to decimal fraction nsig %d nfrac %d tenpower %d tensig %d \n", nsig, nfrac, tenpower, tensig); -#endif - _big_float_times_power(&b, 10, tenpower, tensig, &pb); - switch ((unsigned int)pb) { - case ((unsigned int)BIG_FLOAT_TIMES_TOOBIG): - { - char bcastring[80]; - - (void) sprintf(bcastring, " decimal exponent %d ", tenpower); - _base_conversion_abort(ERANGE, bcastring); - break; - } - case ((unsigned int)BIG_FLOAT_TIMES_NOMEM): - { - char bcastring[80]; - - (void) sprintf(bcastring, " decimal exponent %d ", tenpower); - _base_conversion_abort(ENOMEM, bcastring); - break; - } - default: -#ifdef DEBUG - if (pb != &b) - printf(" large decimal exponent %d needs heap buffer \n", tenpower); - printf(" product "); - _display_big_float(pb, 2); -#endif - break; - } - - if (pb->bexponent <= -16) { - /* Have computed appropriate decimal part; now toss fraction. */ - excess = (-pb->bexponent) / 16; -#ifdef DEBUG - printf(" discard %d excess fraction bits \n", 16 * excess); -#endif - for (i = 0; (i < excess) && (pb->bsignificand[i] == 0); i++); - if (i < excess) - pb->bsignificand[excess] |= 1; /* Sticky bit for - * discarded fraction. */ - for (i = excess; i < pb->blength; i++) - pb->bsignificand[i - excess] = pb->bsignificand[i]; - - pb->blength -= excess; - pb->bexponent += 16 * excess; - } - if (pb->bexponent < 0) { - _right_shift_base_two(pb, (short unsigned) -pb->bexponent, &stickyshift); - if (stickyshift != 0) - pb->bsignificand[0] |= 1; /* Stick to lsb. */ - } - _big_binary_to_big_decimal(pb, &d); - - i = d.blength - 1; - while (d.bsignificand[i] == 0) - i--; - _fourdigitsquick((short unsigned) d.bsignificand[i], s); - for (j = 0; s[j] == '0'; j++); /* Find first non-zero digit. */ - for (is = 0; j <= 3;) - ds[is++] = s[j++]; /* Copy subsequent digits. */ - - for (i--; i >= 0; i--) {/* Convert powers of 10**4 to decimal digits. */ - _fourdigitsquick((short unsigned) d.bsignificand[i], &(ds[is])); - is += 4; - } - - ds[is] = 0; - *ndigs = is; -#ifdef DEBUG - assert(tenpower >= is); -#endif - *nzeros = tenpower - is;/* There were supposed to be tenpower leading - * digits, and is were found. */ - - if (pb != &b) - _free_big_float(pb); - -#ifdef DEBUG - printf(" binary to decimal fraction result .%s * 10**%d \n", ds, -(*nzeros)); -#endif - -} - -void -_unpacked_to_decimal(unpacked *px, decimal_mode *pm, decimal_record *pd, - fp_exception_field_type *ps) -{ - unpacked fx, ix; - unsigned fmask, imask; - int i, intdigs, fracdigs, fraczeros, fracsigs, ids, idsbound, lzbound; - unsigned nsig, nfrac, intzeros, intsigs; - char is[_INTEGER_SIZE], fs[DECIMAL_STRING_LENGTH]; - char round = '0'; - unsigned sticky = 0; - - pd->sign = px->sign; - pd->fpclass = px->fpclass; - if ((px->fpclass != fp_normal) && (px->fpclass != fp_subnormal)) - return; - if ((pm->ndigits >= DECIMAL_STRING_LENGTH) || - ((pm->df == floating_form) && (pm->ndigits < 1))) { /* Gross overflow or bad - * spec. */ -overflow: - *ps |= 1 << fp_overflow; - return; - } - /* Divide x up into integer part ix and fraction part fx. */ - - ix = *px; - fx = ix; - if (ix.exponent <= -1) {/* All fraction. */ - ix.fpclass = fp_zero; - } else if (ix.exponent >= 159) { /* All integer. */ - fx.fpclass = fp_zero; - } else if ((ix.exponent % 32) == 31) { /* Integer/fraction boundary - * is conveniently on a word - * boundary. */ - imask = (ix.exponent + 1) / 32; /* Words 0..imask-1 are - * integer; imask..SIZE are - * fraction. */ - for (i = 0; i < imask; i++) - fx.significand[i] = 0; - for (; i < UNPACKED_SIZE; i++) - ix.significand[i] = 0; - _fp_normalize(&fx); - } else { /* Integer/fraction boundary falls in the - * middle of a word. */ - imask = (ix.exponent + 1) / 32; /* Words 0..imask-1 are - * integer; imask is integer - * and fraction ; - * imask+1..SIZE are - * fraction. */ - for (i = 0; i < imask; i++) - fx.significand[i] = 0; - fmask = (1 << (31 - (ix.exponent % 32))) - 1; - fx.significand[imask] &= fmask; - ix.significand[imask] &= ~fmask; - for (i = (imask + 1); i < UNPACKED_SIZE; i++) - ix.significand[i] = 0; - _fp_normalize(&fx); - } - if (ix.fpclass != fp_zero) { /* Compute integer part of result. */ - if (pm->df == floating_form) - nsig = pm->ndigits + 1; /* Significant digits wanted - * for E format, plus one for - * rounding. */ - else - nsig = _INTEGER_SIZE; /* Significant digits wanted - * for F format == all. */ - - binary_to_decimal_integer(&ix, nsig, is, &intzeros, &intsigs); - } else { - intsigs = 0; - intzeros = 0; - } - intdigs = intsigs + intzeros; - fracdigs = 0; - if (((pm->df == fixed_form) && (pm->ndigits >= 0)) || - ((pm->df == floating_form) && ((pm->ndigits + 1) > intdigs))) { /* Need to compute - * fraction part. */ - if (pm->df == floating_form) { /* Need more significant - * digits. */ - nsig = pm->ndigits + 2 - intdigs; /* Add two for rounding, - * sticky. */ - if (nsig > DECIMAL_STRING_LENGTH) - nsig = DECIMAL_STRING_LENGTH; - nfrac = 1; - } else { /* Need fraction digits. */ - nsig = 0; - nfrac = pm->ndigits + 2; /* Add two for rounding, - * sticky. */ - if (nfrac > DECIMAL_STRING_LENGTH) - nfrac = DECIMAL_STRING_LENGTH; - } - binary_to_decimal_fraction(&fx, nsig, nfrac, fs, &fraczeros, &fracsigs); - fracdigs = fraczeros + fracsigs; - } - if (pm->df == floating_form) { /* Combine integer and fraction for E - * format. */ - idsbound = intsigs; - if (idsbound > pm->ndigits) - idsbound = pm->ndigits; - for (ids = 0; ids < idsbound; ids++) - pd->ds[ids] = is[ids]; - /* Put integer into output string. */ - idsbound = intsigs + intzeros; - if (idsbound > pm->ndigits) - idsbound = pm->ndigits; - for (; ids < idsbound; ids++) - pd->ds[ids] = '0'; - if (ids == pm->ndigits) { /* Integer part had enough - * significant digits. */ - pd->ndigits = ids; - pd->exponent = intdigs - ids; - if (ids < intdigs) { /* Gather rounding info. */ - if (ids < intsigs) - round = is[ids++]; - else - round = '0'; - for (; (is[ids] == '0') && (ids < intsigs); ids++); - if (ids < intsigs) - sticky = 1; - if (fx.fpclass != fp_zero) - sticky = 1; - } else {/* Integer part is exact - round from - * fraction. */ - if (fx.fpclass != fp_zero) { - int stickystart; - /* Fraction non-zero. */ - if (fraczeros > 0) { /* Round digit is zero. */ - round = '0'; - stickystart = 0; /* Stickies start with - * fs[0]. */ - } else { /* Round digit is fs[0]. */ - round = fs[0]; - stickystart = 1; /* Stickies start with - * fs[1]. */ - } - if (sticky == 0) { /* Search for sticky - * bits. */ - for (ids = stickystart; (fs[ids] == '0') && (ids < fracdigs); ids++); - if (ids < fracdigs) - sticky = 1; - } - } - } - } else { /* Need more significant digits from fraction - * part. */ - idsbound = pm->ndigits - ids; - if (ids == 0) { /* No integer part - find first - * significant digit. */ - for (i = 0; fs[i] == '0'; i++); - idsbound = i + idsbound + fraczeros; - i += fraczeros; /* Point i at first - * significant digit. */ - } else - i = 0; - if (idsbound > fracdigs) - idsbound = fracdigs; - pd->exponent = -idsbound; - - if (fraczeros < idsbound) /* Compute number of - * leading zeros - * required. */ - lzbound = fraczeros; - else - lzbound = idsbound; - for (; (i < lzbound); i++) - pd->ds[ids++] = '0'; - for (; (i < idsbound); i++) - pd->ds[ids++] = fs[i - fraczeros]; - i -= fraczeros; /* Don't worry about leading zeros - * from now on, we're just rounding */ - if (i < fracsigs) { /* Gather rounding info. */ - if (i < 0) - round = '0'; - else - round = fs[i]; - i++; - if (sticky == 0) { /* Find out if remainder - * is exact. */ - if (i < 0) - i = 0; - for (; (fs[i] == '0') && (i < fracsigs); i++); - if (i < fracsigs) - sticky = 1; - } - } else {/* Fraction part is exact - add zero digits - * if required. */ - for (; ids < pm->ndigits; ids++) - pd->ds[ids] = '0'; - } - pd->ndigits = ids; - } - decimal_round(pm, pd, ps, round, sticky); - } else { /* Combine integer and fraction for F format. */ - if (pm->ndigits >= 0) { /* Normal F format. */ - if ((intdigs + pm->ndigits) >= DECIMAL_STRING_LENGTH) - goto overflow; - for (ids = 0; ids < intsigs; ids++) - pd->ds[ids] = is[ids]; - for (; ids < intdigs; ids++) - pd->ds[ids] = '0'; - /* Copy integer digits. */ - idsbound = fracdigs; - if (idsbound > pm->ndigits) - idsbound = pm->ndigits; - if (fraczeros < idsbound) /* Compute number of - * leading zeros - * required. */ - lzbound = fraczeros; - else - lzbound = idsbound; - for (i = 0; (i < lzbound); i++) - pd->ds[ids++] = '0'; - for (; (i < idsbound); i++) - pd->ds[ids++] = fs[i - fraczeros]; /* Copy fraction digits. */ - for (; i < pm->ndigits; i++) - pd->ds[ids++] = '0'; - /* Copy trailing zeros if necessary. */ - pd->ndigits = ids; - pd->exponent = intdigs - ids; - i -= fraczeros; /* Don't worry about leading zeros - * from now on, we're just rounding */ - if (i < fracsigs) { /* Gather rounding info. */ - if (i < 0) - round = '0'; - else - round = fs[i]; - i++; - if (sticky == 0) { /* Find out if remainder - * is exact. */ - if (i < 0) - i = 0; - for (; (fs[i] == '0') && (i < fracsigs); i++); - if (i < fracsigs) - sticky = 1; - } - } - decimal_round(pm, pd, ps, round, sticky); - } else { /* Bizarre F format - round to left of point. */ - int roundpos = -pm->ndigits; - - if (intdigs >= DECIMAL_STRING_LENGTH) - goto overflow; - if (roundpos >= DECIMAL_STRING_LENGTH) - goto overflow; - if (intdigs <= roundpos) { /* Not enough integer - * digits. */ - if (intdigs == roundpos) { - round = is[0]; - i = 1; - } else { - round = '0'; - i = 0; - } - for (; (is[i] == '0') && (i < intsigs); i++); - /* Search for sticky bits. */ - if (i < intsigs) - sticky = 1; - pd->ndigits = 0; - } else {/* Some integer digits do not get rounded - * away. */ -#ifdef _NO_GOOD - for (ids = 0; ids < (intsigs - roundpos); ids++) - pd->ds[ids] = is[ids]; - for (ids = 0; ids < (intdigs - roundpos); ids++) - pd->ds[ids] = '0'; -#else - { - int ncopy = intsigs - roundpos; - if (ncopy > 0) { - /* Copy integer digits. */ - (void) memcpy(&(pd->ds[0]), &(is[0]), ncopy); - ids = ncopy; - } - } - { - int ncopy = intdigs - roundpos - ids ; - if (ncopy > 0) { - (void) memset(&(pd->ds[ids]), '0', ncopy); - ids += ncopy; - } - } -#endif /* _NO_GOOD */ - /* Copy integer digits. */ - pd->ndigits = ids; - if (ids < intsigs) { /* Inexact. */ - round = is[ids++]; - for (; (is[ids] == '0') && (ids < intsigs); ids++); - /* Search for non-zero digits. */ - if (ids < intsigs) - sticky = 1; - } - } - if (fx.fpclass != fp_zero) - sticky = 1; - decimal_round(pm, pd, ps, round, sticky); - for (i = pd->ndigits; i < (pd->ndigits + roundpos); i++) - pd->ds[i] = '0'; /* Blank out rounded - * away digits. */ - pd->exponent = 0; - pd->ndigits = i; - pd->ds[i] = 0; /* Terminate string. */ - } - } -} - -void -double_to_decimal(double *px, decimal_mode *pm, decimal_record *pd, - fp_exception_field_type *ps) -{ - double_equivalence kluge; - unpacked u; - - *ps = 0; /* Initialize *ps. */ - kluge.x = *px; - pd->sign = kluge.f.msw.sign; - pd->fpclass = _class_double(px); - switch (pd->fpclass) { - case fp_zero: - break; - case fp_infinity: - break; - case fp_quiet: - break; - case fp_signaling: - break; - default: - _unpack_double(&u, &kluge.x); - _unpacked_to_decimal(&u, pm, pd, ps); - } -} - -void -quadruple_to_decimal(quadruple *px, decimal_mode *pm, decimal_record *pd, - fp_exception_field_type *ps) -{ - quadruple_equivalence kluge; - unpacked u; - int i; - - *ps = 0; /* Initialize *ps - no exceptions. */ - for (i = 0; i < 4; i++) -#ifdef __STDC__ - kluge.x = *px; -#else - kluge.x.u[i] = px->u[i]; -#endif - pd->sign = kluge.f.msw.sign; - pd->fpclass = _class_quadruple(px); - switch (pd->fpclass) { - case fp_zero: - break; - case fp_infinity: - break; - case fp_quiet: - break; - case fp_signaling: - break; - default: - _unpack_quadruple(&u, px); - _unpacked_to_decimal(&u, pm, pd, ps); - } -} diff --git a/usr/src/lib/libbc/libc/gen/common/drand48.c b/usr/src/lib/libbc/libc/gen/common/drand48.c deleted file mode 100644 index 13d0895991..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/drand48.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1996 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -/* - * drand48, etc. pseudo-random number generator - * This implementation assumes unsigned short integers of at least - * 16 bits, long integers of at least 32 bits, and ignores - * overflows on adding or multiplying two unsigned integers. - * Two's-complement representation is assumed in a few places. - * Some extra masking is done if unsigneds are exactly 16 bits - * or longs are exactly 32 bits, but so what? - * An assembly-language implementation would run significantly faster. - */ -#define N 16 -#define MASK ((unsigned)(1 << (N - 1)) + (1 << (N - 1)) - 1) -#define LOW(x) ((unsigned)(x) & MASK) -#define HIGH(x) LOW((x) >> N) -#define MUL(x, y, z) { long l = (long)(x) * (long)(y); \ - (z)[0] = LOW(l); (z)[1] = HIGH(l); } -#define CARRY(x, y) ((long)(x) + (long)(y) > MASK) -#define ADDEQU(x, y, z) (z = CARRY(x, (y)), x = LOW(x + (y))) -#define X0 0x330E -#define X1 0xABCD -#define X2 0x1234 -#define A0 0xE66D -#define A1 0xDEEC -#define A2 0x5 -#define C 0xB -#define SET3(x, x0, x1, x2) ((x)[0] = (x0), (x)[1] = (x1), (x)[2] = (x2)) -#define SETLOW(x, y, n) SET3(x, LOW((y)[n]), LOW((y)[(n)+1]), LOW((y)[(n)+2])) -#define SEED(x0, x1, x2) (SET3(x, x0, x1, x2), SET3(a, A0, A1, A2), c = C) -#define REST(v) \ - for (i = 0; i < 3; i++) { \ - xsubi[i] = x[i]; \ - x[i] = temp[i]; \ - } \ - return (v) - -#define NEST(TYPE, f, F) \ - TYPE f(xsubi) \ - register unsigned short *xsubi; \ - { \ - register int i; \ - register TYPE v; \ - unsigned temp[3]; \ - \ - for (i = 0; i < 3; i++) { \ - temp[i] = x[i]; \ - x[i] = LOW(xsubi[i]); \ - } \ - v = F(); \ - REST(v); \ - } - -static unsigned x[3] = { X0, X1, X2 }, a[3] = { A0, A1, A2 }, c = C; -static unsigned short lastx[3]; -static void next(); - -double -drand48() -{ - static double two16m = 1.0 / (1L << N); - - next(); - return (two16m * (two16m * (two16m * x[0] + x[1]) + x[2])); -} - -NEST(double, erand48, drand48) - -long -lrand48() -{ - next(); - return (((long)x[2] << (N - 1)) + (x[1] >> 1)); -} - -long -mrand48() -{ - next(); - return (((long)x[2] << N) + x[1]); -} - -static void -next() -{ - unsigned p[2], q[2], r[2], carry0, carry1; - - MUL(a[0], x[0], p); - ADDEQU(p[0], c, carry0); - ADDEQU(p[1], carry0, carry1); - MUL(a[0], x[1], q); - ADDEQU(p[1], q[0], carry0); - MUL(a[1], x[0], r); - x[2] = LOW(carry0 + carry1 + CARRY(p[1], r[0]) + q[1] + r[1] + - a[0] * x[2] + a[1] * x[1] + a[2] * x[0]); - x[1] = LOW(p[1] + r[0]); - x[0] = LOW(p[0]); -} - -void -srand48(seedval) -long seedval; -{ - SEED(X0, LOW(seedval), HIGH(seedval)); -} - -unsigned short * -seed48(seed16v) -unsigned short seed16v[3]; -{ - SETLOW(lastx, x, 0); - SEED(LOW(seed16v[0]), LOW(seed16v[1]), LOW(seed16v[2])); - return (lastx); -} - -void -lcong48(param) -unsigned short param[7]; -{ - SETLOW(x, param, 0); - SETLOW(a, param, 3); - c = LOW(param[6]); -} - -NEST(long, nrand48, lrand48) - -NEST(long, jrand48, mrand48) - -#ifdef DRIVER -/* - * This should print the sequences of integers in Tables 2 - * and 1 of the TM: - * 1623, 3442, 1447, 1829, 1305, ... - * 657EB7255101, D72A0C966378, 5A743C062A23, ... - */ -#include <stdio.h> - -main() -{ - int i; - - for (i = 0; i < 80; i++) { - printf("%4d ", (int)(4096 * drand48())); - printf("%.4X%.4X%.4X\n", x[2], x[1], x[0]); - } -} -#endif diff --git a/usr/src/lib/libbc/libc/gen/common/dysize.c b/usr/src/lib/libbc/libc/gen/common/dysize.c deleted file mode 100644 index 98d8c1b10e..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/dysize.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ - -#include <tzfile.h> - -int -dysize(int y) -{ - /* - * The 4.[0123]BSD version of dysize behaves as if the return statement - * below read - * return ((y % 4) == 0) ? DAYS_PER_LYEAR : DAYS_PER_NYEAR; - * but since we'd rather be right than (strictly) compatible. . . - */ - return (isleap(y) ? DAYS_PER_LYEAR : DAYS_PER_NYEAR); -} diff --git a/usr/src/lib/libbc/libc/gen/common/econvert.c b/usr/src/lib/libbc/libc/gen/common/econvert.c deleted file mode 100644 index a82ad20f61..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/econvert.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -#include "base_conversion.h" - -static char *nanstring = "NaN"; -static char *infstring = "Infinity"; - -char * -econvert(arg, ndigits, decpt, sign, buf) - double arg; - int ndigits, *decpt, *sign; - char *buf; -{ - decimal_mode dm; - decimal_record dr; - fp_exception_field_type ef; - int i; - char *pc; - int nc; - - dm.rd = fp_direction; /* Rounding direction. */ - dm.df = floating_form; /* E format. */ - dm.ndigits = ndigits; /* Number of significant digits. */ - double_to_decimal(&arg, &dm, &dr, &ef); - *sign = dr.sign; - switch (dr.fpclass) { - case fp_normal: - case fp_subnormal: - *decpt = dr.exponent + ndigits; - for (i = 0; i < ndigits; i++) - buf[i] = dr.ds[i]; - buf[ndigits] = 0; - break; - case fp_zero: - *decpt = 1; - for (i = 0; i < ndigits; i++) - buf[i] = '0'; - buf[ndigits] = 0; - break; - case fp_infinity: - *decpt = 0; - pc = infstring; - if (ndigits < 8) - nc = 3; - else - nc = 8; - goto movestring; - case fp_quiet: - case fp_signaling: - *decpt = 0; - pc = nanstring; - nc = 3; -movestring: - for (i = 0; i < nc; i++) - buf[i] = pc[i]; - buf[nc] = 0; - break; - } - return buf; /* For compatibility with ecvt. */ -} - -char * -fconvert(arg, ndigits, decpt, sign, buf) - double arg; - int ndigits, *decpt, *sign; - char *buf; -{ - decimal_mode dm; - decimal_record dr; - fp_exception_field_type ef; - int i; - char *pc; - int nc; - - dm.rd = fp_direction; /* Rounding direction. */ - dm.df = fixed_form; /* F format. */ - dm.ndigits = ndigits; /* Number of digits after point. */ - double_to_decimal(&arg, &dm, &dr, &ef); - *sign = dr.sign; - switch (dr.fpclass) { - case fp_normal: - case fp_subnormal: - if (ndigits >= 0) - *decpt = dr.ndigits - ndigits; - else - *decpt = dr.ndigits; - for (i = 0; i < dr.ndigits; i++) - buf[i] = dr.ds[i]; - buf[dr.ndigits] = 0; - break; - case fp_zero: - *decpt = 0; - buf[0] = '0'; - for (i = 1; i < ndigits; i++) - buf[i] = '0'; - buf[i] = 0; - break; - case fp_infinity: - *decpt = 0; - pc = infstring; - if (ndigits < 8) - nc = 3; - else - nc = 8; - goto movestring; - case fp_quiet: - case fp_signaling: - *decpt = 0; - pc = nanstring; - nc = 3; -movestring: - for (i = 0; i < nc; i++) - buf[i] = pc[i]; - buf[nc] = 0; - break; - } - return buf; /* For compatibility with fcvt. */ -} diff --git a/usr/src/lib/libbc/libc/gen/common/ecvt.c b/usr/src/lib/libbc/libc/gen/common/ecvt.c deleted file mode 100644 index 6215866bb1..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/ecvt.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1986 by Sun Microsystems, Inc. - */ - -#include <stdio.h> -extern char * -econvert(), *fconvert(); - -static char *efcvtbuffer; - -char * -ecvt(arg, ndigits, decpt, sign) - double arg; - int ndigits, *decpt, *sign; -{ - if (efcvtbuffer == NULL) - efcvtbuffer = (char *)calloc(1,1024); - return econvert(arg, ndigits, decpt, sign, efcvtbuffer); -} - -char * -fcvt(arg, ndigits, decpt, sign) - double arg; - int ndigits, *decpt, *sign; -{ - if (efcvtbuffer == NULL) - efcvtbuffer = (char *)calloc(1,1024); - return fconvert(arg, ndigits, decpt, sign, efcvtbuffer); -} diff --git a/usr/src/lib/libbc/libc/gen/common/errlst.c b/usr/src/lib/libbc/libc/gen/common/errlst.c deleted file mode 100644 index e660fc56c7..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/errlst.c +++ /dev/null @@ -1,114 +0,0 @@ -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 5.1 85/05/30 */ - -/* - * Copyright (c) 1980 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -char *sys_errlist[] = { - "Error 0", - "Not owner", /* 1 - EPERM */ - "No such file or directory", /* 2 - ENOENT */ - "No such process", /* 3 - ESRCH */ - "Interrupted system call", /* 4 - EINTR */ - "I/O error", /* 5 - EIO */ - "No such device or address", /* 6 - ENXIO */ - "Arg list too long", /* 7 - E2BIG */ - "Exec format error", /* 8 - ENOEXEC */ - "Bad file number", /* 9 - EBADF */ - "No children", /* 10 - ECHILD */ - "No more processes", /* 11 - EAGAIN */ - "Not enough memory", /* 12 - ENOMEM */ - "Permission denied", /* 13 - EACCES */ - "Bad address", /* 14 - EFAULT */ - "Block device required", /* 15 - ENOTBLK */ - "Device busy", /* 16 - EBUSY */ - "File exists", /* 17 - EEXIST */ - "Cross-device link", /* 18 - EXDEV */ - "No such device", /* 19 - ENODEV */ - "Not a directory", /* 20 - ENOTDIR */ - "Is a directory", /* 21 - EISDIR */ - "Invalid argument", /* 22 - EINVAL */ - "File table overflow", /* 23 - ENFILE */ - "Too many open files", /* 24 - EMFILE */ - "Inappropriate ioctl for device", /* 25 - ENOTTY */ - "Text file busy", /* 26 - ETXTBSY */ - "File too large", /* 27 - EFBIG */ - "No space left on device", /* 28 - ENOSPC */ - "Illegal seek", /* 29 - ESPIPE */ - "Read-only file system", /* 30 - EROFS */ - "Too many links", /* 31 - EMLINK */ - "Broken pipe", /* 32 - EPIPE */ - -/* math software */ - "Argument too large", /* 33 - EDOM */ - "Result too large", /* 34 - ERANGE */ - -/* non-blocking and interrupt i/o */ - "Operation would block", /* 35 - EWOULDBLOCK */ - "Operation now in progress", /* 36 - EINPROGRESS */ - "Operation already in progress", /* 37 - EALREADY */ - -/* ipc/network software */ - - /* argument errors */ - "Socket operation on non-socket", /* 38 - ENOTSOCK */ - "Destination address required", /* 39 - EDESTADDRREQ */ - "Message too long", /* 40 - EMSGSIZE */ - "Protocol wrong type for socket", /* 41 - EPROTOTYPE */ - "Option not supported by protocol", /* 42 - ENOPROTOOPT */ - "Protocol not supported", /* 43 - EPROTONOSUPPORT */ - "Socket type not supported", /* 44 - ESOCKTNOSUPPORT */ - "Operation not supported on socket", /* 45 - EOPNOTSUPP */ - "Protocol family not supported", /* 46 - EPFNOSUPPORT */ - "Address family not supported by protocol family", - /* 47 - EAFNOSUPPORT */ - "Address already in use", /* 48 - EADDRINUSE */ - "Can't assign requested address", /* 49 - EADDRNOTAVAIL */ - - /* operational errors */ - "Network is down", /* 50 - ENETDOWN */ - "Network is unreachable", /* 51 - ENETUNREACH */ - "Network dropped connection on reset", /* 52 - ENETRESET */ - "Software caused connection abort", /* 53 - ECONNABORTED */ - "Connection reset by peer", /* 54 - ECONNRESET */ - "No buffer space available", /* 55 - ENOBUFS */ - "Socket is already connected", /* 56 - EISCONN */ - "Socket is not connected", /* 57 - ENOTCONN */ - "Can't send after socket shutdown", /* 58 - ESHUTDOWN */ - "Too many references: can't splice", /* 59 - ETOOMANYREFS */ - "Connection timed out", /* 60 - ETIMEDOUT */ - "Connection refused", /* 61 - EREFUSED */ - "Too many levels of symbolic links", /* 62 - ELOOP */ - "File name too long", /* 63 - ENAMETOOLONG */ - "Host is down", /* 64 - EHOSTDOWN */ - "Host is unreachable", /* 65 - EHOSTUNREACH */ - "Directory not empty", /* 66 - ENOTEMPTY */ - "Too many processes", /* 67 - EPROCLIM */ - "Too many users", /* 68 - EUSERS */ - "Disc quota exceeded", /* 69 - EDQUOT */ - "Stale NFS file handle", /* 70 - ESTALE */ - "Too many levels of remote in path", /* 71 - EREMOTE */ - "Not a stream device", /* 72 - ENOSTR */ - "Timer expired", /* 73 - ETIME */ - "Out of stream resources", /* 74 - ENOSR */ - "No message of desired type", /* 75 - ENOMSG */ - "Not a data message", /* 76 - EBADMSG */ - "Identifier removed", /* 77 - EIDRM */ - "Deadlock situation detected/avoided", /* 78 - EDEADLK */ - "No record locks available", /* 79 - ENOLCK */ - "Machine is not on the network", /* 80 - ENONET */ - "Object is remote", /* 81 - ERREMOTE */ - "Link has been severed", /* 82 - ENOLINK */ - "Advertise error ", /* 83 - EADV */ - "Srmount error ", /* 84 - ESRMNT */ - "Communication error on send", /* 85 - ECOMM */ - "Protocol error", /* 86 - EPROTO */ - "Multihop attempted", /* 87 - EMULTIHOP */ - "EDOTDOT!!!!", /* 88 - EDOTDOT -can't happen */ - "Remote address changed", /* 89 - EREMCHG */ - "Function not implemented", /* 90 - ENOSYS */ -}; -int sys_nerr = { sizeof sys_errlist/sizeof sys_errlist[0] }; diff --git a/usr/src/lib/libbc/libc/gen/common/euc.h b/usr/src/lib/libbc/libc/gen/common/euc.h deleted file mode 100644 index 201fb17fbf..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/euc.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - - -/* This module is created for NLS on Jan.07.87 */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* static char *sccsid = "%Z%%M% %I% %E% SMI"; */ - -#define SS2 0x008e -#define SS3 0x008f - -typedef struct { - short int _eucw1, _eucw2, _eucw3; /* EUC width */ -} eucwidth_t; - -#define csetno(c) (((c)&0x80)?((c)==SS2)?2:(((c)==SS3)?3:1):0) - /* Returns code set number for the first byte of an EUC char. */ diff --git a/usr/src/lib/libbc/libc/gen/common/euc.multibyte.c b/usr/src/lib/libbc/libc/gen/common/euc.multibyte.c deleted file mode 100644 index f1f538adbd..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/euc.multibyte.c +++ /dev/null @@ -1,195 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include "codeset.h" -#include "mbextern.h" -#include "euc.h" -#include <limits.h> - -#define EUCMASK 0x8080 /* All id bits */ -#define MASK0 0x0000 /* Code Set 0 */ -#define MASK1 0x8080 /* Code Set 1 */ -#define MASK2 0x0080 /* Code Set 2 */ -#define MASK3 0x8000 /* Code Set 3 */ - -#define EUCWID1 eucinfo->_eucw1 -#define EUCWID2 eucinfo->_eucw2 -#define EUCWID3 eucinfo->_eucw3 - -int _wctomb_euc(char *, wchar_t); - -int -_mbtowc_euc(wchar_t *wchar, char *s, size_t n) -{ - int length; - wchar_t intcode; - int c; - char *olds = (char *)s; - wchar_t mask; - eucwidth_t * eucinfo = (eucwidth_t *)_code_set_info.code_info; - - if(n <= 0) - return(-1); - if(s == (char *)0) - return (0); - c = (unsigned char)*s++; - if(c < 0200) { - if(wchar) - *wchar = c; - return (c ? 1 : 0); - } - intcode = 0; - if (c == SS2) { - if(!(length = EUCWID2)) { - if(wchar) - *wchar = c; - return (1); - } - mask = MASK2; - } else if(c == SS3) { - if(!(length = EUCWID3)) { - if(wchar) - *wchar = c; - return (1); - } - mask = MASK3; - } else { - if(iscntrl(c)) { - if(wchar) - *wchar = c; - return (1); - } - length = EUCWID1 - 1; - mask = MASK1; - intcode = c & 0177; - } - if(length + 1 > n) - return (-1); - while(length--) { - if((c = (unsigned char)*s++) < 0200 || iscntrl(c)) - return (-1); - intcode = (intcode << 8) | (c & 0177); - } - if(wchar) - *wchar = intcode | mask; - return ((char *)s - olds); -} - - -size_t -_mbstowcs_euc(wchar_t *pwcs, char *s, size_t n) -{ - int i, j; - - j=0; - while(*s) { - if(j>=n) - break; - i=_mbtowc_euc(pwcs+j, s, MB_LEN_MAX); - if(i==-1) - return (-1); - s+=i; - ++j; - } - if(j<n) - pwcs[j]=0; - return (j); -} - - -size_t -_wcstombs_euc(char *s, wchar_t *pwcs, size_t n) -{ - wchar_t wc; - int i; - int r=n; /* Rest of bytes. */ - char *t; - char mbbuf[MB_LEN_MAX+1]; - - while(wc=(*pwcs++)) { - i=_wctomb_euc(mbbuf, wc); - - if (i>r) - break; - if (i==-1) return (-1); - - r-=i; - for (t=mbbuf;i>0;--i){ - /* Copy each byte. */ - *(s++)=*(t++); - } - } - if (r>0) - /* Has enough room for NUL. */ - *s=0; - return (n-r); -} - -int -_wctomb_euc(char *s, wchar_t wchar) -{ - eucwidth_t * eucinfo = (eucwidth_t *)_code_set_info.code_info; - char *olds = s; - int size, index; - unsigned char d; - if(!s) - return(0); - if( wchar <= 0177 || wchar <= 0377 && iscntrl(wchar)) { - *s++ = wchar; - return (wchar ? 1 : 0); - } - switch(wchar & EUCMASK) { - - case MASK1: - size = EUCWID1; - break; - - case MASK2: - *s++ = SS2; - size = EUCWID2; - break; - - case MASK3: - *s++ = SS3; - size = EUCWID3; - break; - - default: - return (-1); - } - index = size; - while(index--) { - d = wchar | 0200; - wchar >>= 8; - if(iscntrl(d)) - return (-1); - s[index] = d; - } - return (s + size - olds); -} diff --git a/usr/src/lib/libbc/libc/gen/common/execvp.c b/usr/src/lib/libbc/libc/gen/common/execvp.c deleted file mode 100644 index d2dc473eb2..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/execvp.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -/* - * execlp(name, arg,...,0) (like execl, but does path search) - * execvp(name, argv) (like execv, but does path search) - */ -#include <errno.h> -#include <sys/param.h> -#include <stdarg.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> - -static char *execat(char *, char *, char *); -static char *shell = "/bin/sh"; - -int -execlp(char *name, ...) -{ - va_list args; - int r; - - va_start(args, name); - r = execvp(name, (char **)args); - va_end(args); - - return (r); -} - -int -execvp(char *name, char **argv) -{ - char *pathstr; - char fname[MAXPATHLEN]; - char *newargs[256]; - int i; - char *cp; - unsigned etxtbsy = 1; - int eacces = 0; - - if ((pathstr = getenv("PATH")) == NULL) - pathstr = ":/usr/ucb:/bin:/usr/bin"; - cp = strchr(name, '/') ? "": pathstr; - - do { - cp = execat(cp, name, fname); - retry: - (void) execv(fname, argv); - switch (errno) { - case ENOEXEC: - newargs[0] = "sh"; - newargs[1] = fname; - for (i = 1; (newargs[i+1] = argv[i]) != NULL; ++i) { - if (i >= 254) { - errno = E2BIG; - return(-1); - } - } - (void) execv(shell, newargs); - return (-1); - case ETXTBSY: - if (++etxtbsy > 5) - return (-1); - (void) sleep(etxtbsy); - goto retry; - case EACCES: - ++eacces; - break; - case ENOMEM: - case E2BIG: - case EFAULT: - return (-1); - } - } while (cp); - if (eacces) - errno = EACCES; - return (-1); -} - -static char * -execat(char *s1, char *s2, char *si) -{ - char *s; - char *end; - - s = si; - end = s + MAXPATHLEN; - while (*s1 && *s1 != ':' && s < end) - *s++ = *s1++; - if (si != s && s < end) - *s++ = '/'; - while (*s2 && s < end) - *s++ = *s2++; - *s = '\0'; - return (*s1 ? ++s1: 0); -} diff --git a/usr/src/lib/libbc/libc/gen/common/exit.c b/usr/src/lib/libbc/libc/gen/common/exit.c deleted file mode 100644 index 44aae2fe47..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/exit.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> - -/* - * Copyright (c) 1987 by Sun Microsystems, Inc. - */ - -struct handlers { - void (*handler)(); - caddr_t arg; - struct handlers *next; -}; - -extern void _cleanup(); - -/* the list of handlers and their arguments */ -struct handlers *_exit_handlers; - -/* - * exit -- do termination processing, then evaporate process - */ -void -exit(code) - int code; -{ - register struct handlers *h; - - while (h = _exit_handlers) { - _exit_handlers = h->next; - (*h->handler)(code, h->arg); - } - _cleanup(); - _exit(code); -} diff --git a/usr/src/lib/libbc/libc/gen/common/exportent.c b/usr/src/lib/libbc/libc/gen/common/exportent.c deleted file mode 100644 index d45520e3ef..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/exportent.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 1995 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Exported file system table manager. Reads/writes "/etc/xtab". - */ - -#include <stdio.h> -#include <exportent.h> -#include <sys/file.h> -#include <ctype.h> - -extern char *strtok(); -extern char *strcpy(); - -#define LINESIZE 4096 - -static char *TMPFILE = "/tmp/xtabXXXXXX"; - -static char *skipwhite(char *); -static char *skipnonwhite(char *); - -FILE * -setexportent(void) -{ - FILE *f; - int fd; - - /* - * Create the tab file if it does not exist already - */ - if (access(TABFILE, F_OK) < 0) { - fd = open(TABFILE, O_CREAT, 0644); - close(fd); - } - if (access(TABFILE, W_OK) == 0) { - f = fopen(TABFILE, "r+"); - } else { - f = fopen(TABFILE, "r"); - } - if (f == NULL) { - return (NULL); - } - if (flock(fileno(f), LOCK_EX) < 0) { - (void)fclose(f); - return (NULL); - } - return (f); -} - - -void -endexportent(FILE *f) -{ - (void) fclose(f); -} - - -struct exportent * -getexportent(FILE *f) -{ - static char *line = NULL; - static struct exportent xent; - int len; - char *p; - - if (line == NULL) { - line = (char *)malloc(LINESIZE + 1); - } - if (fgets(line, LINESIZE, f) == NULL) { - return (NULL); - } - len = strlen(line); - if (line[len-1] == '\n') { - line[len-1] = 0; - } - xent.xent_dirname = line; - xent.xent_options = NULL; - p = skipnonwhite(line); - if (*p == 0) { - return (&xent); - } - *p++ = 0; - p = skipwhite(p); - if (*p == 0) { - return (&xent); - } - if (*p == '-') { - p++; - } - xent.xent_options = p; - return (&xent); -} - -int -remexportent(FILE *f, char *dirname) -{ - char buf[LINESIZE]; - FILE *f2; - int len; - char *fname; - int fd; - long pos; - long rempos; - int remlen; - int res; - - fname = (char *) malloc(strlen(TMPFILE) + 1); - pos = ftell(f); - rempos = 0; - remlen = 0; - (void)strcpy(fname, TMPFILE); - fd = mkstemp(fname); - if (fd < 0) { - return (-1); - } - if (unlink(fname) < 0) { - (void)close(fd); - return (-1); - } - f2 = fdopen(fd, "r+"); - if (f2 == NULL) { - (void)close(fd); - return (-1); - } - len = strlen(dirname); - rewind(f); - while (fgets(buf, sizeof(buf), f)) { - if (strncmp(buf, dirname, - len) != 0 || ! isspace((unsigned char)buf[len])) { - if (fputs(buf, f2) <= 0) { - (void)fclose(f2); - return (-1); - } - } else { - remlen = strlen(buf); - rempos = ftell(f) - remlen; - } - } - rewind(f); - if (ftruncate(fileno(f), 0L) < 0) { - (void)fclose(f2); - return (-1); - } - rewind(f2); - while (fgets(buf, sizeof(buf), f2)) { - if (fputs(buf, f) <= 0) { - (void)fclose(f2); - return (-1); - } - } - (void)fclose(f2); - if (remlen == 0) { - /* nothing removed */ - (void) fseek(f, pos, L_SET); - res = -1; - } else if (pos <= rempos) { - res = fseek(f, pos, L_SET); - } else if (pos > rempos + remlen) { - res = fseek(f, pos - remlen, L_SET); - } else { - res = fseek(f, rempos, L_SET); - } - return (res < 0 ? -1 : 0); -} - -int -addexportent(FILE *f, char *dirname, char *options) -{ - long pos; - - pos = ftell(f); - if (fseek(f, 0L, L_XTND) >= 0 && - fprintf(f, "%s", dirname) > 0 && - (options == NULL || fprintf(f, " -%s", options) > 0) && - fprintf(f, "\n") > 0 && - fseek(f, pos, L_SET) >= 0) { - return (0); - } - return (-1); -} - - -char * -getexportopt(struct exportent *xent, char *opt) -{ - static char *tokenbuf = NULL; - char *lp; - char *tok; - int len; - - if (tokenbuf == NULL) { - tokenbuf = (char *)malloc(LINESIZE); - } - if (xent->xent_options == NULL) { - return (NULL); - } - (void)strcpy(tokenbuf, xent->xent_options); - lp = tokenbuf; - len = strlen(opt); - while ((tok = strtok(lp, ",")) != NULL) { - lp = NULL; - if (strncmp(opt, tok, len) == 0) { - if (tok[len] == '=') { - return (&tok[len + 1]); - } else if (tok[len] == 0) { - return (""); - } - } - } - return (NULL); -} - - -#define iswhite(c) ((c) == ' ' || c == '\t') - -static char * -skipwhite(char *str) -{ - while (*str && iswhite(*str)) { - str++; - } - return (str); -} - -static char * -skipnonwhite(char *str) -{ - while (*str && ! iswhite(*str)) { - str++; - } - return (str); -} diff --git a/usr/src/lib/libbc/libc/gen/common/fabs.c b/usr/src/lib/libbc/libc/gen/common/fabs.c deleted file mode 100644 index d570aa4017..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/fabs.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -double -fabs(x) - double x; -{ - long *px = (long *) &x; -#ifdef i386 - px[1] &= 0x7fffffff; -#else - px[0] &= 0x7fffffff; -#endif - return x; -} diff --git a/usr/src/lib/libbc/libc/gen/common/file_decim.c b/usr/src/lib/libbc/libc/gen/common/file_decim.c deleted file mode 100644 index a12b272fb6..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/file_decim.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -#include <ctype.h> -#include <stdio.h> -#ifndef PRE41 -#include <locale.h> -#endif -#include "base_conversion.h" - -void -file_to_decimal(ppc, nmax, fortran_conventions, pd, pform, pechar, pf, pnread) - char **ppc; - int nmax; - int fortran_conventions; - decimal_record *pd; - enum decimal_string_form *pform; - char **pechar; - FILE *pf; - int *pnread; - -{ - register char *cp = *ppc; - register int current; - register int nread = 1; /* Number of characters read so far. */ - char *good = cp - 1; /* End of known good token. */ - char *cp0 = cp; - - current = getc(pf); /* Initialize buffer. */ - *cp = current; - -#define ATEOF current -#define CURRENT current -#define NEXT \ - if (nread < nmax) \ - { cp++ ; current = getc(pf) ; *cp = current ; nread++ ;} \ - else \ - { current = NULL ; } ; - -#include "char_to_decimal.h" -#undef CURRENT -#undef NEXT - - if (nread < nmax) { - while (cp >= *ppc) { /* Push back as many excess - * characters as possible. */ - if (*cp != EOF) { /* Can't push back EOF. */ - if (ungetc(*cp, pf) == EOF) - break; - } cp--; - nread--; - } - } - cp++; - *cp = 0; /* Terminating null. */ - *pnread = nread; - -} diff --git a/usr/src/lib/libbc/libc/gen/common/float_decim.c b/usr/src/lib/libbc/libc/gen/common/float_decim.c deleted file mode 100644 index f532e8b2c5..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/float_decim.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -/* - * Conversion between single, and extended binary and decimal - * floating point - separated from double_to_decimal to minimize impact on - * main(){printf("Hello");} - */ - -#include "base_conversion.h" - -void -single_to_decimal(px, pm, pd, ps) - single *px; - decimal_mode *pm; - decimal_record *pd; - fp_exception_field_type *ps; -{ - single_equivalence kluge; - unpacked u; - - *ps = 0; /* Initialize *ps - no exceptions. */ - kluge.x = *px; - pd->sign = kluge.f.msw.sign; - pd->fpclass = _class_single(px); - switch (pd->fpclass) { - case fp_zero: - break; - case fp_infinity: - break; - case fp_quiet: - break; - case fp_signaling: - break; - default: - _unpack_single(&u, &kluge.x); - _unpacked_to_decimal(&u, pm, pd, ps); - } -} - -void -extended_to_decimal(px, pm, pd, ps) - extended *px; - decimal_mode *pm; - decimal_record *pd; - fp_exception_field_type *ps; -{ - extended_equivalence kluge; - unpacked u; - - *ps = 0; /* Initialize *ps - no exceptions. */ - kluge.x[0] = (*px)[0]; - kluge.x[1] = (*px)[1]; - kluge.x[2] = (*px)[2]; - pd->sign = kluge.f.msw.sign; - pd->fpclass = _class_extended(px); - switch (pd->fpclass) { - case fp_zero: - break; - case fp_infinity: - break; - case fp_quiet: - break; - case fp_signaling: - break; - default: - _unpack_extended(&u, px); - _unpacked_to_decimal(&u, pm, pd, ps); - } -} diff --git a/usr/src/lib/libbc/libc/gen/common/fmod.c b/usr/src/lib/libbc/libc/gen/common/fmod.c deleted file mode 100644 index 4692f54609..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/fmod.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* Special version adapted from libm for use in libc. */ - -static int n0 = 0, n1 = 1; - -static double two52 = 4.503599627370496000E+15; -static double twom52 = 2.220446049250313081E-16; - -static double -setexception(int n, double x) -{ - return (0.0); -} - -double -copysign(double x, double y) -{ - long *px = (long *) &x; - long *py = (long *) &y; - px[n0] = (px[n0] & 0x7fffffff) | (py[n0] & 0x80000000); - return (x); -} - -static double -fabs(double x) -{ - long *px = (long *) &x; - px[0] &= 0x7fffffff; - - return (x); -} - -static int -finite(double x) -{ - long *px = (long *) &x; - return ((px[n0] & 0x7ff00000) != 0x7ff00000); -} - -static int -ilogb(double x) -{ - long *px = (long *) &x, k; - k = px[n0] & 0x7ff00000; - if (k == 0) { - if ((px[n1] | (px[n0] & 0x7fffffff)) == 0) - return (0x80000001); - else { - x *= two52; - return ((px[n0] & 0x7ff00000) >> 20) - 1075; - } - } else if (k != 0x7ff00000) - return (k >> 20) - 1023; - else - return (0x7fffffff); -} - -static double -scalbn(double x, int n) -{ - long *px = (long *) &x, k; - double twom54 = twom52 * 0.25; - k = (px[n0] & 0x7ff00000) >> 20; - if (k == 0x7ff) - return (x + x); - if ((px[n1] | (px[n0] & 0x7fffffff)) == 0) - return (x); - if (k == 0) { - x *= two52; - k = ((px[n0] & 0x7ff00000) >> 20) - 52; - } - k = k + n; - if (n > 5000) - return (setexception(2, x)); - if (n < -5000) - return (setexception(1, x)); - if (k > 0x7fe) - return (setexception(2, x)); - if (k <= -54) - return (setexception(1, x)); - if (k > 0) { - px[n0] = (px[n0] & 0x800fffff) | (k << 20); - return (x); - } - k += 54; - px[n0] = (px[n0] & 0x800fffff) | (k << 20); - return (x * twom54); -} - -double -fmod(double x, double y) -{ - int ny, nr; - double r, z, w; - - int finite(), ilogb(); - double fabs(), scalbn(), copysign(); - - /* purge off exception values */ - if (!finite(x) || y != y || y == 0.0) { - return ((x * y) / (x * y)); - } - /* scale and subtract to get the remainder */ - r = fabs(x); - y = fabs(y); - ny = ilogb(y); - while (r >= y) { - nr = ilogb(r); - if (nr == ny) - w = y; - else { - z = scalbn(y, nr - ny - 1); - w = z + z; - } - if (r >= w) - r -= w; - else - r -= z; - } - - /* restore sign */ - return (copysign(r, x)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/frexp.c b/usr/src/lib/libbc/libc/gen/common/frexp.c deleted file mode 100644 index ffc75618b1..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/frexp.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" /* from UCB 5.2 3/9/86 */ - -/* - * the call - * x = frexp(arg,&exp); - * must return a double fp quantity x which is <1.0 - * and the corresponding binary exponent "exp". - * such that - * arg = x*2^exp - */ -double -frexp(x, i) - double x; - int *i; -{ - int neg, j; - - j = 0; - neg = 0; - if (x<0) { - x = -x; - neg = 1; - } - if (x>=1.0) - while (x>=1.0) { - j = j+1; - x = x/2; - } - else if (x < 0.5 && x != 0.0) - while(x<0.5) { - j = j-1; - x = 2*x; - } - *i = j; - if(neg) - x = -x; - return (x); -} diff --git a/usr/src/lib/libbc/libc/gen/common/fstab.c b/usr/src/lib/libbc/libc/gen/common/fstab.c deleted file mode 100644 index 7fa88f0a5b..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/fstab.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <fstab.h> -#include <stdio.h> -#include <ctype.h> -#include <mntent.h> - -static struct fstab *pfs; -static FILE *fs_file; - -static int -fstabscan(struct fstab *fs) -{ - struct mntent *mnt; - - /* skip over all filesystem types except '4.2', 'swap' & 'ignore' */ - while (((mnt = getmntent(fs_file)) != NULL) && - !((strcmp(mnt->mnt_type, MNTTYPE_42) == 0) || - (strcmp(mnt->mnt_type, MNTTYPE_SWAP) == 0) || - (strcmp(mnt->mnt_type, MNTTYPE_IGNORE) == 0))) - continue; - if (mnt == NULL) - return (EOF); - fs->fs_spec = mnt->mnt_fsname; - fs->fs_file = mnt->mnt_dir; - if (strcmp(mnt->mnt_type, MNTTYPE_IGNORE) == 0) { - strcpy(mnt->mnt_opts, FSTAB_XX); - } else if (strcmp(mnt->mnt_type, MNTTYPE_SWAP) == 0) { - strcpy(mnt->mnt_opts, FSTAB_SW); - } else if (hasmntopt(mnt, MNTOPT_RO)) { - strcpy(mnt->mnt_opts, FSTAB_RO); - } else if (hasmntopt(mnt, MNTOPT_QUOTA)) { - strcpy(mnt->mnt_opts, FSTAB_RQ); - } else { - strcpy(mnt->mnt_opts, FSTAB_RW); - } - fs->fs_type = mnt->mnt_opts; - fs->fs_freq = mnt->mnt_freq; - fs->fs_passno = mnt->mnt_passno; - return (5); -} - -int -setfsent(void) -{ - - if (fs_file) - endfsent(); - if ((fs_file = setmntent(FSTAB, "r")) == NULL) { - fs_file = 0; - return (0); - } - return (1); -} - -int -endfsent(void) -{ - - if (fs_file) { - endmntent(fs_file); - fs_file = 0; - } - return (1); -} - -struct fstab * -getfsent(void) -{ - int nfields; - - if ((fs_file == 0) && (setfsent() == 0)) - return ((struct fstab *)0); - if (pfs == 0) { - pfs = (struct fstab *)malloc(sizeof (struct fstab)); - if (pfs == 0) - return (0); - } - nfields = fstabscan(pfs); - if (nfields == EOF || nfields != 5) - return ((struct fstab *)0); - return (pfs); -} - -struct fstab * -getfsspec(char *name) -{ - struct fstab *fsp; - - if (setfsent() == 0) /* start from the beginning */ - return ((struct fstab *)0); - while((fsp = getfsent()) != 0) - if (strcmp(fsp->fs_spec, name) == 0) - return (fsp); - return ((struct fstab *)0); -} - -struct fstab * -getfsfile(char *name) -{ - struct fstab *fsp; - - if (setfsent() == 0) /* start from the beginning */ - return ((struct fstab *)0); - while ((fsp = getfsent()) != 0) - if (strcmp(fsp->fs_file, name) == 0) - return (fsp); - return ((struct fstab *)0); -} - -struct fstab * -getfstype(char *type) -{ - struct fstab *fs; - - if (setfsent() == 0) - return ((struct fstab *)0); - while ((fs = getfsent()) != 0) - if (strcmp(fs->fs_type, type) == 0) - return (fs); - return ((struct fstab *)0); -} diff --git a/usr/src/lib/libbc/libc/gen/common/ftok.c b/usr/src/lib/libbc/libc/gen/common/ftok.c deleted file mode 100644 index ae0724c487..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/ftok.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/sysmacros.h> - -key_t -ftok(path, id) -char *path; -char id; -{ - struct stat st; - - return(stat(path, &st) < 0 ? (key_t)-1 : - (key_t)((key_t)id << 24 | ((long)(unsigned)minor(st.st_dev)) << 16 | - (unsigned)st.st_ino)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/ftw.c b/usr/src/lib/libbc/libc/gen/common/ftw.c deleted file mode 100644 index 6ac2cade21..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/ftw.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -/*************************************************************** - * ftw - file tree walk - * - * int ftw (path, fn, depth) char *path; int (*fn)(); int depth; - * - * Given a path name, ftw starts from the file given by that path - * name and visits each file and directory in the tree beneath - * that file. If a single file has multiple links within the - * structure, it will be visited once for each such link. - * For each object visited, fn is called with three arguments. - * The first contains the path name of the object, the second - * contains a pointer to a stat buffer which will usually hold - * appropriate information for the object and the third will - * contain an integer value giving additional information about - * - * FTW_F The object is a file for which stat was - * successful. It does not guarantee that the - * file can actually be read. - * - * FTW_D The object is a directory for which stat and - * open for read were both successful. - * - * FTW_DNR The object is a directory for which stat - * succeeded, but which cannot be read. Because - * the directory cannot be read, fn will not be - * called for any descendants of this directory. - * - * FTW_NS Stat failed on the object because of lack of - * appropriate permission, or because the object is a - * symbolic link that points to a non-existent file. - * This indication will be given, for example, for each - * file in a directory with read but no execute - * permission. Because stat failed, it is not - * possible to determine whether this object is a file - * or a directory. The stat buffer passed to fn will - * contain garbage. Stat failure for any reason - * other than lack of permission will be - * considered an error and will cause ftw to stop - * and return -1 to its caller. - * - * If fn returns nonzero, ftw stops and returns the same value - * to its caller. If ftw gets into other trouble along the way, - * it returns -1 and leaves an indication of the cause in errno. - * - * The third argument to ftw does not limit the depth to which - * ftw will go. Rather, it limits the depth to which ftw will - * go before it starts recycling file descriptors. In general, - * it is necessary to use a file descriptor for each level of the - * tree, but they can be recycled for deep trees by saving the - * position, closing, re-opening, and seeking. It is possible - * to start recycling file descriptors by sensing when we have - * run out, but in general this will not be terribly useful if - * fn expects to be able to open files. We could also figure out - * how many file descriptors are available and guarantee a certain - * number to fn, but we would not know how many to guarantee, - * and we do not want to impose the extra overhead on a caller who - * knows how many are available without having to figure it out. - * - * It is possible for ftw to die with a memory fault in the event - * of a file system so deeply nested that the stack overflows. - **************************************************************/ - -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/dir.h> -#include <errno.h> -#include <ftw.h> - -#define NULL 0 - -extern char *malloc(), *strcpy(); -extern void free(); -extern int errno; - -int -ftw(path, fn, depth) -char *path; -int (*fn)(); -int depth; -{ - int rc, n; - DIR *dirp; - char *subpath, *component; - struct stat sb; - struct direct *dp; - - /* Try to get file status. - If unsuccessful, errno will say why. */ - if(stat(path, &sb) < 0) { - if (errno == EACCES) { - return((*fn)(path, &sb, FTW_NS)); - } else if (errno == ENOENT) { - /* Check if symbolic link points to non-existent file */ - if (lstat(path, &sb) < 0) { - return(-1); - } - else if ((sb.st_mode & S_IFMT) == S_IFLNK) { - errno = ENOENT; - return((*fn)(path, &sb, FTW_NS)); - } - else { - return(-1); - } - } else { - return(-1); - } - } - - /* - * The stat succeeded, so we know the object exists. - * If not a directory, call the user function and return. - */ - if((sb.st_mode & S_IFMT) != S_IFDIR) - return((*fn)(path, &sb, FTW_F)); - - /* - * The object was a directory. - * - * Open a file to read the directory - */ - dirp = opendir(path); - - /* - * Call the user function, telling it whether - * the directory can be read. If it can't be read - * call the user function or indicate an error, - * depending on the reason it couldn't be read. - */ - if(dirp == NULL) - return(errno == EACCES? (*fn)(path, &sb, FTW_DNR): -1); - - /* We could read the directory. Call user function. */ - rc = (*fn)(path, &sb, FTW_D); - if(rc != 0) - return(rc); - - /* Allocate a buffer to hold generated pathnames. */ - n = strlen(path); - subpath = malloc((unsigned)(n+MAXNAMLEN+2)); - if(subpath == NULL) { - closedir(dirp); - errno = ENOMEM; - return(-1); - } - - /* Create a prefix to which we will append component names */ - (void)strcpy(subpath, path); - if(subpath[0] != '\0' && subpath[n-1] != '/') - subpath[n++] = '/'; - component = &subpath[n]; - - /* - * Read the directory one component at a time. - * We must ignore "." and "..", but other than that, - * just create a path name and call self to check it out. - */ - while((dp = readdir(dirp)) != NULL) { - if(strcmp(dp->d_name, ".") != 0 && - strcmp(dp->d_name, "..") != 0) { - long here; - - /* Append component name to the working path */ - (void)strcpy(component, dp->d_name); - - /* - * If we are about to exceed our depth, - * remember where we are and close a file. - */ - if(depth <= 1) { - here = telldir(dirp); - closedir(dirp); - } - - /* - * Do a recursive call to process the file. - * (watch this, sports fans) - */ - rc = ftw(subpath, fn, depth-1); - if(rc != 0) { - free(subpath); - if(depth > 1) - closedir(dirp); - return(rc); - } - - /* - * If we closed the file, try to reopen it. - */ - if(depth <= 1) { - dirp = opendir(path); - if(dirp == NULL) { - free(subpath); - return(-1); - } - seekdir(dirp, here); - } - } - } - - /* - * We got out of the subdirectory loop. The return from - * the final readdir is in dp. Clean up. - */ - free(subpath); - closedir(dirp); - return(0); -} diff --git a/usr/src/lib/libbc/libc/gen/common/func_decim.c b/usr/src/lib/libbc/libc/gen/common/func_decim.c deleted file mode 100644 index a42a3c80ca..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/func_decim.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -#include <ctype.h> -#include <stdio.h> -#ifndef PRE41 -#include <locale.h> -#endif -#include "base_conversion.h" - -void -func_to_decimal(ppc, nmax, fortran_conventions, pd, pform, pechar, pget, pnread, punget) - char **ppc; - int nmax; - int fortran_conventions; - decimal_record *pd; - enum decimal_string_form *pform; - char **pechar; - int (*pget) (); -int *pnread; -int (*punget) (); - -{ - register char *cp = *ppc; - register int current; - register int nread = 1; /* Number of characters read so far. */ - char *good = cp - 1; /* End of known good token. */ - char *cp0 = cp; - - current = (*pget) (); /* Initialize buffer. */ - *cp = current; - -#define ATEOF current -#define CURRENT current -#define NEXT \ - if (nread < nmax) \ - { cp++ ; current = (*pget)() ; *cp = current ; nread++ ;} \ - else \ - { current = NULL ; } ; - -#include "char_to_decimal.h" -#undef CURRENT -#undef NEXT - - if ((nread < nmax) && (punget != NULL)) { - while (cp >= *ppc) { /* Push back as many excess - * characters as possible. */ - if (*cp != EOF) { /* Can't push back EOF. */ - if ((*punget) (*cp) == EOF) - break; - } - cp--; - nread--; - } - } - cp++; - *cp = 0; /* Terminating null. */ - *pnread = nread; -} diff --git a/usr/src/lib/libbc/libc/gen/common/gconvert.c b/usr/src/lib/libbc/libc/gen/common/gconvert.c deleted file mode 100644 index 885889855d..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/gconvert.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -/* - * gcvt - Floating output conversion to minimal length string - */ - -#include "base_conversion.h" -#ifndef PRE41 -#include <locale.h> -#endif - -void -_gcvt(ndigit, pd, trailing, buf) - int ndigit; - decimal_record *pd; - char *buf; -{ - char *p, *pstring; - int i; - static char *inf8 = "Infinity"; - static char *inf3 = "Inf"; - static char *nan = "NaN"; -#ifdef PRE41 - char decpt = '.'; -#else - char decpt = *(localeconv()->decimal_point); -#endif - - p = buf; - if (pd->sign) - *(p++) = '-'; - switch (pd->fpclass) { - case fp_zero: - *(p++) = '0'; - if (trailing != 0) { - *(p++) = decpt; - for (i = 0; i < ndigit - 1; i++) - *(p++) = '0'; - } - break; - case fp_infinity: - if (ndigit < 8) - pstring = inf3; - else - pstring = inf8; - goto copystring; - case fp_quiet: - case fp_signaling: - pstring = nan; -copystring: - for (i = 0; *pstring != 0;) - *(p++) = *(pstring++); - break; - default: - if ((pd->exponent > 0) || (pd->exponent < -(ndigit + 3))) { /* E format. */ - char estring[4]; - int n; - - i = 0; - *(p++) = pd->ds[0]; - *(p++) = decpt; - for (i = 1; pd->ds[i] != 0;) - *(p++) = pd->ds[i++]; - if (trailing == 0) { /* Remove trailing zeros and . */ - p--; - while (*p == '0') - p--; - if (*p != decpt) - p++; - } - *(p++) = 'e'; - n = pd->exponent + i - 1; - if (n >= 0) - *(p++) = '+'; - else { - *(p++) = '-'; - n = -n; - } - _fourdigitsquick((short unsigned) n, estring); - for (i = 0; estring[i] == '0'; i++); /* Find end of zeros. */ - if (i > 2) - i = 2; /* Guarantee two zeros. */ - for (; i <= 3;) - *(p++) = estring[i++]; /* Copy exp digits. */ - } else { /* F format. */ - if (pd->exponent >= (1 - ndigit)) { /* x.xxx */ - for (i = 0; i < (ndigit + pd->exponent);) - *(p++) = pd->ds[i++]; - *(p++) = decpt; - if (pd->ds[i] != 0) { /* More follows point. */ - for (; i < ndigit;) - *(p++) = pd->ds[i++]; - } - } else {/* 0.00xxxx */ - *(p++) = '0'; - *(p++) = decpt; - for (i = 0; i < -(pd->exponent + ndigit); i++) - *(p++) = '0'; - for (i = 0; pd->ds[i] != 0;) - *(p++) = pd->ds[i++]; - } - if (trailing == 0) { /* Remove trailing zeros and point. */ - p--; - while (*p == '0') - p--; - if (*p != decpt) - p++; - } - } - } - *(p++) = 0; -} - -char * -gconvert(number, ndigit, trailing, buf) - double number; - int ndigit, trailing; - char *buf; -{ - decimal_mode dm; - decimal_record dr; - fp_exception_field_type fef; - - dm.rd = fp_direction; - dm.df = floating_form; - dm.ndigits = ndigit; - double_to_decimal(&number, &dm, &dr, &fef); - _gcvt(ndigit, &dr, trailing, buf); - return (buf); -} - -char * -gcvt(number, ndigit, buf) - double number; - int ndigit; - char *buf; -{ - return (gconvert(number, ndigit, 0, buf)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/getauditflags.c b/usr/src/lib/libbc/libc/gen/common/getauditflags.c deleted file mode 100644 index 62c8d63463..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/getauditflags.c +++ /dev/null @@ -1,495 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1992 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <string.h> -#include <sys/types.h> -#include <sys/label.h> -#include <sys/audit.h> -#include <auevents.h> - -#define ON 1 -#define OK 0 -#define OFF -1 -#define COMMA ',' -#define COMMASTR "," - -#define COMMON 0 -#define SUCCESS 1 -#define FAILURE 2 - -#define MAXFLDLEN 25 -#define MAXSTRLEN 360 -#define MAXEVENT 11 - -/* GLOBALS */ - -static int length; -static int pos = 0; - -struct list { - short count; - short on[MAXEVENT+1]; - short off; -}; -typedef struct list list_t; - -struct exception { - short type; - short exception; -}; -typedef struct exception except_t; - -static int stringcopy(char *, char *, int); - -/* - * getauditflagschar() - convert bit flag to character string - * - * input: masks->as_success - audit on success - * masks->as_failure - audit on failure - * verbose - string format. 0 if short name; 1 if long name; - * - * output: auditstring - resultant audit string - * - * returns: 0 - entry read ok - * -1 - error - */ - -int -getauditflagschar(char *auditstring, audit_state_t *masks, int verbose) -{ - int i, j, k, mask_num; - int list = -1, retstat = 0; - int except_list[3]; - char *prefix = " "; - except_t except[2]; - list_t lists[3]; - - /* - * initialize input buffer - */ - strcpy(auditstring, ""); - /* - * initialize lists struct - */ - for (mask_num = COMMON; mask_num <= FAILURE; mask_num++) { - lists[mask_num].count = 0; - lists[mask_num].off = -1; - for (i=0;i<MAXEVENT+1;i++) - lists[mask_num].on[i] = -1; - } - /* - * initialize exception lists - */ - for (i = 0; i < 2; i++) { - except[i].type = -1; - except[i].exception = -1; - } - - for (i = 0; i < 3; i++) - except_list[i] = 0; - - /* - * set length global - */ - length = verbose; - pos = 0; - - /* - * find turned-on events - if on, store index of event - * in one of the three event lists, common, success, failure. - */ - for ( i = 0; i < MAXEVENT; i++) { - if (((event_class[i].event_mask & masks->as_success) > 0) || - ((event_class[i].event_mask & masks->as_failure) > 0)) { - - /* - * check for events in common - */ - if (((event_class[i].event_mask & masks->as_success) > - 0) && - ((event_class[i].event_mask & masks->as_failure) > 0)) - lists[COMMON].on[lists[COMMON].count++] = i; - - /* - * check for success events - */ - if ((event_class[i].event_mask & masks->as_success) > 0) - lists[SUCCESS].on[lists[SUCCESS].count++] = i; - else { - except_list[SUCCESS]++; - if (lists[SUCCESS].off == -1) - lists[SUCCESS].off = i; - } - /* - * check for failure events - */ - if ((event_class[i].event_mask & masks->as_failure) > 0) - lists[FAILURE].on[lists[FAILURE].count++] = i; - else { - except_list[FAILURE]++; - if (lists[FAILURE].off == -1) - lists[FAILURE].off = i; - } - } else { - except_list[COMMON]++; - if (lists[COMMON].off == -1) - lists[COMMON].off = i; - } - } - /* - * check for all set or all-1 set - output all and common exceptions. - * the all or common state is exclusive; only one of the - * three, (+-)all, allowed - */ - /* - * no exceptions - */ - if (lists[COMMON].count >= MAXEVENT-2) { - if (lists[COMMON].count == MAXEVENT) - list = COMMON; - - /* - * one exception - */ - else if (lists[COMMON].count == MAXEVENT-1) { - for (i=COMMON;i<=FAILURE && (list == -1);i++) { - if (except_list[i] == 1) { - list = COMMON; - except[0].type = i; - except[0].exception = lists[i].off; - } - } - } - /* - * two exceptions - */ - else if (lists[COMMON].count == MAXEVENT-2) { - if (except_list[COMMON] == 1) { - list = COMMON; - except[0].type = COMMON; - except[0].exception = lists[COMMON].off; - for (i=SUCCESS;i<=FAILURE;i++) { - if (except_list[i] == 1) { - except[1].type = i; - except[1].exception = lists[i].off; - } - } - - } else if (except_list[COMMON] == 0) { - for (i=SUCCESS,j=0;i<=FAILURE;i++) { - if (except_list[i] == 1) { - list = COMMON; - except[j].type = i; - except[j++].exception = lists[i].off; - } - } - } - } - } else { - /* - * check for +all or -all - */ - for (i=SUCCESS,j=0;i<=FAILURE;i++) { - if (lists[i].count >= MAXEVENT-1) { - list = i; - except[j].type = i; - if (lists[i].count != MAXEVENT) { - if (lists[i].off != -1) - except[j++].exception = - lists[i].off; - else - except[j++].exception = - lists[COMMON].off; - } - } - } - } - /* - * output all and exceptions - */ - if (list != -1) { - if(list==SUCCESS) { - if ((stringcopy(auditstring, "+", 0)) == -1) - retstat = -1; - } - if(list==FAILURE) { - if ((stringcopy(auditstring, "-", 0)) == -1) - retstat = -1; - } - - if (retstat == 0) { - if (length) { - if - ((stringcopy(auditstring,event_class[11].event_lname,1)) == -1) - retstat = -1; - } else - if ((stringcopy(auditstring, event_class[11].event_sname,1)) == -1) - retstat = -1; - } - - if (retstat == 0) { - /* - * output exceptions - */ - for (i=0;i<2 && except[i].exception != -1; i++) { - if ((stringcopy(auditstring, "^", 0)) == -1) - retstat = -1; - if(except[i].type==SUCCESS) { - if ((stringcopy(auditstring, "+", 0)) == -1) - retstat = -1; - } - if (except[i].type==FAILURE) { - if ((stringcopy(auditstring, "-", 0)) == -1) - retstat = -1; - } - if (length == 1 && retstat == 0) { - if ((stringcopy(auditstring, - event_class[except[i].exception].event_lname, 1))==-1) - retstat = -1; - } else if (retstat == 0) { - if ((stringcopy(auditstring, - event_class[except[i].exception].event_sname, 1))==-1) - retstat = -1; - } - } - } - } /* end of " all " processing */ - - /* - * process common events if no "all" was output - */ - if (list == -1 && (lists[COMMON].count > 0) && retstat == 0) { - /* - * output common events first - */ - for (j=0;j<lists[COMMON].count;j++) { - if (length == 1) { - if ((stringcopy(auditstring, - event_class[lists[COMMON].on[j]].event_lname, 1)) == -1) - retstat = -1; - } else if ((stringcopy(auditstring, - event_class[lists[COMMON].on[j]].event_sname, 1)) == -1) - retstat = -1; - } - /* - * remove common events from individual lists - */ - if (retstat == 0) { - for (i=SUCCESS;i<=FAILURE;i++) { - for(j=0;j<lists[COMMON].count;j++) { - for(k=0;k < lists[i].count;k++) { - if (lists[COMMON].on[j] == - lists[i].on[k]) - lists[i].on[k] = -1; - } - } - } - } - } - - /* - * start processing individual event flags in success - * and failure lists - */ - if (list != COMMON && retstat == 0) { - for (i=SUCCESS;i<=FAILURE;i++) { - if(list != i) { - if (i==SUCCESS) strcpy(prefix, "+"); - if (i==FAILURE) strcpy(prefix, "-"); - for (j=0;j<MAXEVENT && j<lists[i].count;j++) { - if (lists[i].on[j] != -1) { - if ((stringcopy(auditstring, prefix, 0)) == -1) - retstat = -1; - if (length == 1 && - retstat == 0) { - if ((stringcopy(auditstring, - event_class[lists[i].on[j]].event_lname, 1))==-1) - retstat = -1; - } else if (retstat == 0) { - if ((stringcopy(auditstring, - event_class[lists[i].on[j]].event_sname, 1))==-1) - retstat = -1; - } - } - } - } - } - } - if ((stringcopy(auditstring, "\0", 2)) == -1) - retstat = -1; - - return (retstat); -} - -static int -stringcopy(char *auditstring, char *event, - int flag) /* if set, output comma after event */ -{ - int retstat = 0; - - /* - * check size - */ - if (pos >= MAXSTRLEN) { - fprintf(stderr,"getauditflagschar: Inputted buffer too small.\n"); - retstat = -1; - } else if (flag != 2) { - strcpy(auditstring+pos, event); - pos += strlen(event); - if(flag) { - strcpy(auditstring+pos, COMMASTR); - pos += strlen(COMMASTR); - } - } else { - /* - * add null terminator only - */ - if (pos) - strcpy(auditstring+(pos-1), event); - - } - return (retstat); -} - -/* - * getauditflagsbin() - converts character string to success and - * failure bit masks - * - * input: auditstring - audit string - * cnt - number of elements in the masks array - * - * output: masks->as_success - audit on success - * masks->as_failure - audit on failure - * - * returns: 0 - ok - * -1 - error - string contains characters which do - * not match event flag names - */ - -int -getauditflagsbin(char *auditstring, audit_state_t *masks) -{ - int i, gotone, done = 0, invert = 0, tryagain; - int retstat = 0, succ_event, fail_event; - char *ptr, tmp_buff[MAXFLDLEN]; - - /* - * process character string - */ - do { - gotone = 0; - /* - * read through string storing chars. until a comma - */ - for (ptr=tmp_buff; !gotone;) { - if(*auditstring!=COMMA && *auditstring!='\0' && - *auditstring!='\n' && *auditstring!=' ') - *ptr++ = *auditstring++; - else if (*auditstring == ' ') - *auditstring++; - else { - if (*auditstring == '\0' || - *auditstring == '\n') { - done = 1; - if (ptr == tmp_buff) - done = 2; - } - gotone = 1; - } - } - /* - * process audit state - */ - if(gotone && done != 2) { - if(!done) auditstring++; - *ptr++ = '\0'; - ptr = tmp_buff; - gotone = 0; - succ_event = ON; - fail_event = ON; - tryagain = 1; - invert = 0; - - /* - * get flags - */ - do { - switch (*ptr++) { - case '^': - invert = 1; - succ_event = OFF; - fail_event = OFF; - break; - case '+': - if (invert) - fail_event = OK; - else { - succ_event = ON; - fail_event = OK; - } - break; - case '-': - if (invert) - succ_event = OK; - else { - fail_event = ON; - succ_event = OK; - } - break; - default: - tryagain = 0; - ptr--; - break; - } - } while(tryagain); - - /* add audit state to mask */ - for (i=0;i<MAXEVENT+1 && !gotone;i++) { - if ((!(strcmp(ptr, event_class[i].event_sname))) || - (!(strcmp(ptr, event_class[i].event_lname)))) { - if (succ_event == ON) - masks->as_success |= event_class[i].event_mask; - else if (succ_event == OFF) - masks->as_success &= ~(event_class[i].event_mask); - if (fail_event == ON) - masks->as_failure |= event_class[i].event_mask; - else if (fail_event == OFF) - masks->as_failure &= ~(event_class[i].event_mask); - gotone = 1; - } - } - if(!gotone) { - retstat = -1; - done = 1; - } - } - } while (!done); - - return (retstat); -} diff --git a/usr/src/lib/libbc/libc/gen/common/getauid.c b/usr/src/lib/libbc/libc/gen/common/getauid.c deleted file mode 100644 index 8dc4df8cc2..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/getauid.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1987 by Sun Microsystems, Inc. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -int -getauid(void) -{ - return (0); -} - -int -setauid(int auid) -{ - return (0); -} diff --git a/usr/src/lib/libbc/libc/gen/common/getcwd.c b/usr/src/lib/libbc/libc/gen/common/getcwd.c deleted file mode 100644 index 3f3f46b067..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/getcwd.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -/* - * Library routine to GET the Current Working Directory. - * arg1 is a pointer to a character buffer into which the - * path name of the current directory is placed by the - * subroutine. arg1 may be zero, in which case the - * subroutine will call malloc to get the required space. - * arg2 is the length of the buffer space for the path-name. - * If the actual path-name is longer than (arg2-2), or if - * the value of arg2 is not at least 3, the subroutine will - * return a value of zero, with errno set as appropriate. - */ - -#include <stdio.h> -#include <sys/errno.h> - -extern FILE *popen(); -extern char *malloc(), *fgets(), *strchr(); -extern int errno, pclose(); - -char * -getcwd(arg1, arg2) -char *arg1; -int arg2; -{ - FILE *pipe; - char *trm; - - if(arg2 <= 0) { - errno = EINVAL; - return(0); - } - if(arg1 == 0) - if((arg1 = malloc((unsigned)arg2)) == 0) { - errno = ENOMEM; - return(0); - } - errno = 0; - if((pipe = popen("pwd", "r")) == 0) - return(0); - (void) fgets(arg1, arg2, pipe); - (void) pclose(pipe); - trm = strchr(arg1, '\0'); - if(*(trm-1) != '\n') { - errno = ERANGE; - return(0); - } - *(trm-1) = '\0'; - return(arg1); -} diff --git a/usr/src/lib/libbc/libc/gen/common/getenv.c b/usr/src/lib/libbc/libc/gen/common/getenv.c deleted file mode 100644 index e6c4fb2062..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/getenv.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -/* - * getenv(name) - * returns ptr to value associated with name, if any, else NULL - */ -#define NULL 0 -extern char **environ; -static char *nvmatch(); - -char * -getenv(name) -register char *name; -{ - register char *v, **p=environ; - - if(p == NULL) - return(NULL); - while(*p != NULL) - if((v = nvmatch(name, *p++)) != NULL) - return(v); - return(NULL); -} - -/* - * s1 is either name, or name=value - * s2 is name=value - * if names match, return value of s2, else NULL - * used for environment searching: see getenv - */ - -static char * -nvmatch(s1, s2) -register char *s1, *s2; -{ - while(*s1 == *s2++) - if(*s1++ == '=') - return(s2); - if(*s1 == '\0' && *(s2-1) == '=') - return(s2); - return(NULL); -} diff --git a/usr/src/lib/libbc/libc/gen/common/getgraent.c b/usr/src/lib/libbc/libc/gen/common/getgraent.c deleted file mode 100644 index 006a30355a..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/getgraent.c +++ /dev/null @@ -1,462 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <grp.h> -#include <grpadj.h> -#include <rpcsvc/ypclnt.h> -#include <string.h> -#include <malloc.h> - -extern void rewind(); -extern long strtol(); -extern int fclose(); - -void setgraent(void); -void endgraent(void); - -static struct gradata { - char *domain; - FILE *grfa; - char *yp; - int yplen; - char *oldyp; - int oldyplen; - struct list { - char *name; - struct list *nxt; - } *minuslist; /* list of - items */ - struct group_adjunct interpgra; - char interpline[BUFSIZ+1]; - struct group_adjunct *sv; -} *gradata, *_gradata(void); - -static char *GROUPADJ = "/etc/security/group.adjunct"; - -static struct group_adjunct *interpret(char *, int); -static struct group_adjunct *interpretwithsave(char *, int, - struct group_adjunct *); -static struct group_adjunct *save(struct group_adjunct *); -static struct group_adjunct *getnamefromyellow(char *, - struct group_adjunct *); -static int onminuslist(struct group_adjunct *); -static int matchname(char [], struct group_adjunct **, char *); -static void freeminuslist(void); -static void getnextfromyellow(void); -static void getfirstfromyellow(void); -static void addtominuslist(char *); - - -static struct gradata * -_gradata(void) -{ - struct gradata *g = gradata; - - if (g == 0) { - g = (struct gradata *)calloc(1, sizeof (struct gradata)); - gradata = g; - } - return (g); -} - -struct group_adjunct * -getgranam(char *name) -{ - struct gradata *g = _gradata(); - struct group_adjunct *gra; - char line[BUFSIZ+1]; - - setgraent(); - if (g == 0) - return (0); - if (!g->grfa) - return (NULL); - while (fgets(line, BUFSIZ, g->grfa) != NULL) { - if ((gra = interpret(line, strlen(line))) == NULL) - continue; - if (matchname(line, &gra, name)) { - endgraent(); - return (gra); - } - } - endgraent(); - return (NULL); -} - -void -setgraent(void) -{ - struct gradata *g = _gradata(); - - if (g == NULL) - return; - if (g->domain == NULL) - (void) yp_get_default_domain(&g->domain); - if (!g->grfa) - g->grfa = fopen(GROUPADJ, "r"); - else - rewind(g->grfa); - if (g->yp) - free(g->yp); - g->yp = NULL; - freeminuslist(); -} - -void -endgraent(void) -{ - struct gradata *g = _gradata(); - - if (g == 0) - return; - if (g->grfa) { - (void) fclose(g->grfa); - g->grfa = NULL; - } - if (g->yp) - free(g->yp); - g->yp = NULL; - freeminuslist(); -} - -struct group_adjunct * -fgetgraent(FILE *f) -{ - char line1[BUFSIZ+1]; - - if(fgets(line1, BUFSIZ, f) == NULL) - return (NULL); - return (interpret(line1, strlen(line1))); -} - -static char * -grskip(char *p, int c) -{ - while(*p && *p != c && *p != '\n') ++p; - if (*p == '\n') - *p = '\0'; - else if (*p != '\0') - *p++ = '\0'; - return (p); -} - -struct group_adjunct * -getgraent(void) -{ - struct gradata *g = _gradata(); - char line1[BUFSIZ+1]; - static struct group_adjunct *savegra; - struct group_adjunct *gra; - - if (g == 0) - return (0); - if (g->domain == NULL) { - (void) yp_get_default_domain(&g->domain); - } - if(!g->grfa && !(g->grfa = fopen(GROUPADJ, "r"))) - return (NULL); - again: - if (g->yp) { - gra = interpretwithsave(g->yp, g->yplen, savegra); - free(g->yp); - if (gra == NULL) - return (NULL); - getnextfromyellow(); - if (onminuslist(gra)) - goto again; - else - return (gra); - } - else if (fgets(line1, BUFSIZ, g->grfa) == NULL) - return (NULL); - if ((gra = interpret(line1, strlen(line1))) == NULL) - return (NULL); - switch(line1[0]) { - case '+': - if (strcmp(gra->gra_name, "+") == 0) { - getfirstfromyellow(); - savegra = save(gra); - goto again; - } - /* - * else look up this entry in NIS - */ - savegra = save(gra); - gra = getnamefromyellow(gra->gra_name+1, savegra); - if (gra == NULL) - goto again; - else if (onminuslist(gra)) - goto again; - else - return (gra); - break; - case '-': - addtominuslist(gra->gra_name+1); - goto again; - break; - default: - if (onminuslist(gra)) - goto again; - return (gra); - break; - } - /* NOTREACHED */ -} - -static struct group_adjunct * -interpret(char *val, int len) -{ - struct gradata *g = _gradata(); - char *p; - - if (g == 0) - return (0); - strncpy(g->interpline, val, len); - p = g->interpline; - g->interpline[len] = '\n'; - g->interpline[len+1] = 0; - g->interpgra.gra_name = p; - p = grskip(p,':'); - if (strcmp(g->interpgra.gra_name, "+") == 0) { - /* we are going to the NIS - fix the - * rest of the struct as much as is needed - */ - g->interpgra.gra_passwd = ""; - return (&g->interpgra); - } - g->interpgra.gra_passwd = p; - while(*p && *p != '\n') p++; - *p = '\0'; - return (&g->interpgra); -} - -static void -freeminuslist(void) -{ - struct gradata *g = _gradata(); - struct list *ls; - - if (g == 0) - return; - for (ls = g->minuslist; ls != NULL; ls = ls->nxt) { - free(ls->name); - free(ls); - } - g->minuslist = NULL; -} - -static struct group_adjunct * -interpretwithsave(char *val, int len, struct group_adjunct *savegra) -{ - struct gradata *g = _gradata(); - struct group_adjunct *gra; - - if (g == 0) - return (0); - if ((gra = interpret(val, len)) == NULL) - return (NULL); - if (savegra->gra_passwd && *savegra->gra_passwd) - gra->gra_passwd = savegra->gra_passwd; - return (gra); -} - -static int -onminuslist(struct group_adjunct *gra) -{ - struct gradata *g = _gradata(); - struct list *ls; - char *nm; - - if (g == 0) - return (0); - nm = gra->gra_name; - for (ls = g->minuslist; ls != NULL; ls = ls->nxt) - if (strcmp(ls->name, nm) == 0) - return (1); - return (0); -} - -static void -getnextfromyellow(void) -{ - struct gradata *g = _gradata(); - int reason; - char *key = NULL; - int keylen; - - if (g == 0) - return; - if (reason = yp_next(g->domain, "group.adjunct.byname", - g->oldyp, g->oldyplen, &key, &keylen, - &g->yp, &g->yplen)) { -#ifdef DEBUG -fprintf(stderr, "reason yp_next failed is %d\n", reason); -#endif - g->yp = NULL; - } - if (g->oldyp) - free(g->oldyp); - g->oldyp = key; - g->oldyplen = keylen; -} - -static void -getfirstfromyellow(void) -{ - struct gradata *g = _gradata(); - int reason; - char *key = NULL; - int keylen; - - if (g == 0) - return; - if (reason = yp_first(g->domain, "group.adjunct.byname", - &key, &keylen, &g->yp, &g->yplen)) { -#ifdef DEBUG -fprintf(stderr, "reason yp_first failed is %d\n", reason); -#endif - g->yp = NULL; - } - if (g->oldyp) - free(g->oldyp); - g->oldyp = key; - g->oldyplen = keylen; -} - -static struct group_adjunct * -getnamefromyellow(char *name, struct group_adjunct *savegra) -{ - struct gradata *g = _gradata(); - struct group_adjunct *gra; - int reason; - char *val; - int vallen; - - if (g == 0) - return (NULL); - if (reason = yp_match(g->domain, "group.adjunct.byname", - name, strlen(name), &val, &vallen)) { -#ifdef DEBUG -fprintf(stderr, "reason yp_next failed is %d\n", reason); -#endif - return (NULL); - } - else { - gra = interpret(val, vallen); - free(val); - if (gra == NULL) - return (NULL); - if (savegra->gra_passwd && *savegra->gra_passwd) - gra->gra_passwd = savegra->gra_passwd; - return (gra); - } -} - -static void -addtominuslist(char *name) -{ - struct gradata *g = _gradata(); - struct list *ls; - char *buf; - - if (g == 0) - return; - ls = (struct list *)malloc(sizeof(struct list)); - buf = (char *)malloc(strlen(name) + 1); - (void) strcpy(buf, name); - ls->name = buf; - ls->nxt = g->minuslist; - g->minuslist = ls; -} - -/* - * save away psswd field, which is the only - * one which can be specified in a local + entry to override the - * value in the NIS - */ -static struct group_adjunct * -save(struct group_adjunct *gra) -{ - struct gradata *g = _gradata(); - - if (g == 0) - return (0); - /* - * free up stuff from last time around - */ - if (g->sv) { - free(g->sv->gra_passwd); - free(g->sv); - } - g->sv = (struct group_adjunct *)calloc(1, sizeof(struct group_adjunct)); - g->sv->gra_passwd = (char *)malloc(strlen(gra->gra_passwd) + 1); - (void) strcpy(g->sv->gra_passwd, gra->gra_passwd); - return (g->sv); -} - -static int -matchname(char line1[], struct group_adjunct **grap, char *name) -{ - struct group_adjunct *savegra; - struct group_adjunct *gra = *grap; - - switch (line1[0]) { - case '+': - if (strcmp(gra->gra_name, "+") == 0) { - savegra = save(gra); - gra = getnamefromyellow(name, savegra); - if (gra) { - *grap = gra; - return (1); - } - else - return (0); - } - if (strcmp(gra->gra_name+1, name) == 0) { - savegra = save(gra); - gra = getnamefromyellow(gra->gra_name+1, savegra); - if (gra) { - *grap = gra; - return (1); - } - else - return (0); - } - break; - case '-': - if (strcmp(gra->gra_name+1, name) == 0) { - *grap = NULL; - return (1); - } - break; - default: - if (strcmp(gra->gra_name, name) == 0) - return (1); - } - return (0); -} diff --git a/usr/src/lib/libbc/libc/gen/common/getlogin.c b/usr/src/lib/libbc/libc/gen/common/getlogin.c deleted file mode 100644 index d5c0dd2baf..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/getlogin.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1992 by Sun Microsystems, Inc. - */ - -#include <pwd.h> -#include <stdio.h> - -char * -getlogin() -{ - char *lgn; - - if ((lgn = (char *)_getlogin()) == NULL) { - struct passwd *pwd; - if ((pwd = (struct passwd *)_getpwuid(_getuid())) != NULL) - return (pwd->pw_name); - } - return (lgn); -} diff --git a/usr/src/lib/libbc/libc/gen/common/getopt.c b/usr/src/lib/libbc/libc/gen/common/getopt.c deleted file mode 100644 index 84d33cdc25..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/getopt.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1987 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by the University of California, Berkeley. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - - -/* LINTLIBRARY */ - -#include <stdio.h> -#include <string.h> - -/* - * get option letter from argument vector - */ -/* See lib/libc/gen/common/optind.c for next 3 definitions. */ -extern char *optarg; /* argument associated with option */ -extern int opterr; /* if error message should be printed */ -extern int optind; /* index into parent argv vector */ -int optopt; /* character checked for validity */ - - -#define BADCH (int)'?' -#define EMSG "" - -int -getopt(int nargc, char **nargv, char *ostr) -{ - static char *place = EMSG; /* option letter processing */ - char *oli; /* option letter list index */ - char *p; - - if (!*place) { /* update scanning pointer */ - if (optind >= nargc || *(place = nargv[optind]) != '-') { - place = EMSG; - return (EOF); - } - if (place[1] && *++place == '-') { /* found "--" */ - ++optind; - place = EMSG; - return (EOF); - } - } /* option letter okay? */ - if ((optopt = (int)*place++) == (int)':' || - !(oli = strchr(ostr, optopt))) { - - /* - * For backwards compatibility: don't treat '-' as an - * option letter unless caller explicitly asked for it. - */ - if (optopt == (int)'-') - return (EOF); - if (!*place) - ++optind; - if (opterr) { - if (!(p = strrchr(*nargv, '/'))) - p = *nargv; - else - ++p; - (void)fprintf(stderr, "%s: illegal option -- %c\n", - p, optopt); - } - return (BADCH); - } - if (*++oli != ':') { /* don't need argument */ - optarg = NULL; - if (!*place) - ++optind; - } else { /* need an argument */ - if (*place) /* no white space */ - optarg = place; - else if (nargc <= ++optind) { /* no arg */ - place = EMSG; - if (!(p = strrchr(*nargv, '/'))) - p = *nargv; - else - ++p; - if (opterr) - (void)fprintf(stderr, - "%s: option requires an argument -- %c\n", - p, optopt); - return (BADCH); - } else /* white space */ - optarg = nargv[optind]; - place = EMSG; - ++optind; - } - return (optopt); /* dump back option letter */ -} diff --git a/usr/src/lib/libbc/libc/gen/common/getpass.c b/usr/src/lib/libbc/libc/gen/common/getpass.c deleted file mode 100644 index 302afa7d3f..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/getpass.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <signal.h> -#include <termios.h> -#include <unistd.h> - -extern void setbuf(); -extern int fclose(FILE *); -extern int fprintf(FILE *, char *, ...); -extern int findiop(); -extern int ioctl(); -static int intrupt; - -static void catch(void); - -#define MAXPASSWD 8 /* max significant characters in password */ - -char * -getpass(char *prompt) -{ - struct termios ttyb; - long flags; - char *p; - int c; - FILE *fi; - static char pbuf[ MAXPASSWD + 1 ]; - struct sigvec osv, sv; - - if((fi = fopen("/dev/tty", "r")) == NULL) -#ifdef S5EMUL - return((char*)NULL); -#else - fi = stdin; -#endif - else - setbuf(fi, (char*)NULL); - sv.sv_handler = catch; - sv.sv_mask = 0; - sv.sv_flags = SV_INTERRUPT; - (void) sigvec(SIGINT, &sv, &osv); - intrupt = 0; - (void) ioctl(fileno(fi), TCGETS, &ttyb); - flags = ttyb.c_lflag; - ttyb.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL); - (void) ioctl(fileno(fi), TCSETSF, &ttyb); - (void) fputs(prompt, stderr); - p = pbuf; - while( !intrupt && - (c = getc(fi)) != '\n' && c != '\r' && c != EOF ) { - if(p < &pbuf[ MAXPASSWD ]) - *p++ = c; - } - *p = '\0'; - ttyb.c_lflag = flags; - (void) ioctl(fileno(fi), TCSETSW, &ttyb); - (void) putc('\n', stderr); - (void) sigvec(SIGINT, &osv, (struct sigvec *)NULL); - if(fi != stdin) - (void) fclose(fi); -#ifdef S5EMUL /* XXX - BOTH versions should probably do this! */ - if(intrupt) - (void) kill(getpid(), SIGINT); -#endif - return(pbuf); -} - -static void -catch(void) -{ - ++intrupt; -} diff --git a/usr/src/lib/libbc/libc/gen/common/getpwaent.c b/usr/src/lib/libbc/libc/gen/common/getpwaent.c deleted file mode 100644 index fa3e1c5b64..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/getpwaent.c +++ /dev/null @@ -1,557 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1991 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - - -#include <stdio.h> -#include <sys/types.h> -#include <sys/label.h> -#include <sys/audit.h> -#include <pwdadj.h> -#include <pwd.h> -#include <rpcsvc/ypclnt.h> -#include <string.h> -#include <malloc.h> - -extern void rewind(); -extern long strtol(); -extern int fclose(); - -void setpwaent(void); -void endpwaent(void); - -static struct _pwajunk { - struct passwd _NULLPW; - FILE *_pwfadj; - char *_yp; - int _yplen; - char *_oldyp; - int _oldyplen; - struct list { - char *name; - struct list *nxt; - } *_minuslist; - struct passwd _interppasswd; - struct passwd_adjunct _apwadj; - char _interpline[BUFSIZ+1]; - char *_domain; -} *__pwajunk, *_pwajunk(void); - -#define NULLPW (_pwa->_NULLPW) -#define pwfadj (_pwa->_pwfadj) -#define yp (_pwa->_yp) -#define yplen (_pwa->_yplen) -#define oldyp (_pwa->_oldyp) -#define oldyplen (_pwa->_oldyplen) -#define minuslist (_pwa->_minuslist) -#define interppasswd (_pwa->_interppasswd) -#define apwadj (_pwa->_apwadj) -#define interpline (_pwa->_interpline) -#define domain (_pwa->_domain) - -static char *PASSWDADJ = "/etc/security/passwd.adjunct"; - -static struct passwd_adjunct *interpret(char *, int); -static struct passwd_adjunct *interpretwithsave(char *, int, - struct passwd_adjunct *); -static struct passwd_adjunct *save(struct passwd_adjunct *); -static struct passwd_adjunct *getnamefromyellow(char *, - struct passwd_adjunct *); -static int matchname(char [], struct passwd_adjunct **, char *); -static int onminuslist(struct passwd_adjunct *); -static void getnextfromyellow(void); -static void getfirstfromyellow(void); -static void freeminuslist(void); -static void addtominuslist(char *); - - - -static struct _pwajunk * -_pwajunk(void) -{ - - if (__pwajunk == 0) - __pwajunk = (struct _pwajunk *)calloc(1, sizeof (*__pwajunk)); - return (__pwajunk); -} - -struct passwd_adjunct * -getpwanam(char *name) -{ - struct _pwajunk *_pwa = _pwajunk(); - struct passwd_adjunct *pwadj; - char line[BUFSIZ+1]; - - if (_pwa == 0) - return (NULL); - setpwaent(); - if (!pwfadj) - return (NULL); - while (fgets(line, BUFSIZ, pwfadj) != NULL) { - if ((pwadj = interpret(line, strlen(line))) == NULL) - continue; - if (matchname(line, &pwadj, name)) { - endpwaent(); - return (pwadj); - } - } - endpwaent(); - return (NULL); -} - - -void -setpwaent(void) -{ - struct _pwajunk *_pwa = _pwajunk(); - - if (_pwa == 0) - return; - if (domain == NULL) { - (void) yp_get_default_domain(&domain ); - } - if (pwfadj == NULL) - pwfadj = fopen(PASSWDADJ, "r"); - else - rewind(pwfadj); - if (yp) - free(yp); - yp = NULL; - freeminuslist(); -} - - - -void -endpwaent(void) -{ - struct _pwajunk *_pwa = _pwajunk(); - - if (_pwa == 0) - return; - if (pwfadj != NULL) { - (void) fclose(pwfadj); - pwfadj = NULL; - } - if (yp) - free(yp); - yp = NULL; - freeminuslist(); - endnetgrent(); -} - - - -struct passwd_adjunct * -getpwaent(void) -{ - struct _pwajunk *_pwa = _pwajunk(); - char line[BUFSIZ+1]; - static struct passwd_adjunct *savepwadj; - struct passwd_adjunct *pwadj; - char *user; - char *mach; - char *dom; - - if (_pwa == 0) - return (NULL); - if (domain == NULL) { - (void) yp_get_default_domain(&domain ); - } - if (pwfadj == NULL && (pwfadj = fopen(PASSWDADJ, "r")) == NULL) { - return (NULL); - } - - for (;;) { - if (yp) { - pwadj = interpretwithsave(yp, yplen, savepwadj); - free(yp); - if (pwadj == NULL) - return (NULL); - getnextfromyellow(); - if (!onminuslist(pwadj)) { - return (pwadj); - } - } else if (getnetgrent(&mach,&user,&dom)) { - if (user) { - pwadj = getnamefromyellow(user, savepwadj); - if (pwadj != NULL && !onminuslist(pwadj)) { - return (pwadj); - } - } - } else { - endnetgrent(); - if (fgets(line, BUFSIZ, pwfadj) == NULL) { - return (NULL); - } - if ((pwadj = interpret(line, strlen(line))) == NULL) - return (NULL); - switch(line[0]) { - case '+': - if (strcmp(pwadj->pwa_name, "+") == 0) { - getfirstfromyellow(); - savepwadj = save(pwadj); - } else if (line[1] == '@') { - savepwadj = save(pwadj); - if (innetgr(pwadj->pwa_name+2,(char *) NULL,"*",domain)) { - /* include the whole NIS database */ - getfirstfromyellow(); - } else { - setnetgrent(pwadj->pwa_name+2); - } - } else { - /* - * else look up this entry in NIS - */ - savepwadj = save(pwadj); - pwadj = getnamefromyellow(pwadj->pwa_name+1, savepwadj); - if (pwadj != NULL && !onminuslist(pwadj)) { - return (pwadj); - } - } - break; - case '-': - if (line[1] == '@') { - if (innetgr(pwadj->pwa_name+2,(char *) NULL,"*",domain)) { - /* everybody was subtracted */ - return (NULL); - } - setnetgrent(pwadj->pwa_name+2); - while (getnetgrent(&mach,&user,&dom)) { - if (user) { - addtominuslist(user); - } - } - endnetgrent(); - } else { - addtominuslist(pwadj->pwa_name+1); - } - break; - default: - if (!onminuslist(pwadj)) { - return (pwadj); - } - break; - } - } - } -} - -static int -matchname(char line1[], struct passwd_adjunct **pwadjp, char *name) -{ - struct _pwajunk *_pwa = _pwajunk(); - struct passwd_adjunct *savepwadj; - struct passwd_adjunct *pwadj = *pwadjp; - - if (_pwa == 0) - return (0); - switch(line1[0]) { - case '+': - if (strcmp(pwadj->pwa_name, "+") == 0) { - savepwadj = save(pwadj); - pwadj = getnamefromyellow(name, savepwadj); - if (pwadj) { - *pwadjp = pwadj; - return (1); - } - else - return (0); - } - if (line1[1] == '@') { - if (innetgr(pwadj->pwa_name+2,(char *) NULL,name,domain)) { - savepwadj = save(pwadj); - pwadj = getnamefromyellow(name,savepwadj); - if (pwadj) { - *pwadjp = pwadj; - return (1); - } - } - return (0); - } - if (strcmp(pwadj->pwa_name+1, name) == 0) { - savepwadj = save(pwadj); - pwadj = getnamefromyellow(pwadj->pwa_name+1, savepwadj); - if (pwadj) { - *pwadjp = pwadj; - return (1); - } - else - return (0); - } - break; - case '-': - if (line1[1] == '@') { - if (innetgr(pwadj->pwa_name+2,(char *) NULL,name,domain)) { - *pwadjp = NULL; - return (1); - } - } - else if (strcmp(pwadj->pwa_name+1, name) == 0) { - *pwadjp = NULL; - return (1); - } - break; - default: - if (strcmp(pwadj->pwa_name, name) == 0) - return (1); - } - return (0); -} - -static void -getnextfromyellow(void) -{ - struct _pwajunk *_pwa = _pwajunk(); - int reason; - char *key; - int keylen; - - if (_pwa == 0) - return; - reason = yp_next(domain, "passwd_adjunct",oldyp, oldyplen, &key - ,&keylen,&yp,&yplen); - if (reason) { -#ifdef DEBUG -fprintf(stderr, "reason yp_next failed is %d\n", reason); -#endif - yp = NULL; - } - if (oldyp) - free(oldyp); - oldyp = key; - oldyplen = keylen; -} - -static void -getfirstfromyellow(void) -{ - struct _pwajunk *_pwa = _pwajunk(); - int reason; - char *key; - int keylen; - - if (_pwa == 0) - return; - reason = yp_first(domain, "passwd_adjunct", &key, &keylen, &yp, &yplen); - if (reason) { -#ifdef DEBUG -fprintf(stderr, "reason yp_first failed is %d\n", reason); -#endif - yp = NULL; - } - if (oldyp) - free(oldyp); - oldyp = key; - oldyplen = keylen; -} - -static struct passwd_adjunct * -getnamefromyellow(char *name, struct passwd_adjunct *savepwadj) -{ - struct _pwajunk *_pwa = _pwajunk(); - struct passwd_adjunct *pwadj; - int reason; - char *val; - int vallen; - - if (_pwa == 0) - return (NULL); - reason = yp_match(domain, "passwd.adjunct.byname", name, strlen(name) - , &val, &vallen); - if (reason) { -#ifdef DEBUG -fprintf(stderr, "reason yp_match failed is %d\n", reason); -#endif - return (NULL); - } else { - pwadj = interpret(val, vallen); - free(val); - if (pwadj == NULL) - return (NULL); - if (savepwadj->pwa_passwd && *savepwadj->pwa_passwd) - pwadj->pwa_passwd = savepwadj->pwa_passwd; - return (pwadj); - } -} - -static struct passwd_adjunct * -interpretwithsave(char *val, int len, struct passwd_adjunct *savepwadj) -{ - struct _pwajunk *_pwa = _pwajunk(); - struct passwd_adjunct *pwadj; - - if (_pwa == 0) - return (NULL); - if ((pwadj = interpret(val, len)) == NULL) - return (NULL); - if (savepwadj->pwa_passwd && *savepwadj->pwa_passwd) - pwadj->pwa_passwd = savepwadj->pwa_passwd; - return (pwadj); -} - -static char * -pwskip(char *p) -{ - while(*p && *p != ':' && *p != '\n') - ++p; - if (*p == '\n') - *p = '\0'; - else if (*p != '\0') - *p++ = '\0'; - return (p); -} - -static struct passwd_adjunct * -interpret(char *val, int len) -{ - struct _pwajunk *_pwa = _pwajunk(); - char *p; - char *field; - - if (_pwa == 0) - return (NULL); - (void) strncpy(interpline, val, len); - p = interpline; - interpline[len] = '\n'; - interpline[len+1] = 0; - - apwadj.pwa_name = p; - p = pwskip(p); - if (strcmp(apwadj.pwa_name, "+") == 0) { - /* we are going to the NIS - fix the - * rest of the struct as much as is needed - */ - apwadj.pwa_passwd = ""; - return (&apwadj); - } - apwadj.pwa_passwd = p; - p = pwskip(p); - field = p; - p = pwskip(p); - labelfromstring(0, field, &apwadj.pwa_minimum); - field = p; - p = pwskip(p); - labelfromstring(0, field, &apwadj.pwa_maximum); - field = p; - p = pwskip(p); - labelfromstring(0, field, &apwadj.pwa_def); - field = p; - p = pwskip(p); - apwadj.pwa_au_always.as_success = 0; - apwadj.pwa_au_always.as_failure = 0; - if (getauditflagsbin(field, &apwadj.pwa_au_always) != 0) - return (NULL); - field = p; - (void) pwskip(p); - p = apwadj.pwa_passwd; - while (*p && *p != ',') - p++; - if (*p) - *p = '\0'; - apwadj.pwa_age = p; - apwadj.pwa_au_never.as_success = 0; - apwadj.pwa_au_never.as_failure = 0; - if (getauditflagsbin(field, &apwadj.pwa_au_never) != 0) - return (NULL); - return (&apwadj); -} - -static void -freeminuslist(void) { - struct _pwajunk *_pwa = _pwajunk(); - struct list *ls; - - if (_pwa == 0) - return; - for (ls = minuslist; ls != NULL; ls = ls->nxt) { - free(ls->name); - free((char *) ls); - } - minuslist = NULL; -} - -static void -addtominuslist(char *name) -{ - struct _pwajunk *_pwa = _pwajunk(); - struct list *ls; - char *buf; - - if (_pwa == 0) - return; - ls = (struct list *) malloc(sizeof(struct list)); - buf = malloc((unsigned) strlen(name) + 1); - (void) strcpy(buf, name); - ls->name = buf; - ls->nxt = minuslist; - minuslist = ls; -} - -/* - * save away the psswd field, which is the only one which can be - * specified in a local + entry to override the value in the NIS - * for passwd.adjunct - */ -static struct passwd_adjunct * -save(struct passwd_adjunct *pwadj) -{ - struct _pwajunk *_pwa = _pwajunk(); - static struct passwd_adjunct *sv; - - if (_pwa == 0) - return (NULL); - /* free up stuff from last call */ - if (sv) { - free(sv->pwa_passwd); - free((char *) sv); - } - sv = (struct passwd_adjunct *) malloc(sizeof(struct passwd_adjunct)); - - sv->pwa_passwd = malloc((unsigned) strlen(pwadj->pwa_passwd) + 1); - (void) strcpy(sv->pwa_passwd, pwadj->pwa_passwd); - - return (sv); -} - -static int -onminuslist(struct passwd_adjunct *pwadj) -{ - struct _pwajunk *_pwa = _pwajunk(); - struct list *ls; - char *nm; - - if (_pwa == 0) - return (0); - nm = pwadj->pwa_name; - for (ls = minuslist; ls != NULL; ls = ls->nxt) { - if (strcmp(ls->name,nm) == 0) { - return (1); - } - } - return (0); -} diff --git a/usr/src/lib/libbc/libc/gen/common/getsubopt.c b/usr/src/lib/libbc/libc/gen/common/getsubopt.c deleted file mode 100644 index c41bcca34b..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/getsubopt.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - /* created from scratch */ - -/* - * getsubopt - parse suboptions from a flag argument. - */ -#include <string.h> -#include <stdio.h> - -int -getsubopt(optionsp, tokens, valuep) - char **optionsp; - char *tokens[]; - char **valuep; -{ - register char *s = *optionsp, *p; - register int i, optlen; - - *valuep = NULL; - if (*s == '\0') - return (-1); - p = strchr(s, ','); /* find next option */ - if (p == NULL) { - p = s + strlen(s); - } else { - *p++ = '\0'; /* mark end and point to next */ - } - *optionsp = p; /* point to next option */ - p = strchr(s, '='); /* find value */ - if (p == NULL) { - optlen = strlen(s); - *valuep = NULL; - } else { - optlen = p - s; - *valuep = ++p; - } - for (i = 0; tokens[i] != NULL; i++) { - if ((optlen == strlen(tokens[i])) && - (strncmp(s, tokens[i], optlen) == 0)) - return (i); - } - /* no match, point value at option and return error */ - *valuep = s; - return (-1); -} - diff --git a/usr/src/lib/libbc/libc/gen/common/getttyent.c b/usr/src/lib/libbc/libc/gen/common/getttyent.c deleted file mode 100644 index ddea7093df..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/getttyent.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 1985 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - - -#include <stdio.h> -#include <strings.h> -#include <ttyent.h> - -static char *TTYFILE = "/etc/ttytab"; -#define LINE 256 -static struct _ttyentjunk { - char zapchar; - FILE *tf; - char line[LINE]; - struct ttyent tty; -} *__ttyentjunk, *_ttyentjunk(void); - -static struct _ttyentjunk * -_ttyentjunk(void) -{ - - if (__ttyentjunk == 0) - __ttyentjunk = (struct _ttyentjunk *)calloc(1, sizeof (struct _ttyentjunk)); - return (__ttyentjunk); -} - -void -setttyent(void) -{ - struct _ttyentjunk *t = _ttyentjunk(); - - if (t == 0) - return; - if (t->tf == NULL) - t->tf = fopen(TTYFILE, "r"); - else - rewind(t->tf); -} - -void -endttyent(void) -{ - struct _ttyentjunk *t = _ttyentjunk(); - - if (t == 0) - return; - if (t->tf != NULL) { - (void) fclose(t->tf); - t->tf = NULL; - } -} - -#define QUOTED 1 - -/* - * Skip over the current field, removing quotes, - * and return a pointer to the next field. - */ -static char * -skip(char *p) -{ - struct _ttyentjunk *t = _ttyentjunk(); - char *cp = p; - int c; - int q = 0; - - if (t == 0) - return (0); - for (; (c = *p) != '\0'; p++) { - if (c == '"') { - q ^= QUOTED; /* obscure, but nice */ - continue; - } - if (q == QUOTED && *p == '\\' && *(p+1) == '"') - p++; - *cp++ = *p; - if (q == QUOTED) - continue; - if (c == '#') { - t->zapchar = c; - *p = 0; - break; - } - if (c == '\t' || c == ' ' || c == '\n') { - t->zapchar = c; - *p++ = 0; - while ((c = *p) == '\t' || c == ' ' || c == '\n') - p++; - break; - } - } - *--cp = '\0'; - return (p); -} - -static char * -value(char *p) -{ - if ((p = index(p,'=')) == 0) - return (NULL); - p++; /* get past the = sign */ - return (p); -} - -struct ttyent * -getttyent(void) -{ - struct _ttyentjunk *t = _ttyentjunk(); - char *p; - int c; - - if (t == 0) - return (NULL); - if (t->tf == NULL) { - if ((t->tf = fopen(TTYFILE, "r")) == NULL) - return (NULL); - } - do { - p = fgets(t->line, LINE, t->tf); - if (p == NULL) - return (NULL); - while ((c = *p) == '\t' || c == ' ' || c == '\n') - p++; - } while (c == '\0' || c == '#'); - t->zapchar = 0; - t->tty.ty_name = p; - p = skip(p); - t->tty.ty_getty = p; - p = skip(p); - t->tty.ty_type = p; - p = skip(p); - t->tty.ty_status = 0; - t->tty.ty_window = NULL; - for (; *p; p = skip(p)) { -#define space(x) ((c = p[x]) == ' ' || c == '\t' || c == '\n') - if (strncmp(p, "on", 2) == 0 && space(2)) - t->tty.ty_status |= TTY_ON; - else if (strncmp(p, "off", 3) == 0 && space(3)) - t->tty.ty_status &= ~TTY_ON; - else if (strncmp(p, "secure", 6) == 0 && space(6)) - t->tty.ty_status |= TTY_SECURE; - else if (strncmp(p, "local", 5) == 0 && space(5)) - t->tty.ty_status |= TTY_LOCAL; - else if (strncmp(p, "window=", 7) == 0) - t->tty.ty_window = value(p); - else - break; - } - if (t->zapchar == '#' || *p == '#') - while ((c = *++p) == ' ' || c == '\t') - ; - t->tty.ty_comment = p; - if (*p == 0) - t->tty.ty_comment = 0; - if (p = index(p, '\n')) - *p = '\0'; - return (&t->tty); -} diff --git a/usr/src/lib/libbc/libc/gen/common/getttynam.c b/usr/src/lib/libbc/libc/gen/common/getttynam.c deleted file mode 100644 index b61ba7b1cc..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/getttynam.c +++ /dev/null @@ -1,24 +0,0 @@ -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 5.2 3/9/86 */ -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#include <ttyent.h> - -struct ttyent * -getttynam(tty) - char *tty; -{ - register struct ttyent *t; - - setttyent(); - while (t = getttyent()) { - if (strcmp(tty, t->ty_name) == 0) - break; - } - endttyent(); - return (t); -} diff --git a/usr/src/lib/libbc/libc/gen/common/getusershell.c b/usr/src/lib/libbc/libc/gen/common/getusershell.c deleted file mode 100644 index f164bea8e4..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/getusershell.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 1985 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/param.h> -#include <sys/file.h> -#include <sys/stat.h> -#include <ctype.h> -#include <stdio.h> -#include <malloc.h> - -#define SHELLS "/etc/shells" - -/* - * Do not add local shells here. They should be added in /etc/shells - */ -static char *okshells[] = - { "/bin/sh", "/bin/csh", "/usr/bin/sh", "/usr/bin/csh", 0 }; - -static char **shells, *strings; -static char **curshell; - -static char **initshells(void); - -/* - * Get a list of shells from SHELLS, if it exists. - */ -char * -getusershell(void) -{ - char *ret; - - if (curshell == NULL) - curshell = initshells(); - ret = *curshell; - if (ret != NULL) - curshell++; - return (ret); -} - -void -endusershell(void) -{ - - if (shells != NULL) - free((char *)shells); - shells = NULL; - if (strings != NULL) - free(strings); - strings = NULL; - curshell = NULL; -} - -void -setusershell(void) -{ - - curshell = initshells(); -} - -static char ** -initshells(void) -{ - char **sp, *cp; - FILE *fp; - struct stat statb; - - if (shells != NULL) - free((char *)shells); - shells = NULL; - if (strings != NULL) - free(strings); - strings = NULL; - if ((fp = fopen(SHELLS, "r")) == (FILE *)0) - return (okshells); - if (fstat(fileno(fp), &statb) == -1) { - (void)fclose(fp); - return (okshells); - } - if ((strings = malloc((unsigned)statb.st_size + 1)) == NULL) { - (void)fclose(fp); - return (okshells); - } - shells = (char **)calloc((unsigned)statb.st_size / 3, sizeof (char *)); - if (shells == NULL) { - (void)fclose(fp); - free(strings); - strings = NULL; - return (okshells); - } - sp = shells; - cp = strings; - while (fgets(cp, MAXPATHLEN + 1, fp) != NULL) { - while (*cp != '#' && *cp != '/' && *cp != '\0') - cp++; - if (*cp == '#' || *cp == '\0') - continue; - *sp++ = cp; - while (!isspace(*cp) && *cp != '#' && *cp != '\0') - cp++; - *cp++ = '\0'; - } - *sp = (char *)0; - (void)fclose(fp); - return (shells); -} diff --git a/usr/src/lib/libbc/libc/gen/common/grpauth.c b/usr/src/lib/libbc/libc/gen/common/grpauth.c deleted file mode 100644 index 3532ae959e..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/grpauth.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1992 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <signal.h> -#include <grp.h> -#include <sys/time.h> -#include <errno.h> - -/* - * Version to go in the BCP compatibility library in SVr4 version of - * SunOS. This does not bother talking to rpc.pwdauthd or looking for the - * password.adjunct file on the system since they do not exist anymore. - * They have been effectively replaced by a more robust aging security provided - * by the combination of /etc/shadow file, shadow support in the NIS+ - * passwd table and the use of secure RPC in NIS+. - */ - -int -grpauth(char *name, char *password) -{ - - /* - * this routine authenticates a password for the named user. - * Assumes the adjunct file does not exist. - * and therefore checks the group "source" using the standard - * getgrnam(3C) routine that uses /etc/nsswitch.conf(4). - */ - struct group gr; - struct group *grp; - - if ((grp = getgrnam(name)) == NULL) - /* group is not in main password system */ - return (-1); - gr = *grp; - if (gr.gr_passwd[0] == '#' && gr.gr_passwd[1] == '$') { - /* this means that /etc/group has problems */ - fprintf(stderr, "grpauth: bad group entry for %s\n", - gr.gr_name); - return (-1); - } - if (strcmp(crypt(password, gr.gr_passwd), gr.gr_passwd) == 0) - return (0); - else - return (-1); -} diff --git a/usr/src/lib/libbc/libc/gen/common/hsearch.c b/usr/src/lib/libbc/libc/gen/common/hsearch.c deleted file mode 100644 index 8a98c709de..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/hsearch.c +++ /dev/null @@ -1,545 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1996 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -/* Compile time switches: - - MULT - use a multiplicative hashing function. - DIV - use the remainder mod table size as a hashing function. - CHAINED - use a linked list to resolve collisions. - OPEN - use open addressing to resolve collisions. - BRENT - use Brent's modification to improve the OPEN algorithm. - SORTUP - CHAINED list is sorted in increasing order. - SORTDOWN - CHAINED list is sorted in decreasing order. - START - CHAINED list with entries appended at front. - DRIVER - compile in a main program to drive the tests. - DEBUG - compile some debugging printout statements. - USCR - user supplied comparison routine. -*/ - -#include <stdio.h> -#include <limits.h> -#include <malloc.h> -#include <string.h> - -#define SUCCEED 0 -#define FAIL 1 -#define TRUE 1 -#define FALSE 0 -#define repeat for(;;) -#define until(A) if(A) break; - -#ifdef OPEN -# undef CHAINED -#else -#ifndef CHAINED -# define OPEN -#endif -#endif - -#ifdef MULT -# undef DIV -#else -#ifndef DIV -# define MULT -#endif -#endif - -#ifdef START -# undef SORTUP -# undef SORTDOWN -#else -#ifdef SORTUP -# undef SORTDOWN -#endif -#endif - -#ifdef USCR -# define COMPARE(A, B) (* hcompar)((A), (B)) - extern int (* hcompar)(); -#else -# define COMPARE(A, B) strcmp((A), (B)) -#endif - -#ifdef MULT -# define SHIFT ((bitsper * sizeof(int)) - m) /* Shift factor */ -# define FACTOR 035761254233 /* Magic multiplication factor */ -# define HASH hashm /* Multiplicative hash function */ -# define HASH2 hash2m /* Secondary hash function */ -static unsigned int bitsper; /* Bits per byte */ -static unsigned int hashm(); -static unsigned int hash2m(); -#else -#ifdef DIV -# define HASH hashd /* Division hashing routine */ -# define HASH2(A) 1 /* Secondary hash function */ -static unsigned int hashd(); -#endif -#endif - -typedef enum { - FIND, /* Find, if present */ - ENTER /* Find; enter if not present */ -} ACTION; -typedef char *POINTER; -typedef struct entry { /* Hash table entry */ - POINTER key; - POINTER data; -} ENTRY; - -#ifdef CHAINED -typedef struct node { /* Part of the linked list of entries */ - ENTRY item; - struct node *next; -} NODE; -typedef NODE *TABELEM; -static NODE **table; /* The address of the hash table */ -static ENTRY *build(); -#else -#ifdef OPEN -typedef ENTRY TABELEM; /* What the table contains (TABle ELEMents) */ -static TABELEM *table; /* The address of the hash table */ -static unsigned int count = 0; /* Number of entries in hash table */ -#endif -#endif - -static unsigned int length; /* Size of the hash table */ -static unsigned int m; /* Log base 2 of length */ -static unsigned int prcnt; /* Number of probes this item */ - -int hcreate(); -void hdestroy(); -ENTRY *hsearch(); -static unsigned int crunch(); - -#ifdef DRIVER -static void hdump(); - -main() -{ - char line[80]; /* Room for the input line */ - int i = 0; /* Data generator */ - ENTRY *res; /* Result of hsearch */ - ENTRY *new; /* Test entry */ - - if(hcreate(5)) - printf("Length = %u, m = %u\n", length, m); - else { - fprintf(stderr, "Out of core\n"); - exit(FAIL); - } - - repeat { - hdump(); - printf("Enter a probe: "); - until (EOF == scanf("%s", line)); -#ifdef DEBUG - printf("%s, ", line); - printf("division: %d, ", hashd(line)); - printf("multiplication: %d\n", hashm(line)); -#endif - new = (ENTRY *) malloc(sizeof(ENTRY)); - if(new == NULL) { - fprintf(stderr, "Out of core \n"); - exit(FAIL); - } - else { - new->key = malloc((unsigned) strlen(line) + 1); - if(new->key == NULL) { - fprintf(stderr, "Out of core \n"); - exit(FAIL); - } - strcpy(new->key, line); - new->data = malloc(sizeof(int)); - if(new->data == NULL) { - fprintf(stderr, "Out of core \n"); - exit(FAIL); - } - *new->data = i++; - } - res = hsearch(*new, ENTER); - printf("The number of probes required was %d\n", prcnt); - if(res == (ENTRY *) 0) - printf("Table is full\n"); - else { - printf("Success: "); - printf("Key = %s, Value = %d\n", res->key, *res->data); - } - } - exit(SUCCEED); -} -#endif - -/* - * Create a hash table no smaller than size - * - * size: Minimum size for hash table - */ -int -hcreate(int size) -{ - unsigned int unsize; /* Holds the shifted size */ - - if(size <= 0) - return(FALSE); - - unsize = size; /* +1 for empty table slot; -1 for ceiling */ - length = 1; /* Maximum entries in tabbe */ - m = 0; /* Log2 length */ - while(unsize) { - unsize >>= 1; - length <<= 1; - m++; - } - - table = (TABELEM *) calloc(length, sizeof(TABELEM)); - return (table != NULL); -} - -void -hdestroy(void) /* Reset the module to its initial state */ -{ - free((POINTER) table); -#ifdef OPEN - count = 0; -#endif -} - -#ifdef OPEN -/* Hash search of a fixed-capacity table. Open addressing used to - resolve collisions. Algorithm modified from Knuth, Volume 3, - section 6.4, algorithm D. Labels flag corresponding actions. -*/ - -/* - * Find or insert the item into the table - * - * item: Item to be inserted or found - * action: FIND or ENTER - */ -ENTRY * -hsearch(ENTRY item, ACTION action) -{ - unsigned int i; /* Insertion index */ - unsigned int c; /* Secondary probe displacement */ - - prcnt = 1; - -/* D1: */ - i = HASH(item.key); /* Primary hash on key */ -#ifdef DEBUG - if(action == ENTER) - printf("hash = %o\n", i); -#endif - -/* D2: */ - if(table[i].key == NULL) /* Empty slot? */ - goto D6; - else if(COMPARE(table[i].key, item.key) == 0) /* Match? */ - return(&table[i]); - -/* D3: */ - c = HASH2(item.key); /* No match => compute secondary hash */ -#ifdef DEBUG - if(action == ENTER) - printf("hash2 = %o\n", c); -#endif - -D4: - i = (i + c) % length; /* Advance to next slot */ - prcnt++; - -/* D5: */ - if(table[i].key == NULL) /* Empty slot? */ - goto D6; - else if(COMPARE(table[i].key, item.key) == 0) /* Match? */ - return(&table[i]); - else - goto D4; - -D6: if(action == FIND) /* Insert if requested */ - return((ENTRY *) NULL); - if(count == (length - 1)) /* Table full? */ - return((ENTRY *) 0); - -#ifdef BRENT -/* Brent's variation of the open addressing algorithm. Do extra - work during insertion to speed retrieval. May require switching - of previously placed items. Adapted from Knuth, Volume 3, section - 4.6 and Brent's article in CACM, volume 10, #2, February 1973. -*/ - - { unsigned int p0 = HASH(item.key); /* First probe index */ - unsigned int c0 = HASH2(item.key); /* Main branch increment */ - unsigned int r = prcnt - 1; /* Current minimum distance */ - unsigned int j; /* Counts along main branch */ - unsigned int k; /* Counts along secondary branch */ - unsigned int curj; /* Current best main branch site */ - unsigned int curpos; /* Current best table index */ - unsigned int pj; /* Main branch indices */ - unsigned int cj; /* Secondary branch increment distance*/ - unsigned int pjk; /* Secondary branch probe indices */ - - if(prcnt >= 3) { - for(j = 0; j < prcnt; j++) { /* Count along main branch */ - pj = (p0 + j * c0) % length; /* New main branch index */ - cj = HASH2(table[pj].key); /* Secondary branch incr. */ - for(k=1; j+k <= r; k++) { /* Count on secondary branch*/ - pjk = (pj + k * cj) % length; /* Secondary probe */ - if(table[pjk].key == NULL) { /* Improvement found */ - r = j + k; /* Decrement upper bound */ - curj = pj; /* Save main probe index */ - curpos = pjk; /* Save secondeary index */ - } - } - } - if(r != prcnt - 1) { /* If an improvement occurred */ - table[curpos] = table[curj]; /* Old key to new site */ -#ifdef DEBUG - printf("Switch curpos = %o, curj = %o, oldi = %o\n", - curj, curpos, i); -#endif - i = curj; - } - } - } -#endif - count++; /* Increment table occupancy count */ - table[i] = item; /* Save item */ - return(&table[i]); /* Address of item is returned */ -} -#endif - -#ifdef USCR -# ifdef DRIVER -static int -compare(POINTER a, POINTER b) -{ - return (strcmp(a, b)); -} - -int (* hcompar)() = compare; -# endif -#endif - -#ifdef CHAINED -# ifdef SORTUP -# define STRCMP(A, B) (COMPARE((A), (B)) > 0) -# else -# ifdef SORTDOWN -# define STRCMP(A, B) (COMPARE((A), (B)) < 0) -# else -# define STRCMP(A, B) (COMPARE((A), (B)) != 0) -# endif -# endif - -/* - * Chained search with sorted lists - * - * item: Item to be inserted or found - * action: FIND or ENTER - */ -ENTRY * -hsearch(ENTRY item, ACTION action) -{ - NODE *p; /* Searches through the linked list */ - NODE **q; /* Where to store the pointer to a new NODE */ - unsigned int i; /* Result of hash */ - int res; /* Result of string comparison */ - - prcnt = 1; - - i = HASH(item.key); /* Table[i] contains list head */ - - if(table[i] == (NODE*)NULL) { /* List has not yet been begun */ - if(action == FIND) - return((ENTRY *) NULL); - else - return(build(&table[i], (NODE *) NULL, item)); - } - else { /* List is not empty */ - q = &table[i]; - p = table[i]; - while(p != NULL && (res = STRCMP(item.key, p->item.key))) { - prcnt++; - q = &(p->next); - p = p->next; - } - - if(p != NULL && res == 0) /* Item has been found */ - return(&(p->item)); - else { /* Item is not yet on list */ - if(action == FIND) - return((ENTRY *) NULL); - else -#ifdef START - return(build(&table[i], table[i], item)); -#else - return(build(q, p, item)); -#endif - } - } -} - -/* - * last: Where to store in last list item - * next: Link to next list item - * item: Item to be kept in node - */ -static ENTRY * -build(NODE **last, NODE *next, ENTRY item) -{ - NODE *p = (NODE *) malloc(sizeof(NODE)); - - if(p != NULL) { - p->item = item; - *last = p; - p->next = next; - return(&(p->item)); - } - else - return(NULL); -} -#endif - -#ifdef DIV -/* - * Division hashing scheme - * - * key: Key to be hashed - */ -static unsigned int -hashd(POINTER key) -{ - return (crunch(key) % length); -} -#else -#ifdef MULT -/* - * NOTE: The following algorithm only works on machines where - * the results of multiplying two integers is the least - * significant part of the double word integer required to hold - * the result. It is adapted from Knuth, Volume 3, section 6.4. - */ - -/* - * Multiplication hashing scheme - * - * key: Key to be hashed - */ -static unsigned int -hashm(POINTER key) -{ - static int first = TRUE; /* TRUE on the first call only */ - - if(first) { /* Compute the number of bits in a byte */ - unsigned char c = UCHAR_MAX; /* A byte full of 1's */ - bitsper = 0; - while(c) { /* Shift until no more 1's */ - c >>= 1; - bitsper++; /* Count number of shifts */ - } - first = FALSE; - } - return ((int) (((unsigned) (crunch(key) * FACTOR)) >> SHIFT)); -} - -/* - * Secondary hashing, for use with multiplicitive hashing scheme. - * Adapted from Knuth, Volume 3, section 6.4. - */ - -/* - * Secondary hashing routine - * - * key: String to be hashed - */ -static unsigned int -hash2m(POINTER key) -{ - return ((int) (((unsigned) ((crunch(key) * FACTOR) << m) >> SHIFT) | 1)); -} -#endif -#endif - -/* Convert multicharacter key to unsigned int */ -static unsigned int -crunch(POINTER key) -{ - unsigned int sum = 0; /* Results */ - int s; /* Length of the key */ - - for(s = 0; *key; s++) /* Simply add up the bytes */ - sum += *key++; - - return (sum + s); -} - -#ifdef DRIVER -static void -hdump() /* Dumps loc, data, probe count, key */ -{ - unsigned int i; /* Counts table slots */ -#ifdef OPEN - unsigned int sum = 0; /* Counts probes */ -#else -#ifdef CHAINED - NODE *a; /* Current Node on list */ -#endif -#endif - - for(i = 0; i < length; i++) -#ifdef OPEN - if(table[i].key == NULL) - printf("%o.\t-,\t-,\t(NULL)\n", i); - else { - unsigned int oldpr = prcnt; /* Save current probe count */ - hsearch(table[i], FIND); - sum += prcnt; - printf("%o.\t%d,\t%d,\t%s\n", i, - *table[i].data, prcnt, table[i].key); - prcnt = oldpr; - } - printf("Total probes = %d\n", sum); -#else -#ifdef CHAINED - if(table[i] == NULL) - printf("%o.\t-,\t-,\t(NULL)\n", i); - else { - printf("%o.", i); - for(a = table[i]; a != NULL; a = a->next) - printf("\t%d,\t%#0.4x,\t%s\n", - *a->item.data, a, a->item.key); - } -#endif -#endif -} -#endif diff --git a/usr/src/lib/libbc/libc/gen/common/ieee_globals.c b/usr/src/lib/libbc/libc/gen/common/ieee_globals.c deleted file mode 100644 index 101eeffa5c..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/ieee_globals.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1987 by Sun Microsystems, Inc. - */ - -/* - * contains definitions for variables for IEEE floating-point arithmetic - * modes; IEEE floating-point arithmetic exception handling; - */ - -#include <floatingpoint.h> - -enum fp_direction_type fp_direction; -/* - * Current rounding direction. Updated by ieee_flags. - */ - -enum fp_precision_type fp_precision; -/* - * Current rounding precision. Updated by ieee_flags. - */ - -sigfpe_handler_type ieee_handlers[N_IEEE_EXCEPTION]; -/* - * Array of pointers to functions to handle SIGFPE's corresponding to IEEE - * fp_exceptions. sigfpe_default means do not generate SIGFPE. An invalid - * address such as sigfpe_abort will cause abort on that SIGFPE. Updated by - * ieee_handler. - */ -fp_exception_field_type fp_accrued_exceptions; -/* - * Sticky accumulated exceptions, updated by ieee_flags. In hardware - * implementations this variable is not automatically updated as the hardware - * changes and should therefore not be relied on directly. - */ diff --git a/usr/src/lib/libbc/libc/gen/common/index.c b/usr/src/lib/libbc/libc/gen/common/index.c deleted file mode 100644 index 9b5e0a5766..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/index.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 4.1 80/12/21 */ - -/* - * Return the ptr in sp at which the character c appears; - * NULL if not found - */ - -#define NULL 0 - -char * -index(sp, c) - register char *sp, c; -{ - - do { - if (*sp == c) - return (sp); - } while (*sp++); - return (NULL); -} diff --git a/usr/src/lib/libbc/libc/gen/common/isatty.c b/usr/src/lib/libbc/libc/gen/common/isatty.c deleted file mode 100644 index 689f9e5e2a..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/isatty.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R3 1.7 */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - - -/*LINTLIBRARY*/ -/* - * Returns 1 iff file is a tty - */ -#include <sys/termio.h> - -extern int ioctl(); -extern int errno; - -int -isatty(f) -int f; -{ - struct termio tty; - int err ; - - err = errno; - if(ioctl(f, TCGETA, &tty) < 0) - { - errno = err; - return(0); - } - return(1); -} diff --git a/usr/src/lib/libbc/libc/gen/common/iso.multibyte.c b/usr/src/lib/libbc/libc/gen/common/iso.multibyte.c deleted file mode 100644 index fb1f1c607f..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/iso.multibyte.c +++ /dev/null @@ -1,923 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include "codeset.h" -#include "mbextern.h" -#include "iso2022.h" - -#define TO_MULTI 2 -#define TO_SINGLE 1 - -#define BIT7ENV 7 /* 7bit enviornment */ -#define BIT8ENV 8 /* 8bit environment */ -#define NUM_OF_STATES 4 /* G0, G1, G2, G3 */ -#define BIT8(_ch) (_ch & 0x80) -#define MAXSIZE 100 /* ESC LOCK upper lower */ - -#define USE_STATE 0 /* use the actual _state info */ -#define USE_CONTROL 1 /* use C0 or C1 */ -#define USE_SS2 2 /* use Single shift 2 */ -#define USE_SS3 3 /* use Single shift 3 */ - -#define G0MASK 0x0000 -#define G1MASK 0x0080 -#define G2MASK 0x8000 -#define G3MASK 0x8080 -#define FINAL 0x33 /* Temporary final character */ - -#define MMB_CUR_MAX 128 - -/* - * Keep state informations - */ -struct state { - char width; /* 1 or 2 */ - char final; /* final character */ -}; - -static char _my_env = BIT7ENV; /* default 7bits environment */ -static struct state Invoked_G0, Invoked_G1; -static char _currentG0 = G0; -static char _currentG1 = G1; -static struct state _des_states[NUM_OF_STATES] = { - {-1, 0}, {-1, 0}, {-1, 0}, {01, 0} -}; - -void _savestates(void); /* save states */ -void _restorestates(void); /* restore states */ -void _initializestates(void);/* Initialize states */ - - -/* - * Variables for wc*tomb*() - */ -static char _currentOUT = G0; /* G0, G1, G2 or G3 */ -static int prevcsize = 1; - -/* - * mbtowc - subroutine for most iso codeset sequences - */ -int -_mbtowc_iso(wchar_t *pwc, char *s, size_t n) -{ - unsigned char ch; - unsigned char tch; /* temporary use */ - unsigned char *us = (unsigned char *)s; - int gen_wide_state = USE_STATE; /* used in gen_wide: */ - int length = 0; - int len = 0; - wchar_t wide; - int mask; - int i; - - isowidth_t * isoinfo = (isowidth_t *) _code_set_info.code_info; - - /* - * initialize _g0_stuff - */ - if (_des_states[G0].width == -1) { - _des_states[G0].width = isoinfo->g0_len; - _des_states[G1].width = isoinfo->g1_len; - _des_states[G2].width = isoinfo->g2_len; - _des_states[G3].width = isoinfo->g3_len; - _my_env = isoinfo->bit_env; - - Invoked_G0 = _des_states[G0]; - Invoked_G1 = _des_states[G1]; - } - - /* - * get character and proceed - */ -loop: - ch = *us++; - if (++length > n) return (-1); /* too long */ - switch (ch) { /* get a character */ - /* escape sequence or locking shifts */ - case ESC: /* escape sequence */ - gen_wide_state = USE_STATE; /* used in gen_wide: */ - ch = *us++; - if (++length > n) return (-1); /* too long */ - switch (ch) { - /* DESIGNATE */ - case 0x24: /* designate */ - ch = *us++; - if (++length > n) return (-1); /* too long */ - switch (ch) { - case 0x28: case 0x29: - case 0x2A: case 0x2B: - case 0x2D: case 0x2E: - case 0x2F: - tch = ch; /* save this to decide _des_state */ - /* Skip intermidiates */ - do { - ch = *us++; - if (++length > n) return (-1); /* too long */ - } while (ch >= 0x20 && ch <= 0x2F); - if (ch < 0x30) /* ch should be a final character */ - return (-1); /* error */ - if (tch == 0x28) - i = G0; - else if (tch == 0x29 || tch == 0x2D) - i = G1; - else if (tch == 0x2A || tch == 0x2E) - i = G2; - else /* (tch == 0x2B || tch == 0x2F) */ - i = G3; - /* updates state info */ - _des_states[i].width = TO_MULTI; - _des_states[i].final = ch; - - goto loop; - break; - default: - /* This is an illegal sequence */ - return (-1); - break; - } - break; - case 0x28: /* designate */ - case 0x29: case 0x2A: case 0x2B: - case 0x2D: case 0x2E: case 0x2F: - tch = ch; /* save this to decide _des_state */ - /* Skip intermidiates */ - do { - ch = *us++; - if (++length > n) return (-1); /* too long */ - } while (ch >= 0x20 && ch <= 0x2F); - if (ch < 0x30) /* ch should be a final character */ - return (-1); /* error */ - if (tch == 0x28) - i = G0; - else if (tch == 0x29 || tch == 0x2D) - i = G1; - else if (tch == 0x2A || tch == 0x2E) - i = G2; - else /* (tch == 0x2B || tch == 0x2F) */ - i = G3; - /* updates state info */ - _des_states[i].width = TO_SINGLE; - _des_states[i].final = ch; - - goto loop; - break; - - /* LOCKING SHIFTS */ - case LS1R: /* locking shift LS1R */; - Invoked_G1 = _des_states[G1]; - _currentG1 = G1; - goto loop; - break; - case LS2: /* locking shift LS2 */ - Invoked_G0 = _des_states[G2]; - _currentG0 = G2; - goto loop; - break; - case LS2R: /* locking shift LS2R */ - Invoked_G1 = _des_states[G2]; - _currentG1 = G2; - goto loop; - break; - case LS3: /* locking shift LS3 */ - Invoked_G0 = _des_states[G3]; - _currentG0 = G3; - goto loop; - break; - case LS3R: /* locking shift LS3R */ - Invoked_G1 = _des_states[G3]; - _currentG1 = G3; - goto loop; - break; - - /* CONTROL FUNCTIONS */ - case 0x21: /* C0 sets */ - case 0x22: /* C1 sets */ - do { - ch = *us++; - if (++length > n) return (-1); /* too long */ - } while (ch >= 0x20 && ch <= 0x2F); - if (ch < 0x30) /* ch should be a final character */ - return (-1); /* error */ - goto loop; - break; - - /* SINGLE SHIFT for 7bit environment */ - case SS2_7B: /* Single shift SS2 for 7bits */ - case SS3_7B: /* Single shoft SS3 for 7bits */ - if (ch == SS2_7B) - gen_wide_state = USE_SS2; - else - gen_wide_state = USE_SS3; - goto loop; - break; - - default: /* should be an error */ - return (-1); - break; - } - /* locking shifts */ - case LS0: - gen_wide_state = USE_STATE; /* used in gen_wide: */ - Invoked_G0 = _des_states[G0]; - _currentG0 = G0; - goto loop; - break; - - case LS1: - gen_wide_state = USE_STATE; /* used in gen_wide: */ - Invoked_G0 = _des_states[G1]; - _currentG0 = G1; - goto loop; - break; - - /* Single shift SS3 and SS2 for 8bits */ - case SS2_8B: - case SS3_8B: - if (ch == SS2_8B) - gen_wide_state = USE_SS2; - else - gen_wide_state = USE_SS3; - goto loop; - break; - - /* This character is not any special character/ - * It does not change any state. - * Goto where it generates wide character. - */ - default: - /* - * Use this ch to generate pwc. - */ - if (ch == 0) { /* end of string or 0 */ - wide = 0; - mask = 0; - goto gen_wide; - } - break; - } - - - /* - * Generate pwc here. - * The information here is - * current state and length. If the length is two, you need to - * read one more character. - */ - switch (gen_wide_state) { - case USE_STATE: - if (BIT8(ch)) { /* 8bit environment ? */ - /* current mode is G1 mode */ - if (Invoked_G1.width == 2) { - tch = *us++; - if (++length > n) return (-1); - wide = ch; - wide = (wide << 8 | tch); - } - else { - wide = ch; - } - if (_currentG1 == G0) mask = G0MASK; - else if (_currentG1 == G1) mask = G1MASK; - else if (_currentG1 == G2) mask = G2MASK; - else mask = G3MASK; - } - else { - /* current mode is G0 mode */ - if (Invoked_G0.width == 2) { - tch = *us++; - if (++length > n) return (-1); - wide = ch; - wide = (wide << 8 | tch); - } - else { - wide = ch; - } - if (_currentG0 == G0) mask = G0MASK; - else if (_currentG0 == G1) mask = G1MASK; - else if (_currentG0 == G2) mask = G2MASK; - else mask = G3MASK; - } - break; - case USE_SS2: - if (_des_states[G2].width == 2) { - tch = *us++; - if (++length > n) return (-1); - wide = ch; - wide = (wide << 8 | tch); - } - else { - wide = ch; - } - mask = G2MASK; - break; - case USE_SS3: - if (_des_states[G3].width == 2) { - tch = *us++; - if (++length > n) return (-1); - wide = ch; - wide = (wide << 8 | tch); - } - else { - wide = ch; - } - mask = G3MASK; - break; - default: - /* shoult be internal error */ - return (-1); - break; - } -gen_wide: - wide &= 0x7F7F; /* strip off the top bit */ - wide = wide | mask; - if (pwc != NULL) - *pwc = wide; - return (length); -} - - -#define MAXMBSIZE 128 -/* - * mbstowcs() - */ -size_t -_mbstowcs_iso(wchar_t *pwcs, unsigned char *s, size_t n) -{ - int ret1; - int accsum = 0; - wchar_t pwc; - - /* - * If pwcs == 0, do nothing. - */ - if (pwcs == 0) - return (0); - /* - * States things - */ - _savestates(); _initializestates(); - while (accsum < n) { - ret1 = _mbtowc_iso (&pwc, (char *)s, MAXMBSIZE); - if (ret1 < 0) - return (-1); /* error */ - if (ret1 == 0 || pwc == 0) { - if (pwcs == 0) - *pwcs = 0; - /* - * Restore states - */ - _restorestates(); - return (accsum); - } - s = s + ret1; /* increment the pointer */ - *pwcs++ = pwc; - ++accsum; - } - /* - * Restore states - */ - _restorestates(); - return (accsum); -} - -/* - * wctomb - - */ -int -_wctomb_iso(unsigned char *s, wchar_t pwc) -{ - unsigned char ch; - unsigned char tch; /* temporary use */ - unsigned char *us = (unsigned char *)s; - int gen_wide_state = USE_STATE; /* used in gen_wide: */ - int length = 0; - int len = 0; - wchar_t wide; - unsigned short mode; - unsigned char buf[MAXSIZE]; - unsigned char *bp; - int csize, i; - int n = MMB_CUR_MAX; - - isowidth_t * isoinfo = (isowidth_t *) _code_set_info.code_info; - - /* - * If pwc is 0, do this first. - */ - if (pwc == 0) { - if (s != 0) { - *s = 0; - return (1); - } - else { - return (0); - } - } - - mode = pwc & G3MASK; /* The mode of this character */ - if (((pwc >> 8) & 0x007f) == 0) - csize = 1; - else - csize = 2; - bp = buf; - length = 0; -#ifdef DDDebug - if (_my_env == BIT7ENV) - printf ("7b "); - else - printf ("8b "); - printf ("csize = %d, prevcsize = %d, (%x,%x) ",csize, prevcsize, (pwc>>8)&0x00ff, pwc&0x00ff); - switch (mode) { - case G0MASK: - printf ("G0"); break; - case G1MASK: - printf ("G1"); break; - case G2MASK: - printf ("G2"); break; - case G3MASK: - printf ("G3"); break; - default: - printf ("XXXX"); break; - } -#endif - - switch (_my_env) { - case BIT7ENV: /* 7 bit environment */ - switch (mode) { - case G0MASK: - if (_currentOUT != G0 || prevcsize != csize) { - _currentOUT = G0; - if (csize == 2) { - /* - * Emit escape sequences - */ - *bp++ = ESC; - *bp++ = 0x24; - *bp++ = 0x28; - *bp++ = FINAL; - length += 4; - } - else { - /* - * Emit escape sequences - */ - *bp++ = ESC; - *bp++ = 0x28; - *bp++ = FINAL; - length += 3; - } - *bp++ = SI; - ++length; - } - if (csize == 1) { - *bp++ = pwc & 0x007f; - ++length; - } - else { - *bp++ = (pwc & 0x7f00) >> 8; - ++length; - *bp++ = pwc & 0x007f; - ++length; - } - break; - case G1MASK: - if (_currentOUT != G1 || prevcsize != csize) { - _currentOUT = G1; - if (csize == 2) { - /* - * Emit escape sequences - */ - *bp++ = ESC; - *bp++ = 0x24; - *bp++ = 0x29; - *bp++ = FINAL; - length += 4; - } - else { - /* - * Emit escape sequences - */ - *bp++ = ESC; - *bp++ = 0x29; - *bp++ = FINAL; - length += 3; - } - *bp++ = SO; - ++length; - } - if (csize == 1) { - *bp++ = pwc & 0x007f; - ++length; - } - else { - *bp++ = (pwc & 0x7f00) >> 8; - ++length; - *bp++ = pwc & 0x007f; - ++length; - } - break; - case G2MASK: - if (_currentOUT != G2 || prevcsize != csize) { - _currentOUT = G2; - if (csize == 2) { - /* - * Emit escape sequences - */ - *bp++ = ESC; - *bp++ = 0x24; - *bp++ = 0x2A; - *bp++ = FINAL; - length += 4; - } - else { - /* - * Emit escape sequences - */ - *bp++ = ESC; - *bp++ = 0x2A; - *bp++ = FINAL; - length += 3; - } - *bp++ = ESC; *bp++ = LS2; - length += 2; - } - if (csize == 1) { - *bp++ = pwc & 0x007f; - ++length; - } - else { - *bp++ = (pwc & 0x7f00) >> 8; - ++length; - *bp++ = pwc & 0x007f; - ++length; - } - break; - case G3MASK: - if (_currentOUT != G3 || prevcsize != csize) { - _currentOUT = G3; - if (csize == 2) { - /* - * Emit escape sequences - */ - *bp++ = ESC; - *bp++ = 0x24; - *bp++ = 0x2B; - *bp++ = FINAL; - length += 4; - } - else { - /* - * Emit escape sequences - */ - *bp++ = ESC; - *bp++ = 0x2B; - *bp++ = FINAL; - length += 3; - } - *bp++ = ESC; *bp++ = LS3; - length += 2; - } - if (csize == 1) { - *bp++ = pwc & 0x007f; - ++length; - } - else { - *bp++ = (pwc & 0x7f00) >> 8; - ++length; - *bp++ = pwc & 0x007f; - ++length; - } - break; - } - break; - case BIT8ENV: /* 8 bit environment */ - switch (mode) { - case G0MASK: - if (_currentOUT != G0 || prevcsize != csize) { - _currentOUT = G0; - if (csize == 2) { - /* - * Emit escape sequences - */ - *bp++ = ESC; - *bp++ = 0x24; - *bp++ = 0x28; - *bp++ = FINAL; - length += 4; - } - else { - /* - * Emit escape sequences - */ - *bp++ = ESC; - *bp++ = 0x28; - *bp++ = FINAL; - length += 3; - } - *bp++ = LS0; - ++length; - } - if (csize == 1) { - *bp++ = pwc & 0x007f; - ++length; - } - else { - *bp++ = (pwc & 0x7f00) >> 8; - ++length; - *bp++ = pwc & 0x007f; - ++length; - } - break; - case G1MASK: - if (_currentOUT != G1 || prevcsize != csize) { - _currentOUT = G1; - if (csize == 2) { - /* - * Emit escape sequences - */ - *bp++ = ESC; - *bp++ = 0x24; - *bp++ = 0x29; - *bp++ = FINAL; - length += 4; - } - else { - /* - * Emit escape sequences - */ - *bp++ = ESC; - *bp++ = 0x29; - *bp++ = FINAL; - length += 3; - } - *bp++ = ESC; *bp++ = LS1R; - length += 2; - } - - /* - * If state is G1 or G2, or G3, assume that - * this is 8bit characters. To do this more - * accurately, wide character needs to be - * larger than 16 bits to keep more information. - */ - pwc |= 0x8080; - if (csize == 1) { - *bp++ = pwc & 0x00ff; - ++length; - } - else { - *bp++ = (pwc & 0xff00) >> 8; - ++length; - *bp++ = pwc & 0x00ff; - ++length; - } - break; - case G2MASK: - if (_currentOUT != G2 || prevcsize != csize) { - _currentOUT = G2; - if (csize == 2) { - /* - * Emit escape sequences - */ - *bp++ = ESC; - *bp++ = 0x24; - *bp++ = 0x2A; - *bp++ = FINAL; - length += 4; - } - else { - /* - * Emit escape sequences - */ - *bp++ = ESC; - *bp++ = 0x2A; - *bp++ = FINAL; - length += 3; - } - *bp++ = ESC; *bp++ = LS2R; - length += 2; - } - /* - * If state is G1 or G2, or G3, assume that - * this is 8bit characters. To do this more - * accurately, wide character needs to be - * larger than 16 bits to keep more information. - */ - pwc |= 0x8080; - if (csize == 1) { - *bp++ = pwc & 0x00ff; - ++length; - } - else { - *bp++ = (pwc & 0xff00) >> 8; - ++length; - *bp++ = pwc & 0x00ff; - ++length; - } - break; - case G3MASK: - if (_currentOUT != G3 || prevcsize != csize) { - _currentOUT = G3; - if (csize == 2) { - /* - * Emit escape sequences - */ - *bp++ = ESC; - *bp++ = 0x24; - *bp++ = 0x2B; - *bp++ = FINAL; - length += 4; - } - else { - /* - * Emit escape sequences - */ - *bp++ = ESC; - *bp++ = 0x2B; - *bp++ = FINAL; - length += 3; - } - *bp++ = ESC; *bp++ = LS3R; - length += 2; - } - /* - * If state is G1 or G2, or G3, assume that - * this is 8bit characters. To do this more - * accurately, wide character needs to be - * larger than 16 bits to keep more information. - */ - pwc |= 0x8080; - if (csize == 1) { - *bp++ = pwc & 0x00ff; - ++length; - } - else { - *bp++ = (pwc & 0xff00) >> 8; - ++length; - *bp++ = pwc & 0x00ff; - ++length; - } - break; - } - break; - default: /* Should never happens */ - return (-1); - break; - } - - prevcsize = csize; - - if (length > n) { - return (-1); /* buffer too small */ - } - for (i = 0; i < length; i++) { - *s++ = buf[i]; - } -#ifdef DDDebug - printf ("\t("); - for (i = 0; i < length; i++) { - printf ("%x,", buf[i]); - } - printf (")\n"); -#endif - return (length); -} - -/* - * wcstombs - */ -size_t -_wcstombs_iso(char *s, wchar_t *pwcs, int n) -{ - int acclen = 0; - char buf[MMB_CUR_MAX]; - int ret1; - int i; - - if (n < 0) - return (-1); - /* - * Initialize State - */ - _savestates(); _initializestates(); - while (acclen < n) { - ret1 = _wctomb_iso ((unsigned char *)buf, *pwcs); - /* - * end of string ? - */ - if (ret1 == 1 && buf[0] == 0) { - *s = 0; - /* - * restore states - */ - _restorestates(); - return (acclen); - } - /* - * Error ? - */ - if (ret1 < 0) - return (-1); - acclen += ret1; - for (i = 0; i < ret1; i++) - *s++ = buf[i]; - ++pwcs; - } - - /* - * restore states - */ - _restorestates(); - - /* - * return the length - */ - return (acclen); -} - - -/* - * Supplementary routines - */ - -void -_initializestates(void) -{ - _currentG0 = G0; - _currentG1 = G1; - - _des_states[G0].width = -1; /* This makes it Initialize */ - - _currentOUT = G0; - prevcsize = 1; -} - -static char SAVED_currentG0; -static char SAVED_currentG1; -static struct state SAVED_des_states[NUM_OF_STATES]; -static struct state SAVED_Invoked_G0, SAVED_Invoked_G1; -static char SAVED_currentOUT = G0; /* G0, G1, G2 or G3 */ -static int SAVED_prevcsize = 1; - -void -_savestates(void) -{ - - SAVED_currentG0 = _currentG0; - SAVED_currentG1 = _currentG1; - - SAVED_des_states[G0] = _des_states[G0]; - SAVED_des_states[G1] = _des_states[G1]; - SAVED_des_states[G2] = _des_states[G2]; - SAVED_des_states[G3] = _des_states[G3]; - - SAVED_Invoked_G0 = Invoked_G0; - SAVED_Invoked_G1 = Invoked_G1; - - SAVED_currentOUT = _currentOUT; - SAVED_prevcsize = prevcsize; -} - -void -_restorestates(void) -{ - _currentG0 = SAVED_currentG0; - _currentG1 = SAVED_currentG1; - - _des_states[G0] = SAVED_des_states[G0]; - _des_states[G1] = SAVED_des_states[G1]; - _des_states[G2] = SAVED_des_states[G2]; - _des_states[G3] = SAVED_des_states[G3]; - - Invoked_G0 = SAVED_Invoked_G0; - Invoked_G1 = SAVED_Invoked_G1; - - _currentOUT = SAVED_currentOUT; - prevcsize = SAVED_prevcsize; -} diff --git a/usr/src/lib/libbc/libc/gen/common/iso2022.h b/usr/src/lib/libbc/libc/gen/common/iso2022.h deleted file mode 100644 index 5e7e63abe7..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/iso2022.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * ISO2022 generic escape sequence handler for graphical characters - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* static char *sccsid = "%Z%%M% %I% %E% SMI"; */ - -/* - * single control characters - */ -#define SI 0x0F -#define SO 0x0E - -#define ESC 0x1B - -#define LS0 0x0F -#define LS1 0x0E -#define LS1R 0x7E /* need ESC */ -#define LS2 0x6E /* need ESC */ -#define LS2R 0x7D /* need ESC */ -#define LS3 0x6F /* need ESC */ -#define LS3R 0x7C /* need ESC */ -#define SS2_7B 0x4E /* need ESC */ -#define SS2_8B 0x8E -#define SS3_7B 0x4F /* need ESC */ -#define SS3_8B 0x8F - -#define C_C0 0 -#define C_C1 1 - -#define G0 0 -#define G1 1 -#define G2 2 -#define G3 3 - -#define CONT 0 -#define SING 1 -#define MULT 2 -/* - * code info - */ -typedef struct { - char g0_len; /* 1 or 2 */ - char g1_len; /* 1 or 2 */ - char g2_len; /* 1 or 2 */ - char g3_len; /* 1 or 2 */ - char bit_env;/* 7 or 8 */ - -} isowidth_t; diff --git a/usr/src/lib/libbc/libc/gen/common/issecure.c b/usr/src/lib/libbc/libc/gen/common/issecure.c deleted file mode 100644 index 9e27fb2dc5..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/issecure.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/file.h> - -#define PWDADJ "/etc/security/passwd.adjunct" - -/* - * Is this a secure system ? - */ -int -issecure(void) -{ - static int securestate = -1; - - if (securestate == -1) - securestate = (access(PWDADJ, F_OK) == 0); - return (securestate); -} diff --git a/usr/src/lib/libbc/libc/gen/common/jcsetpgrp.c b/usr/src/lib/libbc/libc/gen/common/jcsetpgrp.c deleted file mode 100644 index 50c6eb8175..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/jcsetpgrp.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/syscall.h> - -/* - * POSIX call to set job control process group of current process. - * Use 4BSD "setpgrp" call, but don't call "setpgrp" since that may refer - * to SVID "setpgrp" call in System V environment. - */ -int -jcsetpgrp(pgrp) - int pgrp; -{ - return (setpgid(0,pgrp)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/l64a.c b/usr/src/lib/libbc/libc/gen/common/l64a.c deleted file mode 100644 index 5115b998ba..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/l64a.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.5 */ - -/*LINTLIBRARY*/ -/* - * convert long int to base 64 ascii - * char set is [./0-9A-Za-z] - * two's complement negatives are assumed, - * but no assumptions are made about sign propagation on right shift - * - */ - -#include <values.h> -#define BITSPERCHAR 6 /* to hold entire character set */ -#define BITSPERLONG (BITSPERBYTE * sizeof(long)) -#define NMAX ((BITSPERLONG + BITSPERCHAR - 1)/BITSPERCHAR) -#define SIGN (-(1L << (BITSPERLONG - BITSPERCHAR - 1))) -#define CHARMASK ((1 << BITSPERCHAR) - 1) -#define WORDMASK ((1L << ((NMAX - 1) * BITSPERCHAR)) - 1) - -static char buf[NMAX + 1]; - -char * -l64a(lg) -register long lg; -{ - register char *s = buf; - - while (lg != 0) { - - register int c = ((int)lg & CHARMASK) + ('0' - 2); - - if (c > '9') - c += 'A' - '9' - 1; - if (c > 'Z') - c += 'a' - 'Z' - 1; - *s++ = c; - /* fill high-order CHAR if negative */ - /* but suppress sign propagation */ - lg = ((lg < 0) ? (lg >> BITSPERCHAR) | SIGN : - lg >> BITSPERCHAR) & WORDMASK; - } - *s = '\0'; - return (buf); -} diff --git a/usr/src/lib/libbc/libc/gen/common/labeltostring.c b/usr/src/lib/libbc/libc/gen/common/labeltostring.c deleted file mode 100644 index 76e996abe0..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/labeltostring.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/label.h> - -char * -labeltostring(int part, blabel_t *value, int verbose) -{ - char *string; - - string = (char *)malloc(sizeof(char)); - strcpy(string, ""); - return (string); -} - -void -labelfromstring(int part, char *label_string, blabel_t *value) -{ - bzero(value, sizeof(value)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/ldexp.c b/usr/src/lib/libbc/libc/gen/common/ldexp.c deleted file mode 100644 index d7d83183b1..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/ldexp.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 2.7 */ - -/*LINTLIBRARY*/ -/* - * double ldexp (value, exp) - * double value; - * int exp; - * - * Ldexp returns value * 2**exp, if that result is in range. - * If underflow occurs, it returns zero. If overflow occurs, - * it returns a value of appropriate sign and largest single- - * precision magnitude. In case of underflow or overflow, - * the external int "errno" is set to ERANGE. Note that errno is - * not modified if no error occurs, so if you intend to test it - * after you use ldexp, you had better set it to something - * other than ERANGE first (zero is a reasonable value to use). - */ - -#include <values.h> -#include <errno.h> -/* Largest signed long int power of 2 */ -#define MAXSHIFT (BITSPERBYTE * sizeof(long) - 2) - -extern double frexp(); - -double -ldexp(value, exp) -register double value; -register int exp; -{ - int old_exp; - - if (exp == 0 || value == 0.0) /* nothing to do for zero */ - return (value); -#if !(pdp11 || u3b5) /* pdp11 "cc" can't handle cast of - double to void on pdp11 or 3b5 */ - (void) -#endif - frexp(value, &old_exp); - if (exp > 0) { - if (exp + old_exp > MAXBEXP) { /* overflow */ - errno = ERANGE; - return ((double)(value < 0 ? MINDOUBLE : MAXDOUBLE)); -/* - return ((double)(value < 0 ? -1.0e999 : 1.0e999)); -*/ - } - for ( ; exp > MAXSHIFT; exp -= MAXSHIFT) - value *= (1L << MAXSHIFT); - return (value * (1L << exp)); - } - if (exp + old_exp < MINBEXP) { /* underflow */ - errno = ERANGE; - return (0.0); - } - for ( ; exp < -MAXSHIFT; exp += MAXSHIFT) - value *= 1.0/(1L << MAXSHIFT); /* mult faster than div */ - return (value / (1L << -exp)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/lfind.c b/usr/src/lib/libbc/libc/gen/common/lfind.c deleted file mode 100644 index 63aa525cf7..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/lfind.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.1 */ - -/*LINTLIBRARY*/ -/* - * Linear search algorithm, generalized from Knuth (6.1) Algorithm Q. - * - * This version no longer has anything to do with Knuth's Algorithm Q, - * which first copies the new element into the table, then looks for it. - * The assumption there was that the cost of checking for the end of the - * table before each comparison outweighed the cost of the comparison, which - * isn't true when an arbitrary comparison function must be called and when the - * copy itself takes a significant number of cycles. - * Actually, it has now reverted to Algorithm S, which is "simpler." - */ - -typedef char *POINTER; -extern POINTER memcpy(); - -POINTER -lfind(key, base, nelp, width, compar) -register POINTER key; /* Key to be located */ -register POINTER base; /* Beginning of table */ -unsigned *nelp; /* Pointer to current table size */ -register unsigned width; /* Width of an element (bytes) */ -int (*compar)(); /* Comparison function */ -{ - register POINTER next = base + *nelp * width; /* End of table */ - - for ( ; base < next; base += width) - if ((*compar)(key, base) == 0) - return (base); /* Key found */ - return (POINTER)0; -} diff --git a/usr/src/lib/libbc/libc/gen/common/localtime.c b/usr/src/lib/libbc/libc/gen/common/localtime.c deleted file mode 100644 index ba4278f37e..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/localtime.c +++ /dev/null @@ -1,1421 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1995-2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - /* from Arthur Olson's 6.1 */ - -/*LINTLIBRARY*/ - -#include <tzfile.h> -#include <time.h> -#include <string.h> -#include <ctype.h> -#include <stdio.h> /* for NULL */ -#include <fcntl.h> - -#include <sys/param.h> /* for MAXPATHLEN */ - -#undef FILENAME_MAX -#define FILENAME_MAX MAXPATHLEN - -#ifdef __STDC__ - -#define P(s) s - -#else /* !defined __STDC__ */ - -/* -** Memory management functions -*/ - -extern char * calloc(); -extern char * malloc(); - -/* -** Communication with the environment -*/ - -extern char * getenv(); - -#define ASTERISK * -#define P(s) (/ASTERISK s ASTERISK/) - -#define const - -#endif /* !defined __STDC__ */ - -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 -#endif /* !defined TRUE */ - -#define ACCESS_MODE O_RDONLY - -#define OPEN_MODE O_RDONLY - -/* -** Someone might make incorrect use of a time zone abbreviation: -** 1. They might reference tzname[0] before calling tzset (explicitly -** or implicitly). -** 2. They might reference tzname[1] before calling tzset (explicitly -** or implicitly). -** 3. They might reference tzname[1] after setting to a time zone -** in which Daylight Saving Time is never observed. -** 4. They might reference tzname[0] after setting to a time zone -** in which Standard Time is never observed. -** 5. They might reference tm.TM_ZONE after calling offtime. -** What's best to do in the above cases is open to debate; -** for now, we just set things up so that in any of the five cases -** WILDABBR is used. Another possibility: initialize tzname[0] to the -** string "tzname[0] used before set", and similarly for the other cases. -** And another: initialize tzname[0] to "ERA", with an explanation in the -** manual page of what this "time zone abbreviation" means (doing this so -** that tzname[0] has the "normal" length of three characters). -*/ -static const char *WILDABBR = " "; - -static const char *GMT = "GMT"; - -struct ttinfo { /* time type information */ - long tt_gmtoff; /* GMT offset in seconds */ - int tt_isdst; /* used to set tm_isdst */ - int tt_abbrind; /* abbreviation list index */ - int tt_ttisstd; /* TRUE if transition is std time */ -}; - -struct state { - int timecnt; - int typecnt; - int charcnt; - time_t *ats; - unsigned char *types; - struct ttinfo *ttis; - char *chars; - char *last_tzload; /* name of file tzload() last opened */ -}; - -struct rule { - int r_type; /* type of rule--see below */ - int r_day; /* day number of rule */ - int r_week; /* week number of rule */ - int r_mon; /* month number of rule */ - long r_time; /* transition time of rule */ -}; - -#define JULIAN_DAY 0 /* Jn - Julian day */ -#define DAY_OF_YEAR 1 /* n - day of year */ -#define MONTH_NTH_DAY_OF_WEEK 2 /* Mm.n.d - month, week, day of week */ - -/* -** Prototypes for static functions. -*/ - -static int allocall P((register struct state * sp)); -static long detzcode P((const char * codep)); -static void freeall P((register struct state * sp)); -static const char * getzname P((const char * strp, const int i)); -static const char * getnum P((const char * strp, int * nump, int min, - int max)); -static const char * getsecs P((const char * strp, long * secsp)); -static const char * getoffset P((const char * strp, long * offsetp)); -static const char * getrule P((const char * strp, struct rule * rulep)); -static void gmtload P((struct state * sp)); -static void gmtsub P((const time_t * timep, long offset, - struct tm * tmp)); -static void localsub P((const time_t * timep, long offset, - struct tm * tmp)); -static void normalize P((int * tensptr, int * unitsptr, int base)); -static void settzname P((void)); -static time_t time1 P((struct tm * tmp, void (* funcp)(), - long offset)); -static time_t time2 P((struct tm *tmp, void (* funcp)(), - long offset, int * okayp)); -static void timesub P((const time_t * timep, long offset, - struct tm * tmp)); -static int tmcomp P((const struct tm * atmp, - const struct tm * btmp)); -static time_t transtime P((time_t janfirst, int year, - const struct rule * rulep, long offset)); -static int tzload P((const char * name, struct state * sp)); -static int tzparse P((const char * name, struct state * sp, - int lastditch)); - -static struct state * lclptr; -static struct state * gmtptr; - -static int lcl_is_set; -static int gmt_is_set; - -#ifdef S5EMUL -char * tzname[2] = { - "GMT", - " ", -}; - -time_t timezone = 0; -time_t altzone = 0; -int daylight = 0; -#endif /* defined S5EMUL */ - -static long -detzcode(codep) -const char * const codep; -{ - register long result; - register int i; - - result = 0; - for (i = 0; i < 4; ++i) - result = (result << 8) | (codep[i] & 0xff); - return result; -} - -/* -** Free up existing items pointed to by the specified "state" structure, -** and allocate new ones of sizes specified by that "state" structure. -** Return 0 on success; return -1 and free all previously-allocated items -** on failure. -*/ -static int -allocall(sp) -register struct state * const sp; -{ - freeall(sp); - - if (sp->timecnt != 0) { - sp->ats = (time_t *)calloc((unsigned)sp->timecnt, - (unsigned)sizeof (time_t)); - if (sp->ats == NULL) - return -1; - sp->types = - (unsigned char *)calloc((unsigned)sp->timecnt, - (unsigned)sizeof (unsigned char)); - if (sp->types == NULL) { - freeall(sp); - return -1; - } - } - sp->ttis = - (struct ttinfo *)calloc((unsigned)sp->typecnt, - (unsigned)sizeof (struct ttinfo)); - if (sp->ttis == NULL) { - freeall(sp); - return -1; - } - sp->chars = (char *)calloc((unsigned)sp->charcnt + 1, - (unsigned)sizeof (char)); - if (sp->chars == NULL) { - freeall(sp); - return -1; - } - return 0; -} - -/* -** Free all the items pointed to by the specified "state" structure (except for -** "chars", which might have other references to it), and zero out all the -** pointers to those items. -*/ -static void -freeall(sp) -register struct state * const sp; -{ - if (sp->ttis) { - free((char *)sp->ttis); - sp->ttis = 0; - } - if (sp->types) { - free((char *)sp->types); - sp->types = 0; - } - if (sp->ats) { - free((char *)sp->ats); - sp->ats = 0; - } -} - -#ifdef S5EMUL -static void -settzname() -{ - register const struct state * const sp = lclptr; - register int i; - - tzname[0] = (char *)GMT; - tzname[1] = (char *)WILDABBR; - daylight = 0; - timezone = 0; - altzone = 0; - if (sp == NULL) - return; - for (i = 0; i < sp->typecnt; ++i) { - register const struct ttinfo * const ttisp = &sp->ttis[i]; - - tzname[ttisp->tt_isdst] = - (char *) &sp->chars[ttisp->tt_abbrind]; - if (ttisp->tt_isdst) - daylight = 1; - if (i == 0 || !ttisp->tt_isdst) - timezone = -(ttisp->tt_gmtoff); - if (i == 0 || ttisp->tt_isdst) - altzone = -(ttisp->tt_gmtoff); - } - /* - ** And to get the latest zone names into tzname. . . - */ - for (i = 0; i < sp->timecnt; ++i) { - register const struct ttinfo * const ttisp = - &sp->ttis[sp->types[i]]; - - tzname[ttisp->tt_isdst] = - (char *) &sp->chars[ttisp->tt_abbrind]; - } -} -#endif - -/* -** Maximum size of a time zone file. -*/ -#define MAX_TZFILESZ (sizeof (struct tzhead) + \ - TZ_MAX_TIMES * (4 + sizeof (char)) + \ - TZ_MAX_TYPES * (4 + 2 * sizeof (char)) + \ - TZ_MAX_CHARS * sizeof (char) + \ - TZ_MAX_LEAPS * 2 * 4 + \ - TZ_MAX_TYPES * sizeof (char)) - -static int -tzload(name, sp) -register const char * name; -register struct state * const sp; -{ - register const char * p; - register int i; - register int fid; - - if (name == NULL && (name = (const char *)TZDEFAULT) == NULL) - return -1; - { - register int doaccess; - char fullname[FILENAME_MAX + 1]; - - if (name[0] == ':') - ++name; - doaccess = name[0] == '/'; - if (!doaccess) { - if ((p = TZDIR) == NULL) - return -1; - if ((strlen(p) + strlen(name) + 1) >= sizeof fullname) - return -1; - (void) strcpy(fullname, p); - (void) strcat(fullname, "/"); - (void) strcat(fullname, name); - /* - ** Set doaccess if '.' (as in "../") shows up in name. - */ - if (strchr(name, '.') != NULL) - doaccess = TRUE; - name = fullname; - } - if (sp->last_tzload && strcmp(sp->last_tzload, name) == 0) - return (0); - if (doaccess && access(name, ACCESS_MODE) != 0) - return -1; - if ((fid = open(name, OPEN_MODE)) == -1) - return -1; - } - { - register const struct tzhead * tzhp; - char buf[MAX_TZFILESZ]; - int leapcnt; - int ttisstdcnt; - - i = read(fid, buf, sizeof buf); - if (close(fid) != 0 || i < sizeof *tzhp) - return -1; - tzhp = (struct tzhead *) buf; - ttisstdcnt = (int) detzcode(tzhp->tzh_ttisstdcnt); - leapcnt = (int) detzcode(tzhp->tzh_leapcnt); - sp->timecnt = (int) detzcode(tzhp->tzh_timecnt); - sp->typecnt = (int) detzcode(tzhp->tzh_typecnt); - sp->charcnt = (int) detzcode(tzhp->tzh_charcnt); - if (leapcnt < 0 || leapcnt > TZ_MAX_LEAPS || - sp->typecnt <= 0 || sp->typecnt > TZ_MAX_TYPES || - sp->timecnt < 0 || sp->timecnt > TZ_MAX_TIMES || - sp->charcnt < 0 || sp->charcnt > TZ_MAX_CHARS || - (ttisstdcnt != sp->typecnt && ttisstdcnt != 0)) - return -1; - if (i < sizeof *tzhp + - sp->timecnt * (4 + sizeof (char)) + - sp->typecnt * (4 + 2 * sizeof (char)) + - sp->charcnt * sizeof (char) + - leapcnt * 2 * 4 + - ttisstdcnt * sizeof (char)) - return -1; - if (allocall(sp) < 0) - return -1; - p = buf + sizeof *tzhp; - for (i = 0; i < sp->timecnt; ++i) { - sp->ats[i] = detzcode(p); - p += 4; - } - for (i = 0; i < sp->timecnt; ++i) { - sp->types[i] = (unsigned char) *p++; - if (sp->types[i] >= sp->typecnt) - return -1; - } - for (i = 0; i < sp->typecnt; ++i) { - register struct ttinfo * ttisp; - - ttisp = &sp->ttis[i]; - ttisp->tt_gmtoff = detzcode(p); - p += 4; - ttisp->tt_isdst = (unsigned char) *p++; - if (ttisp->tt_isdst != 0 && ttisp->tt_isdst != 1) - return -1; - ttisp->tt_abbrind = (unsigned char) *p++; - if (ttisp->tt_abbrind < 0 || - ttisp->tt_abbrind > sp->charcnt) - return -1; - } - for (i = 0; i < sp->charcnt-1; ++i) - sp->chars[i] = *p++; - sp->chars[i] = '\0'; /* ensure '\0' at end */ - p += (4 + 4) * leapcnt; /* skip leap seconds list */ - for (i = 0; i < sp->typecnt; ++i) { - register struct ttinfo * ttisp; - - ttisp = &sp->ttis[i]; - if (ttisstdcnt == 0) - ttisp->tt_ttisstd = FALSE; - else { - ttisp->tt_ttisstd = *p++; - if (ttisp->tt_ttisstd != TRUE && - ttisp->tt_ttisstd != FALSE) - return -1; - } - } - } - if (sp->last_tzload) - free(sp->last_tzload); - sp->last_tzload = strdup(name); - return 0; -} - -static const int mon_lengths[2][MONSPERYEAR] = { - 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, - 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 -}; - -static const int year_lengths[2] = { - DAYSPERNYEAR, DAYSPERLYEAR -}; - -/* -** Given a pointer into a time zone string, scan until a character that is not -** a valid character in a zone name is found. Return a pointer to that -** character. -** Support both quoted and unquoted timezones. -*/ - -static const char * -getzname(strp, quoted) -const char * strp; -int quoted; -{ - unsigned char c; - - if (quoted) { - while ((c = (unsigned char)*strp) != '\0' && - (isalnum(c) || (c == '+') || (c == '-'))) - ++strp; - } else { - while ((c = (unsigned char)*strp) != '\0' && !isdigit(c) - && (c != ',') && (c != '-') && (c != '+')) - ++strp; - } - return strp; -} - -/* -** Given a pointer into a time zone string, extract a number from that string. -** Check that the number is within a specified range; if it is not, return -** NULL. -** Otherwise, return a pointer to the first character not part of the number. -*/ - -static const char * -getnum(strp, nump, min, max) -register const char * strp; -int * const nump; -const int min; -const int max; -{ - register char c; - register int num; - - if (strp == NULL || !isdigit(*strp)) - return NULL; - num = 0; - while ((c = *strp) != '\0' && isdigit(c)) { - num = num * 10 + (c - '0'); - if (num > max) - return NULL; /* illegal value */ - ++strp; - } - if (num < min) - return NULL; /* illegal value */ - *nump = num; - return strp; -} - -/* -** Given a pointer into a time zone string, extract a number of seconds, -** in hh[:mm[:ss]] form, from the string. -** If any error occurs, return NULL. -** Otherwise, return a pointer to the first character not part of the number -** of seconds. -*/ - -static const char * -getsecs(strp, secsp) -register const char * strp; -long * const secsp; -{ - int num; - - strp = getnum(strp, &num, 0, HOURSPERDAY); - if (strp == NULL) - return NULL; - *secsp = num * SECSPERHOUR; - if (*strp == ':') { - ++strp; - strp = getnum(strp, &num, 0, MINSPERHOUR - 1); - if (strp == NULL) - return NULL; - *secsp += num * SECSPERMIN; - if (*strp == ':') { - ++strp; - strp = getnum(strp, &num, 0, SECSPERMIN - 1); - if (strp == NULL) - return NULL; - *secsp += num; - } - } - return strp; -} - -/* -** Given a pointer into a time zone string, extract an offset, in -** [+-]hh[:mm[:ss]] form, from the string. -** If any error occurs, return NULL. -** Otherwise, return a pointer to the first character not part of the time. -*/ - -static const char * -getoffset(strp, offsetp) -register const char * strp; -long * const offsetp; -{ - register int neg; - - if (*strp == '-') { - neg = 1; - ++strp; - } else if (isdigit(*strp) || *strp++ == '+') - neg = 0; - else return NULL; /* illegal offset */ - strp = getsecs(strp, offsetp); - if (strp == NULL) - return NULL; /* illegal time */ - if (neg) - *offsetp = -*offsetp; - return strp; -} - -/* -** Given a pointer into a time zone string, extract a rule in the form -** date[/time]. See POSIX section 8 for the format of "date" and "time". -** If a valid rule is not found, return NULL. -** Otherwise, return a pointer to the first character not part of the rule. -*/ - -static const char * -getrule(strp, rulep) -const char * strp; -register struct rule * const rulep; -{ - if (*strp == 'J') { - /* - ** Julian day. - */ - rulep->r_type = JULIAN_DAY; - ++strp; - strp = getnum(strp, &rulep->r_day, 1, DAYSPERNYEAR); - } else if (*strp == 'M') { - /* - ** Month, week, day. - */ - rulep->r_type = MONTH_NTH_DAY_OF_WEEK; - ++strp; - strp = getnum(strp, &rulep->r_mon, 1, MONSPERYEAR); - if (strp == NULL) - return NULL; - if (*strp++ != '.') - return NULL; - strp = getnum(strp, &rulep->r_week, 1, 5); - if (strp == NULL) - return NULL; - if (*strp++ != '.') - return NULL; - strp = getnum(strp, &rulep->r_day, 0, DAYSPERWEEK - 1); - } else if (isdigit(*strp)) { - /* - ** Day of year. - */ - rulep->r_type = DAY_OF_YEAR; - strp = getnum(strp, &rulep->r_day, 0, DAYSPERLYEAR - 1); - } else return NULL; /* invalid format */ - if (strp == NULL) - return NULL; - if (*strp == '/') { - /* - ** Time specified. - */ - ++strp; - strp = getsecs(strp, &rulep->r_time); - } else rulep->r_time = 2 * SECSPERHOUR; /* default = 2:00:00 */ - return strp; -} - -/* -** Given the Epoch-relative time of January 1, 00:00:00 GMT, in a year, the -** year, a rule, and the offset from GMT at the time that rule takes effect, -** calculate the Epoch-relative time that rule takes effect. -*/ - -static time_t -transtime(janfirst, year, rulep, offset) -const time_t janfirst; -const int year; -register const struct rule * const rulep; -const long offset; -{ - register int leapyear; - register time_t value; - register int i; - int d, m1, yy0, yy1, yy2, dow; - - leapyear = isleap(year); - switch (rulep->r_type) { - - case JULIAN_DAY: - /* - ** Jn - Julian day, 1 == January 1, 60 == March 1 even in leap - ** years. - ** In non-leap years, or if the day number is 59 or less, just - ** add SECSPERDAY times the day number-1 to the time of - ** January 1, midnight, to get the day. - */ - value = janfirst + (rulep->r_day - 1) * SECSPERDAY; - if (leapyear && rulep->r_day >= 60) - value += SECSPERDAY; - break; - - case DAY_OF_YEAR: - /* - ** n - day of year. - ** Just add SECSPERDAY times the day number to the time of - ** January 1, midnight, to get the day. - */ - value = janfirst + rulep->r_day * SECSPERDAY; - break; - - case MONTH_NTH_DAY_OF_WEEK: - /* - ** Mm.n.d - nth "dth day" of month m. - */ - value = janfirst; - for (i = 0; i < rulep->r_mon - 1; ++i) - value += mon_lengths[leapyear][i] * SECSPERDAY; - - /* - ** Use Zeller's Congruence to get day-of-week of first day of - ** month. - */ - m1 = (rulep->r_mon + 9) % 12 + 1; - yy0 = (rulep->r_mon <= 2) ? (year - 1) : year; - yy1 = yy0 / 100; - yy2 = yy0 % 100; - dow = ((26 * m1 - 2) / 10 + - 1 + yy2 + yy2 / 4 + yy1 / 4 - 2 * yy1) % 7; - if (dow < 0) - dow += DAYSPERWEEK; - - /* - ** "dow" is the day-of-week of the first day of the month. Get - ** the day-of-month (zero-origin) of the first "dow" day of the - ** month. - */ - d = rulep->r_day - dow; - if (d < 0) - d += DAYSPERWEEK; - for (i = 1; i < rulep->r_week; ++i) { - if (d + DAYSPERWEEK >= - mon_lengths[leapyear][rulep->r_mon - 1]) - break; - d += DAYSPERWEEK; - } - - /* - ** "d" is the day-of-month (zero-origin) of the day we want. - */ - value += d * SECSPERDAY; - break; - } - - /* - ** "value" is the Epoch-relative time of 00:00:00 GMT on the day in - ** question. To get the Epoch-relative time of the specified local - ** time on that day, add the transition time and the current offset - ** from GMT. - */ - return value + rulep->r_time + offset; -} - -/* -** Given a POSIX section 8-style TZ string, fill in the rule tables as -** appropriate. -*/ - -static int -tzparse(name, sp, lastditch) -const char * name; -struct state * const sp; -const int lastditch; -{ - const char * stdname; - const char * dstname; - int stdlen; - int dstlen; - long stdoffset; - long dstoffset; - time_t * atp; - unsigned char * typep; - char * cp; - - freeall(sp); /* */ - stdname = name; - if (lastditch) { - stdlen = strlen(name); /* length of standard zone name */ - name += stdlen; - if (stdlen >= sizeof sp->chars) - stdlen = (sizeof sp->chars) - 1; - } else { - if (*name == '<') { - name++; - stdname++; - name = getzname(name, 1); - if (*name != '>') { - return (-1); - } - stdlen = name - stdname; - name++; - } else { - name = getzname(name, 0); - stdlen = name - stdname; - } - if (stdlen < 3) - return -1; - } - if (*name == '\0') - stdoffset = 0; - else { - name = getoffset(name, &stdoffset); - if (name == NULL) - return -1; - } - if (*name != '\0') { - dstname = name; - if (*name == '<') { - name++; - dstname++; - name = getzname(name, 1); - if (*name != '>') { - return (-1); - } - dstlen = name - dstname; - name++; - } else { - name = getzname(name, 0); - dstlen = name - dstname; - } - if (dstlen < 3) - return -1; - if (*name != '\0' && *name != ',' && *name != ';') { - name = getoffset(name, &dstoffset); - if (name == NULL) - return -1; - } else dstoffset = stdoffset - SECSPERHOUR; - if (*name == ',' || *name == ';') { - struct rule start; - struct rule end; - register int year; - register time_t janfirst; - time_t starttime; - time_t endtime; - - ++name; - if ((name = getrule(name, &start)) == NULL) - return -1; - if (*name++ != ',') - return -1; - if ((name = getrule(name, &end)) == NULL) - return -1; - if (*name != '\0') - return -1; - sp->typecnt = 2; /* standard time and DST */ - /* - ** Two transitions per year, from EPOCH_YEAR to 2037. - */ - sp->timecnt = 2 * (2037 - EPOCH_YEAR + 1); - if (sp->timecnt > TZ_MAX_TIMES) - return -1; - sp->charcnt = stdlen + 1 + dstlen + 1; - if (allocall(sp) < 0) - return -1; - sp->ttis[0].tt_gmtoff = -dstoffset; - sp->ttis[0].tt_isdst = 1; - sp->ttis[0].tt_abbrind = stdlen + 1; - sp->ttis[1].tt_gmtoff = -stdoffset; - sp->ttis[1].tt_isdst = 0; - sp->ttis[1].tt_abbrind = 0; - atp = sp->ats; - typep = sp->types; - janfirst = 0; - for (year = EPOCH_YEAR; year <= 2037; ++year) { - starttime = transtime(janfirst, year, &start, - stdoffset); - endtime = transtime(janfirst, year, &end, - dstoffset); - if (starttime > endtime) { - *atp++ = endtime; - *typep++ = 1; /* DST ends */ - *atp++ = starttime; - *typep++ = 0; /* DST begins */ - } else { - *atp++ = starttime; - *typep++ = 0; /* DST begins */ - *atp++ = endtime; - *typep++ = 1; /* DST ends */ - } - janfirst += - year_lengths[isleap(year)] * SECSPERDAY; - } - } else { - int sawstd; - int sawdst; - long stdfix; - long dstfix; - long oldfix; - int isdst; - register int i; - - if (*name != '\0') - return -1; - if (tzload(TZDEFRULES, sp) != 0) { - freeall(sp); - return -1; - } - /* - ** Discard zone abbreviations from file, and allocate - ** space for the ones from TZ. - */ - free(sp->chars); - sp->charcnt = stdlen + 1 + dstlen + 1; - sp->chars = (char *)calloc((unsigned)sp->charcnt, - (unsigned)sizeof (char)); - /* - ** Compute the difference between the real and - ** prototype standard and summer time offsets - ** from GMT, and put the real standard and summer - ** time offsets into the rules in place of the - ** prototype offsets. - */ - sawstd = FALSE; - sawdst = FALSE; - stdfix = 0; - dstfix = 0; - for (i = 0; i < sp->typecnt; ++i) { - if (sp->ttis[i].tt_isdst) { - oldfix = dstfix; - dstfix = - sp->ttis[i].tt_gmtoff + dstoffset; - if (sawdst && (oldfix != dstfix)) - return -1; - sp->ttis[i].tt_gmtoff = -dstoffset; - sp->ttis[i].tt_abbrind = stdlen + 1; - sawdst = TRUE; - } else { - oldfix = stdfix; - stdfix = - sp->ttis[i].tt_gmtoff + stdoffset; - if (sawstd && (oldfix != stdfix)) - return -1; - sp->ttis[i].tt_gmtoff = -stdoffset; - sp->ttis[i].tt_abbrind = 0; - sawstd = TRUE; - } - } - /* - ** Make sure we have both standard and summer time. - */ - if (!sawdst || !sawstd) - return -1; - /* - ** Now correct the transition times by shifting - ** them by the difference between the real and - ** prototype offsets. Note that this difference - ** can be different in standard and summer time; - ** the prototype probably has a 1-hour difference - ** between standard and summer time, but a different - ** difference can be specified in TZ. - */ - isdst = FALSE; /* we start in standard time */ - for (i = 0; i < sp->timecnt; ++i) { - register const struct ttinfo * ttisp; - - /* - ** If summer time is in effect, and the - ** transition time was not specified as - ** standard time, add the summer time - ** offset to the transition time; - ** otherwise, add the standard time offset - ** to the transition time. - */ - ttisp = &sp->ttis[sp->types[i]]; - sp->ats[i] += - (isdst && !ttisp->tt_ttisstd) ? - dstfix : stdfix; - isdst = ttisp->tt_isdst; - } - } - } else { - dstlen = 0; - sp->typecnt = 1; /* only standard time */ - sp->timecnt = 0; - sp->charcnt = stdlen + 1; - if (allocall(sp) < 0) - return -1; - sp->ttis[0].tt_gmtoff = -stdoffset; - sp->ttis[0].tt_isdst = 0; - sp->ttis[0].tt_abbrind = 0; - } - cp = sp->chars; - (void) strncpy(cp, stdname, stdlen); - cp += stdlen; - *cp++ = '\0'; - if (dstlen != 0) { - (void) strncpy(cp, dstname, dstlen); - *(cp + dstlen) = '\0'; - } - return 0; -} - -static void -gmtload(sp) -struct state * const sp; -{ - if (tzload(GMT, sp) != 0) - (void) tzparse(GMT, sp, TRUE); -} - -void -tzsetwall() -{ - lcl_is_set = TRUE; - if (lclptr == NULL) { - lclptr = (struct state *) calloc(1, (unsigned)sizeof *lclptr); - if (lclptr == NULL) { -#ifdef S5EMUL - settzname(); /* all we can do */ -#endif - return; - } - } - if (tzload((char *) NULL, lclptr) != 0) - gmtload(lclptr); -#ifdef S5EMUL - settzname(); -#endif -} - -void -tzset() -{ - register const char * name; - - name = (const char *)getenv("TZ"); - if (name == NULL) { - tzsetwall(); - return; - } - lcl_is_set = TRUE; - if (lclptr == NULL) { - lclptr = (struct state *) calloc(1, (unsigned)sizeof *lclptr); - if (lclptr == NULL) { -#ifdef S5EMUL - settzname(); /* all we can do */ -#endif - return; - } - } - if (*name == '\0') { - /* - ** User wants it fast rather than right. - */ - lclptr->timecnt = 0; - lclptr->typecnt = 1; - lclptr->charcnt = sizeof GMT; - if (allocall(lclptr) < 0) - return; - lclptr->ttis[0].tt_gmtoff = 0; - lclptr->ttis[0].tt_abbrind = 0; - (void) strcpy(lclptr->chars, GMT); - } else if (tzload(name, lclptr) != 0) - if (name[0] == ':' || tzparse(name, lclptr, FALSE) != 0) - (void) tzparse(name, lclptr, TRUE); -#ifdef S5EMUL - settzname(); -#endif -} - -/* -** The easy way to behave "as if no library function calls" localtime -** is to not call it--so we drop its guts into "localsub", which can be -** freely called. (And no, the PANS doesn't require the above behavior-- -** but it *is* desirable.) -** -** The unused offset argument is for the benefit of mktime variants. -*/ - -static struct tm tm; - -/*ARGSUSED*/ -static void -localsub(timep, offset, tmp) -const time_t * const timep; -const long offset; -struct tm * const tmp; -{ - register const struct state * sp; - register const struct ttinfo * ttisp; - register int i; - const time_t t = *timep; - - if (!lcl_is_set) - tzset(); - sp = lclptr; - if (sp == NULL) { - gmtsub(timep, offset, tmp); - return; - } - if (sp->timecnt == 0 || t < sp->ats[0]) { - i = 0; - while (sp->ttis[i].tt_isdst) - if (++i >= sp->typecnt) { - i = 0; - break; - } - } else { - for (i = 1; i < sp->timecnt; ++i) - if (t < sp->ats[i]) - break; - i = sp->types[i - 1]; - } - ttisp = &sp->ttis[i]; - timesub(&t, ttisp->tt_gmtoff, tmp); - tmp->tm_isdst = ttisp->tt_isdst; -#ifdef S5EMUL - tzname[tmp->tm_isdst] = (char *) &sp->chars[ttisp->tt_abbrind]; -#endif /* S5EMUL */ - tmp->tm_zone = &sp->chars[ttisp->tt_abbrind]; -} - -struct tm * -localtime(timep) -const time_t * const timep; -{ - time_t temp_time = *(const time_t*)timep; - - _ltzset(&temp_time); /* - * base localtime calls this to initialize - * some things, so we'll do it here, too. - */ - localsub(timep, 0L, &tm); - return &tm; -} - -/* -** gmtsub is to gmtime as localsub is to localtime. -*/ - -static void -gmtsub(timep, offset, tmp) -const time_t * const timep; -const long offset; -struct tm * const tmp; -{ - if (!gmt_is_set) { - gmt_is_set = TRUE; - gmtptr = (struct state *) calloc(1, (unsigned)sizeof *gmtptr); - if (gmtptr != NULL) - gmtload(gmtptr); - } - timesub(timep, offset, tmp); - /* - ** Could get fancy here and deliver something such as - ** "GMT+xxxx" or "GMT-xxxx" if offset is non-zero, - ** but this is no time for a treasure hunt. - */ - if (offset != 0) - tmp->tm_zone = (char *)WILDABBR; - else { - if (gmtptr == NULL) - tmp->tm_zone = (char *)GMT; - else tmp->tm_zone = gmtptr->chars; - } -} - -struct tm * -gmtime(timep) -const time_t * const timep; -{ - gmtsub(timep, 0L, &tm); - return &tm; -} - -struct tm * -offtime(timep, offset) -const time_t * const timep; -const long offset; -{ - gmtsub(timep, offset, &tm); - return &tm; -} - -static void -timesub(timep, offset, tmp) -const time_t * const timep; -const long offset; -register struct tm * const tmp; -{ - register long days; - register long rem; - register int y; - register int yleap; - register const int * ip; - - days = *timep / SECSPERDAY; - rem = *timep % SECSPERDAY; - rem += offset; - while (rem < 0) { - rem += SECSPERDAY; - --days; - } - while (rem >= SECSPERDAY) { - rem -= SECSPERDAY; - ++days; - } - tmp->tm_hour = (int) (rem / SECSPERHOUR); - rem = rem % SECSPERHOUR; - tmp->tm_min = (int) (rem / SECSPERMIN); - tmp->tm_sec = (int) (rem % SECSPERMIN); - tmp->tm_wday = (int) ((EPOCH_WDAY + days) % DAYSPERWEEK); - if (tmp->tm_wday < 0) - tmp->tm_wday += DAYSPERWEEK; - y = EPOCH_YEAR; - if (days >= 0) - for ( ; ; ) { - yleap = isleap(y); - if (days < (long) year_lengths[yleap]) - break; - ++y; - days = days - (long) year_lengths[yleap]; - } - else do { - --y; - yleap = isleap(y); - days = days + (long) year_lengths[yleap]; - } while (days < 0); - tmp->tm_year = y - TM_YEAR_BASE; - tmp->tm_yday = (int) days; - ip = mon_lengths[yleap]; - for (tmp->tm_mon = 0; days >= (long) ip[tmp->tm_mon]; ++(tmp->tm_mon)) - days = days - (long) ip[tmp->tm_mon]; - tmp->tm_mday = (int) (days + 1); - tmp->tm_isdst = 0; - tmp->tm_gmtoff = offset; -} - -/* -** Adapted from code provided by Robert Elz, who writes: -** The "best" way to do mktime I think is based on an idea of Bob -** Kridle's (so its said...) from a long time ago. (mtxinu!kridle now). -** It does a binary search of the time_t space. Since time_t's are -** just 32 bits, its a max of 32 iterations (even at 64 bits it -** would still be very reasonable). -*/ - -#ifndef WRONG -#define WRONG (-1) -#endif /* !defined WRONG */ - -static void -normalize(tensptr, unitsptr, base) -int * const tensptr; -int * const unitsptr; -const int base; -{ - int tmp; - - if (*unitsptr >= base) { - *tensptr += *unitsptr / base; - *unitsptr %= base; - } else if (*unitsptr < 0) { - /* tmp has the range 0 to abs(*unitptr) -1 */ - tmp = -1 - (*unitsptr); - *tensptr -= (tmp/base + 1); - *unitsptr = (base - 1) - (tmp % base); - } -} - -static int -tmcomp(atmp, btmp) -register const struct tm * const atmp; -register const struct tm * const btmp; -{ - register int result; - - if ((result = (atmp->tm_year - btmp->tm_year)) == 0 && - (result = (atmp->tm_mon - btmp->tm_mon)) == 0 && - (result = (atmp->tm_mday - btmp->tm_mday)) == 0 && - (result = (atmp->tm_hour - btmp->tm_hour)) == 0 && - (result = (atmp->tm_min - btmp->tm_min)) == 0) - result = atmp->tm_sec - btmp->tm_sec; - return result; -} - -static time_t -time2(tmp, funcp, offset, okayp) -struct tm * const tmp; -void (* const funcp)(); -const long offset; -int * const okayp; -{ - register const struct state * sp; - register int dir; - register int bits; - register int i, j ; - register int saved_seconds; - time_t newt; - time_t t; - struct tm yourtm, mytm; - - *okayp = FALSE; - yourtm = *tmp; - if (yourtm.tm_sec >= SECSPERMIN + 2 || yourtm.tm_sec < 0) - normalize(&yourtm.tm_min, &yourtm.tm_sec, SECSPERMIN); - normalize(&yourtm.tm_hour, &yourtm.tm_min, MINSPERHOUR); - normalize(&yourtm.tm_mday, &yourtm.tm_hour, HOURSPERDAY); - normalize(&yourtm.tm_year, &yourtm.tm_mon, MONSPERYEAR); - while (yourtm.tm_mday <= 0) { - if (yourtm.tm_mon == 0) { - yourtm.tm_mon = 12; - --yourtm.tm_year; - } - yourtm.tm_mday += - mon_lengths[isleap(yourtm.tm_year + - TM_YEAR_BASE)][--yourtm.tm_mon]; - if (yourtm.tm_mon >= MONSPERYEAR) { - yourtm.tm_mon = 0; - --yourtm.tm_year; - } - } - for ( ; ; ) { - i = mon_lengths[isleap(yourtm.tm_year + - TM_YEAR_BASE)][yourtm.tm_mon]; - if (yourtm.tm_mday <= i) - break; - yourtm.tm_mday -= i; - if (++yourtm.tm_mon >= MONSPERYEAR) { - yourtm.tm_mon = 0; - ++yourtm.tm_year; - } - } - saved_seconds = yourtm.tm_sec; - yourtm.tm_sec = 0; - /* - ** Calculate the number of magnitude bits in a time_t - ** (this works regardless of whether time_t is - ** signed or unsigned, though lint complains if unsigned). - */ - for (bits = 0, t = 1; t > 0; ++bits, t <<= 1) - ; - /* - ** If time_t is signed, then 0 is the median value, - ** if time_t is unsigned, then 1 << bits is median. - */ - t = (t < 0) ? 0 : ((time_t) 1 << bits); - for ( ; ; ) { - (*funcp)(&t, offset, &mytm); - dir = tmcomp(&mytm, &yourtm); - if (dir != 0) { - if (bits-- < 0) - return WRONG; - if (bits < 0) - --t; - else if (dir > 0) - t -= (time_t) 1 << bits; - else t += (time_t) 1 << bits; - continue; - } - if (yourtm.tm_isdst < 0 || mytm.tm_isdst == yourtm.tm_isdst) - break; - /* - ** Right time, wrong type. - ** Hunt for right time, right type. - ** It's okay to guess wrong since the guess - ** gets checked. - */ - sp = (const struct state *) - ((funcp == localsub) ? lclptr : gmtptr); - if (sp == NULL) - return WRONG; - for (i = 0; i < sp->typecnt; ++i) { - if (sp->ttis[i].tt_isdst != yourtm.tm_isdst) - continue; - for (j = 0; j < sp->typecnt; ++j) { - if (sp->ttis[j].tt_isdst == yourtm.tm_isdst) - continue; - newt = t + sp->ttis[j].tt_gmtoff - - sp->ttis[i].tt_gmtoff; - (*funcp)(&newt, offset, &mytm); - if (tmcomp(&mytm, &yourtm) != 0) - continue; - if (mytm.tm_isdst != yourtm.tm_isdst) - continue; - /* - ** We have a match. - */ - t = newt; - goto label; - } - } - return WRONG; - } -label: - t += saved_seconds; - (*funcp)(&t, offset, tmp); - *okayp = TRUE; - return t; -} - -static time_t -time1(tmp, funcp, offset) -struct tm * const tmp; -void (* const funcp)(); -const long offset; -{ - register time_t t; - register const struct state * sp; - register int samei, otheri; - int okay; - - - if (tmp->tm_isdst > 1) - tmp->tm_isdst = 1; - t = time2(tmp, funcp, offset, &okay); - if (okay || tmp->tm_isdst < 0) - return t; - /* - ** We're supposed to assume that somebody took a time of one type - ** and did some math on it that yielded a "struct tm" that's bad. - ** We try to divine the type they started from and adjust to the - ** type they need. - */ - sp = (const struct state *) ((funcp == localsub) ? lclptr : gmtptr); - if (sp == NULL) - return WRONG; - for (samei = 0; samei < sp->typecnt; ++samei) { - if (sp->ttis[samei].tt_isdst != tmp->tm_isdst) - continue; - for (otheri = 0; otheri < sp->typecnt; ++otheri) { - if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst) - continue; - tmp->tm_sec += sp->ttis[otheri].tt_gmtoff - - sp->ttis[samei].tt_gmtoff; - tmp->tm_isdst = !tmp->tm_isdst; - t = time2(tmp, funcp, offset, &okay); - if (okay) - return t; - tmp->tm_sec -= sp->ttis[otheri].tt_gmtoff - - sp->ttis[samei].tt_gmtoff; - tmp->tm_isdst = !tmp->tm_isdst; - } - } - return WRONG; -} - -time_t -mktime(tmp) -struct tm * const tmp; -{ - return time1(tmp, localsub, 0L); -} - -time_t -timelocal(tmp) -struct tm * const tmp; -{ - tmp->tm_isdst = -1; - return mktime(tmp); -} - -time_t -timegm(tmp) -struct tm * const tmp; -{ - return time1(tmp, gmtsub, 0L); -} - -time_t -timeoff(tmp, offset) -struct tm * const tmp; -const long offset; -{ - - return time1(tmp, gmtsub, offset); -} diff --git a/usr/src/lib/libbc/libc/gen/common/lsearch.c b/usr/src/lib/libbc/libc/gen/common/lsearch.c deleted file mode 100644 index adcb72b0d7..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/lsearch.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.8 */ - -/*LINTLIBRARY*/ -/* - * Linear search algorithm, generalized from Knuth (6.1) Algorithm Q. - * - * This version no longer has anything to do with Knuth's Algorithm Q, - * which first copies the new element into the table, then looks for it. - * The assumption there was that the cost of checking for the end of the - * table before each comparison outweighed the cost of the comparison, which - * isn't true when an arbitrary comparison function must be called and when the - * copy itself takes a significant number of cycles. - * Actually, it has now reverted to Algorithm S, which is "simpler." - */ - -typedef char *POINTER; -extern POINTER memcpy(); - -POINTER -lsearch(key, base, nelp, width, compar) -register POINTER key; /* Key to be located */ -register POINTER base; /* Beginning of table */ -unsigned *nelp; /* Pointer to current table size */ -register unsigned width; /* Width of an element (bytes) */ -int (*compar)(); /* Comparison function */ -{ - register POINTER next = base + *nelp * width; /* End of table */ - - for ( ; base < next; base += width) - if ((*compar)(key, base) == 0) - return (base); /* Key found */ - ++*nelp; /* Not found, add to table */ - return (memcpy(base, key, (int)width)); /* base now == next */ -} diff --git a/usr/src/lib/libbc/libc/gen/common/madvise.c b/usr/src/lib/libbc/libc/gen/common/madvise.c deleted file mode 100644 index 7ecf45b868..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/madvise.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/mman.h> -#include <errno.h> - -/* - * Function to provide advise to vm system to optimize it's - * characteristics for a particular application - */ - -/*LINTLIBRARY*/ -int -madvise(caddr_t addr, u_int len, int advice) -{ - if (len == 0) { - errno = EINVAL; - return (-1); - } - return (mctl(addr, len, MC_ADVISE, advice)); -} - -/* - * This is only here so programs that use vadvise will not fail - * because it is not in the bcp libc. - */ -int -vadvise(int param) -{ - return (0); -} diff --git a/usr/src/lib/libbc/libc/gen/common/mallint.h b/usr/src/lib/libbc/libc/gen/common/mallint.h deleted file mode 100644 index d516393191..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/mallint.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1986 by Sun Microsystems, Inc. - */ - -/* - * file: mallint.h - * description: - * - * Definitions for malloc.c and friends (realloc.c, memalign.c) - * - * The node header structure. Header info never overlaps with user - * data space, in order to accommodate the following atrocity: - * free(p); - * realloc(p, newsize); - * ... which was historically used to obtain storage compaction as - * a side effect of the realloc() call, when the block referenced - * by p was coalesced with another free block by the call to free(). - * - * To reduce storage consumption, a header block is associated with - * free blocks only, not allocated blocks. - * When a free block is allocated, its header block is put on - * a free header block list. - * - * This creates a header space and a free block space. - * The left pointer of a header blocks is used to chain free header - * blocks together. New header blocks are allocated in chunks of - * NFREE_HDRS. - */ -#include <malloc.h> - -typedef enum {false,true} bool; -typedef struct freehdr *Freehdr; -typedef struct dblk *Dblk; -typedef unsigned int uint; - -/* - * Description of a header for a free block - * Only free blocks have such headers. - */ -struct freehdr { - Freehdr left; /* Left tree pointer */ - Freehdr right; /* Right tree pointer */ - Dblk block; /* Ptr to the data block */ - uint size; -}; - -#define NIL ((Freehdr) 0) -#define NFREE_HDRS 512 /* Get this many headers at a time */ -#define SMALLEST_BLK sizeof(struct dblk) /* Size of smallest block */ -#define NULL 0 - -/* - * Description of a data block. - * A data block consists of a length word, possibly followed by - * a filler word for alignment, followed by the user's data. - * To back up from the user's data to the length word, use - * (address of data) - ALIGNSIZ; - */ - -#ifdef sparc -#define ALIGNSIZ sizeof(double) -struct dblk { - uint size; /* Size of the block */ - uint filler; /* filler, for double alignment */ - char data[ALIGNSIZ]; /* Addr returned to the caller */ -}; -#endif - -#ifdef mc68000 -#define ALIGNSIZ sizeof(uint) -struct dblk { - uint size; /* Size of the block */ - char data[ALIGNSIZ]; /* Addr returned to the caller */ -}; -#endif - - -/* - * weight(x) is the size of a block, in bytes; or 0 if and only if x - * is a null pointer. Note that malloc() and free() should be - * prepared to deal with things like zero-length blocks, which - * can be introduced by errant programs. - */ - -#define weight(x) ((x) == NIL? 0: (x->size)) -#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) -#define nextblk(p, size) ((Dblk) ((char *) (p) + (size))) -#define max(a, b) ((a) < (b)? (b): (a)) -#define min(a, b) ((a) < (b)? (a): (b)) -#define heapsize() (_ubound - _lbound) -#define misaligned(p) ((unsigned)(p)&3) - -extern Freehdr _root; -extern char *_lbound, *_ubound; -extern int malloc_debug(); - -extern struct mallinfo __mallinfo; diff --git a/usr/src/lib/libbc/libc/gen/common/malloc.c b/usr/src/lib/libbc/libc/gen/common/malloc.c deleted file mode 100644 index 2d5891dd18..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/malloc.c +++ /dev/null @@ -1,1444 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1986 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * file: malloc.c - * description: - * Yet another memory allocator, this one based on a method - * described in C.J. Stephenson, "Fast Fits" - * - * The basic data structure is a "Cartesian" binary tree, in which - * nodes are ordered by ascending addresses (thus minimizing free - * list insertion time) and block sizes decrease with depth in the - * tree (thus minimizing search time for a block of a given size). - * - * In other words: for any node s, let D(s) denote the set of - * descendents of s; for all x in D(left(s)) and all y in - * D(right(s)), we have: - * - * a. addr(x) < addr(s) < addr(y) - * b. len(x) <= len(s) >= len(y) - */ - -#include "mallint.h" -#include <errno.h> -#include <stdlib.h> -#include <stdarg.h> - -/* system interface */ - -extern char *sbrk(); -extern int getpagesize(); - -static int nbpg = 0; /* set by calling getpagesize() */ -static bool morecore(uint); /* get more memory into free space */ - -#ifdef S5EMUL -#define ptr_t void * /* ANSI C says these are voids */ -#define free_t void /* ANSI says void free(ptr_t ptr) */ -#define free_return(x) return -#else -#define ptr_t char * /* BSD still (4.3) wants char*'s */ -#define free_t int /* BSD says int free(ptr_t ptr) */ -#define free_return(x) return(x) -#endif - -/* SystemV-compatible information structure */ -#define INIT_MXFAST 0 -#define INIT_NLBLKS 100 -#define INIT_GRAIN ALIGNSIZ - -struct mallinfo __mallinfo = { - 0,0,0,0,0,0,0,0,0,0, /* basic info */ - INIT_MXFAST, INIT_NLBLKS, INIT_GRAIN, /* mallopt options */ - 0,0,0 -}; - -/* heap data structures */ - -Freehdr _root = NIL; /* root of free space list */ -char *_lbound = NULL; /* lower bound of heap */ -char *_ubound = NULL; /* upper bound of heap */ - -/* free header list management */ - -static Freehdr getfreehdr(void); -static void putfreehdr(Freehdr); -static Freehdr freehdrptr = NIL; /* ptr to block of available headers */ -static int nfreehdrs = 0; /* # of headers in current block */ -static Freehdr freehdrlist = NIL; /* List of available headers */ - -/* error checking */ -static void error(char *, ...); -/* sets errno; prints msg and aborts if DEBUG is on */ - -static int reclaim(Dblk, uint, int); - -#ifdef DEBUG /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */ - -int malloc_debug(int); -int malloc_verify(void); -static int debug_level = 1; - -/* - * A block with a negative size, a size that is not a multiple - * of ALIGNSIZ, a size greater than the current extent of the - * heap, or a size which extends beyond the end of the heap is - * considered bad. - */ - -#define badblksize(p,size)\ -( (size) < SMALLEST_BLK \ - || (size) & (ALIGNSIZ-1) \ - || (size) > heapsize() \ - || ((char*)(p))+(size) > _ubound ) - -#else /* !DEBUG ================================================= */ - -#define malloc_debug(level) 0 -#define malloc_verify() 1 -#define debug_level 0 -#define badblksize(p,size) 0 - -#endif /* !DEBUG <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< */ - - -/* - * insert (newblk, len) - * Inserts a new node in the free space tree, placing it - * in the correct position with respect to the existing nodes. - * - * algorithm: - * Starting from the root, a binary search is made for the new - * node. If this search were allowed to continue, it would - * eventually fail (since there cannot already be a node at the - * given address); but in fact it stops when it reaches a node in - * the tree which has a length less than that of the new node (or - * when it reaches a null tree pointer). - * - * The new node is then inserted at the root of the subtree for - * which the shorter node forms the old root (or in place of the - * null pointer). - * - * Arguments - * newblk: Ptr to the block to insert - * len: Length of new node - */ - -static void -insert(Dblk newblk, uint len) -{ - Freehdr *fpp; /* Address of ptr to subtree */ - Freehdr x; - Freehdr *left_hook; /* Temp for insertion */ - Freehdr *right_hook; /* Temp for insertion */ - Freehdr newhdr; - - /* - * check for bad block size. - */ - if ( badblksize(newblk,len) ) { - error("insert: bad block size (%d) at %#x\n", len, newblk); - return; - } - - /* - * Search for the first node which has a weight less - * than that of the new node; this will be the - * point at which we insert the new node. - */ - fpp = &_root; - x = *fpp; - while (weight(x) >= len) { - if (newblk < x->block) - fpp = &x->left; - else - fpp = &x->right; - x = *fpp; - } - - /* - * Perform root insertion. The variable x traces a path through - * the fpp, and with the help of left_hook and right_hook, - * rewrites all links that cross the territory occupied - * by newblk. - */ - - if ((newhdr = getfreehdr()) == NIL) { - /* Error message returned by getfreehdr() */ - return; - } - *fpp = newhdr; - - newhdr->left = NIL; - newhdr->right = NIL; - newhdr->block = newblk; - newhdr->size = len; - - /* - * set length word in the block for consistency with the header. - */ - - newblk->size = len; - - left_hook = &newhdr->left; - right_hook = &newhdr->right; - - while (x != NIL) { - /* - * Remark: - * The name 'left_hook' is somewhat confusing, since - * it is always set to the address of a .right link - * field. However, its value is always an address - * below (i.e., to the left of) newblk. Similarly - * for right_hook. The values of left_hook and - * right_hook converge toward the value of newblk, - * as in a classical binary search. - */ - if (x->block < newblk) { - /* - * rewrite link crossing from the left - */ - *left_hook = x; - left_hook = &x->right; - x = x->right; - } else { - /* - * rewrite link crossing from the right - */ - *right_hook = x; - right_hook = &x->left; - x = x->left; - } /*else*/ - } /*while*/ - - *left_hook = *right_hook = NIL; /* clear remaining hooks */ - -} /*insert*/ - -/* - * delete(p) - * deletes a node from a cartesian tree. p is the address of - * a pointer to the node which is to be deleted. - * - * algorithm: - * The left and right branches of the node to be deleted define two - * subtrees which are to be merged and attached in place of the - * deleted node. Each node on the inside edges of these two - * subtrees is examined and longer nodes are placed above the - * shorter ones. - * - * On entry: - * *p is assumed to be non-null. - */ -static void -delete(Freehdr *p) -{ - Freehdr x; - Freehdr left_branch; /* left subtree of deleted node */ - Freehdr right_branch; /* right subtree of deleted node */ - uint left_weight; - uint right_weight; - - x = *p; - left_branch = x->left; - left_weight = weight(left_branch); - right_branch = x->right; - right_weight = weight(right_branch); - - while (left_branch != right_branch) { - /* - * iterate until left branch and right branch are - * both NIL. - */ - if ( left_weight >= right_weight ) { - /* - * promote the left branch - */ - if (left_branch != NIL) { - if (left_weight == 0) { - /* zero-length block */ - error("blocksize=0 at %#x\n", - (int)left_branch->block->data); - break; - } - *p = left_branch; - p = &left_branch->right; - left_branch = *p; - left_weight = weight(left_branch); - } - } else { - /* - * promote the right branch - */ - if (right_branch != NIL) { - if (right_weight == 0) { - /* zero-length block */ - error("blocksize=0 at %#x\n", - (int)right_branch->block->data); - break; - } - *p = right_branch; - p = &right_branch->left; - right_branch = *p; - right_weight = weight(right_branch); - } - }/*else*/ - }/*while*/ - *p = NIL; - putfreehdr(x); -} /*delete*/ - - -/* - * demote(p) - * Demotes a node in a cartesian tree, if necessary, to establish - * the required vertical ordering. - * - * algorithm: - * The left and right subtrees of the node to be demoted are to - * be partially merged and attached in place of the demoted node. - * The nodes on the inside edges of these two subtrees are - * examined and the longer nodes are placed above the shorter - * ones, until a node is reached which has a length no greater - * than that of the node being demoted (or until a null pointer - * is reached). The node is then attached at this point, and - * the remaining subtrees (if any) become its descendants. - * - * on entry: - * a. All the nodes in the tree, including the one to be demoted, - * must be correctly ordered horizontally; - * b. All the nodes except the one to be demoted must also be - * correctly positioned vertically. The node to be demoted - * may be already correctly positioned vertically, or it may - * have a length which is less than that of one or both of - * its progeny. - * c. *p is non-null - */ - -static void -demote(Freehdr *p) -{ - Freehdr x; /* addr of node to be demoted */ - Freehdr left_branch; - Freehdr right_branch; - uint left_weight; - uint right_weight; - uint x_weight; - - x = *p; - x_weight = weight(x); - left_branch = x->left; - right_branch = x->right; - left_weight = weight(left_branch); - right_weight = weight(right_branch); - - while (left_weight > x_weight || right_weight > x_weight) { - /* - * select a descendant branch for promotion - */ - if (left_weight >= right_weight) { - /* - * promote the left branch - */ - *p = left_branch; - p = &left_branch->right; - left_branch = *p; - left_weight = weight(left_branch); - } else { - /* - * promote the right branch - */ - *p = right_branch; - p = &right_branch->left; - right_branch = *p; - right_weight = weight(right_branch); - } /*else*/ - } /*while*/ - - *p = x; /* attach demoted node here */ - x->left = left_branch; - x->right = right_branch; - -} /*demote*/ - - -/* - * char* - * malloc(nbytes) - * Allocates a block of length specified in bytes. If nbytes is - * zero, a valid pointer (that should not be dereferenced) is returned. - * - * algorithm: - * The freelist is searched by descending the tree from the root - * so that at each decision point the "better fitting" branch node - * is chosen (i.e., the shorter one, if it is long enough, or - * the longer one, otherwise). The descent stops when both - * branch nodes are too short. - * - * function result: - * Malloc returns a pointer to the allocated block. A null - * pointer indicates an error. - * - * diagnostics: - * - * ENOMEM: storage could not be allocated. - * - * EINVAL: either the argument was invalid, or the heap was found - * to be in an inconsistent state. More detailed information may - * be obtained by enabling range checks (cf., malloc_debug()). - * - * Note: In this implementation, each allocated block includes a - * length word, which occurs before the address seen by the caller. - * Allocation requests are rounded up to a multiple of wordsize. - */ - -ptr_t -malloc(uint nbytes) -{ - Freehdr allocp; /* ptr to node to be allocated */ - Freehdr *fpp; /* for tree modifications */ - Freehdr left_branch; - Freehdr right_branch; - uint left_weight; - uint right_weight; - Dblk retblk; /* block returned to the user */ - - /* - * if rigorous checking was requested, do it. - */ - if (debug_level >= 2) { - malloc_verify(); - } - - /* - * add the size of a length word to the request, and - * guarantee at least one word of usable data. - */ - nbytes += ALIGNSIZ; - if (nbytes < SMALLEST_BLK) { - nbytes = SMALLEST_BLK; - } else { - nbytes = roundup(nbytes, ALIGNSIZ); - } - - /* - * ensure that at least one block is big enough to satisfy - * the request. - */ - - if (weight(_root) < nbytes) { - /* - * the largest block is not enough. - */ - if(!morecore(nbytes)) - return 0; - } - - /* - * search down through the tree until a suitable block is - * found. At each decision point, select the better - * fitting node. - */ - - fpp = &_root; - allocp = *fpp; - left_branch = allocp->left; - right_branch = allocp->right; - left_weight = weight(left_branch); - right_weight = weight(right_branch); - - while (left_weight >= nbytes || right_weight >= nbytes) { - if (left_weight <= right_weight) { - if (left_weight >= nbytes) { - fpp = &allocp->left; - allocp = left_branch; - } else { - fpp = &allocp->right; - allocp = right_branch; - } - } else { - if (right_weight >= nbytes) { - fpp = &allocp->right; - allocp = right_branch; - } else { - fpp = &allocp->left; - allocp = left_branch; - } - } - left_branch = allocp->left; - right_branch = allocp->right; - left_weight = weight(left_branch); - right_weight = weight(right_branch); - } /*while*/ - - /* - * allocate storage from the selected node. - */ - - if (allocp->size - nbytes <= SMALLEST_BLK) { - /* - * not big enough to split; must leave at least - * a dblk's worth of space. - */ - retblk = allocp->block; - delete(fpp); - } else { - - /* - * Split the selected block n bytes from the top. The - * n bytes at the top are returned to the caller; the - * remainder of the block goes back to free space. - */ - Dblk nblk; - - retblk = allocp->block; - nblk = nextblk(retblk, nbytes); /* ^next block */ - nblk->size = allocp->size = retblk->size - nbytes; - __mallinfo.ordblks++; /* count fragments */ - - /* - * Change the selected node to point at the newly split - * block, and move the node to its proper place in - * the free space list. - */ - allocp->block = nblk; - demote(fpp); - - /* - * set the length field of the allocated block; we need - * this because free() does not specify a length. - */ - retblk->size = nbytes; - } - /* maintain statistics */ - __mallinfo.uordbytes += retblk->size; /* bytes allocated */ - __mallinfo.allocated++; /* frags allocated */ - if (nbytes < __mallinfo.mxfast) - __mallinfo.smblks++; /* kludge to pass the SVVS */ - - return((ptr_t)retblk->data); - -} /*malloc*/ - -/* - * free(p) - * return a block to the free space tree. - * - * algorithm: - * Starting at the root, search for and coalesce free blocks - * adjacent to one given. When the appropriate place in the - * tree is found, insert the given block. - * - * Some sanity checks to avoid total confusion in the tree. - * If the block has already been freed, return. - * If the ptr is not from the sbrk'ed space, return. - * If the block size is invalid, return. - */ -free_t -free(ptr_t ptr) -{ - uint nbytes; /* Size of node to be released */ - Freehdr *fpp; /* For deletion from free list */ - Freehdr neighbor; /* Node to be coalesced */ - Dblk neighbor_blk; /* Ptr to potential neighbor */ - uint neighbor_size; /* Size of potential neighbor */ - Dblk oldblk; /* Ptr to block to be freed */ - - /* - * if rigorous checking was requested, do it. - */ - if (debug_level >= 2) { - malloc_verify(); - } - - /* - * Check the address of the old block. - */ - if ( misaligned(ptr) ) { - error("free: illegal address (%#x)\n", ptr); - free_return(0); - } - - /* - * Freeing something that wasn't allocated isn't - * exactly kosher, but fclose() does it routinely. - */ - if( ptr < (ptr_t)_lbound || ptr > (ptr_t)_ubound ) { - errno = EINVAL; - free_return(0); - } - - /* - * Get node length by backing up by the size of a header. - * Check for a valid length. It must be a positive - * multiple of ALIGNSIZ, at least as large as SMALLEST_BLK, - * no larger than the extent of the heap, and must not - * extend beyond the end of the heap. - */ - oldblk = (Dblk)((char*)ptr - ALIGNSIZ); - nbytes = oldblk->size; - if (badblksize(oldblk,nbytes)) { - error("free: bad block size (%d) at %#x\n", - (int)nbytes, (int)oldblk ); - free_return(0); - } - - /* maintain statistics */ - __mallinfo.uordbytes -= nbytes; /* bytes allocated */ - __mallinfo.allocated--; /* frags allocated */ - - /* - * Search the tree for the correct insertion point for this - * node, coalescing adjacent free blocks along the way. - */ - fpp = &_root; - neighbor = *fpp; - while (neighbor != NIL) { - neighbor_blk = neighbor->block; - neighbor_size = neighbor->size; - if (oldblk < neighbor_blk) { - Dblk nblk = nextblk(oldblk,nbytes); - if (nblk == neighbor_blk) { - /* - * Absorb and delete right neighbor - */ - nbytes += neighbor_size; - __mallinfo.ordblks--; - delete(fpp); - } else if (nblk > neighbor_blk) { - /* - * The block being freed overlaps - * another block in the tree. This - * is bad news. Return to avoid - * further fouling up the the tree. - */ - error("free: blocks %#x, %#x overlap\n", - (int)oldblk, (int)neighbor_blk); - free_return(0); - } else { - /* - * Search to the left - */ - fpp = &neighbor->left; - } - } else if (oldblk > neighbor_blk) { - Dblk nblk = nextblk(neighbor_blk, neighbor_size); - if (nblk == oldblk) { - /* - * Absorb and delete left neighbor - */ - oldblk = neighbor_blk; - nbytes += neighbor_size; - __mallinfo.ordblks--; - delete(fpp); - } else if (nblk > oldblk) { - /* - * This block has already been freed - */ - error("free: block %#x was already free\n", - (int)ptr); - free_return(0); - } else { - /* - * search to the right - */ - fpp = &neighbor->right; - } - } else { - /* - * This block has already been freed - * as "oldblk == neighbor_blk" - */ - error("free: block %#x was already free\n", (int)ptr); - free_return(0); - } /*else*/ - - /* - * Note that this depends on a side effect of - * delete(fpp) in order to terminate the loop! - */ - neighbor = *fpp; - - } /*while*/ - - /* - * Insert the new node into the free space tree - */ - insert( oldblk, nbytes ); - free_return(1); - -} /*free*/ - - -/* - * char* - * shrink(oldblk, oldsize, newsize) - * Decreases the size of an old block to a new size. - * Returns the remainder to free space. Returns the - * truncated block to the caller. - */ - -static char * -shrink(Dblk oldblk, uint oldsize, uint newsize) -{ - Dblk remainder; - if (oldsize - newsize >= SMALLEST_BLK) { - /* - * Block is to be contracted. Split the old block - * and return the remainder to free space. - */ - remainder = nextblk(oldblk, newsize); - remainder->size = oldsize - newsize; - oldblk->size = newsize; - - /* maintain statistics */ - __mallinfo.ordblks++; /* count fragments */ - __mallinfo.allocated++; /* negate effect of free() */ - - free(remainder->data); - } - return(oldblk->data); -} - -/* - * char* - * realloc(ptr, nbytes) - * - * Reallocate an old block with a new size, returning the old block - * if possible. The block returned is guaranteed to preserve the - * contents of the old block up to min(size(old block), newsize). - * - * For backwards compatibility, ptr is allowed to reference - * a block freed since the LAST call of malloc(). Thus the old - * block may be busy, free, or may even be nested within a free - * block. - * - * Some old programs have been known to do things like the following, - * which is guaranteed not to work: - * - * free(ptr); - * free(dummy); - * dummy = malloc(1); - * ptr = realloc(ptr,nbytes); - * - * This atrocity was found in the source for diff(1). - */ -ptr_t -realloc(ptr_t ptr, uint nbytes) -{ - Freehdr *fpp; - Freehdr fp; - Dblk oldblk; - Dblk freeblk; - Dblk oldneighbor; - uint oldsize; - uint newsize; - uint oldneighborsize; - - /* - * Add SVR4 semantics for OS 5.x so /usr/lib librarys - * work correctly when running in BCP mode - */ - if (ptr == NULL) { - return (malloc(nbytes)); - } - - /* - * if rigorous checking was requested, do it. - */ - if (debug_level >= 2) { - malloc_verify(); - } - - /* - * Check the address of the old block. - */ - if ( misaligned(ptr) || - ptr < (ptr_t)_lbound || - ptr > (ptr_t)_ubound ) { - error("realloc: illegal address (%#x)\n", ptr); - return(NULL); - } - - /* - * check location and size of the old block and its - * neighboring block to the right. If the old block is - * at end of memory, the neighboring block is undefined. - */ - oldblk = (Dblk)((char*)ptr - ALIGNSIZ); - oldsize = oldblk->size; - if (badblksize(oldblk,oldsize)) { - error("realloc: bad block size (%d) at %#x\n", - oldsize, oldblk); - return(NULL); - } - oldneighbor = nextblk(oldblk,oldsize); - - /* *** tree search code pulled into separate subroutine *** */ - if (reclaim(oldblk, oldsize, 1) == -1) { - return(NULL); /* internal error */ - } - - /* - * At this point, we can guarantee that oldblk is out of free - * space. What we do next depends on a comparison of the size - * of the old block and the requested new block size. To do - * this, first round up the new size request. - */ - newsize = nbytes + ALIGNSIZ; /* add size of a length word */ - if (newsize < SMALLEST_BLK) { - newsize = SMALLEST_BLK; - } else { - newsize = roundup(newsize, ALIGNSIZ); - } - - /* - * Next, examine the size of the old block, and compare it - * with the requested new size. - */ - - if (oldsize >= newsize) { - /* - * Block is to be made smaller. - */ - return(shrink(oldblk, oldsize, newsize)); - } - - /* - * Block is to be expanded. Look for adjacent free memory. - */ - if ( oldneighbor < (Dblk)_ubound ) { - /* - * Search for the adjacent block in the free - * space tree. Note that the tree may have been - * modified in the earlier loop. - */ - fpp = &_root; - fp = *fpp; - oldneighborsize = oldneighbor->size; - if ( badblksize(oldneighbor, oldneighborsize) ) { - error("realloc: bad blocksize(%d) at %#x\n", - oldneighborsize, oldneighbor); - return(NULL); - } - while ( weight(fp) >= oldneighborsize ) { - freeblk = fp->block; - if (oldneighbor < freeblk) { - /* - * search to the left - */ - fpp = &(fp->left); - fp = *fpp; - } - else if (oldneighbor > freeblk) { - /* - * search to the right - */ - fpp = &(fp->right); - fp = *fpp; - } - else { /* oldneighbor == freeblk */ - /* - * neighboring block is free; is it big enough? - */ - if (oldsize + oldneighborsize >= newsize) { - /* - * Big enough. Delete freeblk, join - * oldblk to neighbor, return newsize - * bytes to the caller, and return the - * remainder to free storage. - */ - delete(fpp); - - /* maintain statistics */ - __mallinfo.ordblks--; - __mallinfo.uordbytes += oldneighborsize; - - oldsize += oldneighborsize; - oldblk->size = oldsize; - return(shrink(oldblk, oldsize, newsize)); - } else { - /* - * Not big enough. Stop looking for a - * free lunch. - */ - break; - } /*else*/ - } /*else*/ - }/*while*/ - } /*if*/ - - /* - * At this point, we know there is no free space in which to - * expand. Malloc a new block, copy the old block to the new, - * and free the old block, IN THAT ORDER. - */ - ptr = malloc(nbytes); - if (ptr != NULL) { - bcopy(oldblk->data, ptr, oldsize-ALIGNSIZ); - free(oldblk->data); - } - return(ptr); - -} /* realloc */ - - -/* - * *** The following code was pulled out of realloc() *** - * - * int - * reclaim(oldblk, oldsize, flag) - * If a block containing 'oldsize' bytes from 'oldblk' - * is in the free list, remove it from the free list. - * 'oldblk' and 'oldsize' are assumed to include the free block header. - * - * Returns 1 if block was successfully removed. - * Returns 0 if block was not in free list. - * Returns -1 if block spans a free/allocated boundary (error() called - * if 'flag' == 1). - */ -static int -reclaim(Dblk oldblk, uint oldsize, int flag) -{ - Dblk oldneighbor; - Freehdr *fpp; - Freehdr fp; - Dblk freeblk; - uint size; - - /* - * Search the free space list for a node describing oldblk, - * or a node describing a block containing oldblk. Assuming - * the size of blocks decreases monotonically with depth in - * the tree, the loop may terminate as soon as a block smaller - * than oldblk is encountered. - */ - - oldneighbor = nextblk(oldblk, oldsize); - - fpp = &_root; - fp = *fpp; - while ( (size = weight(fp)) >= oldsize ) { - freeblk = fp->block; - if (badblksize(freeblk,size)) { - error("realloc: bad block size (%d) at %#x\n", - size, freeblk); - return(-1); - } - if ( oldblk == freeblk ) { - /* - * |<-- freeblk ... - * _________________________________ - * |<-- oldblk ... - * --------------------------------- - * Found oldblk in the free space tree; delete it. - */ - delete(fpp); - - /* maintain statistics */ - __mallinfo.uordbytes += oldsize; - __mallinfo.allocated++; - return(1); - } - else if (oldblk < freeblk) { - /* - * |<-- freeblk ... - * _________________________________ - * |<--oldblk ... - * --------------------------------- - * Search to the left for oldblk - */ - fpp = &fp->left; - fp = *fpp; - } - else { - /* - * |<-- freeblk ... - * _________________________________ - * | |<--oldblk--->|<--oldneighbor - * --------------------------------- - * oldblk is somewhere to the right of freeblk. - * Check to see if it lies within freeblk. - */ - Dblk freeneighbor; - freeneighbor = nextblk(freeblk, freeblk->size); - if (oldblk >= freeneighbor) { - /* - * |<-- freeblk--->|<--- freeneighbor ... - * _________________________________ - * | |<--oldblk--->| - * --------------------------------- - * no such luck; search to the right. - */ - fpp = &fp->right; - fp = *fpp; - } - else { - /* - * freeblk < oldblk < freeneighbor; - * i.e., oldblk begins within freeblk. - */ - if (oldneighbor > freeneighbor) { - /* - * |<-- freeblk--->|<--- freeneighbor - * _________________________________ - * | |<--oldblk--->|<--oldneighbor - * --------------------------------- - * oldblk straddles a block boundary! - */ - if (flag) { - error("realloc: block %#x straddles free block boundary\n", oldblk); - } - return(-1); - } - else if ( oldneighbor == freeneighbor ) { - /* - * |<-------- freeblk------------->| - * _________________________________ - * | |<--oldblk--->| - * --------------------------------- - * Oldblk is on the right end of - * freeblk. Delete freeblk, split - * into two fragments, and return - * the one on the left to free space. - */ - delete(fpp); - - /* maintain statistics */ - __mallinfo.ordblks++; - __mallinfo.uordbytes += oldsize; - __mallinfo.allocated += 2; - - freeblk->size -= oldsize; - free(freeblk->data); - return(1); - } - else { - /* - * |<-------- freeblk------------->| - * _________________________________ - * | |oldblk | oldneighbor | - * --------------------------------- - * Oldblk is in the middle of freeblk. - * Delete freeblk, split into three - * fragments, and return the ones on - * the ends to free space. - */ - delete(fpp); - - /* maintain statistics */ - __mallinfo.ordblks += 2; - __mallinfo.uordbytes += freeblk->size; - __mallinfo.allocated += 3; - - /* - * split the left fragment by - * subtracting the size of oldblk - * and oldblk's neighbor - */ - freeblk->size -= - ( (char*)freeneighbor - - (char*)oldblk ); - /* - * split the right fragment by - * setting oldblk's neighbor's size - */ - oldneighbor->size = - (char*)freeneighbor - - (char*)oldneighbor; - /* - * return the fragments to free space - */ - free(freeblk->data); - free(oldneighbor->data); - return(1); - } /*else*/ - } /*else*/ - } /* else */ - } /*while*/ - - return(0); /* free block not found */ -} - -/* - * bool - * morecore(nbytes) - * Add a block of at least nbytes from end-of-memory to the - * free space tree. - * - * return value: - * true if at least n bytes can be allocated - * false otherwise - * - * remarks: - * - * -- free space (delimited by the extern variable _ubound) is - * extended by an amount determined by rounding nbytes up to - * a multiple of the system page size. - * - * -- The lower bound of the heap is determined the first time - * this routine is entered. It does NOT necessarily begin at - * the end of static data space, since startup code (e.g., for - * profiling) may have invoked sbrk() before we got here. - */ - -static bool -morecore(uint nbytes) -{ - Dblk p; - Freehdr newhdr; - - if (nbpg == 0) { - nbpg = getpagesize(); - /* hack to avoid fragmenting the heap with the first - freehdr page */ - if ((newhdr = getfreehdr()) == NIL) { - /* Error message returned by getfreehdr() */ - return(false); - } - (void)putfreehdr(newhdr); - } - nbytes = roundup(nbytes, nbpg); - p = (Dblk) sbrk((int)nbytes); - if (p == (Dblk) -1) { - if (errno == EAGAIN) errno = ENOMEM; - return(false); /* errno = ENOMEM */ - } - if (_lbound == NULL) /* set _lbound the first time through */ - _lbound = (char*) p; - _ubound = (char *) p + nbytes; - p->size = nbytes; - - /* maintain statistics */ - __mallinfo.arena = _ubound - _lbound; - __mallinfo.uordbytes += nbytes; - __mallinfo.ordblks++; - __mallinfo.allocated++; - - free(p->data); - return(true); - -} /*morecore*/ - - -/* - * Get a free block header from the free header list. - * When the list is empty, allocate an array of headers. - * When the array is empty, allocate another one. - * When we can't allocate another array, we're in deep weeds. - */ -static Freehdr -getfreehdr(void) -{ - Freehdr r; - Dblk blk; - uint size; - - if (freehdrlist != NIL) { - r = freehdrlist; - freehdrlist = freehdrlist->left; - return(r); - } - if (nfreehdrs <= 0) { - size = NFREE_HDRS*sizeof(struct freehdr) + ALIGNSIZ; - blk = (Dblk) sbrk(size); - if ((int)blk == -1) { - malloc_debug(1); - error("getfreehdr: out of memory"); - if (errno == EAGAIN) errno = ENOMEM; - return(NIL); - } - if (_lbound == NULL) /* set _lbound on first allocation */ - _lbound = (char*)blk; - blk->size = size; - freehdrptr = (Freehdr)blk->data; - nfreehdrs = NFREE_HDRS; - _ubound = (char*) nextblk(blk,size); - - /* maintain statistics */ - __mallinfo.arena = _ubound - _lbound; - __mallinfo.treeoverhead += size; - } - nfreehdrs--; - return(freehdrptr++); -} - -/* - * Free a free block header - * Add it to the list of available headers. - */ -static void -putfreehdr(Freehdr p) -{ - p->left = freehdrlist; - freehdrlist = p; -} - -#ifndef DEBUG /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */ - -/* - * stubs for error handling and diagnosis routines. These are what - * you get in the standard C library; for non-placebo diagnostics - * load /usr/lib/malloc.debug.o with your program. - */ -/*ARGSUSED*/ -static void -error(char *fmt, ...) -{ - errno = EINVAL; -} - -#endif /* !DEBUG <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< */ - - -#ifdef DEBUG /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */ - -/* - * malloc_debug(level) - * - * description: - * - * Controls the level of error diagnosis and consistency checking - * done by malloc() and free(). level is interpreted as follows: - * - * 0: malloc() and free() return 0 if error detected in arguments - * (errno is set to EINVAL) - * 1: malloc() and free() abort if errors detected in arguments - * 2: same as 1, but scan entire heap for errors on every call - * to malloc() or free() - * - * function result: - * returns the previous level of error reporting. - */ -int -malloc_debug(int level) -{ - int old_level; - old_level = debug_level; - debug_level = level; - return (old_level); -} - -/* - * check a free space tree pointer. Should be in - * the static free pool or somewhere in the heap. - */ - -#define chkblk(p)\ - if ( misaligned(p)\ - || ((Dblk)(p) < (Dblk)_lbound || (Dblk)(p) > (Dblk)_ubound)){\ - blkerror(p);\ - return 0;\ - } - -#define chkhdr(p) chkblk(p) - -static -blkerror(Freehdr p) -{ - error("Illegal block address (%#x)\n", (p)); -} - -/* - * cartesian(p) - * returns 1 if free space tree p satisfies internal consistency - * checks. - */ - -static int -cartesian(Freehdr p) -{ - Freehdr probe; - Dblk db,pdb; - - if (p == NIL) /* no tree to test */ - return 1; - /* - * check that root has a data block - */ - chkhdr(p); - pdb = p->block; - chkblk(pdb); - - /* - * check that the child blocks are no larger than the parent block. - */ - probe = p->left; - if (probe != NIL) { - chkhdr(probe); - db = probe->block; - chkblk(db); - if (probe->size > p->size) /* child larger than parent */ - return 0; - } - probe = p->right; - if (probe != NIL) { - chkhdr(probe); - db = probe->block; - chkblk(db); - if (probe->size > p->size) /* child larger than parent */ - return 0; - } - /* - * test data addresses in the left subtree, - * starting at the left subroot and probing to - * the right. All data addresses must be < p->block. - */ - probe = p->left; - while (probe != NIL) { - chkhdr(probe); - db = probe->block; - chkblk(db); - if ( nextblk(db, probe->size) >= pdb ) /* overlap */ - return 0; - probe = probe->right; - } - /* - * test data addresses in the right subtree, - * starting at the right subroot and probing to - * the left. All addresses must be > nextblk(p->block). - */ - pdb = nextblk(pdb, p->size); - probe = p->right; - while (probe != NIL) { - chkhdr(probe); - db = probe->block; - chkblk(db); - if (db == NULL || db <= pdb) /* overlap */ - return 0; - probe = probe->left; - } - return (cartesian(p->left) && cartesian(p->right)); -} - -/* - * malloc_verify() - * - * This is a verification routine. It walks through all blocks - * in the heap (both free and busy) and checks for bad blocks. - * malloc_verify returns 1 if the heap contains no detectably bad - * blocks; otherwise it returns 0. - */ - -int -malloc_verify(void) -{ - int maxsize; - int hdrsize; - int size; - Dblk p; - uint lb,ub; - - extern char end[]; - - if (_lbound == NULL) /* no allocation yet */ - return 1; - - /* - * first check heap bounds pointers - */ - lb = (uint)end; - ub = (uint)sbrk(0); - - if ((uint)_lbound < lb || (uint)_lbound > ub) { - error("malloc_verify: illegal heap lower bound (%#x)\n", - _lbound); - return 0; - } - if ((uint)_ubound < lb || (uint)_ubound > ub) { - error("malloc_verify: illegal heap upper bound (%#x)\n", - _ubound); - return 0; - } - maxsize = heapsize(); - p = (Dblk)_lbound; - while (p < (Dblk) _ubound) { - size = p->size; - if ( (size) < SMALLEST_BLK - || (size) & (ALIGNSIZ-1) - || (size) > heapsize() - || ((char*)(p))+(size) > _ubound ) { - error("malloc_verify: bad block size (%d) at %#x\n", - size, p); - return(0); /* Badness */ - } - p = nextblk(p, size); - } - if (p > (Dblk) _ubound) { - error("malloc_verify: heap corrupted\n"); - return(0); - } - if (!cartesian(_root)){ - error("malloc_verify: free space tree corrupted\n"); - return(0); - } - return(1); -} - -/* - * The following is a kludge to avoid dependency on stdio, which - * uses malloc() and free(), one of which probably got us here in - * the first place. - */ - -#define putchar(c) (*buf++ = (c)) -extern int fileno(); /*bletch*/ -#define stderr 2 /*bletch*/ -#define LBUFSIZ 256 - -static char stderrbuf[LBUFSIZ]; - -/* - * Error routine. - * If debug_level == 0, does nothing except set errno = EINVAL. - * Otherwise, prints an error message to stderr and generates a - * core image. - */ -static void -error(char *fmt, ...) -{ - static int n = 0; /* prevents infinite recursion when using stdio */ - int nbytes; - va_list ap; - - errno = EINVAL; - if (debug_level == 0) - return; - if (!n++) { - va_start(ap, fmt); - nbytes = vsprintf(stderrbuf, fmt, ap); - va_end(ap); - stderrbuf[nbytes++] = '\n'; - stderrbuf[nbytes] = '\0'; - write(fileno(stderr), stderrbuf, nbytes); - } - abort(); -} - -#endif /* DEBUG <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< */ diff --git a/usr/src/lib/libbc/libc/gen/common/mallopt.c b/usr/src/lib/libbc/libc/gen/common/mallopt.c deleted file mode 100644 index 2d78e18333..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/mallopt.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1986 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "mallint.h" -#include <errno.h> - -/* - * mallopt -- System V-compatible malloc "optimizer" - */ -int -mallopt(int cmd, int value) -{ - if (__mallinfo.smblks != 0) - return (-1); /* small block has been allocated */ - - switch (cmd) { - case M_MXFAST: /* small block size */ - if (value < 0) - return (-1); - __mallinfo.mxfast = value; - break; - - case M_NLBLKS: /* # small blocks per holding block */ - if (value <= 0) - return (-1); - __mallinfo.nlblks = value; - break; - - case M_GRAIN: /* small block rounding factor */ - if (value <= 0) - return (-1); - /* round up to multiple of minimum alignment */ - __mallinfo.grain = roundup(value, ALIGNSIZ); - break; - - case M_KEEP: /* Sun algorithm always preserves data */ - break; - - default: - return (-1); - } - - /* make sure that everything is consistent */ - __mallinfo.mxfast = roundup(__mallinfo.mxfast, __mallinfo.grain); - - return (0); -} - - -/* - * mallinfo -- System V-compatible malloc information reporter - */ -struct mallinfo -mallinfo(void) -{ - struct mallinfo mi; - - mi = __mallinfo; - mi.uordblks = mi.uordbytes - (mi.allocated * sizeof(uint)); - mi.fordblks = mi.arena - (mi.treeoverhead + mi.uordblks + - (mi.ordblks * sizeof(uint))); - return (mi); -} diff --git a/usr/src/lib/libbc/libc/gen/common/mbextern.h b/usr/src/lib/libbc/libc/gen/common/mbextern.h deleted file mode 100644 index b858e7e321..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/mbextern.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef lint -/* static char *sccsid = "%Z%%M% %I% %E% SMI"; */ -#endif - -/* - * external declaration for mb* routines - */ - -extern struct _code_set_info _code_set_info; diff --git a/usr/src/lib/libbc/libc/gen/common/mblib.c b/usr/src/lib/libbc/libc/gen/common/mblib.c deleted file mode 100644 index c28860d83a..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/mblib.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * misc routines - */ - -#include <stdio.h> -#include <sys/types.h> -#include "codeset.h" -#include "mbextern.h" -#include <dlfcn.h> - -static void *handle = (void *)NULL; /* initialize it with NULL */ - -/* - * Close current library library - */ -int -_ml_close_library(void) -{ - if (handle == (void *)NULL) { - _code_set_info.open_flag = NULL; - return (-1); - } - - dlclose(handle); - _code_set_info.open_flag = NULL; - handle = (void *)NULL; - return (0); -} - -/* - * Open the given library - */ -void * -_ml_open_library(void) -{ - char buf[BUFSIZ]; - - if (handle != (void *)NULL) /* This library is already opened */ - return (handle); - - /* - * Open the given library - */ - strcpy(buf, LIBRARY_PATH); - strcat(buf, _code_set_info.code_name); - strcat(buf, ".so"); -#ifdef DEBUG - printf ("ml_open_library: buf = '%s'\n", buf); -#endif - handle = dlopen(buf, 1); - if (handle != (void *)NULL) - _code_set_info.open_flag = 1; -#ifdef DEBUG - else - printf ("_ml_open_library: dlopen failed\n"); -#endif - return (handle); -} diff --git a/usr/src/lib/libbc/libc/gen/common/mbstowcs.c b/usr/src/lib/libbc/libc/gen/common/mbstowcs.c deleted file mode 100644 index 1216ccbd45..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/mbstowcs.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1993 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * mbstowcs - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#if !defined(lint) && defined(SCCSIDS) -static char *sccsid = "%Z%%M% %I% %E% SMI"; -#endif - -#include <sys/types.h> -#include "codeset.h" -#include "mbextern.h" - -int -mbstowcs(pwcs, s, n) - wchar_t * pwcs; - char *s; - size_t n; -{ - char *handle; /* handle */ - int (*p)(); - int num = 0; - int ret; - - switch (_code_set_info.code_id) { - case CODESET_NONE: - /* - * default code set, - */ - while (*s && num < n) { - *pwcs++ = (wchar_t)*s++; - num++; - } - if (num < n) - *pwcs = 0; - return (num); - break; - case CODESET_EUC: - /* - * EUC code set - */ - return(_mbstowcs_euc(pwcs, s, n)); - break; - - case CODESET_XCCS: - /* - * XCCS code set - */ - return(_mbstowcs_xccs(pwcs, s, n)); - break; - - case CODESET_ISO2022: - /* - * ISO family - */ - return(_mbstowcs_iso(pwcs, s, n)); - break; - - default: - /* - * User defined code set - */ - handle = _ml_open_library(); - if (handle == (void *)NULL) - return(ERROR_NO_LIB); /* No user library */ - p = (int (*)()) dlsym(handle, "_mbstowcs"); - if (p == (int (*)()) NULL) - return(ERROR_NO_SYM); - ret = (*p)(pwcs, s, n); - return (ret); - break; - } - /* NOTREACHED */ -} diff --git a/usr/src/lib/libbc/libc/gen/common/mbtowc.c b/usr/src/lib/libbc/libc/gen/common/mbtowc.c deleted file mode 100644 index 9fbedb48c9..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/mbtowc.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1997 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * mbtowc - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#if !defined(lint) && defined(SCCSIDS) -static char *sccsid = "%Z%%M% %I% %E% SMI"; -#endif - -#include <stdlib.h> -#include "codeset.h" -#include "mbextern.h" - -#undef mblen - -int -mbtowc(pwc, s, n) - wchar_t * pwc; - char *s; - size_t n; -{ - char *handle; /* handle */ - int (*p)(); - int ret; - - switch (_code_set_info.code_id) { - case CODESET_NONE: -#ifdef DEBUG - printf ("DEFAULT: mbtowc invoked\n"); -#endif - /* - * This is a default code set - */ - if (s == NULL) - return (1); - else { - if (pwc != NULL) - *pwc = (unsigned char)*s; - return (1); - } - break; - case CODESET_EUC: -#ifdef DEBUG - printf ("EUC: mbtowc invoked\n"); -#endif - /* - * EUC code set - */ - return(_mbtowc_euc(pwc, s, n)); - break; - - case CODESET_XCCS: -#ifdef DEBUG - printf ("XCCS: mbtowc invoked\n"); -#endif - /* - * XCCS code set - */ - return(_mbtowc_xccs(pwc, s, n)); - break; - - case CODESET_ISO2022: -#ifdef DEBUG - printf ("ISO2022: mbtowc invoked\n"); -#endif - /* - * ISO family - */ - return(_mbtowc_iso(pwc, s, n)); - break; - - default: - /* - * User defined code set - */ - handle = _ml_open_library(); - if (handle == (char *)NULL) - return(ERROR_NO_LIB); /* No user library */ - p = (int (*)()) dlsym(handle, "_mbtowc"); - if (p == (int (*)()) NULL) - return(ERROR_NO_SYM); - ret = (*p)(pwc, s, n); - return (ret); - break; - } - /* NOTREACHED */ -} - -int mblen(s, n) -register char *s; int n; -{ - int val; - - if (_code_set_info.code_id != CODESET_ISO2022) - return (mbtowc((wchar_t *)0, s, n)); - else { - /* - * ISO's mbtowc() changes 'states'. - */ - _savestates(); - val = mbtowc((wchar_t *)0, s, n); - _restorestates(); - return (val); - } -} diff --git a/usr/src/lib/libbc/libc/gen/common/memalign.c b/usr/src/lib/libbc/libc/gen/common/memalign.c deleted file mode 100644 index a71c2a06f8..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/memalign.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "mallint.h" -#include <errno.h> - -extern int errno; - -/* - * memalign(align,nbytes) - * - * Description: - * Returns a block of specified size on a specified alignment boundary. - * - * Algorithm: - * Malloc enough to ensure that a block can be aligned correctly. - * Find the alignment point and return the fragments - * before and after the block. - * - * Errors: - * Returns NULL and sets errno as follows: - * [EINVAL] - * if nbytes = 0, - * or if alignment is misaligned, - * or if the heap has been detectably corrupted. - * [ENOMEM] - * if the requested memory could not be allocated. - */ - -char * -memalign(align, nbytes) - uint align; - uint nbytes; -{ - uint reqsize; /* Num of bytes to get from malloc() */ - register char *p; /* Ptr returned from malloc() */ - register Dblk blk; /* For addressing fragment blocks */ - register uint blksize; /* Current (shrinking) block size */ - register char *alignedp; /* Ptr to properly aligned boundary */ - register Dblk aligned_blk; /* The block to be returned */ - register uint frag_size; /* size of fragments fore and aft */ - uint x; /* ccom can't do (char*)(uint/uint) */ - - /* - * check for valid size and alignment parameters - */ - if (nbytes == 0 || misaligned(align)) { - errno = EINVAL; - return NULL; - } - - /* - * Malloc enough memory to guarantee that the result can be - * aligned correctly. The worst case is when malloc returns - * a block so close to the next alignment boundary that a - * fragment of minimum size cannot be created. - */ - nbytes = roundup(nbytes, ALIGNSIZ); - reqsize = nbytes + align + SMALLEST_BLK; - p = malloc(reqsize); - if (p == NULL) { - return NULL; - } - - /* - * get size of the entire block (overhead and all) - */ - blk = (Dblk)(p - ALIGNSIZ); /* back up to get length word */ - blksize = blk->size; - - /* - * locate the proper alignment boundary within the block. - */ - x = roundup((uint)p, align); /* ccom work-around */ - alignedp = (char *)x; - aligned_blk = (Dblk)(alignedp - ALIGNSIZ); - - /* - * Check out the space to the left of the alignment - * boundary, and split off a fragment if necessary. - */ - frag_size = (uint)aligned_blk - (uint)blk; - if (frag_size != 0) { - /* - * Create a fragment to the left of the aligned block. - */ - if ( frag_size < SMALLEST_BLK ) { - /* - * Not enough space. So make the split - * at the other end of the alignment unit. - */ - frag_size += align; - aligned_blk = nextblk(aligned_blk,align); - } - blk->size = frag_size; - blksize -= frag_size; - aligned_blk->size = blksize; - free(blk->data); - } - - /* - * Is there a (sufficiently large) fragment to the - * right of the aligned block? - */ - nbytes += ALIGNSIZ; - frag_size = blksize - nbytes; - if (frag_size > SMALLEST_BLK) { - /* - * split and free a fragment on the right - */ - blk = nextblk(aligned_blk, nbytes); - blk->size = frag_size; - aligned_blk->size -= frag_size; - free(blk->data); - } - return(aligned_blk->data); -} diff --git a/usr/src/lib/libbc/libc/gen/common/memccpy.c b/usr/src/lib/libbc/libc/gen/common/memccpy.c deleted file mode 100644 index cbdc8b0db2..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/memccpy.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.1 */ - -/*LINTLIBRARY*/ -/* - * Copy s2 to s1, stopping if character c is copied. Copy no more than n bytes. - * Return a pointer to the byte after character c in the copy, - * or NULL if c is not found in the first n bytes. - */ -char * -memccpy(s1, s2, c, n) -register char *s1, *s2; -register int c, n; -{ - while (--n >= 0) - if ((*s1++ = *s2++) == c) - return (s1); - return (0); -} diff --git a/usr/src/lib/libbc/libc/gen/common/memchr.c b/usr/src/lib/libbc/libc/gen/common/memchr.c deleted file mode 100644 index 89754259dd..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/memchr.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.1 */ - -/*LINTLIBRARY*/ -/* - * Return the ptr in sp at which the character c appears; - * NULL if not found in n chars; don't stop at \0. - */ -char * -memchr(sp, c, n) -register char *sp, c; -register int n; -{ - while (--n >= 0) - if (*sp++ == c) - return (--sp); - return (0); -} diff --git a/usr/src/lib/libbc/libc/gen/common/memcmp.c b/usr/src/lib/libbc/libc/gen/common/memcmp.c deleted file mode 100644 index f4439d8005..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/memcmp.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.1 */ - -/*LINTLIBRARY*/ -/* - * Compare n bytes: s1>s2: >0 s1==s2: 0 s1<s2: <0 - */ -int -memcmp(s1, s2, n) -register char *s1, *s2; -register int n; -{ - int diff; - - if (s1 != s2) - while (--n >= 0) - if (diff = *s1++ - *s2++) - return (diff); - return (0); -} diff --git a/usr/src/lib/libbc/libc/gen/common/mkstemp.c b/usr/src/lib/libbc/libc/gen/common/mkstemp.c deleted file mode 100644 index 579044ff80..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/mkstemp.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/file.h> - -int -mkstemp(char *as) -{ - char *s; - unsigned int pid; - int fd, i; - - pid = getpid(); - s = as; - while (*s++) - /* void */; - s--; - while (*--s == 'X') { - *s = (pid % 10) + '0'; - pid /= 10; - } - s++; - i = 'a'; - while ((fd = open(as, O_CREAT|O_EXCL|O_RDWR, 0600)) == -1) { - if (i == 'z') - return (-1); - *s = i++; - } - return (fd); -} diff --git a/usr/src/lib/libbc/libc/gen/common/mktemp.c b/usr/src/lib/libbc/libc/gen/common/mktemp.c deleted file mode 100644 index 8373996607..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/mktemp.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R3 1.11 */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - - -/*LINTLIBRARY*/ -/**************************************************************** - * Routine expects a string of length at least 6, with - * six trailing 'X's. These will be overlaid with a - * letter and the last (5) digigts of the proccess ID. - * If every letter (a thru z) thus inserted leads to - * an existing file name, your string is shortened to - * length zero upon return (first character set to '\0'). - ***************************************************************/ -#include <sys/types.h> -#include <sys/stat.h> - -#define XCNT 6 - -extern int strlen(), access(), getpid(); - -char * -mktemp(as) -char *as; -{ - register char *s=as; - register unsigned pid; - register unsigned xcnt=0; /* keeps track of number of X's seen */ - struct stat buf; - - pid = getpid(); - s += strlen(as); /* point at the terminal null */ - while(*--s == 'X' && ++xcnt <= XCNT) { - *s = (pid%10) + '0'; - pid /= 10; - } - if(*++s) { /* maybe there were no 'X's */ - *s = 'a'; - while (stat(as, &buf) == 0) { - if(++*s > 'z') { - *as = '\0'; - break; - } - } - } else - if (stat(as, &buf) == 0) - *as = '\0'; - return(as); -} diff --git a/usr/src/lib/libbc/libc/gen/common/mlock.c b/usr/src/lib/libbc/libc/gen/common/mlock.c deleted file mode 100644 index 1e9e1b1a12..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/mlock.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/mman.h> -#include <errno.h> - -/* - * Function to lock address range in memory. - */ - -/*LINTLIBRARY*/ -int -mlock(caddr_t addr, u_int len) -{ - if((int)len <= 0) { - errno = EINVAL; - return (-1); - } - return (mctl(addr, len, MC_LOCK, 0)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/mlockall.c b/usr/src/lib/libbc/libc/gen/common/mlockall.c deleted file mode 100644 index 8bb08dc047..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/mlockall.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/mman.h> - -/* - * Function to lock address space in memory. - */ - -/*LINTLIBRARY*/ -int -mlockall(int flags) -{ - - return (mctl(0, 0, MC_LOCKAS, flags)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/mntent.c b/usr/src/lib/libbc/libc/gen/common/mntent.c deleted file mode 100644 index 8a0b8ac375..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/mntent.c +++ /dev/null @@ -1,233 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <ctype.h> -#include <mntent.h> -#include <sys/file.h> -#include <malloc.h> - -static int mntprtent(FILE *, struct mntent *); - -static struct mntent *mntp; - -struct mntent * -_mnt(void) -{ - - if (mntp == 0) - mntp = (struct mntent *)calloc(1, sizeof (struct mntent)); - return (mntp); -} - -static char * -mntstr(char **p) -{ - unsigned char *cp = (unsigned char *) *p; - unsigned char *retstr; - - while (*cp && isspace(*cp)) - cp++; - retstr = cp; - while (*cp && !isspace(*cp)) - cp++; - if (*cp) { - *cp = '\0'; - cp++; - } - *p = (char *) cp; - return ((char *)retstr); -} - -static int -mntdigit(char **p) -{ - int value = 0; - unsigned char *cp = (unsigned char *) *p; - - while (*cp && isspace(*cp)) - cp++; - for (; *cp && isdigit(*cp); cp++) { - value *= 10; - value += *cp - '0'; - } - while (*cp && !isspace(*cp)) - cp++; - if (*cp) { - *cp = '\0'; - cp++; - } - *p = (char *) cp; - return (value); -} - -static int -mnttabscan(FILE *mnttabp, struct mntent *mnt) -{ - static char *line = NULL; - char *cp; - - if (line == NULL) - line = (char *)malloc(BUFSIZ+1); - do { - cp = fgets(line, BUFSIZ, mnttabp); - if (cp == NULL) { - return (EOF); - } - } while (*cp == '#'); - mnt->mnt_fsname = mntstr(&cp); - if (*cp == '\0') - return (1); - mnt->mnt_dir = mntstr(&cp); - if (*cp == '\0') - return (2); - mnt->mnt_type = mntstr(&cp); - if (*cp == '\0') - return (3); - mnt->mnt_opts = mntstr(&cp); - if (*cp == '\0') - return (4); - mnt->mnt_freq = mntdigit(&cp); - if (*cp == '\0') - return (5); - mnt->mnt_passno = mntdigit(&cp); - return (6); -} - -FILE * -setmntent(char *fname, char *flag) -{ - FILE *mnttabp; - - if ((mnttabp = fopen(fname, flag)) == NULL) { - return (NULL); - } - for (; *flag ; flag++) { - if (*flag == 'w' || *flag == 'a' || *flag == '+') { - if (flock(fileno(mnttabp), LOCK_EX) < 0) { - fclose(mnttabp); - return (NULL); - } - break; - } - } - return (mnttabp); -} - -int -endmntent(FILE *mnttabp) -{ - - if (mnttabp) { - fclose(mnttabp); - } - return (1); -} - -struct mntent * -getmntent(FILE *mnttabp) -{ - int nfields; - - if (mnttabp == 0) - return ((struct mntent *)0); - if (_mnt() == 0) - return ((struct mntent *)0); - nfields = mnttabscan(mnttabp, mntp); - if (nfields == EOF || nfields != 6) - return ((struct mntent *)0); - return (mntp); -} - -int -addmntent(FILE *mnttabp, struct mntent *mnt) -{ - if (fseek(mnttabp, 0L, 2) < 0) - return (1); - if (mnt == (struct mntent *)0) - return (1); - if (mnt->mnt_fsname == NULL || mnt->mnt_dir == NULL || - mnt->mnt_type == NULL || mnt->mnt_opts == NULL) - return (1); - - mntprtent(mnttabp, mnt); - return (0); -} - -static char * -mntopt(char **p) -{ - unsigned char *cp = (unsigned char *) *p; - unsigned char *retstr; - - while (*cp && isspace(*cp)) - cp++; - retstr = cp; - while (*cp && *cp != ',') - cp++; - if (*cp) { - *cp = '\0'; - cp++; - } - *p = (char *) cp; - return ((char *)retstr); -} - -char * -hasmntopt(struct mntent *mnt, char *opt) -{ - char *f, *opts; - static char *tmpopts; - - if (tmpopts == 0) { - tmpopts = (char *)calloc(256, sizeof (char)); - if (tmpopts == 0) - return (0); - } - strcpy(tmpopts, mnt->mnt_opts); - opts = tmpopts; - f = mntopt(&opts); - for (; *f; f = mntopt(&opts)) { - if (strncmp(opt, f, strlen(opt)) == 0) - return (f - tmpopts + mnt->mnt_opts); - } - return (NULL); -} - -static int -mntprtent(FILE *mnttabp, struct mntent *mnt) -{ - fprintf(mnttabp, "%s %s %s %s %d %d\n", - mnt->mnt_fsname, - mnt->mnt_dir, - mnt->mnt_type, - mnt->mnt_opts, - mnt->mnt_freq, - mnt->mnt_passno); - return (0); -} diff --git a/usr/src/lib/libbc/libc/gen/common/modf.c b/usr/src/lib/libbc/libc/gen/common/modf.c deleted file mode 100644 index 3ce1bb8256..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/modf.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" /* from ATT S5R3 */ - -/* The following is extracted from... */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - - -/* - * modf(value, iptr) returns the signed fractional part of value - * and stores the integer part indirectly through iptr. - * - */ - -#define MAXPOWTWO 4.503599627370496000E+15 - /* doubles >= MAXPOWTWO are already integers */ -double -modf(value, iptr) -double value; -register double *iptr; -{ - register double absvalue; - - if ((absvalue = (value >= 0.0) ? value : -value) >= MAXPOWTWO) - *iptr = value; /* it must be an integer */ - else { - *iptr = absvalue + MAXPOWTWO; /* shift fraction off right */ - *iptr -= MAXPOWTWO; /* shift back without fraction */ - while (*iptr > absvalue) /* above arithmetic might round */ - *iptr -= 1.0; /* test again just to be sure */ - if (value < 0.0) - *iptr = -*iptr; - } - return (value - *iptr); /* signed fractional part */ -} diff --git a/usr/src/lib/libbc/libc/gen/common/msync.c b/usr/src/lib/libbc/libc/gen/common/msync.c deleted file mode 100644 index f96b5bd811..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/msync.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/mman.h> -#include <errno.h> - -/* - * Function to synchronize address range with backing store. - */ - -/*LINTLIBRARY*/ -int -msync(caddr_t addr, u_int len, int flags) -{ - if ((int)len <= 0) { - errno = EINVAL; - return (-1); - } - return (mctl(addr, len, MC_SYNC, flags)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/munlock.c b/usr/src/lib/libbc/libc/gen/common/munlock.c deleted file mode 100644 index 3576de146f..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/munlock.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/mman.h> - -/* - * Function to unlock address range from memory. - */ - -/*LINTLIBRARY*/ -int -munlock(caddr_t addr, u_int len) -{ - - return (mctl(addr, len, MC_UNLOCK, 0)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/munlockall.c b/usr/src/lib/libbc/libc/gen/common/munlockall.c deleted file mode 100644 index 0141c40306..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/munlockall.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/mman.h> - -/* - * Function to unlock address space from memory. - */ - -/*LINTLIBRARY*/ -int -munlockall(void) -{ - - return (mctl(0, 0, MC_UNLOCKAS, 0)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/ndbm.c b/usr/src/lib/libbc/libc/gen/common/ndbm.c deleted file mode 100644 index 78676d16eb..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/ndbm.c +++ /dev/null @@ -1,899 +0,0 @@ -/* - * Copyright 2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - * Copyright (c) 2016 by Delphix. All rights reserved. - */ - -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/file.h> -#include <stdio.h> -#include <errno.h> -#include <ndbm.h> -#include <stdlib.h> -#include <string.h> - -datum dbm_do_nextkey(DBM *, datum); - - -/*add support for batched writing for NIS*/ - -#define _DBM_DEFWRITE 0x4 -#define _DBM_DIRTY 0x8 -#define _DBM_DIRDIRTY 0x10 -#define dbm_dirty(db) ((db)->dbm_flags & _DBM_DIRTY) -#define dbm_dirdirty(db) ((db)->dbm_flags & _DBM_DIRDIRTY) -#define dbm_defwrite(db) ((db)->dbm_flags & _DBM_DEFWRITE) -#define dbm_setdirty(db) (db)->dbm_flags |= _DBM_DIRTY -#define dbm_clrdirty(db) (db)->dbm_flags &= ~_DBM_DIRTY -#define dbm_setdirdirty(db) (db)->dbm_flags |= _DBM_DIRDIRTY -#define dbm_clrdirdirty(db) (db)->dbm_flags &= ~_DBM_DIRDIRTY - - -static void dbm_access(DBM *, long); -static int getbit(DBM *); -static int setbit(DBM *); -static int cmpdatum(datum, datum); -static int finddatum(char [PBLKSIZ], datum); -static int delitem(char [PBLKSIZ], int); -static int additem(char [PBLKSIZ], datum, datum); -static datum makdatum(char [PBLKSIZ], int); -static long dcalchash(datum); - -/*used to make a dbm file all at once instead of incrementally*/ -void -dbm_setdefwrite(DBM *db) -{ - db->dbm_flags |= _DBM_DEFWRITE; -} - -int -dbm_flush(DBM *db) -{ - int ok=0; - if (dbm_flushpag(db)<0) ok= -1; - if (dbm_flushdir(db)<0) ok= -1; - return(ok); -} - -int -dbm_flushpag(DBM *db) -{ - int ok=0; - if (dbm_dirty(db)){ /*must page out the page*/ - (void) lseek(db->dbm_pagf, (long)(db->dbm_pagbno*PBLKSIZ), L_SET); - if (write(db->dbm_pagf, db->dbm_pagbuf, PBLKSIZ) != PBLKSIZ) { - db->dbm_flags |= _DBM_IOERR; - ok= -1; - } - dbm_clrdirty(db); - } - return(ok); -} - -int -dbm_flushdir(DBM *db) -{ - int ok=0; - if (dbm_dirdirty(db)){ /*must page out the dir*/ - (void) lseek(db->dbm_dirf, (long)(db->dbm_dirbno*DBLKSIZ), L_SET); - if (write(db->dbm_dirf, db->dbm_dirbuf, DBLKSIZ) != DBLKSIZ) { - ok= -1; - } - dbm_clrdirdirty(db); - } - return(ok); -} -#define BYTESIZ 8 -#undef setbit - -DBM * -dbm_open(char *file, int flags, int mode) -{ - struct stat statb; - DBM *db; - int serrno; - - if ((db = (DBM *)malloc(sizeof *db)) == 0) { - errno = ENOMEM; - return ((DBM *)0); - } - db->dbm_flags = (flags & 03) == O_RDONLY ? _DBM_RDONLY : 0; - if ((flags & 03) == O_WRONLY) - flags = (flags & ~03) | O_RDWR; - if (strlcpy(db->dbm_pagbuf, file, sizeof (db->dbm_pagbuf)) >= - sizeof (db->dbm_pagbuf) || - strlcat(db->dbm_pagbuf, ".pag", sizeof (db->dbm_pagbuf)) >= - sizeof (db->dbm_pagbuf)) { - /* - * file.pag does not fit into dbm_pagbuf. - * fails with ENAMETOOLONG. - */ - serrno = ENAMETOOLONG; - goto bad; - } - db->dbm_pagf = open(db->dbm_pagbuf, flags, mode); - if (db->dbm_pagf < 0) { - serrno = errno; - goto bad; - } - /* - * We know this won't overflow so it is safe to ignore the - * return value; we use strl* to prevent false hits in - * code sweeps. - */ - (void) strlcpy(db->dbm_pagbuf, file, sizeof (db->dbm_pagbuf)); - (void) strlcat(db->dbm_pagbuf, ".dir", sizeof (db->dbm_pagbuf)); - db->dbm_dirf = open(db->dbm_pagbuf, flags, mode); - if (db->dbm_dirf < 0) { - serrno = errno; - goto bad1; - } - (void) fstat(db->dbm_dirf, &statb); - db->dbm_maxbno = statb.st_size*BYTESIZ-1; - db->dbm_pagbno = db->dbm_dirbno = -1; - return (db); -bad1: - (void) close(db->dbm_pagf); -bad: - free((char *)db); - errno = serrno; - return ((DBM *)0); -} - -void -dbm_close(DBM *db) -{ - (void) dbm_close_status(db); -} - -/*close with return code*/ -int -dbm_close_status(DBM *db) -{ - int ok; - ok=0; - - if (dbm_flush(db) <0) ok = -1; - if (close(db->dbm_dirf)<0) ok= -1; - if ( close(db->dbm_pagf)<0) ok= -1; - free((char *)db); - return (ok); -} - -long -dbm_forder(DBM *db, datum key) -{ - long hash; - - hash = dcalchash(key); - for (db->dbm_hmask=0;; db->dbm_hmask=(db->dbm_hmask<<1)+1) { - db->dbm_blkno = hash & db->dbm_hmask; - db->dbm_bitno = db->dbm_blkno + db->dbm_hmask; - if (getbit(db) == 0) - break; - } - return (db->dbm_blkno); -} - -datum -dbm_fetch(DBM *db, datum key) -{ - int i; - datum item; - - if (dbm_error(db)) - goto err; - dbm_access(db, dcalchash(key)); - if ((i = finddatum(db->dbm_pagbuf, key)) >= 0) { - item = makdatum(db->dbm_pagbuf, i+1); - if (item.dptr != NULL) - return (item); - } -err: - item.dptr = NULL; - item.dsize = 0; - return (item); -} - -int -dbm_delete(DBM *db, datum key) -{ - int i; - - if (dbm_error(db)) - return (-1); - if (dbm_rdonly(db)) { - errno = EPERM; - return (-1); - } - dbm_access(db, dcalchash(key)); - if ((i = finddatum(db->dbm_pagbuf, key)) < 0) - return (-1); - if (!delitem(db->dbm_pagbuf, i)) - goto err; - db->dbm_pagbno = db->dbm_blkno; - if (dbm_defwrite(db)) { - dbm_setdirty(db); - } - else { - (void) lseek(db->dbm_pagf, (long)(db->dbm_blkno*PBLKSIZ), L_SET); - if (write(db->dbm_pagf, db->dbm_pagbuf, PBLKSIZ) != PBLKSIZ) { - err: - db->dbm_flags |= _DBM_IOERR; - return (-1); - } - } - return (0); -} - -int -dbm_store(DBM *db, datum key, datum dat, int replace) -{ - int i; - datum item, item1; - char ovfbuf[PBLKSIZ]; - - if (dbm_error(db)) - return (-1); - if (dbm_rdonly(db)) { - errno = EPERM; - return (-1); - } -loop: - dbm_access(db, dcalchash(key)); - if ((i = finddatum(db->dbm_pagbuf, key)) >= 0) { - if (!replace) - return (1); - if (!delitem(db->dbm_pagbuf, i)) { - db->dbm_flags |= _DBM_IOERR; - return (-1); - } - } - if (!additem(db->dbm_pagbuf, key, dat)) - goto split; - db->dbm_pagbno = db->dbm_blkno; - if (dbm_defwrite(db)) { - dbm_setdirty(db); - } - else { - - (void) lseek(db->dbm_pagf, (long)(db->dbm_blkno*PBLKSIZ), L_SET); - if (write(db->dbm_pagf, db->dbm_pagbuf, PBLKSIZ) != PBLKSIZ) { - db->dbm_flags |= _DBM_IOERR; - return (-1); - } - } - return (0); - -split: - if (key.dsize+dat.dsize+3*sizeof(short) >= PBLKSIZ) { - db->dbm_flags |= _DBM_IOERR; - errno = ENOSPC; - return (-1); - } - bzero(ovfbuf, PBLKSIZ); - for (i=0;;) { - item = makdatum(db->dbm_pagbuf, i); - if (item.dptr == NULL) - break; - if (dcalchash(item) & (db->dbm_hmask+1)) { - item1 = makdatum(db->dbm_pagbuf, i+1); - if (item1.dptr == NULL) { - /*(void) fprintf(stderr, "ndbm: split not paired\n");*/ - db->dbm_flags |= _DBM_IOERR; - break; - } - if (!additem(ovfbuf, item, item1) || - !delitem(db->dbm_pagbuf, i)) { - db->dbm_flags |= _DBM_IOERR; - return (-1); - } - continue; - } - i += 2; - } - db->dbm_pagbno = db->dbm_blkno; - (void) lseek(db->dbm_pagf, (long)(db->dbm_blkno*PBLKSIZ), L_SET); - if (write(db->dbm_pagf, db->dbm_pagbuf, PBLKSIZ) != PBLKSIZ) { - db->dbm_flags |= _DBM_IOERR; - return (-1); - } - dbm_clrdirty(db); /*clear dirty*/ - (void) lseek(db->dbm_pagf, - (long)((db->dbm_blkno+db->dbm_hmask+1)*PBLKSIZ), L_SET); - if (write(db->dbm_pagf, ovfbuf, PBLKSIZ) != PBLKSIZ) { - db->dbm_flags |= _DBM_IOERR; - return (-1); - } - if (setbit(db) < 0) { - db->dbm_flags |= _DBM_IOERR; - return (-1); - } - goto loop; -} - -static long -dbm_hashinc(DBM *db, long hash) -{ - - long bit; - - hash &= db->dbm_hmask; - bit = db->dbm_hmask+1; - for(;;) { - bit >>= 1; - if(bit == 0) - return(0L); - if((hash&bit) == 0) - return(hash|bit); - hash &= ~bit; - } -} - - - -static datum nullkey= {NULL, 0}; - -datum -dbm_firsthash(DBM *db, long hash) -{ - int i,j; - datum item, bitem; - -loop: - dbm_access(db, hash); - j=0; - bitem = makdatum(db->dbm_pagbuf, 0); - for(i=2;; i+=2) { - item = makdatum(db->dbm_pagbuf, i); - if(item.dptr == NULL) - break; - if(cmpdatum(bitem, item) < 0) { - j=i; - bitem = item; - } - } - if(bitem.dptr != NULL) { - db->dbm_keyptr = j + 2; - db->dbm_blkptr = db->dbm_blkno; - return(bitem); - } - hash = dbm_hashinc(db,hash); - if(hash == 0) - return(item); /*null item*/ - goto loop; - -} - -datum -dbm_firstkey(DBM *db) -{ - - db->dbm_blkptr = 0L; - db->dbm_keyptr = 0; - return (dbm_firsthash(db, 0L)); -} - -datum -dbm_nextkey(DBM *db) -{ - - return (dbm_do_nextkey(db, nullkey)); -} - -/*this is used if keyptr-2,blocknum doesn't point to the previous -specific key allowing the fast hash order search -- -its use indicates user tampering with our state variables, -which some evil users might do to search from some specific place. -It finds the first key at or after blkptr,keyptr in block seq order -this requires looking at all sorts of emtpy blocks in many cases*/ - -static datum -dbm_slow_nextkey(DBM *db) -{ - struct stat statb; - datum item; - - if (dbm_error(db) || fstat(db->dbm_pagf, &statb) < 0) - goto err; - statb.st_size /= PBLKSIZ; - - for (;;) { - if (db->dbm_blkptr != db->dbm_pagbno) { - - if (dbm_dirty(db)) dbm_flushpag(db); - - db->dbm_pagbno = db->dbm_blkptr; - (void) lseek(db->dbm_pagf, (long)(db->dbm_blkptr*PBLKSIZ), L_SET); - if (read(db->dbm_pagf, db->dbm_pagbuf, PBLKSIZ) != PBLKSIZ) - bzero(db->dbm_pagbuf, PBLKSIZ); -#ifdef DEBUG - else if (chkblk(db->dbm_pagbuf) < 0) - db->dbm_flags |= _DBM_IOERR; -#endif - } - /*Am I an empty block?*/ - if (((short *)db->dbm_pagbuf)[0] != 0) { - item = makdatum(db->dbm_pagbuf, db->dbm_keyptr); - if (item.dptr != NULL) { - db->dbm_keyptr += 2; - return (item); - } - db->dbm_keyptr = 0; - } - /*go to next sequential block*/ - if (++db->dbm_blkptr >= statb.st_size) - break; - } -err: - item.dptr = NULL; - item.dsize = 0; - return (item); -} - -datum -dbm_do_nextkey(DBM *db, datum inkey) -{ - datum item,bitem; - long hash; - datum key; - int f; - int i; - int j; - short *sp; - int n; - char *p1, *p2; - - if ( dbm_error(db) ) { - item.dptr = NULL; - item.dsize = 0; - return (item); - } - - /*user has supplied lastkey*/ - - if(inkey.dptr != NULL) { - dbm_access(db, (hash=dcalchash(inkey))); - if ((i = finddatum(db->dbm_pagbuf, inkey)) >= 0) { - db->dbm_keyptr = i + 2; - db->dbm_blkptr = db->dbm_blkno; - } - key=inkey; - } - else { - /*is this a manual firstkey request? */ - - if (db->dbm_blkptr == 0L && - db->dbm_keyptr == 0) - return (dbm_firsthash(db, 0L)); - - /*no -- get lastkey this is like dbm_access by blkptr*/ - - if (db->dbm_blkptr != db->dbm_pagbno) { - - if (dbm_dirty(db)) dbm_flushpag(db); - db->dbm_pagbno = db->dbm_blkptr; - (void) lseek(db->dbm_pagf, (long)(db->dbm_blkptr*PBLKSIZ), L_SET); - if (read(db->dbm_pagf, db->dbm_pagbuf, PBLKSIZ) != PBLKSIZ) - bzero(db->dbm_pagbuf, PBLKSIZ); -#ifdef DEBUG - else if (chkblk(db->dbm_pagbuf) < 0) - db->dbm_flags |= _DBM_IOERR; -#endif - } - /*now just make up last key datum*/ - if (db->dbm_keyptr >=2) key= makdatum(db->dbm_pagbuf,(db->dbm_keyptr-2)); - else key=nullkey; - - /* the keyptr pagbuf have failed us, the user must - depend on these variables and their former meaning. - If we set the variables this would have got - us the key for sure! So give the user the old algorithm.*/ - if (key.dptr == NULL) return (dbm_slow_nextkey(db)); - } - - /*at this point the last key is paged in and - we can proceed as in old dbm -- like Ken did his. */ - - f = 1; - j=0; - sp = (short *)db->dbm_pagbuf; - - for(i=0;; i+=2) { - - /*begin put makdatum inline*/ - - if ((unsigned)i >= sp[0]) { - item.dptr = NULL; - item.dsize = 0; - break; /*from below*/ - } - else { - if (i > 0) item.dsize = sp[i] - sp[i+1]; - else item.dsize = PBLKSIZ - sp[i+1]; - item.dptr = db->dbm_pagbuf+sp[i+1]; - } - - /* item = makdatum(db->dbm_pagbuf, i);*/ - /*end put makdatum inline*/ - - if(item.dptr == NULL) - break; -/*inline cmpdatum*/ - - - n = key.dsize; - if(n != item.dsize) - if( (n - item.dsize) <= 0 ) continue; - else { } - else { - if(n == 0) continue; - p1 = key.dptr; - p2 = item.dptr; - do - if(*p1++ != *p2++) - if((*--p1 - *--p2) > 0) goto keep_going; - else continue; - while(--n); - continue; - } - -keep_going: - -/*end inline cmpdatum*/ - /*if(cmpdatum(key, item) <= 0) - continue;*/ - if (f) { - bitem = item; - j=i; - f = 0; - } - else { - -/* if(cmpdatum(bitem, item) < 0)*/ - - n = bitem.dsize; - if(n != item.dsize) - { - if((n - item.dsize) <0) { - bitem = item; - j=i; - } - } - else if (n != 0) { - p1 = bitem.dptr; - p2 = item.dptr; - do - if(*p1++ != *p2++) { - if((*--p1 - *--p2) <0) { - bitem = item; - j=i; - } - break; - } - while(--n); - } - } - } - - if(f == 0) { - db->dbm_keyptr = j + 2; - db->dbm_blkptr = db->dbm_blkno; - return (bitem); - } - - /* really need hash at this point */ - /* if it gave us a key we have already calculated the hash */ - /* if not get the hash */ - if (inkey.dptr == NULL) hash=dcalchash(key); - hash = dbm_hashinc(db,hash); - - if(hash == 0) - return (item); /*null*/ - /*get first item on next page in hash table order*/ - return (dbm_firsthash(db, hash)); - - -} - -static void -dbm_access(DBM *db, long hash) -{ - int b, i, n; - long bn; - long my_bitno; - long my_hmask; - long my_blkno; - - for (my_hmask=0;; my_hmask=(my_hmask<<1)+1) { - my_blkno = hash & my_hmask; - my_bitno = my_blkno + my_hmask; - /*getbit inline*/ - if (my_bitno > db->dbm_maxbno) break; - n = my_bitno % BYTESIZ; - bn = my_bitno / BYTESIZ; - i = bn % DBLKSIZ; - b = bn / DBLKSIZ; - if (b != db->dbm_dirbno) { - if (dbm_dirdirty(db)) dbm_flushdir(db); /*must flush*/ - db->dbm_dirbno = b; - (void) lseek(db->dbm_dirf, (long)(b*DBLKSIZ), L_SET); - if (read(db->dbm_dirf, db->dbm_dirbuf, DBLKSIZ) != DBLKSIZ) - bzero(db->dbm_dirbuf, DBLKSIZ); - } - if ( (db->dbm_dirbuf[i] & (1<<n)) == 0 ) break; - - /* - if (getbit(db) == 0) - break; - */ - } - /*copy*/ - db->dbm_blkno=my_blkno; - db->dbm_bitno=my_bitno; - db->dbm_hmask=my_hmask; - - if (my_blkno != db->dbm_pagbno) { - if (dbm_dirty(db)){ /*must page out the page*/ - (void) lseek(db->dbm_pagf, (long)(db->dbm_pagbno*PBLKSIZ), L_SET); - if (write(db->dbm_pagf, db->dbm_pagbuf, PBLKSIZ) != PBLKSIZ) { - db->dbm_flags |= _DBM_IOERR; - } - dbm_clrdirty(db); - } - - db->dbm_pagbno = my_blkno; - (void) lseek(db->dbm_pagf, (long)(my_blkno*PBLKSIZ), L_SET); - if (read(db->dbm_pagf, db->dbm_pagbuf, PBLKSIZ) != PBLKSIZ) - bzero(db->dbm_pagbuf, PBLKSIZ); -#ifdef DEBUG - else if (chkblk(db->dbm_pagbuf) < 0) - db->dbm_flags |= _DBM_IOERR; -#endif - } -} - -static int -getbit(DBM *db) -{ - long bn; - int b, i, n; - - - if (db->dbm_bitno > db->dbm_maxbno) - return (0); - n = db->dbm_bitno % BYTESIZ; - bn = db->dbm_bitno / BYTESIZ; - i = bn % DBLKSIZ; - b = bn / DBLKSIZ; - if (b != db->dbm_dirbno) { - if (dbm_dirdirty(db)) dbm_flushdir(db); /*must flush*/ - db->dbm_dirbno = b; - (void) lseek(db->dbm_dirf, (long)(b*DBLKSIZ), L_SET); - if (read(db->dbm_dirf, db->dbm_dirbuf, DBLKSIZ) != DBLKSIZ) - bzero(db->dbm_dirbuf, DBLKSIZ); - } - return (db->dbm_dirbuf[i] & (1<<n)); -} - -static int -setbit(DBM *db) -{ - long bn; - int i, n, b; - - if (db->dbm_bitno > db->dbm_maxbno) - db->dbm_maxbno = db->dbm_bitno; - n = db->dbm_bitno % BYTESIZ; - bn = db->dbm_bitno / BYTESIZ; - i = bn % DBLKSIZ; - b = bn / DBLKSIZ; - if (b != db->dbm_dirbno) { - if (dbm_dirdirty(db)) dbm_flushdir(db); - db->dbm_dirbno = b; - (void) lseek(db->dbm_dirf, (long)(b*DBLKSIZ), L_SET); - if (read(db->dbm_dirf, db->dbm_dirbuf, DBLKSIZ) != DBLKSIZ) - bzero(db->dbm_dirbuf, DBLKSIZ); - } - db->dbm_dirbuf[i] |= 1<<n; - db->dbm_dirbno = b; - if (dbm_defwrite(db)) { - dbm_setdirdirty(db); - } else{ - (void) lseek(db->dbm_dirf, (long)(b*DBLKSIZ), L_SET); - if (write(db->dbm_dirf, db->dbm_dirbuf, DBLKSIZ) != DBLKSIZ) { - return (-1); - } - } - return (0); -} - -static datum -makdatum(char buf[PBLKSIZ], int n) -{ - short *sp; - int t; - datum item; - - sp = (short *)buf; - if ((unsigned)n >= sp[0]) { - item.dptr = NULL; - item.dsize = 0; - return (item); - } - t = PBLKSIZ; - if (n > 0) - t = sp[n]; - item.dptr = buf+sp[n+1]; - item.dsize = t - sp[n+1]; - return (item); -} - -static int -cmpdatum(datum d1, datum d2) -{ - int n; - char *p1, *p2; - - n = d1.dsize; - if(n != d2.dsize) - return(n - d2.dsize); - if(n == 0) - return(0); - p1 = d1.dptr; - p2 = d2.dptr; - do - if(*p1++ != *p2++) - return(*--p1 - *--p2); - while(--n); - return(0); -} - -static int -finddatum(char buf[PBLKSIZ], datum item) -{ - short *sp; - int i, n, j; - - sp = (short *)buf; - n = PBLKSIZ; - for (i=0, j=sp[0]; i<j; i+=2, n = sp[i]) { - n -= sp[i+1]; - if (n != item.dsize) - continue; - if (n == 0 || bcmp(&buf[sp[i+1]], item.dptr, n) == 0) - return (i); - } - return (-1); -} - -static int hitab[16] - = { 61, 57, 53, 49, 45, 41, 37, 33, - 29, 25, 21, 17, 13, 9, 5, 1, -}; - -static long hltab[64] - = { - 06100151277L,06106161736L,06452611562L,05001724107L, - 02614772546L,04120731531L,04665262210L,07347467531L, - 06735253126L,06042345173L,03072226605L,01464164730L, - 03247435524L,07652510057L,01546775256L,05714532133L, - 06173260402L,07517101630L,02431460343L,01743245566L, - 00261675137L,02433103631L,03421772437L,04447707466L, - 04435620103L,03757017115L,03641531772L,06767633246L, - 02673230344L,00260612216L,04133454451L,00615531516L, - 06137717526L,02574116560L,02304023373L,07061702261L, - 05153031405L,05322056705L,07401116734L,06552375715L, - 06165233473L,05311063631L,01212221723L,01052267235L, - 06000615237L,01075222665L,06330216006L,04402355630L, - 01451177262L,02000133436L,06025467062L,07121076461L, - 03123433522L,01010635225L,01716177066L,05161746527L, - 01736635071L,06243505026L,03637211610L,01756474365L, - 04723077174L,03642763134L,05750130273L,03655541561L, -}; - -static long -dcalchash(datum item) -{ - int s, c, j; - char *cp; - long hashl; - int hashi; - - hashl = 0; - hashi = 0; - for (cp = item.dptr, s=item.dsize; --s >= 0; ) { - c = *cp++; - for (j=0; j<BYTESIZ; j+=4) { - hashi += hitab[c&017]; - hashl += hltab[hashi&63]; - c >>= 4; - } - } - return (hashl); -} - -/* - * Delete pairs of items (n & n+1). - */ -static int -delitem(char buf[PBLKSIZ], int n) -{ - short *sp, *sp1; - int i1, i2; - - sp = (short *)buf; - i2 = sp[0]; - if ((unsigned)n >= i2 || (n & 1)) - return (0); - if (n == i2-2) { - sp[0] -= 2; - return (1); - } - i1 = PBLKSIZ; - if (n > 0) - i1 = sp[n]; - i1 -= sp[n+2]; - if (i1 > 0) { - i2 = sp[i2]; - bcopy(&buf[i2], &buf[i2 + i1], sp[n+2] - i2); - } - sp[0] -= 2; - for (sp1 = sp + sp[0], sp += n+1; sp <= sp1; sp++) - sp[0] = sp[2] + i1; - return (1); -} - -/* - * Add pairs of items (item & item1). - */ -static int -additem(char buf[PBLKSIZ], datum item, datum item1) -{ - short *sp; - int i1, i2; - - sp = (short *)buf; - i1 = PBLKSIZ; - i2 = sp[0]; - if (i2 > 0) - i1 = sp[i2]; - i1 -= item.dsize + item1.dsize; - if (i1 <= (i2+3) * sizeof(short)) - return (0); - sp[0] += 2; - sp[++i2] = i1 + item1.dsize; - bcopy(item.dptr, &buf[i1 + item1.dsize], item.dsize); - sp[++i2] = i1; - bcopy(item1.dptr, &buf[i1], item1.dsize); - return (1); -} - -#ifdef DEBUG -static int -chkblk(char buf[PBLKSIZ]) -{ - short *sp; - int t, i; - - sp = (short *)buf; - t = PBLKSIZ; - for (i=0; i<sp[0]; i++) { - if (sp[i+1] > t) - return (-1); - t = sp[i+1]; - } - if (t < (sp[0]+1)*sizeof(short)) - return (-1); - return (0); -} -#endif diff --git a/usr/src/lib/libbc/libc/gen/common/nl_cxtime.c b/usr/src/lib/libbc/libc/gen/common/nl_cxtime.c deleted file mode 100644 index 53c73ee0d9..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/nl_cxtime.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1993 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - - -#include <stdio.h> -#include <time.h> - -#define TBUFSIZE 128 -char _tbuf[TBUFSIZE]; - -char * -nl_cxtime(clk, fmt) - struct tm *clk; - char *fmt; -{ - char *nl_ascxtime(); - return (nl_ascxtime(localtime(clk), fmt)); -} - -char * -nl_ascxtime(tmptr, fmt) - struct tm *tmptr; - char *fmt; -{ - return (strftime (_tbuf, TBUFSIZE, fmt ? fmt : "%H:%M:%S", tmptr) ? - _tbuf : asctime(tmptr)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/nl_strncmp.c b/usr/src/lib/libbc/libc/gen/common/nl_strncmp.c deleted file mode 100644 index cbf844c983..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/nl_strncmp.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> - -#define MAXSTR 256 /* use same value as used in strcoll */ - -int -nl_strncmp(s1, s2, n) - char *s1; - char *s2; - int n; -{ - char ns1[MAXSTR+1]; - char ns2[MAXSTR+1]; - register int i; - register char *p1, *p2; - - p1 = ns1; - p2 = ns2; - - for (i = 0; i < n && i < MAXSTR; i++) { - *p1++ = *s1++; - *p2++ = *s2++; - } - *p1 = *p2 = '\0'; - - return (strcoll(ns1, ns2)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/on_exit.c b/usr/src/lib/libbc/libc/gen/common/on_exit.c deleted file mode 100644 index 354c9a6409..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/on_exit.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> - -/* - * Copyright (c) 1987 by Sun Microsystems, Inc. - */ - -char *malloc(); - -struct handlers { - void (*handler)(); - caddr_t arg; - struct handlers *next; -}; - -extern struct handlers *_exit_handlers; - -int -on_exit(handler, arg) - void (*handler)(); - caddr_t arg; -{ - register struct handlers *h = - (struct handlers *)malloc(sizeof (*h)); - - if (h == 0) - return (-1); - h->handler = handler; - h->arg = arg; - h->next = _exit_handlers; - _exit_handlers = h; - return (0); -} diff --git a/usr/src/lib/libbc/libc/gen/common/opendir.c b/usr/src/lib/libbc/libc/gen/common/opendir.c deleted file mode 100644 index cf41897df2..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/opendir.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1995, by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/param.h> -#include <sys/stat.h> -#include <dirent.h> -#include <errno.h> -#include <fcntl.h> - -/* - * open a directory. - */ -DIR * -opendir(name) - char *name; -{ - register DIR *dirp; - register int fd; - struct stat sb; - extern int errno; - extern char *malloc(); - extern int open(), close(), fstat(); - - if ((fd = open(name, O_RDONLY | O_NDELAY)) == -1) - return (NULL); - if (fstat(fd, &sb) == -1) { - (void) close(fd); - return (NULL); - } - if ((sb.st_mode & S_IFMT) != S_IFDIR) { - errno = ENOTDIR; - (void) close(fd); - return (NULL); - } - if (((dirp = (DIR *)malloc(sizeof(DIR))) == NULL) || - ((dirp->dd_buf = malloc(sb.st_blksize)) == NULL)) { - if (dirp) - free(dirp); - (void) close(fd); - return (NULL); - } - dirp->dd_fd = fd; - dirp->dd_loc = 0; - dirp->dd_size = 0; - dirp->dd_bsize = sb.st_blksize; - dirp->dd_off = 0; - (void) fcntl(fd, F_SETFD, FD_CLOEXEC); - return (dirp); -} diff --git a/usr/src/lib/libbc/libc/gen/common/optind.c b/usr/src/lib/libbc/libc/gen/common/optind.c deleted file mode 100644 index 5bfeb416cb..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/optind.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1987 Sun Microsystems, Inc. - */ - -/*LINTLIBRARY*/ -int optind = 1; -int opterr = 1; -char *optarg; diff --git a/usr/src/lib/libbc/libc/gen/common/pack_float.c b/usr/src/lib/libbc/libc/gen/common/pack_float.c deleted file mode 100644 index 4a75254292..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/pack_float.c +++ /dev/null @@ -1,455 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1988-1995, by Sun Microsystems, Inc. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "base_conversion.h" - -void -_fp_rightshift(pu, n) - unpacked *pu; - int n; - -/* Right shift significand sticky by n bits. */ - -{ - int i; - - if (n >= (32 * UNPACKED_SIZE)) { /* drastic */ - for (i = 0; (pu->significand[i] == 0) && (i < UNPACKED_SIZE); i++); - if (i >= UNPACKED_SIZE) { - pu->fpclass = fp_zero; - return; - } else { - for (i = 0; i < (UNPACKED_SIZE - 1); i++) - pu->significand[i] = 0; - pu->significand[UNPACKED_SIZE - 1] = 1; - return; - } - } - while (n >= 32) { /* big shift */ - if (pu->significand[UNPACKED_SIZE - 1] != 0) - pu->significand[UNPACKED_SIZE - 2] |= 1; - for (i = UNPACKED_SIZE - 2; i >= 0; i--) - pu->significand[i + 1] = pu->significand[i]; - pu->significand[0] = 0; - n -= 32; - } - if (n >= 1) { /* small shift */ - unsigned long high, low, shiftout = 0; - for (i = 0; i < UNPACKED_SIZE; i++) { - high = pu->significand[i] >> n; - low = pu->significand[i] << (32 - n); - pu->significand[i] = shiftout | high; - shiftout = low; - } - if (shiftout != 0) - pu->significand[UNPACKED_SIZE - 1] |= 1; - } -} - -PRIVATE int -overflow_to_infinity(sign) - int sign; - -/* Returns 1 if overflow should go to infinity, 0 if to max finite. */ - -{ - int inf; - - switch (_fp_current_direction) { - case fp_nearest: - inf = 1; - break; - case fp_tozero: - inf = 0; - break; - case fp_positive: - inf = !sign; - break; - case fp_negative: - inf = sign; - break; - } - return (inf); -} - -PRIVATE void -round(pu, roundword) - unpacked *pu; - -/* - * Round according to current rounding mode. pu must be shifted to so that - * the roundbit is pu->significand[roundword] & 0x80000000 - */ - -{ - int increment; /* boolean to indicate round up */ - int is; - unsigned msw; /* msw before increment */ - - for (is = (roundword + 1); is < UNPACKED_SIZE; is++) - if (pu->significand[is] != 0) { /* Condense extra bits into - * sticky bottom of - * roundword. */ - pu->significand[roundword] |= 1; - break; - } - if (pu->significand[roundword] == 0) - return; - _fp_set_exception(fp_inexact); - switch (_fp_current_direction) { - case fp_nearest: - increment = pu->significand[roundword] >= 0x80000000; - break; - case fp_tozero: - increment = 0; - break; - case fp_positive: - increment = (pu->sign == 0) & (pu->significand[roundword] != 0); - break; - case fp_negative: - increment = (pu->sign != 0) & (pu->significand[roundword] != 0); - break; - } - if (increment) { - msw=pu->significand[0]; /* save msw before round */ - is = roundword; - do { - is--; - pu->significand[is]++; - } - while ((pu->significand[is] == 0) && (is > 0)); - if (pu->significand[0] < msw) { /* rounding carried out */ - pu->exponent++; - pu->significand[0] = 0x80000000; - } - } - if ((_fp_current_direction == fp_nearest) && (pu->significand[roundword] == 0x80000000)) { /* ambiguous case */ - pu->significand[roundword - 1] &= ~1; /* force round to even */ - } -} - -void -_pack_single(pu, px) - unpacked *pu; /* unpacked result */ - single *px; /* packed single */ -{ - single_equivalence kluge; - - kluge.f.msw.sign = pu->sign; - switch (pu->fpclass) { - case fp_zero: - kluge.f.msw.exponent = 0; - kluge.f.msw.significand = 0; - break; - case fp_infinity: -infinity: - kluge.f.msw.exponent = 0xff; - kluge.f.msw.significand = 0; - break; - case fp_quiet: - kluge.f.msw.exponent = 0xff; - kluge.f.msw.significand = 0x400000 | (0x3fffff & (pu->significand[0] >> 8)); - break; - case fp_normal: - _fp_rightshift(pu, 8); - pu->exponent += SINGLE_BIAS; - if (pu->exponent <= 0) { - kluge.f.msw.exponent = 0; - _fp_rightshift(pu, 1 - pu->exponent); - round(pu, 1); - if (pu->significand[0] == 0x800000) { /* rounded back up to - * normal */ - kluge.f.msw.exponent = 1; - kluge.f.msw.significand = 0; - _fp_set_exception(fp_underflow); - goto ret; - } - if (_fp_current_exceptions & (1 << fp_inexact)) - _fp_set_exception(fp_underflow); - kluge.f.msw.significand = 0x7fffff & pu->significand[0]; - goto ret; - } - round(pu, 1); - if (pu->significand[0] == 0x1000000) { /* rounding overflow */ - pu->significand[0] = 0x800000; - pu->exponent += 1; - } - if (pu->exponent >= 0xff) { - _fp_set_exception(fp_overflow); - _fp_set_exception(fp_inexact); - if (overflow_to_infinity(pu->sign)) - goto infinity; - kluge.f.msw.exponent = 0xfe; - kluge.f.msw.significand = 0x7fffff; - goto ret; - } - kluge.f.msw.exponent = pu->exponent; - kluge.f.msw.significand = 0x7fffff & pu->significand[0]; - } -ret: - *px = kluge.x; -} - -void -_pack_double(pu, px) - unpacked *pu; /* unpacked result */ - double *px; /* packed double */ -{ - double_equivalence kluge; - - kluge.f.msw.sign = pu->sign; - switch (pu->fpclass) { - case fp_zero: - kluge.f.msw.exponent = 0; - kluge.f.msw.significand = 0; - kluge.f.significand2 = 0; - break; - case fp_infinity: -infinity: - kluge.f.msw.exponent = 0x7ff; - kluge.f.msw.significand = 0; - kluge.f.significand2 = 0; - break; - case fp_quiet: - kluge.f.msw.exponent = 0x7ff; - _fp_rightshift(pu, 11); - kluge.f.msw.significand = 0x80000 | (0x7ffff & pu->significand[0]); - kluge.f.significand2 = pu->significand[1]; - break; - case fp_normal: - _fp_rightshift(pu, 11); - pu->exponent += DOUBLE_BIAS; - if (pu->exponent <= 0) { /* underflow */ - kluge.f.msw.exponent = 0; - _fp_rightshift(pu, 1 - pu->exponent); - round(pu, 2); - if (pu->significand[0] == 0x100000) { /* rounded back up to - * normal */ - kluge.f.msw.exponent = 1; - kluge.f.msw.significand = 0; - kluge.f.significand2 = 0; - _fp_set_exception(fp_underflow); - goto ret; - } - if (_fp_current_exceptions & (1 << fp_inexact)) - _fp_set_exception(fp_underflow); - kluge.f.msw.exponent = 0; - kluge.f.msw.significand = 0xfffff & pu->significand[0]; - kluge.f.significand2 = pu->significand[1]; - goto ret; - } - round(pu, 2); - if (pu->significand[0] == 0x200000) { /* rounding overflow */ - pu->significand[0] = 0x100000; - pu->exponent += 1; - } - if (pu->exponent >= 0x7ff) { /* overflow */ - _fp_set_exception(fp_overflow); - _fp_set_exception(fp_inexact); - if (overflow_to_infinity(pu->sign)) - goto infinity; - kluge.f.msw.exponent = 0x7fe; - kluge.f.msw.significand = 0xfffff; - kluge.f.significand2 = 0xffffffff; - goto ret; - } - kluge.f.msw.exponent = pu->exponent; - kluge.f.msw.significand = 0xfffff & pu->significand[0]; - kluge.f.significand2 = pu->significand[1]; - break; - } -ret: - *px = kluge.x; -} - -void -_pack_extended(pu, px) - unpacked *pu; /* unpacked result */ - extended *px; /* packed extended */ -{ - extended_equivalence kluge; - - kluge.f.msw.sign = pu->sign; - switch (pu->fpclass) { - case fp_zero: - kluge.f.msw.exponent = 0; - kluge.f.significand = 0; - kluge.f.significand2 = 0; - break; - case fp_infinity: -infinity: - kluge.f.msw.exponent = 0x7fff; - kluge.f.significand = 0; - kluge.f.significand2 = 0; - break; - case fp_quiet: - kluge.f.msw.exponent = 0x7fff; - kluge.f.significand = 0x40000000 | (0x7fffffff & pu->significand[0]); - kluge.f.significand2 = pu->significand[1]; - break; - case fp_normal: - switch (_fp_current_precision) { - case fp_single: - { - single s; - _pack_single(pu, &s); - _unpack_single(pu, &s); - break; - } - case fp_double: - { - double s; - _pack_double(pu, &s); - _unpack_double(pu, &s); - break; - } - } - pu->exponent += EXTENDED_BIAS; - if (pu->exponent <= 0) { /* underflow */ - kluge.f.msw.exponent = 0; - _fp_rightshift(pu, -pu->exponent); - round(pu, 2); - if (_fp_current_exceptions & (1 << fp_inexact)) - _fp_set_exception(fp_underflow); - kluge.f.msw.exponent = 0; - kluge.f.significand = pu->significand[0]; - kluge.f.significand2 = pu->significand[1]; - goto ret; - } - round(pu, 2); - if (pu->exponent >= 0x7fff) { /* overflow */ - _fp_set_exception(fp_overflow); - _fp_set_exception(fp_inexact); - if (overflow_to_infinity(pu->sign)) - goto infinity; - kluge.f.msw.exponent = 0x7ffe; - kluge.f.significand = 0xffffffff; - kluge.f.significand2 = 0xffffffff; - goto ret; - } - kluge.f.msw.exponent = pu->exponent; - kluge.f.significand = pu->significand[0]; - kluge.f.significand2 = pu->significand[1]; - break; - } -ret: - (*px)[0] = kluge.x[0]; - (*px)[1] = kluge.x[1]; - (*px)[2] = kluge.x[2]; -} - -void -_pack_quadruple(pu, px) - unpacked *pu; /* unpacked result */ - quadruple *px; /* packed quadruple */ -{ - quadruple_equivalence kluge; - int i; - - kluge.f.msw.sign = pu->sign; - switch (pu->fpclass) { - case fp_zero: - kluge.f.msw.exponent = 0; - kluge.f.msw.significand = 0; - kluge.f.significand2 = 0; - kluge.f.significand3 = 0; - kluge.f.significand4 = 0; - break; - case fp_infinity: -infinity: - kluge.f.msw.exponent = 0x7fff; - kluge.f.msw.significand = 0; - kluge.f.significand2 = 0; - kluge.f.significand3 = 0; - kluge.f.significand4 = 0; - break; - case fp_quiet: - kluge.f.msw.exponent = 0x7fff; - _fp_rightshift(pu, 15); - kluge.f.msw.significand = 0x8000 | (0xffff & pu->significand[0]); - kluge.f.significand2 = pu->significand[1]; - kluge.f.significand3 = pu->significand[2]; - kluge.f.significand4 = pu->significand[3]; - break; - case fp_normal: - _fp_rightshift(pu, 15); - pu->exponent += QUAD_BIAS; - if (pu->exponent <= 0) { /* underflow */ - kluge.f.msw.exponent = 0; - _fp_rightshift(pu, 1 - pu->exponent); - round(pu, 4); - if (pu->significand[0] == 0x10000) { /* rounded back up to - * normal */ - kluge.f.msw.exponent = 1; - kluge.f.msw.significand = 0; - kluge.f.significand2 = 0; - kluge.f.significand3 = 0; - kluge.f.significand4 = 0; - _fp_set_exception(fp_underflow); - goto ret; - } - if (_fp_current_exceptions & (1 << fp_inexact)) - _fp_set_exception(fp_underflow); - kluge.f.msw.exponent = 0; - kluge.f.msw.significand = 0xffff & pu->significand[0]; - kluge.f.significand2 = pu->significand[1]; - kluge.f.significand3 = pu->significand[2]; - kluge.f.significand4 = pu->significand[3]; - goto ret; - } - round(pu, 4); - if (pu->significand[0] == 0x20000) { /* rounding overflow */ - pu->significand[0] = 0x10000; - pu->exponent += 1; - } - if (pu->exponent >= 0x7fff) { /* overflow */ - _fp_set_exception(fp_overflow); - _fp_set_exception(fp_inexact); - if (overflow_to_infinity(pu->sign)) - goto infinity; - kluge.f.msw.exponent = 0x7ffe; - kluge.f.msw.significand = 0xffff; - kluge.f.significand2 = 0xffffffff; - kluge.f.significand3 = 0xffffffff; - kluge.f.significand4 = 0xffffffff; - goto ret; - } - kluge.f.msw.exponent = pu->exponent; - kluge.f.msw.significand = pu->significand[0] & 0xffff; - kluge.f.significand2 = pu->significand[1]; - kluge.f.significand3 = pu->significand[2]; - kluge.f.significand4 = pu->significand[3]; - break; - } -ret: -#ifdef __STDC__ - *px = kluge.x; -#else - for (i = 0; i < 4; i++) - px->u[i] = kluge.x.u[i]; -#endif -} diff --git a/usr/src/lib/libbc/libc/gen/common/perror.c b/usr/src/lib/libbc/libc/gen/common/perror.c deleted file mode 100644 index 484af3f4cf..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/perror.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1983 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Print the error indicated - * in the cerror cell. - */ -#include <stdio.h> - -extern int fflush(); -extern void _perror(); - -void -perror(s) - char *s; -{ - - (void)fflush(stderr); - _perror(s); -} diff --git a/usr/src/lib/libbc/libc/gen/common/plock.c b/usr/src/lib/libbc/libc/gen/common/plock.c deleted file mode 100644 index fe3d069929..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/plock.c +++ /dev/null @@ -1,319 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * plock - lock "segments" in physical memory. - * - * Supports SVID-compatible plock, taking into account dynamically linked - * objects (such as shared libraries). - */ - -#include <sys/types.h> -#include <sys/mman.h> -#include <sys/lock.h> -#include <sys/time.h> -#include <sys/resource.h> -#include <machine/param.h> -#include <machine/vmparam.h> -#include <a.out.h> -#include <link.h> -#include <errno.h> - -/* - * Globals we reference. - */ -extern struct link_dynamic _DYNAMIC; -extern int mlock(); -extern int munlock(); -extern caddr_t sbrk(); /* find end of data segment */ -extern caddr_t etext; /* end of text segment */ - -/* - * Module-scope variables. - */ -static int page_size = 0; /* cached result of getpagesize() */ -static int lock_state = 0; /* lock state */ -static int state_pid = -1; /* pid to which state belongs */ - -/* - * Local worker routine to lock text and data segments. Handles - * dynamically loaded objects. This routine is highly dependent - * on executable format and layout. - * - * Arguments: - * op: desired operation - * f: function to perform - */ -static int -apply_lock(int op, int (*f)(caddr_t, u_int)) -{ - int e = 0; /* return value */ - caddr_t a; /* address of operation */ - u_int l; /* length of operation */ - struct link_map *lmp; /* link map walker */ - struct exec *eh; /* exec header */ - - /* - * Operate on application segment first. - */ - switch (op) { - case TXTLOCK: - a = (caddr_t)USRTEXT; /* note: old Sun-2 not handled */ - l = (u_int)&etext - USRTEXT; - break; - case DATLOCK: - a = (caddr_t)(((int)&etext + (SEGSIZ - 1)) & ~(SEGSIZ - 1)); - l = (u_int)(sbrk(0) - a); - break; - } - l = (l + (page_size - 1)) & (u_int)~(page_size - 1); - - /* - * Perform the operation -- if failure, return immediately. - */ - if (e = (*f)(a, l)) - return (e); - - /* - * If we're not a dynamically linked program, we are finished. - */ - if (&_DYNAMIC == 0) - return (0); - - /* - * Find the list of dynamically linked objects. If we get - * dynamic linking formats we don't recognize, then punt. - */ - switch (_DYNAMIC.ld_version) { - case 2: -#if defined(__sparc) - case 3: -#endif /* __sparc */ - lmp = _DYNAMIC.ld_un.ld_2->ld_loaded; - break; - default: - return (0); - } - - /* - * Loop over all objects. Extract the addresses and lengths as - * required, and perform the appropriate operation. - */ - - while (lmp) { - eh = (struct exec *)lmp->lm_addr; - switch (op) { - case TXTLOCK: - a = (caddr_t)eh; - l = (u_int)eh->a_text; - break; - case DATLOCK: - a = (caddr_t)((u_int)eh + N_DATADDR(*eh) - - N_TXTADDR(*eh)); - l = (u_int)eh->a_data + (u_int)eh->a_bss; - break; - } - l = (l + (page_size - 1)) & ~(page_size - 1); - if (e = (*f)(a, l)) - return (e); - lmp = lmp->lm_next; - } - return (0); -} - -/* - * plock - * - * Argument: - * op: desired operation - */ -int -plock(int op) -{ - int e = 0; /* return value */ - int pid; /* current pid */ - caddr_t a1, a2; /* loop variables */ - struct rlimit rl; /* resource limit */ - - /* - * Initialize static caches. - */ - if (page_size == 0) - page_size = getpagesize(); - - /* - * Validate state of lock's. If parent has forked, then - * the lock state needs to be reset (children do not inherit - * memory locks, and thus do not inherit their state). - */ - if ((pid = getpid()) != state_pid) { - lock_state = 0; - state_pid = pid; - } - - /* - * Dispatch on operation. Note: plock and its relatives depend - * upon "op" being bit encoded. - */ - switch (op) { - - /* - * UNLOCK: remove all memory locks. Requires that some be set! - */ - case UNLOCK: - if (lock_state == 0) { - errno = EINVAL; - return (-1); - } - if (e = munlockall()) - return (-1); - else { - lock_state = 0; - return (0); - } - /*NOTREACHED*/ - - /* - * TXTLOCK: locks text segments. - */ - case TXTLOCK: - - /* - * If a text or process lock is already set, then fail. - */ - if ((lock_state & TXTLOCK) || (lock_state & PROCLOCK)) { - errno = EINVAL; - return (-1); - } - - /* - * Try to apply the lock(s). If a failure occurs, - * back them out. On success, remember that a text - * lock was set. - */ - if (e = apply_lock(op, mlock)) - (void) apply_lock(op, munlock); - else - lock_state |= TXTLOCK; - return (e); - /*NOTREACHED*/ - - /* - * DATLOCK: locks data segment(s), including the stack and all - * future growth in the address space. - */ - case DATLOCK: - - /* - * If a data or process lock is already set, then fail. - */ - if ((lock_state & DATLOCK) || (lock_state & PROCLOCK)) { - errno = EINVAL; - return (-1); - } - - /* - * Try to lock the data segments. On failure, back out - * the locks and return. - */ - if (e = apply_lock(op, mlock)) { - (void) apply_lock(op, munlock); - return (-1); - } - - /* - * Try to lock the stack segment. Find out the extent - * and start of the stack (there should be a function for - * this!) and then iterate over the pages of the stack - * locking them. The stack *could* be sparely populated. - * Ignore lock failures resulting from the absence of a - * mapping. - */ - (void) getrlimit(RLIMIT_STACK, &rl); - for (a1 = (caddr_t)USRSTACK - page_size; - a1 != (caddr_t)USRSTACK - rl.rlim_cur; a1 -= page_size) - if (e = mlock(a1, page_size)) { - if (errno == ENOMEM) - e = 0; - break; - } - - /* - * If we were successful in locking the stack, then - * try to set a lock for all future mappings. - */ - if (!e) - e = mlockall(MCL_FUTURE); - - /* - * If failures have occurred, back out the locks - * and return failure. - */ - if (e) { - e = errno; - (void) apply_lock(op, munlock); - for (a2 = (caddr_t)USRSTACK - page_size; a2 != a1; - a2 -= page_size) - (void) munlock(a2, page_size); - errno = e; - return (-1); - } - - /* - * Data, stack, and growth have been locked. Set state - * and return success. - */ - lock_state |= DATLOCK; - return (0); - /*NOTREACHED*/ - - /* - * PROCLOCK: lock everything, and all future things as well. - * There should be nothing locked when this is called. - */ - case PROCLOCK: - if (lock_state) { - errno = EINVAL; - return (-1); - } - if (mlockall(MCL_CURRENT | MCL_FUTURE) == 0) { - lock_state |= PROCLOCK; - return (0); - } else - return (-1); - /*NOTREACHED*/ - - /* - * Invalid operation. - */ - default: - errno = EINVAL; - return (-1); - /*NOTREACHED*/ - } -} diff --git a/usr/src/lib/libbc/libc/gen/common/popen.c b/usr/src/lib/libbc/libc/gen/common/popen.c deleted file mode 100644 index bb295e717a..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/popen.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 1995, by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 5.2 85/06/05 */ - -/* - * Copyright (c) 1980 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#include <stdio.h> -#include <signal.h> -#include <vfork.h> - -#define tst(a,b) (*mode == 'r'? (b) : (a)) -#define RDR 0 -#define WTR 1 - -extern char *malloc(); -extern int execl(), vfork(), pipe(), close(), fcntl(); - -static int *popen_pid; -static int nfiles; - -FILE * -popen(cmd,mode) - char *cmd; - char *mode; -{ - int p[2]; - register int *poptr; - register int myside, hisside, pid; - - if (nfiles <= 0) - nfiles = getdtablesize(); - if (popen_pid == NULL) { - popen_pid = (int *)malloc(nfiles * sizeof *popen_pid); - if (popen_pid == NULL) - return (NULL); - for (pid = 0; pid < nfiles; pid++) - popen_pid[pid] = -1; - } - if (pipe(p) < 0) - return (NULL); - myside = tst(p[WTR], p[RDR]); - hisside = tst(p[RDR], p[WTR]); - if ((pid = vfork()) == 0) { - /* myside and hisside reverse roles in child */ - int stdio; - - /* close all pipes from other popen's */ - for (poptr = popen_pid; poptr < popen_pid+nfiles; poptr++) { - if(*poptr >= 0) - close(poptr - popen_pid); - } - stdio = tst(0, 1); - (void) close(myside); - if (hisside != stdio) { - (void) dup2(hisside, stdio); - (void) close(hisside); - } - (void) execl("/bin/sh", "sh", "-c", cmd, (char *)NULL); - _exit(127); - } - if (pid == -1) { - close(myside); - close(hisside); - return (NULL); - } - popen_pid[myside] = pid; - close(hisside); - return (fdopen(myside, mode)); -} - -int -pclose(ptr) - FILE *ptr; -{ - int child = -1; - int pid, status, omask; - - if (popen_pid != NULL) { - child = popen_pid[fileno(ptr)]; - popen_pid[fileno(ptr)] = -1; - } - fclose(ptr); - if (child == -1) - return (-1); - omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGHUP)); - while ((pid = waitpid(child, &status, 0)) != child && pid != -1) - ; - (void) sigsetmask(omask); - return (pid == -1 ? -1 : status); -} diff --git a/usr/src/lib/libbc/libc/gen/common/posix_sig.c b/usr/src/lib/libbc/libc/gen/common/posix_sig.c deleted file mode 100644 index c2b867c912..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/posix_sig.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1994 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * posix signal package - */ -#include <stdio.h> -#include <signal.h> -#include <errno.h> - -#define cantmask (sigmask(SIGKILL)|sigmask(SIGSTOP)) - - -/* - * sigemptyset - all known signals - */ -int -sigemptyset(sigset_t *sigp) -{ - if (!sigp) { - errno = EINVAL; - return (-1); - } - *sigp = 0; - return (0); -} - -/* - * sigfillset - all known signals - */ -int -sigfillset(sigset_t *sigp) -{ - if (!sigp) { - errno = EINVAL; - return (-1); - } - *sigp = sigmask(NSIG - 1) | (sigmask(NSIG - 1) - 1); - return (0); -} - -/* - * add the signal to the set - */ -int -sigaddset(sigset_t *sigp, int signo) -{ - if (!sigp || signo <= 0 || signo >= NSIG) { - errno = EINVAL; - return (-1); - } - *sigp |= sigmask(signo); - return (0); -} - -/* - * remove the signal from the set - */ -int -sigdelset(sigset_t *sigp, int signo) -{ - if (!sigp || signo <= 0 || signo >= NSIG) { - errno = EINVAL; - return (-1); - } - *sigp &= ~sigmask(signo); - return (0); -} - -/* - * return true if the signal is in the set (return is 0 or 1) - */ -int -sigismember(sigset_t *sigp, int signo) -{ - if (!sigp || signo <= 0 || signo >= NSIG) { - errno = EINVAL; - return (-1); - } - return ((*sigp & sigmask(signo)) != 0); -} diff --git a/usr/src/lib/libbc/libc/gen/common/posix_tty.c b/usr/src/lib/libbc/libc/gen/common/posix_tty.c deleted file mode 100644 index ae07844ecd..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/posix_tty.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1995 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * wrappers for posix tty manipulation functions - */ - -#include <errno.h> -#include <termios.h> -#include <termio.h> -#include <sys/types.h> - -/* - * return the output speed from the struct - */ -speed_t -cfgetospeed(struct termios *termios_p) -{ - return (termios_p->c_cflag & CBAUDEXT ? - (termios_p->c_cflag & CBAUD) + CBAUD + 1 : - termios_p->c_cflag & CBAUD); -} - -/* - * set the speed in the struct - */ -int -cfsetospeed(struct termios *termios_p, speed_t speed) -{ - if (speed > (2*CBAUD + 1)) { - errno = EINVAL; - return (-1); - } - if (speed > CBAUD) { - termios_p->c_cflag |= CBAUDEXT; - speed -= (CBAUD + 1); - } else - termios_p->c_cflag &= ~CBAUDEXT; - - termios_p->c_cflag = - (termios_p->c_cflag & ~CBAUD) | (speed & CBAUD); - return (0); -} - -/* - * return the input speed from the struct - */ -speed_t -cfgetispeed(struct termios *termios_p) -{ - return (termios_p->c_cflag & CIBAUDEXT ? - ((termios_p->c_cflag & CIBAUD) >> IBSHIFT) - + (CIBAUD >> IBSHIFT) + 1 : - (termios_p->c_cflag & CIBAUD) >> IBSHIFT); -} - -/* - * set the input speed in the struct - */ -int -cfsetispeed(struct termios *termios_p, speed_t speed) -{ - if (speed > (2*CBAUD + 1)) { - errno = EINVAL; - return (-1); - } - if ((speed << IBSHIFT) > CIBAUD) { - termios_p->c_cflag |= CIBAUDEXT; - speed -= ((CIBAUD >> IBSHIFT) + 1); - } else - termios_p->c_cflag &= ~CIBAUDEXT; - termios_p->c_cflag = - (termios_p->c_cflag & ~CIBAUD) | ((speed << IBSHIFT) & CIBAUD); - return (0); -} - -/* - * grab the modes - */ -int -tcgetattr(int fd, struct termios *termios_p) -{ - return (ioctl(fd, TCGETS, termios_p)); -} - -/* - * set the modes - */ -int -tcsetattr(int fd, int option, struct termios *termios_p) -{ - struct termios work_area; - - /* If input speed is zero, set it to the output speed. */ - if ((((termios_p->c_cflag >> IBSHIFT) & CIBAUD) == 0) && - ((termios_p->c_cflag & CIBAUDEXT) == 0)) { - work_area = *termios_p; - work_area.c_cflag |= (work_area.c_cflag & CBAUD) << IBSHIFT; - if (termios_p->c_cflag & CBAUDEXT) - work_area.c_cflag |= CIBAUDEXT; - termios_p = &work_area; - } - switch (option) { - case TCSADRAIN: - return (ioctl(fd, TCSETSW, termios_p)); - case TCSAFLUSH: - return (ioctl(fd, TCSETSF, termios_p)); - case TCSANOW: - return (ioctl(fd, TCSETS, termios_p)); - default: - errno = EINVAL; - return (-1); - } - /*NOTREACHED*/ -} - -/* - * send a break - * This is kludged for duration != 0; it should do something like crank the - * baud rate down and then send the break if the duration != 0. - */ -int -tcsendbreak(int fd, int duration) -{ - unsigned d = (unsigned)duration; - - do - if (ioctl(fd, TCSBRK, 0) == -1) - return (-1); - while (d--); - return (0); -} - -/* - * wait for all output to drain from fd - */ -int -tcdrain(int fd) -{ - return (ioctl(fd, TCSBRK, !0)); -} - -/* - * flow control - */ -int -tcflow(int fd, int action) -{ - switch (action) { - default: - errno = EINVAL; - return (-1); - case TCOOFF: - case TCOON: - case TCIOFF: - case TCION: - return (ioctl(fd, TCXONC, action)); - } - /*NOTREACHED*/ -} - -/* - * flush read/write/both - */ -int -tcflush(int fd, int queue) -{ - switch (queue) { - default: - errno = EINVAL; - return (-1); - case TCIFLUSH: - case TCOFLUSH: - case TCIOFLUSH: - return (ioctl(fd, TCFLSH, queue)); - } - /*NOTREACHED*/ -} - -/* - * get the foreground process group id - */ -pid_t -tcgetpgrp(int fd) -{ - int grp_id; - - if (ioctl(fd, TIOCGETPGRP, &grp_id) == -1) - return ((pid_t)-1); - else - return ((pid_t)grp_id); -} - -/* - * set the foreground process group id - */ -int -tcsetpgrp(int fd, int grp_id) -{ - return (ioctl(fd, TIOCSETPGRP, &grp_id)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/psignal.c b/usr/src/lib/libbc/libc/gen/common/psignal.c deleted file mode 100644 index 1be7704b44..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/psignal.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1983 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Print the name of the signal indicated - * along with the supplied message. - */ -#include <stdio.h> - -extern int fflush(); -extern void _psignal(); - -void -psignal(sig, s) - unsigned sig; - char *s; -{ - - (void)fflush(stderr); - _psignal(sig, s); -} diff --git a/usr/src/lib/libbc/libc/gen/common/putenv.c b/usr/src/lib/libbc/libc/gen/common/putenv.c deleted file mode 100644 index 72796576c8..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/putenv.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* LINTLIBRARY */ -/* putenv - change environment variables - * - * input - char *change = a pointer to a string of the form - * "name=value" - * - * output - 0, if successful - * 1, otherwise - */ - -#include <stdio.h> -#include <stdlib.h> - -extern char **environ; /* pointer to enviroment */ -static int reall; /* flag to reallocate space, if putenv is called - more than once */ -static int find(char *); -static int match(char *, char *); - -int -putenv(char *change) -{ - char **newenv; /* points to new environment */ - int which; /* index of variable to replace */ - - if ((which = find(change)) < 0) { - /* if a new variable */ - /* which is negative of table size, so invert and - count new element */ - which = (-which) + 1; - if (reall) { - /* we have expanded environ before */ - newenv = (char **)realloc(environ, - which*sizeof(char *)); - if (newenv == NULL) return (-1); - /* now that we have space, change environ */ - environ = newenv; - } else { - /* environ points to the original space */ - reall++; - newenv = (char **)malloc(which*sizeof(char *)); - if (newenv == NULL) return (-1); - (void)memcpy((char *)newenv, (char *)environ, - (int)(which*sizeof(char *))); - environ = newenv; - } - environ[which-2] = change; - environ[which-1] = NULL; - } else { - /* we are replacing an old variable */ - environ[which] = change; - } - return (0); -} - -/* find - find where s2 is in environ - * - * input - str = string of form name=value - * - * output - index of name in environ that matches "name" - * -size of table, if none exists -*/ -static int -find(char *str) -{ - int ct = 0; /* index into environ */ - - while(environ[ct] != NULL) { - if (match(environ[ct], str) != 0) - return (ct); - ct++; - } - return (-(++ct)); -} -/* - * s1 is either name, or name=value - * s2 is name=value - * if names match, return value of 1, - * else return 0 - */ - -static int -match(char *s1, char *s2) -{ - while(*s1 == *s2++) { - if (*s1 == '=') - return (1); - s1++; - } - return (0); -} diff --git a/usr/src/lib/libbc/libc/gen/common/pwdauth.c b/usr/src/lib/libbc/libc/gen/common/pwdauth.c deleted file mode 100644 index bbc367a2bf..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/pwdauth.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1992 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <pwd.h> -#include <shadow.h> -#include <errno.h> - -/* - * Version to go in the BCP compatibility library in SVr4 version of - * SunOS. This does not bother talking to rpc.pwdauthd or looking for the - * password.adjunct file on the system since they do not exist anymore. - * They have been effectively replaced by a more robust aging security provided - * by the combination of /etc/shadow file, shadow support in the NIS+ - * passwd table and the use of secure RPC in NIS+. - */ - -int -pwdauth(char *name, char *password) -{ - /* - * this routine authenticates a password for the named user. - * Assumes the adjunct file does not exist. - * and therefore checks the passwd "source" using the standard - * getpwnam(3C) routine that uses /etc/nsswitch.conf(4). - */ - - struct passwd *pwp = NULL; - struct spwd *spwp = NULL; - char *enpwp; - - if (spwp = getspnam(name)) - enpwp = spwp->sp_pwdp; - else if (pwp = getpwnam(name)) - enpwp = pwp->pw_passwd; - else - /* user is not in main password system */ - return (-1); - if (enpwp[0] == '#' && enpwp[1] == '#') { - /* this means that /etc/passwd has problems */ - fprintf(stderr, "pwdauth: bad passwd entry for %s\n", - name); - return (-1); - } - if (strcmp(crypt(password, enpwp), enpwp) == 0) - return (0); - else - return (-1); -} diff --git a/usr/src/lib/libbc/libc/gen/common/pwdnm.c b/usr/src/lib/libbc/libc/gen/common/pwdnm.c deleted file mode 100644 index dda9de2a15..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/pwdnm.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* c2 secure */ - -#include <rpc/rpc.h> -#include <rpcsvc/pwdnm.h> - - -bool_t -xdr_pwdnm(xdrs,objp) - XDR *xdrs; - pwdnm *objp; -{ - if (! xdr_wrapstring(xdrs, &objp->name)) { - return(FALSE); - } - if (! xdr_wrapstring(xdrs, &objp->password)) { - return(FALSE); - } - return(TRUE); -} - - diff --git a/usr/src/lib/libbc/libc/gen/common/qeconvert.c b/usr/src/lib/libbc/libc/gen/common/qeconvert.c deleted file mode 100644 index 38c324ddc2..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/qeconvert.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -#include "base_conversion.h" - -char * -qeconvert(arg, ndigits, decpt, sign, buf) - quadruple *arg; - int ndigits, *decpt, *sign; - char *buf; -{ - decimal_mode dm; - decimal_record dr; - fp_exception_field_type ef; - int i; - static char *nanstring = "NaN"; - static char *infstring = "Infinity"; - char *pc; - int nc; - - dm.rd = fp_direction; /* Rounding direction. */ - dm.df = floating_form; /* E format. */ - dm.ndigits = ndigits; /* Number of significant digits. */ - quadruple_to_decimal(arg, &dm, &dr, &ef); - *sign = dr.sign; - switch (dr.fpclass) { - case fp_normal: - case fp_subnormal: - *decpt = dr.exponent + ndigits; - for (i = 0; i < ndigits; i++) - buf[i] = dr.ds[i]; - buf[ndigits] = 0; - break; - case fp_zero: - *decpt = 1; - for (i = 0; i < ndigits; i++) - buf[i] = '0'; - buf[ndigits] = 0; - break; - case fp_infinity: - *decpt = 0; - pc = infstring; - if (ndigits < 8) - nc = 3; - else - nc = 8; - goto movestring; - case fp_quiet: - case fp_signaling: - *decpt = 0; - pc = nanstring; - nc = 3; -movestring: - for (i = 0; i < nc; i++) - buf[i] = pc[i]; - buf[nc] = 0; - break; - } - return buf; /* For compatibility with ecvt. */ -} - -char * -qfconvert(arg, ndigits, decpt, sign, buf) - quadruple *arg; - int ndigits, *decpt, *sign; - char *buf; -{ - decimal_mode dm; - decimal_record dr; - fp_exception_field_type ef; - int i; - - dm.rd = fp_direction; /* Rounding direction. */ - dm.df = fixed_form; /* F format. */ - dm.ndigits = ndigits; /* Number of digits after point. */ - quadruple_to_decimal(arg, &dm, &dr, &ef); - *sign = dr.sign; - switch (dr.fpclass) { - case fp_normal: - case fp_subnormal: - if (ndigits >= 0) - *decpt = dr.ndigits - ndigits; - else - *decpt = dr.ndigits; - for (i = 0; i < dr.ndigits; i++) - buf[i] = dr.ds[i]; - buf[dr.ndigits] = 0; - break; - case fp_zero: - *decpt = 0; - buf[0] = '0'; - for (i = 1; i < ndigits; i++) - buf[i] = '0'; - buf[i] = 0; - break; - case fp_infinity: - *decpt = 0; - if (ndigits < 8) - buf = "Inf"; - else - buf = "Infinity"; - break; - case fp_quiet: - case fp_signaling: - *decpt = 0; - buf = "NaN"; - break; - } - return buf; /* For compatibility with fcvt. */ -} - -extern void _gcvt(); - -char * -qgconvert(number, ndigit, trailing, buf) - quadruple *number; - int ndigit, trailing; - char *buf; -{ - decimal_mode dm; - decimal_record dr; - fp_exception_field_type fef; - - dm.rd = fp_direction; - dm.df = floating_form; - dm.ndigits = ndigit; - quadruple_to_decimal(number, &dm, &dr, &fef); - _gcvt(ndigit, &dr, trailing, buf); - return (buf); -} diff --git a/usr/src/lib/libbc/libc/gen/common/qsort.c b/usr/src/lib/libbc/libc/gen/common/qsort.c deleted file mode 100644 index ecb276f301..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/qsort.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * qsort.c: - * Our own version of the system qsort routine which is faster by an average - * of 25%, with lows and highs of 10% and 50%. - * The THRESHold below is the insertion sort threshold, and has been adjusted - * for records of size 48 bytes. - * The MTHREShold is where we stop finding a better median. - */ - -#define THRESH 4 /* threshold for insertion */ -#define MTHRESH 6 /* threshold for median */ - -static int (*qcmp)(); /* the comparison routine */ -static int qsz; /* size of each record */ -static int thresh; /* THRESHold in chars */ -static int mthresh; /* MTHRESHold in chars */ - -static void qst(char *, char *); - -/* - * qsort: - * First, set up some global parameters for qst to share. Then, quicksort - * with qst(), and then a cleanup insertion sort ourselves. Sound simple? - * It's not... - */ - -void -qsort(char *base, int n, int size, int (*compar)()) -{ - char c, *i, *j, *lo, *hi; - char *min, *max; - - if (n <= 1) - return; - qsz = size; - qcmp = compar; - thresh = qsz * THRESH; - mthresh = qsz * MTHRESH; - max = base + n * qsz; - if (n >= THRESH) { - qst(base, max); - hi = base + thresh; - } else { - hi = max; - } - /* - * First put smallest element, which must be in the first THRESH, in - * the first position as a sentinel. This is done just by searching - * the first THRESH elements (or the first n if n < THRESH), finding - * the min, and swapping it into the first position. - */ - for (j = lo = base; (lo += qsz) < hi; ) - if (qcmp(j, lo) > 0) - j = lo; - if (j != base) { - /* swap j into place */ - for (i = base, hi = base + qsz; i < hi; ) { - c = *j; - *j++ = *i; - *i++ = c; - } - } - /* - * With our sentinel in place, we now run the following hyper-fast - * insertion sort. For each remaining element, min, from [1] to [n-1], - * set hi to the index of the element AFTER which this one goes. - * Then, do the standard insertion sort shift on a character at a time - * basis for each element in the frob. - */ - for (min = base; (hi = min += qsz) < max; ) { - while (qcmp(hi -= qsz, min) > 0) - /* void */; - if ((hi += qsz) != min) { - for (lo = min + qsz; --lo >= min; ) { - c = *lo; - for (i = j = lo; (j -= qsz) >= hi; i = j) - *i = *j; - *i = c; - } - } - } -} - -/* - * qst: - * Do a quicksort - * First, find the median element, and put that one in the first place as the - * discriminator. (This "median" is just the median of the first, last and - * middle elements). (Using this median instead of the first element is a big - * win). Then, the usual partitioning/swapping, followed by moving the - * discriminator into the right place. Then, figure out the sizes of the two - * partions, do the smaller one recursively and the larger one via a repeat of - * this code. Stopping when there are less than THRESH elements in a partition - * and cleaning up with an insertion sort (in our caller) is a huge win. - * All data swaps are done in-line, which is space-losing but time-saving. - * (And there are only three places where this is done). - */ - -static void -qst(char *base, char *max) -{ - char c, *i, *j, *jj; - int ii; - char *mid, *tmp; - int lo, hi; - - /* - * At the top here, lo is the number of characters of elements in the - * current partition. (Which should be max - base). - * Find the median of the first, last, and middle element and make - * that the middle element. Set j to largest of first and middle. - * If max is larger than that guy, then it's that guy, else compare - * max with loser of first and take larger. Things are set up to - * prefer the middle, then the first in case of ties. - */ - lo = max - base; /* number of elements as chars */ - do { - mid = i = base + qsz * ((lo / qsz) >> 1); - if (lo >= mthresh) { - j = (qcmp((jj = base), i) > 0 ? jj : i); - if (qcmp(j, (tmp = max - qsz)) > 0) { - /* switch to first loser */ - j = (j == jj ? i : jj); - if (qcmp(j, tmp) < 0) - j = tmp; - } - if (j != i) { - ii = qsz; - do { - c = *i; - *i++ = *j; - *j++ = c; - } while (--ii); - } - } - /* - * Semi-standard quicksort partitioning/swapping - */ - for (i = base, j = max - qsz; ; ) { - while (i < mid && qcmp(i, mid) <= 0) - i += qsz; - while (j > mid) { - if (qcmp(mid, j) <= 0) { - j -= qsz; - continue; - } - tmp = i + qsz; /* value of i after swap */ - if (i == mid) { - /* j <-> mid, new mid is j */ - mid = jj = j; - } else { - /* i <-> j */ - jj = j; - j -= qsz; - } - goto swap; - } - if (i == mid) { - break; - } else { - /* i <-> mid, new mid is i */ - jj = mid; - tmp = mid = i; /* value of i after swap */ - j -= qsz; - } - swap: - ii = qsz; - do { - c = *i; - *i++ = *jj; - *jj++ = c; - } while (--ii); - i = tmp; - } - /* - * Look at sizes of the two partitions, do the smaller - * one first by recursion, then do the larger one by - * making sure lo is its size, base and max are update - * correctly, and branching back. But only repeat - * (recursively or by branching) if the partition is - * of at least size THRESH. - */ - i = (j = mid) + qsz; - if ((lo = j - base) <= (hi = max - i)) { - if (lo >= thresh) - qst(base, j); - base = i; - lo = hi; - } else { - if (hi >= thresh) - qst(i, max); - max = j; - } - } while (lo >= thresh); -} diff --git a/usr/src/lib/libbc/libc/gen/common/random.c b/usr/src/lib/libbc/libc/gen/common/random.c deleted file mode 100644 index 1fdee713fe..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/random.c +++ /dev/null @@ -1,384 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1999 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <stdlib.h> - -/* - * random.c: - * An improved random number generation package. In addition to the standard - * rand()/srand() like interface, this package also has a special state info - * interface. The initstate() routine is called with a seed, an array of - * bytes, and a count of how many bytes are being passed in; this array is then - * initialized to contain information for random number generation with that - * much state information. Good sizes for the amount of state information are - * 32, 64, 128, and 256 bytes. The state can be switched by calling the - * setstate() routine with the same array as was initiallized with initstate(). - * By default, the package runs with 128 bytes of state information and - * generates far better random numbers than a linear congruential generator. - * If the amount of state information is less than 32 bytes, a simple linear - * congruential R.N.G. is used. - * Internally, the state information is treated as an array of longs; the - * zeroeth element of the array is the type of R.N.G. being used (small - * integer); the remainder of the array is the state information for the - * R.N.G. Thus, 32 bytes of state information will give 7 longs worth of - * state information, which will allow a degree seven polynomial. (Note: the - * zeroeth word of state information also has some other information stored - * in it -- see setstate() for details). - * The random number generation technique is a linear feedback shift register - * approach, employing trinomials (since there are fewer terms to sum up that - * way). In this approach, the least significant bit of all the numbers in - * the state table will act as a linear feedback shift register, and will have - * period 2^deg - 1 (where deg is the degree of the polynomial being used, - * assuming that the polynomial is irreducible and primitive). The higher - * order bits will have longer periods, since their values are also influenced - * by pseudo-random carries out of the lower bits. The total period of the - * generator is approximately deg*(2**deg - 1); thus doubling the amount of - * state information has a vast influence on the period of the generator. - * Note: the deg*(2**deg - 1) is an approximation only good for large deg, - * when the period of the shift register is the dominant factor. With deg - * equal to seven, the period is actually much longer than the 7*(2**7 - 1) - * predicted by this formula. - */ - - - -/* - * For each of the currently supported random number generators, we have a - * break value on the amount of state information (you need at least this - * many bytes of state info to support this random number generator), a degree - * for the polynomial (actually a trinomial) that the R.N.G. is based on, and - * the separation between the two lower order coefficients of the trinomial. - */ - -#define TYPE_0 0 /* linear congruential */ -#define BREAK_0 8 -#define DEG_0 0 -#define SEP_0 0 - -#define TYPE_1 1 /* x**7 + x**3 + 1 */ -#define BREAK_1 32 -#define DEG_1 7 -#define SEP_1 3 - -#define TYPE_2 2 /* x**15 + x + 1 */ -#define BREAK_2 64 -#define DEG_2 15 -#define SEP_2 1 - -#define TYPE_3 3 /* x**31 + x**3 + 1 */ -#define BREAK_3 128 -#define DEG_3 31 -#define SEP_3 3 - -#define TYPE_4 4 /* x**63 + x + 1 */ -#define BREAK_4 256 -#define DEG_4 63 -#define SEP_4 1 - - -/* - * Array versions of the above information to make code run faster -- relies - * on fact that TYPE_i == i. - */ - -#define MAX_TYPES 5 /* max number of types above */ - -static struct _randomjunk { - int degrees[MAX_TYPES]; - int seps[MAX_TYPES]; - long randtbl[ DEG_3 + 1 ]; -/* - * fptr and rptr are two pointers into the state info, a front and a rear - * pointer. These two pointers are always rand_sep places aparts, as they cycle - * cyclically through the state information. (Yes, this does mean we could get - * away with just one pointer, but the code for random() is more efficient this - * way). The pointers are left positioned as they would be from the call - * initstate(1, randtbl, 128) - * (The position of the rear pointer, rptr, is really 0 (as explained above - * in the initialization of randtbl) because the state table pointer is set - * to point to randtbl[1] (as explained below). - */ - long *fptr, *rptr; -/* - * The following things are the pointer to the state information table, - * the type of the current generator, the degree of the current polynomial - * being used, and the separation between the two pointers. - * Note that for efficiency of random(), we remember the first location of - * the state information, not the zeroeth. Hence it is valid to access - * state[-1], which is used to store the type of the R.N.G. - * Also, we remember the last location, since this is more efficient than - * indexing every time to find the address of the last element to see if - * the front and rear pointers have wrapped. - */ - long *state; - int rand_type, rand_deg, rand_sep; - long *end_ptr; -} *__randomjunk, *_randomjunk(void), _randominit = { - /* - * Initially, everything is set up as if from : - * initstate(1, &randtbl, 128); - * Note that this initialization takes advantage of the fact - * that srandom() advances the front and rear pointers 10*rand_deg - * times, and hence the rear pointer which starts at 0 will also - * end up at zero; thus the zeroeth element of the state - * information, which contains info about the current - * position of the rear pointer is just - * MAX_TYPES*(rptr - state) + TYPE_3 == TYPE_3. - */ - { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 }, - { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 }, - { TYPE_3, - (long)0x9a319039, (long)0x32d9c024, (long)0x9b663182, (long)0x5da1f342, - (long)0xde3b81e0, (long)0xdf0a6fb5, (long)0xf103bc02, (long)0x48f340fb, - (long)0x7449e56b, (long)0xbeb1dbb0, (long)0xab5c5918, (long)0x946554fd, - (long)0x8c2e680f, (long)0xeb3d799f, (long)0xb11ee0b7, (long)0x2d436b86, - (long)0xda672e2a, (long)0x1588ca88, (long)0xe369735d, (long)0x904f35f7, - (long)0xd7158fd6, (long)0x6fa6f051, (long)0x616e6b96, (long)0xac94efdc, - (long)0x36413f93, (long)0xc622c298, (long)0xf5a42ab8, (long)0x8a88d77b, - (long)0xf5ad9d0e, (long)0x8999220b, (long)0x27fb47b9 }, - &_randominit.randtbl[ SEP_3 + 1 ], - &_randominit.randtbl[1], - &_randominit.randtbl[1], - TYPE_3, DEG_3, SEP_3, - &_randominit.randtbl[ DEG_3 + 1] -}; - -long random(void); - -static struct _randomjunk * -_randomjunk(void) -{ - struct _randomjunk *rp = __randomjunk; - - if (rp == 0) { - rp = (struct _randomjunk *)malloc(sizeof (*rp)); - if (rp == 0) - return (0); - *rp = _randominit; - __randomjunk = rp; - } - return (rp); -} - -/* - * srandom: - * Initialize the random number generator based on the given seed. If the - * type is the trivial no-state-information type, just remember the seed. - * Otherwise, initializes state[] based on the given "seed" via a linear - * congruential generator. Then, the pointers are set to known locations - * that are exactly rand_sep places apart. Lastly, it cycles the state - * information a given number of times to get rid of any initial dependencies - * introduced by the L.C.R.N.G. - * Note that the initialization of randtbl[] for default usage relies on - * values produced by this routine. - */ - -void -srandom(unsigned x) -{ - struct _randomjunk *rp = _randomjunk(); - int i; - - if (rp == 0) - return; - if (rp->rand_type == TYPE_0) { - rp->state[0] = x; - } else { - rp->state[0] = x; - for (i = 1; i < rp->rand_deg; i++) { - rp->state[i] = 1103515245*rp->state[i - 1] + 12345; - } - rp->fptr = &rp->state[rp->rand_sep]; - rp->rptr = &rp->state[0]; - for (i = 0; i < 10 * rp->rand_deg; i++) - random(); - } -} - - - -/* - * initstate: - * Initialize the state information in the given array of n bytes for - * future random number generation. Based on the number of bytes we - * are given, and the break values for the different R.N.G.'s, we choose - * the best (largest) one we can and set things up for it. srandom() is - * then called to initialize the state information. - * Note that on return from srandom(), we set state[-1] to be the type - * multiplexed with the current value of the rear pointer; this is so - * successive calls to initstate() won't lose this information and will - * be able to restart with setstate(). - * Note: the first thing we do is save the current state, if any, just like - * setstate() so that it doesn't matter when initstate is called. - * Returns a pointer to the old state. - * - * Arguments: - * seed: seed for R. N. G. - * arg_state: pointer to state array - * n: # bytes of state info - */ - -char * -initstate(unsigned seed, char *arg_state, int n) -{ - struct _randomjunk *rp = _randomjunk(); - char *ostate; - - if (rp == 0) - return (0); - ostate = (char *)(&rp->state[-1]); - - if (rp->rand_type == TYPE_0) rp->state[-1] = rp->rand_type; - else rp->state[-1] = - MAX_TYPES*(rp->rptr - rp->state) + rp->rand_type; - if (n < BREAK_0) { - fprintf(stderr, - "initstate: state array too small, ignored; minimum size is %d bytes\n", - BREAK_0); - return (0); - } else if (n < BREAK_1) { - rp->rand_type = TYPE_0; - rp->rand_deg = DEG_0; - rp->rand_sep = SEP_0; - } else if (n < BREAK_2) { - rp->rand_type = TYPE_1; - rp->rand_deg = DEG_1; - rp->rand_sep = SEP_1; - } else if (n < BREAK_3) { - rp->rand_type = TYPE_2; - rp->rand_deg = DEG_2; - rp->rand_sep = SEP_2; - } else if (n < BREAK_4) { - rp->rand_type = TYPE_3; - rp->rand_deg = DEG_3; - rp->rand_sep = SEP_3; - } else { - rp->rand_type = TYPE_4; - rp->rand_deg = DEG_4; - rp->rand_sep = SEP_4; - } - rp->state = &((long *)arg_state)[1]; /* first location */ - rp->end_ptr = &rp->state[rp->rand_deg]; /* set end_ptr before srandom */ - srandom(seed); - rp->state[-1] = (rp->rand_type == TYPE_0) ? rp->rand_type - : MAX_TYPES * (rp->rptr - rp->state) + rp->rand_type; - return (ostate); -} - - -/* - * setstate: - * Restore the state from the given state array. - * Note: it is important that we also remember the locations of the pointers - * in the current state information, and restore the locations of the pointers - * from the old state information. This is done by multiplexing the pointer - * location into the zeroeth word of the state information. - * Note that due to the order in which things are done, it is OK to call - * setstate() with the same state as the current state. - * Returns a pointer to the old state information. - */ - -char * -setstate(char *arg_state) -{ - struct _randomjunk *rp = _randomjunk(); - long *new_state; - int type; - int rear; - char *ostate; - - if (rp == 0) - return (0); - new_state = (long *)arg_state; - type = new_state[0] % MAX_TYPES; - rear = new_state[0] / MAX_TYPES; - ostate = (char *)(&rp->state[-1]); - - rp->state[-1] = (rp->rand_type == TYPE_0) ? rp->rand_type - : MAX_TYPES*(rp->rptr - rp->state) + rp->rand_type; - switch (type) { - case TYPE_0: - case TYPE_1: - case TYPE_2: - case TYPE_3: - case TYPE_4: - rp->rand_type = type; - rp->rand_deg = rp->degrees[type]; - rp->rand_sep = rp->seps[type]; - break; - - default: - fprintf(stderr, "setstate: invalid state info; not changed.\n"); - } - rp->state = &new_state[1]; - if (rp->rand_type != TYPE_0) { - rp->rptr = &rp->state[rear]; - rp->fptr = &rp->state[(rear + rp->rand_sep) % rp->rand_deg]; - } - rp->end_ptr = &rp->state[rp->rand_deg]; /* set end_ptr too */ - return (ostate); -} - - -/* - * random: - * If we are using the trivial TYPE_0 R.N.G., just do the old linear - * congruential bit. Otherwise, we do our fancy trinomial stuff, which is the - * same in all ther other cases due to all the global variables that have been - * set up. The basic operation is to add the number at the rear pointer into - * the one at the front pointer. Then both pointers are advanced to the next - * location cyclically in the table. The value returned is the sum generated, - * reduced to 31 bits by throwing away the "least random" low bit. - * Note: the code takes advantage of the fact that both the front and - * rear pointers can't wrap on the same call by not testing the rear - * pointer if the front one has wrapped. - * Returns a 31-bit random number. - */ - -long -random(void) -{ - struct _randomjunk *rp = _randomjunk(); - long i; - - if (rp == 0) - return (0); - if (rp->rand_type == TYPE_0) { - i = rp->state[0] = (rp->state[0]*1103515245 + 12345)&0x7fffffff; - } else { - *rp->fptr += *rp->rptr; - i = (*rp->fptr >> 1)&0x7fffffff; /* chucking least random bit */ - if (++rp->fptr >= rp->end_ptr) { - rp->fptr = rp->state; - ++rp->rptr; - } else if (++rp->rptr >= rp->end_ptr) - rp->rptr = rp->state; - } - return (i); -} diff --git a/usr/src/lib/libbc/libc/gen/common/readdir.c b/usr/src/lib/libbc/libc/gen/common/readdir.c deleted file mode 100644 index c4f2c65652..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/readdir.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/param.h> -#include <dirent.h> - -/* - * get next entry in a directory. - */ -struct dirent * -readdir(dirp) - register DIR *dirp; -{ - register struct dirent *dp; - int saveloc = 0; - -next: - if (dirp->dd_size != 0) { - dp = (struct dirent *)&dirp->dd_buf[dirp->dd_loc]; - saveloc = dirp->dd_loc; /* save for possible EOF */ - dirp->dd_loc += dp->d_reclen; - } - if (dirp->dd_loc >= dirp->dd_size) - dirp->dd_loc = dirp->dd_size = 0; - - if (dirp->dd_size == 0 /* refill buffer */ - && (dirp->dd_size = getdents(dirp->dd_fd, dirp->dd_buf, dirp->dd_bsize) - ) <= 0 - ) { - if (dirp->dd_size == 0) /* This means EOF */ - dirp->dd_loc = saveloc; /* EOF so save for telldir */ - return (NULL); /* error or EOF */ - } - - dp = (struct dirent *)&dirp->dd_buf[dirp->dd_loc]; - if (dp->d_reclen <= 0) - return (NULL); - if (dp->d_fileno == 0) - goto next; - dirp->dd_off = dp->d_off; - return(dp); -} diff --git a/usr/src/lib/libbc/libc/gen/common/realpath.c b/usr/src/lib/libbc/libc/gen/common/realpath.c deleted file mode 100644 index 2fa7c5333a..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/realpath.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1987 by Sun Microsystems, Inc. - */ - -#include <strings.h> -#include <sys/param.h> -#include <errno.h> - -extern char *getwd(); - -/* LINTLIBRARY */ - -/* - * Input name in raw, canonicalized pathname output to canon. If dosymlinks - * is nonzero, resolves all symbolic links encountered during canonicalization - * into an equivalent symlink-free form. Returns 0 on success, -1 on failure. - * The routine fails if the current working directory can't be obtained or if - * either of the arguments is NULL. - * - * Sets errno on failure. - */ -int -pathcanon(raw, canon, dosymlinks) - char *raw, - *canon; - int dosymlinks; -{ - register char *s, - *d; - register char *limit = canon + MAXPATHLEN; - char *modcanon; - int nlink = 0; - - /* - * Do a bit of sanity checking. - */ - if (raw == NULL || canon == NULL) { - errno = EINVAL; - return (-1); - } - - /* - * If the path in raw is not already absolute, convert it to that form. - * In any case, initialize canon with the absolute form of raw. Make - * sure that none of the operations overflow the corresponding buffers. - * The code below does the copy operations by hand so that it can easily - * keep track of whether overflow is about to occur. - */ - s = raw; - d = canon; - if (*s != '/') { - /* Relative; prepend the working directory. */ - if (getwd(d) == NULL) { - /* Use whatever errno value getwd may have left around. */ - return (-1); - } - d += strlen(d); - /* Add slash to separate working directory from relative part. */ - if (d < limit) - *d++ = '/'; - modcanon = d; - } else - modcanon = canon; - while (d < limit && *s) - *d++ = *s++; - - /* Add a trailing slash to simplify the code below. */ - s = "/"; - while (d < limit && (*d++ = *s++)) - continue; - - - /* - * Canonicalize the path. The strategy is to update in place, with - * d pointing to the end of the canonicalized portion and s to the - * current spot from which we're copying. This works because - * canonicalization doesn't increase path length, except as discussed - * below. Note also that the path has had a slash added at its end. - * This greatly simplifies the treatment of boundary conditions. - */ - d = s = modcanon; - while (d < limit && *s) { - if ((*d++ = *s++) == '/' && d > canon + 1) { - register char *t = d - 2; - - switch (*t) { - case '/': - /* Found // in the name. */ - d--; - continue; - case '.': - switch (*--t) { - case '/': - /* Found /./ in the name. */ - d -= 2; - continue; - case '.': - if (*--t == '/') { - /* Found /../ in the name. */ - while (t > canon && *--t != '/') - continue; - d = t + 1; - } - continue; - default: - break; - } - break; - default: - break; - } - /* - * We're at the end of a component. If dosymlinks is set - * see whether the component is a symbolic link. If so, - * replace it by its contents. - */ - if (dosymlinks) { - char link[MAXPATHLEN + 1]; - register int llen; - - /* - * See whether it's a symlink by trying to read it. - * - * Start by isolating it. - */ - *(d - 1) = '\0'; - if ((llen = readlink(canon, link, sizeof link)) >= 0) { - /* Make sure that there are no circular links. */ - nlink++; - if (nlink > MAXSYMLINKS) { - errno = ELOOP; - return (-1); - } - /* - * The component is a symlink. Since its value can be - * of arbitrary size, we can't continue copying in place. - * Instead, form the new path suffix in the link buffer - * and then copy it back to its proper spot in canon. - */ - t = link + llen; - *t++ = '/'; - /* - * Copy the remaining unresolved portion to the end - * of the symlink. If the sum of the unresolved part and - * the readlink exceeds MAXPATHLEN, the extra bytes - * will be dropped off. Too bad! - */ - (void) strncpy(t, s, sizeof link - llen - 1); - link[sizeof link - 1] = '\0'; - /* - * If the link's contents are absolute, copy it back - * to the start of canon, otherwise to the beginning of - * the link's position in the path. - */ - if (link[0] == '/') { - /* Absolute. */ - (void) strcpy(canon, link); - d = s = canon; - } - else { - /* - * Relative: find beginning of component and copy. - */ - --d; - while (d > canon && *--d != '/') - continue; - s = ++d; - /* - * If the sum of the resolved part, the readlink - * and the remaining unresolved part exceeds - * MAXPATHLEN, the extra bytes will be dropped off. - */ - if (strlen(link) >= (limit - s)) { - (void) strncpy(s, link, limit - s); - *(limit - 1) = '\0'; - } else { - (void) strcpy(s, link); - } - } - continue; - } else { - /* - * readlink call failed. It can be because it was - * not a link (i.e. a file, dir etc.) or because the - * the call actually failed. - */ - if (errno != EINVAL) - return (-1); - *(d - 1) = '/'; /* Restore it */ - } - } /* if (dosymlinks) */ - } - } /* while */ - - /* Remove the trailing slash that was added above. */ - if (*(d - 1) == '/' && d > canon + 1) - d--; - *d = '\0'; - return (0); -} - -/* - * Canonicalize the path given in raw, resolving away all symbolic link - * components. Store the result into the buffer named by canon, which - * must be long enough (MAXPATHLEN bytes will suffice). Returns NULL - * on failure and canon on success. - * - * The routine indirectly invokes the readlink() system call and getwd() - * so it inherits the possibility of hanging due to inaccessible file - * system resources. - */ -char * -realpath(raw, canon) - char *raw; - char *canon; -{ - return (pathcanon(raw, canon, 1) < 0 ? NULL : canon); -} diff --git a/usr/src/lib/libbc/libc/gen/common/regex.c b/usr/src/lib/libbc/libc/gen/common/regex.c deleted file mode 100644 index e6bd73361a..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/regex.c +++ /dev/null @@ -1,437 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * routines to do regular expression matching - * - * Entry points: - * - * re_comp(s) - * char *s; - * ... returns 0 if the string s was compiled successfully, - * a pointer to an error message otherwise. - * If passed 0 or a null string returns without changing - * the currently compiled re (see note 11 below). - * - * re_exec(s) - * char *s; - * ... returns 1 if the string s matches the last compiled regular - * expression, - * 0 if the string s failed to match the last compiled - * regular expression, and - * -1 if the compiled regular expression was invalid - * (indicating an internal error). - * - * The strings passed to both re_comp and re_exec may have trailing or - * embedded newline characters; they are terminated by nulls. - * - * The identity of the author of these routines is lost in antiquity; - * this is essentially the same as the re code in the original V6 ed. - * - * The regular expressions recognized are described below. This description - * is essentially the same as that for ed. - * - * A regular expression specifies a set of strings of characters. - * A member of this set of strings is said to be matched by - * the regular expression. In the following specification for - * regular expressions the word `character' means any character but NUL. - * - * 1. Any character except a special character matches itself. - * Special characters are the regular expression delimiter plus - * \ [ . and sometimes ^ * $. - * 2. A . matches any character. - * 3. A \ followed by any character except a digit or ( ) - * matches that character. - * 4. A nonempty string s bracketed [s] (or [^s]) matches any - * character in (or not in) s. In s, \ has no special meaning, - * and ] may only appear as the first letter. A substring - * a-b, with a and b in ascending ASCII order, stands for - * the inclusive range of ASCII characters. - * 5. A regular expression of form 1-4 followed by * matches a - * sequence of 0 or more matches of the regular expression. - * 6. A regular expression, x, of form 1-8, bracketed \(x\) - * matches what x matches. - * 7. A \ followed by a digit n matches a copy of the string that the - * bracketed regular expression beginning with the nth \( matched. - * 8. A regular expression of form 1-8, x, followed by a regular - * expression of form 1-7, y matches a match for x followed by - * a match for y, with the x match being as long as possible - * while still permitting a y match. - * 9. A regular expression of form 1-8 preceded by ^ (or followed - * by $), is constrained to matches that begin at the left - * (or end at the right) end of a line. - * 10. A regular expression of form 1-9 picks out the longest among - * the leftmost matches in a line. - * 11. An empty regular expression stands for a copy of the last - * regular expression encountered. - */ - -/* - * constants for re's - */ -#define CBRA 1 -#define CCHR 2 -#define CDOT 4 -#define CCL 6 -#define NCCL 8 -#define CDOL 10 -#define CEOF 11 -#define CKET 12 -#define CBACK 18 - -#define CSTAR 01 - -#define ESIZE 512 -#define NBRA 9 - -static struct re_globals { - char _expbuf[ESIZE]; - char *_braslist[NBRA], *_braelist[NBRA]; - char _circf; -} *re_globals; -#define expbuf (_re->_expbuf) -#define braslist (_re->_braslist) -#define braelist (_re->_braelist) -#define circf (_re->_circf) - -static int advance(char *, char *); -static int backref(int, char *); -static int cclass(char *, char, int); - -/* - * compile the regular expression argument into a dfa - */ -char * -re_comp(char *sp) -{ - int c; - struct re_globals *_re = re_globals; - char *ep; - int cclcnt, numbra = 0; - char *lastep = 0; - char bracket[NBRA]; - char *bracketp = &bracket[0]; - char *retoolong = "Regular expression too long"; - - if (_re == 0) { - _re = (struct re_globals *)calloc(1, sizeof (*_re)); - if (_re == 0) - return ("Out of memory"); - re_globals = _re; - } - ep = expbuf; - -#define comerr(msg) {expbuf[0] = 0; numbra = 0; return(msg); } - - if (sp == 0 || *sp == '\0') { - if (*ep == 0) - return("No previous regular expression"); - return (0); - } - if (*sp == '^') { - circf = 1; - sp++; - } - else - circf = 0; - for (;;) { - if (ep >= &expbuf[ESIZE]) - comerr(retoolong); - if ((c = *sp++) == '\0') { - if (bracketp != bracket) - comerr("unmatched \\("); - *ep++ = CEOF; - *ep++ = 0; - return (0); - } - if (c != '*') - lastep = ep; - switch (c) { - - case '.': - *ep++ = CDOT; - continue; - - case '*': - if (lastep == 0 || *lastep == CBRA || *lastep == CKET) - goto defchar; - *lastep |= CSTAR; - continue; - - case '$': - if (*sp != '\0') - goto defchar; - *ep++ = CDOL; - continue; - - case '[': - *ep++ = CCL; - *ep++ = 0; - cclcnt = 1; - if ((c = *sp++) == '^') { - c = *sp++; - ep[-2] = NCCL; - } - do { - if (c == '\0') - comerr("missing ]"); - if (c == '-' && ep [-1] != 0) { - if ((c = *sp++) == ']') { - *ep++ = '-'; - cclcnt++; - break; - } - while (ep[-1] < c) { - *ep = ep[-1] + 1; - ep++; - cclcnt++; - if (ep >= &expbuf[ESIZE]) - comerr(retoolong); - } - } - *ep++ = c; - cclcnt++; - if (ep >= &expbuf[ESIZE]) - comerr(retoolong); - } while ((c = *sp++) != ']'); - lastep[1] = cclcnt; - continue; - - case '\\': - if ((c = *sp++) == '(') { - if (numbra >= NBRA) - comerr("too many \\(\\) pairs"); - *bracketp++ = numbra; - *ep++ = CBRA; - *ep++ = numbra++; - continue; - } - if (c == ')') { - if (bracketp <= bracket) - comerr("unmatched \\)"); - *ep++ = CKET; - *ep++ = *--bracketp; - continue; - } - if (c >= '1' && c < ('1' + NBRA)) { - *ep++ = CBACK; - *ep++ = c - '1'; - continue; - } - *ep++ = CCHR; - *ep++ = c; - continue; - - defchar: - default: - *ep++ = CCHR; - *ep++ = c; - } - } -} - -/* - * match the argument string against the compiled re - */ -int -re_exec(char *p1) -{ - struct re_globals *_re = re_globals; - char *p2; - int c; - int rv; - - if (_re == 0) - return (0); - p2 = expbuf; - for (c = 0; c < NBRA; c++) { - braslist[c] = 0; - braelist[c] = 0; - } - if (circf) - return((advance(p1, p2))); - /* - * fast check for first character - */ - if (*p2 == CCHR) { - c = p2[1]; - do { - if (*p1 != c) - continue; - if (rv = advance(p1, p2)) - return(rv); - } while (*p1++); - return(0); - } - /* - * regular algorithm - */ - do - if (rv = advance(p1, p2)) - return(rv); - while (*p1++); - return(0); -} - -/* - * try to match the next thing in the dfa - */ -static int -advance(char *lp, char *ep) -{ - char *curlp; - int ct, i; - int rv; - struct re_globals *_re = re_globals; - - for (;;) - switch (*ep++) { - - case CCHR: - if (*ep++ == *lp++) - continue; - return(0); - - case CDOT: - if (*lp++) - continue; - return(0); - - case CDOL: - if (*lp == '\0') - continue; - return(0); - - case CEOF: - return(1); - - case CCL: - if (cclass(ep, *lp++, 1)) { - ep += *ep; - continue; - } - return(0); - - case NCCL: - if (cclass(ep, *lp++, 0)) { - ep += *ep; - continue; - } - return(0); - - case CBRA: - braslist[*ep++] = lp; - continue; - - case CKET: - braelist[*ep++] = lp; - continue; - - case CBACK: - if (braelist[i = *ep++] == 0) - return(-1); - if (backref(i, lp)) { - lp += braelist[i] - braslist[i]; - continue; - } - return(0); - - case CBACK|CSTAR: - if (braelist[i = *ep++] == 0) - return(-1); - curlp = lp; - ct = braelist[i] - braslist[i]; - while (backref(i, lp)) - lp += ct; - while (lp >= curlp) { - if (rv = advance(lp, ep)) - return(rv); - lp -= ct; - } - continue; - - case CDOT|CSTAR: - curlp = lp; - while (*lp++) - ; - goto star; - - case CCHR|CSTAR: - curlp = lp; - while (*lp++ == *ep) - ; - ep++; - goto star; - - case CCL|CSTAR: - case NCCL|CSTAR: - curlp = lp; - while (cclass(ep, *lp++, ep[-1] == (CCL|CSTAR))) - ; - ep += *ep; - goto star; - - star: - do { - lp--; - if (rv = advance(lp, ep)) - return(rv); - } while (lp > curlp); - return(0); - - default: - return(-1); - } -} - -static int -backref(int i, char *lp) -{ - char *bp; - struct re_globals *_re = re_globals; - - bp = braslist[i]; - while (*bp++ == *lp++) - if (bp >= braelist[i]) - return (1); - return (0); -} - -static int -cclass(char *set, char c, int af) -{ - int n; - - if (c == 0) - return(0); - n = *set++; - while (--n) - if (*set++ == c) - return (af); - return (!af); -} diff --git a/usr/src/lib/libbc/libc/gen/common/rindex.c b/usr/src/lib/libbc/libc/gen/common/rindex.c deleted file mode 100644 index fd442e4b13..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/rindex.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 4.1 80/12/21 */ - -/* - * Return the ptr in sp at which the character c last - * appears; NULL if not found - */ - -#define NULL 0 - -char * -rindex(sp, c) - register char *sp, c; -{ - register char *r; - - r = NULL; - do { - if (*sp == c) - r = sp; - } while (*sp++); - return (r); -} diff --git a/usr/src/lib/libbc/libc/gen/common/scandir.c b/usr/src/lib/libbc/libc/gen/common/scandir.c deleted file mode 100644 index 633354971b..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/scandir.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by the University of California, Berkeley. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Scan the directory dirname calling select to make a list of selected - * directory entries then sort using qsort and compare routine dcomp. - * Returns the number of entries and a pointer to a list of pointers to - * struct direct (through namelist). Returns -1 if there were any errors. - */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/dir.h> - -int -scandir(char *dirname, struct direct *(*namelist[]), - int (*select)(), int (*dcomp)()) -{ - struct direct *d, *p, **names; - int nitems; - char *cp1, *cp2; - struct stat stb; - long arraysz; - DIR *dirp; - - if ((dirp = opendir(dirname)) == NULL) - return (-1); - if (fstat(dirp->dd_fd, &stb) < 0) - return (-1); - - /* - * estimate the array size by taking the size of the directory file - * and dividing it by a multiple of the minimum size entry. - */ - arraysz = (stb.st_size / 24); - names = (struct direct **)malloc(arraysz * sizeof(struct direct *)); - if (names == NULL) - return (-1); - - nitems = 0; - while ((d = readdir(dirp)) != NULL) { - if (select != NULL && !(*select)(d)) - continue; /* just selected names */ - /* - * Make a minimum size copy of the data - */ - p = (struct direct *)malloc(DIRSIZ(d)); - if (p == NULL) - return (-1); - p->d_ino = d->d_ino; - p->d_reclen = d->d_reclen; - p->d_namlen = d->d_namlen; - for (cp1 = p->d_name, cp2 = d->d_name; *cp1++ = *cp2++; ); - /* - * Check to make sure the array has space left and - * realloc the maximum size. - */ - if (++nitems >= arraysz) { - if (fstat(dirp->dd_fd, &stb) < 0) - return (-1); /* just might have grown */ - arraysz = stb.st_size / 12; - names = (struct direct **)realloc((char *)names, - arraysz * sizeof(struct direct *)); - if (names == NULL) - return (-1); - } - names[nitems-1] = p; - } - closedir(dirp); - if (nitems && dcomp != NULL) - qsort(names, nitems, sizeof(struct direct *), dcomp); - *namelist = names; - return (nitems); -} - -/* - * Alphabetic order comparison routine for those who want it. - */ -int -alphasort(struct direct **d1, struct direct **d2) -{ - return (strcmp((*d1)->d_name, (*d2)->d_name)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/seconvert.c b/usr/src/lib/libbc/libc/gen/common/seconvert.c deleted file mode 100644 index 99e86a8656..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/seconvert.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -#include "base_conversion.h" - -char * -seconvert(arg, ndigits, decpt, sign, buf) - single *arg; - int ndigits, *decpt, *sign; - char *buf; -{ - decimal_mode dm; - decimal_record dr; - fp_exception_field_type ef; - int i; - static char *nanstring = "NaN"; - static char *infstring = "Infinity"; - char *pc; - int nc; - - dm.rd = fp_direction; /* Rounding direction. */ - dm.df = floating_form; /* E format. */ - dm.ndigits = ndigits; /* Number of significant digits. */ - single_to_decimal(arg, &dm, &dr, &ef); - *sign = dr.sign; - switch (dr.fpclass) { - case fp_normal: - case fp_subnormal: - *decpt = dr.exponent + ndigits; - for (i = 0; i < ndigits; i++) - buf[i] = dr.ds[i]; - buf[ndigits] = 0; - break; - case fp_zero: - *decpt = 1; - for (i = 0; i < ndigits; i++) - buf[i] = '0'; - buf[ndigits] = 0; - break; - case fp_infinity: - *decpt = 0; - pc = infstring; - if (ndigits < 8) - nc = 3; - else - nc = 8; - goto movestring; - case fp_quiet: - case fp_signaling: - *decpt = 0; - pc = nanstring; - nc = 3; -movestring: - for (i = 0; i < nc; i++) - buf[i] = pc[i]; - buf[nc] = 0; - break; - } - return buf; /* For compatibility with ecvt. */ -} - -char * -sfconvert(arg, ndigits, decpt, sign, buf) - single *arg; - int ndigits, *decpt, *sign; - char *buf; -{ - decimal_mode dm; - decimal_record dr; - fp_exception_field_type ef; - int i; - - dm.rd = fp_direction; /* Rounding direction. */ - dm.df = fixed_form; /* F format. */ - dm.ndigits = ndigits; /* Number of digits after point. */ - single_to_decimal(arg, &dm, &dr, &ef); - *sign = dr.sign; - switch (dr.fpclass) { - case fp_normal: - case fp_subnormal: - if (ndigits >= 0) - *decpt = dr.ndigits - ndigits; - else - *decpt = dr.ndigits; - for (i = 0; i < dr.ndigits; i++) - buf[i] = dr.ds[i]; - buf[dr.ndigits] = 0; - break; - case fp_zero: - *decpt = 0; - buf[0] = '0'; - for (i = 1; i < ndigits; i++) - buf[i] = '0'; - buf[i] = 0; - break; - case fp_infinity: - *decpt = 0; - if (ndigits < 8) - buf = "Inf"; - else - buf = "Infinity"; - break; - case fp_quiet: - case fp_signaling: - *decpt = 0; - buf = "NaN"; - break; - } - return buf; /* For compatibility with fcvt. */ -} - -extern void _gcvt(); - -char * -sgconvert(number, ndigit, trailing, buf) - single *number; - int ndigit, trailing; - char *buf; -{ - decimal_mode dm; - decimal_record dr; - fp_exception_field_type fef; - - dm.rd = fp_direction; - dm.df = floating_form; - dm.ndigits = ndigit; - single_to_decimal(number, &dm, &dr, &fef); - _gcvt(ndigit, &dr, trailing, buf); - return (buf); -} diff --git a/usr/src/lib/libbc/libc/gen/common/seekdir.c b/usr/src/lib/libbc/libc/gen/common/seekdir.c deleted file mode 100644 index 55facc6aa2..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/seekdir.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1992 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/param.h> -#include <dirent.h> - -/* - * seek to an entry in a directory. - * Only values returned by "telldir" should be passed to seekdir. - */ -void -seekdir(dirp, tell) - register DIR *dirp; - register long tell; -{ - extern long lseek(); - long curloc; - - curloc = telldir(dirp); - if (curloc == tell) - return; - dirp->dd_loc = 0; - (void) lseek(dirp->dd_fd, tell, 0); - dirp->dd_size = 0; - dirp->dd_off = tell; -} - -#undef rewinddir - -void -rewinddir(dirp) - DIR *dirp; -{ - seekdir(dirp, 0); -} diff --git a/usr/src/lib/libbc/libc/gen/common/setlocale.c b/usr/src/lib/libbc/libc/gen/common/setlocale.c deleted file mode 100644 index a6b815ea40..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/setlocale.c +++ /dev/null @@ -1,831 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1995 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/fcntl.h> -#include <locale.h> -#include <stdlib.h> -#include "codeset.h" -#include <ctype.h> -#include <string.h> -#include <memory.h> -#include <malloc.h> -#include <sys/param.h> /* for MAXPATHLEN */ -#include <sys/stat.h> -#include <errno.h> -#include <limits.h> - -#define TRAILER ".ci" - - -struct _code_set_info _code_set_info = { - NULL, - CODESET_NONE, /* no codeset */ - NULL, /* not defined */ - 0, -}; - -/* tolower() and toupper() conversion table - * is hidden here to avoid being placed in the - * extern .sa file in the dynamic version of libc - */ - -char _ctype_ul[] = { 0, - -/* 0 1 2 3 4 5 6 7 */ - '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', - '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', - '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', - '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', - ' ', '!', '"', '#', '$', '%', '&', '\'', - '(', ')', '*', '+', ',', '-', '.', '/', - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', ':', ';', '<', '=', '>', '?', - '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', - 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', - 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', - 'x', 'y', 'z', '[', '\\', ']', '^', '_', - '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', - 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', - 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', - 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -}; - -/* following layout is: - * LC_NUMERIC LC_TIME LC_MONETARY LANGINFO LC_COLLATE LC_MESSAGES - */ -char _locales[MAXLOCALE - 1][MAXLOCALENAME + 1] ; - -char _my_time[MAXLOCALENAME + 1]; - -/* The array Default holds the systems notion of default locale. It is normally - * found in {LOCALE}/.default and moved to here. Note there is only one - * default locale spanning all categories - */ - -static char Default[MAXLOCALENAME+1]; - -struct langinfo _langinfo; -struct dtconv *_dtconv = NULL; - -static char *realmonths = NULL; -static char *realdays = NULL; -static char *realfmts = NULL; -static short lang_succ = ON; /* setlocale success */ - - -/* Set the values here to guarantee stdio use of the - decimal point - */ -static struct lconv lconv_arr = { - ".", "", "", "", "", - "", "", "", "", "", - CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX, - CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX -}; - -/* lconv is externally defined by ANSI C */ -struct lconv *lconv = &lconv_arr; - -static char *lconv_numeric_str = NULL; -static char *lconv_monetary_str = NULL; - -int openlocale(char *, int, char *, char *); -int getlocale_ctype(char *, char *, char *); -char *getlocale_numeric(char *, struct lconv *, char *); -void init_statics(void); -static char *getlocale_monetary(char *, struct lconv *, char *); -static char *getstr(char *, char **); -static char *getgrouping(char *, char **); -static char *getnum(char *, char *); -static char *getbool(char *, char *); -static void set_default(void); - -char * -setlocale(int category, char *locale) -{ - static char buf[MAXLOCALE*(MAXLOCALENAME + 1) + 1]; - /* buffer for current LC_ALL value */ - int nonuniform; - short ret; - char my_ctype[CTYPE_SIZE]; /* local copy */ - struct lconv my_lconv; /* local copy */ - char *my_lconv_numeric_str; - char *my_lconv_monetary_str; - int i; - char *p; - - - /* initialize my_lconv to lconv */ - memcpy(&my_lconv, lconv, sizeof(my_lconv)); - - /* - * Following code is to avoid static initialisation of - * strings which would otherwise blow up "xstr". - */ - if (_locales[0][0] == '\0') - init_statics(); - - if (locale == NULL) { - if (category == LC_ALL) { - /* - * Assume all locales are set to the same value. Then - * scan through the locales to see if any are - * different. If they are the same, return the common - * value; otherwise, construct a "composite" value. - */ - nonuniform = 0; /* assume all locales set the same */ - for (i = 0; i < MAXLOCALE - 2; i++) { - if (strcmp(_locales[i], _locales[i + 1]) != 0) { - nonuniform = 1; - break; - } - } - if (nonuniform) { - /* - * They're not all the same. Construct a list - * of all the locale values, in order, - * separated by slashes. Return that value. - */ - (void) strcpy(buf, _locales[0]); - for (i = 1; i < MAXLOCALE - 1; i++) { - (void) strcat(buf, "/"); - (void) strcat(buf, _locales[i]); - } - return (buf); - } else { - /* - * They're all the same; any one you return is - * OK. - */ - return (_locales[0]); - } - } else - return (_locales[category - 1]); - } - - switch (category) { - - case LC_ALL: - if (strchr(locale, '/') != NULL) { - /* - * Composite value; extract each category. - */ - if (strlen(locale) > sizeof buf - 1) - return (NULL); /* too long */ - (void) strcpy(buf, locale); - p = buf; - - /* - * LC_CTYPE and LC_NUMERIC are set here. - * Others locales won't be set here, - * they will be just marked. - */ - for (i = 0; i < MAXLOCALE - 1; i++) { - p = strtok(p, "/"); - if (p == NULL) - return (NULL); /* missing item */ - switch (i) { - - case LC_CTYPE - 1: - if (setlocale(LC_CTYPE,p) == NULL) - return (NULL); - break; - case LC_NUMERIC - 1: - if (setlocale(LC_NUMERIC,p) == NULL) - return (NULL); - break; - case LC_TIME - 1: - if (setlocale(LC_TIME,p) == NULL) - return (NULL); - break; - case LC_MONETARY - 1: - if (setlocale(LC_MONETARY,p) == NULL) - return (NULL); - break; - case LANGINFO - 1: - if (setlocale(LANGINFO,p) == NULL) - return (NULL); - break; - case LC_COLLATE - 1: - if (setlocale(LC_COLLATE,p) == NULL) - return (NULL); - break; - case LC_MESSAGES - 1: - if (setlocale(LC_MESSAGES,p) == NULL) - return (NULL); - break; - } - p = NULL; - } - if (strtok((char *)NULL, "/") != NULL) - return (NULL); /* extra stuff at end */ - } - - /* If category = LC_ALL, Drop through to test each individual - * category, one at a time. Note default rules where env vars - * are not set - */ - - case LC_CTYPE: - if ((ret = getlocale_ctype(locale , my_ctype, - _locales[LC_CTYPE - 1])) < 0) - return (NULL); - if (ret) { - (void) memcpy(_ctype_, my_ctype, CTYPE_SIZE/2); - (void) memcpy(_ctype_ul, my_ctype+(CTYPE_SIZE/2), CTYPE_SIZE/2); - } - if (category != LC_ALL) - break; - - case LC_NUMERIC: - if ((my_lconv_numeric_str = - getlocale_numeric(locale, &my_lconv, - _locales[LC_NUMERIC - 1])) == NULL) - return (NULL); - if (*my_lconv_numeric_str) { - if (lconv_numeric_str != NULL) - free((malloc_t)lconv_numeric_str); - lconv_numeric_str = my_lconv_numeric_str; - memcpy(lconv, my_lconv, sizeof(my_lconv)); - } - if (category != LC_ALL) - break; - - case LC_TIME: - if ((ret = openlocale("LC_TIME", LC_TIME, locale, - _locales[LC_TIME -1])) < 0) - return (NULL); - if (ret) - (void) close(ret); - if (category != LC_ALL) - break; - - case LC_MONETARY: - if ((my_lconv_monetary_str = - getlocale_monetary(locale, &my_lconv, - _locales[LC_MONETARY - 1])) == NULL) - return (NULL); - if (*my_lconv_monetary_str) { - if (lconv_monetary_str != NULL) - free((malloc_t)lconv_monetary_str); - lconv_monetary_str = my_lconv_monetary_str; - memcpy(lconv, &my_lconv, sizeof(my_lconv)); - } - if (category != LC_ALL) - break; - - case LANGINFO: - if ((ret = openlocale("LANGINFO", LANGINFO, locale, - _locales[LANGINFO - 1])) < 0) { - lang_succ = OFF; - return (NULL); - } - if (ret) { - lang_succ = OFF; - (void) close(ret); - } - if (category != LC_ALL) - break; - - case LC_COLLATE: - if ((ret = openlocale("LC_COLLATE", LC_COLLATE, locale, - _locales[LC_COLLATE - 1])) < 0) - return (NULL); - if (ret) { - (void) close(ret); - } - if (category != LC_ALL) - break; - - case LC_MESSAGES: - if ((ret = openlocale("LC_MESSAGES", LC_MESSAGES, locale, - _locales[LC_MESSAGES - 1])) < 0) - return (NULL); - if (ret) { - (void) close(ret); - } - } - return (setlocale(category, (char *)NULL)); -} - -int -getlocale_ctype(char *locale, char *ctypep, char *newlocale) -{ - int fd; - - if ((fd = openlocale("LC_CTYPE", LC_CTYPE, locale, newlocale)) > 0) { - if (read(fd, (char *)ctypep, CTYPE_SIZE) != CTYPE_SIZE) { - (void) close(fd); - fd = -1; - } - (void) close(fd); - } - return (fd); -} - -/* open and load the numeric information */ - -char * -getlocale_numeric(char *locale, struct lconv *lconvp, char *newlocale) -{ - int fd; - struct stat buf; - char *str; - char *p; - - if ((fd = openlocale("LC_NUMERIC", LC_NUMERIC, locale, newlocale)) < 0) - return (NULL); - if (fd == 0) - return ""; - if ((fstat(fd, &buf)) != 0) - return (NULL); - if ((str = (char*)malloc((unsigned)buf.st_size + 2)) == NULL) - return (NULL); - - if ((read(fd, str, (int)buf.st_size)) != buf.st_size) { - free((malloc_t)str); - return (NULL); - } - - /* Set last character of str to '\0' */ - p = &str[buf.st_size]; - *p++ = '\n'; - *p = '\0'; - - /* p will "walk thru" str */ - p = str; - - p = getstr(p, &lconvp->decimal_point); - if (p == NULL) - goto fail; - p = getstr(p, &lconvp->thousands_sep); - if (p == NULL) - goto fail; - p = getgrouping(p, &lconvp->grouping); - if (p == NULL) - goto fail; - (void) close(fd); - - return (str); - -fail: - (void) close(fd); - free((malloc_t)str); - return (NULL); -} - - -static char * -getlocale_monetary(char *locale, struct lconv *lconvp, char *newlocale) -{ - int fd; - struct stat buf; - char *str; - char *p; - - if ((fd = openlocale("LC_MONETARY", LC_MONETARY, locale, newlocale)) < 0) - return (NULL); - if (fd == 0) - return (""); - if ((fstat(fd, &buf)) != 0) - return (NULL); - if ((str = (char*)malloc((unsigned)buf.st_size + 2)) == NULL) - return (NULL); - - if ((read(fd, str, (int)buf.st_size)) != buf.st_size) { - free((malloc_t)str); - return (NULL); - } - - /* Set last character of str to '\0' */ - p = &str[buf.st_size]; - *p++ = '\n'; - *p = '\0'; - - /* p will "walk thru" str */ - p = str; - - p = getstr(p, &lconvp->int_curr_symbol); - if (p == NULL) - goto fail; - p = getstr(p, &lconvp->currency_symbol); - if (p == NULL) - goto fail; - p = getstr(p, &lconvp->mon_decimal_point); - if (p == NULL) - goto fail; - p = getstr(p, &lconvp->mon_thousands_sep); - if (p == NULL) - goto fail; - p = getgrouping(p, &lconvp->mon_grouping); - if (p == NULL) - goto fail; - p = getstr(p, &lconvp->positive_sign); - if (p == NULL) - goto fail; - p = getstr(p, &lconvp->negative_sign); - if (p == NULL) - goto fail; - p = getnum(p, &lconvp->frac_digits); - if (p == NULL) - goto fail; - p = getbool(p, &lconvp->p_cs_precedes); - if (p == NULL) - goto fail; - p = getbool(p, &lconvp->p_sep_by_space); - if (p == NULL) - goto fail; - p = getbool(p, &lconvp->n_cs_precedes); - if (p == NULL) - goto fail; - p = getbool(p, &lconvp->n_sep_by_space); - if (p == NULL) - goto fail; - p = getnum(p, &lconvp->p_sign_posn); - if (p == NULL) - goto fail; - p = getnum(p, &lconvp->n_sign_posn); - if (p == NULL) - goto fail; - (void) close(fd); - - return (str); - -fail: - (void) close(fd); - free((malloc_t)str); - return (NULL); -} - -static char * -getstr(char *p, char **strp) -{ - *strp = p; - p = strchr(p, '\n'); - if (p == NULL) - return (NULL); /* no end-of-line */ - *p++ = '\0'; - return (p); -} - -static char * -getgrouping(char *p, char **groupingp) -{ - int c; - - if (*p == '\0') - return (NULL); /* no grouping */ - *groupingp = p; - while ((c = *p) != '\n') { - if (c == '\0') - return (NULL); /* no end-of-line */ - if (c >= '0' && c <= '9') - *p++ = c - '0'; - else - *p++ = '\177'; - } - *p++ = '\0'; - return (p); -} - -static char * -getnum(char *p, char *nump) -{ - int num; - int c; - - if (*p == '\0') - return (NULL); /* no number */ - if (*p == '\n') - *nump = '\177'; /* blank line - no value */ - else { - num = 0; - while ((c = *p) != '\n') { - if (c < '0' || c > '9') - return (NULL); /* bad number */ - num = num*10 + c - '0'; - p++; - } - *nump = num; - } - *p++ = '\0'; - return (p); -} - -static char * -getbool(char *p, char *boolp) -{ - - if (*p == '\0') - return (NULL); /* no number */ - if (*p == '\n') - *boolp = '\177'; /* blank line - no value */ - else { - switch (*p++) { - - case 'y': - case 'Y': - case 't': - case 'T': - *boolp = 1; /* true */ - break; - - case 'n': - case 'N': - case 'f': - case 'F': - *boolp = 0; /* false */ - break; - - default: - return (NULL); /* bad boolean */ - } - if (*p != '\n') - return (NULL); /* noise at end of line */ - } - *p++ = '\0'; - return (p); -} - -/* - * Open a locale file. First, check the value of "locale"; if it's a null - * string, first check the environment variable with the same name as the - * category, and then check the environment variable "LANG". If neither of - * them are set to non-null strings, use the LC_default env.var and if this - * has no meaning then assume we are running in the C locale. It is expected - * That LC_default is set across the whole system. If the resulting locale is - * longer than MAXLOCALENAME characters, reject it. Then, try looking in the - * per-machine locale directory for the file in question; if it's not found - * there, try looking in the shared locale directory. - * If there is no work to do, that is, the last setting of locales is equal - * to the current request, then we don't do anything, and exit with value 0. - * Copy the name of the locale used into "newlocale". - * Exit with positive value if we opened a file - * Exit with -1 if an error occured (invalid locale). - * Exit with 0 if there is no need to look at the disk file. - * (Assumption - there is always at least one fd open before setlocale - * is called) - */ -int -openlocale(char *category, int cat_id, char *locale, char *newlocale) -{ - char pathname[MAXPATHLEN], *defp; - int fd, fd2; - struct _code_header code_header; - char *my_info; - - if (*locale == '\0') { - locale = getenv(category); - if (locale == NULL || *locale == '\0') { - locale = getenv("LANG"); - if (locale == NULL || *locale == '\0') { - if (*Default == '\0') { - defp = getenv("LC_default"); - if (defp == NULL || *defp == '\0') - strcpy(Default,"C"); - else - strcpy(Default, defp); - } - locale = Default; - } - } - } - if (strcmp(locale,_locales[cat_id-1]) == 0) { - (void) strcpy(newlocale, locale); - return (0); - } - if (strlen(locale) > MAXLOCALENAME) - return (-1); - - (void) strcpy(pathname, PRIVATE_LOCALE_DIR); - (void) strcat(pathname, category); - (void) strcat(pathname, "/"); - (void) strcat(pathname, locale); - if ((fd = open(pathname, O_RDONLY)) < 0 && errno == ENOENT) { - (void) strcpy(pathname, LOCALE_DIR); - (void) strcat(pathname, category); - (void) strcat(pathname, "/"); - (void) strcat(pathname, locale); - fd = open(pathname, O_RDONLY); - } - if (fd >= 0) - (void) strcpy(newlocale, locale); - /* - * bug id 1072740; if by some chance the actual fd we're going to - * return is 0, change it to be some non-zero descriptor, because - * returning 0 means something different. If '0' is the only - * descriptor left, return an error. - */ - if (fd == 0) { - int dupfd; - - if ((dupfd = dup(fd)) < 1) { - (void) close(fd); - fd = -1; - } else { - (void) close(fd); - fd = dupfd; - } - } - - if (cat_id == LC_CTYPE) { - - /* Go and get the trailer file */ - - (void) strcat(pathname, TRAILER); - fd2 = open(pathname, O_RDONLY); - if ( fd2 == 0 ) { - fd2 = dup(fd2); - close(0); - } - - if (fd2 == -1) { - set_default(); - return (fd); - } - - /* - * ctype trailer file exists - read it - */ - - if (read (fd2, (char *)&code_header, sizeof (code_header)) != - sizeof (code_header)) { - /* - * File format not correct - */ - set_default(); - close(fd2); - return (-1); - } - /* - * set up trailer file - */ - strcpy(_code_set_info.code_name, code_header.code_name); - _code_set_info.code_id = code_header.code_id; - if (_code_set_info.code_info != NULL) - free (_code_set_info.code_info); - if (code_header.code_info_size > 0) { - my_info = malloc(code_header.code_info_size); - if (read (fd2, (char *)my_info, - code_header.code_info_size) != - code_header.code_info_size) { - close(fd2); - set_default(); - return (-1); - } - _code_set_info.code_info = my_info; - } - else { - /* - * We have a corrupted file too - */ - _code_set_info.code_info = NULL; - close(fd2); - set_default(); - return (-1); - } - close (fd2); - } - return (fd); -} - -struct lconv * -localeconv(void) -{ - return (lconv); -} - -struct dtconv * -localdtconv(void) -{ - char *p; - short i; - - char *rawmonths = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec\nJanuary\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember"; - - char *rawdays = "Sun\nMon\nTue\nWed\nThu\nFri\nSat\nSunday\nMonday\nTuesday\nWednesday\nThursday\nFriday\nSaturday"; - -char *rawfmts = "%H:%M:%S\n%m/%d/%y\n%a %b %e %T %Z %Y\nAM\nPM\n%A, %B %e, %Y\n"; - - /* fix for bugid 1067574 ... robinson */ - (void)getlocale_time(); - - if (_dtconv == NULL) { - - /* We malloc both the space for the dtconv struct and the - * copy of the strings above because this program is later run - * through xstr and the resultant strings are put in read-only - * text segment. Therefore we cannot write to the original - * raw strings but we can to their copies. - */ - - _dtconv = (struct dtconv*)malloc(sizeof (struct dtconv)); - if (_dtconv == NULL) - return (NULL); - if ((realmonths = malloc(strlen(rawmonths)+1)) == NULL) - return (NULL); - strcpy(realmonths, rawmonths); - if ((realdays = malloc(strlen(rawdays)+1)) == NULL) - return (NULL); - strcpy(realdays, rawdays); - if ((realfmts = malloc(strlen(rawfmts)+1)) == NULL) - return (NULL); - strcpy(realfmts, rawfmts); - - /* p will "walk thru" str */ - - p = realmonths; - - for (i = 0; i < 12; i++) - p = getstr(p, &(_dtconv->abbrev_month_names[i])); - - for (i = 0; i < 12; i++) - p = getstr(p, &(_dtconv->month_names[i])); - p = realdays; - for (i= 0; i < 7; i++) - p = getstr(p, &(_dtconv->abbrev_weekday_names[i])); - for (i = 0; i < 7; i++) - p = getstr(p, &(_dtconv->weekday_names[i])); - p = realfmts; - p = getstr(p, &_dtconv->time_format); - p = getstr(p, &_dtconv->sdate_format); - p = getstr(p, &_dtconv->dtime_format); - p = getstr(p, &_dtconv->am_string); - p = getstr(p, &_dtconv->pm_string); - p = getstr(p, &_dtconv->ldate_format); - } - - return (_dtconv); -} - - -static void -set_default(void) -{ - - strcpy(_code_set_info.code_name, Default); - _code_set_info.code_id = CODESET_NONE; - if (_code_set_info.code_info != NULL) - free (_code_set_info.code_info); - _code_set_info.code_info = NULL; - _code_set_info.open_flag = 0; -} - -void -init_statics(void) -{ - - short i; - - for (i=0; i<MAXLOCALE-1;i++) - strcpy(_locales[i],"C"); - strcpy(_code_set_info.code_name, "default"); - strcpy(_my_time,"C"); - _langinfo.yesstr = "yes"; - _langinfo.nostr = "no"; -} diff --git a/usr/src/lib/libbc/libc/gen/common/setrgid.c b/usr/src/lib/libbc/libc/gen/common/setrgid.c deleted file mode 100644 index 2b1a3298f7..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/setrgid.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - - -int -setrgid(int rgid) -{ - - return (setregid(rgid, -1)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/setruid.c b/usr/src/lib/libbc/libc/gen/common/setruid.c deleted file mode 100644 index 2aaf47afb8..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/setruid.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -int -setruid(int ruid) -{ - - return (setreuid(ruid, -1)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/sigfpe.c b/usr/src/lib/libbc/libc/gen/common/sigfpe.c deleted file mode 100644 index 24b24eb95f..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/sigfpe.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1987 by Sun Microsystems, Inc. - */ - -/* Swap handler for SIGFPE codes. */ - -#include <errno.h> -#include <signal.h> -#include <floatingpoint.h> - -#ifndef FPE_INTDIV_TRAP -#define FPE_INTDIV_TRAP 0x14 /* integer divide by zero */ -#endif -#ifndef FPE_CHKINST_TRAP -#define FPE_CHKINST_TRAP 0x18 /* CHK [CHK2] instruction */ -#endif -#ifndef FPE_TRAPV_TRAP -#define FPE_TRAPV_TRAP 0x1c /* TRAPV [cpTRAPcc TRAPcc] instr */ -#endif -#ifndef FPE_FLTBSUN_TRAP -#define FPE_FLTBSUN_TRAP 0xc0 /* [branch or set on unordered cond] */ -#endif -#ifndef FPE_FLTINEX_TRAP -#define FPE_FLTINEX_TRAP 0xc4 /* [floating inexact result] */ -#endif -#ifndef FPE_FLTDIV_TRAP -#define FPE_FLTDIV_TRAP 0xc8 /* [floating divide by zero] */ -#endif -#ifndef FPE_FLTUND_TRAP -#define FPE_FLTUND_TRAP 0xcc /* [floating underflow] */ -#endif -#ifndef FPE_FLTOPERR_TRAP -#define FPE_FLTOPERR_TRAP 0xd0 /* [floating operand error] */ -#endif -#ifndef FPE_FLTOVF_TRAP -#define FPE_FLTOVF_TRAP 0xd4 /* [floating overflow] */ -#endif -#ifndef FPE_FLTNAN_TRAP -#define FPE_FLTNAN_TRAP 0xd8 /* [floating Not-A-Number] */ -#endif -#ifndef FPE_FPA_ENABLE -#define FPE_FPA_ENABLE 0x400 /* [FPA not enabled] */ -#endif -#ifndef FPE_FPA_ERROR -#define FPE_FPA_ERROR 0x404 /* [FPA arithmetic exception] */ -#endif - -#define N_SIGFPE_CODE 13 - -/* Array of SIGFPE codes. */ - -static sigfpe_code_type sigfpe_codes[N_SIGFPE_CODE] = { - FPE_INTDIV_TRAP, - FPE_CHKINST_TRAP, - FPE_TRAPV_TRAP, - FPE_FLTBSUN_TRAP, - FPE_FLTINEX_TRAP, - FPE_FLTDIV_TRAP, - FPE_FLTUND_TRAP, - FPE_FLTOPERR_TRAP, - FPE_FLTOVF_TRAP, - FPE_FLTNAN_TRAP, - FPE_FPA_ENABLE, - FPE_FPA_ERROR, - 0}; - -/* Array of handlers. */ - -static sigfpe_handler_type sigfpe_handlers[N_SIGFPE_CODE]; - -static int _sigfpe_master_enabled; -/* Originally zero, set to 1 by _enable_sigfpe_master. */ - -void -_sigfpe_master(sig, code, scp, addr) - int sig; - sigfpe_code_type code; - struct sigcontext *scp; - char *addr; -{ - int i; - enum fp_exception_type exception; - - for (i = 0; (i < N_SIGFPE_CODE) && (code != sigfpe_codes[i]); i++); - /* Find index of handler. */ - if (i >= N_SIGFPE_CODE) - i = N_SIGFPE_CODE - 1; - switch ((unsigned int)sigfpe_handlers[i]) { - case (unsigned int)SIGFPE_DEFAULT: - switch (code) { - case FPE_FLTBSUN_TRAP: - case FPE_FLTOPERR_TRAP: - case FPE_FLTNAN_TRAP: - exception = fp_invalid; - goto ieee; - case FPE_FLTINEX_TRAP: - exception = fp_inexact; - goto ieee; - case FPE_FLTDIV_TRAP: - exception = fp_division; - goto ieee; - case FPE_FLTUND_TRAP: - exception = fp_underflow; - goto ieee; - case FPE_FLTOVF_TRAP: - exception = fp_overflow; - goto ieee; - default: /* The common default treatment is to abort. */ - break; - } - case (unsigned int)SIGFPE_ABORT: - abort(); - case (unsigned int)SIGFPE_IGNORE: - return; - default: /* User-defined not SIGFPE_DEFAULT or - * SIGFPE_ABORT. */ - (sigfpe_handlers[i]) (sig, code, scp, addr); - return; - } -ieee: - switch ((unsigned int)ieee_handlers[(int) exception]) { - case (unsigned int)SIGFPE_DEFAULT: - /* Error condition but ignore it. */ - case (unsigned int)SIGFPE_IGNORE: - /* Error condition but ignore it. */ - return; - case (unsigned int)SIGFPE_ABORT: - abort(); - default: - (ieee_handlers[(int) exception]) (sig, code, scp, addr); - return; - } -} - -int -_enable_sigfpe_master() -{ - /* Enable the sigfpe master handler always. */ - struct sigvec newsigvec, oldsigvec; - - newsigvec.sv_handler = _sigfpe_master; - newsigvec.sv_mask = 0; - newsigvec.sv_onstack = 0; - _sigfpe_master_enabled = 1; - return sigvec(SIGFPE, &newsigvec, &oldsigvec); -} - -int -_test_sigfpe_master() -{ - /* - * Enable the sigfpe master handler if it's never been enabled - * before. - */ - - if (_sigfpe_master_enabled == 0) - return _enable_sigfpe_master(); - else - return _sigfpe_master_enabled; -} - -sigfpe_handler_type -sigfpe(code, hdl) - sigfpe_code_type code; - sigfpe_handler_type hdl; -{ - sigfpe_handler_type oldhdl; - int i; - - _test_sigfpe_master(); - for (i = 0; (i < N_SIGFPE_CODE) && (code != sigfpe_codes[i]); i++); - /* Find index of handler. */ - if (i >= N_SIGFPE_CODE) { - errno = EINVAL; - return (sigfpe_handler_type) BADSIG;/* Not 0 or SIGFPE code */ - } - oldhdl = sigfpe_handlers[i]; - sigfpe_handlers[i] = hdl; - return oldhdl; -} diff --git a/usr/src/lib/libbc/libc/gen/common/siglist.c b/usr/src/lib/libbc/libc/gen/common/siglist.c deleted file mode 100644 index 3467ab140e..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/siglist.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 5.1 85/30/05 */ - -/* - * Copyright (c) 1980 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ -#include <signal.h> - -char *sys_siglist[NSIG] = { - "Signal 0", - "Hangup", /* SIGHUP */ - "Interrupt", /* SIGINT */ - "Quit", /* SIGQUIT */ - "Illegal instruction", /* SIGILL */ - "Trace/BPT trap", /* SIGTRAP */ - "Abort", /* SIGABRT */ - "Emulator trap", /* SIGEMT */ - "Arithmetic exception", /* SIGFPE */ - "Killed", /* SIGKILL */ - "Bus error", /* SIGBUS */ - "Segmentation fault", /* SIGSEGV */ - "Bad system call", /* SIGSYS */ - "Broken pipe", /* SIGPIPE */ - "Alarm clock", /* SIGALRM */ - "Terminated", /* SIGTERM */ - "Urgent I/O condition", /* SIGURG */ - "Stopped (signal)", /* SIGSTOP */ - "Stopped", /* SIGTSTP */ - "Continued", /* SIGCONT */ - "Child exited", /* SIGCHLD */ - "Stopped (tty input)", /* SIGTTIN */ - "Stopped (tty output)", /* SIGTTOU */ - "I/O possible", /* SIGIO */ - "Cputime limit exceeded", /* SIGXCPU */ - "Filesize limit exceeded", /* SIGXFSZ */ - "Virtual timer expired", /* SIGVTALRM */ - "Profiling timer expired", /* SIGPROF */ - "Window changed", /* SIGWINCH */ - "Resource lost", /* SIGLOST */ - "User defined signal 1", /* SIGUSR1 */ - "User defined signal 2" /* SIGUSR2 */ -}; diff --git a/usr/src/lib/libbc/libc/gen/common/sparc/alloca.s b/usr/src/lib/libbc/libc/gen/common/sparc/alloca.s deleted file mode 100644 index bec6bc5ba0..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/sparc/alloca.s +++ /dev/null @@ -1,62 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * .seg "data" - * .asciz ident "%Z%%M% %I% %E% SMI" - */ -! .seg "text" - - .file "alloca.s" - -#include <sun4/asm_linkage.h> - - ! - ! o0: # bytes of space to allocate, already rounded to 0 mod 8 - ! o1: %sp-relative offset of tmp area - ! o2: %sp-relative offset of end of tmp area - ! - ! we want to bump %sp by the requested size - ! then copy the tmp area to its new home - ! this is necessasy as we could theoretically - ! be in the middle of a compilicated expression. - ! - ENTRY(__builtin_alloca) - mov %sp, %o3 ! save current sp - sub %sp, %o0, %sp ! bump to new value - ! copy loop: should do nothing gracefully - b 2f - subcc %o2, %o1, %o5 ! number of bytes to move -1: - ld [%o3 + %o1], %o4 ! load from old temp area - st %o4, [%sp + %o1] ! store to new temp area - add %o1, 4, %o1 -2: bg 1b - subcc %o5, 4, %o5 - ! now return new %sp + end-of-temp - retl - add %sp, %o2, %o0 - SET_SIZE(__builtin_alloca) diff --git a/usr/src/lib/libbc/libc/gen/common/sparc/base_conv.c b/usr/src/lib/libbc/libc/gen/common/sparc/base_conv.c deleted file mode 100644 index 405b0ab99a..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/sparc/base_conv.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1986 by Sun Microsystems, Inc. - */ - -/* - * Machine-independent versions of base conversion primitives. - * Routines to multiply buffers by 2**16 or 10**4. Base 10**4 buffers have - * b[i] < 10000, carry in and out < 65536. Base 2**16 buffers have b[i] < - * 65536, carry in and out < 10000. If n is positive, b[0]..b[n-1] are - * processed; if n is negative, b[0]..b[n+1] are processed. - */ - -void -_fourdigits(t, d) - unsigned t; - char d[4]; - -/* Converts t < 10000 into four ascii digits at *pc. */ - -{ - register short i; - - i = 3; - do { - d[i] = '0' + t % 10; - t = t / 10; - } - while (--i != -1); -} - -unsigned -_quorem10000(u, pr) - unsigned u; - unsigned *pr; -{ - *pr = u % 10000; - return (u / 10000); -} - -void -_mul_10000(b, n, c) - unsigned *b; - int n; - unsigned *c; -{ - /* Multiply base-2**16 buffer by 10000. */ - - register unsigned carry, t; - register short int i; - register unsigned *pb; - - carry = *c; - pb = b; - if ((i = n) > 0) { - i--; - do { - *pb = (t = (*pb * 10000) + carry) & 0xffff; - pb++; - carry = t >> 16; - } - while (--i != -1); - } else { - i = -i - 1; - do { - *pb = (t = (*pb * 10000) + carry) & 0xffff; - pb--; - carry = t >> 16; - } - while (--i != -1); - } - *c = carry; -} - -void -_mul_65536(b, n, c) - unsigned *b; - int n; - unsigned *c; -{ - /* Multiply base-10**4 buffer by 65536. */ - - register unsigned carry, t; - register short int i; - register unsigned *pb; - - carry = *c; - pb = b; - if ((i = n) > 0) { - i--; - do { - *pb = (t = (*pb << 16) | carry) % 10000; - pb++; - carry = t / 10000; - } - while (--i != -1); - } else { - i = -i - 1; - do { - *pb = (t = (*pb << 16) | carry) % 10000; - pb--; - carry = t / 10000; - } - while (--i != -1); - } - *c = carry; -} diff --git a/usr/src/lib/libbc/libc/gen/common/sparc/ffs.s b/usr/src/lib/libbc/libc/gen/common/sparc/ffs.s deleted file mode 100644 index 5534fcc7ca..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/sparc/ffs.s +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1992 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -! .seg "data" -! .asciz ident "%Z%%M% %I% %E% SMI" - .seg ".text" - - .file "ffs.s" - -#include <sun4/asm_linkage.h> - - ENTRY(ffs) - tst %o0 ! if zero, done - bz 2f - clr %o1 ! delay slot, return zero if no bit set -1: - inc %o1 ! bit that will get checked - btst 1, %o0 - be 1b ! if bit is zero, keep checking - srl %o0, 1, %o0 ! shift input right until we hit a 1 bit -2: - retl - mov %o1, %o0 ! return value is in o1 - SET_SIZE(ffs) diff --git a/usr/src/lib/libbc/libc/gen/common/sparc/insque.s b/usr/src/lib/libbc/libc/gen/common/sparc/insque.s deleted file mode 100644 index eef886a1c7..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/sparc/insque.s +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1992 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -! .seg "data" -! .asciz ident "%Z%%M% %I% %E% SMI" - .seg ".text" - - .file "insque.s" - -#include <sun4/asm_linkage.h> - -/* - * insque(entryp, predp) - * - * Insert entryp after predp in a doubly linked list. - */ - ENTRY(insque) - ld [%o1], %g1 ! predp->forw - st %o1, [%o0 + 4] ! entryp->back = predp - st %g1, [%o0] ! entryp->forw = predp->forw - st %o0, [%o1] ! predp->forw = entryp - retl - st %o0, [%g1 + 4] ! predp->forw->back = entryp - SET_SIZE(insque) diff --git a/usr/src/lib/libbc/libc/gen/common/sparc/isinf.c b/usr/src/lib/libbc/libc/gen/common/sparc/isinf.c deleted file mode 100644 index 2bd47b88e5..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/sparc/isinf.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1986 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Recognize an infinity or a NaN when one is presented. - * This is for keeping various IO routines out of trouble - */ - - -int -isinf( d0, d1 ) - unsigned d0,d1; - /* a lie -- actually its a ``double'' */ -{ - if (d1 != 0 ) return 0; /* nope -- low-order must be all zeros */ - if (d0 != 0x7ff00000 && d0 != 0xfff00000) return 0; /* nope */ - return 1; -} - -int -isnan( d0,d1 ) - unsigned d0,d1; - /* a lie -- actually its a ``double'' */ -{ -#define EXPONENT 0x7ff00000 -#define SIGN 0x80000000 - if ((d0 & EXPONENT) != EXPONENT ) return 0; /* exponent wrong */ - if ((d0 & ~(EXPONENT|SIGN)) == 0 && d1 == 0 ) return 0; /* must have bits */ - return 1; -} diff --git a/usr/src/lib/libbc/libc/gen/common/sparc/remque.s b/usr/src/lib/libbc/libc/gen/common/sparc/remque.s deleted file mode 100644 index 358b2eb08c..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/sparc/remque.s +++ /dev/null @@ -1,46 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -! .seg "data" -! .asciz ident "%Z%%M% %I% %E% SMI" -! .seg "text" - - .file "remque.s" - -#include <sun4/asm_linkage.h> - -/* - * remque(entryp) - * - * Remove entryp from a doubly linked list - */ - ENTRY(remque) - ld [%o0], %g1 ! entryp->forw - ld [%o0 + 4], %g2 ! entryp->back - st %g1, [%g2] ! entryp->back = entryp->forw - retl - st %g2, [%g1 + 4] ! entryp->forw = entryp->back - SET_SIZE(remque) diff --git a/usr/src/lib/libbc/libc/gen/common/ssignal.c b/usr/src/lib/libbc/libc/gen/common/ssignal.c deleted file mode 100644 index 8becd84fd5..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/ssignal.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -/* - * ssignal, gsignal: software signals - */ -#include <signal.h> - -/* Highest allowable user signal number */ -#define MAXSIG NSIG - -/* Lowest allowable signal number (lowest user number is always 1) */ -#define MINSIG (-4) - -/* Table of signal values */ -typedef int (*sigfunc)(); -sigfunc *ssigp; - - -sigfunc * -_ssig() -{ - if (ssigp == 0) - ssigp = (sigfunc *)calloc(MAXSIG-MINSIG+1, sizeof (sigfunc)); - return (ssigp); -} - -int -(*ssignal(sig, fn))() -register int sig, (*fn)(); -{ - register int (*savefn)(); - register sigfunc *sp = _ssig(); - - if (sp == 0) - return ((int (*)())SIG_DFL); - if (sig >= MINSIG && sig <= MAXSIG) { - savefn = sp[sig-MINSIG]; - sp[sig-MINSIG] = fn; - } else - savefn = (int (*)())SIG_DFL; - - return (savefn); -} - -int -gsignal(sig) -register int sig; -{ - register int (*sigfn)(); - register sigfunc *sp = _ssig(); - - if (sp == 0) - return (0); - if (sig < MINSIG || sig > MAXSIG || - (sigfn = sp[sig-MINSIG]) == (int (*)())SIG_DFL) - return (0); - else if (sigfn == (int (*)())SIG_IGN) - return (1); - else { - sp[sig-MINSIG] = (int (*)())SIG_DFL; - return ((*sigfn)(sig)); - } -} diff --git a/usr/src/lib/libbc/libc/gen/common/strchr.c b/usr/src/lib/libbc/libc/gen/common/strchr.c deleted file mode 100644 index e978579ae1..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/strchr.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -/* - * Return the ptr in sp at which the character c appears; - * NULL if not found - */ - -#define NULL 0 - -char * -strchr(sp, c) -register char *sp, c; -{ - do { - if(*sp == c) - return(sp); - } while(*sp++); - return(NULL); -} diff --git a/usr/src/lib/libbc/libc/gen/common/strftime.c b/usr/src/lib/libbc/libc/gen/common/strftime.c deleted file mode 100644 index 5267bc447a..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/strftime.c +++ /dev/null @@ -1,531 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1996 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - - -#pragma ident "%Z%%M% %I% %E% SMI" - -#if !defined(lint) && defined(SCCSIDS) -static char *sccsid = "%Z%%M% %I% %E% SMI"; /* from S5R3.1 cftime.c 1.9 */ -#endif - -/*LINTLIBRARY*/ - -#include <locale.h> -#include <time.h> -#include <string.h> -#include <sys/param.h> -#include <sys/stat.h> - -static char *getstr(/*char *p, char **strp*/); -static char *itoa(); -extern int stat(); -extern char *getenv(); -extern char *malloc(); -extern int openlocale(/*char *category, int cat_id, char *locale, char *newlocale */); -extern void init_statics(); - -extern struct dtconv *_dtconv; -extern char _locales[MAXLOCALE + 1][MAXLOCALENAME + 1]; -extern char _my_time[]; - -char *dtconv_str = NULL; -char *getlocale_time(); - -int -strftime(buf, maxsize, format, tm) -char *buf, *format; -struct tm *tm; -{ - register char *cp, *p, c; - int size; - int i, temp; - register struct dtconv *dtcp; - - (void) getlocale_time(); - dtcp = localdtconv(); /* get locale's strings */ - - /* Build date string by parsing format string */ - cp = buf; - size = 0; - while ((c = *format++) != '\0') { - if (c == '%') { - switch (*format++) { - - case '%': /* Percent sign */ - if (++size >= maxsize) - return (0); - *cp++ = '%'; - break; - - case 'a': /* Abbreviated weekday name */ - for (p = dtcp->abbrev_weekday_names[tm->tm_wday]; - *p != '\0'; p++) { - if (++size >= maxsize) - return (0); - *cp++ = *p; - } - break; - - case 'A': /* Weekday name */ - for (p = dtcp->weekday_names[tm->tm_wday]; - *p != '\0'; p++) { - if (++size >= maxsize) - return (0); - *cp++ = *p; - } - break; - - case 'h': - case 'b': /* Abbreviated month name */ - for (p = dtcp->abbrev_month_names[tm->tm_mon]; - *p != '\0'; p++) { - if (++size >= maxsize) - return (0); - *cp++ = *p; - } - break; - - case 'B': /* Month name */ - for (p = dtcp->month_names[tm->tm_mon]; - *p != '\0'; p++) { - if (++size >= maxsize) - return (0); - *cp++ = *p; - } - break; - - case 'c': /* date and time representation */ - i = strftime(cp, maxsize - size, "%x %X", tm); - if (i == 0) - return (0); - cp += i; - size += i; - break; - - case 'C': /* long date and time representation */ - i = strftime(cp, maxsize - size, - dtcp->ldate_format, tm); - if (i == 0) - return (0); - cp += i; - size += i; - break; - - case 'd': /* Day of month, with leading zero */ - if ((size += 2) >= maxsize) - return (0); - cp = itoa(tm->tm_mday, cp, 2); - break; - - case 'D': /* Shorthand for %m/%d/%y */ - i = strftime(cp, maxsize - size, "%m/%d/%y", - tm); - if (i == 0) - return (0); - cp += i; - size += i; - break; - - case 'e': /* Day of month without leading zero */ - if ((size += 2) >= maxsize) - return (0); - if (tm->tm_mday < 10) { - *cp++ = ' '; - cp = itoa(tm->tm_mday, cp, 1); - } else - cp = itoa(tm->tm_mday, cp, 2); - break; - - case 'H': /* Hour (24 hour version) */ - if ((size += 2) >= maxsize) - return (0); - cp = itoa(tm->tm_hour, cp, 2); - break; - - case 'I': /* Hour (12 hour version) */ - if ((size += 2) >= maxsize) - return (0); - cp = itoa(tm->tm_hour > 12 ? - tm->tm_hour - 12 : - (tm->tm_hour == 0 ? 12 : tm->tm_hour), - cp, 2); - break; - - case 'j': /* Julian date */ - if ((size += 3) >= maxsize) - return (0); - cp = itoa(tm->tm_yday + 1, cp, 3); - break; - - case 'k': /* Hour (24 hour version) */ - if ((size += 2) >= maxsize) - return (0); - if (tm->tm_hour < 10) { - *cp++ = ' '; - cp = itoa(tm->tm_hour, cp, 1); - } else - cp = itoa(tm->tm_hour, cp, 2); - break; - - case 'l': /* Hour (12 hour version) */ - if ((size += 2) >= maxsize) - return (0); - temp = tm->tm_hour > 12 ? - tm->tm_hour - 12 : - (tm->tm_hour == 0 ? 12 : tm->tm_hour); - if (temp < 10) { - *cp++ = ' '; - cp = itoa(temp, cp, 1); - } else - cp = itoa(temp, cp, 2); - break; - - case 'm': /* Month number */ - if ((size += 2) >= maxsize) - return (0); - cp = itoa(tm->tm_mon + 1, cp, 2); - break; - - case 'M': /* Minute */ - if ((size += 2) >= maxsize) - return (0); - cp = itoa(tm->tm_min, cp, 2); - break; - - case 'n': /* Newline */ - if (++size >= maxsize) - return (0); - *cp++ = '\n'; - break; - - case 'p': /* AM or PM */ - if (tm->tm_hour >= 12) - p = dtcp->pm_string; - else - p = dtcp->am_string; - for (; *p != '\0'; p++) { - if (++size >= maxsize) - return (0); - *cp++ = *p; - } - break; - - case 'r': /* Shorthand for %I:%M:%S AM or PM */ - i = strftime(cp, maxsize - size, "%I:%M:%S %p", - tm); - if (i == 0) - return (0); - cp += i; - size += i; - break; - - case 'R': /* Time as %H:%M */ - i = strftime(cp, maxsize - size, "%H:%M", tm); - if (i == 0) - return (0); - cp += i; - size += i; - break; - - case 'S': /* Seconds */ - if ((size += 2) >= maxsize) - return (0); - cp = itoa(tm->tm_sec, cp, 2); - break; - - case 't': /* Tab */ - if (++size >= maxsize) - return (0); - *cp++ = '\t'; - break; - - case 'T': /* Shorthand for %H:%M:%S */ - i = strftime(cp, maxsize - size, "%H:%M:%S", - tm); - if (i == 0) - return (0); - cp += i; - size += i; - break; - - case 'U': /* Weekday number, taking Sunday as - * the first day of the week */ - if ((size += 2) >= maxsize) - return (0); - temp = tm->tm_yday - tm->tm_wday; - if (temp >= -3 ) { - i = (temp + 1) / 7 + 1; /* +1 for - tm->tm_wday */ - if (temp % 7 >= 4) - i++; - } else - i = 52; - cp = itoa(i, cp, 2); - break; - - case 'w': /* Weekday number */ - if (++size >= maxsize) - return (0); - cp = itoa(tm->tm_wday, cp, 1); - break; - - case 'W': /* Week number of year, taking Monday as - * first day of week */ - if ((size += 2) >= maxsize) - return (0); - if (tm->tm_wday == 0) - temp = tm->tm_yday - 6; - else - temp = tm->tm_yday - tm->tm_wday + 1; - if (temp >= -3) { - i = (temp + 1) / 7 + 1; /* 1 for - -tm->tm_wday */ - if (temp % 7 >= 4) - i++; - } else - i = 52; /* less than 4 days in the first - week causes it to belong to - the tail of prev year */ - cp = itoa(i, cp, 2); - break; - - case 'x': /* Localized date format */ - i = strftime(cp, maxsize - size, - dtcp->sdate_format, tm); - if (i == 0) - return (0); - cp += i; - size += i; - break; - - case 'X': /* Localized time format */ - i = strftime(cp, maxsize - size, - dtcp->time_format, tm); - if (i == 0) - return (0); - cp += i; - size += i; - break; - - case 'y': /* Year in the form yy */ - if ((size += 2) >= maxsize) - return (0); - cp = itoa((tm->tm_year% 100), cp, 2); - break; - - case 'Y': /* Year in the form ccyy */ - if ((size += 4) >= maxsize) - return (0); - cp = itoa(1900 + tm->tm_year, cp, 4); - break; - - case 'Z': /* Timezone */ - for(p = tm->tm_zone; *p != '\0'; p++) { - if (++size >= maxsize) - return (0); - *cp++ = *p; - } - break; - - default: - if ((size += 2) >= maxsize) - return (0); - *cp++ = c; - *cp++ = *(format - 1); - break; - } - } else { - if (++size >= maxsize) - return (0); - *cp++ = c; - } - } - *cp = '\0'; - return(size); -} - -static char * -itoa(i, ptr, dig) -register int i; -register char *ptr; -register int dig; -{ - switch(dig) { - case 4: - *ptr++ = i / 1000 + '0'; - i = i - i / 1000 * 1000; - case 3: - *ptr++ = i / 100 + '0'; - i = i - i / 100 * 100; - case 2: - *ptr++ = i / 10 + '0'; - case 1: - *ptr++ = i % 10 + '0'; - } - - return(ptr); -} - -char * -getlocale_time() -{ - register int fd; - struct stat buf; - char *str; - register char *p; - register int i; - struct dtconv dtconvp; - char temp[MAXLOCALENAME + 1]; - - if (_locales[0][0] == '\0') - init_statics(); - - /* Here we use the string newlocales to set time constants - * which should have been saved - * from a previous call to setlocale. We deferred the read until now - */ - - if (strcmp(_my_time, _locales[LC_TIME -1]) == 0) { - if (dtconv_str == NULL) { - /* - * Below is executed if getlocale_time() - * is called when LC_TIME locale is initial - * C locale. - */ - strcpy(temp, "C"); - /* - * Just to make openlocale() to read LC_TIME file. - */ - strcat(_locales[LC_TIME-1], temp); - goto initial; - } - return dtconv_str; - } - strcpy(temp, _locales[LC_TIME - 1]); - strcpy(_locales[LC_TIME - 1], _my_time); -initial: - if ((fd = openlocale("LC_TIME", LC_TIME, temp, _locales[LC_TIME - 1])) < 0) - return (NULL); - strcpy(_my_time, _locales[LC_TIME - 1]); - if (fd == 0) - return dtconv_str; - if ((fstat(fd, &buf)) != 0) - return (NULL); - if ((str = malloc((unsigned)buf.st_size + 2)) == NULL) { - close(fd); - return (NULL); - } - - if ((read(fd, str, (int)buf.st_size)) != buf.st_size) { - close(fd); - free(str); - return (NULL); - } - - /* Set last character of str to '\0' */ - p = &str[buf.st_size]; - *p++ = '\n'; - *p = '\0'; - - /* p will "walk thru" str */ - p = str; - - for (i = 0; i < 12; i++) { - p = getstr(p, &dtconvp.abbrev_month_names[i]); - if (p == NULL) - goto fail; - } - for (i = 0; i < 12; i++) { - p = getstr(p, &dtconvp.month_names[i]); - if (p == NULL) - goto fail; - } - for (i = 0; i < 7; i++) { - p = getstr(p, &dtconvp.abbrev_weekday_names[i]); - if (p == NULL) - goto fail; - } - for (i = 0; i < 7; i++) { - p = getstr(p, &dtconvp.weekday_names[i]); - if (p == NULL) - goto fail; - } - p = getstr(p, &dtconvp.time_format); - if (p == NULL) - goto fail; - p = getstr(p, &dtconvp.sdate_format); - if (p == NULL) - goto fail; - p = getstr(p, &dtconvp.dtime_format); - if (p == NULL) - goto fail; - p = getstr(p, &dtconvp.am_string); - if (p == NULL) - goto fail; - p = getstr(p, &dtconvp.pm_string); - if (p == NULL) - goto fail; - p = getstr(p, &dtconvp.ldate_format); - if (p == NULL) - goto fail; - (void) close(fd); - - /* - * set info. - */ - if (dtconv_str != NULL) - free(dtconv_str); - - dtconv_str = str; - - /* The following is to get space malloc'd for _dtconv */ - - if (_dtconv == 0) - (void) localdtconv(); - memcpy(_dtconv, &dtconvp, sizeof(struct dtconv)); - return (dtconv_str); - -fail: - (void) close(fd); - free(str); - return (NULL); -} - - -static char * -getstr(p, strp) - register char *p; - char **strp; -{ - *strp = p; - p = strchr(p, '\n'); - if (p == NULL) - return (NULL); /* no end-of-line */ - *p++ = '\0'; - return (p); -} diff --git a/usr/src/lib/libbc/libc/gen/common/stricmp.c b/usr/src/lib/libbc/libc/gen/common/stricmp.c deleted file mode 100644 index 8f903db3de..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/stricmp.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1987 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * This array is designed for mapping upper and lower case letter - * together for a case independent comparison. The mappings are - * based upon ascii character sequences. - */ -static char charmap[] = { - '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', - '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', - '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', - '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', - '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', - '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', - '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', - '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', - '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', - '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', - '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', - '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', - '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', - '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', - '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', - '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', - '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', - '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', - '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', - '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', - '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', - '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', - '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', - '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', - '\300', '\341', '\342', '\343', '\344', '\345', '\346', '\347', - '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', - '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', - '\370', '\371', '\372', '\333', '\334', '\335', '\336', '\337', - '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', - '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', - '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', - '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377', -}; - -int -strcasecmp(char *s1, char *s2) -{ - char *cm = charmap; - - while (cm[*s1] == cm[*s2++]) - if (*s1++ == '\0') - return (0); - return(cm[*s1] - cm[*--s2]); -} - -int -strncasecmp(char *s1, char *s2, int n) -{ - char *cm = charmap; - - while (--n >= 0 && cm[*s1] == cm[*s2++]) - if (*s1++ == '\0') - return (0); - return(n < 0 ? 0 : cm[*s1] - cm[*--s2]); -} - -/* - * For 4.0 compatibility - */ -int -stricmp(char *s1, char *s2) -{ - return (strcasecmp(s1, s2)); -} - -int -strnicmp(char *s1, char *s2, int n) -{ - return (strncasecmp(s1, s2, n)); -} diff --git a/usr/src/lib/libbc/libc/gen/common/string_decim.c b/usr/src/lib/libbc/libc/gen/common/string_decim.c deleted file mode 100644 index 2dd47e6ab1..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/string_decim.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1988 by Sun Microsystems, Inc. - */ - -#include <ctype.h> -#include <stdio.h> -#ifndef PRE41 -#include <locale.h> -#endif -#include "base_conversion.h" - -void -string_to_decimal(ppc, nmax, fortran_conventions, pd, pform, pechar) - char **ppc; - int nmax; - int fortran_conventions; - decimal_record *pd; - enum decimal_string_form *pform; - char **pechar; - -{ - register char *cp = *ppc; - register int current; - register int nread = 1; /* Number of characters read so far. */ - char *cp0 = cp; - char *good = cp - 1; /* End of known good token. */ - - current = *cp; - -#define ATEOF 0 /* A string is never at EOF. */ -#define CURRENT current -#define NEXT \ - if (nread < nmax) \ - {cp++ ; current = *cp ; nread++ ;} \ - else \ - {current = NULL ; } ; /* Increment input character and cp. */ - -#include "char_to_decimal.h" -#undef CURRENT -#undef NEXT -} diff --git a/usr/src/lib/libbc/libc/gen/common/strncat.c b/usr/src/lib/libbc/libc/gen/common/strncat.c deleted file mode 100644 index 6c1c5f4ea9..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/strncat.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Concatenate s2 on the end of s1. S1's space must be large enough. - * At most n characters are moved. - * Return s1. - */ - -char * -strncat(char *s1, char *s2, int n) -{ - char *os1; - - os1 = s1; - while (*s1++) - ; - --s1; - while (*s1++ = *s2++) - if (--n < 0) { - *--s1 = '\0'; - break; - } - return (os1); -} diff --git a/usr/src/lib/libbc/libc/gen/common/strpbrk.c b/usr/src/lib/libbc/libc/gen/common/strpbrk.c deleted file mode 100644 index c876665bd9..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/strpbrk.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -/* - * Return ptr to first occurance of any character from `brkset' - * in the character string `string'; NULL if none exists. - */ - -#define NULL (char *) 0 - -char * -strpbrk(string, brkset) -register char *string, *brkset; -{ - register char *p; - - do { - for(p=brkset; *p != '\0' && *p != *string; ++p) - ; - if(*p != '\0') - return(string); - } - while(*string++); - return(NULL); -} diff --git a/usr/src/lib/libbc/libc/gen/common/strptime.c b/usr/src/lib/libbc/libc/gen/common/strptime.c deleted file mode 100644 index bfd7aef821..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/strptime.c +++ /dev/null @@ -1,483 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1997 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#if !defined(lint) && defined(SCCSIDS) -static char *sccsid = "%Z%%M% %I% %E% SMI"; -#endif - -#include <ctype.h> -#include <locale.h> -#include <time.h> - -static char *strmatch(/*char *cp, char *string*/); -static char *yearmatch(/*char *cp, char *format, struct tm *tm, - int *hadyearp*/); -static char *cvtnum(/*char *cp, int *nump*/); -static char *skipnws(/*char *format*/); - -extern char *getlocale_time(); -#define NULL 0 - -char * -strptime(buf, format, tm) - char *buf; - char *format; - struct tm *tm; -{ - register char *cp, *p; - register int c, ch; - register int i; - register struct dtconv *dtcp; - int hadyear; - - (void) getlocale_time(); - dtcp = localdtconv(); /* get locale's strings */ - - cp = buf; - while ((c = *format++) != '\0') { - if (c == '%') { - switch (*format++) { - - case '%': /* Percent sign */ - if (*cp++ != '%') - return (NULL); - break; - - case 'a': /* Abbreviated weekday name */ - case 'A': /* Weekday name */ - for (i = 0; i < 7; i++) { - if ((p = strmatch(cp, - dtcp->weekday_names[i], - *format)) != NULL - || (p = strmatch(cp, - dtcp->abbrev_weekday_names[i], - *format)) != NULL) - goto match_wday; - } - return (NULL); /* no match */ - - match_wday: - tm->tm_wday = i; - cp = p; - break; - - case 'h': - case 'b': /* Abbreviated month name */ - case 'B': /* Month name */ - for (i = 0; i < 12; i++) { - if ((p = strmatch(cp, - dtcp->month_names[i], - *format)) != NULL - || (p = strmatch(cp, - dtcp->abbrev_month_names[i], - *format)) != NULL) - goto match_month; - } - return (NULL); /* no match */ - - match_month: - tm->tm_mon = i; - cp = p; - break; - - case 'c': /* date and time representation */ - cp = strptime(cp, "%x %X", tm); - if (cp == NULL) - return (NULL); - break; - - case 'C': /* long date and time representation */ - cp = strptime(cp, dtcp->ldate_format, tm); - if (cp == NULL) - return (NULL); - break; - - case 'd': /* Day of month, with leading zero */ - case 'e': /* Day of month without leading zero */ - cp = cvtnum(cp, &tm->tm_mday); - if (cp == NULL) - return (NULL); /* no digits */ - if (tm->tm_mday > 31) - return (NULL); - if ((c = *cp) == '\0' - || isspace((unsigned char)c)) - format = skipnws(format); - break; - - case 'D': /* Shorthand for %m/%d/%y */ - cp = strptime(cp, "%m/%d/%y", tm); - if (cp == NULL) - return (NULL); - break; - - case 'H': /* Hour (24 hour version) */ - case 'k': /* Hour (24 hour version) */ - cp = cvtnum(cp, &tm->tm_hour); - if (cp == NULL) - return (NULL); /* no digits */ - if (tm->tm_hour > 23) - return (NULL); - if ((c = *cp) == '\0' - || isspace((unsigned char)c)) - format = skipnws(format); - break; - - case 'I': /* Hour (12 hour version) */ - case 'l': /* Hour (12 hour version) */ - cp = cvtnum(cp, &tm->tm_hour); - if (cp == NULL) - return (NULL); /* no digits */ - if (tm->tm_hour == 12) - tm->tm_hour = 0; - else if (tm->tm_hour > 11) - return (NULL); - if ((c = *cp) == '\0' - || isspace((unsigned char)c)) - format = skipnws(format); - break; - - case 'j': /* Julian date */ - cp = cvtnum(cp, &tm->tm_yday); - if (cp == NULL) - return (NULL); /* no digits */ - if (tm->tm_yday > 365) - return (NULL); - break; - - case 'm': /* Month number */ - cp = cvtnum(cp, &tm->tm_mon); - if (cp == NULL) - return (NULL); /* no digits */ - tm->tm_mon--; - if (tm->tm_mon < 0 || tm->tm_mon > 11) - return (NULL); - if ((c = *cp) == '\0' - || isspace((unsigned char)c)) - format = skipnws(format); - break; - - case 'M': /* Minute */ - /* - * This is optional; if we're at the end of the - * string, or the next character is white - * space, don't try to match it. - */ - if ((c = *cp) != '\0' - && !isspace((unsigned char)c)) { - cp = cvtnum(cp, &tm->tm_min); - if (cp == NULL) - return (NULL); /* no digits */ - if (tm->tm_min > 59) - return (NULL); - } - if ((c = *cp) == '\0' - || isspace((unsigned char)c)) - format = skipnws(format); - break; - - case 'p': /* AM or PM */ - if ((p = strmatch(cp, dtcp->am_string, - *format)) != NULL) { - /* - * AM. - */ - if (tm->tm_hour == 12) - tm->tm_hour = 0; - cp = p; - } else if ((p = strmatch(cp, dtcp->pm_string, - *format)) != NULL) { - /* - * PM. - */ - if (tm->tm_hour > 12) - return (NULL); /* error */ - else if (tm->tm_hour != 12) - tm->tm_hour += 12; - cp = p; - } - break; - - case 'r': /* Shorthand for %I:%M:%S AM or PM */ - cp = strptime(cp, "%I:%M:%S %p", tm); - if (cp == NULL) - return (NULL); - break; - - case 'R': /* Time as %H:%M */ - cp = strptime(cp, "%H:%M", tm); - if (cp == NULL) - return (NULL); - break; - - case 'S': /* Seconds */ - /* - * This is optional; if we're at the end of the - * string, or the next character is white - * space, don't try to match it. - */ - if ((c = *cp) != '\0' - && !isspace((unsigned char)c)) { - cp = cvtnum(cp, &tm->tm_sec); - if (cp == NULL) - return (NULL); /* no digits */ - if (tm->tm_sec > 59) - return (NULL); - } - if ((c = *cp) == '\0' - || isspace((unsigned char)c)) - format = skipnws(format); - break; - - case 'T': /* Shorthand for %H:%M:%S */ - cp = strptime(cp, "%H:%M:%S", tm); - if (cp == NULL) - return (NULL); - break; - - case 'x': /* Localized date format */ - cp = strptime(cp, dtcp->sdate_format, tm); - if (cp == NULL) - return (NULL); - break; - - case 'X': /* Localized time format */ - cp = strptime(cp, dtcp->time_format, tm); - if (cp == NULL) - return (NULL); - break; - - case 'y': /* Year in the form yy */ - cp = yearmatch(cp, format, tm, &hadyear); - if (cp == NULL) - return (NULL); - if (hadyear) { - if (tm->tm_year < 69) - tm->tm_year += 100; - } - return (cp); /* match is complete */ - - case 'Y': /* Year in the form ccyy */ - cp = yearmatch(cp, format, tm, &hadyear); - if (cp == NULL) - return (NULL); - if (hadyear) { - tm->tm_year -= 1900; - if (tm->tm_year < 0) - return (NULL); - } - return (cp); /* match is complete */ - - default: - return (NULL); /* unknown conversion */ - } - } else { - if (isspace((unsigned char)c)) { - while ((ch = *cp++) != '\0' - && isspace((unsigned char)ch)) - ; - cp--; - } else { - if (*cp++ != c) - return (NULL); - } - } - } - return (cp); -} - -/* - * Try to match the beginning of the string pointed to by "cp" with the string - * pointed to by "string". The match is independent of the case of either - * string. - * - * "termc" is the next character in the format string following the one for - * which this match is being done. If the match succeeds, make sure the next - * character after the match is either '\0', or that it would match "termc". - * - * If both matches succeed, return a pointer to the next character after the - * first match. Otherwise, return NULL. - */ -static char * -strmatch(cp, string, termc) - register char *cp; - register char *string; - char termc; -{ - register unsigned char c, strc; - - /* - * Match the beginning portion of "cp" with "string". - */ - while ((strc = *string++) != '\0') { - c = *cp++; - if (isupper(c)) - c = tolower(c); - if (isupper(strc)) - strc = tolower(strc); - if (c != strc) - return (NULL); - } - - if ((c = *cp) != '\0') { - if (isspace((unsigned char)termc)) { - if (!isspace(c)) - return (NULL); - } else { - if (c != (unsigned char)termc) - return (NULL); - } - } - return (cp); -} - -/* - * Try to match a %y or %Y specification. - * If it matches, try matching the rest of the format. If it succeeds, just - * return. Otherwise, try backing the scan up, ignoring the %y/%Y and any - * following non-white-space string. If that succeeds, just return. (This - * permits a missing year to be detected if it's at the beginning of a date, as - * well as if it's at the end of a date, so that formats such as "%Y/%m/%d" can - * match "3/14" and default the year.) - * - * Set "*hadyearp" to indicate whether a year was specified or not. - */ -static char * -yearmatch(cp, format, tm, hadyearp) - register char *cp; - char *format; - struct tm *tm; - int *hadyearp; -{ - register int c; - char *savecp; - int saveyear; - - /* - * This is optional; if we're at the end of the - * string, or the next character is white - * space, don't try to match it. - */ - if ((c = *cp) != '\0' && !isspace((unsigned char)c)) { - savecp = cp; - saveyear = tm->tm_year; - cp = cvtnum(cp, &tm->tm_year); - if (cp == NULL) - return (NULL); /* no digits */ - if ((c = *cp) == '\0' - || isspace((unsigned char)c)) - format = skipnws(format); - - /* - * Year can also be optional if it's at - * the *beginning* of a date. We check - * this by trying to parse the rest of - * the date here. If we succeed, OK; - * otherwise, we skip over the %y and - * try again. - */ - cp = strptime(cp, format, tm); - if (cp != NULL) - *hadyearp = 1; - else { - *hadyearp = 0; - cp = savecp; - format = skipnws(format); - tm->tm_year = saveyear; - cp = strptime(cp, format, tm); - } - } else { - *hadyearp = 0; - if ((c = *cp) == '\0' - || isspace((unsigned char)c)) - format = skipnws(format); - cp = strptime(cp, format, tm); - } - - return (cp); -} - -/* - * Try to match a (decimal) number in the string pointed to by "cp". - * If the match succeeds, store the result in the "int" pointed to by "nump" - * and return a pointer to the character following the number in the string. - * If it fails, return NULL. - */ -static char * -cvtnum(cp, nump) - register char *cp; - int *nump; -{ - register int c; - register int i; - - c = (unsigned char)*cp++; - if (!isdigit(c)) - return (NULL); /* no digits */ - i = 0; - do { - i = i*10 + c - '0'; - c = (unsigned char)*cp++; - } while (isdigit(c)); - *nump = i; - return (cp - 1); -} - -/* - * If a format item (such as %H, hours) is followed by a non-white-space - * character other than "%", and the part of the string that matched the format - * item is followed by white space, the string of non-white-space, - * non-format-item characters following that format item may be omitted. - */ -static char * -skipnws(format) - register char *format; -{ - register char c; - - /* - * Skip over non-white-space, non-digit characters. "%" is special. - */ - while ((c = *format) != '\0' && !isspace((unsigned char)c)) { - if (c == '%') { - /* - * This is a format item. If it's %%, skip it as - * that's a non-white space, non-digit character. - */ - if (*(format + 1) == '%') - format++; /* skip % */ - else - break; - } - format++; - } - - return (format); -} diff --git a/usr/src/lib/libbc/libc/gen/common/strrchr.c b/usr/src/lib/libbc/libc/gen/common/strrchr.c deleted file mode 100644 index 28c338b895..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/strrchr.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -/* - * Return the ptr in sp at which the character c last - * appears; NULL if not found -*/ - -#define NULL 0 - -char * -strrchr(sp, c) -register char *sp, c; -{ - register char *r; - - r = NULL; - do { - if(*sp == c) - r = sp; - } while(*sp++); - return(r); -} diff --git a/usr/src/lib/libbc/libc/gen/common/strspn.c b/usr/src/lib/libbc/libc/gen/common/strspn.c deleted file mode 100644 index d68f5ce6af..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/strspn.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -/* - * Return the number of characters in the maximum leading segment - * of string which consists solely of characters from charset. - */ -int -strspn(string, charset) -char *string; -register char *charset; -{ - register char *p, *q; - - for(q=string; *q != '\0'; ++q) { - for(p=charset; *p != '\0' && *p != *q; ++p) - ; - if(*p == '\0') - break; - } - return(q-string); -} diff --git a/usr/src/lib/libbc/libc/gen/common/strstr.c b/usr/src/lib/libbc/libc/gen/common/strstr.c deleted file mode 100644 index 79bc3151fd..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/strstr.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Get matching substring - */ -#include <string.h> - -#pragma weak strstr = _strstr - -char * -_strstr(s1, s2) - register char *s1, *s2; -{ - int s2len = strlen(s2); /* length of the second string */ - /* - * If the length of the second string is 0, - * return the first argument. - */ - if (s2len == 0) - return (s1); - - while (strlen(s1) >= s2len) { - if (strncmp(s1, s2, s2len) == 0) - return (s1); - s1++; - } - return (0); -} diff --git a/usr/src/lib/libbc/libc/gen/common/strtod.c b/usr/src/lib/libbc/libc/gen/common/strtod.c deleted file mode 100644 index fa551c76f1..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/strtod.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1987 by Sun Microsystems, Inc. - */ - -#include <errno.h> -#include <stdio.h> -#include <values.h> -#include <floatingpoint.h> - -double -strtod(cp, ptr) - char *cp; - char **ptr; -{ - double x; - decimal_mode mr; - decimal_record dr; - fp_exception_field_type fs; - enum decimal_string_form form; - char *pechar; - - string_to_decimal(&cp, MAXINT, 0, &dr, &form, &pechar); - if (ptr != (char **) NULL) - *ptr = cp; - if (form == invalid_form) - return 0.0; /* Shameful kluge for SVID's sake. */ - mr.rd = fp_direction; - decimal_to_double(&x, &mr, &dr, &fs); - if (fs & (1 << fp_overflow)) { /* Overflow. */ - errno = ERANGE; - } - if (fs & (1 << fp_underflow)) { /* underflow */ - errno = ERANGE; - } - return x; -} diff --git a/usr/src/lib/libbc/libc/gen/common/strtok.c b/usr/src/lib/libbc/libc/gen/common/strtok.c deleted file mode 100644 index 07fdbc7e94..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/strtok.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -/* - * uses strpbrk and strspn to break string into tokens on - * sequentially subsequent calls. returns NULL when no - * non-separator characters remain. - * `subsequent' calls are calls with first argument NULL. - */ - -#define NULL (char*)0 - -extern int strspn(); -extern char *strpbrk(); - -char * -strtok(string, sepset) -char *string, *sepset; -{ - register char *p, *q, *r; - static char *savept; - - /*first or subsequent call*/ - p = (string == NULL)? savept: string; - - if(p == 0) /* return if no tokens remaining */ - return(NULL); - - q = p + strspn(p, sepset); /* skip leading separators */ - - if(*q == '\0') /* return if no tokens remaining */ - return(NULL); - - if((r = strpbrk(q, sepset)) == NULL) /* move past token */ - savept = 0; /* indicate this is last token */ - else { - *r = '\0'; - savept = ++r; - } - return(q); -} diff --git a/usr/src/lib/libbc/libc/gen/common/strtol.c b/usr/src/lib/libbc/libc/gen/common/strtol.c deleted file mode 100644 index 5871be330f..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/strtol.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 2.1 */ - -/*LINTLIBRARY*/ -#include <ctype.h> -#define DIGIT(x) (isdigit(x) ? (x) - '0' : \ - islower(x) ? (x) + 10 - 'a' : (x) + 10 - 'A') -#define MBASE ('z' - 'a' + 1 + 10) - -long -strtol(str, ptr, base) -register char *str; -char **ptr; -register int base; -{ - register long val; - register int c; - int xx, neg = 0; - - if (ptr != (char **)0) - *ptr = str; /* in case no number is formed */ - if (base < 0 || base > MBASE) - return (0); /* base is invalid -- should be a fatal error */ - if (!isalnum(c = *str)) { - while (isspace(c)) - c = *++str; - switch (c) { - case '-': - neg++; - case '+': /* fall-through */ - c = *++str; - } - } - if (base == 0) - if (c != '0') - base = 10; - else if (str[1] == 'x' || str[1] == 'X') - base = 16; - else - base = 8; - /* - * for any base > 10, the digits incrementally following - * 9 are assumed to be "abc...z" or "ABC...Z" - */ - if (!isalnum(c) || (xx = DIGIT(c)) >= base) - return (0); /* no number formed */ - if (base == 16 && c == '0' && isxdigit(str[2]) && - (str[1] == 'x' || str[1] == 'X')) - c = *(str += 2); /* skip over leading "0x" or "0X" */ - for (val = -DIGIT(c); isalnum(c = *++str) && (xx = DIGIT(c)) < base; ) - /* accumulate neg avoids surprises near MAXLONG */ - val = base * val - xx; - if (ptr != (char **)0) - *ptr = str; - return (neg ? val : -val); -} diff --git a/usr/src/lib/libbc/libc/gen/common/swab.c b/usr/src/lib/libbc/libc/gen/common/swab.c deleted file mode 100644 index 19c50d1e99..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/swab.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 4.2 83/06/27 */ - -/* - * Swab bytes - * Jeffrey Mogul, Stanford - */ - -void -swab(from, to, n) - register char *from, *to; - register int n; -{ - register unsigned long temp; - - if (n <= 1) - return; - n >>= 1; n++; -#define STEP temp = *from++,*to++ = *from++,*to++ = temp - /* round to multiple of 8 */ - while ((--n) & 07) - STEP; - n >>= 3; - while (--n >= 0) { - STEP; STEP; STEP; STEP; - STEP; STEP; STEP; STEP; - } -} diff --git a/usr/src/lib/libbc/libc/gen/common/syslog.c b/usr/src/lib/libbc/libc/gen/common/syslog.c deleted file mode 100644 index 8ff41f8e94..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/syslog.c +++ /dev/null @@ -1,331 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * SYSLOG -- print message on log file - * - * This routine looks a lot like printf, except that it - * outputs to the log file instead of the standard output. - * Also: - * adds a timestamp, - * prints the module name in front of the message, - * has some other formatting types (or will sometime), - * adds a newline on the end of the message. - * - * The output of this routine is intended to be read by /etc/syslogd. - * - * Author: Eric Allman - * Modified to use UNIX domain IPC by Ralph Campbell - */ - -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/file.h> -#include <sys/signal.h> -#include <sys/syslog.h> -#include <sys/time.h> -#include <sys/unistd.h> -#include <netdb.h> -#include <strings.h> -#include <stdarg.h> -#include <vfork.h> -#include <stdio.h> -#include <errno.h> -#include <malloc.h> - - -#define MAXLINE 1024 /* max message size */ - -#define PRIMASK(p) (1 << ((p) & LOG_PRIMASK)) -#define PRIFAC(p) (((p) & LOG_FACMASK) >> 3) -#define IMPORTANT LOG_ERR - -static char *logname = "/dev/log"; -static char *ctty = "/dev/console"; -static char *sysmsg = "/dev/sysmsg"; - -static struct _syslog { - int _LogFile; - int _LogStat; - char *_LogTag; - int _LogMask; - struct sockaddr _SyslogAddr; - char *_SyslogHost; - int _LogFacility; -} *_syslog; -#define LogFile (_syslog->_LogFile) -#define LogStat (_syslog->_LogStat) -#define LogTag (_syslog->_LogTag) -#define LogMask (_syslog->_LogMask) -#define SyslogAddr (_syslog->_SyslogAddr) -#define SyslogHost (_syslog->_SyslogHost) -#define LogFacility (_syslog->_LogFacility) - - -extern char *strerror(int); -extern time_t time(); - -void vsyslog(int, char *, va_list); -void openlog(char *, int, int); -static int snprintf(char *, size_t, char *, ...); -static int vsnprintf(char *, size_t, char *, va_list ap); - -static int -allocstatic(void) -{ - _syslog = (struct _syslog *)calloc(1, sizeof (struct _syslog)); - if (_syslog == 0) - return (0); /* can't do it */ - LogFile = -1; /* fd for log */ - LogStat = 0; /* status bits, set by openlog() */ - LogTag = "syslog"; /* string to tag the entry with */ - LogMask = 0xff; /* mask of priorities to be logged */ - LogFacility = LOG_USER; /* default facility code */ - return (1); -} - -void -syslog(int pri, char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vsyslog(pri, fmt, ap); - va_end(ap); -} - -void -vsyslog(int pri, char *fmt, va_list ap) -{ - char buf[MAXLINE + 1], outline[MAXLINE + 1]; - char *b, *f, *o; - int c; - long now; - int pid, olderrno = errno; - int retsiz, outsiz = MAXLINE + 1; - int taglen; -/* - * Maximum tag length is 256 (the pad in outline) minus the size of the - * other things that can go in the pad. - */ -#define MAX_TAG 230 - - - if (_syslog == 0 && !allocstatic()) - return; - - /* see if we should just throw out this message */ - if (pri <= 0 || PRIFAC(pri) >= LOG_NFACILITIES || - (PRIMASK(pri) & LogMask) == 0) - return; - if (LogFile < 0) - openlog(LogTag, LogStat | LOG_NDELAY, 0); - - /* set default facility if none specified */ - if ((pri & LOG_FACMASK) == 0) - pri |= LogFacility; - - /* build the message */ - o = outline; - (void) time(&now); - (void) sprintf(o, "<%d>%.15s ", pri, ctime(&now) + 4); - o += strlen(o); - - if (LogTag) { - taglen = strlen(LogTag) < MAX_TAG ? strlen(LogTag) : MAX_TAG; - strncpy(o, LogTag, taglen); - o[taglen] = '\0'; - o += strlen(o); - } - if (LogStat & LOG_PID) { - (void) sprintf(o, "[%d]", getpid()); - o += strlen(o); - } - if (LogTag) { - (void) strcpy(o, ": "); - o += 2; - } - - b = buf; - f = fmt; - while ((c = *f++) != '\0' && c != '\n' && b < &buf[MAXLINE]) { - char *errstr; - - if (c != '%') { - *b++ = c; - continue; - } - if ((c = *f++) != 'm') { - *b++ = '%'; - *b++ = c; - continue; - } - if ((errstr = strerror(olderrno)) == NULL) - (void) snprintf(b, &buf[MAXLINE] - b, "error %d", - olderrno); - else { - while (*errstr != '\0' && b < &buf[MAXLINE]) { - if (*errstr == '%') { - strcpy(b, "%%"); - b += 2; - } - else - *b++ = *errstr; - errstr++; - } - *b = '\0'; - } - b += strlen(b); - } - if (b > buf && *(b-1) != '\n') /* ensure at least one newline */ - *b++ = '\n'; - *b = '\0'; - (void) vsnprintf(o, &outline[sizeof (outline)] - o, buf, ap); - c = strlen(outline) + 1; /* add one for NULL byte */ - if (c > MAXLINE) { - c = MAXLINE; - outline[MAXLINE-1] = '\0'; - } - - /* output the message to the local logger */ - if (sendto(LogFile, outline, c, 0, &SyslogAddr, - sizeof (SyslogAddr)) >= 0) - return; - if (!(LogStat & LOG_CONS)) - return; - - /* output the message to the console */ - pid = vfork(); - if (pid == -1) - return; - if (pid == 0) { - int fd; - - (void) signal(SIGALRM, SIG_DFL); - (void) sigsetmask(sigblock(0) & ~sigmask(SIGALRM)); - (void) alarm(5); - if (((fd = open(sysmsg, O_WRONLY)) >= 0) || - (fd = open(ctty, O_WRONLY)) >= 0) { - (void) alarm(0); - if (outsiz > 2) { /* Just in case */ - (void) strcat(o, "\r\n"); - c += 2; - } - o = index(outline, '>') + 1; - (void) write(fd, o, c - (o - outline)); - (void) close(fd); - } else - (void) alarm(0); - _exit(0); - } - if (!(LogStat & LOG_NOWAIT)) - while ((c = wait((int *)0)) > 0 && c != pid) - ; -} - -/* - * OPENLOG -- open system log - */ -void -openlog(char *ident, int logstat, int logfac) -{ - if (_syslog == 0 && !allocstatic()) - return; - if (ident != NULL) - LogTag = ident; - LogStat = logstat; - if (logfac != 0) - LogFacility = logfac & LOG_FACMASK; - if (LogFile >= 0) - return; - SyslogAddr.sa_family = AF_UNIX; - (void) strncpy(SyslogAddr.sa_data, logname, - sizeof (SyslogAddr.sa_data)); - if (LogStat & LOG_NDELAY) { - LogFile = socket(AF_UNIX, SOCK_DGRAM, 0); - (void) fcntl(LogFile, F_SETFD, 1); - } -} - -/* - * CLOSELOG -- close the system log - */ -void -closelog(void) -{ - - if (_syslog == 0) - return; - (void) close(LogFile); - LogFile = -1; -} - -/* - * SETLOGMASK -- set the log mask level - */ -int -setlogmask(int pmask) -{ - int omask; - - if (_syslog == 0 && !allocstatic()) - return (-1); - omask = LogMask; - if (pmask != 0) - LogMask = pmask; - return (omask); -} - -/* - * snprintf/vsnprintf -- These routines are here - * temporarily to solve bugid 1220257. Perhaps - * they could become a public interface at some - * point but not for now. - */ - -extern int _doprnt(); - -static int -snprintf(char *string, size_t n, char *format, ...) -{ - int count; - FILE siop; - va_list ap; - - if (n == 0) - return (0); - siop._cnt = n - 1; - siop._base = siop._ptr = (unsigned char *)string; - siop._flag = _IOWRT+_IOSTRG; - va_start(ap, format); - count = _doprnt(format, ap, &siop); - va_end(ap); - *siop._ptr = '\0'; /* plant terminating null character */ - return (count); -} - -static int -vsnprintf(char *string, size_t n, char *format, va_list ap) -{ - int count; - FILE siop; - - if (n == 0) - return (0); - siop._cnt = n - 1; - siop._base = siop._ptr = (unsigned char *)string; - siop._flag = _IOWRT+_IOSTRG; - count = _doprnt(format, ap, &siop); - *siop._ptr = '\0'; /* plant terminating null character */ - return (count); -} diff --git a/usr/src/lib/libbc/libc/gen/common/telldir.c b/usr/src/lib/libbc/libc/gen/common/telldir.c deleted file mode 100644 index 84364cb547..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/telldir.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/param.h> -#include <dirent.h> - -/* - * return a pointer into a directory - */ -long -telldir(dirp) - register DIR *dirp; -{ - return(dirp->dd_off); -} diff --git a/usr/src/lib/libbc/libc/gen/common/tfind.c b/usr/src/lib/libbc/libc/gen/common/tfind.c deleted file mode 100644 index b58036f1bd..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/tfind.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -/* - * Tree search algorithm, generalized from Knuth (6.2.2) Algorithm T. - * - * The NODE * arguments are declared in the lint files as char *, - * because the definition of NODE isn't available to the user. - */ - -#include <search.h> -typedef char *POINTER; -typedef struct node { POINTER key; struct node *llink, *rlink; } NODE; - -#define NULL 0 - - -/* tfind - find a node, or return 0 */ -NODE * -tfind(key, rootp, compar) -POINTER key; /* Key to be located */ -register NODE **rootp; /* Address of the root of the tree */ -int (*compar)(); /* Comparison function */ -{ - if (rootp == NULL) - return (NULL); - while (*rootp != NULL) { /* T1: */ - int r = (*compar)(key, (*rootp)->key); /* T2: */ - if (r == 0) - return (*rootp); /* Key found */ - rootp = (r < 0) ? - &(*rootp)->llink : /* T3: Take left branch */ - &(*rootp)->rlink; /* T4: Take right branch */ - } - return (NODE *)(NULL); -} diff --git a/usr/src/lib/libbc/libc/gen/common/time.c b/usr/src/lib/libbc/libc/gen/common/time.c deleted file mode 100644 index 7b73f79bd8..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/time.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 4.2 83/02/27 */ - -/* - * Backwards compatible time call. - */ -#include <sys/types.h> -#include <sys/time.h> - -time_t -time(t) - time_t *t; -{ - struct timeval tt; - - if (gettimeofday(&tt, (struct timezone *)0) < 0) - return (-1); - if (t) - *t = tt.tv_sec; - return (tt.tv_sec); -} diff --git a/usr/src/lib/libbc/libc/gen/common/tsearch.c b/usr/src/lib/libbc/libc/gen/common/tsearch.c deleted file mode 100644 index 287c84806a..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/tsearch.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -/* - * Tree search algorithm, generalized from Knuth (6.2.2) Algorithm T. - * - * - * The NODE * arguments are declared in the lint files as char *, - * because the definition of NODE isn't available to the user. - */ - -#include <search.h> -#include <stdio.h> -#include <malloc.h> - -typedef char *POINTER; -typedef struct node { POINTER key; struct node *llink, *rlink; } NODE; - -/* - * Find or insert key into search tree - * - * Arguments - * key: Key to be located - * rootp: Address of the root of the tree - * compar: Comparison function - */ -NODE * -tsearch(POINTER key, NODE **rootp, int (*compar)(POINTER, POINTER)) -{ - NODE *q; /* New node if key not found */ - - if (rootp == NULL) - return (NULL); - while (*rootp != NULL) { /* T1: */ - int r = (*compar)(key, (*rootp)->key); /* T2: */ - if (r == 0) - return (*rootp); /* Key found */ - rootp = (r < 0) ? - &(*rootp)->llink : /* T3: Take left branch */ - &(*rootp)->rlink; /* T4: Take right branch */ - } - q = (NODE *) malloc(sizeof(NODE)); /* T5: Not found */ - if (q != NULL) { /* Allocate new node */ - *rootp = q; /* Link new node to old */ - q->key = key; /* Initialize new node */ - q->llink = q->rlink = NULL; - } - return (q); -} - -/* - * Delete node with key key - * - * Arguments - * key: Key to be deleted - * rootp: Address of the root of tree - * compar: Comparison function - */ -NODE * -tdelete(POINTER key, NODE **rootp, int (*compar)(POINTER, POINTER)) -{ - NODE *p; /* Parent of node to be deleted */ - NODE *q; /* Successor node */ - NODE *r; /* Right son node */ - int ans; /* Result of comparison */ - - if (rootp == NULL || (p = *rootp) == NULL) - return (NULL); - while ((ans = (*compar)(key, (*rootp)->key)) != 0) { - p = *rootp; - rootp = (ans < 0) ? - &(*rootp)->llink : /* Take left branch */ - &(*rootp)->rlink; /* Take right branch */ - if (*rootp == NULL) - return (NULL); /* Key not found */ - } - r = (*rootp)->rlink; /* D1: */ - if ((q = (*rootp)->llink) == NULL) /* Llink NULL? */ - q = r; - else if (r != NULL) { /* Rlink NULL? */ - if (r->llink == NULL) { /* D2: Find successor */ - r->llink = q; - q = r; - } else { /* D3: Find NULL link */ - for (q = r->llink; q->llink != NULL; q = r->llink) - r = q; - r->llink = q->rlink; - q->llink = (*rootp)->llink; - q->rlink = (*rootp)->rlink; - } - } - free((POINTER) *rootp); /* D4: Free node */ - *rootp = q; /* Link parent to replacement */ - return (p); -} - -static void _twalk(NODE *, void (*)(NODE *, VISIT, int), int); - -/* - * Walk the nodes of a tree - * - * Arguments - * root: Root of the tree to be walked - * action: Function to be called at each node - */ -void -twalk(NODE *root, void (*action)(NODE *, VISIT, int)) -{ - - if (root != NULL && action != NULL) - _twalk(root, action, 0); -} - -/* - * Walk the nodes of a tree - * - * Arguments - * root: Root of the tree to be walked - * action: Function to be called at each node - */ -static void -_twalk(NODE *root, void (*action)(NODE *, VISIT, int), int level) -{ - if (root->llink == NULL && root->rlink == NULL) - (*action)(root, leaf, level); - else { - (*action)(root, preorder, level); - if (root->llink != NULL) - _twalk(root->llink, action, level + 1); - (*action)(root, postorder, level); - if (root->rlink != NULL) - _twalk(root->rlink, action, level + 1); - (*action)(root, endorder, level); - } -} diff --git a/usr/src/lib/libbc/libc/gen/common/ttyslot.c b/usr/src/lib/libbc/libc/gen/common/ttyslot.c deleted file mode 100644 index 24a132f4f1..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/ttyslot.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1984 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -/* - * Return the number of the slot in the utmp file - * corresponding to the current user: try for file 0, 1, 2. - * To mimic the behavior of getttyent, we loop through utmp - * and try to find an entry with a matching line number. - * If we don't find one we return the index of the end of - * the file, so that the record can be added to the end of - * the file. - */ -#include "../../sys/common/compat.h" -#include <sys/syscall.h> -#include <sys/fcntl.h> -#include <stdio.h> -#include <unistd.h> -#include <strings.h> - -int -ttyslot(void) -{ - char *tp, *p; - int s; - int fd; - struct utmpx utx; - - - if ((tp = ttyname(0)) == NULL && - (tp = ttyname(1)) == NULL && - (tp = ttyname(2)) == NULL) - return (0); - if ((p = rindex(tp, '/')) == NULL) - p = tp; - else - p++; - - if ((fd = _syscall(SYS_openat, - AT_FDCWD, "/etc/utmpx", O_RDONLY)) == -1) { - perror("ttyslot: open of /etc/utmpx failed:"); - return (0); - } - - s = 0; - while (_read(fd, &utx, sizeof (struct utmpx)) > 0) { - s++; - if (strncmp(utx.ut_line, p, sizeof (utx.ut_line)) == 0) { - _syscall(SYS_close, fd); - return (s); - } - } - _syscall(SYS_close, fd); - return (s); -} diff --git a/usr/src/lib/libbc/libc/gen/common/ualarm.c b/usr/src/lib/libbc/libc/gen/common/ualarm.c deleted file mode 100644 index 9972b0b279..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/ualarm.c +++ /dev/null @@ -1,36 +0,0 @@ -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 5.1 85/06/05 */ - -/* - * Copyright (c) 1985 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#include <sys/time.h> - -#define USPS 1000000 /* # of microseconds in a second */ - -/* - * Generate a SIGALRM signal in ``usecs'' microseconds. - * If ``reload'' is non-zero, keep generating SIGALRM - * every ``reload'' microseconds after the first signal. - */ -unsigned -ualarm(usecs, reload) - register unsigned usecs; - register unsigned reload; -{ - struct itimerval new, old; - - new.it_interval.tv_usec = reload % USPS; - new.it_interval.tv_sec = reload / USPS; - - new.it_value.tv_usec = usecs % USPS; - new.it_value.tv_sec = usecs / USPS; - - if (setitimer(ITIMER_REAL, &new, &old) == 0) - return (old.it_value.tv_sec * USPS + old.it_value.tv_usec); - /* else */ - return (-1); -} diff --git a/usr/src/lib/libbc/libc/gen/common/unpack_float.c b/usr/src/lib/libbc/libc/gen/common/unpack_float.c deleted file mode 100644 index b102daeb0c..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/unpack_float.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* IEEE function implementations. */ - -#include "base_conversion.h" - -enum fp_class_type -_class_single(single *x) -{ - single_equivalence kluge; - - kluge.x = *x; - if (kluge.f.msw.exponent == 0) { /* 0 or sub */ - if (kluge.f.msw.significand == 0) - return fp_zero; - else - return fp_subnormal; - } else if (kluge.f.msw.exponent == 0xff) { /* inf or nan */ - if (kluge.f.msw.significand == 0) - return fp_infinity; - else if (kluge.f.msw.significand >= 0x400000) - return fp_quiet; - else - return fp_signaling; - } else - return fp_normal; -} - -enum fp_class_type -_class_extended(extended *x) -{ - extended_equivalence kluge; - - kluge.x[0] = (*x)[0]; - kluge.x[1] = (*x)[1]; - kluge.x[2] = (*x)[2]; - if (kluge.f.msw.exponent == 0) { /* 0 or sub */ - if ((kluge.f.significand == 0) && (kluge.f.significand2 == 0)) - return fp_zero; - else - return fp_subnormal; - } else if (kluge.f.msw.exponent == 0x7fff) { /* inf or nan */ - if (((kluge.f.significand & 0x7fffffff) == 0) && (kluge.f.significand2 == 0)) - return fp_infinity; - else if ((kluge.f.significand & 0x7fffffff) >= 0x40000000) - return fp_quiet; - else - return fp_signaling; - } else - return fp_normal; -} - -void -_unpack_single(unpacked *pu, single *px) -{ - single_equivalence x; - int i; - - x.x = *px; - (*pu).sign = x.f.msw.sign; - for (i = 1; i < UNPACKED_SIZE; i++) - pu->significand[i] = 0; - if (x.f.msw.exponent == 0) { /* zero or sub */ - if (x.f.msw.significand == 0) { /* zero */ - pu->fpclass = fp_zero; - return; - } else { /* subnormal */ - pu->fpclass = fp_normal; - pu->exponent = -SINGLE_BIAS; - pu->significand[0] = x.f.msw.significand << 9; - _fp_normalize(pu); - return; - } - } else if (x.f.msw.exponent == 0xff) { /* inf or nan */ - if (x.f.msw.significand == 0) { /* inf */ - pu->fpclass = fp_infinity; - return; - } else { /* nan */ - if ((x.f.msw.significand & 0x400000) != 0) { /* quiet */ - pu->fpclass = fp_quiet; - } else {/* signaling */ - pu->fpclass = fp_quiet; - _fp_set_exception(fp_invalid); - } - pu->significand[0] = 0x40000000 | (x.f.msw.significand << 8); - return; - } - } - (*pu).exponent = x.f.msw.exponent - SINGLE_BIAS; - (*pu).fpclass = fp_normal; - (*pu).significand[0] = 0x80000000 | (x.f.msw.significand << 8); -} - -void -_unpack_extended(unpacked *pu, extended *px) -{ - extended_equivalence x; - int i; - - x.x[0] = (*px)[0]; - x.x[1] = (*px)[1]; - x.x[2] = (*px)[2]; - pu->sign = x.f.msw.sign; - pu->fpclass = fp_normal; - pu->exponent = x.f.msw.exponent - EXTENDED_BIAS; - pu->significand[0] = x.f.significand; - pu->significand[1] = x.f.significand2; - for (i = 2; i < UNPACKED_SIZE; i++) - pu->significand[i] = 0; - if (x.f.msw.exponent == 0x7fff) { /* inf or nan */ - if (((x.f.significand & 0x7fffffff) == 0) && (x.f.significand2 == 0)) { /* inf */ - pu->fpclass = fp_infinity; - return; - } else { /* nan */ - if ((x.f.significand & 0x40000000) != 0) { /* quiet */ - pu->fpclass = fp_quiet; - } else {/* signaling */ - pu->fpclass = fp_quiet; - _fp_set_exception(fp_invalid); - } - return; - } - } - if (x.f.significand < 0x80000000) { /* zero or unnormal */ - if ((x.f.significand == 0) && (x.f.significand2 == 0)) { /* zero */ - pu->fpclass = fp_zero; - return; - } else { /* unnormal */ - pu->fpclass = fp_normal; - _fp_normalize(pu); - return; - } - } -} - -void -_display_unpacked(unpacked *pu) -{ - int i, e; - - (void) printf(" unpacked "); - if (pu->sign == 1) - (void) printf("-"); - else - (void) printf("+"); - switch (pu->fpclass) { - case fp_zero: - (void) printf("0"); - break; - case fp_infinity: - (void) printf("Infinity"); - break; - case fp_quiet: - (void) printf("NaN(quiet)"); - break; - case fp_signaling: - (void) printf("NaN(signaling)"); - break; - case fp_subnormal: - case fp_normal: - e = 1 + pu->exponent; - for (i = 0; i < UNPACKED_SIZE; i++) { - e -= 32; - (void) printf(" %8X *2**%d + ", pu->significand[i], e); - } - } - (void) printf("\n"); -} diff --git a/usr/src/lib/libbc/libc/gen/common/usleep.c b/usr/src/lib/libbc/libc/gen/common/usleep.c deleted file mode 100644 index 65b5071b36..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/usleep.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 1996 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1985 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#include <unistd.h> -#include <sys/time.h> -#include <signal.h> - -#define USPS 1000000 /* number of microseconds in a second */ -#define TICK (USPS / _sysconf(_SC_CLK_TCK)) - -#define setvec(vec, a) \ - vec.sv_handler = a; vec.sv_mask = vec.sv_onstack = 0 - -static int ringring; - -static void -sleepx(void) -{ - - ringring = 1; -} - -void -usleep(unsigned n) -{ - int omask; - struct itimerval itv, oitv; - struct itimerval *itp = &itv; - struct sigvec vec, ovec; - - if (n == 0) - return; - timerclear(&itp->it_interval); - timerclear(&itp->it_value); - if (setitimer(ITIMER_REAL, itp, &oitv) < 0) - return; - itp->it_value.tv_sec = n / USPS; - itp->it_value.tv_usec = n % USPS; - if (timerisset(&oitv.it_value)) { - if (timercmp(&oitv.it_value, &itp->it_value, >)) { - oitv.it_value.tv_sec -= itp->it_value.tv_sec; - oitv.it_value.tv_usec -= itp->it_value.tv_usec; - if (oitv.it_value.tv_usec < 0) { - oitv.it_value.tv_usec += USPS; - oitv.it_value.tv_sec--; - } - } else { - itp->it_value = oitv.it_value; - oitv.it_value.tv_sec = 0; - oitv.it_value.tv_usec = 2 * TICK; - } - } - setvec(vec, sleepx); - (void) sigvec(SIGALRM, &vec, &ovec); - omask = sigblock(sigmask(SIGALRM)); - ringring = 0; - (void) setitimer(ITIMER_REAL, itp, (struct itimerval *)0); - while (!ringring) - sigpause(omask &~ sigmask(SIGALRM)); - (void) sigvec(SIGALRM, &ovec, (struct sigvec *)0); - (void) sigsetmask(omask); - (void) setitimer(ITIMER_REAL, &oitv, (struct itimerval *)0); -} diff --git a/usr/src/lib/libbc/libc/gen/common/valloc.c b/usr/src/lib/libbc/libc/gen/common/valloc.c deleted file mode 100644 index 68fd6a9efc..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/valloc.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 4.3 83/07/01 */ - -extern unsigned getpagesize(); -extern char *memalign(); - -char * -valloc(size) - unsigned size; -{ - static unsigned pagesize; - if (!pagesize) - pagesize = getpagesize(); - return memalign(pagesize, size); -} diff --git a/usr/src/lib/libbc/libc/gen/common/wcstombs.c b/usr/src/lib/libbc/libc/gen/common/wcstombs.c deleted file mode 100644 index 9520238429..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/wcstombs.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1991 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * wcstombs - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#if !defined(lint) && defined(SCCSIDS) -static char *sccsid = "%Z%%M% %I% %E% SMI"; -#endif - -#include <sys/types.h> -#include "codeset.h" -#include "mbextern.h" - -size_t -wcstombs(s, pwcs, n) - char *s; - wchar_t * pwcs; - size_t n; -{ - char *handle; /* handle */ - int (*p)(); - int num = 0; - int ret; - - switch (_code_set_info.code_id) { - case CODESET_NONE: - /* - * default code set - */ - while (*pwcs && (num < n)) { - *s++ = *pwcs++ & 0x00ff; - num++; - } - if (num < n) - *s = 0; - return (num); - break; - case CODESET_EUC: - /* - * EUC code set - */ - return(_wcstombs_euc(s, pwcs, n)); - break; - - case CODESET_XCCS: - /* - * XCCS code set - */ - return(_wcstombs_xccs(s, pwcs, n)); - break; - - case CODESET_ISO2022: - /* - * ISO family - */ - return(_wcstombs_iso(s, pwcs, n)); - break; - - default: - /* - * User defined code set - */ - handle = _ml_open_library(); - if (handle == (char *)NULL) - return(ERROR_NO_LIB); /* No user library */ - p = (int (*)()) dlsym(handle, "_wcstombs"); - if (p == (int (*)()) NULL) - return(ERROR_NO_SYM); - ret = (*p)(s, pwcs, n); - return (ret); - break; - } - /* NOTREACHED */ -} diff --git a/usr/src/lib/libbc/libc/gen/common/wctomb.c b/usr/src/lib/libbc/libc/gen/common/wctomb.c deleted file mode 100644 index dba8d0999d..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/wctomb.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1991 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * wctomb - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#if !defined(lint) && defined(SCCSIDS) -static char *sccsid = "%Z%%M% %I% %E% SMI"; -#endif - -#include <sys/types.h> -#include "codeset.h" -#include "mbextern.h" - -int -wctomb(s, pwc) - char *s; - wchar_t pwc; -{ - char *handle; /* handle */ - int (*p)(); - int ret; - - switch (_code_set_info.code_id) { - case CODESET_NONE: - /* - * Default code set, - */ - if (s == NULL) - return (0); /* No state dependency */ - else { - *s = (char) (pwc & 0x00ff); - return (1); - } - case CODESET_EUC: - /* - * EUC code set - */ - if (s == NULL) - return (0); /* No state dependecy */ - return(_wctomb_euc(s, pwc)); - break; - - case CODESET_XCCS: - /* - * XCCS code set - */ - if (s == 0) - return (0); /* No state dependecy */ - return(_wctomb_xccs(s, pwc)); - break; - - case CODESET_ISO2022: - /* - * ISO family - */ - if (s == 0) - return (1); /* State dependant */ - return(_wctomb_iso(s, pwc)); - break; - - default: - /* - * User defined code set - */ - handle = _ml_open_library(); - if (handle == (char *)NULL) - return(ERROR_NO_LIB); /* No user library */ - p = (int (*)()) dlsym(handle, "_wctomb"); - if (p == (int (*)()) NULL) - return(ERROR_NO_SYM); - ret = (*p)(s, pwc); - return (ret); - break; - } - /* NOTREACHED */ -} diff --git a/usr/src/lib/libbc/libc/gen/common/xccs.multibyte.c b/usr/src/lib/libbc/libc/gen/common/xccs.multibyte.c deleted file mode 100644 index 6685f4d707..0000000000 --- a/usr/src/lib/libbc/libc/gen/common/xccs.multibyte.c +++ /dev/null @@ -1,342 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#if !defined(lint) && defined(SCCSIDS) -static char *sccsid = "%Z%%M% %I% %E% SMI"; -#endif - -#include <stdio.h> -#include <sys/types.h> - -#define CS377 0377 -#define MASK 0x0000ffff -#define TOP1 0x80000000 -#define TOP2 0x08000000 - - -/* - * mbtowc routines for the Xerox XCCS codeset standard - */ -int -_mbtowc_xccs(pwc, s, n) - wchar_t *pwc; - char *s; - int n; -{ - static unsigned int CSselect = 0; - static int CSlength = 1; - wchar_t twchar = 0; - - /* - * If length is negative, return error - */ - if (n <= 0) - return (-1); - - /* - * End of string ? - */ - if (*s == 0 && CSlength == 1) - return (0); - if (*s == 0 && *(s + 1) == 0 && CSlength == 2) - return (0); - - /* - * Get a character - */ - if ((unsigned char)*s == CS377) { - /* - * Switching code set - */ - ++s; - /* - * Change characteristics - */ - if ((unsigned char)*s == CS377) { - ++s; - /* - * two byte sequence - */ - if (*s++ != 0) - return (-1); - CSselect = 0; - CSlength = 2; - - } - else { - /* - * Change CSselect - */ - CSselect = (unsigned int)*s++; - CSlength = 1; - } - } - - /* - * Get a character and return - */ - if (CSlength == 1) { - twchar = CSselect; - } - else { - twchar = *s++; - } - twchar = twchar << 8; - twchar = twchar | *s; - if (pwc) - *pwc = twchar & MASK; - /* - * Encode additional information - */ - if (CSlength == 2) - if (pwc) - *pwc |= TOP1; - return (CSlength); -} - -/* - * wctomb routines - */ -int -_wctomb_xccs(s, pwc) - char *s; - wchar_t pwc; -{ - unsigned char upper, lower; - char *old = s; -#ifdef DEBUG - printf ("XCCS- xctomb\n"); -#endif - - if (!s) - return (0); - - /* - * Get lower and upper anyway - */ - lower = pwc & 0x00ff; - upper = (pwc >> 8) & 0x00ff; - if (lower == CS377 || upper == CS377) - return (-1); - if (pwc & TOP1) { /* length == 2 */ - /* - * This was the marker. - * Emitt 3 additional characters. - */ - *s++ = CS377; - *s++ = CS377; - *s++ = 0; - *s++ = upper; - *s++ = lower; - } - else { - /* - * This was the marker. - * Emitt 2 additional characters. - */ - *s++ = CS377; - *s++ = upper; - *s++ = lower; - } - return (s - old); -} - - -/* - * mbstowcs routines - */ -size_t -_mbstowcs_xccs(pwc, s, n) - wchar_t *pwc; - char *s; - int n; -{ - static unsigned int CSselect = 0; - static int CSlength = 1; - wchar_t twchar = 0; - int cnt = 0; - - /* - * If length is negative, return error - */ - if (n <= 0) - return (-1); - - /* - * End of string ? - */ - if (*s == 0 && CSlength == 1) - return (0); - if (*s == 0 && *(s + 1) == 0 && CSlength == 2) - return (0); - - do { - /* - * Check for an end of the string - */ - if (((*s == 0 && CSlength == 1)) || - ((*s == 0 && *(s + 1) == 0 && CSlength == 2))) { - *pwc = 0; - ++cnt; - --n; - break; - } - /* - * Get a character - */ - if ((unsigned char)*s == CS377) { - ++s; - /* - * Change characterristics - */ - if ((unsigned char)*s == CS377) { - ++s; - /* - * two byte sequence - */ - if (*s++ != 0) - return (-1); - CSselect = 0; - CSlength = 2; - - } - else { - /* - * Change CSselect - */ - CSselect = (unsigned int)*s++; - CSlength = 1; - } - } - - /* - * Get a character and return - */ - if (CSlength == 1) { - twchar = CSselect; - } - else { - twchar = *s++; - } - twchar = twchar << 8; - twchar = twchar | *s++; - *pwc = twchar & MASK; - if (CSlength == 2) - *pwc |= TOP1; - ++pwc; - ++cnt; - --n; - } while (n >= 0); - return (cnt); -} - - -/* - * wcstombs routines - */ -size_t -_wcstombs_xccs(s, pwc, n) - char *s; - wchar_t *pwc; - int n; -{ - int cnt = 0; - unsigned char lower, upper; - int in_2byte = 0; - int in_1byte = 0; - int current = 0; - - if (n <= 0) - return (-1); - - if (*pwc == 0) - return (0); - - do { - lower = *pwc & 0x00ff; - upper = (*pwc >> 8) & 0x00ff; - /* - * End of string ? - */ - if (lower == 0) { - *s++ = 0; - ++cnt; - --n; - if (n == 0) - break; - *s++ = 0; - ++cnt; - break; - } - if (lower == CS377 || upper == CS377) - return (-1); - if (*pwc & TOP1) { /* length == 2 */ - if (in_2byte == 0) { - /* - * This was the marker. - * Emitt 3 additional characters. - */ - *s++ = CS377; ++cnt; --n; - *s++ = CS377; ++cnt; --n; - *s++ = 0; ++cnt; --n; - in_2byte = 1; - in_1byte = 0; - } - *s++ = upper; ++cnt; --n; - if (n == 0) - break; - *s++ = lower; ++cnt; --n; - if (n == 0) - break; - } - else { - if ((in_1byte == 0 && in_2byte == 1) || - (in_1byte == 1 && upper != current) || - (in_1byte == 0 && in_2byte == 0 && upper != 0)) { - /* - * This was the marker. - * Emitt 2 additional characters. - */ - *s++ = CS377; ++cnt; --n; - if (n == 0) - break; - *s++ = upper; ++cnt; --n; - if (n == 0) - break; - in_2byte = 0; - in_1byte = 1; - current = upper; - } - *s++ = lower; ++cnt; --n; - if (n == 0) - break; - } - ++pwc; - } while (n >= 0); - return (cnt); -} diff --git a/usr/src/lib/libbc/libc/gen/sys5/assert.c b/usr/src/lib/libbc/libc/gen/sys5/assert.c deleted file mode 100644 index 21865bf4f4..0000000000 --- a/usr/src/lib/libbc/libc/gen/sys5/assert.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -/* - * called from "assert" macro; prints without printf or stdio. - */ - -#include <malloc.h> - -#define WRITE(s, n) (void) write(2, (s), (n)) -#define WRITESTR(s1, n, s2) WRITE((s1), n), \ - WRITE((s2), (unsigned) strlen(s2)) - -#define LINESTR ", line NNNNN\n" - -void -_assert(char *assertion, char *filename, int line_num) -{ - static char *linestr; - char *p; - int div, digit; - - if (!linestr) { - linestr = malloc(strlen(LINESTR)+1); - strcpy(linestr, LINESTR); - } - p = &linestr[7]; - - WRITESTR("Assertion failed: ", 18, assertion); - WRITESTR(", file ", 7, filename); - for (div = 10000; div != 0; line_num %= div, div /= 10) - if ((digit = line_num/div) != 0 || p != &linestr[7] || div == 1) - *p++ = digit + '0'; - *p++ = '\n'; - *p = '\0'; - WRITE(linestr, (unsigned) strlen(linestr)); - (void) abort(); -} diff --git a/usr/src/lib/libbc/libc/gen/sys5/nlist.c b/usr/src/lib/libbc/libc/gen/sys5/nlist.c deleted file mode 100644 index cfaa36325b..0000000000 --- a/usr/src/lib/libbc/libc/gen/sys5/nlist.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/file.h> -#include <a.out.h> - -/* - * nlist - retreive attributes from name list (string table version) - * [The actual work is done in ../common/_nlist.c] - */ -int -nlist(char *name, struct nlist *list) -{ - int fd; - - fd = open(name, O_RDONLY, 0); - (void) _nlist(fd, list); - close(fd); - return (0); -} diff --git a/usr/src/lib/libbc/libc/gen/sys5/sgetl.c b/usr/src/lib/libbc/libc/gen/sys5/sgetl.c deleted file mode 100644 index 8904cc103e..0000000000 --- a/usr/src/lib/libbc/libc/gen/sys5/sgetl.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" -/* - * Provide machine independent transfer of longs. - */ - -/* - * The intent here is to provide a means to make the value of - * bytes in an io-buffer correspond to the value of a long - * in the memory while doing the io a `long' at a time. - * Files written and read in this way are machine-independent. - * - */ -#include <values.h> - -long sgetl(buffer) -register char *buffer; -{ - register long l = 0; - register int i = BITSPERBYTE * sizeof(long); - - while ((i -= BITSPERBYTE) >= 0) - l |= (short) ((unsigned char) *buffer++) << i; - return l; - } - diff --git a/usr/src/lib/libbc/libc/gen/sys5/sighold.c b/usr/src/lib/libbc/libc/gen/sys5/sighold.c deleted file mode 100644 index d0b304dd72..0000000000 --- a/usr/src/lib/libbc/libc/gen/sys5/sighold.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1987 Sun Microsystems, Inc. - */ - -#include <errno.h> -#include <sys/signal.h> - -int -sighold(sig) - int sig; -{ - - if (sig == SIGKILL) { - errno = EINVAL; - return (-1); /* sigblock quietly disallows SIGKILL */ - } - (void) sigblock(sigmask(sig)); - return (0); /* SVID specifies 0 return on success */ -} - -int -sigrelse(sig) - int sig; -{ - - if (sig == SIGKILL) { - errno = EINVAL; - return (-1); /* sigsetmask quietly disallows SIGKILL */ - } - (void) sigsetmask(sigblock(0) & ~sigmask(sig)); - return (0); /* SVID specifies 0 return on success */ -} - -int -sigignore(sig) - int sig; -{ - struct sigvec vec; - - if (sig == SIGKILL) { - errno = EINVAL; - return (-1); /* sigsetmask quietly disallows SIGKILL */ - } - if (sigvec(sig, (struct sigvec *)0, &vec) < 0) - return (-1); - vec.sv_handler = SIG_IGN; - if (sigvec(sig, &vec, (struct sigvec *)0) < 0) - return (-1); - (void) sigsetmask(sigblock(0) & ~sigmask(sig)); - return (0); /* SVID specifies 0 return on success */ -} - -void (* -sigset(sig, func))() - int sig; - void (*func)(); -{ - struct sigvec newvec; - int newmask; - struct sigvec oldvec; - int oldmask; - - if (sigvec(sig, (struct sigvec *)0, &oldvec) < 0) - return (SIG_ERR); - oldmask = sigblock(0); - newvec = oldvec; - newvec.sv_flags |= SV_INTERRUPT; - newvec.sv_flags &= ~SV_RESETHAND; - newvec.sv_mask = 0; - newmask = oldmask; - if (func == SIG_HOLD) { - /* - * Signal will be held. Set the bit for that - * signal in the signal mask. Leave the action - * alone. - */ - newmask |= sigmask(sig); - } else { - /* - * Signal will not be held. Clear the bit - * for it in the signal mask. Set the action - * for it. - */ - newmask &= ~sigmask(sig); - newvec.sv_handler = func; - } - if (sigvec(sig, &newvec, (struct sigvec *)0) < 0) - return (SIG_ERR); - if (sigsetmask(newmask) < 0) - return (SIG_ERR); - if (oldmask & sigmask(sig)) - return (SIG_HOLD); /* signal was held */ - else - return (oldvec.sv_handler); -} diff --git a/usr/src/lib/libbc/libc/gen/sys5/sleep.c b/usr/src/lib/libbc/libc/gen/sys5/sleep.c deleted file mode 100644 index 1e6dbbbc29..0000000000 --- a/usr/src/lib/libbc/libc/gen/sys5/sleep.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 1986 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1980 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/time.h> -#include <signal.h> - -#define setvec(vec, a) \ - vec.sv_handler = a; vec.sv_mask = vec.sv_onstack = 0 - -static void sleepx(void); - -/* - * sleep(n) - * - * return 0 if n seconds passed - * return n - t if t seconds passed - * - * this code is gross and works just barely. - * it would be nice if someone rewrote it. - */ -unsigned -sleep(unsigned n) -{ - int omask; - struct itimerval new, old, zero; - struct itimerval *newp = &new; - struct timeval left_over; - int alrm_flg; - struct sigvec vec, ovec; - - if (n == 0) - return(0); - timerclear(&newp->it_interval); - timerclear(&newp->it_value); - if (setitimer(ITIMER_REAL, newp, &old) < 0) - return(n); - newp->it_value.tv_sec = n; - alrm_flg = 0; - timerclear(&left_over); - if (timerisset(&old.it_value)) { - if (timercmp(&old.it_value, &newp->it_value, >)) { - old.it_value.tv_sec -= newp->it_value.tv_sec; - ++alrm_flg; - } else { - left_over.tv_sec = newp->it_value.tv_sec - - old.it_value.tv_sec; - if (old.it_value.tv_usec != 0) { - left_over.tv_sec--; - left_over.tv_usec = 1000000 - - old.it_value.tv_usec; - } - newp->it_value = old.it_value; - timerclear(&old.it_value); - --alrm_flg; - } - } - if (alrm_flg >= 0) { - setvec(vec, sleepx); - (void) sigvec(SIGALRM, &vec, &ovec); - } - omask = sigblock(sigmask(SIGALRM)); - (void) setitimer(ITIMER_REAL, newp, (struct itimerval *)0); - sigpause(omask &~ sigmask(SIGALRM)); - timerclear(&zero.it_value); - timerclear(&zero.it_interval); - (void) setitimer(ITIMER_REAL, &zero, newp); - if (alrm_flg >= 0) - (void) sigvec(SIGALRM, &ovec, (struct sigvec *)0); - (void) sigsetmask(omask); - if (alrm_flg > 0 || (alrm_flg < 0 && timerisset(&newp->it_value))) { - struct itimerval reset; - - /* - * I use reset instead of what new points to because the - * code that calculates the return value depends on the - * old value of *newp. - */ - reset = *newp; - newp = &reset; - newp->it_value.tv_usec += old.it_value.tv_usec; - newp->it_value.tv_sec += old.it_value.tv_sec; - if (newp->it_value.tv_usec >= 1000000) { - newp->it_value.tv_usec -= 1000000; - newp->it_value.tv_sec++; - } - (void) setitimer(ITIMER_REAL, newp, (struct itimerval *)0); - newp = &new; - } - left_over.tv_sec += newp->it_value.tv_sec; - left_over.tv_usec += newp->it_value.tv_usec; - if (left_over.tv_usec >= 1000000) { - left_over.tv_sec++; - left_over.tv_usec -= 1000000; - } - if (left_over.tv_usec >= 500000) - left_over.tv_sec++; - return(left_over.tv_sec); -} - -static void -sleepx(void) -{ -} diff --git a/usr/src/lib/libbc/libc/gen/sys5/sputl.c b/usr/src/lib/libbc/libc/gen/sys5/sputl.c deleted file mode 100644 index 9867b878d8..0000000000 --- a/usr/src/lib/libbc/libc/gen/sys5/sputl.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" -/* - * Provide machine independent transfer of longs. - */ - -/* - * The intent here is to provide a means to make the value of - * bytes in an io-stream correspond to the value of the long - * in the memory while doing the io a `long' at a time. - * Files written and read in this way are machine-independent. - * - */ -#include <values.h> - -void sputl(l, buffer) -register long l; -register char *buffer; -{ - register int i = BITSPERBYTE * sizeof(long); - - while ((i -= BITSPERBYTE) >= 0) - *buffer++ = (char) (l >> i); -} - diff --git a/usr/src/lib/libbc/libc/gen/sys5/system.c b/usr/src/lib/libbc/libc/gen/sys5/system.c deleted file mode 100644 index 9919b3bbc3..0000000000 --- a/usr/src/lib/libbc/libc/gen/sys5/system.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1992 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -#include <signal.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <string.h> -#include <sys/file.h> - -extern int execl(); - -int -system(s) -char *s; -{ - int status; - pid_t pid, w; - register void (*istat)(), (*qstat)(); - char path[256]; - char *c; - - while (*s == ' ' || *s == '\t') - s++; - - if (strncmp(s, "/usr/ucb", strlen("/usr/ucb")) == 0) { - /* check if command is under /usr/ucb, if not - * replace /usr/ucb with /usr/bin. - */ - strcpy(path, s); - if ((c = strchr(path, ' ')) != NULL) - *c ='\0'; - if (access(path, F_OK) == -1) { - strncpy(path, "/usr/bin", strlen("/usr/bin")); - if (c != NULL) *c = ' '; - s = path; - } - } - else if (strncmp(s, "/bin", strlen("/bin")) == 0 || - strncmp(s, "/usr/bin", strlen("/usr/bin")) == 0) { - /* if /usr/bin is specified, first check if the command - * exists under /usr/bin, otherwise try /usr/ucb */ - if (access(path, F_OK) == -1) { - strcpy(path, "/usr/ucb"); - if (strncmp(s, "/bin", strlen("/bin")) == 0) - strcat(path, strchr(s+1, '/')); - else { - c = strchr(s+1, '/'); - strcat(path, strchr(c+1, '/')); - } - if (c != NULL) *c = ' '; - s = path; - } - } - - if ((pid = vfork()) == 0) { - (void) execl("/bin/sh", "sh", "-c", s, (char *)0); - _exit(127); - } - if (pid == -1) { - return (-1); - } - istat = signal(SIGINT, SIG_IGN); - qstat = signal(SIGQUIT, SIG_IGN); - w = waitpid(pid, &status, 0); - (void) signal(SIGINT, istat); - (void) signal(SIGQUIT, qstat); - return ((w == -1) ? -1: status); -} diff --git a/usr/src/lib/libbc/libc/inet/inet_addr.c b/usr/src/lib/libbc/libc/inet/inet_addr.c deleted file mode 100644 index ac347b1965..0000000000 --- a/usr/src/lib/libbc/libc/inet/inet_addr.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 4.5 82/11/14 */ - -#include <sys/types.h> -#include <ctype.h> -#include <netinet/in.h> - -/* - * Internet address interpretation routine. - * All the network library routines call this - * routine to interpret entries in the data bases - * which are expected to be an address. - * The value returned is in network order. - */ -u_long -inet_addr(cp) - register char *cp; -{ - register u_long val, base, n; - register char c; - u_long parts[4], *pp = parts; - -again: - /* - * Collect number up to ``.''. - * Values are specified as for C: - * 0x=hex, 0=octal, other=decimal. - */ - val = 0; base = 10; - if (*cp == '0') { - if (*++cp == 'x' || *cp == 'X') - base = 16, cp++; - else - base = 8; - } - while (c = *cp) { - if (isdigit(c)) { - if ((c - '0') >= base) - break; - val = (val * base) + (c - '0'); - cp++; - continue; - } - if (base == 16 && isxdigit(c)) { - val = (val << 4) + (c + 10 - (islower(c) ? 'a' : 'A')); - cp++; - continue; - } - break; - } - if (*cp == '.') { - /* - * Internet format: - * a.b.c.d - * a.b.c (with c treated as 16-bits) - * a.b (with b treated as 24 bits) - */ - if (pp >= parts + 4) - return (-1); - *pp++ = val, cp++; - goto again; - } - /* - * Check for trailing characters. - */ - if (*cp && !isspace(*cp)) - return (-1); - *pp++ = val; - /* - * Concoct the address according to - * the number of parts specified. - */ - n = pp - parts; - switch (n) { - - case 1: /* a -- 32 bits */ - val = parts[0]; - break; - - case 2: /* a.b -- 8.24 bits */ - val = (parts[0] << 24) | (parts[1] & 0xffffff); - break; - - case 3: /* a.b.c -- 8.8.16 bits */ - val = (parts[0] << 24) | ((parts[1] & 0xff) << 16) | - (parts[2] & 0xffff); - break; - - case 4: /* a.b.c.d -- 8.8.8.8 bits */ - val = (parts[0] << 24) | ((parts[1] & 0xff) << 16) | - ((parts[2] & 0xff) << 8) | (parts[3] & 0xff); - break; - - default: - return (-1); - } - val = htonl(val); - return (val); -} diff --git a/usr/src/lib/libbc/libc/inet/inet_lnaof.c b/usr/src/lib/libbc/libc/inet/inet_lnaof.c deleted file mode 100644 index 8a33c9655c..0000000000 --- a/usr/src/lib/libbc/libc/inet/inet_lnaof.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1983 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <netinet/in.h> - -/* - * Return the local network address portion of an - * internet address; handles class a/b/c network - * number formats. - */ -int -inet_lnaof(struct in_addr in) -{ - u_long i = ntohl(in.s_addr); - - if (IN_CLASSA(i)) - return ((i)&IN_CLASSA_HOST); - else if (IN_CLASSB(i)) - return ((i)&IN_CLASSB_HOST); - else - return ((i)&IN_CLASSC_HOST); -} diff --git a/usr/src/lib/libbc/libc/inet/inet_makeaddr.c b/usr/src/lib/libbc/libc/inet/inet_makeaddr.c deleted file mode 100644 index ffa52390a9..0000000000 --- a/usr/src/lib/libbc/libc/inet/inet_makeaddr.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2001 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * University Copyright- Copyright (c) 1982, 1986, 1988 - * The Regents of the University of California - * All Rights Reserved - * - * University Acknowledgment- Portions of this document are derived from - * software developed by the University of California, Berkeley, and its - * contributors. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 4.4 85/06/02 */ - -#include <sys/types.h> -#include <netinet/in.h> - -/* - * Formulate an Internet address from network + host. Used in - * building addresses stored in the ifnet structure. - */ -struct in_addr -inet_makeaddr(net, host) - int net, host; -{ - ulong_t addr; - struct in_addr inaddr; - - if (net < 128) - addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST); - else if (net < 65536) - addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST); - else - addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST); - inaddr.s_addr = htonl(addr); - return (inaddr); -} diff --git a/usr/src/lib/libbc/libc/inet/inet_netof.c b/usr/src/lib/libbc/libc/inet/inet_netof.c deleted file mode 100644 index 19587623e8..0000000000 --- a/usr/src/lib/libbc/libc/inet/inet_netof.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1983 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <netinet/in.h> - -/* - * Return the network number from an internet - * address; handles class a/b/c network #'s. - */ -int -inet_netof(struct in_addr in) -{ - u_long i = ntohl(in.s_addr); - - if (IN_CLASSA(i)) - return (((i)&IN_CLASSA_NET) >> IN_CLASSA_NSHIFT); - else if (IN_CLASSB(i)) - return (((i)&IN_CLASSB_NET) >> IN_CLASSB_NSHIFT); - else - return (((i)&IN_CLASSC_NET) >> IN_CLASSC_NSHIFT); -} diff --git a/usr/src/lib/libbc/libc/inet/inet_network.c b/usr/src/lib/libbc/libc/inet/inet_network.c deleted file mode 100644 index cd7f1c692d..0000000000 --- a/usr/src/lib/libbc/libc/inet/inet_network.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 4.2 82/10/07 */ - -#include <sys/types.h> -#include <ctype.h> - -/* - * Internet network address interpretation routine. - * The library routines call this routine to interpret - * network numbers. - */ -u_long -inet_network(cp) - register char *cp; -{ - register u_long val, base, n; - register char c; - u_long parts[4], *pp = parts; - register int i; - -again: - val = 0; base = 10; - if (*cp == '0') { - if (*++cp == 'x' || *cp == 'X') - base = 16, cp++; - else - base = 8; - } - while ((c = *cp) != '\0') { - if (isdigit(c)) { - if ((c - '0') >= base) - break; - val = (val * base) + (c - '0'); - cp++; - continue; - } - if (base == 16 && isxdigit(c)) { - val = (val << 4) + (c + 10 - (islower(c) ? 'a' : 'A')); - cp++; - continue; - } - break; - } - if (pp >= parts + 4 || val > 0xff) - return (-1); - *pp++ = val; - if (*cp == '.') { - cp++; - goto again; - } - if (*cp != '\0' && !isspace(*cp)) - return (-1); - n = pp - parts; - for (val = 0, i = 0; i < n; i++) { - val <<= 8; - val |= parts[i]; - } - return (val); -} diff --git a/usr/src/lib/libbc/libc/inet/inet_ntoa.c b/usr/src/lib/libbc/libc/inet/inet_ntoa.c deleted file mode 100644 index d8fdd91ca3..0000000000 --- a/usr/src/lib/libbc/libc/inet/inet_ntoa.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - /* from UCB 4.1 83/06/12 */ - -/* - * Convert network-format internet address - * to base 256 d.d.d.d representation. - */ -#include <sys/types.h> -#include <netinet/in.h> - -char * -inet_ntoa(in) - struct in_addr in; -{ - static char b[18]; - register char *p; - - p = (char *)∈ -#define UC(b) (((int)b)&0xff) - sprintf(b, "%d.%d.%d.%d", UC(p[0]), UC(p[1]), UC(p[2]), UC(p[3])); - return (b); -} diff --git a/usr/src/lib/libbc/libc/net/authunix.c b/usr/src/lib/libbc/libc/net/authunix.c deleted file mode 100644 index 2f7671ee75..0000000000 --- a/usr/src/lib/libbc/libc/net/authunix.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1992 by Sun Microsystems, Inc. - */ - - -#include <rpc/types.h> -#include <rpc/auth.h> - -#undef authunix_create -#undef authunix_create_default - -AUTH * -authunix_create(machname, uid, gid, len, aup_gids) - char *machname; - uid_t uid; - gid_t gid; - register int len; - gid_t *aup_gids; -{ - return(authsys_create(machname, uid, gid, len, aup_gids)); -} - - - -AUTH * -authunix_create_default() -{ - return(authsys_create_default()); -} diff --git a/usr/src/lib/libbc/libc/net/bindresvport.c b/usr/src/lib/libbc/libc/net/bindresvport.c deleted file mode 100644 index 944a4d1f66..0000000000 --- a/usr/src/lib/libbc/libc/net/bindresvport.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <errno.h> -#include <sys/socket.h> -#include <netinet/in.h> - -/* - * Bind a socket to a privileged IP port - */ -int -bindresvport(int sd, struct sockaddr_in *sin) -{ - int res; - static short port; - struct sockaddr_in myaddr; - int i; - -#define STARTPORT 600 -#define ENDPORT (IPPORT_RESERVED - 1) -#define NPORTS (ENDPORT - STARTPORT + 1) - - if (sin == (struct sockaddr_in *)0) { - sin = &myaddr; - bzero(sin, sizeof (*sin)); - sin->sin_family = AF_INET; - } else if (sin->sin_family != AF_INET) { - errno = EPFNOSUPPORT; - return (-1); - } - if (port == 0) { - port = (getpid() % NPORTS) + STARTPORT; - } - res = -1; - errno = EADDRINUSE; - for (i = 0; i < NPORTS && res < 0 && errno == EADDRINUSE; i++) { - sin->sin_port = htons(port++); - if (port > ENDPORT) { - port = STARTPORT; - } - res = bind(sd, sin, sizeof(struct sockaddr_in)); - } - return (res); -} diff --git a/usr/src/lib/libbc/libc/net/ether_addr.c b/usr/src/lib/libbc/libc/net/ether_addr.c deleted file mode 100644 index e62f3ae674..0000000000 --- a/usr/src/lib/libbc/libc/net/ether_addr.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * All routines necessary to deal with the file /etc/ethers. The file - * contains mappings from 48 bit ethernet addresses to their corresponding - * hosts name. The addresses have an ascii representation of the form - * "x:x:x:x:x:x" where x is a hex number between 0x00 and 0xff; the - * bytes are always in network order. - */ - -#include <stdio.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <net/if.h> -#include <netinet/in.h> -#include <net/if_arp.h> -#include <netinet/if_ether.h> - -static char *domain; /* NIS domain name */ -static int usingyellow; -static char *ethers = "/etc/ethers"; - -/* - * Parses a line from /etc/ethers into its components. The line has the form - * 8:0:20:1:17:c8 krypton - * where the first part is a 48 bit ethernet addrerss and the second is - * the corresponding hosts name. - * Returns zero if successful, non-zero otherwise. - * - * Arguments - * s: the string to be parsed - * e: ethernet address struct to be filled in - * hostname: hosts name to be set - */ -int -ether_line(char *s, struct ether_addr *e, char *hostname) -{ - int i; - unsigned int t[6]; - - i = sscanf(s, " %x:%x:%x:%x:%x:%x %s", - &t[0], &t[1], &t[2], &t[3], &t[4], &t[5], hostname); - if (i != 7) { - return (7 - i); - } - for (i = 0; i < 6; i++) - e->ether_addr_octet[i] = t[i]; - return (0); -} - -/* - * Converts a 48 bit ethernet number to its string representation. - */ -#define EI(i) (unsigned int)(e->ether_addr_octet[(i)]) -char * -ether_ntoa(struct ether_addr *e) -{ - static char *s; - - if (s == 0) { - s = (char *)malloc(18); - if (s == 0) - return (0); - } - s[0] = 0; - sprintf(s, "%x:%x:%x:%x:%x:%x", - EI(0), EI(1), EI(2), EI(3), EI(4), EI(5)); - return (s); -} - -/* - * Converts a ethernet address representation back into its 48 bits. - */ -struct ether_addr * -ether_aton(char *s) -{ - static struct ether_addr *ep; - int i; - unsigned int t[6]; - - if (ep == 0) { - ep = (struct ether_addr *)calloc(1, sizeof (struct ether_addr)); - if (ep == 0) - return (0); - } - i = sscanf(s, " %x:%x:%x:%x:%x:%x", - &t[0], &t[1], &t[2], &t[3], &t[4], &t[5]); - if (i != 6) - return ((struct ether_addr *)NULL); - for (i = 0; i < 6; i++) - ep->ether_addr_octet[i] = t[i]; - return (ep); -} diff --git a/usr/src/lib/libbc/libc/net/getrpcport.c b/usr/src/lib/libbc/libc/net/getrpcport.c deleted file mode 100644 index 4f12c21a11..0000000000 --- a/usr/src/lib/libbc/libc/net/getrpcport.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1985 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <rpc/rpc.h> -#include <netdb.h> -#include <sys/socket.h> - -int -getrpcport(char *host, int prognum, int versnum, int proto) -{ - struct sockaddr_in addr; - struct hostent *hp; - - if ((hp = gethostbyname(host)) == NULL) - return (0); - bcopy(hp->h_addr, (char *) &addr.sin_addr, hp->h_length); - addr.sin_family = AF_INET; - addr.sin_port = 0; - return (pmap_getport(&addr, prognum, versnum, proto)); -} diff --git a/usr/src/lib/libbc/libc/net/rcmd.c b/usr/src/lib/libbc/libc/net/rcmd.c deleted file mode 100644 index 89e8f79f44..0000000000 --- a/usr/src/lib/libbc/libc/net/rcmd.c +++ /dev/null @@ -1,391 +0,0 @@ -/* - * Copyright 1995 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <ctype.h> -#include <pwd.h> -#include <sys/param.h> -#include <sys/file.h> -#include <sys/signal.h> -#include <sys/socket.h> -#include <sys/stat.h> - -#include <netinet/in.h> - -#include <netdb.h> -#include <errno.h> - -#include <strings.h> - -static char *domain; - -int -rcmd( - char **ahost, - unsigned short rport, - const char *locuser, - const char *remuser, - const char *cmd, - int *fd2p) -{ - int s, timo = 1, pid, oldmask, retval; - struct sockaddr_in sin, from; - char c; - int lport = IPPORT_RESERVED - 1; - struct hostent *hp; - - pid = getpid(); - hp = gethostbyname(*ahost); - if (hp == 0) { - fprintf(stderr, "%s: unknown host\n", *ahost); - return (-1); - } - *ahost = hp->h_name; - oldmask = sigblock(sigmask(SIGURG)); - for (;;) { - s = rresvport(&lport); - if (s < 0) { - if (errno == EAGAIN) - fprintf(stderr, "socket: All ports in use\n"); - else - perror("rcmd: socket"); - sigsetmask(oldmask); - return (-1); - } - fcntl(s, F_SETOWN, pid); - sin.sin_family = hp->h_addrtype; - bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr, hp->h_length); - sin.sin_port = rport; - if (connect(s, &sin, sizeof (sin)) >= 0) - break; - (void) close(s); - if (errno == EADDRINUSE) { - lport--; - continue; - } - if (errno == ECONNREFUSED && timo <= 16) { - sleep(timo); - timo *= 2; - continue; - } - if (hp->h_addr_list[1] != NULL) { - int oerrno = errno; - - fprintf(stderr, - "connect to address %s: ", inet_ntoa(sin.sin_addr)); - errno = oerrno; - perror(0); - hp->h_addr_list++; - bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr, - hp->h_length); - fprintf(stderr, "Trying %s...\n", - inet_ntoa(sin.sin_addr)); - continue; - } - perror(hp->h_name); - sigsetmask(oldmask); - return (-1); - } - lport--; - if (fd2p == 0) { - write(s, "", 1); - lport = 0; - } else { - char num[8]; - int s2 = rresvport(&lport), s3; - int len = sizeof (from); - - if (s2 < 0) - goto bad; - listen(s2, 1); - (void) sprintf(num, "%d", lport); - if (write(s, num, strlen(num)+1) != strlen(num)+1) { - perror("write: setting up stderr"); - (void) close(s2); - goto bad; - } - s3 = accept(s2, &from, &len); - (void) close(s2); - if (s3 < 0) { - perror("accept"); - lport = 0; - goto bad; - } - *fd2p = s3; - from.sin_port = ntohs((u_short)from.sin_port); - if (from.sin_family != AF_INET || - from.sin_port >= IPPORT_RESERVED) { - fprintf(stderr, - "socket: protocol failure in circuit setup.\n"); - goto bad2; - } - } - (void) write(s, locuser, strlen(locuser)+1); - (void) write(s, remuser, strlen(remuser)+1); - (void) write(s, cmd, strlen(cmd)+1); - retval = read(s, &c, 1); - if (retval != 1) { - if (retval == 0) { - fprintf(stderr, - "Protocol error, %s closed connection\n", *ahost); - } else if (retval < 0) { - perror(*ahost); - } else { - fprintf(stderr, - "Protocol error, %s sent %d bytes\n", *ahost, retval); - } - goto bad2; - } - if (c != 0) { - while (read(s, &c, 1) == 1) { - (void) write(2, &c, 1); - if (c == '\n') - break; - } - goto bad2; - } - sigsetmask(oldmask); - return (s); -bad2: - if (lport) - (void) close(*fd2p); -bad: - (void) close(s); - sigsetmask(oldmask); - return (-1); -} - -int -rresvport(int *alport) -{ - struct sockaddr_in sin; - int s; - - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = INADDR_ANY; - s = socket(AF_INET, SOCK_STREAM, 0); - if (s < 0) - return (-1); - for (;;) { - sin.sin_port = htons((u_short)*alport); - if (bind(s, (caddr_t)&sin, sizeof (sin)) >= 0) - return (s); - if (errno != EADDRINUSE) { - (void) close(s); - return (-1); - } - (*alport)--; - if (*alport == IPPORT_RESERVED/2) { - (void) close(s); - errno = EAGAIN; /* close */ - return (-1); - } - } -} - -int -ruserok( - const char *rhost, - int superuser, - const char *ruser, - const char *luser) -{ - FILE *hostf; - char fhost[MAXHOSTNAMELEN]; - const char *sp; - char *p; - int baselen = -1; - - struct stat sbuf; - struct passwd *pwd; - char pbuf[MAXPATHLEN]; - int euid = -1; - - sp = rhost; - p = fhost; - while (*sp) { - if (*sp == '.') { - if (baselen == -1) - baselen = sp - rhost; - *p++ = *sp++; - } else { - *p++ = isupper(*sp) ? tolower(*sp++) : *sp++; - } - } - *p = '\0'; - - /* check /etc/hosts.equiv */ - if (!superuser) { - if ((hostf = fopen("/etc/hosts.equiv", "r")) != NULL) { - if (!_validuser(hostf, fhost, luser, ruser, baselen)) { - (void) fclose(hostf); - return(0); - } - (void) fclose(hostf); - } - } - - /* check ~/.rhosts */ - - if ((pwd = getpwnam(luser)) == NULL) - return(-1); - (void)strcpy(pbuf, pwd->pw_dir); - (void)strcat(pbuf, "/.rhosts"); - - /* - * Read .rhosts as the local user to avoid NFS mapping the root uid - * to something that can't read .rhosts. - */ - euid = geteuid(); - (void) seteuid (pwd->pw_uid); - if ((hostf = fopen(pbuf, "r")) == NULL) { - if (euid != -1) - (void) seteuid (euid); - return(-1); - } - (void)fstat(fileno(hostf), &sbuf); - if (sbuf.st_uid && sbuf.st_uid != pwd->pw_uid) { - fclose(hostf); - if (euid != -1) - (void) seteuid (euid); - return(-1); - } - - if (!_validuser(hostf, fhost, luser, ruser, baselen)) { - (void) fclose(hostf); - if (euid != -1) - (void) seteuid (euid); - return(0); - } - - (void) fclose(hostf); - if (euid != -1) - (void) seteuid (euid); - return (-1); -} - -int -_validuser(FILE *hostf, char *rhost, char *luser, char *ruser, int baselen) -{ - char *user; - char ahost[MAXHOSTNAMELEN]; - int hostmatch, usermatch; - char *p; - - if (domain == NULL) { - (void) yp_get_default_domain(&domain); - } - while (fgets(ahost, sizeof (ahost), hostf)) { - hostmatch = usermatch = 0; /* bugid fix 1033104 */ - p = ahost; - while (*p != '\n' && *p != ' ' && *p != '\t' && *p != '\0') { - *p = isupper(*p) ? tolower(*p) : *p; - p++; - } - if (*p == ' ' || *p == '\t') { - *p++ = '\0'; - while (*p == ' ' || *p == '\t') - p++; - user = p; - while (*p != '\n' && *p != ' ' && *p != '\t' && *p != '\0') - p++; - } else - user = p; - *p = '\0'; - if (ahost[0] == '+' && ahost[1] == 0) - hostmatch = 1; - else if (ahost[0] == '+' && ahost[1] == '@') - hostmatch = innetgr(ahost + 2, rhost, - NULL, domain); - else if (ahost[0] == '-' && ahost[1] == '@') { - if (innetgr(ahost + 2, rhost, NULL, domain)) - break; - } - else if (ahost[0] == '-') { - if (_checkhost(rhost, ahost+1, baselen)) - break; - } - else - hostmatch = _checkhost(rhost, ahost, baselen); - if (user[0]) { - if (user[0] == '+' && user[1] == 0) - usermatch = 1; - else if (user[0] == '+' && user[1] == '@') - usermatch = innetgr(user+2, NULL, - ruser, domain); - else if (user[0] == '-' && user[1] == '@') { - if (hostmatch && innetgr(user+2, NULL, - ruser, domain)) - break; - } - else if (user[0] == '-') { - if (hostmatch && !strcmp(user+1, ruser)) - break; - } - else - usermatch = !strcmp(user, ruser); - } - else - usermatch = !strcmp(ruser, luser); - if (hostmatch && usermatch) - return (0); - } - return (-1); -} - -int -_checkhost(char *rhost, char *lhost, int len) -{ - static char *ldomain; - static char *domainp; - static int nodomain; - char *cp; - - if (ldomain == NULL) { - ldomain = (char *)malloc(MAXHOSTNAMELEN+1); - if (ldomain == 0) - return (0); - } - - if (len == -1) - return(!strcmp(rhost, lhost)); - if (strncmp(rhost, lhost, len)) - return(0); - if (!strcmp(rhost, lhost)) - return(1); - if (*(lhost + len) != '\0') - return(0); - if (nodomain) - return(0); - if (!domainp) { - /* - * "domainp" points after the first dot in the host name - */ - if (gethostname(ldomain, MAXHOSTNAMELEN) == -1) { - nodomain = 1; - return(0); - } - ldomain[MAXHOSTNAMELEN] = NULL; - if ((domainp = index(ldomain, '.')) == (char *)NULL) { - nodomain = 1; - return(0); - } - domainp++; - cp = domainp; - while (*cp) { - *cp = isupper(*cp) ? tolower(*cp) : *cp; - cp++; - } - } - return(!strcmp(domainp, rhost + len +1)); -} diff --git a/usr/src/lib/libbc/libc/net/rexec.c b/usr/src/lib/libbc/libc/net/rexec.c deleted file mode 100644 index ae9ce5c132..0000000000 --- a/usr/src/lib/libbc/libc/net/rexec.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/socket.h> - -#include <netinet/in.h> - -#include <stdio.h> -#include <netdb.h> -#include <errno.h> -#include <strings.h> -#include <unistd.h> - - -char *getpass(); - -int -rexec( - char **ahost, - unsigned short rport, - char *name, - char *pass, - char *cmd, - int *fd2p) -{ - int s, timo = 1, s3; - struct sockaddr_in sin, sin2, from; - char c; - u_short port; - struct hostent *hp; - - hp = gethostbyname(*ahost); - if (hp == 0) { - fprintf(stderr, "%s: unknown host\n", *ahost); - return (-1); - } - *ahost = hp->h_name; - _ruserpass(hp->h_name, &name, &pass); -retry: - s = socket(AF_INET, SOCK_STREAM, 0); - if (s < 0) { - perror("rexec: socket"); - return (-1); - } - sin.sin_family = hp->h_addrtype; - sin.sin_port = rport; - bcopy(hp->h_addr, (caddr_t)&sin.sin_addr, hp->h_length); - if (connect(s, &sin, sizeof(sin)) < 0) { - if (errno == ECONNREFUSED && timo <= 16) { - (void) close(s); - sleep(timo); - timo *= 2; - goto retry; - } - perror(hp->h_name); - (void) close(s); - return (-1); - } - if (fd2p == 0) { - (void) write(s, "", 1); - port = 0; - } else { - char num[8]; - int s2, sin2len; - - s2 = socket(AF_INET, SOCK_STREAM, 0); - if (s2 < 0) { - (void) close(s); - return (-1); - } - listen(s2, 1); - sin2len = sizeof (sin2); - if (getsockname(s2, (char *)&sin2, &sin2len) < 0 || - sin2len != sizeof (sin2)) { - perror("getsockname"); - (void) close(s2); - goto bad; - } - port = ntohs((u_short)sin2.sin_port); - (void) sprintf(num, "%u", port); - (void) write(s, num, strlen(num)+1); - { int len = sizeof (from); - s3 = accept(s2, &from, &len); - close(s2); - if (s3 < 0) { - perror("accept"); - port = 0; - goto bad; - } - } - *fd2p = s3; - } - (void) write(s, name, strlen(name) + 1); - /* should public key encypt the password here */ - (void) write(s, pass, strlen(pass) + 1); - (void) write(s, cmd, strlen(cmd) + 1); - if (read(s, &c, 1) != 1) { - perror(*ahost); - goto bad; - } - if (c != 0) { - while (read(s, &c, 1) == 1) { - (void) write(2, &c, 1); - if (c == '\n') - break; - } - goto bad; - } - return (s); -bad: - if (port) - (void) close(*fd2p); - (void) close(s); - return (-1); -} diff --git a/usr/src/lib/libbc/libc/net/ruserpass.c b/usr/src/lib/libbc/libc/net/ruserpass.c deleted file mode 100644 index abd411bb90..0000000000 --- a/usr/src/lib/libbc/libc/net/ruserpass.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <ctype.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <errno.h> -#include <malloc.h> -#include <strings.h> -#include <stdlib.h> -#include <unistd.h> - -char *getpass(); - -#define DEFAULT 1 -#define LOGIN 2 -#define PASSWD 3 -#define NOTIFY 4 -#define WRITE 5 -#define YES 6 -#define NO 7 -#define COMMAND 8 -#define FORCE 9 -#define ID 10 -#define MACHINE 11 - -#define MAXTOKEN 11 -#define NTOKENS (MAXTOKEN - 1 + 2 + 1) /* two duplicates and null, minus id */ - -static void rnetrc(char *, char **, char **); -static int token(void); - -static struct ruserdata { - char tokval[100]; - struct toktab { - char *tokstr; - int tval; - } toktab[NTOKENS]; - FILE *cfile; -} *ruserdata, *_ruserdata(void); - - -static struct ruserdata * -_ruserdata(void) -{ - struct ruserdata *d = ruserdata; - struct toktab *t; - - if (d == 0) { - if ((d = (struct ruserdata *) - calloc(1, sizeof(struct ruserdata))) == NULL) { - return(NULL); - } - ruserdata = d; - t = d->toktab; - t->tokstr = "default"; t++->tval = DEFAULT; - t->tokstr = "login"; t++->tval = LOGIN; - t->tokstr = "password"; t++->tval = PASSWD; - t->tokstr = "notify"; t++->tval = NOTIFY; - t->tokstr = "write"; t++->tval = WRITE; - t->tokstr = "yes"; t++->tval = YES; - t->tokstr = "y"; t++->tval = YES; - t->tokstr = "no"; t++->tval = NO; - t->tokstr = "n"; t++->tval = NO; - t->tokstr = "command"; t++->tval = COMMAND; - t->tokstr = "force"; t++->tval = FORCE; - t->tokstr = "machine"; t++->tval = MACHINE; - t->tokstr = 0; t->tval = 0; - } - return(d); -} - -void -_ruserpass(char *host, char **aname, char **apass) -{ - - if (*aname == 0 || *apass == 0) - rnetrc(host, aname, apass); - if (*aname == 0) { - char *myname = getlogin(); - *aname = malloc(16); - printf("Name (%s:%s): ", host, myname); - fflush(stdout); - if (read(2, *aname, 16) <= 0) - exit(1); - if ((*aname)[0] == '\n') - *aname = myname; - else - if (index(*aname, '\n')) - *index(*aname, '\n') = 0; - } - if (*aname && *apass == 0) { - printf("Password (%s:%s): ", host, *aname); - fflush(stdout); - *apass = getpass(""); - } -} - - -static void -rnetrc(char *host, char **aname, char **apass) -{ - struct ruserdata *d = _ruserdata(); - char *hdir, buf[BUFSIZ]; - int t; - struct stat stb; - - if (d == 0) - return; - - hdir = getenv("HOME"); - if (hdir == NULL) - hdir = "."; - sprintf(buf, "%s/.netrc", hdir); - d->cfile = fopen(buf, "r"); - if (d->cfile == NULL) { - if (errno != ENOENT) - perror(buf); - return; - } -next: - while ((t = token())) switch(t) { - - case DEFAULT: - (void) token(); - continue; - - case MACHINE: - if (token() != ID || strcmp(host, d->tokval)) - continue; - while ((t = token()) && t != MACHINE) switch(t) { - - case LOGIN: - if (token()) - if (*aname == 0) { - *aname = malloc(strlen(d->tokval) + 1); - strcpy(*aname, d->tokval); - } else { - if (strcmp(*aname, d->tokval)) - goto next; - } - break; - case PASSWD: - if (fstat(fileno(d->cfile), &stb) >= 0 - && (stb.st_mode & 077) != 0) { - fprintf(stderr, "Error - .netrc file not correct mode.\n"); - fprintf(stderr, "Remove password or correct mode.\n"); - exit(1); - } - if (token() && *apass == 0) { - *apass = malloc(strlen(d->tokval) + 1); - strcpy(*apass, d->tokval); - } - break; - case COMMAND: - case NOTIFY: - case WRITE: - case FORCE: - (void) token(); - break; - default: - fprintf(stderr, "Unknown .netrc option %s\n", d->tokval); - break; - } - goto done; - } -done: - fclose(d->cfile); -} - -static int -token(void) -{ - struct ruserdata *d = _ruserdata(); - char *cp; - int c; - struct toktab *t; - - if (d == 0) - return(0); - - if (feof(d->cfile)) - return (0); - while ((c = getc(d->cfile)) != EOF && - (c == '\n' || c == '\t' || c == ' ' || c == ',')) - continue; - if (c == EOF) - return (0); - cp = d->tokval; - if (c == '"') { - while ((c = getc(d->cfile)) != EOF && c != '"') { - if (c == '\\') - c = getc(d->cfile); - *cp++ = c; - } - } else { - *cp++ = c; - while ((c = getc(d->cfile)) != EOF - && c != '\n' && c != '\t' && c != ' ' && c != ',') { - if (c == '\\') - c = getc(d->cfile); - *cp++ = c; - } - } - *cp = 0; - if (d->tokval[0] == 0) - return (0); - for (t = d->toktab; t->tokstr; t++) - if (!strcmp(t->tokstr, d->tokval)) - return (t->tval); - return (ID); -} diff --git a/usr/src/lib/libbc/libc/net/sparc/htonl.c b/usr/src/lib/libbc/libc/net/sparc/htonl.c deleted file mode 100644 index b923e9e534..0000000000 --- a/usr/src/lib/libbc/libc/net/sparc/htonl.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1992 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -unsigned long -htonl(unsigned long a) -{ - - return (a); -} diff --git a/usr/src/lib/libbc/libc/net/sparc/htons.c b/usr/src/lib/libbc/libc/net/sparc/htons.c deleted file mode 100644 index f65763d87a..0000000000 --- a/usr/src/lib/libbc/libc/net/sparc/htons.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1992 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> - -unsigned short -htons(u_short a) -{ - - return (a); -} diff --git a/usr/src/lib/libbc/libc/net/sparc/ntohl.c b/usr/src/lib/libbc/libc/net/sparc/ntohl.c deleted file mode 100644 index 0bff6fd4d8..0000000000 --- a/usr/src/lib/libbc/libc/net/sparc/ntohl.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1992 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -unsigned long -ntohl(unsigned long a) -{ - - return (a); -} diff --git a/usr/src/lib/libbc/libc/net/sparc/ntohs.c b/usr/src/lib/libbc/libc/net/sparc/ntohs.c deleted file mode 100644 index f698decec3..0000000000 --- a/usr/src/lib/libbc/libc/net/sparc/ntohs.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1992 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> - -unsigned short -ntohs(u_short a) -{ - - return (a); -} diff --git a/usr/src/lib/libbc/libc/stdio/4.2/filbuf.c b/usr/src/lib/libbc/libc/stdio/4.2/filbuf.c deleted file mode 100644 index d271d4a0ed..0000000000 --- a/usr/src/lib/libbc/libc/stdio/4.2/filbuf.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1986 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <unistd.h> - -extern void _findbuf(); -extern int fflush(); - -int -__filbuf(FILE *iop) -{ - return (_filbuf(iop)); -} - -int -_filbuf(FILE *iop) -{ - - if ( !(iop->_flag & _IOREAD) ) - if (iop->_flag & _IORW) - iop->_flag |= _IOREAD; - else - return(EOF); - - if (iop->_flag&(_IOSTRG|_IOEOF)) - return(EOF); - - if (iop->_base == NULL) /* get buffer if we don't have one */ - _findbuf(iop); - - if (iop == stdin) { - if (stdout->_flag&_IOLBF) - (void) fflush(stdout); - if (stderr->_flag&_IOLBF) - (void) fflush(stderr); - } - - iop->_ptr = iop->_base; - iop->_cnt = read(fileno(iop), (char *)iop->_base, - (unsigned)((iop->_flag & _IONBF) ? 1 : iop->_bufsiz )); - if (--iop->_cnt >= 0) /* success */ - return (*iop->_ptr++); - if (iop->_cnt != -1) /* error */ - iop->_flag |= _IOERR; - else { /* end-of-file */ - iop->_flag |= _IOEOF; - if (iop->_flag & _IORW) - iop->_flag &= ~_IOREAD; - } - iop->_cnt = 0; - return (EOF); -} diff --git a/usr/src/lib/libbc/libc/stdio/4.2/flsbuf.c b/usr/src/lib/libbc/libc/stdio/4.2/flsbuf.c deleted file mode 100644 index a582cc6b7f..0000000000 --- a/usr/src/lib/libbc/libc/stdio/4.2/flsbuf.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> -#include "../common/stdiom.h" -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <malloc.h> -#include <unistd.h> - -extern int fclose(); -extern unsigned char (*_smbuf)[_SBFSIZ]; - -void _findbuf(FILE *); -void _bufsync(FILE *); - -/* - * Flush buffers on exit - */ - -void -_cleanup(void) -{ - - _fwalk(fclose); -} -/* - * fclose() will flush (output) buffers for a buffered open - * FILE and then issue a system close on the _fileno. The - * _base field will be reset to NULL for any but stdin and - * stdout, the _ptr field will be set the same as the _base - * field. The _flags and the _cnt field will be zeroed. - * If buffers had been obtained via malloc(), the space will - * be free()'d. In case the FILE was not open, or fflush() - * or close() failed, an EOF will be returned, otherwise the - * return value is 0. - */ - -int -fclose(FILE *iop) -{ - int rtn=EOF; - - if(iop == NULL) - return(rtn); - if(iop->_flag & (_IOREAD | _IOWRT | _IORW) - && (iop->_flag & _IOSTRG) == 0) { - rtn = (iop->_flag & _IONBF)? 0: fflush(iop); - if(close(fileno(iop)) < 0) - rtn = EOF; - } - if(iop->_flag & _IOMYBUF) { - free((char*)iop->_base); - iop->_base = NULL; - } - iop->_flag = 0; - iop->_cnt = 0; - iop->_ptr = iop->_base; - iop->_bufsiz = 0; - return(rtn); -} - -/* - * The fflush() routine must take care because of the - * possibility for recursion. The calling program might - * do IO in an interupt catching routine that is likely - * to interupt the write() call within fflush() - */ - -int -fflush(FILE *iop) -{ - if (!(iop->_flag & _IOWRT)) { - return(0); - } - while(!(iop->_flag & _IONBF) && (iop->_flag & _IOWRT) && - (iop->_base != NULL) && (iop->_ptr > iop->_base) ) - (void) _xflsbuf(iop); - return(ferror(iop) ? EOF : 0); -} - -/* The routine _flsbuf may or may not actually flush the output buffer. If - * the file is line-buffered, the fact that iop->_cnt has run below zero - * is meaningless: it is always kept below zero so that invocations of putc - * will consistently give control to _flsbuf, even if the buffer is far from - * full. _flsbuf, on seeing the "line-buffered" flag, determines whether the - * buffer is actually full by comparing iop->_ptr to the end of the buffer - * iop->_base + iop->_bufsiz. If it is full, or if an output line is - * completed (with a newline), the buffer is flushed. (Note: the character - * argument to _flsbuf is not flushed with the current buffer if the buffer - * is actually full -- it goes into the buffer after flushing.) - */ - -int -_flsbuf(unsigned char c, FILE *iop) -{ - unsigned char c1; - - do { - /* check for linebuffered with write perm, but no EOF */ - if ( (iop->_flag & (_IOLBF | _IOWRT | _IOEOF)) == (_IOLBF | _IOWRT) ) { - if ( iop->_ptr >= iop->_base + iop->_bufsiz ) /* if buffer full, */ - break; /* exit do-while, and flush buf. */ - if ( (*iop->_ptr++ = c) != '\n' ) - return(c); - return(_xflsbuf(iop) == EOF ? EOF : c); - } - /* write out an unbuffered file, if have write perm, but no EOF */ - if ( (iop->_flag & (_IONBF | _IOWRT | _IOEOF)) == (_IONBF | _IOWRT) ) { - c1 = c; - iop->_cnt = 0; - if (write(fileno(iop), (char *) &c1, 1) == 1) - return(c); - iop->_flag |= _IOERR; - return(EOF); - } - /* The _wrtchk call is here rather than at the top of _flsbuf to re- */ - /* duce overhead for line-buffered I/O under normal circumstances. */ - - if (_WRTCHK(iop)) /* is writing legitimate? */ - return(EOF); - } while ( (iop->_flag & (_IONBF | _IOLBF)) ); - - - (void) _xflsbuf(iop); /* full buffer: flush buffer */ - (void) putc((char) c, iop); /* then put "c" in newly emptied buf */ - /* (which, because of signals, may NOT be empty) */ - return( ferror(iop) ? EOF : c); -} - -/* The function _xflsbuf writes out the current contents of the output - * buffer delimited by iop->_base and iop->_ptr. - * iop->_cnt is reset appropriately, but its value on entry to _xflsbuf - * is ignored. - * - * The following code is not strictly correct. If a signal is raised, - * invoking a signal-handler which generates output into the same buffer - * being flushed, a peculiar output sequence may result (for example, - * the output generated by the signal-handler may appear twice). At - * present no means has been found to guarantee correct behavior without - * resorting to the disabling of signals, a means considered too expensive. - * For now the code has been written with the intent of reducing the - * probability of strange effects and, when they do occur, of confining - * the damage. Except under extremely pathological circumstances, this - * code should be expected to respect buffer boundaries even in the face - * of interrupts and other signals. - */ - -int -_xflsbuf(FILE *iop) -{ - unsigned char *base; - int n; - - n = iop->_ptr - (base = iop->_base); - iop->_ptr = base; - iop->_cnt = (iop->_flag &(_IONBF | _IOLBF)) ? 0 : iop->_bufsiz; - _BUFSYNC(iop); - if (n > 0 && n != write(fileno(iop),(char*)base,(unsigned)n) ) { - iop->_flag |= _IOERR; - return(EOF); - } - return(0); -} - -/* The function _wrtchk checks to see whether it is legitimate to write - * to the specified device. If it is, _wrtchk sets flags in iop->_flag for - * writing, assures presence of a buffer, and returns 0. If writing is not - * legitimate, EOF is returned. - */ - -int -_wrtchk(FILE *iop) -{ - if ( (iop->_flag & (_IOWRT | _IOEOF)) != _IOWRT ) { - if (!(iop->_flag & (_IOWRT | _IORW))) - return(EOF); /* bogus call--read-only file */ - iop->_flag = iop->_flag & ~_IOEOF | _IOWRT; /* fix flags */ - } - if (iop->_flag & _IOSTRG) - return(0); /* not our business to monkey with buffers or counts */ - if (iop->_base == NULL) /* this is first I/O to file--get buffer */ - _findbuf(iop); - if (iop->_ptr == iop->_base && !(iop->_flag & (_IONBF | _IOLBF)) ) { - iop->_cnt = iop->_bufsiz; /* first write since seek--set cnt */ - _BUFSYNC(iop); - } - return(0); -} - -/* - * _findbuf, called only when iop->_base == NULL, locates a predefined buffer - * or allocates a buffer using malloc. If a buffer is obtained from malloc, - * the _IOMYBUF flag is set in iop->_flag. - */ - -void -_findbuf(FILE *iop) -{ - int fno = fileno(iop); /* file number */ - struct stat statb; - int size; - - /* allocate a small block for unbuffered, large for buffered */ - if (iop->_flag & _IONBF) { - iop->_base = _smbuf[fno]; - iop->_bufsiz = _SBFSIZ; - } else { - - if ( isatty(fno) ) { - iop->_flag |= _IOLBF; - size = 128; - } else { - if (fstat(fno, &statb) < 0) - size = BUFSIZ; - else { - if ((size = statb.st_blksize) <= 0) - size = BUFSIZ; - } - } - if ((iop->_base = (unsigned char *) malloc(size+8)) != NULL) { - /* if we got a buffer */ - iop->_flag |= _IOMYBUF; - iop->_bufsiz = size; - } else { - /* if no room for buffer, use small buffer */ - iop->_base = _smbuf[fno]; - iop->_bufsiz = _SBFSIZ; - iop->_flag &= ~_IOLBF; - iop->_flag |= _IONBF; - } - } - iop->_ptr = iop->_base; -} - -/* - * The function _bufsync is called because interrupts and other signals - * which occur in between the decrementing of iop->_cnt and the incrementing - * of iop->_ptr, or in other contexts as well, may upset the synchronization - * of iop->_cnt and iop->ptr. If this happens, calling _bufsync should - * resynchronize the two quantities (this is not always possible). Resyn- - * chronization guarantees that putc invocations will not write beyond - * the end of the buffer. Note that signals during _bufsync can cause - * _bufsync to do the wrong thing, but usually with benign effects. - */ - -void -_bufsync(FILE *iop) -{ - int spaceleft; - unsigned char *bufend = iop->_base + iop->_bufsiz; - - if ((spaceleft = bufend - iop->_ptr) < 0) - iop->_ptr = bufend; - else if (spaceleft < iop->_cnt) - iop->_cnt = spaceleft; -} diff --git a/usr/src/lib/libbc/libc/stdio/4.2/fopen.c b/usr/src/lib/libbc/libc/stdio/4.2/fopen.c deleted file mode 100644 index fec2814aaf..0000000000 --- a/usr/src/lib/libbc/libc/stdio/4.2/fopen.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1986 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <fcntl.h> - -extern int fclose(); -extern FILE *_findiop(); - -static FILE *_endopen(char *, char *, FILE *); - -FILE * -fopen(char *file, char *mode) -{ - return (_endopen(file, mode, _findiop())); -} - -FILE * -freopen(char *file, char *mode, FILE *iop) -{ - (void) fclose(iop); /* doesn't matter if this fails */ - return (_endopen(file, mode, iop)); -} - -static FILE * -_endopen(char *file, char *mode, FILE *iop) -{ - int plus, oflag, fd; - - if (iop == NULL || file == NULL || file[0] == '\0') - return (NULL); - plus = (mode[1] == '+'); - switch (mode[0]) { - case 'w': - oflag = (plus ? O_RDWR : O_WRONLY) | O_TRUNC | O_CREAT; - break; - case 'a': - oflag = (plus ? O_RDWR : O_WRONLY) | O_CREAT; - break; - case 'r': - oflag = plus ? O_RDWR : O_RDONLY; - break; - default: - return (NULL); - } - if ((fd = open(file, oflag, 0666)) < 0) - return (NULL); - iop->_cnt = 0; - iop->_file = fd; - iop->_flag = plus ? _IORW : (mode[0] == 'r') ? _IOREAD : _IOWRT; - if (mode[0] == 'a') { - if ((lseek(fd,0L,2)) < 0) { - (void) close(fd); - return NULL; - } - } - iop->_base = iop->_ptr = NULL; - iop->_bufsiz = 0; - return (iop); -} diff --git a/usr/src/lib/libbc/libc/stdio/4.2/fprintf.c b/usr/src/lib/libbc/libc/stdio/4.2/fprintf.c deleted file mode 100644 index 61ea2888aa..0000000000 --- a/usr/src/lib/libbc/libc/stdio/4.2/fprintf.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <stdarg.h> - -extern int _doprnt(); - -int -fprintf(FILE *iop, char *format, ...) -{ - unsigned char localbuf[BUFSIZ]; - int count; - va_list ap; - - if (!(iop->_flag & _IOWRT)) { - /* if no write flag */ - if (iop->_flag & _IORW) { - /* if ok, cause read-write */ - iop->_flag |= _IOWRT; - } else { - /* else error */ - return EOF; - } - } - va_start(ap, format); - if (iop->_flag & _IONBF) { - iop->_flag &= ~_IONBF; - iop->_ptr = iop->_base = localbuf; - iop->_bufsiz = BUFSIZ; - count = _doprnt(format, ap, iop); - fflush(iop); - iop->_flag |= _IONBF; - iop->_base = NULL; - iop->_bufsiz = 0; - iop->_cnt = 0; - } else { - count = _doprnt(format, ap, iop); - } - va_end(ap); - return (count); -} diff --git a/usr/src/lib/libbc/libc/stdio/4.2/printf.c b/usr/src/lib/libbc/libc/stdio/4.2/printf.c deleted file mode 100644 index 3a45a16882..0000000000 --- a/usr/src/lib/libbc/libc/stdio/4.2/printf.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - - -#include <stdio.h> -#include <stdarg.h> - -extern int _doprnt(); - -int -printf(char *format, ...) -{ - int count; - va_list ap; - - va_start(ap, format); - if (!(stdout->_flag & _IOWRT)) { - /* if no write flag */ - if (stdout->_flag & _IORW) { - /* if ok, cause read-write */ - stdout->_flag |= _IOWRT; - } else { - /* else error */ - return (EOF); - } - } - count = _doprnt(format, ap, stdout); - va_end(ap); - return (count); -} diff --git a/usr/src/lib/libbc/libc/stdio/4.2/setbuf.c b/usr/src/lib/libbc/libc/stdio/4.2/setbuf.c deleted file mode 100644 index 21e285bac2..0000000000 --- a/usr/src/lib/libbc/libc/stdio/4.2/setbuf.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1986 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 2.2 */ - -/*LINTLIBRARY*/ -#include <stdio.h> - -extern void free(); -extern int isatty(); -extern unsigned char (*_smbuf)[_SBFSIZ]; -extern void _getsmbuf(); - -void -setbuf(iop, buf) -register FILE *iop; -char *buf; -{ - register int fno = fileno(iop); /* file number */ - - if(iop->_base != NULL && iop->_flag & _IOMYBUF) - free((char*)iop->_base); - iop->_flag &= ~(_IOMYBUF | _IONBF | _IOLBF); - if((iop->_base = (unsigned char*)buf) == NULL) { - iop->_flag |= _IONBF; /* file unbuffered except in fastio */ - /* use small buffers reserved for this */ - iop->_base = _smbuf[fno]; - iop->_bufsiz = _SBFSIZ; - } - else /* regular buffered I/O, standard buffer size */ - iop->_bufsiz = BUFSIZ; - iop->_ptr = iop->_base; - iop->_cnt = 0; -} diff --git a/usr/src/lib/libbc/libc/stdio/4.2/sprintf.c b/usr/src/lib/libbc/libc/stdio/4.2/sprintf.c deleted file mode 100644 index 6de08b632c..0000000000 --- a/usr/src/lib/libbc/libc/stdio/4.2/sprintf.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <stdarg.h> -#include <values.h> - -extern int _doprnt(); - -char * -sprintf(char *string, char *format, ...) -{ - FILE siop; - va_list ap; - - siop._cnt = MAXINT; - siop._base = siop._ptr = (unsigned char *)string; - siop._flag = _IOWRT+_IOSTRG; - va_start(ap, format); - (void) _doprnt(format, ap, &siop); - va_end(ap); - *siop._ptr = '\0'; /* plant terminating null character */ - return (string); -} diff --git a/usr/src/lib/libbc/libc/stdio/4.2/vfprintf.c b/usr/src/lib/libbc/libc/stdio/4.2/vfprintf.c deleted file mode 100644 index a1b4e897c0..0000000000 --- a/usr/src/lib/libbc/libc/stdio/4.2/vfprintf.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <stdarg.h> - -extern int _doprnt(); - -int -vfprintf(FILE *iop, char *format, va_list ap) -{ - unsigned char localbuf[BUFSIZ]; - int count; - - if (!(iop->_flag & _IOWRT)) { - /* if no write flag */ - if (iop->_flag & _IORW) { - /* if ok, cause read-write */ - iop->_flag |= _IOWRT; - } else { - /* else error */ - return (EOF); - } - } - if (iop->_flag & _IONBF) { - iop->_flag &= ~_IONBF; - iop->_ptr = iop->_base = localbuf; - iop->_bufsiz = BUFSIZ; - count = _doprnt(format, ap, iop); - fflush(iop); - iop->_flag |= _IONBF; - iop->_base = NULL; - iop->_bufsiz = 0; - iop->_cnt = 0; - } else { - count = _doprnt(format, ap, iop); - } - return (count); -} diff --git a/usr/src/lib/libbc/libc/stdio/4.2/vprintf.c b/usr/src/lib/libbc/libc/stdio/4.2/vprintf.c deleted file mode 100644 index a2c278dc6a..0000000000 --- a/usr/src/lib/libbc/libc/stdio/4.2/vprintf.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <stdarg.h> - -extern int _doprnt(); - -int -vprintf(char *format, va_list ap) -{ - if (!(stdout->_flag & _IOWRT)) { - /* if no write flag */ - if (stdout->_flag & _IORW) { - /* if ok, cause read-write */ - stdout->_flag |= _IOWRT; - } else { - /* else error */ - return (EOF); - } - } - return (_doprnt(format, ap, stdout)); -} diff --git a/usr/src/lib/libbc/libc/stdio/4.2/vsprintf.c b/usr/src/lib/libbc/libc/stdio/4.2/vsprintf.c deleted file mode 100644 index 67d530de29..0000000000 --- a/usr/src/lib/libbc/libc/stdio/4.2/vsprintf.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <stdarg.h> -#include <values.h> - -extern int _doprnt(); - -char * -vsprintf(char *string, char *format, va_list ap) -{ - FILE siop; - - siop._cnt = MAXINT; - siop._base = siop._ptr = (unsigned char *)string; - siop._flag = _IOWRT+_IOSTRG; - (void) _doprnt(format, ap, &siop); - *siop._ptr = '\0'; /* plant terminating null character */ - return (string); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/clrerr.c b/usr/src/lib/libbc/libc/stdio/common/clrerr.c deleted file mode 100644 index fcb8f0478e..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/clrerr.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.3 */ - -/*LINTLIBRARY*/ -#include <stdio.h> -#undef clearerr - -void -clearerr(iop) -register FILE *iop; -{ - iop->_flag &= ~(_IOERR | _IOEOF); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/ctermid.c b/usr/src/lib/libbc/libc/stdio/common/ctermid.c deleted file mode 100644 index 23365e3a6a..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/ctermid.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.3 */ - -/*LINTLIBRARY*/ -#include <stdio.h> - -extern char *strcpy(); -static char res[L_ctermid]; - -char * -ctermid(s) -register char *s; -{ - return (strcpy(s != NULL ? s : res, "/dev/tty")); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/cuserid.c b/usr/src/lib/libbc/libc/stdio/common/cuserid.c deleted file mode 100644 index b33140d0b8..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/cuserid.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.3 */ - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <pwd.h> - -extern char *strcpy(), *getlogin(); -extern int getuid(); -extern struct passwd *getpwuid(); -static char res[L_cuserid]; - -char * -cuserid(s) -char *s; -{ - register struct passwd *pw; - register char *p; - - if (s == NULL) - s = res; - p = getlogin(); - if (p != NULL) - return (strcpy(s, p)); - pw = getpwuid(getuid()); - endpwent(); - if (pw != NULL) - return (strcpy(s, pw->pw_name)); - *s = '\0'; - return (NULL); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/doprnt.c b/usr/src/lib/libbc/libc/stdio/common/doprnt.c deleted file mode 100644 index eb5e3438cd..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/doprnt.c +++ /dev/null @@ -1,1270 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * _doprnt: common code for printf, fprintf, sprintf - * Floating-point code is included or not, depending - * on whether the preprocessor variable FLOAT is 1 or 0. - */ -#define MAXARGS 50 -#ifndef FLOAT -#define FLOAT 1 /* YES! we want floating */ -#endif - -#include <stdio.h> -#include <ctype.h> -#include <stdarg.h> -#include <values.h> -#include <locale.h> -#include "doprnt.h" -#include "stdiom.h" -#include <string.h> /* strchr, strlen, strspn */ - -#define max(a,b) ((a) > (b) ? (a) : (b)) -#define min(a,b) ((a) < (b) ? (a) : (b)) - -/* If this symbol is nonzero, allow '0' as a flag */ -/* If this symbol is nonzero, allow '0' as a flag */ -#define FZERO 1 - -#if FLOAT -/* - * libc/gen/common functions for floating-point conversion - */ -#include <floatingpoint.h> -extern void _fourdigitsquick(); -#endif - -#define emitchar(c) { if (--filecnt < 0) { \ - FILE *iop = file; \ - if (((iop->_flag & (_IOLBF|_IONBF)) == 0 \ - || -filecnt >= iop->_bufsiz)) { \ - iop->_ptr = fileptr; \ - if (iop->_flag & _IOSTRG) \ - return iop->_ptr - iop->_base; \ - else \ - (void) _xflsbuf(iop); \ - fileptr = iop->_ptr; \ - filecnt = iop->_cnt; \ - filecnt--; \ - } \ - } \ - *fileptr++ = (unsigned)(c); \ - count++; \ - } - -static char *nullstr = "(null)"; -static char *lowerhex = "0123456789abcdef"; -static char *upperhex = "0123456789ABCDEF"; - -/* stva_list is used to subvert C's restriction that a variable with an - * array type can not appear on the left hand side of an assignment operator. - * By putting the array inside a structure, the functionality of assigning to - * the whole array through a simple assignment is achieved.. -*/ -typedef struct stva_list { - va_list ap; -} stva_list; - -void _mkarglst(char *, stva_list, stva_list []); -void _getarg(char *, stva_list *, int); -static char *_check_dol(char *, int *); - -int -_doprnt(char *format, va_list in_args, FILE *file) -{ - char convertbuffer[1024] ; - - /* Current position in format */ - char *cp; - - /* Starting and ending points for value to be printed */ - char *bp; - char *p; - - /* Pointer and count for I/O buffer */ - unsigned char *fileptr; - int filecnt; - - /* Field width and precision */ - int width; - int prec; - - /* Format code */ - char fcode; - - /* Number of padding zeroes required on the left */ - int lzero; - - /* Flags - nonzero if corresponding character appears in format */ - bool fplus; /* + */ - bool fminus; /* - */ - bool fblank; /* blank */ - bool fsharp; /* # */ -#if FZERO - bool ansi_fzero; /* 0 for ansi-dictated formats */ - bool compat_fzero; /* 0 for backward compatibility */ -#endif - bool Lsize; /* Capital L for size = long double = quadruple */ - - /* Pointer to sign, "0x", "0X", or empty */ - char *prefix; - - /* Scratch */ - int nblank; - -#if FLOAT - /* Exponent or empty */ - char *suffix; - - /* Buffer to create exponent */ - char expbuf[7]; /* "e+xxxx\0" */ - - /* Number of padding zeroes required on the right */ - int rzero; - - /* Length of exponent suffix. */ - int suffixlength; - - /* The value being converted, if real or quadruple */ - double dval; - quadruple qval; - - /* Output values from fconvert and econvert */ - int decpt, sign; - - /* Values are developed in this buffer */ - char buf[1034]; /* Size of convertbuffer, plus some for exponent and sign. */ - - /* Current locale's decimal point */ - char decpt_char = *(localeconv()->decimal_point); - -#else - /* Values are developed in this buffer */ - char buf[MAXDIGS]; -#endif - - - /* The value being converted, if integer */ - unsigned long val; - - /* Work variables */ - int n; - char c; - char radix; - int svswitch = 0; - /* count of output characters */ - int count; - - /* variables for positional parameters */ - char *sformat = format; /* save the beginning of the format */ - int fpos = 1; /* 1 if first positional parameter */ - stva_list args, /* used to step through the argument list */ - args_width, /* for width */ - args_prec, /* for prec */ - sargs; /* used to save the start of the argument list */ - stva_list arglst[MAXARGS];/* array giving the approriate values - * for va_arg() to retrieve the - * corresponding argument: - * arglst[0] is the first argument - * arglst[1] is the second argument, etc. - */ - int index = 0; /* argument placeolder */ - /* Initialize args and sargs to the start of the argument list. - * Note that ANSI guarantees that the address of the first member of - * a structure will be the same as the address of the structure. */ - args_width = args_prec = args = sargs = *(struct stva_list *)&in_args; - - -/* initialize p an bp (starting and ending points) bugid 1141781 */ - - p = bp = NULL; - - cp = format; - if ((c = *cp++) != '\0') { - /* - * We know we're going to write something; make sure - * we can write and set up buffers, etc.. - */ - if (_WRTCHK(file)) - return(EOF); - } else - return(0); /* no fault, no error */ - - count = 0; - fileptr = file->_ptr; - filecnt = file->_cnt; - - /* - * The main loop -- this loop goes through one iteration - * for each ordinary character or format specification. - */ - do { - if (c != '%') { - /* Ordinary (non-%) character */ - emitchar(c); - } else { - /* - * % has been spotted! - * - * First, try the 99% cases. - * then parse the format specification. - * - * Note that this code assumes the Sun - * Workstation environment (all params - * passed as int == long, no interrupts - * for fixed point overflow from negating - * the most negative number). - */ - skipit: - switch(c = *cp++) { - - case 'l': - case 'h': - /* Quickly ignore long & short specifiers */ - goto skipit; - - case 's': - bp = va_arg(args.ap, char *); - if (bp == NULL) - bp = nullstr; - while (c = *bp++) - emitchar(c); - p = bp; - continue; - - case 'c': - c = va_arg(args.ap, int); - emitc: - emitchar(c); - continue; - - case 'i': - case 'd': - case 'D': - val = va_arg(args.ap, int); - if ((long) val < 0) { - emitchar('-'); - val = -val; - } - goto udcommon; - - case 'U': - case 'u': - val = va_arg(args.ap, unsigned); - udcommon: - { - char *stringp = lowerhex; - bp = buf+MAXDIGS; - stringp = lowerhex; - do { - *--bp = stringp[val%10]; - val /= 10; - } while (val); - } - goto intout; - - case 'X': - { - char *stringp = upperhex; - val = va_arg(args.ap, unsigned); - bp = buf + MAXDIGS; - if (val == 0) - goto zero; - while (val) { - *--bp = stringp[val%16]; - val /= 16; - } - } - goto intout; - - case 'x': - case 'p': - { - char *stringp = lowerhex; - val = va_arg(args.ap, unsigned); - bp = buf + MAXDIGS; - if (val == 0) - goto zero; - while (val) { - *--bp = stringp[val%16]; - val /= 16; - } - } - goto intout; - - case 'O': - case 'o': - { - char *stringp = lowerhex; - val = va_arg(args.ap, unsigned); - bp = buf + MAXDIGS; - if (val == 0) - goto zero; - while (val) { - *--bp = stringp[val%8]; - val /= 8; - } - } - /* Common code to output integers */ - intout: - p = buf + MAXDIGS; - while (bp < p) { - c = *bp++; - emitchar(c); - } - continue; - - zero: - c = '0'; - goto emitc; - - default: - /* - * let AT&T deal with it - */ - cp-= 2; - } - - Lsize = 0; /* Not long double unless we say so. */ - /* Scan the <flags> */ - fplus = 0; - fminus = 0; - fblank = 0; - fsharp = 0; -#if FZERO - ansi_fzero = 0; - compat_fzero = 0; -#endif - scan: switch (*++cp) { - case '+': - fplus = 1; - goto scan; - case '-': - fminus = 1; - goto scan; - case ' ': - fblank = 1; - goto scan; - case '#': - fsharp = 1; - goto scan; -#if FZERO - case '0': - ansi_fzero = 1; - compat_fzero = 1; - goto scan; -#endif - } - - /* Scan the field width */ - if (*cp == '*') { - char *p; - int val; - - p = _check_dol(cp+1, &val); - if (p != (char *)NULL) { - /* - * argument re-order - */ - if (fpos) { - _mkarglst(sformat, sargs, arglst); - fpos = 0; - } - if (val <= MAXARGS) { - args_width = arglst[val - 1]; - } else { - args_width = arglst[MAXARGS - 1]; - _getarg(sformat, &args_width, val); - } - width = va_arg(args_width.ap, int); - if (width < 0) { - width = -width; - fminus = 1; - } - cp = p; - } - else { - width = va_arg(args.ap, int); - if (width < 0) { - width = -width; - fminus = 1; - } - cp++; - } - } else { - index = width = 0; - while (isdigit(*cp)) { - n = tonumber(*cp++); - index = width = width * 10 + n; - } - } - - /* Scan the precision */ - if (*cp == '.') { - - /* '*' instead of digits? */ - if (*++cp == '*') { - char *p; - int val; - - p = _check_dol(cp+1, &val); - if (p != (char *)NULL) { - /* - * argument re-order - */ - if (fpos) { - _mkarglst(sformat, sargs, arglst); - fpos = 0; - } - if (val <= MAXARGS) { - args_prec = arglst[val - 1]; - } else { - args_prec = arglst[MAXARGS - 1]; - _getarg(sformat, &args_prec, val); - } - prec = va_arg(args_prec.ap, int); - cp = p; - } - else { - prec = va_arg(args.ap, int); - cp++; - } - } else { - prec = 0; - while (isdigit(*cp)) { - n = tonumber(*cp++); - prec = prec * 10 + n; - } - } - } else - prec = -1; - - if (*cp == '$') { - if (fpos) { - _mkarglst(sformat, sargs, arglst); - fpos = 0; - } - if (index <= MAXARGS) { - args = arglst[index - 1]; - } else { - args = arglst[MAXARGS - 1]; - _getarg(sformat, &args, index); - } - goto scan; - } - /* - * The character addressed by cp must be the - * format letter -- there is nothing left for - * it to be. - * - * The status of the +, -, #, blank, and 0 - * flags are reflected in the variables - * "fplus", "fminus", "fsharp", "fblank", - * and "ansi_fzero"/"compat_fzero", respectively. - * "width" and "prec" contain numbers - * corresponding to the digit strings - * before and after the decimal point, - * respectively. If there was no decimal - * point, "prec" is -1. - * - * The following switch sets things up - * for printing. What ultimately gets - * printed will be padding blanks, a prefix, - * left padding zeroes, a value, right padding - * zeroes, a suffix, and more padding - * blanks. Padding blanks will not appear - * simultaneously on both the left and the - * right. Each case in this switch will - * compute the value, and leave in several - * variables the information necessary to - * construct what is to be printed. - * - * The prefix is a sign, a blank, "0x", "0X", - * or null, and is addressed by "prefix". - * - * The suffix is either null or an exponent, - * and is addressed by "suffix". - * - * The value to be printed starts at "bp" - * and continues up to and not including "p". - * - * "lzero" and "rzero" will contain the number - * of padding zeroes required on the left - * and right, respectively. If either of - * these variables is negative, it will be - * treated as if it were zero. - * - * The number of padding blanks, and whether - * they go on the left or the right, will be - * computed on exit from the switch. - */ - - lzero = 0; - prefix = ""; -#if FLOAT - rzero = 0; - suffix = prefix; -#endif - -#if FZERO - /* if both zero-padding and left-justify flags - * are used, ignore zero-padding, per ansi c - */ - if (ansi_fzero & fminus) { - ansi_fzero = 0; - compat_fzero = 0; - } - - /* if zero-padding and precision are specified, - * ignore zero-padding for ansi-dictated formats, - * per ansi c - */ - if (ansi_fzero & (prec != -1)) ansi_fzero = 0; -#endif - - next: - switch (fcode = *cp++) { - - /* toss the length modifier, if any */ - case 'l': - case 'h': - goto next; - - case 'L': - Lsize = 1; /* Remember long double size. */ - goto next; - - /* - * fixed point representations - * - * "radix" is the radix for the conversion. - * Conversion is unsigned unless fcode is 'd'. - * We assume a 2's complement machine and - * that fixed point overflow (from negating - * the largest negative int) is ignored. - */ - - case 'i': - case 'D': - case 'U': - case 'd': - case 'u': - radix = 10; - goto fixed; - - case 'O': - case 'o': - radix = 8; - goto fixed; - - case 'X': - case 'x': - radix = 16; - - fixed: - /* Establish default precision */ - if (prec < 0) - prec = 1; - - /* Fetch the argument to be printed */ - val = va_arg(args.ap, unsigned); - - /* If signed conversion, establish sign */ - if (fcode == 'd' || fcode == 'D' || fcode == 'i') { - if ((long) val < 0) { - prefix = "-"; - val = -val; - } else if (fplus) - prefix = "+"; - else if (fblank) - prefix = " "; - } - /* Set translate table for digits */ - { - char *stringp; - if (fcode == 'X') - stringp = upperhex; - else - stringp = lowerhex; - - /* Develop the digits of the value */ - bp = buf + MAXDIGS; - switch(radix) { - case 8: /*octal*/ - while (val) { - *--bp = stringp[val%8]; - val /= 8; - } - break; - case 16:/*hex*/ - while (val) { - *--bp = stringp[val%16]; - val /= 16; - } - break; - default: - while (val) { - *--bp = stringp[val%10]; - val /= 10; - } - break; - } /* switch */ - } - - /* Calculate padding zero requirement */ - p = buf + MAXDIGS; - - /* Handle the # flag */ - if (fsharp && bp != p) { - switch (fcode) { - case 'x': - prefix = "0x"; - break; - case 'X': - prefix = "0X"; - break; - } - } -#if FZERO - if (ansi_fzero) { - n = width - strlen(prefix); - if (n > prec) - prec = n; - } -#endif - lzero = bp - p + prec; - - /* Handle the # flag for 'o' */ - if (fsharp && bp != p && fcode == 'o' && - lzero < 1) { - lzero = 1; - } - break; -#if FLOAT - -#if defined(__sparc) -#define GETQVAL /* Sun-4 macro to get a quad q from the argument list, passed as a pointer. */ \ - { qval = *(va_arg(args.ap, quadruple*)) ; } -#else -#define GETQVAL /* Sun-3 macro to get a quad q from the argument list, passed as a value. */ \ - { int iq ; unsigned long * pl = (unsigned long *) (&qval) ; for(iq=0;iq<4;iq++) pl[iq] = (unsigned long) va_arg(args.ap, unsigned long) ; } -#endif - - case 'E': - case 'e': - /* - * E-format. The general strategy - * here is fairly easy: we take - * what econvert gives us and re-format it. - */ - - /* Establish default precision */ - if (prec < 0) - prec = 6; - - /* Fetch the value */ - if (Lsize == 0) { /* Double */ - dval = va_arg(args.ap, double); - bp = econvert(dval, prec + 1, &decpt, &sign, convertbuffer); - } else { /* Long Double = quadruple */ - GETQVAL; - bp = qeconvert(&qval, prec + 1, &decpt, &sign, convertbuffer); - } - - /* Determine the prefix */ - if (sign) - prefix = "-"; - else if (fplus) - prefix = "+"; - else if (fblank) - prefix = " "; - if (convertbuffer[0] > '9') - { /* handle infinity, nan */ - bp = &convertbuffer[0]; - for (p = bp+1 ; *p != 0 ; p++) ; - goto ebreak ; - } - { - char *stringp; - /* Place the first digit in the buffer */ - stringp = &buf[0]; - *stringp++ = *bp != '\0'? *bp++: '0'; - - /* Put in a decimal point if needed */ - if (prec != 0 || fsharp) - *stringp++ = decpt_char; - - /* Create the rest of the mantissa */ - rzero = prec; - while (rzero > 0 && *bp!= '\0') { - --rzero; - *stringp++ = *bp++; - } - p = stringp; - } - - bp = &buf[0]; - - /* Create the exponent */ - if (convertbuffer[0] != '0') - n = decpt - 1; - else - n = 0 ; - if (n < 0) - n = -n; - _fourdigitsquick( (short unsigned) n, &(expbuf[2]) ) ; - expbuf[6] = 0 ; - if (n < 100) - /* - * Normally two digit exponent field, - * three or four if required. - */ - { suffix = &(expbuf[4]) ; suffixlength = 4 ; } - else if (n < 1000) - { suffix = &(expbuf[3]) ; suffixlength = 5 ; } - else - { suffix = &(expbuf[2]) ; suffixlength = 6 ; } - /* Put in the exponent sign */ - *--suffix = (decpt > 0 || convertbuffer[0] == '0' )? '+': '-'; - - /* Put in the e; note kludge in 'g' format */ - *--suffix = fcode; -ebreak: -#if FZERO - if (compat_fzero &! fminus) - /* Calculate padding zero requirement */ - lzero = width - (strlen(prefix) - + (p - buf) + rzero + suffixlength); -#endif - break; - - case 'f': - /* - * F-format floating point. This is - * a good deal less simple than E-format. - * The overall strategy will be to call - * fconvert, reformat its result into buf, - * and calculate how many trailing - * zeroes will be required. There will - * never be any leading zeroes needed. - */ - - /* Establish default precision */ - if (prec < 0) - prec = 6; - - if (Lsize == 0) { - dval = va_arg(args.ap, double); - bp = fconvert(dval, prec, &decpt, &sign, convertbuffer); - } else { - GETQVAL ; - bp = qfconvert(&qval, prec, &decpt, &sign, convertbuffer); - } - - /* Determine the prefix */ - if (sign) - prefix = "-"; - else if (fplus) - prefix = "+"; - else if (fblank) - prefix = " "; - if (convertbuffer[0] > '9') - { /* handle infinity, nan */ - bp = &convertbuffer[0]; - for (p = bp+1 ; *p != 0 ; p++) ; - goto fbreak ; - } - { - char *stringp; - /* Initialize buffer pointer */ - stringp = &buf[0]; - - /* Emit the digits before the decimal point */ - n = decpt; - if (n <= 0) - *stringp++ = '0'; - else - do - if (*bp == '\0' ) - *stringp++ = '0'; - else { - *stringp++ = *bp++; - } - while (--n != 0); - - /* Decide whether we need a decimal point */ - if (fsharp || prec > 0) - *stringp++ = decpt_char; - - /* Digits(if any) after the decimal point */ - n = prec; - rzero = prec - n; - while (--n >= 0) { - if (++decpt <= 0 || *bp == '\0') - *stringp++ = '0'; - else { - *stringp++ = *bp++; - } - } -#if FZERO - if (compat_fzero &! fminus) - /* Calculate padding zero requirement */ - lzero = width - (strlen(prefix) - + (stringp - buf) + rzero); -#endif - p = stringp; - } - - bp = &buf[0]; -fbreak: - break; - - case 'G': - case 'g': - /* - * g-format. We play around a bit - * and then jump into e or f, as needed. - */ - - /* Establish default precision */ - if (prec < 0) - prec = 6; - else if (prec == 0) - prec = 1; - - if (Lsize == 0) { - dval = va_arg(args.ap, double); - bp = gconvert(dval, prec, fsharp, convertbuffer); - } else { - GETQVAL; - bp = qgconvert(&qval, prec, fsharp, convertbuffer); - } - bp = convertbuffer ; - if (convertbuffer[0] == '-') { - prefix = "-" ; - bp++; - } - else if (fplus) - prefix = "+"; - else if (fblank) - prefix = " "; - if (isupper(fcode)) - { /* Put in a big E for small minds. */ - for (p = bp ; (*p != NULL) && (*p != 'e') ; p++) ; - if (*p == 'e') *p = 'E' ; - for (; (*p != NULL) ; p++) ; - /* Find end of string. */ - } - else - for (p = bp ; *p != NULL ; p++) ; - /* Find end of string. */ - rzero = 0; -#if FZERO - if (compat_fzero & !fminus) - /* Calculate padding zero requirement */ - lzero = width - (strlen(prefix) - + (p - bp) + rzero); -#endif - break ; - -#endif - case 'c': - buf[0] = va_arg(args.ap, int); - bp = &buf[0]; - p = bp + 1; - break; - - case 's': - bp = va_arg(args.ap, char *); - if (prec < 0) - prec = MAXINT; - /* avoid *(0) */ - if (bp == NULL) - bp = nullstr; - for (n=0; *bp++ != '\0' && n < prec; n++) - ; -#if FZERO - if (compat_fzero &! fminus) - lzero = width - n; -#endif - p = --bp; - bp -= n; - break; - - case '\0': - /* well, what's the punch line? */ - goto out; - - case 'n': - svswitch = 1; - break; - default: - p = bp = &fcode; - p++; - break; - - } - /* Calculate number of padding blanks */ - nblank = width -#if FLOAT - - (rzero < 0? 0: rzero) - - strlen(suffix) -#endif - - (p - bp) - - (lzero < 0? 0: lzero) - - strlen(prefix); - - /* Blanks on left if required */ - if (!fminus) - while (--nblank >= 0) - emitchar(' '); - - /* Prefix, if any */ - while (*prefix != '\0') { - emitchar(*prefix); - prefix++; - } - - /* Zeroes on the left */ - while (--lzero >= 0) - emitchar('0'); - - /* The value itself */ - while (bp < p) { - emitchar(*bp); - bp++; - } -#if FLOAT - /* Zeroes on the right */ - while (--rzero >= 0) - emitchar('0'); - - /* The suffix */ - while (*suffix != '\0') { - emitchar(*suffix); - suffix++; - } -#endif - /* Blanks on the right if required */ - if (fminus) - while (--nblank >= 0) - emitchar(' '); - /* If %n is seen, save count in argument */ - if (svswitch == 1) { - long *svcount; - svcount = va_arg (args.ap, long *); - *svcount = count; - svswitch = 0; - } - } /* else */ - } while ((c = *cp++) != '\0'); /* do */ -out: - file->_ptr = fileptr; - file->_cnt = filecnt; - if (file->_flag & (_IONBF | _IOLBF) && - (file->_flag & _IONBF || - memchr((char *)file->_base, '\n', fileptr - file->_base) != NULL)) - (void) _xflsbuf(file); - return (ferror(file)? EOF: count); -} - -#if defined(__sparc) -/* - * We use "double *" instead of "quadruple *" to skip over the pointer to - * long double on the argument list since a pointer is a pointer after all. - */ -#define SKIPQVAL { \ - (void) va_arg(args.ap, double *); \ -} -#else /* Sun-3 */ -#define SKIPQVAL { \ - int iq; \ - for (iq = 0; iq < 4; iq++) \ - (void) va_arg(args.ap, unsigned long); \ -} -#endif -/* - * This function initializes arglst, to contain the appropriate va_list values - * for the first MAXARGS arguments. - */ -void -_mkarglst(char *fmt, stva_list args, stva_list arglst[]) -{ - static char *digits = "01234567890", *skips = "# +-.0123456789h$"; - - enum types {INT = 1, LONG, CHAR_PTR, DOUBLE, LONG_DOUBLE, VOID_PTR, - LONG_PTR, INT_PTR}; - enum types typelst[MAXARGS], curtype; - int maxnum, n, curargno, flags; - - /* - * Algorithm 1. set all argument types to zero. - * 2. walk through fmt putting arg types in typelst[]. - * 3. walk through args using va_arg(args.ap, typelst[n]) - * and set arglst[] to the appropriate values. - * Assumptions: Cannot use %*$... to specify variable position. - */ - - (void)memset((void *)typelst, 0, sizeof(typelst)); - maxnum = -1; - curargno = 0; - while ((fmt = strchr(fmt, '%')) != 0) - { - fmt++; /* skip % */ - if (fmt[n = strspn(fmt, digits)] == '$') - { - curargno = atoi(fmt) - 1; /* convert to zero base */ - fmt += n + 1; - } - flags = 0; - again:; - fmt += strspn(fmt, skips); - switch (*fmt++) - { - case '%': /*there is no argument! */ - continue; - case 'l': - flags |= 0x1; - goto again; - case 'L': - flags |= 0x8; - goto again; - case '*': /* int argument used for value */ - flags |= 0x2; - curtype = INT; - break; - case 'e': - case 'E': - case 'f': - case 'g': - case 'G': - if (flags & 0x8) - curtype = LONG_DOUBLE; - else - curtype = DOUBLE; - break; - case 's': - curtype = CHAR_PTR; - break; - case 'p': - curtype = VOID_PTR; - break; - case 'n': - if (flags & 0x1) - curtype = LONG_PTR; - else - curtype = INT_PTR; - break; - default: - if (flags & 0x1) - curtype = LONG; - else - curtype = INT; - break; - } - if (curargno >= 0 && curargno < MAXARGS) - { - typelst[curargno] = curtype; - if (maxnum < curargno) - maxnum = curargno; - } - curargno++; /* default to next in list */ - if (flags & 0x2) /* took care of *, keep going */ - { - flags ^= 0x2; - goto again; - } - } - for (n = 0 ; n <= maxnum; n++) - { - arglst[n] = args; - if (typelst[n] == 0) - typelst[n] = INT; - - switch (typelst[n]) - { - case INT: - va_arg(args.ap, int); - break; - case LONG: - va_arg(args.ap, long); - break; - case CHAR_PTR: - va_arg(args.ap, char *); - break; - case DOUBLE: - va_arg(args.ap, double); - break; - case LONG_DOUBLE: - SKIPQVAL - break; - case VOID_PTR: - va_arg(args.ap, void *); - break; - case LONG_PTR: - va_arg(args.ap, long *); - break; - case INT_PTR: - va_arg(args.ap, int *); - break; - } - } -} - -/* - * This function is used to find the va_list value for arguments whose - * position is greater than MAXARGS. This function is slow, so hopefully - * MAXARGS will be big enough so that this function need only be called in - * unusual circumstances. - * pargs is assumed to contain the value of arglst[MAXARGS - 1]. - */ -void -_getarg(char *fmt, stva_list *pargs, int argno) -{ - static char *digits = "01234567890", *skips = "# +-.0123456789h$"; - int i, n, curargno, flags; - char *sfmt = fmt; - int found = 1; - - curargno = i = MAXARGS; - while (found) - { - fmt = sfmt; - found = 0; - while ((i != argno) && (fmt = strchr(fmt, '%')) != 0) - { - fmt++; /* skip % */ - if (fmt[n = strspn(fmt, digits)] == '$') - { - curargno = atoi(fmt); - fmt += n + 1; - } - - /* find conversion specifier for next argument */ - if (i != curargno) - { - curargno++; - continue; - } else - found = 1; - flags = 0; - again:; - fmt += strspn(fmt, skips); - switch (*fmt++) - { - case '%': /*there is no argument! */ - continue; - case 'l': - flags |= 0x1; - goto again; - case 'L': - flags |= 0x8; - goto again; - case '*': /* int argument used for value */ - flags |= 0x2; - (void)va_arg((*pargs).ap, int); - break; - case 'e': - case 'E': - case 'f': - case 'g': - case 'G': - if (flags & 0x8) { -#define args (*pargs) - SKIPQVAL -#undef args - } - else - (void)va_arg((*pargs).ap, double); - break; - case 's': - (void)va_arg((*pargs).ap, char *); - break; - case 'p': - (void)va_arg((*pargs).ap, void *); - break; - case 'n': - if (flags & 0x1) - (void)va_arg((*pargs).ap, long *); - else - (void)va_arg((*pargs).ap, int *); - break; - default: - if (flags & 0x1) - (void)va_arg((*pargs).ap, long int); - else - (void)va_arg((*pargs).ap, int); - break; - } - i++; - curargno++; /* default to next in list */ - if (flags & 0x2) /* took care of *, keep going */ - { - flags ^= 0x2; - goto again; - } - } - - /* missing specifier for parameter, assume parameter is an int */ - if (!found && i != argno) { - (void)va_arg((*pargs).ap, int); - i++; - curargno++; - found = 1; - } - } -} - - -/* - * parse a string, mini parse - */ -static char * -_check_dol(char *s, int *val) -{ - char *os; /* save old string */ - int tmp_val = 0; - int flag = 0; - - while (isdigit (*s)) { - ++flag; - tmp_val = tmp_val*10 + *s - '0'; - s++; - } - if (flag == 0) - return ((char *)NULL); - if (*s == '$') { - *val = tmp_val; - return(++s); - } - return ((char *)NULL); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/doprnt.h b/usr/src/lib/libbc/libc/stdio/common/doprnt.h deleted file mode 100644 index 68c4e5d06e..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/doprnt.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2000 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -/* - * Portions of this source code were derived from Berkeley 4.3 BSD - * under license from the Regents of the University of California. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* Maximum number of digits in any integer (long) representation */ -#define MAXDIGS 11 - -/* Convert a digit character to the corresponding number */ -#define tonumber(x) ((x)-'0') - -/* Convert a number between 0 and 9 to the corresponding digit */ -#define todigit(x) ((x)+'0') - -/* Data type for flags */ -typedef char bool; diff --git a/usr/src/lib/libbc/libc/stdio/common/doscan.c b/usr/src/lib/libbc/libc/stdio/common/doscan.c deleted file mode 100644 index 08cc3ff215..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/doscan.c +++ /dev/null @@ -1,505 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <ctype.h> -#include <stdarg.h> -#include <values.h> -#include <floatingpoint.h> -#include <errno.h> -#include <memory.h> - -#define NCHARS (1 << BITSPERBYTE) -#define locgetc() (chcount+=1,getc(iop)) -#define locungetc(x) (chcount-=1,ungetc(x,iop)) - -static int chcount,flag_eof; - -static int number(int, int, int, int, FILE *, va_list *); -static int string(int, int, int, char *, FILE *, va_list *); -static unsigned char *setup(unsigned char *, char *); - -#ifdef S5EMUL -#define isws(c) isspace(c) -#else -/* - * _sptab[c+1] is 1 iff 'c' is a white space character according to the - * 4.2BSD "scanf" definition - namely, SP, TAB, and NL are the only - * whitespace characters. - */ -static char _sptab[1+256] = { - 0, /* EOF - not a whitespace char */ - 0,0,0,0,0,0,0,0, - 0,1,1,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 1,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, -}; - -#define isws(c) ((_sptab + 1)[c] != 0) -#endif - -int -_doscan(FILE *iop, unsigned char *fmt, va_list va_alist) -{ - char tab[NCHARS]; - int ch; - int nmatch = 0, len, inchar, stow, size; - chcount=0; flag_eof=0; - - /******************************************************* - * Main loop: reads format to determine a pattern, - * and then goes to read input stream - * in attempt to match the pattern. - *******************************************************/ - for ( ; ; ) - { - if ( (ch = *fmt++) == '\0') - return(nmatch); /* end of format */ - if (isws(ch)) - { - if (!flag_eof) - { - while (isws(inchar = locgetc())) - ; - if (inchar == EOF) { - chcount--; - flag_eof = 1; - } - else if (locungetc(inchar) == EOF) - flag_eof = 1; - } - continue; - } - if (ch != '%' || (ch = *fmt++) == '%') - { - if ( (inchar = locgetc()) == ch ) - continue; - if (inchar != EOF) { - if (locungetc(inchar) != EOF) - return(nmatch); /* failed to match input */ - } else { - chcount--; - } - break; - } - if (ch == '*') - { - stow = 0; - ch = *fmt++; - } - else - stow = 1; - - for (len = 0; isdigit(ch); ch = *fmt++) - len = len * 10 + ch - '0'; - if (len == 0) - len = MAXINT; - if ( (size = ch) == 'l' || (size == 'h') || (size == 'L') ) - ch = *fmt++; - if (ch == '\0' || - ch == '[' && (fmt = setup(fmt, tab)) == NULL) - return(EOF); /* unexpected end of format */ - if (isupper(ch)) /* no longer documented */ - { - /* - * The rationale behind excluding the size - * of 'L' is that the 'L' size specifier was - * introduced in ANSI/ISO-C. If the user - * specifies a format of %LG, it can mean - * nothing other than "long double", be the - * code ANSI or not. Mapping it to "double" - * makes no sense. - */ - if (size != 'L') - size = 'l'; -#ifdef S5EMUL - ch = _tolower(ch); -#else - ch = tolower(ch); -#endif - } - switch(ch) - { - case 'c': - case 's': - case '[': - if ((size = string(stow,ch,len,tab,iop,&va_alist)) < 0) - goto out; /* EOF seen, nothing converted */ - break; - case 'n': - if (stow == 0) - continue; - if (size == 'h') - *va_arg(va_alist, short *) = (short) chcount; - else if (size == 'l') - *va_arg(va_alist, long *) = (long) chcount; - else - *va_arg(va_alist, int *) = (int) chcount; - continue; - default: - if ((size = number(stow, ch, len, size, iop, &va_alist)) < 0) - goto out; /* EOF seen, nothing converted */ - break; - } - if (size) - nmatch += stow; - else - return((flag_eof && !nmatch) ? EOF : nmatch); - continue; - } -out: - return (nmatch != 0 ? nmatch : EOF); /* end of input */ -} - -/* - ************************************************************** - * Functions to read the input stream in an attempt to match incoming - * data to the current pattern from the main loop of _doscan(). - ************************************************************** - */ -static int -number(int stow, int type, int len, int size, FILE *iop, va_list *listp) -{ - char numbuf[64], inchar, lookahead; - char *np = numbuf; - int c, base; - int digitseen = 0, floater = 0, negflg = 0; - long lcval = 0; - switch(type) - { - case 'e': - case 'f': - case 'g': - floater++; - case 'd': - case 'u': - case 'i': - base = 10; - break; - case 'o': - base = 8; - break; - case 'x': - base = 16; - break; - default: - return(0); /* unrecognized conversion character */ - } - if (!flag_eof) - { - while (isws(c = locgetc())) - ; - } - else - c = locgetc(); - if (c == EOF) { - chcount--; - return(-1); /* EOF before match */ - } - if (floater != 0) { /* Handle floating point with - * file_to_decimal. */ - decimal_mode dm; - decimal_record dr; - fp_exception_field_type efs; - enum decimal_string_form form; - char *echar; - int nread, ic; - char buffer[1024]; - char *nb = buffer; - - locungetc(c); - if (len > 1024) - len = 1024; - file_to_decimal(&nb, len, 0, &dr, &form, &echar, iop, &nread); - if (stow && (form != invalid_form)) { - dm.rd = fp_direction; - if (size == 'l') { /* double */ - decimal_to_double((double *) va_arg(*listp, double *), &dm, &dr, &efs); - } else if (size == 'L') { /* quad */ - decimal_to_quadruple((quadruple *)va_arg(*listp, double *), &dm, &dr, &efs); - } else {/* single */ - decimal_to_single((float *) va_arg(*listp, float *), &dm, &dr, &efs); - } - if ((efs & (1 << fp_overflow)) != 0) { - errno = ERANGE; - } - if ((efs & (1 << fp_underflow)) != 0) { - errno = ERANGE; - } - } - chcount += nread; /* Count characters read. */ - c = *nb; /* Get first unused character. */ - ic = c; - if (c == NULL) { - ic = locgetc(); - c = ic; - /* - * If null, first unused may have been put back - * already. - */ - } - if (ic == EOF) { - chcount--; - flag_eof = 1; - } else if (locungetc(c) == EOF) - flag_eof = 1; - return ((form == invalid_form) ? 0 : 1); /* successful match if - * non-zero */ - } - switch(c) { - case '-': - negflg++; - if (type == 'u') - break; - case '+': /* fall-through */ - if (--len <= 0) - break; - if ( (c = locgetc()) != '0') - break; - case '0': - if ( (type != 'i') || (len <= 1) ) - break; - if ( ((inchar = locgetc()) == 'x') || (inchar == 'X') ) - { - /* If not using sscanf and * - * at the buffer's end * - * then LOOK ahead */ - - if ( (iop->_flag & _IOSTRG) || (iop->_cnt != 0) ) - lookahead = locgetc(); - else - { - if ( read(fileno(iop),np,1) == 1) - lookahead = *np; - else - lookahead = EOF; - chcount += 1; - } - if ( isxdigit(lookahead) ) - { - base =16; - - if ( len <= 2) - { - locungetc(lookahead); - len -= 1; /* Take into account the 'x'*/ - } - else - { - c = lookahead; - len -= 2; /* Take into account '0x'*/ - } - } - else - { - locungetc(lookahead); - locungetc(inchar); - } - } - else - { - locungetc(inchar); - base = 8; - } - } - if (!negflg || type != 'u') - for (; --len >= 0 ; *np++ = c, c = locgetc()) - { - if (np > numbuf + 62) - { - errno = ERANGE; - return(0); - } - if (isdigit(c)) - { - int digit; - digit = c - '0'; - if (base == 8) - { - if (digit >= 8) - break; - if (stow) - lcval = (lcval<<3) + digit; - } - else - { - if (stow) - { - if (base == 10) - lcval = (((lcval<<2) + lcval)<<1) + digit; - else /* base == 16 */ - lcval = (lcval<<4) + digit; - } - } - digitseen++; - - - continue; - } - else if (base == 16 && isxdigit(c)) - { - int digit; - digit = c - (isupper(c) ? 'A' - 10 : 'a' - 10); - if (stow) - lcval = (lcval<<4) + digit; - digitseen++; - continue; - } - break; - } - - - if (stow && digitseen) - { - /* suppress possible overflow on 2's-comp negation */ - if (negflg && lcval != HIBITL) - lcval = -lcval; - if (size == 'l') - *va_arg(*listp, long *) = lcval; - else if (size == 'h') - *va_arg(*listp, short *) = (short)lcval; - else - *va_arg(*listp, int *) = (int)lcval; - } - if (c == EOF) { - chcount--; - flag_eof=1; - } else if (locungetc(c) == EOF) - flag_eof=1; - return (digitseen); /* successful match if non-zero */ -} - -static int -string(int stow, int type, int len, char *tab, FILE *iop, va_list *listp) -{ - int ch; - char *ptr; - char *start; - - start = ptr = stow ? va_arg(*listp, char *) : NULL; - if (type == 's') - { - if (!flag_eof) - { - while (isws(ch = locgetc())) - ; - } - else - ch = locgetc(); - if (ch == EOF) - return(-1); /* EOF before match */ - while (ch != EOF && !isws(ch)) - { - if (stow) - *ptr = ch; - ptr++; - if (--len <= 0) - break; - ch = locgetc(); - } - } else if (type == 'c') { - if (len == MAXINT) - len = 1; - while ( (ch = locgetc()) != EOF) - { - if (stow) - *ptr = ch; - ptr++; - if (--len <= 0) - break; - } - } else { /* type == '[' */ - while ( (ch = locgetc()) != EOF && !tab[ch]) - { - if (stow) - *ptr = ch; - ptr++; - if (--len <= 0) - break; - } - } - if (ch == EOF ) - { - chcount-=1; - flag_eof = 1; - } - else if (len > 0 && locungetc(ch) == EOF) - flag_eof = 1; - if (ptr == start) - return(0); /* no match */ - if (stow && type != 'c') - *ptr = '\0'; - return (1); /* successful match */ -} - -static unsigned char * -setup(unsigned char *fmt, char *tab) -{ - int b, c, d, t = 0; - - if (*fmt == '^') - { - t++; - fmt++; - } - (void) memset(tab, !t, NCHARS); - if ( (c = *fmt) == ']' || c == '-') /* first char is special */ - { - tab[c] = t; - fmt++; - } - while ( (c = *fmt++) != ']') - { - if (c == '\0') - return(NULL); /* unexpected end of format */ - if (c == '-' && (d = *fmt) != ']' && (b = fmt[-2]) < d) - { - (void) memset(&tab[b], t, d - b + 1); - fmt++; - } - else - tab[c] = t; - } - return (fmt); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/fdopen.c b/usr/src/lib/libbc/libc/stdio/common/fdopen.c deleted file mode 100644 index a225c02b45..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/fdopen.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.4 */ - -/*LINTLIBRARY*/ -/* - * Unix routine to do an "fopen" on file descriptor - * The mode has to be repeated because you can't query its - * status - */ - -#include <stdio.h> -#include <sys/errno.h> - -extern int errno; -extern long lseek(); -extern FILE *_findiop(); - -FILE * -fdopen(fd, mode) -int fd; -register char *mode; -{ - static int nofile = -1; - register FILE *iop; - - if(nofile < 0) - nofile = getdtablesize(); - - if(fd < 0 || fd >= nofile) { - errno = EINVAL; - return(NULL); - } - - if((iop = _findiop()) == NULL) - return(NULL); - - iop->_cnt = 0; - iop->_file = fd; - iop->_base = iop->_ptr = NULL; - iop->_bufsiz = 0; - switch(*mode) { - - case 'r': - iop->_flag = _IOREAD; - break; - case 'a': - (void) lseek(fd, 0L, 2); - /* No break */ - case 'w': - iop->_flag = _IOWRT; - break; - default: - errno = EINVAL; - return(NULL); - } - - if(mode[1] == '+') - iop->_flag = _IORW; - - return(iop); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/feof.c b/usr/src/lib/libbc/libc/stdio/common/feof.c deleted file mode 100644 index 9bbaeded9b..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/feof.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - - -/*LINTLIBRARY*/ -#include <stdio.h> - -#undef feof -#define __feof__(p) (((p)->_flag&_IOEOF)!=0) - -int -feof(fp) -register FILE *fp; -{ - return (__feof__(fp)); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/ferror.c b/usr/src/lib/libbc/libc/stdio/common/ferror.c deleted file mode 100644 index 4c0b69e3b9..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/ferror.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> - -#undef ferror -#define __ferror__(p) (((p)->_flag&_IOERR)!=0) - -int -ferror(fp) -register FILE *fp; -{ - return (__ferror__(fp)); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/fgetc.c b/usr/src/lib/libbc/libc/stdio/common/fgetc.c deleted file mode 100644 index 8ed7c98f0b..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/fgetc.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -#include <stdio.h> - -int -fgetc(fp) -register FILE *fp; -{ - return(getc(fp)); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/fgets.c b/usr/src/lib/libbc/libc/stdio/common/fgets.c deleted file mode 100644 index d6cfb55466..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/fgets.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 3.3 */ - -/*LINTLIBRARY*/ -/* - * This version reads directly from the buffer rather than looping on getc. - * Ptr args aren't checked for NULL because the program would be a - * catastrophic mess anyway. Better to abort than just to return NULL. - */ -#include <stdio.h> -#include "stdiom.h" - -#define MIN(x, y) (x < y ? x : y) - -extern int _filbuf(); -extern char *memccpy(); - -char * -fgets(ptr, size, iop) -char *ptr; -register int size; -register FILE *iop; -{ - char *p, *ptr0 = ptr; - register int n; - - if ( !(iop->_flag & (_IOREAD|_IORW)) ) { - iop->_flag |= _IOERR; - return (NULL); - } - - for (size--; size > 0; size -= n) { - if (iop->_cnt <= 0) { /* empty buffer */ - if (_filbuf(iop) == EOF) { - if (ptr0 == ptr) - return (NULL); - break; /* no more data */ - } - iop->_ptr--; - iop->_cnt++; - } - n = MIN(size, iop->_cnt); - if ((p = memccpy(ptr, (char *) iop->_ptr, '\n', n)) != NULL) - n = p - ptr; - ptr += n; - iop->_cnt -= n; - iop->_ptr += n; - _BUFSYNC(iop); - if (p != NULL) - break; /* found '\n' in buffer */ - } - *ptr = '\0'; - return (ptr0); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/fileno.c b/usr/src/lib/libbc/libc/stdio/common/fileno.c deleted file mode 100644 index 5d91655a26..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/fileno.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> - -int -fileno(fp) -register FILE *fp; -{ - return (fp->_file); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/findiop.c b/usr/src/lib/libbc/libc/stdio/common/findiop.c deleted file mode 100644 index b038b0bc8d..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/findiop.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <errno.h> -#include <malloc.h> -#include "iob.h" - -#define active(iop) ((iop)->_flag & (_IOREAD|_IOWRT|_IORW)) - -static unsigned char sbuf[NSTATIC][_SBFSIZ]; -unsigned char (*_smbuf)[_SBFSIZ] = sbuf; -static FILE **iobglue; -static FILE **endglue; - -/* - * Find a free FILE for fopen et al. - * We have a fixed static array of entries, and in addition - * may allocate additional entries dynamically, up to the kernel - * limit on the number of open files. - * At first just check for a free slot in the fixed static array. - * If none are available, then we allocate a structure to glue together - * the old and new FILE entries, which are then no longer contiguous. - */ -FILE * -_findiop(void) -{ - FILE **iov, *iop; - FILE *fp; - - if(iobglue == NULL) { - for(iop = _iob; iop < _iob + NSTATIC; iop++) - if(!active(iop)) - return(iop); - - if(_f_morefiles() == 0) { - errno = ENOMEM; - return(NULL); - } - } - - iov = iobglue; - while(*iov != NULL && active(*iov)) - if (++iov >= endglue) { - errno = EMFILE; - return(NULL); - } - - if(*iov == NULL) - *iov = (FILE *)calloc(1, sizeof **iov); - - return(*iov); -} - -int -_f_morefiles(void) -{ - FILE **iov; - FILE *fp; - unsigned char *cp; - int nfiles; - - nfiles = getdtablesize(); - - iobglue = (FILE **)calloc(nfiles, sizeof *iobglue); - if(iobglue == NULL) - return(0); - - if((_smbuf = (unsigned char (*)[_SBFSIZ])malloc(nfiles * sizeof *_smbuf)) == NULL) { - free((char *)iobglue); - iobglue = NULL; - return(0); - } - - endglue = iobglue + nfiles; - - for(fp = _iob, iov = iobglue; fp < &_iob[NSTATIC]; /* void */) - *iov++ = fp++; - - return(1); -} - -void -f_prealloc(void) -{ - FILE **iov; - FILE *fp; - - if(iobglue == NULL && _f_morefiles() == 0) - return; - - for(iov = iobglue; iov < endglue; iov++) - if(*iov == NULL) - *iov = (FILE *)calloc(1, sizeof **iov); -} - -void -_fwalk(int (*function)(FILE *)) -{ - FILE **iov; - FILE *fp; - - if(function == NULL) - return; - - if(iobglue == NULL) { - for(fp = _iob; fp < &_iob[NSTATIC]; fp++) - if(active(fp)) - (*function)(fp); - } else { - for(iov = iobglue; iov < endglue; iov++) - if(*iov && active(*iov)) - (*function)(*iov); - } -} diff --git a/usr/src/lib/libbc/libc/stdio/common/fputc.c b/usr/src/lib/libbc/libc/stdio/common/fputc.c deleted file mode 100644 index 54ceb3220b..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/fputc.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -#include <stdio.h> - -int -fputc(c, fp) -int c; -register FILE *fp; -{ - return(putc(c, fp)); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/fputs.c b/usr/src/lib/libbc/libc/stdio/common/fputs.c deleted file mode 100644 index c91c890f85..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/fputs.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1995 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - - -/*LINTLIBRARY*/ -/* - * This version writes directly to the buffer rather than looping on putc. - * Ptr args aren't checked for NULL because the program would be a - * catastrophic mess anyway. Better to abort than just to return NULL. - */ -#include <stdio.h> -#include "stdiom.h" -#include <errno.h> -#include <memory.h> - -static char *memnulccpy(char *, char *, int, int); - -int -fputs(char *ptr, FILE *iop) -{ - int ndone = 0, n; - unsigned char *cptr, *bufend; - char *p; - char c; - - if (_WRTCHK(iop)) { - iop->_flag |= _IOERR; -#ifdef POSIX - errno = EBADF; -#endif /* POSIX */ - return (EOF); - } - bufend = iop->_base + iop->_bufsiz; - - if ((iop->_flag & _IONBF) == 0) { - if (iop->_flag & _IOLBF) { - for ( ; ; ptr += n) { - while ((n = bufend - (cptr = iop->_ptr)) <= 0) - /* full buf */ - if (_xflsbuf(iop) == EOF) - return(EOF); - if ((p = memnulccpy((char *) cptr, ptr, '\n', n)) != NULL) { - /* - * Copy terminated either because we - * saw a newline or we saw a NUL (end - * of string). - */ - c = *(p - 1); /* last character moved */ - if (c == '\0') - p--; /* didn't write '\0' */ - n = p - (char *) cptr; - } - iop->_cnt -= n; - iop->_ptr += n; - _BUFSYNC(iop); - ndone += n; - if (p != NULL) { - /* - * We found either a newline or a NUL. - * If we found a newline, flush the - * buffer. - * If we found a NUL, we're done. - */ - if (c == '\n') { - if (_xflsbuf(iop) == EOF) - return(EOF); - } else { - /* done */ - return(ndone); - } - } - } - } else { - for ( ; ; ptr += n) { - while ((n = bufend - (cptr = iop->_ptr)) <= 0) - /* full buf */ - if (_xflsbuf(iop) == EOF) - return(EOF); - if ((p = memccpy((char *) cptr, ptr, '\0', n)) != NULL) - n = (p - (char *) cptr) - 1; - iop->_cnt -= n; - iop->_ptr += n; - _BUFSYNC(iop); - ndone += n; - if (p != NULL) { - /* done */ - return(ndone); - } - } - } - } else { - /* write out to an unbuffered file */ - return (write(iop->_file, ptr, strlen(ptr))); - } -} - -/* - * Copy s2 to s1, stopping if character c or a NUL is copied. - * Copy no more than n bytes. - * Return a pointer to the byte after character c or NUL in the copy, - * or NULL if c or NUL is not found in the first n bytes. - */ -static char * -memnulccpy(char *s1, char *s2, int c, int n) -{ - int cmoved; - - while (--n >= 0) { - cmoved = *s2++; - if ((*s1++ = cmoved) == '\0' || cmoved == c) - return (s1); - } - return (0); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/fread.c b/usr/src/lib/libbc/libc/stdio/common/fread.c deleted file mode 100644 index 0a0aeea727..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/fread.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1986 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -/* - * This version reads directly from the buffer rather than looping on getc. - * Ptr args aren't checked for NULL because the program would be a - * catastrophic mess anyway. Better to abort than just to return NULL. - */ -#include <stdio.h> -#include "stdiom.h" -#include <memory.h> - -#define MIN(x, y) (x < y ? x : y) - -extern int _filbuf(); - -int -fread(char *ptr, int size, int count, FILE *iop) -{ - unsigned int nleft; - int n; - - if (size <= 0 || count <= 0) return 0; - nleft = count * size; - - /* Put characters in the buffer */ - /* note that the meaning of n when just starting this loop is - irrelevant. It is defined in the loop */ - for ( ; ; ) { - if (iop->_cnt <= 0) { /* empty buffer */ - if (_filbuf(iop) == EOF) - return (count - (nleft + size - 1)/size); - iop->_ptr--; - iop->_cnt++; - } - n = MIN(nleft, iop->_cnt); - ptr = memcpy(ptr, (char *) iop->_ptr, n) + n; - iop->_cnt -= n; - iop->_ptr += n; - _BUFSYNC(iop); - if ((nleft -= n) == 0) - return (count); - } -} diff --git a/usr/src/lib/libbc/libc/stdio/common/fseek.c b/usr/src/lib/libbc/libc/stdio/common/fseek.c deleted file mode 100644 index 348f11302d..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/fseek.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1986 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.3 */ - -/*LINTLIBRARY*/ -/* - * Seek for standard library. Coordinates with buffering. - */ -#include <stdio.h> - -extern long lseek(); -extern int fflush(); - -int -fseek(iop, offset, ptrname) -register FILE *iop; -long offset; -int ptrname; -{ - register int resync, c; - long p = -1; /* can't happen? */ - - iop->_flag &= ~_IOEOF; - if(iop->_flag & _IOREAD) { - if(ptrname < 2 && iop->_base && !(iop->_flag&_IONBF)) { - c = iop->_cnt; - p = offset; - if(ptrname == 0) { - long curpos = lseek(fileno(iop), 0L, 1); - if (curpos == -1) - return (-1); - p += c - curpos; - resync = offset&01; - } else { - offset -= (long)c; - resync = 0; - } - if(!(iop->_flag&_IORW) && c > 0 && p <= c && - p >= iop->_base - iop->_ptr) { - iop->_ptr += (int)p; - iop->_cnt -= (int)p; - return(0); - } - } else - resync = 0; - if(iop->_flag & _IORW) { - iop->_ptr = iop->_base; - iop->_flag &= ~_IOREAD; - resync = 0; - } - p = lseek(fileno(iop), offset-resync, ptrname); - iop->_cnt = 0; - if (resync && p != -1) - if (getc(iop) == EOF) - p = -1; - } else if(iop->_flag & (_IOWRT | _IORW)) { - p = fflush(iop); - iop->_cnt = 0; - if(iop->_flag & _IORW) { - iop->_flag &= ~_IOWRT; - iop->_ptr = iop->_base; - } - return(lseek(fileno(iop), offset, ptrname) == -1 || p == EOF ? - -1 : 0); - } - return((p == -1)? -1: 0); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/ftell.c b/usr/src/lib/libbc/libc/stdio/common/ftell.c deleted file mode 100644 index 85659bb764..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/ftell.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1986 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -/* - * Return file offset. - * Coordinates with buffering. - */ -#include <stdio.h> - -extern long lseek(); - -long -ftell(iop) -register FILE *iop; -{ - register long tres; - register int adjust; - - if(iop->_cnt < 0) - iop->_cnt = 0; - if(iop->_flag & _IOREAD) - adjust = - iop->_cnt; - else if(iop->_flag & (_IOWRT | _IORW)) { - adjust = 0; - if(iop->_flag & _IOWRT && iop->_base && - (iop->_flag & _IONBF) == 0) - adjust = iop->_ptr - iop->_base; - } else - return(-1); - tres = lseek(fileno(iop), 0L, 1); - if(tres >= 0) - tres += (long)adjust; - return(tres); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/fwrite.c b/usr/src/lib/libbc/libc/stdio/common/fwrite.c deleted file mode 100644 index c68412ed52..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/fwrite.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 3.6 */ - -/*LINTLIBRARY*/ -/* - * This version writes directly to the buffer rather than looping on putc. - * Ptr args aren't checked for NULL because the program would be a - * catastrophic mess anyway. Better to abort than just to return NULL. - * - * This version does buffered writes larger than BUFSIZ directly, when - * the buffer is empty. - */ -#include <stdio.h> -#include "stdiom.h" - -#define MIN(x, y) (x < y ? x : y) - -extern char *memcpy(); - -int -fwrite(ptr, size, count, iop) -char *ptr; -int size, count; -register FILE *iop; -{ - register unsigned nleft; - register int n; - register unsigned char *cptr, *bufend; - register unsigned char *prev_ptr; - - if (size <= 0 || count <= 0 || _WRTCHK(iop)) - return (0); - - bufend = iop->_base + iop->_bufsiz; - nleft = count*size; - - /* if the file is unbuffered, or if the iop->ptr = iop->base, and there - is > BUFSZ chars to write, we can do a direct write */ - prev_ptr = iop->_ptr; - if (iop->_base >= iop->_ptr) { /*this covers the unbuffered case, too*/ - if (((iop->_flag & _IONBF) != 0) || (nleft >= BUFSIZ)) { - if ((n=write(fileno(iop),ptr,nleft)) != nleft) - { - iop->_flag |= _IOERR; - n = (n >= 0) ? n : 0; - } - return n/size; - } - } - /* Put characters in the buffer */ - /* note that the meaning of n when just starting this loop is - irrelevant. It is defined in the loop */ - for (; ; ptr += n) { - while ((n = bufend - (cptr = iop->_ptr)) <= 0) /* full buf */ - if (_xflsbuf(iop) == EOF) - return (count - (nleft + size - 1)/size); - n = MIN(nleft, n); - (void) memcpy((char *) cptr, ptr, n); - iop->_cnt -= n; - iop->_ptr += n; - _BUFSYNC(iop); - /* done; flush if linebuffered with a newline */ - if ((nleft -= n) == 0) { - if (iop->_flag & (_IOLBF | _IONBF)) { - if ((iop->_flag & _IONBF) || (memchr(prev_ptr, - '\n',iop->_ptr - prev_ptr) != NULL)) { - (void) _xflsbuf(iop); - } - } - return (count); - } - } -} diff --git a/usr/src/lib/libbc/libc/stdio/common/getc.c b/usr/src/lib/libbc/libc/stdio/common/getc.c deleted file mode 100644 index 617c18be80..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/getc.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> - -#undef getc -#define __getc__(p) (--(p)->_cnt>=0? ((int)*(p)->_ptr++):_filbuf(p)) - -int -getc(fp) -register FILE *fp; -{ - return (__getc__(fp)); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/getchar.c b/usr/src/lib/libbc/libc/stdio/common/getchar.c deleted file mode 100644 index db8a18821b..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/getchar.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -/* - * A subroutine version of the macro getchar. - */ -#include <stdio.h> -#undef getchar - -int -getchar() -{ - return(getc(stdin)); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/gets.c b/usr/src/lib/libbc/libc/stdio/common/gets.c deleted file mode 100644 index a78346dbab..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/gets.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -/* - * This version reads directly from the buffer rather than looping on getc. - * Ptr args aren't checked for NULL because the program would be a - * catastrophic mess anyway. Better to abort than just to return NULL. - */ -#include <stdio.h> -#include "stdiom.h" -#include <memory.h> - -extern int _filbuf(); - -char * -gets(char *ptr) -{ - char *p, *ptr0 = ptr; - int n; - - for ( ; ; ) { - if (stdin->_cnt <= 0) { /* empty buffer */ - if (_filbuf(stdin) == EOF) { - if (ptr0 == ptr) - return (NULL); - break; /* no more data */ - } - stdin->_ptr--; - stdin->_cnt++; - } - n = stdin->_cnt; - if ((p = memccpy(ptr, (char *) stdin->_ptr, '\n', n)) != NULL) - n = p - ptr; - ptr += n; - stdin->_cnt -= n; - stdin->_ptr += n; - _BUFSYNC(stdin); - if (p != NULL) { /* found '\n' in buffer */ - ptr--; /* step back over '\n' */ - break; - } - } - *ptr = '\0'; - return (ptr0); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/getw.c b/usr/src/lib/libbc/libc/stdio/common/getw.c deleted file mode 100644 index 97df767bce..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/getw.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.3 */ - -/*LINTLIBRARY*/ -/* - * The intent here is to provide a means to make the order of - * bytes in an io-stream correspond to the order of the bytes - * in the memory while doing the io a `word' at a time. - */ -#include <stdio.h> - -int -getw(stream) -register FILE *stream; -{ - int w; - register char *s = (char *)&w; - register int i = sizeof(int); - - while (--i >= 0) - *s++ = getc(stream); - return (feof(stream) || ferror(stream) ? EOF : w); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/iob.c b/usr/src/lib/libbc/libc/stdio/common/iob.c deleted file mode 100644 index df2e0846d3..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/iob.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from Sun */ - -#include <stdio.h> -#include "iob.h" - -FILE _iob[NSTATIC] = { -#if pdp11 - { NULL, 0, NULL, 0, _IOREAD, 0 }, /* stdin */ - { NULL, 0, NULL, 0, _IOWRT, 1 }, /* stdout */ - { NULL, 0, NULL, 0, _IOWRT|_IONBF, 2 }, /* stderr */ -#else -#if u370 - { NULL, 0, NULL, 0, _IOREAD, 0 }, /* stdin */ - { NULL, 0, NULL, 0, _IOWRT, 1 }, /* stdout */ - { NULL, 0, NULL, 0, _IOWRT|_IONBF, 2 }, /* stderr */ -#else /* just about every other UNIX system in existence */ - { 0, NULL, NULL, 0, _IOREAD, 0 }, /* stdin */ - { 0, NULL, NULL, 0, _IOWRT, 1 }, /* stdout */ - { 0, NULL, NULL, 0, _IOWRT|_IONBF, 2 }, /* stderr */ -#endif -#endif -}; diff --git a/usr/src/lib/libbc/libc/stdio/common/iob.h b/usr/src/lib/libbc/libc/stdio/common/iob.h deleted file mode 100644 index 644dfecf46..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/iob.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1987 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#define NSTATIC 32 diff --git a/usr/src/lib/libbc/libc/stdio/common/putc.c b/usr/src/lib/libbc/libc/stdio/common/putc.c deleted file mode 100644 index 9cf2d6dae6..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/putc.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> - -#undef putc -#define __putc__(x, p) (--(p)->_cnt >= 0 ?\ - (int)(*(p)->_ptr++ = (unsigned char)(x)) :\ - (((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\ - ((*(p)->_ptr = (unsigned char)(x)) != '\n' ?\ - (int)(*(p)->_ptr++) :\ - _flsbuf(*(unsigned char *)(p)->_ptr, p)) :\ - _flsbuf((unsigned char)(x), p))) - -int -putc(c, fp) -register char c; -register FILE *fp; -{ - return (__putc__(c, fp)); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/putchar.c b/usr/src/lib/libbc/libc/stdio/common/putchar.c deleted file mode 100644 index 7a8fb3b9b5..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/putchar.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -/* - * A subroutine version of the macro putchar - */ -#include <stdio.h> -#undef putchar - -int -putchar(c) -register char c; -{ - return(putc(c, stdout)); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/puts.c b/usr/src/lib/libbc/libc/stdio/common/puts.c deleted file mode 100644 index ed6297474c..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/puts.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1986 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 3.3 */ - -/*LINTLIBRARY*/ -/* - * This version writes directly to the buffer rather than looping on putc. - * Ptr args aren't checked for NULL because the program would be a - * catastrophic mess anyway. Better to abort than just to return NULL. - */ -#include <stdio.h> -#include "stdiom.h" - -extern char *memccpy(); - -int -puts(ptr) -char *ptr; -{ - char *p; - register int ndone = 0, n; - register unsigned char *cptr, *bufend; - - if (_WRTCHK(stdout)) - return (EOF); - - bufend = stdout->_base + stdout->_bufsiz; - - for ( ; ; ptr += n) { - while ((n = bufend - (cptr = stdout->_ptr)) <= 0) /* full buf */ - if (_xflsbuf(stdout) == EOF) - return(EOF); - if ((p = memccpy((char *) cptr, ptr, '\0', n)) != NULL) - n = p - (char *) cptr; - stdout->_cnt -= n; - stdout->_ptr += n; - _BUFSYNC(stdout); - ndone += n; - if (p != NULL) { - stdout->_ptr[-1] = '\n'; /* overwrite '\0' with '\n' */ - if (stdout->_flag & (_IONBF | _IOLBF)) /* flush line */ - if (_xflsbuf(stdout) == EOF) - return(EOF); - return(ndone); - } - } -} diff --git a/usr/src/lib/libbc/libc/stdio/common/putw.c b/usr/src/lib/libbc/libc/stdio/common/putw.c deleted file mode 100644 index db34b3aed4..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/putw.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.3 */ - -/*LINTLIBRARY*/ -/* - * The intent here is to provide a means to make the order of - * bytes in an io-stream correspond to the order of the bytes - * in the memory while doing the io a `word' at a time. - */ -#include <stdio.h> - -int -putw(w, stream) -int w; -register FILE *stream; -{ - register char *s = (char *)&w; - register int i = sizeof(int); - - while (--i >= 0) - (void) putc(*s++, stream); - return (ferror(stream)); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/remove.c b/usr/src/lib/libbc/libc/stdio/common/remove.c deleted file mode 100644 index d886a73306..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/remove.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> - -#undef remove - -int -remove(fname) -register char *fname; -{ - return (unlink(fname)); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/rew.c b/usr/src/lib/libbc/libc/stdio/common/rew.c deleted file mode 100644 index d56416aed2..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/rew.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -#include <stdio.h> - -extern int fflush(); -extern long lseek(); - -void -rewind(iop) -register FILE *iop; -{ - (void) fflush(iop); - (void) lseek(fileno(iop), 0L, 0); - iop->_cnt = 0; - iop->_ptr = iop->_base; - iop->_flag &= ~(_IOERR | _IOEOF); - if(iop->_flag & _IORW) - iop->_flag &= ~(_IOREAD | _IOWRT); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/scanf.c b/usr/src/lib/libbc/libc/stdio/common/scanf.c deleted file mode 100644 index e024fb7c4f..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/scanf.c +++ /dev/null @@ -1,264 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <ctype.h> -#include <stdarg.h> -#include <errno.h> -#include <string.h> -#include <malloc.h> - -#define ON 1 -#define OFF 0 - -#define ARGMAX 64 -static unsigned char newap[ARGMAX * sizeof(double)]; -static unsigned char newform[256]; - -extern int _doscan(); - -static int format_arg(unsigned char *, unsigned char *, unsigned char *); - -int -scanf(char *fmt, ...) -{ - va_list ap; - char *nf; - int ret_val; - - - va_start(ap, fmt); - if (strlen(fmt) >= sizeof(newform)) { - nf = malloc(strlen(fmt)+1); - if (format_arg((unsigned char *)strcpy(nf, fmt), ap, newap) - == ON) { - va_end(ap); - ret_val = _doscan(stdin, nf, newap); - free(nf); - return(ret_val); - } - free(nf); - } else if (format_arg((unsigned char *)strcpy(newform, fmt), ap, newap) - == ON) { - va_end(ap); - return(_doscan(stdin, newform, newap)); - } - ret_val = _doscan(stdin, fmt, ap); - va_end(ap); - return (ret_val); -} - -int -fscanf(FILE *iop, char *fmt, ...) -{ - va_list ap; - char *nf; - int ret_val; - -#ifdef POSIX - if ( !(iop->_flag & (_IOREAD|_IORW)) ) { - iop->_flag |= _IOERR; - errno = EBADF; - return (EOF); - } -#endif /* POSIX */ - va_start(ap, fmt); - if (strlen(fmt) >= sizeof(newform)) { - nf = malloc(strlen(fmt)+1); - if (format_arg((unsigned char *)strcpy(nf, fmt), ap, newap) - == ON) { - va_end(ap); - ret_val = _doscan(stdin, nf, newap); - free(nf); - return(ret_val); - } - free(nf); - } else if (format_arg((unsigned char *)strcpy(newform, fmt), ap, newap) - == ON) { - va_end(ap); - return(_doscan(iop, newform, newap)); - } - ret_val = _doscan(iop, fmt, ap); - va_end(ap); - return (ret_val); -} - -int -sscanf(char *str, char *fmt, ...) -{ - va_list ap; - FILE strbuf; - char *nf; - int ret_val; - - va_start(ap, fmt); - strbuf._flag = _IOREAD|_IOSTRG; - strbuf._ptr = strbuf._base = (unsigned char*)str; - strbuf._cnt = strlen(str); - strbuf._bufsiz = strbuf._cnt; - if (strlen(fmt) >= sizeof(newform)) { - nf = malloc(strlen(fmt)+1); - if (format_arg((unsigned char *)strcpy(nf, fmt), ap, newap) - == ON) { - va_end(ap); - ret_val = _doscan(stdin, nf, newap); - free(nf); - return(ret_val); - } - free(nf); - } else if (format_arg((unsigned char *)strcpy(newform, fmt), ap, newap) - == ON) { - va_end(ap); - return(_doscan(&strbuf, newform, newap)); - } - ret_val = _doscan(&strbuf, fmt, ap); - va_end(ap); - return (ret_val); -} - -/* - * This function reorganises the format string and argument list. - */ - - -#ifndef NL_ARGMAX -#define NL_ARGMAX 9 -#endif - -struct al { - int a_num; /* arg # specified at this position */ - unsigned char *a_start; /* ptr to 'n' part of '%n$' in format str */ - unsigned char *a_end; /* ptr to '$'+1 part of '%n$' in format str */ - int *a_val; /* pointers to arguments */ -}; - -static int -format_arg(unsigned char *format, unsigned char *list, unsigned char *newlist) -{ - unsigned char *aptr, *bptr, *cptr; - int i, fcode, nl_fmt, num, length, j; - unsigned char *fmtsav; - struct al args[ARGMAX + 1]; - -#ifdef VTEST - { - int fd; - fd = creat("/tmp/SCANF", 0666); - } -#endif - for (i = 0; i <= ARGMAX; args[i++].a_num = 0); - nl_fmt = 0; - i = j = 1; - while (*format) { - while ((fcode = *format++) != '\0' && fcode != '%') ; - if (!fcode || i > ARGMAX) - break; - charswitch: - switch (fcode = *format++) { - case 'l': - case 'h': - goto charswitch; - case '0': case '1': case '2': - case '3': case '4': case '5': - case '6': case '7': case '8': - case '9': - num = fcode - '0'; - fmtsav = format; - while (isdigit(fcode = *format)) { - num = num * 10 + fcode - '0'; - format++; - } - if (*format == '$') { - nl_fmt++; - args[i].a_start = fmtsav - 1; - args[i].a_end = ++format; - if (num > NL_ARGMAX) - num = num; - args[i].a_num = num; - } - goto charswitch; - /* now have arg type only to parse */ - case 'd': case 'u': case 'o': - case 'x': case 'e': case 'f': - case 'g': case 'c': case '[': - case 's': - if (nl_fmt == 0) - return(OFF); - if (!args[i].a_num) { - args[i].a_start = args[i].a_end = format - 1; - args[i].a_num = j++; - } - i++; - break; - case '*': - case '%': - break; - default: - format--; - break; - } - } - length = i; - if (nl_fmt == 0) - return (OFF); - for (i = 1; i < length && args[i].a_num == 0; i++); - - /* - * Reformat the format string - */ - cptr = aptr = args[i].a_start; - do { - bptr = args[i++].a_end; - for (; i < length && args[i].a_num == 0; i++); - if (i == length) - while (*cptr++); - else - cptr = args[i].a_start; - for (; bptr != cptr; *aptr++ = *bptr++); - } while (i < length); - - /* - * Create arglist - * assuming that pointer to all variable type have - * same size. - */ - for (i = 1; i < length; i++) - args[i].a_val = ((int **)(list += sizeof(int *)))[-1]; - - for (i = 1; i < length; i++) { - int **ptr; - ptr = (int **)newlist; - *ptr = args[args[i].a_num].a_val; - newlist += sizeof(int *); - } - return(ON); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/setbuffer.c b/usr/src/lib/libbc/libc/stdio/common/setbuffer.c deleted file mode 100644 index dd1afa49d9..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/setbuffer.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1986 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * University Copyright- Copyright (c) 1982, 1986, 1988 - * The Regents of the University of California - * All Rights Reserved - * - * University Acknowledgment- Portions of this document are derived from - * software developed by the University of California, Berkeley, and its - * contributors. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <malloc.h> -#include <unistd.h> - -extern unsigned char (*_smbuf)[_SBFSIZ]; - -void -setbuffer(FILE *iop, char *buf, int size) -{ - int fno = fileno(iop); /* file number */ - - if (iop->_base != NULL && iop->_flag&_IOMYBUF) - free((char *)iop->_base); - iop->_flag &= ~(_IOMYBUF|_IONBF|_IOLBF); - if ((iop->_base = (unsigned char *)buf) == NULL) { - iop->_flag |= _IONBF; /* file unbuffered except in fastio */ - /* use small buffers reserved for this */ - iop->_base = _smbuf[fno]; - iop->_bufsiz = _SBFSIZ; - } else { - /* regular buffered I/O, specified buffer size */ - if (size <= 0) - return; - iop->_bufsiz = size; - } - iop->_ptr = iop->_base; - iop->_cnt = 0; -} - -/* - * set line buffering - */ -int -setlinebuf(FILE *iop) -{ - char *buf; - - fflush(iop); - setbuffer(iop, NULL, 0); - buf = (char *)malloc(128); - if (buf != NULL) { - setbuffer(iop, buf, 128); - iop->_flag |= _IOLBF|_IOMYBUF; - } - return (0); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/setvbuf.c b/usr/src/lib/libbc/libc/stdio/common/setvbuf.c deleted file mode 100644 index 3721c52147..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/setvbuf.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1986 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -#include <stdio.h> - -extern void free(); -extern unsigned char (*_smbuf)[_SBFSIZ]; -extern char *malloc(); -extern void _getsmbuf(); - -int -setvbuf(iop, buf, type, size) -register FILE *iop; -register char *buf; -register int type; -register int size; -{ - register int fno = fileno(iop); /* file number */ - - if(iop->_base != NULL && iop->_flag & _IOMYBUF) - free((char*)iop->_base); - iop->_flag &= ~(_IOMYBUF | _IONBF | _IOLBF); - switch (type) { - /*note that the flags are the same as the possible values for type*/ - case _IONBF: - /* file is unbuffered except in fastio */ - iop->_flag |= _IONBF; - /* use small buffers reserved for this */ - iop->_base = _smbuf[fno]; - iop->_bufsiz = _SBFSIZ; - break; - case _IOLBF: - case _IOFBF: - if (size < 0) - return -1; - iop->_flag |= type; - size = (size == 0) ? BUFSIZ : size; - /* - * need eight characters beyond bufend for stdio slop - */ - if (size <= 8) { - size = BUFSIZ; - buf = NULL; - } - if (buf == NULL) { - size += 8; - buf = malloc((unsigned)size); - iop->_flag |= _IOMYBUF; - } - iop->_base = (unsigned char *)buf; - iop->_bufsiz = size - 8; - break; - default: - return -1; - } - iop->_ptr = iop->_base; - iop->_cnt = 0; - return 0; -} diff --git a/usr/src/lib/libbc/libc/stdio/common/stdiom.h b/usr/src/lib/libbc/libc/stdio/common/stdiom.h deleted file mode 100644 index cac8d3c0b5..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/stdiom.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* The following macros improve performance of the stdio by reducing the - number of calls to _bufsync and _wrtchk. _BUFSYNC has the same - effect as _bufsync, and _WRTCHK has the same effect as _wrtchk, - but often these functions have no effect, and in those cases the - macros avoid the expense of calling the functions. */ - -#define _BUFSYNC(iop) if ((iop->_base + iop->_bufsiz) - iop->_ptr < \ - ( iop->_cnt < 0 ? 0 : iop->_cnt ) ) \ - _bufsync(iop) -#define _WRTCHK(iop) ((((iop->_flag & (_IOWRT | _IOEOF)) != _IOWRT) \ - || (iop->_base == NULL) \ - || (iop->_ptr == iop->_base && iop->_cnt == 0 \ - && !(iop->_flag & (_IONBF | _IOLBF)))) \ - ? _wrtchk(iop) : 0 ) diff --git a/usr/src/lib/libbc/libc/stdio/common/tempnam.c b/usr/src/lib/libbc/libc/stdio/common/tempnam.c deleted file mode 100644 index 53631b1c7a..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/tempnam.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1993 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.1 */ - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <string.h> - -#define max(A,B) (((A)<(B))?(B):(A)) - -extern char *malloc(), *getenv(), *mktemp(); -extern int access(); - -static char *pcopy(); -static char seed[4]; - -char * -tempnam(dir, pfx) -char *dir; /* use this directory please (if non-NULL) */ -char *pfx; /* use this (if non-NULL) as filename prefix */ -{ - register char *p, *q, *tdir; - int x=0, y=0, z; - - if (seed[0] == 0) - seed[0] = seed[1] = seed[2] = 'A'; - z=strlen(P_tmpdir); - if((tdir = getenv("TMPDIR")) != NULL) { - x = strlen(tdir); - } - if(dir != NULL) { - y=strlen(dir); - } - if((p=malloc((unsigned)(max(max(x,y),z)+16))) == NULL) - return(NULL); - if(x > 0 && access(pcopy(p, tdir), 3) == 0) - goto OK; - if(y > 0 && access(pcopy(p, dir), 3) == 0) - goto OK; - if(access(pcopy(p, P_tmpdir), 3) == 0) - goto OK; - if(access(pcopy(p, "/tmp"), 3) != 0) - return(NULL); -OK: - (void)strcat(p, "/"); - if(pfx) { - *(p+strlen(p)+5) = '\0'; - (void)strncat(p, pfx, 5); - } - (void)strcat(p, seed); - (void)strcat(p, "XXXXXX"); - q = seed; - while(*q == 'Z') - *q++ = 'A'; - ++*q; - if(*mktemp(p) == '\0') - return(NULL); - return(p); -} - -static char* -pcopy(space, arg) -char *space, *arg; -{ - char *p; - - if(arg) { - (void)strcpy(space, arg); - p = space-1+strlen(space); - if(*p == '/') - *p = '\0'; - } - return(space); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/tmpfile.c b/usr/src/lib/libbc/libc/stdio/common/tmpfile.c deleted file mode 100644 index 5981194b75..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/tmpfile.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.3 */ - -/*LINTLIBRARY*/ -/* - * tmpfile - return a pointer to an update file that can be - * used for scratch. The file will automatically - * go away if the program using it terminates. - */ -#include <stdio.h> - -extern FILE *fopen(); -extern int unlink(); -extern char *tmpnam(); -extern void perror(); - -FILE * -tmpfile() -{ - char tfname[L_tmpnam]; - register FILE *p; - - (void) tmpnam(tfname); - if((p = fopen(tfname, "w+")) == NULL) - return NULL; - else - (void) unlink(tfname); - return(p); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/tmpnam.c b/usr/src/lib/libbc/libc/stdio/common/tmpnam.c deleted file mode 100644 index ed20714514..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/tmpnam.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */ - -/*LINTLIBRARY*/ -#include <stdio.h> - -extern char *mktemp(), *strcpy(), *strcat(); -static char str[L_tmpnam], seed[] = { 'a', 'a', 'a', '\0' }; - -char * -tmpnam(s) -char *s; -{ - register char *p, *q; - register int cnt = 0; - - p = (s == NULL)? str: s; - (void) strcpy(p, P_tmpdir); - (void) strcat(p, seed); - (void) strcat(p, "XXXXXX"); - - q = seed; - while(*q == 'z') { - *q++ = 'a'; - cnt++; - } - if (cnt < 3) - ++*q; - - (void) mktemp(p); - return(p); -} diff --git a/usr/src/lib/libbc/libc/stdio/common/ungetc.c b/usr/src/lib/libbc/libc/stdio/common/ungetc.c deleted file mode 100644 index f6c5f8b8f4..0000000000 --- a/usr/src/lib/libbc/libc/stdio/common/ungetc.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1988 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 2.1 */ - -/*LINTLIBRARY*/ -#include <stdio.h> - -int -ungetc(c, iop) -int c; -register FILE *iop; -{ - if(c == EOF) - return(EOF); - if((iop->_flag & (_IOREAD|_IORW)) == 0) - return(EOF); - - if (iop->_base == NULL) /* get buffer if we don't have one */ - _findbuf(iop); - - if((iop->_flag & _IOREAD) == 0 || iop->_ptr <= iop->_base) - if(iop->_ptr == iop->_base && iop->_cnt == 0) - ++iop->_ptr; - else - return(EOF); - if (*--iop->_ptr != c) *iop->_ptr = c; /* was *--iop->_ptr = c; */ - ++iop->_cnt; - return(c); -} diff --git a/usr/src/lib/libbc/libc/stdio/sys5/filbuf.c b/usr/src/lib/libbc/libc/stdio/sys5/filbuf.c deleted file mode 100644 index 7d197f149c..0000000000 --- a/usr/src/lib/libbc/libc/stdio/sys5/filbuf.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1998 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <unistd.h> - -extern void _findbuf(); - -static void lbfflush(FILE *); - -int -__filbuf(FILE *iop) -{ - return (_filbuf(iop)); -} - -int -_filbuf(FILE *iop) -{ - if ( !(iop->_flag & _IOREAD) ) - if (iop->_flag & _IORW) - iop->_flag |= _IOREAD; - else - return(EOF); - - if (iop->_flag&_IOSTRG) - return(EOF); - - if (iop->_base == NULL) /* get buffer if we don't have one */ - _findbuf(iop); - - /* if this device is a terminal (line-buffered) or unbuffered, then */ - /* flush buffers of all line-buffered devices currently writing */ - - if (iop->_flag & (_IOLBF | _IONBF)) - _fwalk(lbfflush); - - iop->_ptr = iop->_base; - iop->_cnt = read(fileno(iop), (char *)iop->_base, - (unsigned)((iop->_flag & _IONBF) ? 1 : iop->_bufsiz )); - if (--iop->_cnt >= 0) /* success */ - return (*iop->_ptr++); - if (iop->_cnt != -1) /* error */ - iop->_flag |= _IOERR; - else { /* end-of-file */ - iop->_flag |= _IOEOF; - if (iop->_flag & _IORW) - iop->_flag &= ~_IOREAD; - } - iop->_cnt = 0; - return (EOF); -} - -static void -lbfflush(FILE *iop) -{ - if (iop->_flag & _IOLBF) - (void) fflush(iop); -} diff --git a/usr/src/lib/libbc/libc/stdio/sys5/flsbuf.c b/usr/src/lib/libbc/libc/stdio/sys5/flsbuf.c deleted file mode 100644 index 4dcc1f3f18..0000000000 --- a/usr/src/lib/libbc/libc/stdio/sys5/flsbuf.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <errno.h> -#include "../common/stdiom.h" -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <malloc.h> - -extern unsigned char (*_smbuf)[_SBFSIZ]; - -void _findbuf(FILE *); -void _bufsync(FILE *); - -extern int fclose(); - -/* - * Flush buffers on exit - */ -void -_cleanup(void) -{ - - _fwalk(fclose); -} - -/* - * fclose() will flush (output) buffers for a buffered open - * FILE and then issue a system close on the _fileno. The - * _base field will be reset to NULL for any but stdin and - * stdout, the _ptr field will be set the same as the _base - * field. The _flags and the _cnt field will be zeroed. - * If buffers had been obtained via malloc(), the space will - * be free()'d. In case the FILE was not open, or fflush() - * or close() failed, an EOF will be returned, otherwise the - * return value is 0. - */ -int -fclose(FILE *iop) -{ - int rtn=EOF; - - if(iop == NULL) - return(rtn); - if(iop->_flag & (_IOREAD | _IOWRT | _IORW) - && (iop->_flag & _IOSTRG) == 0) { - rtn = (iop->_flag & _IONBF)? 0: fflush(iop); - if(close(fileno(iop)) < 0) - rtn = EOF; - } - if(iop->_flag & _IOMYBUF) { - free((char*)iop->_base); - iop->_base = NULL; - } - iop->_flag = 0; - iop->_cnt = 0; - iop->_ptr = iop->_base; - iop->_bufsiz = 0; - return(rtn); -} - -/* - * The fflush() routine must take care because of the - * possibility for recursion. The calling program might - * do IO in an interupt catching routine that is likely - * to interupt the write() call within fflush() - */ - -int -fflush(FILE *iop) -{ - if (!(iop->_flag & _IOWRT)) { - if ((iop->_base != NULL) && iop->_cnt) { - lseek(iop->_file, -(iop->_cnt), SEEK_CUR); - iop->_cnt = 0; - } - return(0); - } - while(!(iop->_flag & _IONBF) && (iop->_flag & _IOWRT) && - (iop->_base != NULL) && (iop->_ptr > iop->_base) ) - (void) _xflsbuf(iop); - return(ferror(iop) ? EOF : 0); -} - -/* - * The routine _flsbuf may or may not actually flush the output buffer. If - * the file is line-buffered, the fact that iop->_cnt has run below zero - * is meaningless: it is always kept below zero so that invocations of putc - * will consistently give control to _flsbuf, even if the buffer is far from - * full. _flsbuf, on seeing the "line-buffered" flag, determines whether the - * buffer is actually full by comparing iop->_ptr to the end of the buffer - * iop->_base + iop->_bufsiz. If it is full, or if an output line is - * completed (with a newline), the buffer is flushed. (Note: the character - * argument to _flsbuf is not flushed with the current buffer if the buffer - * is actually full -- it goes into the buffer after flushing.) - */ - -int -_flsbuf(unsigned char c, FILE *iop) -{ - unsigned char c1; - - do { - /* check for linebuffered with write perm, but no EOF */ - if ( (iop->_flag & (_IOLBF | _IOWRT | _IOEOF)) == (_IOLBF | _IOWRT) ) { - if ( iop->_ptr >= iop->_base + iop->_bufsiz ) /* if buffer full, */ - break; /* exit do-while, and flush buf. */ - if ( (*iop->_ptr++ = c) != '\n' ) - return(c); - return(_xflsbuf(iop) == EOF ? EOF : c); - } - /* write out an unbuffered file, if have write perm, but no EOF */ - if ( (iop->_flag & (_IONBF | _IOWRT | _IOEOF)) == (_IONBF | _IOWRT) ) { - c1 = c; - iop->_cnt = 0; - if (write(fileno(iop), (char *) &c1, 1) == 1) - return(c); - iop->_flag |= _IOERR; - return(EOF); - } - /* The _wrtchk call is here rather than at the top of _flsbuf to re- */ - /* duce overhead for line-buffered I/O under normal circumstances. */ - - if (_WRTCHK(iop)) /* is writing legitimate? */ - return(EOF); - } while ( (iop->_flag & (_IONBF | _IOLBF)) ); - - - (void) _xflsbuf(iop); /* full buffer: flush buffer */ - (void) putc((char) c, iop); /* then put "c" in newly emptied buf */ - /* (which, because of signals, may NOT be empty) */ - return( ferror(iop) ? EOF : c); -} - -/* - * The function _xflsbuf writes out the current contents of the output - * buffer delimited by iop->_base and iop->_ptr. - * iop->_cnt is reset appropriately, but its value on entry to _xflsbuf - * is ignored. - * - * The following code is not strictly correct. If a signal is raised, - * invoking a signal-handler which generates output into the same buffer - * being flushed, a peculiar output sequence may result (for example, - * the output generated by the signal-handler may appear twice). At - * present no means has been found to guarantee correct behavior without - * resorting to the disabling of signals, a means considered too expensive. - * For now the code has been written with the intent of reducing the - * probability of strange effects and, when they do occur, of confining - * the damage. Except under extremely pathological circumstances, this - * code should be expected to respect buffer boundaries even in the face - * of interrupts and other signals. - */ - -int -_xflsbuf(FILE *iop) -{ - unsigned char *base; - int n; - - n = iop->_ptr - (base = iop->_base); - iop->_ptr = base; - iop->_cnt = (iop->_flag &(_IONBF | _IOLBF)) ? 0 : iop->_bufsiz; - _BUFSYNC(iop); - if (n > 0 && n != write(fileno(iop),(char*)base,(unsigned)n) ) { - iop->_flag |= _IOERR; - return(EOF); - } - return(0); -} - -/* - * The function _wrtchk checks to see whether it is legitimate to write - * to the specified device. If it is, _wrtchk sets flags in iop->_flag for - * writing, assures presence of a buffer, and returns 0. If writing is not - * legitimate, EOF is returned. - */ - -int -_wrtchk(FILE *iop) -{ - if ( (iop->_flag & (_IOWRT | _IOEOF)) != _IOWRT ) { - if (!(iop->_flag & (_IOWRT | _IORW))) - return(EOF); /* bogus call--read-only file */ - iop->_flag = iop->_flag & ~_IOEOF | _IOWRT; /* fix flags */ - } - if (iop->_flag & _IOSTRG) - return(0); /* not our business to monkey with buffers or counts */ - if (iop->_base == NULL) /* this is first I/O to file--get buffer */ - _findbuf(iop); - if (iop->_ptr == iop->_base && !(iop->_flag & (_IONBF | _IOLBF)) ) { - iop->_cnt = iop->_bufsiz; /* first write since seek--set cnt */ - _BUFSYNC(iop); - } - return(0); -} - -/* - * _findbuf, called only when iop->_base == NULL, locates a predefined buffer - * or allocates a buffer using malloc. If a buffer is obtained from malloc, - * the _IOMYBUF flag is set in iop->_flag. - */ - -void -_findbuf(FILE *iop) -{ - int fno = fileno(iop); /* file number */ - struct stat statb; - int size; - - /* allocate a small block for unbuffered, large for buffered */ - if (iop->_flag & _IONBF) { - iop->_base = _smbuf[fno]; - iop->_bufsiz = _SBFSIZ; - } else { - - if ( isatty(fno) ) { - iop->_flag |= _IOLBF; - size = 128; - } else { - if (fstat(fno, &statb) < 0) - size = BUFSIZ; - else { - if ((size = statb.st_blksize) <= 0) - size = BUFSIZ; - } - } - if ((iop->_base = (unsigned char *) malloc(size+8)) != NULL) { - /* if we got a buffer */ - iop->_flag |= _IOMYBUF; - iop->_bufsiz = size; - } else { - /* if no room for buffer, use small buffer */ - iop->_base = _smbuf[fno]; - iop->_bufsiz = _SBFSIZ; - iop->_flag &= ~_IOLBF; - iop->_flag |= _IONBF; - } - } - iop->_ptr = iop->_base; -} - -/* - * The function _bufsync is called because interrupts and other signals - * which occur in between the decrementing of iop->_cnt and the incrementing - * of iop->_ptr, or in other contexts as well, may upset the synchronization - * of iop->_cnt and iop->ptr. If this happens, calling _bufsync should - * resynchronize the two quantities (this is not always possible). Resyn- - * chronization guarantees that putc invocations will not write beyond - * the end of the buffer. Note that signals during _bufsync can cause - * _bufsync to do the wrong thing, but usually with benign effects. - */ - -void -_bufsync(FILE *iop) -{ - int spaceleft; - unsigned char *bufend = iop->_base + iop->_bufsiz; - - if ((spaceleft = bufend - iop->_ptr) < 0) - iop->_ptr = bufend; - else if (spaceleft < iop->_cnt) - iop->_cnt = spaceleft; -} diff --git a/usr/src/lib/libbc/libc/stdio/sys5/fopen.c b/usr/src/lib/libbc/libc/stdio/sys5/fopen.c deleted file mode 100644 index e156dfc876..0000000000 --- a/usr/src/lib/libbc/libc/stdio/sys5/fopen.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ - -#include <stdio.h> -#include <fcntl.h> - -extern FILE *_findiop(); -static FILE *_endopen(); - -FILE * -fopen(char *file, char *mode) -{ - return (_endopen(file, mode, _findiop())); -} - -FILE * -freopen(char *file, char *mode, FILE *iop) -{ - (void) fclose(iop); /* doesn't matter if this fails */ - return (_endopen(file, mode, iop)); -} - -static FILE * -_endopen(char *file, char *mode, FILE *iop) -{ - int plus, oflag, fd; - - if (iop == NULL || file == NULL || file[0] == '\0') - return (NULL); - plus = (mode[1] == '+'); - switch (mode[0]) { - case 'w': - oflag = (plus ? O_RDWR : O_WRONLY) | O_TRUNC | O_CREAT; - break; - case 'a': - oflag = (plus ? O_RDWR : O_WRONLY) | O_APPEND | O_CREAT; - break; - case 'r': - oflag = plus ? O_RDWR : O_RDONLY; - break; - default: - return (NULL); - } - if ((fd = open(file, oflag, 0666)) < 0) - return (NULL); - iop->_cnt = 0; - iop->_file = fd; - iop->_flag = plus ? _IORW : (mode[0] == 'r') ? _IOREAD : _IOWRT; - if (mode[0] == 'a') { - if (!plus) { - /* if update only mode, move file pointer to the end - of the file */ - if ((lseek(fd,0L,2)) < 0) { - (void) close(fd); - return NULL; - } - } - } - iop->_base = iop->_ptr = NULL; - iop->_bufsiz = 0; - return (iop); -} diff --git a/usr/src/lib/libbc/libc/stdio/sys5/fprintf.c b/usr/src/lib/libbc/libc/stdio/sys5/fprintf.c deleted file mode 100644 index a04eb6080f..0000000000 --- a/usr/src/lib/libbc/libc/stdio/sys5/fprintf.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <stdarg.h> - -extern int _doprnt(); - -int -fprintf(FILE *iop, char *format, ...) -{ - unsigned char localbuf[BUFSIZ]; - int count; - va_list ap; - - if (!(iop->_flag & _IOWRT)) { - /* if no write flag */ - if (iop->_flag & _IORW) { - /* if ok, cause read-write */ - iop->_flag |= _IOWRT; - } else { - /* else error */ - return (EOF); - } - } - va_start(ap, format); - if (iop->_flag & _IONBF) { - iop->_flag &= ~_IONBF; - iop->_ptr = iop->_base = localbuf; - iop->_bufsiz = BUFSIZ; - count = _doprnt(format, ap, iop); - fflush(iop); - iop->_flag |= _IONBF; - iop->_base = NULL; - iop->_bufsiz = 0; - iop->_cnt = 0; - } else - count = _doprnt(format, ap, iop); - va_end(ap); - return (ferror(iop)? EOF: count); -} diff --git a/usr/src/lib/libbc/libc/stdio/sys5/printf.c b/usr/src/lib/libbc/libc/stdio/sys5/printf.c deleted file mode 100644 index 87319f3283..0000000000 --- a/usr/src/lib/libbc/libc/stdio/sys5/printf.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <stdarg.h> - -extern int _doprnt(); - -int -printf(char *format, ...) -{ - int count; - va_list ap; - - if (!(stdout->_flag & _IOWRT)) { - /* if no write flag */ - if (stdout->_flag & _IORW) { - /* if ok, cause read-write */ - stdout->_flag |= _IOWRT; - } else { - /* else error */ - return (EOF); - } - } - va_start(ap, format); - count = _doprnt(format, ap, stdout); - va_end(ap); - return (ferror(stdout)? EOF: count); -} diff --git a/usr/src/lib/libbc/libc/stdio/sys5/setbuf.c b/usr/src/lib/libbc/libc/stdio/sys5/setbuf.c deleted file mode 100644 index 3ad6092e4d..0000000000 --- a/usr/src/lib/libbc/libc/stdio/sys5/setbuf.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1986 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 2.2 */ - -/*LINTLIBRARY*/ -#include <stdio.h> - -extern void free(); -extern int isatty(); -extern unsigned char (*_smbuf)[_SBFSIZ]; -extern void _getsmbuf(); - -void -setbuf(iop, buf) -register FILE *iop; -char *buf; -{ - register int fno = fileno(iop); /* file number */ - - if(iop->_base != NULL && iop->_flag & _IOMYBUF) - free((char*)iop->_base); - iop->_flag &= ~(_IOMYBUF | _IONBF | _IOLBF); - if((iop->_base = (unsigned char*)buf) == NULL) { - iop->_flag |= _IONBF; /* file unbuffered except in fastio */ - /* use small buffers reserved for this */ - iop->_base = _smbuf[fno]; - iop->_bufsiz = _SBFSIZ; - } - else { /* regular buffered I/O, standard buffer size */ - if (isatty(fno)) - iop->_flag |= _IOLBF; - iop->_bufsiz = BUFSIZ; - } - iop->_ptr = iop->_base; - iop->_cnt = 0; -} diff --git a/usr/src/lib/libbc/libc/stdio/sys5/sprintf.c b/usr/src/lib/libbc/libc/stdio/sys5/sprintf.c deleted file mode 100644 index 51814e7595..0000000000 --- a/usr/src/lib/libbc/libc/stdio/sys5/sprintf.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <stdarg.h> -#include <values.h> - -extern int _doprnt(); - -int -sprintf(char *string, char *format, ...) -{ - int count; - FILE siop; - va_list ap; - - siop._cnt = MAXINT; - siop._base = siop._ptr = (unsigned char *)string; - siop._flag = _IOWRT+_IOSTRG; - va_start(ap, format); - count = _doprnt(format, ap, &siop); - va_end(ap); - *siop._ptr = '\0'; /* plant terminating null character */ - return(count); -} diff --git a/usr/src/lib/libbc/libc/stdio/sys5/vfprintf.c b/usr/src/lib/libbc/libc/stdio/sys5/vfprintf.c deleted file mode 100644 index fa4bb97a12..0000000000 --- a/usr/src/lib/libbc/libc/stdio/sys5/vfprintf.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <stdarg.h> - -extern int _doprnt(); - -int -vfprintf(FILE *iop, char *format, va_list ap) -{ - unsigned char localbuf[BUFSIZ]; - int count; - - if (!(iop->_flag & _IOWRT)) { - /* if no write flag */ - if (iop->_flag & _IORW) { - /* if ok, cause read-write */ - iop->_flag |= _IOWRT; - } else { - /* else error */ - return (EOF); - } - } - if (iop->_flag & _IONBF) { - iop->_flag &= ~_IONBF; - iop->_ptr = iop->_base = localbuf; - iop->_bufsiz = BUFSIZ; - count = _doprnt(format, ap, iop); - fflush(iop); - iop->_flag |= _IONBF; - iop->_base = NULL; - iop->_bufsiz = 0; - iop->_cnt = 0; - } else { - count = _doprnt(format, ap, iop); - } - return (ferror(iop)? EOF: count); -} diff --git a/usr/src/lib/libbc/libc/stdio/sys5/vprintf.c b/usr/src/lib/libbc/libc/stdio/sys5/vprintf.c deleted file mode 100644 index 9973cf3cdd..0000000000 --- a/usr/src/lib/libbc/libc/stdio/sys5/vprintf.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -/* - * Portions of this source code were derived from Berkeley 4.3 BSD - * under license from the Regents of the University of California. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <stdarg.h> - -extern int _doprnt(); - -int -vprintf(char *format, va_list ap) -{ - int count; - - if (!(stdout->_flag & _IOWRT)) { - /* if no write flag */ - if (stdout->_flag & _IORW) { - /* if ok, cause read-write */ - stdout->_flag |= _IOWRT; - } else { - /* else error */ - return (EOF); - } - } - count = _doprnt(format, ap, stdout); - return (ferror(stdout)? EOF: count); -} diff --git a/usr/src/lib/libbc/libc/stdio/sys5/vsprintf.c b/usr/src/lib/libbc/libc/stdio/sys5/vsprintf.c deleted file mode 100644 index 09dca81392..0000000000 --- a/usr/src/lib/libbc/libc/stdio/sys5/vsprintf.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -/* - * Portions of this source code were derived from Berkeley 4.3 BSD - * under license from the Regents of the University of California. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/*LINTLIBRARY*/ -#include <stdio.h> -#include <stdarg.h> -#include <values.h> - -extern int _doprnt(); - -/*VARARGS2*/ -int -vsprintf(char *string, char *format, va_list ap) -{ - int count; - FILE siop; - - siop._cnt = MAXINT; - siop._base = siop._ptr = (unsigned char *)string; - siop._flag = _IOWRT+_IOSTRG; - count = _doprnt(format, ap, &siop); - *siop._ptr = '\0'; /* plant terminating null character */ - return (count); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/access.c b/usr/src/lib/libbc/libc/sys/4.2/access.c deleted file mode 100644 index 84c6ce7154..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/access.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "chkpath.h" -#include <sys/syscall.h> -#include <unistd.h> -#include <sys/param.h> - -int -access(char *path, int mode) -{ - CHKNULL(path); - - return (access_com(path, mode)); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/chdir.c b/usr/src/lib/libbc/libc/sys/4.2/chdir.c deleted file mode 100644 index 5d1f8e1b67..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/chdir.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "chkpath.h" - -int -chdir(char *s) -{ - CHKNULL(s); - return (_syscall(SYS_chdir, s)); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/chkpath.h b/usr/src/lib/libbc/libc/sys/4.2/chkpath.h deleted file mode 100644 index cb8c8f8b8e..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/chkpath.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/syscall.h> -#include <errno.h> - -#define CHKNULL(p) \ - if ((p) == (char *)0 || (p) == (char *)-1) { \ - errno = EFAULT; \ - return (-1); \ - } else if (*(p) == 0) { \ - p = "."; \ - } diff --git a/usr/src/lib/libbc/libc/sys/4.2/chmod.c b/usr/src/lib/libbc/libc/sys/4.2/chmod.c deleted file mode 100644 index ea98fb387a..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/chmod.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. - */ - -#include "chkpath.h" -#include <sys/fcntl.h> - -int -chmod(char *s, mode_t m) -{ - CHKNULL(s); - return (_syscall(SYS_fchmodat, AT_FDCWD, s, m, 0)); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/chown.c b/usr/src/lib/libbc/libc/sys/4.2/chown.c deleted file mode 100644 index 4071372779..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/chown.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include "chkpath.h" -#include <sys/syscall.h> -#include <sys/fcntl.h> - -int -chown(char *s, int u, int g) -{ - CHKNULL(s); - return (_syscall(SYS_fchownat, AT_FDCWD, s, u, g, AT_SYMLINK_NOFOLLOW)); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/chroot.c b/usr/src/lib/libbc/libc/sys/4.2/chroot.c deleted file mode 100644 index cc888bf379..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/chroot.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "chkpath.h" - -int -chroot(char *d) -{ - CHKNULL(d); - return (_syscall(SYS_chroot, d)); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/creat.c b/usr/src/lib/libbc/libc/sys/4.2/creat.c deleted file mode 100644 index a226b14cd8..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/creat.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "chkpath.h" -#include <sys/syscall.h> -#include <unistd.h> -#include <errno.h> -#include <sys/param.h> - -int -creat(char *path, int mode) -{ - CHKNULL(path); - - return (creat_com(path, mode)); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/execve.c b/usr/src/lib/libbc/libc/sys/4.2/execve.c deleted file mode 100644 index 8851439266..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/execve.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include "chkpath.h" -#include <string.h> -#include <sys/file.h> -#include <sys/syscall.h> - -int -execve(char *file, char **argv, char **arge) -{ - char *c; - char path[256]; - - - CHKNULL(file); - if (strncmp(file, "/usr/ucb", strlen("/usr/ucb")) == 0) { - if (_syscall(SYS_faccessat, AT_FDCWD, file, F_OK, 0) == -1) { - strcpy(path, "/usr/bin"); - strcat(path, strrchr(file, '/')); - file = path; - } - } - else if (strncmp(file, "/bin", strlen("/bin")) == 0 || - strncmp(file, "/usr/bin", strlen("/usr/bin")) == 0) { - strcpy(path, "/usr/ucb"); - strcat(path, strrchr(file, '/')); - if (_syscall(SYS_faccessat, AT_FDCWD, path, F_OK, 0) == 0) - file = path; - } - else if (strncmp(file, "/usr/5bin", strlen("/usr/5bin")) == 0) { - strcpy(path, "/usr/bin"); - strcat(path, strrchr(file, '/')); - if (_syscall(SYS_faccessat, AT_FDCWD, path, F_OK, 0) == 0) - file = path; - else { - strcpy(path, "/usr/ucb"); - strcat(path, strrchr(file, '/')); - if (_syscall(SYS_faccessat, AT_FDCWD, path, F_OK, 0) - == 0) - file = path; - } - } - - return (_syscall(SYS_execve, file, argv, arge)); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/fcntl.c b/usr/src/lib/libbc/libc/sys/4.2/fcntl.c deleted file mode 100644 index 8e19913010..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/fcntl.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1990-1996 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <sys/errno.h> -#include <sys/fcntl.h> -#include <sys/filio.h> -#include <sys/ioccom.h> -#include <sys/syscall.h> - - -/* The following is an array of fcntl commands. The numbers listed - * below are from SVR4. Array is indexed with SunOS 4.1 numbers to - * obtain the SVR4 numbers. - */ -int cmd_op[14] = {0, 1, 2, 3, 4, 23, 24, 14, 6, 7, 21, 20, -1, 22}; - -/* SVR4/SunOS 5.0 equivalent modes */ -#define N_O_NDELAY 0x04 -#define N_O_SYNC 0x10 -#define N_O_NONBLOCK 0x80 -#define N_O_CREAT 0x100 -#define N_O_TRUNC 0x200 -#define N_O_EXCL 0x400 - -#define S5_FASYNC 0x1000 - -/* from SVR4 stropts.h */ -#define S5_S_RDNORM 0x0040 -#define S5_S_WRNORM 0x0004 -#define S5_S_RDBAND 0x0080 -#define S5_S_BANDURG 0x0200 -#define S5_I_SETSIG (('S'<<8)|011) -#define S5_I_GETSIG (('S'<<8)|012) - -/* Mask corresponding to the bits above in SunOS 4.x */ -#define FLAGS_MASK (O_SYNC|O_NONBLOCK|O_CREAT|O_TRUNC|O_EXCL \ - |O_NDELAY|FNBIO|FASYNC) -#define N_FLAGS_MASK (N_O_NDELAY|N_O_SYNC|N_O_NONBLOCK|N_O_CREAT \ - |N_O_TRUNC|N_O_EXCL|S5_FASYNC) - -struct n_flock { - short l_type; - short l_whence; - long l_start; - long l_len; /* len == 0 means until end of file */ - long l_sysid; - long l_pid; - long pad[4]; /* reserve area */ -} ; - - -int fcntl(fd, cmd, arg) -int fd, cmd, arg; -{ - return(bc_fcntl(fd, cmd, arg)); -} - - -int bc_fcntl(fd, cmd, arg) -int fd, cmd, arg; -{ - int fds, ret; - struct flock *savarg; - struct n_flock nfl; - extern int errno; - int i, narg; - - if ((cmd == F_SETOWN) || (cmd == F_GETOWN)) { - ret = _s_fcntl(fd, cmd_op[cmd], arg); - if ((ret != -1) || (errno != EINVAL)) - return (ret); - else { - if (cmd == F_GETOWN) { - if (_ioctl(fd, S5_I_GETSIG, &i) < 0) { - if (errno == EINVAL) - i = 0; - else - return (-1); - } - if (i & (S5_S_RDBAND|S5_S_BANDURG| - S5_S_RDNORM|S5_S_WRNORM)) - return (getpid()); - return (0); - } else { /* cmd == F_SETOWN */ - i = S5_S_RDNORM|S5_S_WRNORM|S5_S_RDBAND|S5_S_BANDURG; - return (ioctl(fd, S5_I_SETSIG, i)); - } - } - } - if (cmd == F_SETFL) { - if (arg & FLAGS_MASK) { - narg = arg & ~FLAGS_MASK; - if (arg & FASYNC) - narg |= S5_FASYNC; - if (arg & O_SYNC) - narg |= N_O_SYNC; - if (arg & O_CREAT) - narg |= N_O_CREAT; - if (arg & O_TRUNC) - narg |= N_O_TRUNC; - if (arg & O_EXCL) - narg |= N_O_EXCL; - if (arg & (O_NDELAY)) - narg |= N_O_NDELAY; - if (arg & O_NONBLOCK) - narg |= N_O_NONBLOCK; - if (arg & FNBIO) - narg |= N_O_NDELAY; - arg = narg; - } - } else if (cmd == F_SETLK || cmd == F_SETLKW || cmd == F_GETLK) { - if (arg == 0 || arg == -1) { - errno = EFAULT; - return(-1); - } - savarg = (struct flock *)arg; - arg = (int) &nfl; - nfl.l_type = savarg->l_type; - nfl.l_whence = savarg->l_whence; - nfl.l_start = savarg->l_start; - nfl.l_len = savarg->l_len; - nfl.l_pid = savarg->l_pid; - } - - ret = _s_fcntl(fd, cmd_op[cmd], arg); - - if (ret != -1) { - if (cmd == F_DUPFD) { - if ((fds = fd_get(fd)) != -1) - fd_add(ret, fds); - } else if (cmd == F_GETFL) { - if (ret & N_FLAGS_MASK) { - narg = ret & ~N_FLAGS_MASK; - if (ret & S5_FASYNC) - narg |= FASYNC; - if (ret & N_O_SYNC) - narg |= O_SYNC; - if (ret & N_O_NONBLOCK) - narg |= O_NONBLOCK; - if (ret & N_O_CREAT) - narg |= O_CREAT; - if (ret & N_O_TRUNC) - narg |= O_TRUNC; - if (ret & N_O_EXCL) - narg |= O_EXCL; - if (ret & (N_O_NDELAY)) - narg |= O_NDELAY; - ret = narg; - } - } else if (cmd == F_SETLK || cmd == F_SETLKW || - cmd == F_GETLK) { - savarg->l_type = nfl.l_type; - savarg->l_whence = nfl.l_whence; - savarg->l_start = nfl.l_start; - savarg->l_len = nfl.l_len; - savarg->l_pid = nfl.l_pid; - arg = (int) savarg; - } - } - return(ret); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/getpgrp.c b/usr/src/lib/libbc/libc/sys/4.2/getpgrp.c deleted file mode 100644 index f048fc9a0e..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/getpgrp.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -int getpgrp(pid) -int pid; -{ - return(getpgid(pid)); -} - diff --git a/usr/src/lib/libbc/libc/sys/4.2/link.c b/usr/src/lib/libbc/libc/sys/4.2/link.c deleted file mode 100644 index a48eca7975..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/link.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. - */ - -#include "chkpath.h" -#include <sys/fcntl.h> - -int -link(char *a, char *b) -{ - CHKNULL(a); - CHKNULL(b); - return (_syscall(SYS_linkat, AT_FDCWD, a, AT_FDCWD, b, 0)); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/mkdir.c b/usr/src/lib/libbc/libc/sys/4.2/mkdir.c deleted file mode 100644 index 23bed9c6c0..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/mkdir.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. - */ - -#include "chkpath.h" -#include <sys/fcntl.h> - -int -mkdir(char *p, mode_t m) -{ - CHKNULL(p); - return (_syscall(SYS_mkdirat, AT_FDCWD, p, m)); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/mkfifo.c b/usr/src/lib/libbc/libc/sys/4.2/mkfifo.c deleted file mode 100644 index 75022bda9a..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/mkfifo.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/stat.h> -#include "chkpath.h" - -int -mkfifo(char *path, mode_t mode) -{ - CHKNULL(path); - return (mknod(path, S_IFIFO | (mode & (S_IRWXU|S_IRWXG|S_IRWXO)))); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/mknod.c b/usr/src/lib/libbc/libc/sys/4.2/mknod.c deleted file mode 100644 index b06033270d..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/mknod.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. - */ - -#include "chkpath.h" -#include <sys/fcntl.h> - -int -mknod(char *p, int m, int d) -{ - CHKNULL(p); - return (_syscall(SYS_mknodat, AT_FDCWD, p, m, d)); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/mount.c b/usr/src/lib/libbc/libc/sys/4.2/mount.c deleted file mode 100644 index ad9bcd6bfa..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/mount.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1997 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <errno.h> -#include <sys/types.h> -#include <rpc/types.h> -#include <sys/time.h> -#include <sys/mount.h> -#include <sys/syscall.h> -#include <netinet/in.h> - - -#define GETFSIND 1 /* translate fs id to ftype index */ -#define CLIENT 1 /* #defined in <pn.h> */ -#define MS_RFFLAGS (MS_CACHE) - -/* - * Flags bits passed to mount(2), from the SVR4 sys/mount.h header file. - */ -#define MS_RDONLY 0x01 /* read only bit */ -#define MS_DATA 0x04 /* 6-argument mount */ -#define MS_NOSUID 0x10 /* Setuid programs disallowed */ -#define MS_REMOUNT 0x20 /* Remount */ -#define MS_NOTRUNC 0x40 /* Return ENAMETOOLONG for long filenames */ - -/* - * structs netbuf, knetconfig, and nfsarg from SVR4 - */ - - -struct netbuf { - unsigned int maxlen; - unsigned int len; - char *buf; -}; - -struct knetconfig { - unsigned long knc_semantics; /* token name */ - char *knc_protofmly; /* protocol family */ - char *knc_proto; /* protocol */ - dev_t knc_rdev; /* device id */ - unsigned long knc_unused[8]; -}; - -struct nfsarg { - struct netbuf *addr; /* file server address */ - /* secure NFS time sync address */ - struct netbuf *syncaddr; - /* transport knetconfig struct */ - struct knetconfig *knconf; - char *hostname; /* server's hostname */ - char *netname; /* server's netname */ - caddr_t fh; /* File handle to be mounted */ - int flags; /* flags */ - int wsize; /* write size in bytes */ - int rsize; /* read size in bytes */ - int timeo; /* initial timeout in .1 secs */ - int retrans; /* times to retry send */ - int acregmin; /* attr cache file min secs */ - int acregmax; /* attr cache file max secs */ - int acdirmin; /* attr cache dir min secs */ - int acdirmax; /* attr cache dir max secs */ -}; - -int -mount(char *type, char *dir, int flags, caddr_t data) -{ - int idx, nflags = 0; - int returnValue; - char fstr[32]; - struct nfsarg narg; - struct nfsarg *na = &narg; - struct nfs_args *nfsa; - - if (strcmp(type, "4.2") == 0) - strcpy(fstr, "ufs"); - else if (strcmp(type, "lo") == 0) - strcpy(fstr, "lo"); - else if (strcmp(type, "nfs") == 0) - strcpy(fstr, "nfs"); - - if ((idx = sysfs(GETFSIND, fstr)) == -1) - return (-1); - - nflags = MS_NOTRUNC; - switch (flags) { - case M_RDONLY: nflags |= MS_RDONLY; - case M_NOSUID: nflags |= MS_NOSUID; - case M_REMOUNT: nflags |= MS_REMOUNT; - } - - if (strcmp(type, "4.2") == 0) - return (_syscall(SYS_mount, data, dir, nflags, idx, 0, 0)); - else if (strcmp(type, "lo") == 0) - return (_syscall(SYS_mount, data, dir, nflags, idx, 0, 0)); - else if (strcmp(type, "nfs") == 0) { - nflags |= MS_DATA; - nfsa = (struct nfs_args *)data; - if ((na->addr = - (struct netbuf *)malloc(sizeof (struct netbuf))) == NULL) - return (-1); - if ((na->syncaddr = - (struct netbuf *)malloc(sizeof (struct netbuf))) == NULL) { - free(na->addr); - return (-1); - } - if ((na->knconf = -(struct knetconfig *)malloc(sizeof (struct knetconfig))) == NULL) { - free(na->addr); - free(na->syncaddr); - return (-1); - } - na->addr->maxlen = sizeof (struct sockaddr_in); - na->addr->len = na->addr->maxlen; - na->addr->buf = (char *)nfsa->addr; - na->syncaddr->maxlen = na->addr->maxlen; - na->syncaddr->len = na->syncaddr->maxlen; - na->syncaddr->buf = (char *)nfsa->addr; - strcpy(na->hostname, nfsa->hostname); - strcpy(na->netname, nfsa->netname); - na->fh = nfsa->fh; - na->flags = nfsa->flags; - na->wsize = nfsa->wsize; - na->rsize = nfsa->rsize; - na->timeo = nfsa->timeo; - na->retrans = nfsa->retrans; - na->acregmin = nfsa->acregmin; - na->acregmax = nfsa->acregmax; - na->acdirmin = nfsa->acdirmin; - na->acdirmax = nfsa->acdirmax; - returnValue = (_syscall(SYS_mount, data, dir, nflags, idx, na, - sizeof (struct nfsarg))); - free(na->addr); - free(na->syncaddr); - free(na->knconf); - return (returnValue); - } - return (-1); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/open.c b/usr/src/lib/libbc/libc/sys/4.2/open.c deleted file mode 100644 index 1ea83dd49e..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/open.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1995, by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <sys/fcntl.h> -#include <sys/errno.h> - -#include "chkpath.h" - -int -open(char *path, int flags, int mode) -{ - return (bc_open(path, flags, mode)); -} - -int -bc_open(char *path, int flags, int mode) -{ - CHKNULL(path); - if (flags & FNDELAY) { - flags &= ~FNDELAY; - flags |= O_NONBLOCK; - } - return (open_com(path, flags, mode)); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/pathconf.c b/usr/src/lib/libbc/libc/sys/4.2/pathconf.c deleted file mode 100644 index 2a31a9d886..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/pathconf.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "chkpath.h" - -long -pathconf(char *p, int what) -{ - CHKNULL(p); - return (_syscall(SYS_pathconf, p, what)); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/read.c b/usr/src/lib/libbc/libc/sys/4.2/read.c deleted file mode 100644 index 905f542e93..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/read.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "../common/compat.h" -#include <errno.h> -#include <stdio.h> -#include <sys/types.h> -#include <unistd.h> -#include <sys/syscall.h> - -/* - * If reading from the utmp file, map the data to the SunOS 4.1 - * format on the fly. - */ -extern void to_utmp(char *, char *, int); - -int -read(int fd, char *buf, int size) -{ - return (bc_read(fd, buf, size)); -} - -int -bc_read(int fd, char *buf, int size) -{ - int fds, ret, off; - char *nbuf; - - if (fd_get(fd) != -1) { /* we're reading utmp (utmpx, really) */ - size = getmodsize(size, sizeof (struct compat_utmp), - sizeof (struct utmpx)); - - if ((nbuf = (void *)malloc(size)) == NULL) { - (void) fprintf(stderr, "read: malloc failed\n"); - exit(-1); - } - - if ((ret = _read(fd, nbuf, size)) == -1) { - if (errno == EAGAIN) - errno = EWOULDBLOCK; - free(nbuf); - return (-1); - } - to_utmp(buf, nbuf, ret); - - ret = getmodsize(ret, sizeof (struct utmpx), - sizeof (struct compat_utmp)); - free(nbuf); - return (ret); - } - - if ((ret = _read(fd, buf, size)) == -1) { - if (errno == EAGAIN) - errno = EWOULDBLOCK; - } - return (ret); -} - -void -to_utmp(char *buf, char *nbuf, int len) -{ - struct compat_utmp *ut; - struct utmpx *utx; - - utx = (struct utmpx *)nbuf; - ut = (struct compat_utmp *)buf; - - while ((char *)utx < (nbuf + len)) { - (void) strncpy(ut->ut_line, utx->ut_line, sizeof (ut->ut_line)); - (void) strncpy(ut->ut_name, utx->ut_user, sizeof (ut->ut_name)); - (void) strncpy(ut->ut_host, utx->ut_host, sizeof (ut->ut_host)); - ut->ut_time = utx->ut_tv.tv_sec; - utx++; - ut++; - } -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/readlink.c b/usr/src/lib/libbc/libc/sys/4.2/readlink.c deleted file mode 100644 index 4c24ef8f75..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/readlink.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. - */ - -#include "chkpath.h" -#include <sys/fcntl.h> - -int -readlink(char *p, char *b, int s) -{ - CHKNULL(p); - return (_syscall(SYS_readlinkat, AT_FDCWD, p, b, s)); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/readv.c b/usr/src/lib/libbc/libc/sys/4.2/readv.c deleted file mode 100644 index 60a746da24..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/readv.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "../common/compat.h" -#include <stdio.h> -#include <errno.h> -#include <sys/types.h> -#include <unistd.h> -#include <sys/syscall.h> -#include <sys/uio.h> - -/* - * If reading from the utmp file, map the data to the SunOS 4.1 - * format on the fly. - */ -extern void to_utmp(char *, char *, int); - -int -readv(int fd, struct iovec *iov, int iovcnt) -{ - return (bc_readv(fd, iov, iovcnt)); -} - -int -bc_readv(int fd, struct iovec *iov, int iovcnt) -{ - int fds, ret, off; - int i, size, total = 0; - char *nbuf; - - if (fd_get(fd) != -1) { /* we're reading utmp (utmpx really) */ - for (i = 0; i < iovcnt; i++) { - size = getmodsize(iov[i].iov_len, - sizeof (struct compat_utmp), - sizeof (struct utmpx)); - - if ((nbuf = (void *)malloc(size)) == NULL) { - fprintf(stderr, "readv: malloc failed\n"); - exit(-1); - } - - if ((ret = _read(fd, nbuf, size)) == -1) { - if (errno == EAGAIN) - errno = EWOULDBLOCK; - free(nbuf); - return (-1); - } - - to_utmp(iov[i].iov_base, nbuf, ret); - - ret = getmodsize(ret, sizeof (struct utmpx), - sizeof (struct compat_utmp)); - total += ret; - - free(nbuf); - } - - return (total); - } - - if ((ret = _readv(fd, iov, iovcnt)) == -1) { - if (errno == EAGAIN) - errno = EWOULDBLOCK; - } - return (ret); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/rename.c b/usr/src/lib/libbc/libc/sys/4.2/rename.c deleted file mode 100644 index 222765f133..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/rename.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include "chkpath.h" -#include <sys/syscall.h> -#include <sys/fcntl.h> - -int -rename(char *path1, char *path2) -{ - char buf2[256]; - - CHKNULL(path1); - CHKNULL(path2); - - /* - * with the removal of utmp and wtmp, we now need - * to map the utmp or wtmp rename operation into - * a rename of utmpx or wtmpx - */ - if (strcmp(path1, "/etc/utmp") == 0 || - strcmp(path1, "/var/adm/utmp") == 0) { - path1 = "/var/adm/utmpx"; - strcpy(buf2, path2); - strcat(buf2, "x"); - path2 = buf2; - } else if (strcmp(path1, "/var/adm/wtmp") == 0) { - path1 = "/var/adm/wtmpx"; - strcpy(buf2, path2); - strcat(buf2, "x"); - path2 = buf2; - } - - return (_syscall(SYS_renameat, AT_FDCWD, path1, AT_FDCWD, path2)); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/rmdir.c b/usr/src/lib/libbc/libc/sys/4.2/rmdir.c deleted file mode 100644 index 620d8a3d35..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/rmdir.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include "chkpath.h" -#include <sys/fcntl.h> - -int -rmdir(char *d) -{ - int ret; - - CHKNULL(d); - ret = _syscall(SYS_unlinkat, AT_FDCWD, d, AT_REMOVEDIR); - if (errno == EEXIST) - errno = ENOTEMPTY; - return (ret); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/setgid.c b/usr/src/lib/libbc/libc/sys/4.2/setgid.c deleted file mode 100644 index 5cfd0f6768..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/setgid.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1995, by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -int -setgid(int gid) -{ - return (setregid(gid, gid)); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/setjmp.c b/usr/src/lib/libbc/libc/sys/4.2/setjmp.c deleted file mode 100644 index 1373198c83..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/setjmp.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - - -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - - -#include <sys/setjmp.h> -#include "../common/ucontext.h" - -int _getsp(); - -int -setjmp(env) - jmp_buf env; -{ - register o_setjmp_struct_t *bp = (o_setjmp_struct_t *)env; - register int sp = _getsp(); - ucontext_t uc; - - /* - * Get the current machine context. - */ - uc.uc_flags = UC_STACK | UC_SIGMASK; - __getcontext(&uc); - - /* - * Note that the pc and former sp (fp) from the stack are valid - * because the call to __getcontext must flush the user windows - * to the stack. - */ - bp->sjs_flags = 0; - bp->sjs_sp = *((int *)sp+14); - bp->sjs_pc = *((int *)sp+15) + 0x8; - bp->sjs_stack = uc.uc_stack; - - /* save the mask */ - bp->sjs_flags |= JB_SAVEMASK; - memcpy(bp->sjs_sigmask, &(uc.uc_sigmask), 3 * sizeof (int)); - - return (0); -} - - - -void -longjmp(env, val) - jmp_buf env; - int val; -{ - o_setjmp_struct_t *bp = (o_setjmp_struct_t *)env; - setjmp_struct_t sjmp, *sp; - - sp = &sjmp; - sp->sjs_flags = bp->sjs_flags; - sp->sjs_sp = bp->sjs_sp; - sp->sjs_pc = bp->sjs_pc; - sp->sjs_fp = 0; - sp->sjs_i7 = 0; - sp->sjs_uclink = 0; - sp->sjs_sigmask[0] = bp->sjs_sigmask[0]; - sp->sjs_sigmask[1] = bp->sjs_sigmask[1]; - sp->sjs_sigmask[2] = bp->sjs_sigmask[2]; - sp->sjs_sigmask[3] = 0; - sp->sjs_stack = bp->sjs_stack; - _siglongjmp(sjmp, val); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/setpgrp.c b/usr/src/lib/libbc/libc/sys/4.2/setpgrp.c deleted file mode 100644 index a22315b026..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/setpgrp.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -int setpgrp(pid, pgrp) -int pid, pgrp; -{ - if ((pgrp == 0) && (pid == getpid())) { - return(bc_setsid()); - } else - return(setpgid(pid, pgrp)); -} - - diff --git a/usr/src/lib/libbc/libc/sys/4.2/setuid.c b/usr/src/lib/libbc/libc/sys/4.2/setuid.c deleted file mode 100644 index 5b290dc922..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/setuid.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1995, by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -int -setuid(int uid) -{ - return (setreuid(uid, uid)); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/stat.c b/usr/src/lib/libbc/libc/sys/4.2/stat.c deleted file mode 100644 index b546568f8c..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/stat.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include "chkpath.h" -#include <sys/stat.h> - -extern int errno; - -int stat(path, buf) -char *path; -struct stat *buf; -{ - return(bc_stat(path, buf)); -} - - -int bc_stat(path, buf) -char *path; -struct stat *buf; -{ - if ((path == (char*)-1) || (path == (char*)0)) { - errno = EFAULT; - return (-1); - } - if ((buf == (struct stat*)0) || (buf == (struct stat*)-1)) { - errno = EFAULT; - return (-1); - } - return(stat_com(0, path, buf)); -} - - -int lstat(path, buf) -char *path; -struct stat *buf; -{ - return(bc_lstat(path, buf)); -} - -int bc_lstat(path, buf) -char *path; -struct stat *buf; -{ - CHKNULL(path); - return(stat_com(1, path, buf)); -} - diff --git a/usr/src/lib/libbc/libc/sys/4.2/statfs.c b/usr/src/lib/libbc/libc/sys/4.2/statfs.c deleted file mode 100644 index 1cbd699db8..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/statfs.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "chkpath.h" -#include <sys/types.h> -#include <sys/vfs.h> - -int -statfs(char *s, struct statfs *b) -{ - CHKNULL(s); - - return (statfs_com(s, b)); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/symlink.c b/usr/src/lib/libbc/libc/sys/4.2/symlink.c deleted file mode 100644 index 622832a703..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/symlink.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. - */ - -#include "chkpath.h" -#include <sys/fcntl.h> - -int -symlink(char *t, char *f) -{ - CHKNULL(t); - CHKNULL(f); - return (_syscall(SYS_symlinkat, t, AT_FDCWD, f)); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/truncate.c b/usr/src/lib/libbc/libc/sys/4.2/truncate.c deleted file mode 100644 index 4cf30b8f26..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/truncate.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "chkpath.h" -#include <sys/syscall.h> -#include <unistd.h> -#include <errno.h> -#include <sys/fcntl.h> -#include <sys/param.h> - -int -truncate(char *path, off_t length) -{ - int fd, ret = 0; - - CHKNULL(path); - - if (strcmp(path, "/etc/mtab") == 0 || strcmp(path, "/etc/fstab") == 0) { - errno = ENOENT; - return (-1); - } - if ((fd = open(path, O_WRONLY)) == -1) { - return (-1); - } - - if (ftruncate(fd, length) == -1) { - close(fd); - return (-1); - } - close(fd); - return (0); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/unlink.c b/usr/src/lib/libbc/libc/sys/4.2/unlink.c deleted file mode 100644 index 9825d5e502..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/unlink.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include "chkpath.h" -#include <sys/syscall.h> -#include <sys/fcntl.h> - -int -unlink(const char *path) -{ - CHKNULL(path); - - if (strcmp(path, "/etc/utmp") == 0 || - strcmp(path, "/var/adm/utmp") == 0) - path = "/var/adm/utmpx"; - else if (strcmp(path, "/var/adm/wtmp") == 0) - path = "/var/adm/wtmpx"; - - return (_syscall(SYS_unlinkat, AT_FDCWD, path, 0)); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/write.c b/usr/src/lib/libbc/libc/sys/4.2/write.c deleted file mode 100644 index 4180aacbe7..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/write.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1999 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "../common/compat.h" -#include <stdio.h> -#include <sys/errno.h> -#include <sys/types.h> -#include <unistd.h> - -/* - * If writing to a utmp-like file, map the utmp structure to - * new format on the fly. - */ -extern int errno; - -extern int conv2utmp(char *, char *, int); -extern int conv2utmpx(char *, char *, int); - -int -write(int fd, char *buf, int size) -{ - return (bc_write(fd, buf, size)); -} - -int -bc_write(int fd, char *buf, int size) -{ - int ret, off; - int nsize; - char *nbuf; - - if (fd_get(fd) != -1) { /* writing utmp (utmpx actually) */ - nsize = getmodsize(size, sizeof (struct compat_utmp), - sizeof (struct utmpx)); - - if ((nbuf = (void *)malloc(nsize)) == NULL) { - (void) fprintf(stderr, "write: malloc failed\n"); - exit(-1); - } - - (void) memset(nbuf, 0, nsize); - - ret = conv2utmpx(nbuf, buf, size); - - if ((ret = _write(fd, nbuf, ret)) == -1) { - if (errno == EAGAIN) - errno = EWOULDBLOCK; - free(nbuf); - return (-1); - } - - free(nbuf); - - ret = getmodsize(ret, sizeof (struct utmpx), - sizeof (struct compat_utmp)); - - return (ret); - } - - if ((ret = _write(fd, buf, size)) == -1) { - if (errno == EAGAIN) - errno = EWOULDBLOCK; - } - return (ret); - -} - -/* From SunOS/SVR4 utmp.h */ -#define USER_PROCESS 7 -#define DEAD_PROCESS 8 - -extern int -conv2utmpx(char *nbuf, char *buf, int len) -{ - struct compat_utmp *ut; - struct utmpx *utx; - - utx = (struct utmpx *) nbuf; - ut = (struct compat_utmp *) buf; - - while ((char *)ut < (buf + len)) { - (void) strcpy(utx->ut_user, ut->ut_name); - (void) memset(utx->ut_id, 0, sizeof (utx->ut_id)); - (void) strcpy(utx->ut_line, ut->ut_line); - utx->ut_pid = 0; - if ((strcmp(utx->ut_user, "") == 0) && - (strcmp(utx->ut_host, "") == 0)) - utx->ut_type = DEAD_PROCESS; - else - utx->ut_type = USER_PROCESS; - utx->ut_exit.e_termination = 0; - utx->ut_exit.e_exit = 0; - utx->ut_tv.tv_sec = ut->ut_time; - utx->ut_tv.tv_usec = 0; - utx->ut_session = 0; - utx->ut_syslen = sizeof (ut->ut_name) + 1; - (void) strcpy(utx->ut_host, ut->ut_host); - ut++; - utx++; - } - return ((char *) utx - nbuf); -} diff --git a/usr/src/lib/libbc/libc/sys/4.2/writev.c b/usr/src/lib/libbc/libc/sys/4.2/writev.c deleted file mode 100644 index 2e54aa1439..0000000000 --- a/usr/src/lib/libbc/libc/sys/4.2/writev.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "../common/compat.h" -#include <stdio.h> -#include <sys/errno.h> -#include <sys/types.h> -#include <unistd.h> -#include <sys/uio.h> - -/* - * If writing to a utmp-like file, map the utmp structure to - * new format on the fly. - */ -extern int errno; - -extern int conv2utmpx(char *, char *, int); - -int -writev(int fd, struct iovec *iov, int iovcnt) -{ - return (bc_writev(fd, iov, iovcnt)); -} - -int -bc_writev(int fd, struct iovec *iov, int iovcnt) -{ - int ret, off; - int nsize, total = 0; - char *nbuf; - int i; - - if (fd_get(fd) != -1) { /* writing utmp (utmpx, actually) */ - for (i = 0; i < iovcnt; i++) { - nsize = getmodsize(iov[i].iov_len, - sizeof (struct compat_utmp), - sizeof (struct utmpx)); - - if ((nbuf = (void *)malloc(nsize)) == NULL) { - fprintf(stderr, "writev: malloc failed\n"); - exit(-1); - } - - (void) memset(nbuf, 0, nsize); - - ret = conv2utmpx(nbuf, iov[i].iov_base, iov[i].iov_len); - - if ((ret = _write(fd, nbuf, ret)) == -1) { - if (errno == EAGAIN) - errno = EWOULDBLOCK; - free(nbuf); - return (-1); - } - - free(nbuf); - - ret = getmodsize(ret, sizeof (struct utmpx), - sizeof (struct compat_utmp)); - total += ret; - } - return (total); - } - - if ((ret = _writev(fd, iov, iovcnt)) == -1) { - if (errno == EAGAIN) - errno = EWOULDBLOCK; - } - - return (ret); -} diff --git a/usr/src/lib/libbc/libc/sys/common/_access.c b/usr/src/lib/libbc/libc/sys/common/_access.c deleted file mode 100644 index 5adea56e64..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/_access.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include <sys/syscall.h> -#include <sys/fcntl.h> -#include <unistd.h> -#include <sys/param.h> - -int -access_com(char *path, int mode) -{ - if (strcmp(path, "/etc/mtab") == 0 || - strcmp(path, "/etc/fstab") == 0) { - if (mode == W_OK || mode == X_OK) - return (-1); - else - return (0); - } - - if (strcmp(path, "/etc/utmp") == 0 || - strcmp(path, "/var/adm/utmp") == 0) - path = "/var/adm/utmpx"; - else if (strcmp(path, "/var/adm/wtmp") == 0) - path = "/var/adm/wtmpx"; - - return (_syscall(SYS_faccessat, AT_FDCWD, path, mode, 0)); -} diff --git a/usr/src/lib/libbc/libc/sys/common/_creat.c b/usr/src/lib/libbc/libc/sys/common/_creat.c deleted file mode 100644 index 54477b35bf..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/_creat.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include <sys/syscall.h> -#include <unistd.h> -#include <fcntl.h> -#include <errno.h> -#include <sys/param.h> -#include "compat.h" /* for UTMPX_MAGIC_FLAG */ - -#define CREATFLAGS (O_WRONLY | O_CREAT | O_TRUNC) - -int -creat_com(char *path, int mode) -{ - int fd; - - if (strcmp(path, "/etc/mtab") == 0 || - strcmp(path, "/etc/fstab") == 0) { - errno = ENOENT; - return (-1); - } - if (strcmp(path, "/var/adm/wtmp") == 0) { - if ((fd = _syscall(SYS_openat, AT_FDCWD, - "/var/adm/wtmpx", CREATFLAGS, mode)) >= 0) - fd_add(fd, UTMPX_MAGIC_FLAG); - return (fd); - } - if (strcmp(path, "/etc/utmp") == 0 || - strcmp(path, "/var/adm/utmp") == 0) { - if ((fd = _syscall(SYS_openat, AT_FDCWD, - "/var/adm/utmpx", CREATFLAGS, mode)) >= 0) - fd_add(fd, UTMPX_MAGIC_FLAG); - return (fd); - } - return (_syscall(SYS_openat, AT_FDCWD, path, CREATFLAGS, mode)); -} diff --git a/usr/src/lib/libbc/libc/sys/common/_open.c b/usr/src/lib/libbc/libc/sys/common/_open.c deleted file mode 100644 index 5cde96fb2b..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/_open.c +++ /dev/null @@ -1,422 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include <stdio.h> -#include <fcntl.h> -#include <string.h> -#include <mntent.h> -#include <sys/syscall.h> -#include <sys/param.h> -#include <sys/sysmacros.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <dirent.h> -#include "s5sysmacros.h" -#include "compat.h" - -#define PRINTER_DIR "/etc/lp/printers/" -#define PRINTER_CONFIG_FILE "/configuration" -#define MNT_LINE_MAX 1024 - -#define GETTOK(xx, ll) \ - if ((xx = strtok(ll, sepstr)) == NULL) \ - return (-1); \ - if (strcmp(xx, dash) == 0) \ - xx = NULL - -char *mktemp(); - -static void getPrinterInfo(char *, FILE *); -static char sepstr[] = " \t\n"; -static char dash[] = "-"; -static int open_printcap(void); - -/* SVR4/SunOS 5.0 equivalent modes */ -#define N_O_NDELAY 0x04 -#define N_O_SYNC 0x10 -#define N_O_NONBLOCK 0x80 -#define N_O_CREAT 0x100 -#define N_O_TRUNC 0x200 -#define N_O_EXCL 0x400 - -/* Mask corresponding to the bits above in SunOS 4.x */ -#define FLAGS_MASK (O_SYNC|O_NONBLOCK|O_CREAT|O_TRUNC|O_EXCL \ - |_FNDELAY|_FNBIO) - -int -open_com(char *path, int flags, int mode) -{ - int fd, fd2, pathl, inspt, ret = 0; - int nflags = flags; - char loc[] = "/lib/locale"; - char *loct = NULL; - - if (flags & FLAGS_MASK) { - nflags = flags & ~FLAGS_MASK; - if (flags & O_SYNC) - nflags |= N_O_SYNC; - if (flags & (_FNDELAY|O_NONBLOCK)) { - nflags |= N_O_NONBLOCK; - } - if (flags & O_CREAT) - nflags |= N_O_CREAT; - if (flags & O_TRUNC) - nflags |= N_O_TRUNC; - if (flags & O_EXCL) - nflags |= N_O_EXCL; - if (flags & _FNBIO) - nflags |= N_O_NDELAY; - } - -/* change path from ..../lib/locale/.... to ..../lib/oldlocale/.... XXX */ - - if ((loct = (char *)_strstr(path, loc)) != NULL) { /* /lib/locale ? */ - char locbuf[MAXPATHLEN+100]; /* to hold new locale path */ - - pathl = strlen(path); - inspt = pathl - strlen(loct) + 5; /* pos to add "old" */ - (void) strncpy(locbuf, path, inspt); /* copy path upto lib */ - locbuf[inspt] = '\0'; /* make it a string */ - strcat(locbuf, "old"); /* add "old" */ - strcat(locbuf, loct+5); /* add remainer of path */ - return (_syscall(SYS_openat, AT_FDCWD, locbuf, nflags, mode)); - } - - if (strcmp(path, "/etc/mtab") == 0) - return (open_mnt("/etc/mnttab", "mtab", nflags, mode)); - - if (strcmp(path, "/etc/fstab") == 0) - return (open_mnt("/etc/vfstab", "fstab", nflags, mode)); - - if (strcmp(path, "/etc/printcap") == 0) { - if ((fd = _syscall(SYS_openat, AT_FDCWD, path, nflags, mode)) - >= 0) - return (fd); - return (open_printcap()); - } - - if (strcmp(path, "/etc/utmp") == 0 || - strcmp(path, "/var/adm/utmp") == 0) { - fd = _syscall(SYS_openat, - AT_FDCWD, "/var/adm/utmpx", nflags, mode); - if (fd >= 0) - fd_add(fd, UTMPX_MAGIC_FLAG); - return (fd); - } - - if (strcmp(path, "/var/adm/wtmp") == 0) { - fd = _syscall(SYS_openat, - AT_FDCWD, "/var/adm/wtmpx", nflags, mode); - if (fd >= 0) - fd_add(fd, UTMPX_MAGIC_FLAG); - return (fd); - } - - return (_syscall(SYS_openat, AT_FDCWD, path, nflags, mode)); -} - -int -open_mnt(char *fname, char *tname, int flags, int mode) -{ - FILE *fd_in, *fd_out; - FILE *_fopen(); - char tmp_name[64]; - char line[MNT_LINE_MAX]; - int fd; - - if ((fd_in = _fopen(fname, "r")) == NULL) - return (-1); - - sprintf(tmp_name, "%s%s%s", "/tmp/", tname, "XXXXXX"); - mktemp(tmp_name); - - if ((fd_out = _fopen(tmp_name, "a+")) == NULL) { - fclose(fd_in); - return (-1); - } - - while (getmntline(line, fd_in) != -1) { - if (strcmp(fname, "/etc/mnttab") == 0) { - if (putmline(line, fd_out) == -1) { - fclose(fd_in); - fclose(fd_out); - return (-1); - } - } else { /* processing vfstab */ - if (putfline(line, fd_out) == -1) { - fclose(fd_in); - fclose(fd_out); - return (-1); - } - } - } - - if (feof(fd_in)) { - fclose(fd_in); - fclose(fd_out); - - fd = _syscall(SYS_openat, AT_FDCWD, tmp_name, O_RDONLY); - - if (fd == -1 || unlink(tmp_name) == -1) - return (-1); - - return (fd); - } else { - fclose(fd_in); - fclose(fd_out); - return (-1); - } -} - -int -getmntline(char *lp, FILE *fp) -{ - int ret; - char *cp; - - while ((lp = fgets(lp, MNT_LINE_MAX, fp)) != NULL) { - if (strlen(lp) == MNT_LINE_MAX-1 && lp[MNT_LINE_MAX-2] != '\n') - return (-1); - for (cp = lp; *cp == ' ' || *cp == '\t'; cp++) - ; - if (*cp != '#' && *cp != '\n') - return (0); - } - return (-1); -} - -int -putmline(char *line, FILE *fp) -{ - struct mntent mnt; - char *buf; - char *devnumstr = 0; /* the device number, in (hex) ascii */ - char *remainder; /* remainder of mnt_opts string, after devnum */ - unsigned long devnum; - - GETTOK(mnt.mnt_fsname, line); - GETTOK(mnt.mnt_dir, NULL); - GETTOK(mnt.mnt_type, NULL); - GETTOK(mnt.mnt_opts, NULL); - GETTOK(buf, NULL); - mnt.mnt_freq = 0; - mnt.mnt_passno = 0; - - if (strtok(NULL, sepstr) != NULL) - return (-1); - if (strcmp(mnt.mnt_type, "ufs") == 0) { - mnt.mnt_type = "4.2"; - } - - /* - * the device number, if present, follows the '=' - * in the mnt_opts string. - */ - - if (mnt.mnt_opts != NULL) - devnumstr = (char *)strchr(mnt.mnt_opts, '='); - - if (!devnumstr) { - /* no device number on this line */ - fprintf(fp, "%s %s %s %s %d %d\n", - mnt.mnt_fsname, mnt.mnt_dir, mnt.mnt_type, - mnt.mnt_opts, mnt.mnt_freq, mnt.mnt_passno); - } else { - /* found the device number, convert it to 4.x format */ - devnum = strtol(&devnumstr[1], (char **)NULL, 16); - remainder = (char *)strchr(&devnumstr[1], ' '); - devnumstr[1] = 0; /* null terminate mnt_opts after '=' */ - devnum = cmpdev(devnum); - - fprintf(fp, "%s %s %s %s%4x%s %d %d\n", - mnt.mnt_fsname, mnt.mnt_dir, mnt.mnt_type, - mnt.mnt_opts, devnum, remainder ? remainder : "", - mnt.mnt_freq, mnt.mnt_passno); - } - - return (0); -} - -int -putfline(char *line, FILE *fp) -{ - struct mntent mnt; - char *buf; - - GETTOK(mnt.mnt_fsname, line); - GETTOK(buf, NULL); - GETTOK(mnt.mnt_dir, NULL); - if (mnt.mnt_dir == NULL && strcmp(mnt.mnt_fsname, "/dev/root") == 0) - mnt.mnt_dir = "/"; - GETTOK(mnt.mnt_type, NULL); - GETTOK(buf, NULL); - GETTOK(buf, NULL); - GETTOK(mnt.mnt_opts, NULL); - if (mnt.mnt_opts == NULL) - mnt.mnt_opts = "rw"; - mnt.mnt_freq = 0; - mnt.mnt_passno = 0; - - if (strtok(NULL, sepstr) != NULL) - return (-1); - if (strcmp(mnt.mnt_type, "ufs") == 0) { - mnt.mnt_type = "4.2"; - } - - fprintf(fp, "%s %s %s %s %d %d\n", - mnt.mnt_fsname, mnt.mnt_dir, mnt.mnt_type, - mnt.mnt_opts, mnt.mnt_freq, mnt.mnt_passno); - - return (0); -} - -FILE * -_fopen(char *file, char *mode) -{ - extern FILE *_findiop(); - FILE *iop; - - int plus, oflag, fd; - - iop = _findiop(); - - if (iop == NULL || file == NULL || file[0] == '\0') - return (NULL); - plus = (mode[1] == '+'); - switch (mode[0]) { - case 'w': - oflag = (plus ? O_RDWR : O_WRONLY) | N_O_TRUNC | N_O_CREAT; - break; - case 'a': - oflag = (plus ? O_RDWR : O_WRONLY) | N_O_CREAT; - break; - case 'r': - oflag = plus ? O_RDWR : O_RDONLY; - break; - default: - return (NULL); - } - if ((fd = _syscall(SYS_openat, AT_FDCWD, file, oflag, 0666)) < 0) - return (NULL); - iop->_cnt = 0; - iop->_file = fd; - iop->_flag = plus ? _IORW : (mode[0] == 'r') ? _IOREAD : _IOWRT; - if (mode[0] == 'a') { - if ((lseek(fd, 0L, 2)) < 0) { - (void) close(fd); - return (NULL); - } - } - iop->_base = iop->_ptr = NULL; - iop->_bufsiz = 0; - return (iop); -} - -static int -open_printcap(void) -{ - FILE *fd; - FILE *_fopen(); - char tmp_name[] = "/tmp/printcap.XXXXXX"; - int tmp_file; - DIR *printerDir; - struct dirent *entry; - - mktemp(tmp_name); - if ((fd = _fopen(tmp_name, "a+")) == NULL) - return (-1); - fprintf(fd, "# Derived from lp(1) configuration information for BCP\n"); - - if ((printerDir = opendir(PRINTER_DIR)) != NULL) { - while ((entry = readdir(printerDir)) != NULL) - if (entry->d_name[0] != '.') - getPrinterInfo(entry->d_name, fd); - closedir(printerDir); - } - fclose(fd); - - tmp_file = _syscall(SYS_openat, AT_FDCWD, tmp_name, O_RDONLY); - if (tmp_file == -1 || unlink(tmp_name) == -1) - return (-1); - - return (tmp_file); -} - -static void -getPrinterInfo(char *printerName, FILE *fd) -{ - char *fullPath; - char *str; - char *p; - char *c; - struct stat buf; - int config_fd; - - fullPath = (char *)malloc(strlen(PRINTER_DIR) + strlen(printerName) + - strlen(PRINTER_CONFIG_FILE) + 1); - strcpy(fullPath, PRINTER_DIR); - strcat(fullPath, printerName); - strcat(fullPath, PRINTER_CONFIG_FILE); - - if ((config_fd = _syscall(SYS_openat, AT_FDCWD, fullPath, O_RDONLY)) - == -1) { - free(fullPath); - return; - } - if ((fstat(config_fd, &buf)) != 0 || - (str = (char *)malloc(buf.st_size + 2)) == NULL) { - free(fullPath); - close(config_fd); - return; - } - if ((read(config_fd, str, buf.st_size)) != buf.st_size) { - free(fullPath); - free(str); - close(config_fd); - return; - } - p = &str[buf.st_size]; - p[0] = '\n'; - p[1] = '\0'; - - fprintf(fd, "%s:", printerName); - if ((p = (char *)_strstr(str, "Remote")) != NULL) { - /* remote printer */ - p = (char *)strchr(p, ' ') + 1; - c = (char *)strchr(p, '\n'); - *c = '\0'; - fprintf(fd, "lp=:rm=%s:rp=%s:\n", p, printerName); - } else if ((p = (char *)_strstr(str, "Device")) != NULL) { - /* local printer */ - p = (char *)strchr(p, ' ') + 1; - c = (char *)strchr(p, '\n'); - *c = '\0'; - fprintf(fd, "lp=%s:\n", p); - } - free(fullPath); - free(str); - close(config_fd); -} diff --git a/usr/src/lib/libbc/libc/sys/common/_stat.c b/usr/src/lib/libbc/libc/sys/common/_stat.c deleted file mode 100644 index b3d88cccfb..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/_stat.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include <sys/errno.h> -#include <sys/syscall.h> -#include <sys/fcntl.h> -#include <sys/stat.h> -#include <sys/param.h> -#include "compat.h" -#include "s5sysmacros.h" - -#define ST_FSTYPSZ 16 /* array size for file system type name */ - -struct ts { - long tv_sec; /* seconds */ - long tv_nsec; /* nanoseconds */ -}; - -struct n_stat { - unsigned long st_dev; - long st_pad1[3]; /* reserved for network id */ - unsigned long st_ino; - unsigned long st_mode; - unsigned long st_nlink; - long st_uid; - long st_gid; - unsigned long st_rdev; - long st_pad2[2]; - long st_size; - long st_pad3; /* future off_t expansion */ - struct ts st_atim; - struct ts st_mtim; - struct ts st_ctim; - long st_blksize; - long st_blocks; - char st_fstype[ST_FSTYPSZ]; - long st_pad4[8]; /* expansion area */ - -}; - -static void cpstatbuf(struct stat *, struct n_stat *); - -int -fstat(int fd, struct stat *buf) -{ - return (bc_fstat(fd, buf)); -} - -int -bc_fstat(int fd, struct stat *buf) -{ - int ret; - struct n_stat nb; - extern int errno; - - if (buf == 0) { - errno = EFAULT; - return (-1); - } - - if ((ret = _syscall(SYS_fstatat, fd, NULL, &nb, 0)) == -1) - return (ret); - - cpstatbuf(buf, &nb); - if (fd_get(fd) != -1) { - buf->st_size = getmodsize(buf->st_size, - sizeof (struct utmpx), sizeof(struct compat_utmp)); - } - - return (ret); -} - -int -stat_com(int lstat, char *path, struct stat *buf) -{ - int fd, ret; - struct n_stat nb; - int follow = lstat? AT_SYMLINK_NOFOLLOW : 0; - - if (strcmp(path, "/etc/mtab") == 0) { -/* - * stat the real mnttab, or the "parsed" mtab - * created by open? - * - * for now, stat the real mnttab. - */ - -/* - * fd = open_mnt("/etc/mnttab", "mtab", O_RDONLY); - * ret = fstat(fd, buf); - * close(fd); - * return(ret); - */ - ret = stat_com(lstat, "/etc/mnttab", buf); - return(ret); - } - if (strcmp(path, "/etc/fstab") == 0) { - fd = open_mnt("/etc/vfstab", "fstab", O_RDONLY); - if (fd < 0) - ret = -1; - else { - ret = fstat(fd, buf); - close(fd); - } - return(ret); - } - if (strcmp(path, "/etc/utmp") == 0 || - strcmp(path, "/var/adm/utmp") == 0) { - if ((ret = _syscall(SYS_fstatat, AT_FDCWD, - "/var/adm/utmpx", &nb, follow)) != -1) { - cpstatbuf(buf, &nb); - buf->st_size = getmodsize(buf->st_size, - sizeof(struct utmpx), sizeof(struct compat_utmp)); - } - return(ret); - } - if (strcmp(path, "/var/adm/wtmp") == 0) { - if ((ret = _syscall(SYS_fstatat, AT_FDCWD, - "/var/adm/wtmpx", &nb, follow)) != -1) { - cpstatbuf(buf, &nb); - buf->st_size = getmodsize(buf->st_size, - sizeof(struct utmpx), sizeof(struct compat_utmp)); - } - return(ret); - } - if (_strstr(path, "/lib/locale/") != 0) { - fd = open(path, O_RDONLY); - if (fd < 0) - ret = -1; - else { - ret = fstat(fd, buf); - close(fd); - } - return(ret); - } - - if ((ret = _syscall(SYS_fstatat, AT_FDCWD, path, &nb, follow)) != -1) - cpstatbuf(buf, &nb); - return(ret); -} - - -/* - * Common code to copy xstat buf to BSD style buf - */ -static void -cpstatbuf(struct stat *bsdbuf, struct n_stat *nbuf) -{ - bsdbuf->st_dev = (dev_t) cmpdev(nbuf->st_dev); - bsdbuf->st_ino = nbuf->st_ino; - bsdbuf->st_mode = (unsigned short) nbuf->st_mode; - bsdbuf->st_nlink = (short) nbuf->st_nlink; - - if ((unsigned long)nbuf->st_uid > 0xffff) - bsdbuf->st_uid = 60001; /* UID_NOBODY */ - else - bsdbuf->st_uid = (uid_t) nbuf->st_uid; - - if ((unsigned long)nbuf->st_gid > 0xffff) - bsdbuf->st_gid = 60001; /* GID_NOBODY */ - else - bsdbuf->st_gid = (gid_t) nbuf->st_gid; - - bsdbuf->st_rdev = (dev_t) cmpdev(nbuf->st_rdev); - bsdbuf->st_size = nbuf->st_size; - bsdbuf->st_atime = nbuf->st_atim.tv_sec; - bsdbuf->st_mtime = nbuf->st_mtim.tv_sec; - bsdbuf->st_ctime = nbuf->st_ctim.tv_sec; - bsdbuf->st_blksize = nbuf->st_blksize; - bsdbuf->st_blocks = nbuf->st_blocks; -} diff --git a/usr/src/lib/libbc/libc/sys/common/_statfs.c b/usr/src/lib/libbc/libc/sys/common/_statfs.c deleted file mode 100644 index b80c52d6da..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/_statfs.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1993 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/vfs.h> -#include <sys/syscall.h> - -#define FSTYPSZ 16 /* array size for file system type name */ - -struct statvfs { - u_long f_bsize; /* fundamental file system block size */ - u_long f_frsize; /* fragment size */ - u_long f_blocks; /* total # of blocks of f_frsize on fs */ - u_long f_bfree; /* total # of free blocks of f_frsize */ - u_long f_bavail; /* # of free blocks avail to non-superuser */ - u_long f_files; /* total # of file nodes (inodes) */ - u_long f_ffree; /* total # of free file nodes */ - u_long f_favail; /* # of free nodes avail to non-superuser */ - u_long f_fsid; /* file system id (dev for now) */ - char f_basetype[FSTYPSZ]; /* target fs type name, null-terminated */ - u_long f_flag; /* bit-mask of flags */ - u_long f_namemax; /* maximum file name length */ - char f_fstr[32]; /* filesystem-specific string */ - u_long f_filler[16]; /* reserved for future expansion */ -}; - -void cpstatvfs(struct statfs *, struct statvfs *); - -int -statfs_com(char *s, struct statfs *b) -{ - int ret; - struct statvfs vfsb; - - if ((ret = _syscall(SYS_statvfs, s, &vfsb)) == 0) { - cpstatvfs(b, &vfsb); - } - return(ret); -} - -int -fstatfs(int fd, struct statfs *b) -{ - int ret; - struct statvfs vfsb; - - if ((ret = _syscall(SYS_fstatvfs,fd, &vfsb)) == 0) { - cpstatvfs(b, &vfsb); - } - return(ret); -} - -/* - * Common code to copy vfs buf to BSD style buf - */ -void -cpstatvfs(struct statfs *bsdbuf, struct statvfs *vbuf) -{ - bsdbuf->f_type = (long) 0; /* type of info, zero for now */ - bsdbuf->f_bsize = (vbuf->f_frsize != 0) ? - (long) vbuf->f_frsize: (long) vbuf->f_bsize; - bsdbuf->f_blocks = (long) vbuf->f_blocks; - bsdbuf->f_bfree = (long) vbuf->f_bfree; - bsdbuf->f_bavail = (long) vbuf->f_bavail; - bsdbuf->f_files = (long) vbuf->f_files; - bsdbuf->f_ffree = (long) vbuf->f_ffree; - bsdbuf->f_fsid.val[0] = vbuf->f_fsid; - bsdbuf->f_fsid.val[1] = 0; -} diff --git a/usr/src/lib/libbc/libc/sys/common/accept.c b/usr/src/lib/libbc/libc/sys/common/accept.c deleted file mode 100644 index 87c5fc9ba4..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/accept.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/socket.h> -#include <errno.h> - -#define N_AGAIN 11 - -int -accept(int s, struct sockaddr *addr, int *addrlen) -{ - int a; - if ((a = _accept(s, addr, addrlen)) == -1) { - if (errno == N_AGAIN) - errno = EWOULDBLOCK; - else - maperror(errno); - } - return (a); -} diff --git a/usr/src/lib/libbc/libc/sys/common/bind.c b/usr/src/lib/libbc/libc/sys/common/bind.c deleted file mode 100644 index c1f5249bb9..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/bind.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1996 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <errno.h> -#include <sys/types.h> -#include <sys/socket.h> - - -#define SOV_SOCKBSD 3 - -int -bind(int s, struct sockaddr *name, int namelen) -{ - int a; - if ((a = _so_bind(s, name, namelen, SOV_SOCKBSD)) != 0) { - maperror(errno); - } - return (a); -} diff --git a/usr/src/lib/libbc/libc/sys/common/cdioctl.h b/usr/src/lib/libbc/libc/sys/common/cdioctl.h deleted file mode 100644 index c40d08ed26..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/cdioctl.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * - * Defines for SCSI direct access devices modified for CDROM, based on sddef.h - * - */ - -/* - * CDROM io controls type definitions - */ -struct cdrom_msf { - unsigned char cdmsf_min0; /* starting minute */ - unsigned char cdmsf_sec0; /* starting second */ - unsigned char cdmsf_frame0; /* starting frame */ - unsigned char cdmsf_min1; /* ending minute */ - unsigned char cdmsf_sec1; /* ending second */ - unsigned char cdmsf_frame1; /* ending frame */ -}; - -struct cdrom_ti { - unsigned char cdti_trk0; /* starting track */ - unsigned char cdti_ind0; /* starting index */ - unsigned char cdti_trk1; /* ending track */ - unsigned char cdti_ind1; /* ending index */ -}; - -struct cdrom_tochdr { - unsigned char cdth_trk0; /* starting track */ - unsigned char cdth_trk1; /* ending track */ -}; - -struct cdrom_tocentry { - unsigned char cdte_track; - unsigned char cdte_adr :4; - unsigned char cdte_ctrl :4; - unsigned char cdte_format; - union { - struct { - unsigned char minute; - unsigned char second; - unsigned char frame; - } msf; - int lba; - } cdte_addr; - unsigned char cdte_datamode; -}; - -struct cdrom_subchnl { - unsigned char cdsc_format; - unsigned char cdsc_audiostatus; - unsigned char cdsc_adr: 4; - unsigned char cdsc_ctrl: 4; - unsigned char cdsc_trk; - unsigned char cdsc_ind; - union { - struct { - unsigned char minute; - unsigned char second; - unsigned char frame; - } msf; - int lba; - } cdsc_absaddr; - union { - struct { - unsigned char minute; - unsigned char second; - unsigned char frame; - } msf; - int lba; - } cdsc_reladdr; -}; - -/* - * definition of audio volume control structure - */ -struct cdrom_volctrl { - unsigned char channel0; - unsigned char channel1; - unsigned char channel2; - unsigned char channel3; -}; - -struct cdrom_read { - int cdread_lba; - caddr_t cdread_bufaddr; - int cdread_buflen; -}; - -/* - * CDROM io control commands - */ -#define CDROMPAUSE _IO('c', 10) /* Pause Audio Operation */ - -#define CDROMRESUME _IO('c', 11) /* Resume paused Audio Operation */ - -#define CDROMPLAYMSF _IOW('c', 12, struct cdrom_msf) /* Play Audio MSF */ -#define CDROMPLAYTRKIND _IOW('c', 13, struct cdrom_ti) /* - * Play Audio -` * Track/index - */ -#define CDROMREADTOCHDR \ - _IOR('c', 103, struct cdrom_tochdr) /* Read TOC header */ -#define CDROMREADTOCENTRY \ - _IOWR('c', 104, struct cdrom_tocentry) /* Read a TOC entry */ - -#define CDROMSTOP _IO('c', 105) /* Stop the cdrom drive */ - -#define CDROMSTART _IO('c', 106) /* Start the cdrom drive */ - -#define CDROMEJECT _IO('c', 107) /* Ejects the cdrom caddy */ - -#define CDROMVOLCTRL \ - _IOW('c', 14, struct cdrom_volctrl) /* control output volume */ - -#define CDROMSUBCHNL \ - _IOWR('c', 108, struct cdrom_subchnl) /* read the subchannel data */ - -#define CDROMREADMODE2 \ - _IOW('c', 110, struct cdrom_read) /* read CDROM mode 2 data */ - -#define CDROMREADMODE1 \ - _IOW('c', 111, struct cdrom_read) /* read CDROM mode 1 data */ diff --git a/usr/src/lib/libbc/libc/sys/common/close.c b/usr/src/lib/libbc/libc/sys/common/close.c deleted file mode 100644 index ed9a5ae703..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/close.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/syscall.h> - -int -close(int fd) -{ - return (bc_close(fd)); -} - -int -bc_close(int fd) -{ - fd_rem(fd); - return (_syscall(SYS_close, fd)); -} diff --git a/usr/src/lib/libbc/libc/sys/common/compat.h b/usr/src/lib/libbc/libc/sys/common/compat.h deleted file mode 100644 index df1ac6c4d2..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/compat.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1999 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <utmp.h> -#include <sys/types.h> -#include <sys/time.h> - -/* - * the following value will be stuffed into "fd2", which was previously - * used to hold the fd of the utmpx or wtmpx file when the application - * attempted to open utmp or wtmp. Since we now only support utmpx - * and wtmpx, that is always the only file we open (now as "fd"). - * The magic value in the second descriptor simply tells us that - * the fd is "special", in that we have to do utmp to utmpx - * record conversions on data read or written. The magic value - * is specifically chosen to be higher than any possible fd value - * could be in a 4.x application. - */ - -#define UTMPX_MAGIC_FLAG 512 - -/* - * 4.x utmp record format - */ -struct compat_utmp - { - char ut_line[8]; /* tty name */ - char ut_name[8]; /* user id */ - char ut_host[16]; /* host name, if remote */ - time_t ut_time; /* time on */ - } ; - - -struct exit_status -{ - short e_termination; /* termination status */ - short e_exit; /* exit status */ -} ; - -struct utmpx - { - char ut_user[32]; /* user login name */ - char ut_id[4]; /* inittab id */ - char ut_line[32]; /* device name (console, lnxx) */ - long ut_pid; /* process id */ - short ut_type; /* type of entry */ - struct exit_status ut_exit; /* process termination/exit status */ - struct timeval ut_tv; /* time entry was made */ - long ut_session; /* session ID, used for windowing */ - long pad[5]; /* reserved for future use */ - short ut_syslen; /* significant length of ut_host */ - /* including terminating null */ - char ut_host[257]; /* remote host name */ - } ; - - -#define getmodsize(size, ftype, ttype) \ - (((size / ftype) * ttype) + (size % ftype)) diff --git a/usr/src/lib/libbc/libc/sys/common/connect.c b/usr/src/lib/libbc/libc/sys/common/connect.c deleted file mode 100644 index 07ba29ba96..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/connect.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1996 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <errno.h> -#include <sys/types.h> -#include <sys/socket.h> - -/* SVR4 stream operation macros */ -#define STR ('S'<<8) -#define I_SWROPT (STR|023) -#define SNDPIPE 0x002 - -int -connect(int s, struct sockaddr *name, int namelen) -{ - int a; - - if ((a = _connect(s, name, namelen)) == -1) - maperror(); - return (a); -} diff --git a/usr/src/lib/libbc/libc/sys/common/dup.c b/usr/src/lib/libbc/libc/sys/common/dup.c deleted file mode 100644 index 1f7a5dddc1..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/dup.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include <sys/syscall.h> -#include <sys/fcntl.h> - -int -dup(int fd) -{ - int ret, fds; - - if ((ret = _syscall(SYS_fcntl, fd, F_DUPFD, 0)) == -1) - return (-1); - - if ((fds = fd_get(fd)) != -1) - fd_add(ret, fds); - - return (ret); -} diff --git a/usr/src/lib/libbc/libc/sys/common/dup2.c b/usr/src/lib/libbc/libc/sys/common/dup2.c deleted file mode 100644 index 8a314ecd91..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/dup2.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <fcntl.h> -#include <unistd.h> -#include <sys/syscall.h> -#include <errno.h> - -#define OPEN_MAX 20 /* Taken from SVR4 limits.h */ - -int -dup2( - int fildes, /* file descriptor to be duplicated */ - int fildes2) /* desired file descriptor */ -{ - int tmperrno; /* local work area */ - int open_max; /* max open files */ - int ret; /* return value */ - int fds; /* duplicate files descriptor */ - - if ((open_max = ulimit(4, 0)) < 0) - open_max = OPEN_MAX; /* take a guess */ - - /* Be sure fildes is valid and open */ - if (fcntl(fildes, F_GETFL, 0) == -1) { - errno = EBADF; - return (-1); - } - - /* Be sure fildes2 is in valid range */ - if (fildes2 < 0 || fildes2 >= open_max) { - errno = EBADF; - return (-1); - } - - /* Check if file descriptors are equal */ - if (fildes == fildes2) { - /* open and equal so no dup necessary */ - return (fildes2); - } - /* Close in case it was open for another file */ - /* Must save and restore errno in case file was not open */ - tmperrno = errno; - close(fildes2); - errno = tmperrno; - - /* Do the dup */ - if ((ret = fcntl(fildes, F_DUPFD, fildes2)) != -1) { - if ((fds = fd_get(fildes)) != -1) - fd_add(fildes2, fds); - } - return (ret); -} diff --git a/usr/src/lib/libbc/libc/sys/common/execl.c b/usr/src/lib/libbc/libc/sys/common/execl.c deleted file mode 100644 index d0aa2a5169..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/execl.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdarg.h> - -/* - * execl(name, arg0, arg1, ..., argn, (char *)0) - * environment automatically passed. - */ -int -execl(char *name, ...) -{ - extern char **environ; - va_list args; - int r; - - va_start(args, name); - r = execve(name, (char **)args, environ); - va_end(args); - - return (r); -} diff --git a/usr/src/lib/libbc/libc/sys/common/execle.c b/usr/src/lib/libbc/libc/sys/common/execle.c deleted file mode 100644 index a19d616b74..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/execle.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdarg.h> - -/* - * execle(name, arg0, arg1, ..., argn, (char *)0, envp) - */ -int -execle(char *name, ...) -{ - va_list args; - char **first; - char **environmentp; - - va_start(args, name); - first = (char **)args; - /* traverse argument list to NULL */ - while (va_arg(args, char *) != (char *)0) - ; - /* environment is next arg */ - environmentp = va_arg(args, char **); - va_end(args); - - return (execve(name, first, environmentp)); -} diff --git a/usr/src/lib/libbc/libc/sys/common/execv.c b/usr/src/lib/libbc/libc/sys/common/execv.c deleted file mode 100644 index 7f49c7b725..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/execv.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * execv(file, argv) - * - * where argv is a vector argv[0] ... argv[x], NULL - * last vector element must be NULL - * environment passed automatically - */ -int -execv(char *file, char **argv) -{ - extern char **environ; - - return (execve(file, argv, environ)); -} diff --git a/usr/src/lib/libbc/libc/sys/common/fdlist.c b/usr/src/lib/libbc/libc/sys/common/fdlist.c deleted file mode 100644 index 2cadd64442..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/fdlist.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> - -#define NUM_FD 16 - -struct fd_lst { - int fd[NUM_FD]; /* list of 16 descriptors */ - int fds[NUM_FD]; - struct fd_lst *next; -}; - - -static struct fd_lst *fdlist = NULL; -static struct fd_lst *fdtail = NULL; - -void -fd_init(struct fd_lst *lst) -{ - int i; - - for (i=0; i<NUM_FD; i++) { - lst->fd[i] = -1; - lst->fds[i] = -1; - } - lst->next = NULL; -} - - - -int -fd_add(int fd, int fds) -{ - int i; - struct fd_lst *fdc, *fdnew; - - fdc = fdlist; - - while (fdc != NULL) { - for (i=0; i<NUM_FD; i++) { - if (fdc->fd[i] == -1) { - fdc->fd[i] = fd; - fdc->fds[i] = fds; - return(0); - } - } - fdc = fdc->next; - } - - if ((fdnew = (struct fd_lst *)malloc(sizeof(struct fd_lst))) == NULL) { - fprintf(stderr,"fd_add: malloc failed\n"); - exit(1); - } - - fd_init(fdnew); - - if (fdlist == NULL) - fdlist = fdnew; - else - fdtail->next = fdnew; - - fdtail = fdnew; - fdtail->fd[0] = fd; - fdtail->fds[0] = fds; - return (0); -} - - -int -fd_rem(int fd) -{ - int i; - struct fd_lst *fdc = fdlist; - - while (fdc != NULL) { - for (i=0; i<NUM_FD; i++) { - if (fdc->fd[i] == fd) { - fdc->fd[i] = -1; - fdc->fds[i] = -1; - return (0); - } - } - fdc = fdc->next; - } - return (0); -} - - -int -fd_get(int fd) -{ - int i; - struct fd_lst *fdc = fdlist; - - while (fdc != NULL) { - for (i=0; i<NUM_FD; i++) { - if (fdc->fd[i] == fd) { - return (fdc->fds[i]); - } - } - fdc = fdc->next; - } - return (-1); -} diff --git a/usr/src/lib/libbc/libc/sys/common/flock.c b/usr/src/lib/libbc/libc/sys/common/flock.c deleted file mode 100644 index db3525236a..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/flock.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - * Copyright 2015 Joyent, Inc. - */ - -#include <sys/file.h> -#include <sys/fcntl.h> - -int -flock(fd, operation) -int fd, operation; -{ - struct flock fl; - int cmd = F_FLOCKW; - - fl.l_whence = 0; - fl.l_start = 0; - fl.l_len = 0; - fl.l_type = 0; - if (operation & LOCK_UN) - fl.l_type |= F_UNLCK; - if (operation & LOCK_SH) - fl.l_type |= F_RDLCK; - if (operation & LOCK_EX) - fl.l_type |= F_WRLCK; - if (operation & LOCK_NB) - cmd = F_FLOCK; - return (bc_fcntl(fd, cmd, &fl)); -} diff --git a/usr/src/lib/libbc/libc/sys/common/fsync.c b/usr/src/lib/libbc/libc/sys/common/fsync.c deleted file mode 100644 index 7b94aee592..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/fsync.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/syscall.h> - -#define FSYNC 0x10 /* Solaris definition, not SunOS4.x */ - -int -fsync(int fd) -{ - return (_syscall(SYS_fdsync, fd, FSYNC)); -} diff --git a/usr/src/lib/libbc/libc/sys/common/ftruncate.c b/usr/src/lib/libbc/libc/sys/common/ftruncate.c deleted file mode 100644 index 6ebdcdb8ed..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/ftruncate.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/syscall.h> -#include <sys/types.h> - -/* The following are from SVR4 sys/fcntl.h */ - -#define F_FREESP 11 /* Free file space */ -#define F_WRLCK 02 /* Write Lock */ - -/* lock structure from SVR4. */ -struct fl { - short l_type; - short l_whence; - off_t l_start; - off_t l_len; - long l_sysid; - pid_t l_pid; - long pad[4]; -}; - -int -ftruncate(int fd, off_t length) -{ - - struct fl lck; - - lck.l_whence = 0; /* offset l_start from beginning of file */ - lck.l_start = length; - lck.l_type = F_WRLCK; /* setting a write lock */ - lck.l_len = 0L; - - if (_syscall(SYS_fcntl, fd, F_FREESP, (int)&lck) == -1) - return (-1); - else - return (0); -} diff --git a/usr/src/lib/libbc/libc/sys/common/getdents.c b/usr/src/lib/libbc/libc/sys/common/getdents.c deleted file mode 100644 index dce588a3a3..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/getdents.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1994 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <sys/types.h> -#include <sys/dirent.h> -#include <sys/syscall.h> -#include <sys/param.h> -#include <sys/errno.h> - -#define ALIGN 4 - -extern int errno; - -struct n_dirent{ - unsigned long d_ino; - long d_off; - unsigned short d_reclen; - char d_name[1]; -}; - - -int getdents(fd, buf, bytes) -int fd; -char *buf; -int bytes; -{ - return(bc_getdents(fd, buf, bytes)); -} - - -int bc_getdents(fd, buf, bytes) -int fd; -char *buf; -int bytes; -{ - int ret, nbytes; - char *nbuf; - struct dirent *dir; - struct n_dirent *ndir; - int count=0; - off_t last_off; - - if (buf == (char *)0 || buf == (char *)-1) { - errno = EFAULT; - return(-1); - } - - nbytes = bytes; /* buffer can only be as large as user expects */ - - if ((nbuf = (char *)malloc(nbytes)) == NULL) { - return(-1); - } - - if ((ret = _syscall(SYS_getdents, fd, nbuf, nbytes)) == -1) { - free(nbuf); - return(ret); - } - - - dir = (struct dirent *)buf; - ndir = (struct n_dirent *)nbuf; /* source directory format */ - - while ((((int)(((char *)dir) + sizeof(struct n_dirent) + - strlen(ndir->d_name) + ALIGN) & ~(ALIGN - 1)) < - (int)(buf + bytes)) && - ((char *)ndir + sizeof(struct n_dirent) <= (nbuf + ret))) { - dir->d_off = ndir->d_off; - dir->d_fileno = ndir->d_ino; /* NOT VALID */ - dir->d_namlen = strlen(ndir->d_name); - dir->d_reclen = (short)((sizeof(struct dirent) - MAXNAMLEN + - dir->d_namlen + ALIGN) & -ALIGN); - strncpy(dir->d_name, ndir->d_name, dir->d_namlen); - dir->d_name[dir->d_namlen] = '\0'; - count += dir->d_reclen; - last_off = ndir->d_off; - dir = (struct dirent *)((char *)dir + - ((int)( dir->d_reclen))); - ndir = (struct n_dirent *)((char *)ndir + - ((int)(ndir->d_reclen))); - } - - /* - * Seek to the next entry in the directory. If all entries - * in ndir were not copied to dir, the next getdents syscall - * will start reading from there. - */ - (void)lseek(fd, last_off, SEEK_SET); - free(nbuf); - return(count); -} diff --git a/usr/src/lib/libbc/libc/sys/common/getdtablesize.c b/usr/src/lib/libbc/libc/sys/common/getdtablesize.c deleted file mode 100644 index 7d8ad7e6f1..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/getdtablesize.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/time.h> -#include <sys/resource.h> - -/* - * getdtablesize is implemented on top of getrlimit's - * RLIMIT_NOFILE feature. The current (Soft) limit is - * returned. - */ - -int -getdtablesize(void) -{ - int nds; - int error; - struct rlimit rip; - - error = getrlimit(RLIMIT_NOFILE, &rip); - if ( error < 0 ) - return (-1); - else - return (rip.rlim_cur); -} diff --git a/usr/src/lib/libbc/libc/sys/common/getegid.c b/usr/src/lib/libbc/libc/sys/common/getegid.c deleted file mode 100644 index 9e3e71cf22..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/getegid.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1995, by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -int -getegid(void) -{ - int egid; - - if ((egid = _getegid()) > 0xffff) - egid = 60001; /* nobody */ - return (egid); -} diff --git a/usr/src/lib/libbc/libc/sys/common/geteuid.c b/usr/src/lib/libbc/libc/sys/common/geteuid.c deleted file mode 100644 index 0c6fd1c19c..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/geteuid.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1995, by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -int -geteuid(void) -{ - int euid; - - if ((euid = _geteuid()) > 0xffff) - euid = 60001; /* nobody */ - return (euid); -} diff --git a/usr/src/lib/libbc/libc/sys/common/getgid.c b/usr/src/lib/libbc/libc/sys/common/getgid.c deleted file mode 100644 index 3bc425e75f..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/getgid.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1995, by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -int -getgid(void) -{ - int gid; - - if ((gid = _getgid()) > 0xffff) - gid = 60001; /* nobody */ - return (gid); -} diff --git a/usr/src/lib/libbc/libc/sys/common/getpeername.c b/usr/src/lib/libbc/libc/sys/common/getpeername.c deleted file mode 100644 index 0c91688adc..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/getpeername.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/socket.h> -#include <errno.h> - -int -getpeername(int s, struct sockaddr *name, int *namelen) -{ - int a; - if ((a = _getpeername(s, name, namelen)) == -1) - maperror(errno); - return (a); -} diff --git a/usr/src/lib/libbc/libc/sys/common/getsockname.c b/usr/src/lib/libbc/libc/sys/common/getsockname.c deleted file mode 100644 index 1cc4bd7abf..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/getsockname.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/socket.h> -#include <errno.h> - -int -getsockname(int s, struct sockaddr *name, int *namelen) -{ - int a; - if ((a = _getsockname(s, name, namelen)) == -1) - maperror(errno); - return (a); -} diff --git a/usr/src/lib/libbc/libc/sys/common/getsockopt.c b/usr/src/lib/libbc/libc/sys/common/getsockopt.c deleted file mode 100644 index 69f27790bf..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/getsockopt.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/socket.h> -#include <errno.h> - -int -getsockopt(int s, int level, int optname, char *optval, int *optlen) -{ - int a; - if ((a = _getsockopt(s, level, optname, optval, optlen)) == -1) - maperror(errno); - return (a); -} diff --git a/usr/src/lib/libbc/libc/sys/common/gettimeofday.c b/usr/src/lib/libbc/libc/sys/common/gettimeofday.c deleted file mode 100644 index d027ceee36..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/gettimeofday.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1995 Sun Microsystems, Inc. All rights reserved. - */ - -#ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <stdlib.h> -#include <time.h> -#include <tzfile.h> -#include <sys/time.h> - -static int get_tzp_info(void); -extern long _timezone, _altzone; /* from the base libc */ - - -/* - * The second parameter to gettimeofday() did not work correctly on - * 4.x, and it was documented that localtime() should be used instead. - * This is an attempt to provide correctly what 4.x meant to do. There - * are shortcomings, however. See notes for DST_RUM and DST_AUSTALT. - */ - -int -gettimeofday(tp, tzp) -struct timeval *tp; -struct timezone *tzp; -{ - int ret = 0; - - if (tp != NULL) - if ((ret = _gettimeofday(tp)) == -1) - maperror(); - - /* - * We should call localtime() with the current time and - * set tz_minuteswest to _altzone/SECSPERMIN if tm_isdst - * is set. But we want to be bug-for-bug compatible with - * 4.x, which would never adjust for DST. Futher comments - * are in get_tzp_info(). - */ - if (tzp != NULL) { - _tzset(); - tzp->tz_dsttime = get_tzp_info(); - tzp->tz_minuteswest = _timezone/SECSPERMIN; - } - - return(ret); -} - -static int -get_tzp_info() -{ - char *zonename = getenv("TZ"); - - if ((zonename == NULL) || (*zonename == '\0')) - return (DST_NONE); - - if ((strncmp(zonename, "US/", 3) == 0) || - (strcmp(zonename, "PST8PDT") == 0) || - (strcmp(zonename, "MST7MDT") == 0) || - (strcmp(zonename, "CST6CDT") == 0) || - (strcmp(zonename, "EST5EDT") == 0) || - (strncmp(zonename, "America/", 8) == 0)) - return (DST_USA); - - if (strncmp(zonename, "Australia/", 10) == 0) - return (DST_AUST); - - if (strcmp(zonename, "WET") == 0) - return (DST_WET); - - if (strcmp(zonename, "MET") == 0) - return (DST_MET); - - if (strcmp(zonename, "EET") == 0) - return (DST_EET); - - if (strncmp(zonename, "Canada/", 7) == 0) - return (DST_CAN); - - if ((strcmp(zonename, "GB") == 0) || - (strcmp(zonename, "GB-Eire") == 0)) - return (DST_GB); - - /* - * what's the corresponding DST_RUM: Rumanian DST? - * There was not Rumanian timezone on 4.x. - */ - - if (strcmp(zonename, "Turkey") == 0) - return (DST_TUR); - - /* - * How do we differentiate between DST_AUST and DST_AUSTALT? - * It seems that all of our current Australia timezones do - * not have the 1986 shift, so we never will return DST_AUSTALT. - */ - - return (DST_NONE); -} diff --git a/usr/src/lib/libbc/libc/sys/common/getuid.c b/usr/src/lib/libbc/libc/sys/common/getuid.c deleted file mode 100644 index 175c9dd683..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/getuid.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1995, by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -int -getuid(void) -{ - int uid; - - if ((uid = _getuid()) > 0xffff) - uid = 60001; /* nobody */ - return (uid); -} diff --git a/usr/src/lib/libbc/libc/sys/common/ioctl.c b/usr/src/lib/libbc/libc/sys/common/ioctl.c deleted file mode 100644 index 71ed004473..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/ioctl.c +++ /dev/null @@ -1,645 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1995 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Do not include sys/conf.h- it isn't in the compatibility include dirs. - */ -#ifdef THIS_IS_AVAIL -#include <sys/conf.h> -#endif -#include <stdio.h> -#include <signal.h> -#include <sys/types.h> -#include <sys/ioccom.h> -#include <sys/stropts.h> -#include <sys/des.h> -#include <sys/fcntl.h> -#include <sys/filio.h> -#include <sys/termios.h> -#include <sys/termio.h> -#include <sys/ttold.h> -#include <sys/ttycom.h> -#include <sys/msio.h> -#include <sys/errno.h> -#include <nettli/tihdr.h> -#include <nettli/timod.h> -#include <nettli/tiuser.h> -#include <sun/dkio.h> -#include <scsi/impl/uscsi.h> -#include "cdioctl.h" -#include "s5dkio.h" -#include "s5fdio.h" - -/* - * parameter for windows ioctls - */ -struct winclip { - int wc_blockbytes; /* size of wc_block */ - int wc_clipid; /* Current clip id of clipping */ - short wc_screenrect[4]; /* Screen relatived (used when paint) */ - char *wc_block; /* Block where RectList is copied. */ -}; - -/* - * Ioctl control packet - */ -struct s5termios { - tcflag_t c_iflag; /* input modes */ - tcflag_t c_oflag; /* output modes */ - tcflag_t c_cflag; /* control modes */ - tcflag_t c_lflag; /* line discipline modes */ - cc_t c_cc[19]; /* control chars */ -}; - -#define N_ENOMSG 35 -#define N_I_FIND ('S'<<8)|013 -#define N_I_PUSH ('S'<<8)|02 -#define WINGETEXPOSEDRL _IOWR('g',31,struct winclip) -#define WINGETDAMAGEDRL _IOWR('g',32,struct winclip) - -struct n_sgttyb { - char sg_ispeed; /* input speed */ - char sg_ospeed; /* output speed */ - char sg_erase; /* erase character */ - char sg_kill; /* kill character */ - int sg_flags; /* mode flags */ -}; - -static int handle_dkio_partitions(int, int, int); -static int tcget(int, int, int); -static int tcset(int, int, int); -static int _bc_ioctl(int, int, int); - -int -ioctl(int des, int request, int arg) -{ - int ret; - - if ((ret = _bc_ioctl(des, request, arg)) == -1) - maperror(); - return (ret); -} - -int -bc_ioctl(int des, int request, int arg) -{ - int ret; - - if ((ret = _bc_ioctl(des, request, arg)) == -1) - maperror(); - return (ret); -} - -static int -_bc_ioctl(int des, int request, int arg) -{ - int ret; - int nreq = (request >> 8) & 0xFF; - struct n_sgttyb nsg; - struct s5_dk_cinfo newArgs; - struct dk_info *infoArgs; - struct dk_conf *confArgs; - extern int errno; - - /* not all mappings for 'm' have been performed */ - switch (nreq) { - case ((int) 't'): - if (_ioctl(des, N_I_FIND, "ttcompat") == 0) - if (_ioctl(des, N_I_PUSH, "ttcompat") == -1) - perror("ioctl/I_PUSH"); - switch(request) { - case TIOCSETD: - /* added for sunview */ - return(0); - case TIOCREMOTE: request = ('t'<<8)|30; - break; - case TIOCNOTTY: - bc_setsid(); - return(0); - case TIOCGPGRP: request = ('t'<<8)|20; - break; - case TIOCSPGRP: - { - pid_t pgid; - sigset_t set, oset; - - request = ('t'<<8)|21; - ret = _ioctl(des, request, arg); - - /* - * SunOS4.x allows this to succeed - * even if the process group does - * not exist yet. We emulate the 4.x - * bug by creating the process group - * and reissuing the ioctl(). - * See bugid 1175044. - */ - if (ret != 0 && errno == EPERM && - (pgid = *((pid_t *)arg)) != 0 && - pgid == getpid() && - setpgid(0, pgid) == 0) { - sigemptyset(&set); - sigaddset(&set, SIGTSTP); - sigaddset(&set, SIGTTIN); - sigaddset(&set, SIGTTOU); - sigprocmask(SIG_BLOCK, - &set, &oset); - ret = _ioctl(des, - request, arg); - sigprocmask(SIG_SETMASK, - &oset, NULL); - } - return(ret); - } - case TIOCSTI: request = ('t'<<8)|23; - break; - case TIOCSIGNAL: request = ('t'<<8)|31; - break; - case TIOCCONS: request = ('t'<<8)|36; - break; - case TIOCSWINSZ: request = ('T'<<8)|103; - break; - case TIOCGWINSZ: request = ('T'<<8)|104; - break; - case TIOCSETP: - case TIOCSETN: - { - struct sgttyb *sg = (struct sgttyb *)arg; - nsg.sg_ispeed = sg->sg_ispeed; - nsg.sg_ospeed = sg->sg_ospeed; - nsg.sg_erase = sg->sg_erase; - nsg.sg_kill = sg->sg_kill; - nsg.sg_flags = (int)sg->sg_flags; - arg = (int)&nsg; - request = request & 0x0FFFF; - break; - } - - case TIOCGETP: - { - struct sgttyb *sg = (struct sgttyb *)arg; - - ret = _ioctl(des, request&0xFFFF, &nsg); - if (ret != -1) { - sg->sg_ispeed = nsg.sg_ispeed; - sg->sg_ospeed = nsg.sg_ospeed; - sg->sg_erase = nsg.sg_erase; - sg->sg_kill = nsg.sg_kill; - sg->sg_flags = (short)nsg.sg_flags & 0x0FFFF; - } - return(ret); - } - case TIOCPKT: - case TIOCUCNTL: - case TIOCTCNTL: - case TIOCSSOFTCAR: - case TIOCGSOFTCAR: - case TIOCISPACE: - case TIOCISIZE: - case TIOCSSIZE: - case TIOCGSIZE: - break; - default: request = request & 0x0FFFF; - break; - } - break; - case ((int) 'T'): - switch(request) { - case TCGETS: - request = ('T'<<8)|13; - return(tcget(des, request, arg)); - break; - case TCSETS: - request = ('T'<<8)|14; - return(tcset(des, request, arg)); - break; - case TCSETSW: - request = ('T'<<8)|15; - return(tcset(des, request, arg)); - break; - case TCSETSF: - request = ('T'<<8)|16; - return(tcset(des, request, arg)); - break; - case TCGETA: - case TCSETA: - case TCSETAW: - case TCSETAF: - default: - request = request & 0x0FFFF; - break; - } - break; - case ((int) 'S'): - switch (request) { - case I_PLINK: request = ('S'<<8)|026; - break; - case I_PUNLINK: request = ('S'<<8)|027; - break; - case I_STR: { - struct strioctl *iarg = - (struct strioctl *)arg; - int cmd = iarg->ic_cmd; - - switch (cmd) { - case TI_GETINFO: { - /* - * The T_info_ack structure - * has one additional word - * added to it in 5.x. - * To prevent the module from - * overwritting user memory we - * use an internal buffer for - * the transfer and copy out - * the results to the caller. - */ - struct { - struct T_info_ack info; - long pad[16]; - } args; - char *dp = iarg->ic_dp; - - memcpy(&args.info, iarg->ic_dp, - sizeof(struct T_info_ack)); - iarg->ic_dp = - (char *) &args.info; - iarg->ic_cmd = (TIMOD | 140); - ret = _ioctl(des, - request & 0xffff, arg); - iarg->ic_cmd = cmd; - iarg->ic_dp = dp; - iarg->ic_len = - sizeof(struct T_info_ack); - memcpy(iarg->ic_dp, &args.info, - iarg->ic_len); - return (ret); - break; - } - case TI_OPTMGMT: - iarg->ic_cmd = (TIMOD | 141); - break; - case TI_BIND: - iarg->ic_cmd = (TIMOD | 142); - break; - case TI_UNBIND: - iarg->ic_cmd = (TIMOD | 143); - break; - } - ret = _ioctl(des, - request & 0xffff, arg); - iarg->ic_cmd = cmd; - return ret; - } - default: request = request & 0x0FFFF; - break; - } - break; - case ((int) 'm'): - switch (request) { - case MSIOGETPARMS: request = ('m'<<8)|1; - break; - case MSIOSETPARMS: request = ('m'<<8)|2; - break; - default: request = request & 0x0FFFF; - break; - } - break; - case ((int) 'd'): - switch (request) { - case DKIOCGGEOM: - request = S5DKIOCGGEOM; - break; - case DKIOCSGEOM: - request = S5DKIOCSGEOM; - break; - case DKIOCSAPART: - request = S5DKIOCSAPART; - break; - case DKIOCGAPART: - request = S5DKIOCGAPART; - break; - case DKIOCSTYPE: - request = S5HDKIOCSTYPE; - break; - case DKIOCGTYPE: - request = S5HDKIOCGTYPE; - break; - case DKIOCSBAD: - request = S5HDKIOCSBAD; - break; - case DKIOCGBAD: - request = S5HDKIOCGBAD; - break; - case DKIOCSCMD: - request = S5HDKIOCSCMD; - break; - case DKIOCGDIAG: - request = S5HDKIOCGDIAG; - break; - case FDKIOGCHAR: - request = S5FDIOGCHAR; - break; - case FDKIOSCHAR: - request = S5FDIOSCHAR; - break; - case FDKEJECT: - request = S5FDEJECT; - break; - case FDKGETCHANGE: - request = S5FDGETCHANGE; - break; - case FDKGETDRIVECHAR: - request = S5FDGETDRIVECHAR; - break; - case FDKSETDRIVECHAR: - request = S5FDSETDRIVECHAR; - break; - case FDKGETSEARCH: - request = S5FDGETSEARCH; - break; - case FDKSETSEARCH: - request = S5FDSETSEARCH; - break; - case FDKIOCSCMD: - request = S5FDIOCMD; - break; - case F_RAW: - request = S5FDRAW; - break; - case DKIOCINFO: - ret = _ioctl(des, S5DKIOCINFO, &newArgs); - if (ret != -1) { - infoArgs = (struct dk_info *)arg; - infoArgs->dki_ctlr = - newArgs.dki_addr; - infoArgs->dki_unit = - newArgs.dki_unit; - infoArgs->dki_ctype = - newArgs.dki_ctype; - infoArgs->dki_flags = - newArgs.dki_flags; - } - return ret; - break; - case DKIOCGCONF: - ret = _ioctl(des, S5DKIOCINFO, &newArgs); - if (ret != -1) { - confArgs = (struct dk_conf *)arg; - strncpy(confArgs->dkc_cname, - newArgs.dki_cname, - DK_DEVLEN); - strncpy(confArgs->dkc_dname, - newArgs.dki_dname, - DK_DEVLEN); - confArgs->dkc_ctype = - (u_short)newArgs.dki_ctype; - confArgs->dkc_flags = - (u_short)newArgs.dki_flags; - confArgs->dkc_cnum = - newArgs.dki_cnum; - confArgs->dkc_addr = - newArgs.dki_addr; - confArgs->dkc_space = - (u_int)newArgs.dki_space; - confArgs->dkc_prio = - newArgs.dki_prio; - confArgs->dkc_vec = - newArgs.dki_vec; - confArgs->dkc_unit = - newArgs.dki_unit; - confArgs->dkc_slave = - newArgs.dki_slave; - } - return ret; - break; - case DKIOCWCHK: - /* - * This is unsupported in SVR4. It - * turns on verify-after-write for - * the floppy. I don't think the - * system call should fail, however. - */ - return 0; - break; - case DKIOCGPART: - case DKIOCSPART: - return (handle_dkio_partitions(des, - request, arg)); - case DKIOCGLOG: - /* unsupported */ - errno = EINVAL; - return -1; - break; - case DESIOCBLOCK: - case DESIOCQUICK: - break; /* no change for these two */ - default: - request = request & 0x0FFFF; /* try */ - break; - } - break; - case ((int) 'c'): - switch (request) { - case CDROMPAUSE: - request = S5CDROMPAUSE; - break; - case CDROMRESUME: - request = S5CDROMRESUME; - break; - case CDROMPLAYMSF: - request = S5CDROMPLAYMSF; - break; - case CDROMPLAYTRKIND: - request = S5CDROMPLAYTRKIND; - break; - case CDROMREADTOCHDR: - request = S5CDROMREADTOCHDR; - break; - case CDROMREADTOCENTRY: - request = S5CDROMREADTOCENTRY; - break; - case CDROMSTOP: - request = S5CDROMSTOP; - break; - case CDROMSTART: - request = S5CDROMSTART; - break; - case CDROMEJECT: - request = S5CDROMEJECT; - break; - case CDROMVOLCTRL: - request = S5CDROMVOLCTRL; - break; - case CDROMSUBCHNL: - request = S5CDROMSUBCHNL; - break; - case CDROMREADMODE1: - request = S5CDROMREADMODE1; - break; - case CDROMREADMODE2: - request = S5CDROMREADMODE2; - break; - } - break; - case ((int) 'u'): - switch (request) { - case USCSICMD: - { - struct s5_uscsi_cmd s5_cmd; - struct uscsi_cmd *cmd = - (struct uscsi_cmd *) arg; - request = S5USCSICMD; - s5_cmd.uscsi_cdb = cmd->uscsi_cdb; - s5_cmd.uscsi_cdblen = - cmd->uscsi_cdblen; - s5_cmd.uscsi_bufaddr = - cmd->uscsi_bufaddr; - s5_cmd.uscsi_buflen = - cmd->uscsi_buflen; - s5_cmd.uscsi_flags = - cmd->uscsi_flags; - ret = _ioctl(des, request, &s5_cmd); - cmd->uscsi_status = s5_cmd.uscsi_status; - return(ret); - } - } - break; - case ((int) 'k'): - case ((int) 'v'): - case ((int) 'F'): - case ((int) 'G'): - case ((int) 'X'): - case ((int) 'L'): - request = request & 0x0FFFF; - break; - case ((int) 'f'): - if ((request == FIOCLEX) || (request == FIONCLEX)) - return(fcntl(des, F_SETFD, - ((request == FIOCLEX) ? 1 : 0))); - break; - case ((int) 'g'): - /* Treat the following 2 ioctls specially for - * sunview. */ - if (request == WINGETEXPOSEDRL || - request == WINGETDAMAGEDRL) { - ret = _ioctl(des, request, arg); - if (errno == N_ENOMSG) - errno = EFBIG; - return(ret); - } - break; - } - return (_ioctl(des, request, arg)); -} - - -static int -handle_dkio_partitions(int des, int request, int arg) -{ - struct s5_dk_cinfo cinfo; - struct dk_allmap map; - struct dk_map *part; - int ret; - extern int errno; - - part = (struct dk_map *) arg; - - ret = _ioctl(des, S5DKIOCINFO, &cinfo); - - if ((cinfo.dki_partition < 0) || (cinfo.dki_partition >= NDKMAP)) { - errno = EINVAL; - return (-1); - } - - if (ret != -1) { - ret = _ioctl(des, S5DKIOCGAPART, &map); - if (ret != -1) { - if (request == DKIOCGPART) { - part->dkl_cylno = - map.dka_map[cinfo.dki_partition].dkl_cylno; - part->dkl_nblk = - map.dka_map[cinfo.dki_partition].dkl_nblk; - } else { - map.dka_map[cinfo.dki_partition].dkl_cylno = - part->dkl_cylno; - map.dka_map[cinfo.dki_partition].dkl_nblk = - part->dkl_nblk; - ret = _ioctl(des, S5DKIOCSAPART, &map); - } - } - } - return (ret); -} - -static int -tcset(des, request, arg) - register int des; - register int request; - int arg; -{ - struct s5termios s5termios; - struct termios *termios; - - termios = (struct termios *)arg; - - if (termios != NULL) { - s5termios.c_iflag = termios->c_iflag; - s5termios.c_oflag = termios->c_oflag; - s5termios.c_cflag = termios->c_cflag; - s5termios.c_lflag = termios->c_lflag; - memcpy(s5termios.c_cc, termios->c_cc, NCCS); - return (_ioctl(des, request, &s5termios)); - } else - return (_ioctl(des, request, NULL)); - -} - -static int -tcget(des, request, arg) - register int des; - register int request; - int arg; -{ - struct s5termios s5termios; - struct termios *termios; - int ret; - - termios = (struct termios *)arg; - - ret = _ioctl(des, request, &s5termios); - - if (termios != NULL) { - termios->c_iflag = s5termios.c_iflag; - termios->c_oflag = s5termios.c_oflag; - termios->c_cflag = s5termios.c_cflag; - termios->c_lflag = s5termios.c_lflag; - memcpy(termios->c_cc, s5termios.c_cc, NCCS); - } - - return (ret); -} diff --git a/usr/src/lib/libbc/libc/sys/common/kill.c b/usr/src/lib/libbc/libc/sys/common/kill.c deleted file mode 100644 index 9374dda668..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/kill.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/syscall.h> -#include <stdio.h> -#include <errno.h> - - -int -kill(int pid, int sig) -{ - return(bc_kill(pid, sig)); -} - -int -bc_kill(int pid, int sig) -{ - return(_kill(pid, maptonewsig(sig))); -} diff --git a/usr/src/lib/libbc/libc/sys/common/listen.c b/usr/src/lib/libbc/libc/sys/common/listen.c deleted file mode 100644 index 29b05cacf0..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/listen.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <errno.h> - -int -listen(int s, int backlog) -{ - int a; - if ((a = _listen(s, backlog)) == -1) - maperror(errno); - return (a); -} diff --git a/usr/src/lib/libbc/libc/sys/common/lseek.c b/usr/src/lib/libbc/libc/sys/common/lseek.c deleted file mode 100644 index 17bbd92c1c..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/lseek.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "compat.h" -#include <errno.h> -#include <sys/syscall.h> -#include <sys/types.h> -#include <unistd.h> - -off_t -lseek(int fd, off_t offset, int whence) -{ - int off, ret; - - if (whence < 0 || whence > 2) { - errno = EINVAL; - return (-1); - } - if (fd_get(fd) != -1) { - off = getmodsize(offset, sizeof (struct compat_utmp), - sizeof (struct utmpx)); - if ((ret = _syscall(SYS_lseek, fd, off, whence)) != -1) - ret = getmodsize(ret, sizeof (struct utmpx), - sizeof (struct compat_utmp)); - return (ret); - } else { - return (_syscall(SYS_lseek, fd, offset, whence)); - } -} diff --git a/usr/src/lib/libbc/libc/sys/common/maperror.c b/usr/src/lib/libbc/libc/sys/common/maperror.c deleted file mode 100644 index c60db84912..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/maperror.c +++ /dev/null @@ -1,295 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1995 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Include the SVR4/5.0 errno.h - */ - -#include "s5errno.h" - -/* from UCB 4.1 82/12/28 */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * XError codes from 4.1 - */ - -#define XEPERM 1 /* Not owner */ -#define XENOENT 2 /* No such file or directory */ -#define XESRCH 3 /* No such process */ -#define XEINTR 4 /* Interrupted system call */ -#define XEIO 5 /* I/O error */ -#define XENXIO 6 /* No such device or address */ -#define XE2BIG 7 /* Arg list too long */ -#define XENOEXEC 8 /* Exec format error */ -#define XEBADF 9 /* Bad file number */ -#define XECHILD 10 /* No children */ -#define XEAGAIN 11 /* No more processes */ -#define XENOMEM 12 /* Not enough core */ -#define XEACCES 13 /* Permission denied */ -#define XEFAULT 14 /* Bad address */ -#define XENOTBLK 15 /* Block device required */ -#define XEBUSY 16 /* Mount device busy */ -#define XEEXIST 17 /* File exists */ -#define XEXDEV 18 /* Cross-device link */ -#define XENODEV 19 /* No such device */ -#define XENOTDIR 20 /* Not a directory*/ -#define XEISDIR 21 /* Is a directory */ -#define XEINVAL 22 /* Invalid argument */ -#define XENFILE 23 /* File table overflow */ -#define XEMFILE 24 /* Too many open files */ -#define XENOTTY 25 /* Not a typewriter */ -#define XETXTBSY 26 /* Text file busy */ -#define XEFBIG 27 /* File too large */ -#define XENOSPC 28 /* No space left on device */ -#define XESPIPE 29 /* Illegal seek */ -#define XEROFS 30 /* Read-only file system */ -#define XEMLINK 31 /* Too many links */ -#define XEPIPE 32 /* Broken pipe */ - -/* math software */ -#define XEDOM 33 /* Argument too large */ -#define XERANGE 34 /* Result too large */ - -/* non-blocking and interrupt i/o */ -#define XEWOULDBLOCK 35 /* Operation would block */ -#define XEINPROGRESS 36 /* Operation now in progress */ -#define XEALREADY 37 /* Operation already in progress */ -/* ipc/network software */ - - /* argument errors */ -#define XENOTSOCK 38 /* Socket operation on non-socket */ -#define XEDESTADDRREQ 39 /* Destination address required */ -#define XEMSGSIZE 40 /* Message too long */ -#define XEPROTOTYPE 41 /* Protocol wrong type for socket */ -#define XENOPROTOOPT 42 /* Protocol not available */ -#define XEPROTONOSUPPORT 43 /* Protocol not supported */ -#define XESOCKTNOSUPPORT 44 /* Socket type not supported */ -#define XEOPNOTSUPP 45 /* Operation not supported on socket */ -#define XEPFNOSUPPORT 46 /* Protocol family not supported */ -#define XEAFNOSUPPORT 47 /* Address family not supported by protocol family */ -#define XEADDRINUSE 48 /* Address already in use */ -#define XEADDRNOTAVAIL 49 /* Can't assign requested address */ - - /* operational errors */ -#define XENETDOWN 50 /* Network is down */ -#define XENETUNREACH 51 /* Network is unreachable */ -#define XENETRESET 52 /* Network dropped connection on reset */ -#define XECONNABORTED 53 /* Software caused connection abort */ -#define XECONNRESET 54 /* Connection reset by peer */ -#define XENOBUFS 55 /* No buffer space available */ -#define XEISCONN 56 /* Socket is already connected */ -#define XENOTCONN 57 /* Socket is not connected */ -#define XESHUTDOWN 58 /* Can't send after socket shutdown */ -#define XETOOMANYREFS 59 /* Too many references: can't splice */ -#define XETIMEDOUT 60 /* Connection timed out */ -#define XECONNREFUSED 61 /* Connection refused */ - - /* */ -#define XELOOP 62 /* Too many levels of symbolic links */ -#define XENAMETOOLONG 63 /* File name too long */ - -/* should be rearranged */ -#define XEHOSTDOWN 64 /* Host is down */ -#define XEHOSTUNREACH 65 /* No route to host */ -#define XENOTEMPTY 66 /* Directory not empty */ - -/* quotas & mush */ -#define XEPROCLIM 67 /* Too many processes */ -#define XEUSERS 68 /* Too many users */ -#define XEDQUOT 69 /* Disc quota exceeded */ - -/* Network File System */ -#define XESTALE 70 /* Stale NFS file handle */ -#define XEREMOTE 71 /* Too many levels of remote in path */ - -/* streams */ -#define XENOSTR 72 /* Device is not a stream */ -#define XETIME 73 /* Timer expired */ -#define XENOSR 74 /* Out of streams resources */ -#define XENOMSG 75 /* No message of desired type */ -#define XEBADMSG 76 /* Trying to read unreadable message */ - -/* SystemV IPC */ -#define XEIDRM 77 /* Identifier removed */ - -/* SystemV Record Locking */ -#define XEDEADLK 78 /* Deadlock condition. */ -#define XENOLCK 79 /* No record locks available. */ - -/* POSIX */ -#define XENOSYS 90 /* function not implemented */ - - -void maperror() -{ - extern int errno; - - if (errno == 0) - return; - - switch (errno) { - case ENOMSG: - errno = XENOMSG; /* No message of desired type */ - break; - case EIDRM: - errno = XEIDRM; /* Identifier removed */ - break; - case EDEADLK: - errno = XEDEADLK; /* Deadlock condition. */ - break; - case ENOLCK: - errno = XENOLCK; /* No record locks available. */ - break; - case ENOSTR: - errno = XENOSTR; /* Device not a stream */ - break; - case ETIME: - errno = XETIME; /* timer expired */ - break; - case ENOSR: - errno = XENOSR; /* out of streams resources */ - break; - case EBADMSG: - errno = XEBADMSG; /* trying to read unreadable message */ - break; - case ENOSYS: - errno = XENOSYS; /* Unsupported file system operation */ - break; - case ELOOP: - errno = XELOOP; /* Symbolic link loop */ - break; - case ERESTART: - errno = XEINTR; /* Convert ERESTART to EINTR for - interrupted system calls */ - break; - case ENAMETOOLONG: - errno = XENAMETOOLONG; /* File name too long */ - break; - case ENOTEMPTY: - errno = XENOTEMPTY; /* directory not empty */ - break; - case EUSERS: - errno = XEUSERS; /* Too many users (for UFS) */ - break; - case ENOTSOCK: - errno = XENOTSOCK; /* Socket operation on non-socket */ - break; - case EDESTADDRREQ: - errno = XEDESTADDRREQ; /* Destination address required */ - break; - case EMSGSIZE: - errno = XEMSGSIZE; /* Message too long */ - break; - case EPROTOTYPE: - errno = XEPROTOTYPE; /* Protocol wrong type for socket */ - break; - case ENOPROTOOPT: - errno = XENOPROTOOPT; /* Protocol not available */ - break; - case EPROTONOSUPPORT: - errno = XEPROTONOSUPPORT; /* Protocol not supported */ - break; - case ESOCKTNOSUPPORT: - errno = XESOCKTNOSUPPORT; /* Socket type not supported */ - break; - case EOPNOTSUPP: - errno = XEOPNOTSUPP; /* Operation not supported on socket */ - break; - case EPFNOSUPPORT: - errno = XEPFNOSUPPORT; /* Protocol family not supported */ - break; - case EAFNOSUPPORT: - errno = XEAFNOSUPPORT; /* Address family not supported by */ - break; - case EADDRINUSE: - errno = XEADDRINUSE; /* Address already in use */ - break; - case EADDRNOTAVAIL: - errno = XEADDRNOTAVAIL; /* Can't assign requested address */ - break; - case ENETDOWN: - errno = XENETDOWN; /* Network is down */ - break; - case ENETUNREACH: - errno = XENETUNREACH; /* Network is unreachable */ - break; - case ENETRESET: - errno = XENETRESET; /* Dropped connection due to reset */ - break; - case ECONNABORTED: - errno = XECONNABORTED; /* Software caused connection abort */ - break; - case ECONNRESET: - errno = XECONNRESET; /* Connection reset by peer */ - break; - case ENOBUFS: - errno = XENOBUFS; /* No buffer space available */ - break; - case EISCONN: - errno = XEISCONN; /* Socket is already connected */ - break; - case ENOTCONN: - errno = XENOTCONN; /* Socket is not connected */ - break; - case ESHUTDOWN: - errno = XESHUTDOWN; /* Can't send after socket shutdown */ - break; - case ETOOMANYREFS: - errno = XETOOMANYREFS; /* Too many references: can't splice */ - break; - case ETIMEDOUT: - errno = XETIMEDOUT; /* Connection timed out */ - break; - case ECONNREFUSED: - errno = XECONNREFUSED; /* Connection refused */ - break; - case EHOSTDOWN: - errno = XEHOSTDOWN; /* Host is down */ - break; - case EHOSTUNREACH: - errno = XEHOSTUNREACH; /* No route to host */ - break; - case EALREADY: - errno = XEALREADY; - break; - case EINPROGRESS: - errno = XEINPROGRESS; - break; - case ESTALE: - errno = XESTALE; /* Stale NFS file handle */ - break; - case EDQUOT: - errno = XEDQUOT; /* Disc quota exceeded */ - break; - default: - break; - } - - return; - -} diff --git a/usr/src/lib/libbc/libc/sys/common/mincore.c b/usr/src/lib/libbc/libc/sys/common/mincore.c deleted file mode 100644 index 61cacd144c..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/mincore.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* mincore.c SMI 12/14/90 */ -#include <errno.h> -#include <sys/syscall.h> -#include <sys/types.h> -#include <unistd.h> - -#define INCORE 1; /* return only the incore status bit */ - -int -mincore(caddr_t addr, int len, char *vec) -{ - int i; - - if (len < 0) { - errno = EINVAL; - return (-1); - } - - if (_syscall(SYS_mincore, addr, len, vec) == 0) { - len /= getpagesize(); - for (i = 0; i < len; i++) { - vec[i] &= INCORE; - } - } -} diff --git a/usr/src/lib/libbc/libc/sys/common/msgsys.c b/usr/src/lib/libbc/libc/sys/common/msgsys.c deleted file mode 100644 index de9f1c5f18..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/msgsys.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/syscall.h> -#include <stdarg.h> -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/msg.h> - - -/* msgsys dispatch argument */ -#define MSGGET 0 -#define MSGCTL 1 -#define MSGRCV 2 -#define MSGSND 3 - -int -msgget(key_t key, int msgflg) -{ - return (_syscall(SYS_msgsys, MSGGET, key, msgflg)); -} - -int -msgctl(int msqid, int cmd, struct msqid_ds *buf) -{ - return (_syscall(SYS_msgsys, MSGCTL, msqid, cmd, buf)); -} - -int -msgrcv(int msqid, struct msgbuf *msgp, int msgsz, long msgtyp, int msgflg) -{ - return (_syscall(SYS_msgsys, MSGRCV, - msqid, msgp, msgsz, msgtyp, msgflg)); -} - -int -msgsnd(int msqid, struct msgbuf *msgp, int msgsz, int msgflg) -{ - return (_syscall(SYS_msgsys, MSGSND, - msqid, msgp, msgsz, msgflg)); -} - -int -msgsys(int sysnum, ...) -{ - va_list ap; - key_t key; - int msgflg; - int msgflag; - int msqid, cmd; - struct msqid_ds *buf; - struct msgbuf *msgp; - int msgsz; - long msgtyp; - - va_start(ap, sysnum); - switch (sysnum) { - case MSGGET: - key = va_arg(ap, key_t); - msgflag = va_arg(ap, int); - va_end(ap); - return (msgget(key, msgflag)); - case MSGCTL: - msqid = va_arg(ap, int); - cmd = va_arg(ap, int); - buf = va_arg(ap, struct msqid_ds *); - va_end(ap); - return (msgctl(msqid, cmd, buf)); - case MSGRCV: - msqid = va_arg(ap, int); - msgp = va_arg(ap, struct msgbuf *); - msgsz = va_arg(ap, int); - msgtyp = va_arg(ap, long); - msgflg = va_arg(ap, int); - va_end(ap); - return (msgrcv(msqid, msgp, msgsz, msgtyp, msgflg)); - case MSGSND: - msqid = va_arg(ap, int); - msgp = va_arg(ap, struct msgbuf *); - msgsz = va_arg(ap, int); - msgflg = va_arg(ap, int); - va_end(ap); - return (msgsnd(msqid, msgp, msgsz, msgflg)); - } - va_end(ap); - return (-1); -} diff --git a/usr/src/lib/libbc/libc/sys/common/recv.c b/usr/src/lib/libbc/libc/sys/common/recv.c deleted file mode 100644 index 3c8d9c35ee..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/recv.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/errno.h> - -extern int errno; - -#define N_AGAIN 11 - -int recv(s, buf, len, flags) -int s; -char *buf; -int len, flags; -{ - int a; - if ((a = _recv(s, buf, len, flags)) == -1) { - if (errno == N_AGAIN) - errno = EWOULDBLOCK; - else - maperror(errno); - } - return(a); -} - - -int recvfrom(s, buf, len, flags, from, fromlen) -int s; -char *buf; -int len, flags; -struct sockaddr *from; -int *fromlen; -{ - int a; - if ((a = _recvfrom(s, buf, len, flags, from, fromlen)) == -1) { - if (errno == N_AGAIN) - errno = EWOULDBLOCK; - else - maperror(errno); - } - return(a); -} - - -int recvmsg(s, msg, flags) -int s; -struct msghdr *msg; -int flags; -{ - int a; - if ((a = _recvmsg(s, msg, flags)) == -1) { - if (errno == N_AGAIN) - errno = EWOULDBLOCK; - else - maperror(errno); - } - return(a); -} - - diff --git a/usr/src/lib/libbc/libc/sys/common/rlimit.c b/usr/src/lib/libbc/libc/sys/common/rlimit.c deleted file mode 100644 index 4cf918416b..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/rlimit.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/time.h> -#include <sys/resource.h> -#include <sys/syscall.h> - - -/* - * The following are the resource values for SVR4. - * The resource values are mapped to SVR4 values - * before invoking the system calls. - */ -int rlim_res[RLIM_NLIMITS] = {0, 1, 2, 3, 4, -1, 5}; - -int getrlimit(resource, rlp) -int resource; -struct rlimit *rlp; -{ - return(bc_getrlimit(resource, rlp)); -} - -int bc_getrlimit(resource, rlp) -int resource; -struct rlimit *rlp; -{ - return(_syscall(SYS_getrlimit, rlim_res[resource], rlp)); -} - -int setrlimit(resource, rlp) -int resource; -struct rlimit *rlp; -{ - return(bc_setrlimit(resource, rlp)); -} - -int bc_setrlimit(resource, rlp) -int resource; -struct rlimit *rlp; -{ - return(_syscall(SYS_setrlimit, rlim_res[resource], rlp)); -} diff --git a/usr/src/lib/libbc/libc/sys/common/s5dkio.h b/usr/src/lib/libbc/libc/sys/common/s5dkio.h deleted file mode 100644 index b887e32b5e..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/s5dkio.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS5_DKIO_H -#define _SYS5_DKIO_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Structures and definitions for disk io control commands - */ - -/* - * Structures used as data by ioctl calls. - */ - -/* - * Used for controller info - */ -struct s5_dk_cinfo { - char dki_cname[DK_DEVLEN]; /* controller name (no unit #) */ - short dki_ctype; /* controller type */ - short dki_flags; /* flags */ - short dki_cnum; /* controller number */ - int dki_addr; /* controller address */ - int dki_space; /* controller bus type */ - int dki_prio; /* interrupt priority */ - int dki_vec; /* interrupt vector */ - char dki_dname[DK_DEVLEN]; /* drive name (no unit #) */ - int dki_unit; /* unit number */ - int dki_slave; /* slave number */ - short dki_partition; /* partition number */ - short dki_maxtransfer; /* max. transfer size in DEV_BSIZE */ -}; - - -/* - * Disk io control commands - * Warning: some other ioctls with the DIOC prefix exist elsewhere. - */ -#define S5DKIOC (0x04 << 8) -#define S5DKIOCGGEOM (S5DKIOC|1) /* Get geometry */ -#define S5DKIOCSGEOM (S5DKIOC|2) /* Set geometry */ -#define S5DKIOCINFO (S5DKIOC|3) /* Get info */ -#define S5DKIOCSAPART (S5DKIOC|4) /* Set all partitions */ -#define S5DKIOCGAPART (S5DKIOC|5) /* Get all partitions */ - -/* - * These from hdio.h - */ -#define S5HDKIOC (0x04 << 8) -#define S5HDKIOCSTYPE (S5HDKIOC|101) /* Set drive info */ -#define S5HDKIOCGTYPE (S5HDKIOC|102) /* Get drive info */ -#define S5HDKIOCSBAD (S5HDKIOC|103) /* Set bad sector map */ -#define S5HDKIOCGBAD (S5HDKIOC|104) /* Get bad sector map */ -#define S5HDKIOCSCMD (S5HDKIOC|105) /* Set generic cmd */ -#define S5HDKIOCGDIAG (S5HDKIOC|106) /* Get diagnostics */ - -/* - * These are from cdio.h - * CDROM io control commands - */ -#define S5CDIOC (0x04 << 8) -#define S5CDROMPAUSE (S5CDIOC|151) /* Pause Audio Operation */ -#define S5CDROMRESUME (S5CDIOC|152) /* Resume paused Audio Operation */ -#define S5CDROMPLAYMSF (S5CDIOC|153) /* Play Audio MSF */ -#define S5CDROMPLAYTRKIND (S5CDIOC|154) /* Play Audio Track/index */ -#define S5CDROMREADTOCHDR (S5CDIOC|155) /* Read TOC header */ -#define S5CDROMREADTOCENTRY (S5CDIOC|156) /* Read a TOC entry */ -#define S5CDROMSTOP (S5CDIOC|157) /* Stop the CDrom drive */ -#define S5CDROMSTART (S5CDIOC|158) /* Start the CDrom drive */ -#define S5CDROMEJECT (S5CDIOC|159) /* Ejects the CDrom caddy */ -#define S5CDROMVOLCTRL (S5CDIOC|160) /* control output volume */ -#define S5CDROMSUBCHNL (S5CDIOC|161) /* read the subchannel data */ -#define S5CDROMREADMODE2 (S5CDIOC|162) /* read CDROM mode 2 data */ -#define S5CDROMREADMODE1 (S5CDIOC|163) /* read CDROM mode 1 data */ - -/* - * From sys/scsi/impl/uscsi.h - */ -/* - * definition for user-scsi command structure - */ -struct s5_uscsi_cmd { - int uscsi_flags; /* read, write, etc. see below */ - short uscsi_status; /* resulting status */ - short uscsi_timeout; /* Command Timeout */ - caddr_t uscsi_cdb; /* cdb to send to target */ - caddr_t uscsi_bufaddr; /* i/o source/destination */ - u_int uscsi_buflen; /* size of i/o to take place */ - u_int uscsi_resid; /* resid from i/o operation */ - u_char uscsi_cdblen; /* # of valid cdb bytes */ - u_char uscsi_reserved_1; /* Reserved for Future Use */ - u_char uscsi_reserved_2; /* Reserved for Future Use */ - u_char uscsi_reserved_3; /* Reserved for Future Use */ - caddr_t uscsi_reserved_4; /* Reserved for Future Use */ - void *uscsi_reserved_5; /* Reserved for Future Use */ -}; - -/* - * User SCSI io control command - */ -#define S5USCSIIOC (0x04 << 8) -#define S5USCSICMD (S5USCSIIOC|201) /* user scsi command */ - -#ifdef __cplusplus -} -#endif - -#endif /* _SYS5_DKIO_H */ diff --git a/usr/src/lib/libbc/libc/sys/common/s5errno.h b/usr/src/lib/libbc/libc/sys/common/s5errno.h deleted file mode 100644 index 0f657eb413..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/s5errno.h +++ /dev/null @@ -1,192 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -/* - * Portions of this source code were derived from Berkeley 4.3 BSD - * under license from the Regents of the University of California. - */ - -#ifndef _SYS_ERRNO_H -#define _SYS_ERRNO_H - -#ident "%Z%%M% %I% %E% SMI" - -/* - * Error codes - */ - -#define EPERM 1 /* Not super-user */ -#define ENOENT 2 /* No such file or directory */ -#define ESRCH 3 /* No such process */ -#define EINTR 4 /* interrupted system call */ -#define EIO 5 /* I/O error */ -#define ENXIO 6 /* No such device or address */ -#define E2BIG 7 /* Arg list too long */ -#define ENOEXEC 8 /* Exec format error */ -#define EBADF 9 /* Bad file number */ -#define ECHILD 10 /* No children */ -#define EAGAIN 11 /* No more processes */ -#define ENOMEM 12 /* Not enough core */ -#define EACCES 13 /* Permission denied */ -#define EFAULT 14 /* Bad address */ -#define ENOTBLK 15 /* Block device required */ -#define EBUSY 16 /* Mount device busy */ -#define EEXIST 17 /* File exists */ -#define EXDEV 18 /* Cross-device link */ -#define ENODEV 19 /* No such device */ -#define ENOTDIR 20 /* Not a directory */ -#define EISDIR 21 /* Is a directory */ -#define EINVAL 22 /* Invalid argument */ -#define ENFILE 23 /* File table overflow */ -#define EMFILE 24 /* Too many open files */ -#define ENOTTY 25 /* Not a typewriter */ -#define ETXTBSY 26 /* Text file busy */ -#define EFBIG 27 /* File too large */ -#define ENOSPC 28 /* No space left on device */ -#define ESPIPE 29 /* Illegal seek */ -#define EROFS 30 /* Read only file system */ -#define EMLINK 31 /* Too many links */ -#define EPIPE 32 /* Broken pipe */ -#define EDOM 33 /* Math arg out of domain of func */ -#define ERANGE 34 /* Math result not representable */ -#define ENOMSG 35 /* No message of desired type */ -#define EIDRM 36 /* Identifier removed */ -#define ECHRNG 37 /* Channel number out of range */ -#define EL2NSYNC 38 /* Level 2 not synchronized */ -#define EL3HLT 39 /* Level 3 halted */ -#define EL3RST 40 /* Level 3 reset */ -#define ELNRNG 41 /* Link number out of range */ -#define EUNATCH 42 /* Protocol driver not attached */ -#define ENOCSI 43 /* No CSI structure available */ -#define EL2HLT 44 /* Level 2 halted */ -#define EDEADLK 45 /* Deadlock condition. */ -#define ENOLCK 46 /* No record locks available. */ - -/* Filesystem Quotas */ -#define EDQUOT 49 /* Disc quota exceeded */ - -/* Convergent Error Returns */ -#define EBADE 50 /* invalid exchange */ -#define EBADR 51 /* invalid request descriptor */ -#define EXFULL 52 /* exchange full */ -#define ENOANO 53 /* no anode */ -#define EBADRQC 54 /* invalid request code */ -#define EBADSLT 55 /* invalid slot */ -#define EDEADLOCK 56 /* file locking deadlock error */ - -#define EBFONT 57 /* bad font file fmt */ - -/* stream problems */ -#define ENOSTR 60 /* Device not a stream */ -#define ENODATA 61 /* no data (for no delay io) */ -#define ETIME 62 /* timer expired */ -#define ENOSR 63 /* out of streams resources */ - -#define ENONET 64 /* Machine is not on the network */ -#define ENOPKG 65 /* Package not installed */ -#define EREMOTE 66 /* The object is remote */ -#define ENOLINK 67 /* the link has been severed */ -#define EADV 68 /* advertise error */ -#define ESRMNT 69 /* srmount error */ - -#define ECOMM 70 /* Communication error on send */ -#define EPROTO 71 /* Protocol error */ -#define EMULTIHOP 74 /* multihop attempted */ -#define EBADMSG 77 /* trying to read unreadable message */ -#define ENAMETOOLONG 78 /* path name is too long */ -#define EOVERFLOW 79 /* value too large to be stored in data type */ -#define ENOTUNIQ 80 /* given log. name not unique */ -#define EBADFD 81 /* f.d. invalid for this operation */ -#define EREMCHG 82 /* Remote address changed */ - -/* shared library problems */ -#define ELIBACC 83 /* Can't access a needed shared lib. */ -#define ELIBBAD 84 /* Accessing a corrupted shared lib. */ -#define ELIBSCN 85 /* .lib section in a.out corrupted. */ -#define ELIBMAX 86 /* Attempting to link in too many libs. */ -#define ELIBEXEC 87 /* Attempting to exec a shared library. */ -#define EILSEQ 88 /* Illegal byte sequence. */ -#define ENOSYS 89 /* Unsupported file system operation */ -#define ELOOP 90 /* Symbolic link loop */ -#define ERESTART 91 /* Restartable system call */ -#define ESTRPIPE 92 /* if pipe/FIFO, don't sleep in stream head */ -#define ENOTEMPTY 93 /* directory not empty */ -#define EUSERS 94 /* Too many users (for UFS) */ - -/* BSD Networking Software */ - /* argument errors */ -#define ENOTSOCK 95 /* Socket operation on non-socket */ -#define EDESTADDRREQ 96 /* Destination address required */ -#define EMSGSIZE 97 /* Message too long */ -#define EPROTOTYPE 98 /* Protocol wrong type for socket */ -#define ENOPROTOOPT 99 /* Protocol not available */ -#define EPROTONOSUPPORT 120 /* Protocol not supported */ -#define ESOCKTNOSUPPORT 121 /* Socket type not supported */ -#define EOPNOTSUPP 122 /* Operation not supported on socket */ -#define EPFNOSUPPORT 123 /* Protocol family not supported */ -#define EAFNOSUPPORT 124 /* Address family not supported by - protocol family */ -#define EADDRINUSE 125 /* Address already in use */ -#define EADDRNOTAVAIL 126 /* Can't assign requested address */ - /* operational errors */ -#define ENETDOWN 127 /* Network is down */ -#define ENETUNREACH 128 /* Network is unreachable */ -#define ENETRESET 129 /* Network dropped connection because - of reset */ -#define ECONNABORTED 130 /* Software caused connection abort */ -#define ECONNRESET 131 /* Connection reset by peer */ -#define ENOBUFS 132 /* No buffer space available */ -#define EISCONN 133 /* Socket is already connected */ -#define ENOTCONN 134 /* Socket is not connected */ -/* XENIX has 135 - 142 */ -#define ESHUTDOWN 143 /* Can't send after socket shutdown */ -#define ETOOMANYREFS 144 /* Too many references: can't splice */ -#define ETIMEDOUT 145 /* Connection timed out */ -#define ECONNREFUSED 146 /* Connection refused */ -#define EHOSTDOWN 147 /* Host is down */ -#define EHOSTUNREACH 148 /* No route to host */ -#define EWOULDBLOCK EAGAIN -#define EALREADY 149 /* operation already in progress */ -#define EINPROGRESS 150 /* operation now in progress */ - -/* SUN Network File System */ -#define ESTALE 151 /* Stale NFS file handle */ - -#ifdef XENIX_MERGE -/* XENIX error numbers */ -#define EUCLEAN 135 /* Structure needs cleaning */ -#define ENOTNAM 137 /* Not a XENIX named type file */ -#define ENAVAIL 138 /* No XENIX semaphores available */ -#define EISNAM 139 /* Is a named type file */ -#define EREMOTEIO 140 /* Remote I/O error */ -#define EINIT 141 /* Reserved for future */ -#define EREMDEV 142 /* Error 142 */ -#endif /* XENIX_MERGE */ - -#endif /* _SYS_ERRNO_H */ diff --git a/usr/src/lib/libbc/libc/sys/common/s5fdio.h b/usr/src/lib/libbc/libc/sys/common/s5fdio.h deleted file mode 100644 index e20e1f84e2..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/s5fdio.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1991 by Sun Microsystems, Inc. - */ - -#ifndef _SYS5_FDIO_H -#define _SYS5_FDIO_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Disk io control commands - */ -#define S5FDIOC (0x04 << 8) -#define S5FDIOGCHAR (S5FDIOC|51) /* GetCharacteristics */ -#define S5FDIOSCHAR (S5FDIOC|52) /* SetCharacteristics */ -#define S5FDEJECT (S5FDIOC|53) /* Eject floppy disk */ -#define S5FDGETCHANGE (S5FDIOC|54) /* Get diskchng stat */ -#define S5FDGETDRIVECHAR (S5FDIOC|55) /* Get drivechar */ -#define S5FDSETDRIVECHAR (S5FDIOC|56) /* Set drivechar */ -#define S5FDGETSEARCH (S5FDIOC|57) /* Get search tbl */ -#define S5FDSETSEARCH (S5FDIOC|58) /* Set search tbl */ -#define S5FDIOCMD (S5FDIOC|59) /* Floppy command */ -#define S5FDRAW (S5FDIOC|70) /* ECDstyle genericcmd*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _SYS5_FDIO_H */ diff --git a/usr/src/lib/libbc/libc/sys/common/s5sysmacros.h b/usr/src/lib/libbc/libc/sys/common/s5sysmacros.h deleted file mode 100644 index 3e59830f32..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/s5sysmacros.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1993 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#define L_BITSMAJOR 14 /* # of SVR4 major device bits */ -#define L_BITSMINOR 18 /* # of SVR4 minor device bits */ -#define L_MAXMIN 0x3ffff /* MAX minor for 3b2 software drivers. - ** For 3b2 hardware devices the minor is - ** restricted to 256 (0-255) - */ -#define O_BITSMINOR 8 /* # of SunOS 4.x minor device bits */ -#define O_MAXMAJ 0xff /* SunOS 4.x max major value */ -#define O_MAXMIN 0xff /* SunOS 4.x max minor value */ - -/* convert to old dev format */ - -#define cmpdev(x) (unsigned long)((((x)>>L_BITSMINOR) > O_MAXMAJ || \ - ((x)&L_MAXMIN) > O_MAXMIN) ? NODEV : \ - ((((x)>>L_BITSMINOR)<<O_BITSMINOR)|((x)&O_MAXMIN))) diff --git a/usr/src/lib/libbc/libc/sys/common/semsys.c b/usr/src/lib/libbc/libc/sys/common/semsys.c deleted file mode 100644 index 5b3a4d84df..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/semsys.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/syscall.h> -#include <stdarg.h> -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/sem.h> - -/* semsys dispatch argument */ -#define SEMCTL 0 -#define SEMGET 1 -#define SEMOP 2 - -int -semctl(int semid, int semnum, int cmd, union semun *arg) -{ - switch (cmd) { - - case IPC_STAT: - case IPC_SET: - cmd += 10; - /* fall-through */ - case SETVAL: - case GETALL: - case SETALL: - return (_syscall(SYS_semsys, SEMCTL, - semid, semnum, cmd, arg->val)); - - case IPC_RMID: - cmd += 10; - /* fall-through */ - default: - return (_syscall(SYS_semsys, SEMCTL, - semid, semnum, cmd, 0)); - } -} - -int -semget(key_t key, int nsems, int semflg) -{ - return (_syscall(SYS_semsys, SEMGET, key, nsems, semflg)); -} - -int -semop(int semid, struct sembuf *sops, int nsops) -{ - return (_syscall(SYS_semsys, SEMOP, semid, sops, nsops)); -} - -int -semsys(int sysnum, ...) -{ - va_list ap; - int semid, cmd; - int semnum, val; - union semun arg; - key_t key; - int nsems, semflg; - struct sembuf *sops; - int nsops; - - va_start(ap, sysnum); - switch (sysnum) { - case SEMCTL: - semid = va_arg(ap, int); - semnum = va_arg(ap, int); - cmd = va_arg(ap, int); - val = va_arg(ap, int); - if ((cmd == IPC_STAT) || (cmd == IPC_SET) || (cmd == IPC_RMID)) - cmd += 10; - va_end(ap); - return (_syscall(SYS_semsys, SEMCTL, semid, semnum, cmd, val)); - case SEMGET: - key = va_arg(ap, key_t); - nsems = va_arg(ap, int); - semflg = va_arg(ap, int); - va_end(ap); - return (semget(key, nsems, semflg)); - case SEMOP: - semid = va_arg(ap, int); - sops = va_arg(ap, struct sembuf *); - nsops = va_arg(ap, int); - va_end(ap); - return (semop(semid, sops, nsops)); - } - va_end(ap); - return (-1); -} diff --git a/usr/src/lib/libbc/libc/sys/common/send.c b/usr/src/lib/libbc/libc/sys/common/send.c deleted file mode 100644 index 371935f87a..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/send.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1990-1997 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/errno.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <sys/syslog.h> -#include <sys/strlog.h> -#include <sys/stropts.h> -#include <stdio.h> - -extern int errno; - -#define N_AGAIN 11 - -int -send(s, msg, len, flags) - int s; - char *msg; - int len, flags; -{ - int a; - if ((a = _send(s, msg, len, flags)) == -1) { - if (errno == N_AGAIN) - errno = EWOULDBLOCK; - else - maperror(); - } - return (a); -} - - -/* Added to convert socket "/dev/log" to stream "/dev/conslog" */ -#define logname "/dev/conslog" -#define MAXLINE 1024 -#define SVR4_ENOTSOCK 95 /* Socket operation on non-socket */ - - -int -sendto(s, msg, len, flags, to, tolen) - int s; - char *msg; - int len, flags; - struct sockaddr *to; - int tolen; -{ - int a; - static int LogDev = -1; - /* check for logfile */ - - if ((a = _sendto(s, msg, len, flags, to, tolen)) == -1) { - if (errno == SVR4_ENOTSOCK && - strcmp(to->sa_data, "/dev/log") == 0) { - char *msg_p; - struct log_ctl hdr; - struct strbuf dat; - struct strbuf ctl; - struct stat sbuf; - if (LogDev == -1) { - int tfd; - /* close socket /dev/log */ - close(s); - /* open stream /dev/conslog */ - tfd = open(logname, O_WRONLY); - if (tfd == -1) - return (-1); - /* insure stream has same fd as closed socket */ - if (tfd != s) { - if (dup2(tfd, s) < 0) { - close(tfd); - return (-1); - } - close(tfd); - } - if (fcntl(s, F_SETFD, FD_CLOEXEC) == -1) - return (-1); - if (fstat(s, &sbuf) != -1) - LogDev = sbuf.st_rdev; - - } else if (fstat(s, &sbuf) == -1 || - LogDev != sbuf.st_rdev) - return (-1); - - /* build the header */ - - /* parse <pri> from msg */ - - hdr.mid = 1; /* 0 for kernal */ - /* sid, ltime, ttime, seq_no not used */ - - hdr.pri = strtol(msg + 1, &msg_p, 10); - if (msg + 1 == msg_p) { - hdr.pri = (LOG_USER|LOG_INFO); - } else { - len -= msg_p - msg; - msg = msg_p + 1; - } - hdr.flags = SL_CONSOLE; - hdr.level = 0; - - ctl.maxlen = sizeof (struct log_ctl); - ctl.len = sizeof (struct log_ctl); - ctl.buf = (caddr_t)&hdr; - dat.maxlen = MAXLINE; - dat.len = len; - if (dat.len > MAXLINE) { - dat.len = MAXLINE; - msg[MAXLINE - 1] = '\0'; - } - dat.buf = msg; - - /* output the message to the local logger */ - if (_putmsg(s, &ctl, &dat, 0) == 0) - return (0); - } - if (errno == N_AGAIN) - errno = EWOULDBLOCK; - else - maperror(); - } - return (a); -} - - -int -sendmsg(s, msg, flags) - int s; - struct msghdr *msg; - int flags; -{ - int a; - if ((a = _sendmsg(s, msg, flags)) == -1) { - if (errno == N_AGAIN) - errno = EWOULDBLOCK; - else - maperror(); - } - return (a); -} diff --git a/usr/src/lib/libbc/libc/sys/common/setegid.c b/usr/src/lib/libbc/libc/sys/common/setegid.c deleted file mode 100644 index 9b570a34f7..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/setegid.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1995, by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -int -setegid(int egid) -{ - return (setregid(-1, egid)); -} diff --git a/usr/src/lib/libbc/libc/sys/common/seteuid.c b/usr/src/lib/libbc/libc/sys/common/seteuid.c deleted file mode 100644 index 802f054e2f..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/seteuid.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1995, by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -int -seteuid(int euid) -{ - return (setreuid(-1, euid)); -} diff --git a/usr/src/lib/libbc/libc/sys/common/setregid.c b/usr/src/lib/libbc/libc/sys/common/setregid.c deleted file mode 100644 index f1d8f04340..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/setregid.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1995, by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <errno.h> - -int -setregid(int gid, int egid) -{ - if (gid > 0xffff || egid > 0xffff) { - errno = EINVAL; - return (-1); - } - return (_setregid(gid, egid)); -} diff --git a/usr/src/lib/libbc/libc/sys/common/setreuid.c b/usr/src/lib/libbc/libc/sys/common/setreuid.c deleted file mode 100644 index 1e2c448d26..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/setreuid.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1995, by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <errno.h> - -int -setreuid(int uid, int euid) -{ - if (uid > 0xffff || euid > 0xffff) { - errno = EINVAL; - return (-1); - } - return (_setreuid(uid, euid)); -} diff --git a/usr/src/lib/libbc/libc/sys/common/setsid.c b/usr/src/lib/libbc/libc/sys/common/setsid.c deleted file mode 100644 index 70b37ef596..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/setsid.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1993 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <errno.h> - - -static int setsid_called = 0; -static int real_setsid_called=0; -static int setsid_val, setsid_errno; - - -/* setpgrp system call number, setsid command code */ -#define SYS_pgrpsys 39 -#define SYS_setsid 3 - -int -setsid(void) -{ - if (setsid_called != getpid()) { - setsid_called = getpid(); - return (bc_setsid()); - } else { - errno = EPERM; - return (-1); - } -} - - - -int -bc_setsid(void) -{ - if (real_setsid_called != getpid()) { - real_setsid_called = getpid(); - setsid_val = _syscall(SYS_pgrpsys, SYS_setsid); - setsid_errno = errno; - } - errno = setsid_errno; - return (setsid_val); -} diff --git a/usr/src/lib/libbc/libc/sys/common/setsockopt.c b/usr/src/lib/libbc/libc/sys/common/setsockopt.c deleted file mode 100644 index f9ee54a565..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/setsockopt.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <errno.h> - -/* multicast setsockopts */ -#define SUNOS4X_IP_MULTICAST_IF 2 -#define SUNOS4X_IP_MULTICAST_TTL 3 -#define SUNOS4X_IP_MULTICAST_LOOP 4 -#define SUNOS4X_IP_ADD_MEMBERSHIP 5 -#define SUNOS4X_IP_DROP_MEMBERSHIP 6 -#define SUNOS5X_IP_MULTICAST_IF 0x10 -#define SUNOS5X_IP_MULTICAST_TTL 0x11 -#define SUNOS5X_IP_MULTICAST_LOOP 0x12 -#define SUNOS5X_IP_ADD_MEMBERSHIP 0x13 -#define SUNOS5X_IP_DROP_MEMBERSHIP 0x14 - - -int -setsockopt(int s, int level, int optname, char *optval, int optlen) -{ - int a; - - if (level == SOL_SOCKET) - switch (optname) { - case SO_DONTLINGER: { - struct linger ling; - ling.l_onoff = 0; - if ((a = _setsockopt(s, level, SO_LINGER, &ling, - sizeof (struct linger))) == -1) - maperror(errno); - return (a); - } - - case SO_LINGER: - if (optlen == sizeof (int)) { - struct linger ling; - ling.l_onoff = 1; - ling.l_linger = (int)*optval; - if ((a = _setsockopt(s, level, SO_LINGER, &ling, - sizeof (struct linger))) == -1) - maperror(errno); - return (a); - } - case SO_DEBUG: - case SO_KEEPALIVE: - case SO_DONTROUTE: - case SO_USELOOPBACK: - case SO_REUSEADDR: - if (!optval) { - int val = 1; - if ((a = _setsockopt(s, level, optname, &val, - sizeof (int))) == -1) - maperror(errno); - return (a); - } - } - if (level == IPPROTO_IP) - switch (optname) { - case SUNOS4X_IP_MULTICAST_IF: - optname = SUNOS5X_IP_MULTICAST_IF; - break; - - case SUNOS4X_IP_MULTICAST_TTL: - optname = SUNOS5X_IP_MULTICAST_TTL; - break; - - case SUNOS4X_IP_MULTICAST_LOOP: - optname = SUNOS5X_IP_MULTICAST_LOOP; - break; - - case SUNOS4X_IP_ADD_MEMBERSHIP: - optname = SUNOS5X_IP_ADD_MEMBERSHIP; - break; - - case SUNOS4X_IP_DROP_MEMBERSHIP: - optname = SUNOS5X_IP_DROP_MEMBERSHIP; - break; - } - - if ((a = _setsockopt(s, level, optname, optval, optlen)) == -1) - maperror(errno); - return (a); -} diff --git a/usr/src/lib/libbc/libc/sys/common/shmsys.c b/usr/src/lib/libbc/libc/sys/common/shmsys.c deleted file mode 100644 index 2ae18dbe30..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/shmsys.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/syscall.h> -#include <stdarg.h> -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/shm.h> -#include <errno.h> - - -/* shmsys dispatch argument */ -#define SHMAT 0 -#define SHMCTL 1 -#define SHMDT 2 -#define SHMGET 3 - -struct shmid_sv { - struct ipc_perm shm_perm; - int shm_segsz; - struct anon_map *shm_amp; - unsigned short shm_lkcnt; - char pad[2]; - short shm_lpid; - short shm_cpid; - unsigned short shm_nattch; - unsigned short shm_cnattch; - time_t shm_atime; - time_t shm_dtime; - time_t shm_ctime; -}; - - -char * -shmat(int shmid, char *shmaddr, int shmflg) -{ - return ((char *)_syscall(SYS_shmsys, SHMAT, shmid, shmaddr, shmflg)); -} - -int -shmctl(int shmid, int cmd, struct shmid_ds *buf) -{ - struct shmid_sv n_buf; - int ret; - - if (buf == (struct shmid_ds *)-1) { - errno = EFAULT; - return (-1); - } - - if (buf == 0) { - ret = _syscall(SYS_shmsys, SHMCTL, shmid, cmd, 0); - } else { - n_buf.shm_perm = buf->shm_perm; - n_buf.shm_segsz = buf->shm_segsz; - n_buf.shm_amp = buf->shm_amp; - n_buf.shm_lpid = buf->shm_lpid; - n_buf.shm_cpid = buf->shm_cpid; - n_buf.shm_nattch = buf->shm_nattch; - n_buf.shm_atime = buf->shm_atime; - n_buf.shm_dtime = buf->shm_dtime; - n_buf.shm_ctime = buf->shm_ctime; - n_buf.shm_lkcnt = 0; - n_buf.shm_cnattch = 0; - - ret = _syscall(SYS_shmsys, SHMCTL, shmid, cmd, &n_buf); - - buf->shm_perm = n_buf.shm_perm; - buf->shm_segsz = n_buf.shm_segsz; - buf->shm_amp = n_buf.shm_amp; - buf->shm_lpid = n_buf.shm_lpid; - buf->shm_cpid = n_buf.shm_cpid; - buf->shm_nattch = n_buf.shm_nattch; - buf->shm_atime = n_buf.shm_atime; - buf->shm_dtime = n_buf.shm_dtime; - buf->shm_ctime = n_buf.shm_ctime; - } - - return (ret); -} - -int -shmdt(char *shmaddr) -{ - return (_syscall(SYS_shmsys, SHMDT, shmaddr)); -} - -int -shmget(key_t key, int size, int shmflg) -{ - return (_syscall(SYS_shmsys, SHMGET, key, size, shmflg)); -} - -int -shmsys(int sysnum, ...) -{ - va_list ap; - int shmid, shmflg, cmd, size; - char *shmaddr; - struct shmid_ds *buf; - key_t key; - - va_start(ap, sysnum); - switch (sysnum) { - case SHMAT: - shmid = va_arg(ap, int); - shmaddr = va_arg(ap, char *); - shmflg = va_arg(ap, int); - va_end(ap); - return ((int)shmat(shmid, shmaddr, shmflg)); - case SHMCTL: - shmid = va_arg(ap, int); - cmd = va_arg(ap, int); - buf = va_arg(ap, struct shmid_ds *); - va_end(ap); - return (shmctl(shmid, cmd, buf)); - case SHMDT: - shmaddr = va_arg(ap, char *); - va_end(ap); - return (shmdt(shmaddr)); - case SHMGET: - key = va_arg(ap, key_t); - size = va_arg(ap, int); - shmflg = va_arg(ap, int); - va_end(ap); - return (shmget(key, size, shmflg)); - } - va_end(ap); - return (-1); -} diff --git a/usr/src/lib/libbc/libc/sys/common/shutdown.c b/usr/src/lib/libbc/libc/sys/common/shutdown.c deleted file mode 100644 index 0ce818076c..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/shutdown.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/errno.h> -#include <sys/types.h> -#include <sys/socket.h> - -extern int errno; -#define N_ENOTCONN 134 - -int -shutdown(s, how) -register int s; -int how; -{ - int a; - if ((a = _shutdown(s, how)) == -1) { - if (errno == N_ENOTCONN) { - errno = 0; - a = 0; - } else - maperror(errno); - } - return(a); -} - - diff --git a/usr/src/lib/libbc/libc/sys/common/sigaction.c b/usr/src/lib/libbc/libc/sys/common/sigaction.c deleted file mode 100644 index 1b1ccccf10..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/sigaction.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <errno.h> -#include <signal.h> -#include "signalmap.h" - -static void signal_init(void); -#pragma init(signal_init) - -extern void (*handlers[])(); -extern void maphandler(int, int, struct sigcontext *, char *); -extern void (*_siguhandler[])(); /* libucb */ -extern void _sigvechandler(int, void*, void*); /* libucb */ - -extern int maptonewsig(); -extern int _sigaction(); -extern int maptonewmask(); -extern int maptooldmask(); -extern int _signal(); -extern int _sigprocmask(); -extern char *memset(); -extern int _sigpending(); - -typedef struct { - unsigned long __sigbits[4]; -} S5_sigset_t; - -typedef struct { - int sa_flags; - void (*sa_handler)(); - S5_sigset_t sa_mask; - int sa_resv[2]; -} S5_sigaction; - -#define S5_SA_ONSTACK 0x00000001 -#define S5_SA_RESETHAND 0x00000002 -#define S5_SA_RESTART 0x00000004 -#define S5_SA_NOCLDSTOP 0x00020000 - -int -sigaction(sig, act, oact) -int sig; -struct sigaction *act, *oact; -{ - S5_sigaction S5_act; - S5_sigaction S5_oact; - int ret; - int newsig; - void (*oldhand)(); - void (*oldsiguhand)(); - - newsig = maptonewsig(sig); - oldhand = handlers[newsig]; - oldsiguhand = _siguhandler[newsig]; - if (act == NULL) { - ret = _sigaction(newsig, (S5_sigaction *)NULL, &S5_oact); - } else { - S5_act.sa_flags = 0; - if (act->sa_flags & SA_ONSTACK) - S5_act.sa_flags |= S5_SA_ONSTACK; - if (act->sa_flags & SA_RESETHAND) - S5_act.sa_flags |= S5_SA_RESETHAND; - if (act->sa_flags & SA_NOCLDSTOP) - S5_act.sa_flags |= S5_SA_NOCLDSTOP; - if (!(act->sa_flags & SA_INTERRUPT)) - S5_act.sa_flags |= S5_SA_RESTART; - /* - * _sigvechandler() receives control from the OS. - * It calls through _siguhandler[] to maphandler(), - * which maps the signal number new-to-old, and - * calls the user's handler through handlers[]. - */ - handlers[newsig] = act->sa_handler; - _siguhandler[newsig] = maphandler; - if ((act->sa_handler == SIG_DFL) || - (act->sa_handler == SIG_IGN)) - S5_act.sa_handler = act->sa_handler; - else - S5_act.sa_handler = _sigvechandler; - S5_act.sa_mask.__sigbits[0] = maptonewmask(act->sa_mask); - S5_act.sa_mask.__sigbits[1] = 0; - S5_act.sa_mask.__sigbits[2] = 0; - S5_act.sa_mask.__sigbits[3] = 0; - - ret = _sigaction(newsig, &S5_act, &S5_oact); - } - - if ((oact != NULL) && (ret != -1)) { - oact->sa_flags = 0; - if (S5_oact.sa_flags & S5_SA_ONSTACK) - oact->sa_flags |= SA_ONSTACK; - if (S5_oact.sa_flags & S5_SA_RESETHAND) - oact->sa_flags |= SA_RESETHAND; - if (S5_oact.sa_flags & S5_SA_NOCLDSTOP) - oact->sa_flags |= SA_NOCLDSTOP; - if (!(S5_oact.sa_flags & S5_SA_RESTART)) - oact->sa_flags |= SA_INTERRUPT; - if ((S5_oact.sa_handler == SIG_DFL) || - (S5_oact.sa_handler == SIG_IGN)) - oact->sa_handler = S5_oact.sa_handler; - else - oact->sa_handler = oldhand; - oact->sa_mask = maptooldmask(S5_oact.sa_mask.__sigbits[0]); - } - if (ret == -1) { - handlers[newsig] = oldhand; - _siguhandler[newsig] = oldsiguhand; - } - return (ret); -} - -static void -signal_init() { -#define S5_SIGPOLL 22 - _signal(S5_SIGPOLL, SIG_IGN); -#undef S5_SIGPOLL -} - -int -sigprocmask(how, set, oset) -int how; -sigset_t *set, *oset; -{ - int how_map[] = {0, 1, 2, 0, 3}; - int ret; - S5_sigset_t s5_set, s5_oset; - - if (set == NULL) /* query */ - ret = _sigprocmask(how_map[how], NULL, &s5_oset); - else { - memset(&s5_set, 0, sizeof (S5_sigset_t)); - s5_set.__sigbits[0] = maptonewmask(*set); - ret = _sigprocmask(how_map[how], &s5_set, &s5_oset); - } - if ((oset != NULL) && (ret == 0)) - *oset = maptooldmask(s5_oset.__sigbits[0]); - return (ret); -} - -int -sigpending(set) -sigset_t *set; -{ - S5_sigset_t s5_set; - int ret; - - ret = _sigpending(&s5_set); - *set = maptooldmask(s5_set.__sigbits[0]); - return (ret); -} diff --git a/usr/src/lib/libbc/libc/sys/common/signalmap.c b/usr/src/lib/libbc/libc/sys/common/signalmap.c deleted file mode 100644 index 7642964fb0..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/signalmap.c +++ /dev/null @@ -1,314 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1996 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "signalmap.h" -#include <sys/signal.h> -#include <sys/errno.h> - -extern int errno; -void (*handlers[32])(); /* XXX - 32??? NSIG, maybe? */ - -void -maphandler(int sig, int code, struct sigcontext *scp, char *addr) -{ - switch (sig) { - case SIGBUS: - case SIGSEGV: - switch (FC_CODE(code)) { - case 3: /* 5.x value for FC_OBJERR */ - code = FC_MAKE_ERR(FC_ERRNO(code)); - break; - case 5: /* 5.x value for FC_NOMAP */ - code = FC_NOMAP; - break; - } - break; - } - __sendsig(maptooldsig(sig), code, scp, addr, handlers[sig]); -} - -void (* -signal(int sig, void (*a)(int)))(int) -{ - int newsig; - - struct sigvec osv, sv; - - sv.sv_handler = a; - sv.sv_mask = 0; -#ifdef S5EMUL - sv.sv_flags = SV_INTERRUPT|SV_RESETHAND; -#else - sv.sv_flags = 0; -#endif - if (sigvec(sig, &sv, &osv) < 0) - return (BADSIG); - return (osv.sv_handler); -} - - -int -sigvec(int sig, struct sigvec *nvec, struct sigvec *ovec) -{ - int newsig; - struct sigvec tvec, *tvecp; - void (*oldhand)(int); - - if ((int)nvec == -1 || (int)ovec == -1) { - errno = EFAULT; - return (-1); - } - - newsig = maptonewsig(sig); - oldhand = handlers[newsig]; - - if ((tvecp = nvec) != 0) { - tvec = *nvec; - tvecp = &tvec; - /* - * To be compatible with the behavior of SunOS 4.x: - * If the new signal handler is SIG_IGN or SIG_DFL, - * do not change the signal's entry in the handler array. - * This allows a child of vfork(2) to set signal handlers - * to SIG_IGN or SIG_DFL without affecting the parent. - */ - if (tvecp->sv_handler != SIG_DFL && - tvecp->sv_handler != SIG_IGN) { - handlers[newsig] = tvecp->sv_handler; - tvecp->sv_handler = maphandler; - } - } - - if (ucbsigvec(newsig, tvecp, ovec) == -1) { - handlers[newsig] = oldhand; - return (-1); - } - - if (ovec && ovec->sv_handler != SIG_DFL && ovec->sv_handler != SIG_IGN) - ovec->sv_handler = oldhand; - - return (0); -} - -int -sigsetmask(int mask) -{ - int ret; - ret = ucbsigsetmask(maptonewmask(mask)); - return (maptooldmask(ret)); -} - -int -sigblock(int mask) -{ - int ret; - ret = ucbsigblock(maptonewmask(mask)); - return (maptooldmask(ret)); -} - - -int -sigpause(int mask) -{ - int ret; - return (ucbsigpause(maptonewmask(mask))); -} - -int -siginterrupt(int sig, int flag) -{ - return (ucbsiginterrupt(maptonewsig(sig), flag)); -} - - -int -maptonewsig(int sig) -{ - switch (sig) { - case SIGURG: /* urgent condition on IO channel */ - return (XSIGURG); - case SIGSTOP: /* sendable stop signal not from tty */ - return (XSIGSTOP); - case SIGTSTP: /* stop signal from tty */ - return (XSIGTSTP); - case SIGCONT: /* continue a stopped process */ - return (XSIGCONT); - case SIGCLD: /* System V name for SIGCHLD */ - return (XSIGCLD); - case SIGTTIN: /* to readers pgrp upon background tty read */ - return (XSIGTTIN); - case SIGTTOU: /* like TTIN for output */ - return (XSIGTTOU); - case SIGIO: /* input/output possible signal */ - return (XSIGIO); - case SIGXCPU: /* exceeded CPU time limit */ - return (XSIGXCPU); - case SIGXFSZ: /* exceeded file size limit */ - return (XSIGXFSZ); - case SIGVTALRM: /* virtual time alarm */ - return (XSIGVTALRM); - case SIGPROF: /* profiling time alarm */ - return (XSIGPROF); - case SIGWINCH: /* window changed */ - return (XSIGWINCH); - case SIGLOST: /* resource lost, not supported */ - return (-1); - case SIGUSR1: - return (XSIGUSR1); - case SIGUSR2: /* user defined signal 2 */ - return (XSIGUSR2); - default: - return (sig); - } -} - -int -maptooldsig(int sig) -{ - switch (sig) { - case XSIGURG: /* urgent condition on IO channel */ - return (SIGURG); - case XSIGSTOP: /* sendable stop signal not from tty */ - return (SIGSTOP); - case XSIGTSTP: /* stop signal from tty */ - return (SIGTSTP); - case XSIGCONT: /* continue a stopped process */ - return (SIGCONT); - case XSIGCLD: /* System V name for SIGCHLD */ - return (SIGCLD); - case XSIGTTIN: /* to readers pgrp upon background tty read */ - return (SIGTTIN); - case XSIGTTOU: /* like TTIN for output */ - return (SIGTTOU); - case XSIGIO: /* input/output possible signal */ - return (SIGIO); - case XSIGXCPU: /* exceeded CPU time limit */ - return (SIGXCPU); - case XSIGXFSZ: /* exceeded file size limit */ - return (SIGXFSZ); - case XSIGVTALRM: /* virtual time alarm */ - return (SIGVTALRM); - case XSIGPROF: /* profiling time alarm */ - return (SIGPROF); - case XSIGWINCH: /* window changed */ - return (SIGWINCH); - case XSIGUSR1: - return (SIGUSR1); - case XSIGUSR2: /* user defined signal 2 */ - return (SIGUSR2); - case XSIGPWR: /* user defined signal 2 */ - return (-1); - default: - return (sig); - } -} - -int -maptooldmask(int mask) -{ - int omask; - - omask = mask & 0x7FFF; /* these signo are same */ - - if (mask & sigmask(XSIGURG)) - omask |= sigmask(SIGURG); - if (mask & sigmask(XSIGSTOP)) - omask |= sigmask(SIGSTOP); - if (mask & sigmask(XSIGTSTP)) - omask |= sigmask(SIGTSTP); - if (mask & sigmask(XSIGCONT)) - omask |= sigmask(SIGCONT); - if (mask & sigmask(XSIGCLD)) - omask |= sigmask(SIGCLD); - if (mask & sigmask(XSIGTTIN)) - omask |= sigmask(SIGTTIN); - if (mask & sigmask(XSIGTTOU)) - omask |= sigmask(SIGTTOU); - if (mask & sigmask(XSIGIO)) - omask |= sigmask(SIGIO); - if (mask & sigmask(XSIGXCPU)) - omask |= sigmask(SIGXCPU); - if (mask & sigmask(XSIGXFSZ)) - omask |= sigmask(SIGXFSZ); - if (mask & sigmask(XSIGVTALRM)) - omask |= sigmask(SIGVTALRM); - if (mask & sigmask(XSIGPROF)) - omask |= sigmask(SIGPROF); - if (mask & sigmask(XSIGWINCH)) - omask |= sigmask(SIGWINCH); - if (mask & sigmask(XSIGUSR1)) - omask |= sigmask(SIGUSR1); - if (mask & sigmask(XSIGUSR2)) - omask |= sigmask(SIGUSR2); - return (omask); -} - - -int -maptonewmask(int omask) -{ - int mask; - - if (omask == -1) { - return (-1); - } - - mask = omask & 0x7FFF; /* these signo are the same */ - - if (omask & sigmask(SIGURG)) - mask |= sigmask(XSIGURG); - if (omask & sigmask(SIGSTOP)) - mask |= sigmask(XSIGSTOP); - if (omask & sigmask(SIGTSTP)) - mask |= sigmask(XSIGTSTP); - if (omask & sigmask(SIGCONT)) - mask |= sigmask(XSIGCONT); - if (omask & sigmask(SIGCLD)) - mask |= sigmask(XSIGCLD); - if (omask & sigmask(SIGTTIN)) - mask |= sigmask(XSIGTTIN); - if (omask & sigmask(SIGTTOU)) - mask |= sigmask(XSIGTTOU); - if (omask & sigmask(SIGIO)) - mask |= sigmask(XSIGIO); - if (omask & sigmask(SIGXCPU)) - mask |= sigmask(XSIGXCPU); - if (omask & sigmask(SIGXFSZ)) - mask |= sigmask(XSIGXFSZ); - if (omask & sigmask(SIGVTALRM)) - mask |= sigmask(XSIGVTALRM); - if (omask & sigmask(SIGPROF)) - mask |= sigmask(XSIGPROF); - if (omask & sigmask(SIGWINCH)) - mask |= sigmask(XSIGWINCH); - if (omask & sigmask(SIGUSR1)) - mask |= sigmask(XSIGUSR1); - if (omask & sigmask(SIGUSR2)) - mask |= sigmask(XSIGUSR2); - return (mask); -} diff --git a/usr/src/lib/libbc/libc/sys/common/signalmap.h b/usr/src/lib/libbc/libc/sys/common/signalmap.h deleted file mode 100644 index 6e99dad5b8..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/signalmap.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - - -#define XSIGUSR1 16 /* user defined signal 1 */ -#define XSIGUSR2 17 /* user defined signal 2 */ -#define XSIGCLD 18 /* System V name for SIGCHLD */ -#define XSIGPWR 19 /* power-fail restart */ -#define XSIGWINCH 20 /* window changed */ -#define XSIGURG 21 /* urgent condition on IO channel */ -#define XSIGIO 22 /* input/output possible signal */ -#define XSIGSTOP 23 /* sendable stop signal not from tty */ -#define XSIGTSTP 24 /* stop signal from tty */ -#define XSIGCONT 25 /* continue a stopped process */ -#define XSIGTTIN 26 /* to readers pgrp upon background tty read */ -#define XSIGTTOU 27 /* like TTIN for output */ -#define XSIGVTALRM 28 /* virtual time alarm */ -#define XSIGPROF 29 /* profiling time alarm */ -#define XSIGXCPU 30 /* exceeded CPU time limit */ -#define XSIGXFSZ 31 /* exceeded file size limit */ - - -/* SVR4 siginfo_t structure */ -#define SI_PAD ((128/sizeof(int)) -3) - -typedef struct siginfo { - - int si_signo; /* signal from signal.h */ - int si_code; /* code from above */ - int si_errno; /* error from errno.h */ - - union { - - int _pad[SI_PAD]; /* for future growth */ - - struct { /* kill(), SIGCLD */ - long _pid; /* process ID */ - union { - struct { - long _uid; - } _kill; - struct { - long _utime; - int _status; - long _stime; - } _cld; - } _pdata; - } _proc; - - struct { /* SIGSEGV, SIGBUS, SIGILL and SIGFPE */ - char * _addr; /* faulting address */ - } _fault; - - struct { /* SIGPOLL, SIGXFSZ */ - /* fd not currently available for SIGPOLL */ - int _fd; /* file descriptor */ - long _band; - } _file; - - } _data; - -} siginfo_t; - -#define si_pid _data._proc._pid -#define si_status _data._proc._pdata._cld._status -#define si_addr _data._fault._addr diff --git a/usr/src/lib/libbc/libc/sys/common/sigsetjmp.c b/usr/src/lib/libbc/libc/sys/common/sigsetjmp.c deleted file mode 100644 index fab2911048..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/sigsetjmp.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - - -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - - -#include <sys/setjmp.h> -#include "ucontext.h" - -int _getsp(); - -int -sigsetjmp(env, savemask) - sigjmp_buf env; - int savemask; -{ - register o_setjmp_struct_t *bp = (o_setjmp_struct_t *)env; - register int sp = _getsp(); - ucontext_t uc; - - /* - * Get the current machine context. - */ - uc.uc_flags = UC_STACK | UC_SIGMASK; - __getcontext(&uc); - - /* - * Note that the pc and former sp (fp) from the stack are valid - * because the call to __getcontext must flush the user windows - * to the stack. - */ - bp->sjs_flags = 0; - bp->sjs_sp = *((int *)sp+14); - bp->sjs_pc = *((int *)sp+15) + 0x8; - bp->sjs_stack = uc.uc_stack; - - if (savemask) { - /* save the mask */ - bp->sjs_flags |= JB_SAVEMASK; - memcpy(bp->sjs_sigmask, &(uc.uc_sigmask), 3 * sizeof (int)); - } else { - memset(bp->sjs_sigmask, 0, 3 * sizeof (int)); - } - - return (0); -} - - -void -siglongjmp(env, val) - sigjmp_buf env; - int val; -{ - o_setjmp_struct_t *bp = (o_setjmp_struct_t *)env; - setjmp_struct_t sjmp, *sp; - - sp = &sjmp; - sp->sjs_flags = bp->sjs_flags; - sp->sjs_sp = bp->sjs_sp; - sp->sjs_pc = bp->sjs_pc; - sp->sjs_fp = 0; - sp->sjs_i7 = 0; - sp->sjs_uclink = 0; - sp->sjs_sigmask[0] = bp->sjs_sigmask[0]; - sp->sjs_sigmask[1] = bp->sjs_sigmask[1]; - sp->sjs_sigmask[2] = bp->sjs_sigmask[2]; - sp->sjs_sigmask[3] = 0; - sp->sjs_stack = bp->sjs_stack; - - _siglongjmp(sjmp, val); -} - -int -_setjmp(env) - jmp_buf env; -{ - register o_setjmp_struct_t *bp = (o_setjmp_struct_t *)env; - register int sp = _getsp(); - ucontext_t uc; - - /* - * Get the current machine context. - */ - uc.uc_flags = UC_STACK; - __getcontext(&uc); - - /* - * Note that the pc and former sp (fp) from the stack are valid - * because the call to __getcontext must flush the user windows - * to the stack. - */ - bp->sjs_flags = 0; - bp->sjs_sp = *((int *)sp+14); - bp->sjs_pc = *((int *)sp+15) + 0x8; - bp->sjs_sigmask[0] = 0; - bp->sjs_sigmask[1] = 0; - bp->sjs_sigmask[2] = 0; - bp->sjs_stack = uc.uc_stack; - - return (0); -} - - -void -_longjmp(env, val) - jmp_buf env; - int val; -{ - o_setjmp_struct_t *bp = (o_setjmp_struct_t *)env; - setjmp_struct_t sjmp, *sp; - - sp = &sjmp; - sp->sjs_flags = bp->sjs_flags; - sp->sjs_sp = bp->sjs_sp; - sp->sjs_pc = bp->sjs_pc; - sp->sjs_fp = 0; - sp->sjs_i7 = 0; - sp->sjs_uclink = 0; - sp->sjs_sigmask[0] = bp->sjs_sigmask[0]; - sp->sjs_sigmask[1] = bp->sjs_sigmask[1]; - sp->sjs_sigmask[2] = bp->sjs_sigmask[2]; - sp->sjs_sigmask[3] = 0; - sp->sjs_stack = bp->sjs_stack; - - _siglongjmp(sjmp, val); -} diff --git a/usr/src/lib/libbc/libc/sys/common/socket.c b/usr/src/lib/libbc/libc/sys/common/socket.c deleted file mode 100644 index a804463505..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/socket.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1990-1996 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/errno.h> - -extern int errno; - -int -socket(family, type, protocol) -register int family; -register int type; -register int protocol; -{ - int a; - static int map[]={0,2,1,4,5,6}; - if ((a = _socket_bsd(family, map[type], protocol)) == -1) { - maperror(errno); - switch (errno) { - case EAFNOSUPPORT: - case EPROTOTYPE: - errno = EPROTONOSUPPORT; - break; - } - } - return(a); -} - - diff --git a/usr/src/lib/libbc/libc/sys/common/socketpair.c b/usr/src/lib/libbc/libc/sys/common/socketpair.c deleted file mode 100644 index 8a70bf5ea1..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/socketpair.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1990-1996 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/errno.h> - -extern int errno; - -int -socketpair(family, type, protocol, sv) -register int family; -register int type; -register int protocol; -register int sv[2]; -{ - int ret; - static int map[] = {0, 2, 1, 4, 5, 6}; - if ((ret = _socketpair_bsd(family, map[type], protocol, - sv)) == -1) { - maperror(errno); - switch (errno) { - case EAFNOSUPPORT: - case EPROTOTYPE: - errno = EPROTONOSUPPORT; - break; - } - } - return (ret); -} diff --git a/usr/src/lib/libbc/libc/sys/common/sparc/_exit.s b/usr/src/lib/libbc/libc/sys/common/sparc/_exit.s deleted file mode 100644 index 4608b4faac..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/sparc/_exit.s +++ /dev/null @@ -1,29 +0,0 @@ -! -! CDDL HEADER START -! -! The contents of this file are subject to the terms of the -! Common Development and Distribution License, Version 1.0 only -! (the "License"). You may not use this file except in compliance -! with the License. -! -! You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -! or http://www.opensolaris.org/os/licensing. -! See the License for the specific language governing permissions -! and limitations under the License. -! -! When distributing Covered Code, include this CDDL HEADER in each -! file and include the License file at usr/src/OPENSOLARIS.LICENSE. -! If applicable, add the following below this CDDL HEADER, with the -! fields enclosed by brackets "[]" replaced with your own identifying -! information: Portions Copyright [yyyy] [name of copyright owner] -! -! CDDL HEADER END -! -! "%Z%%M% %I% %E% SMI" -! Copyright (c) 1986 by Sun Microsystems, Inc. -! - .seg ".text" - -#include "SYS.h" - - PSEUDO(_exit,exit) diff --git a/usr/src/lib/libbc/libc/sys/common/sparc/_read.s b/usr/src/lib/libbc/libc/sys/common/sparc/_read.s deleted file mode 100644 index c74875cdd0..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/sparc/_read.s +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - - -/* Copyright (c) 1989 by Sun Microsystems, Inc. */ - -.ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */ - -/* C library -- read */ -/* int read (int fildes, void *buf, unsigned nbyte); */ - - .file "_read.s" - -#include "SYS.h" - - SYSREENTRY(_read) - mov SYS_read, %g1 - t 8 - SYSRESTART(.restart__read) - RET - - SET_SIZE(_read) diff --git a/usr/src/lib/libbc/libc/sys/common/sparc/_readv.s b/usr/src/lib/libbc/libc/sys/common/sparc/_readv.s deleted file mode 100644 index 17476b896a..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/sparc/_readv.s +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - - -/* Copyright (c) 1989 by Sun Microsystems, Inc. */ - -.ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */ - -/* C library -- readv */ - - .file "_readv.s" - -#include "SYS.h" - - SYSREENTRY(_readv) - mov SYS_readv, %g1 - t 8 - SYSRESTART(.restart__readv) - RET - - SET_SIZE(_readv) diff --git a/usr/src/lib/libbc/libc/sys/common/sparc/_syscall.s b/usr/src/lib/libbc/libc/sys/common/sparc/_syscall.s deleted file mode 100644 index 678f8b9a28..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/sparc/_syscall.s +++ /dev/null @@ -1,36 +0,0 @@ -! -! CDDL HEADER START -! -! The contents of this file are subject to the terms of the -! Common Development and Distribution License, Version 1.0 only -! (the "License"). You may not use this file except in compliance -! with the License. -! -! You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -! or http://www.opensolaris.org/os/licensing. -! See the License for the specific language governing permissions -! and limitations under the License. -! -! When distributing Covered Code, include this CDDL HEADER in each -! file and include the License file at usr/src/OPENSOLARIS.LICENSE. -! If applicable, add the following below this CDDL HEADER, with the -! fields enclosed by brackets "[]" replaced with your own identifying -! information: Portions Copyright [yyyy] [name of copyright owner] -! -! CDDL HEADER END -! -! "%Z%%M% %I% %E% SMI" -! Copyright (c) 1986 by Sun Microsystems, Inc. -! -! .seg "text" - - .file "_syscall.s" - -#include "SYS.h" - -#define SYS_syscall 0 /* SYS_indir */ - - BSDSYSCALL(syscall) - RET - - SET_SIZE(_syscall) diff --git a/usr/src/lib/libbc/libc/sys/common/sparc/_write.s b/usr/src/lib/libbc/libc/sys/common/sparc/_write.s deleted file mode 100644 index effdb03eb9..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/sparc/_write.s +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - - -/* Copyright (c) 1989 by Sun Microsystems, Inc. */ - -.ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */ - -/* C library -- write */ -/* int write (int fildes, void *buf, unsigned nbyte); */ - - .file "_write.s" - -#include "SYS.h" - - SYSREENTRY(_write) - mov SYS_write, %g1 - t 8 - SYSRESTART(.restart__write) - RET - - SET_SIZE(_write) diff --git a/usr/src/lib/libbc/libc/sys/common/sparc/_writev.s b/usr/src/lib/libbc/libc/sys/common/sparc/_writev.s deleted file mode 100644 index 282c206156..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/sparc/_writev.s +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - - -/* Copyright (c) 1989 by Sun Microsystems, Inc. */ - -.ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */ - -/* C library -- writev */ - - .file "_writev.s" - -#include "SYS.h" - - SYSREENTRY(_writev) - mov SYS_writev, %g1 - t 8 - SYSRESTART(.restart__writev) - RET - - SET_SIZE(_writev) diff --git a/usr/src/lib/libbc/libc/sys/common/sparc/brk.s b/usr/src/lib/libbc/libc/sys/common/sparc/brk.s deleted file mode 100644 index da5a832b97..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/sparc/brk.s +++ /dev/null @@ -1,52 +0,0 @@ -! -! CDDL HEADER START -! -! The contents of this file are subject to the terms of the -! Common Development and Distribution License, Version 1.0 only -! (the "License"). You may not use this file except in compliance -! with the License. -! -! You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -! or http://www.opensolaris.org/os/licensing. -! See the License for the specific language governing permissions -! and limitations under the License. -! -! When distributing Covered Code, include this CDDL HEADER in each -! file and include the License file at usr/src/OPENSOLARIS.LICENSE. -! If applicable, add the following below this CDDL HEADER, with the -! fields enclosed by brackets "[]" replaced with your own identifying -! information: Portions Copyright [yyyy] [name of copyright owner] -! -! CDDL HEADER END -! -! "%Z%%M% %I% %E% SMI" -! Copyright (c) 1986 by Sun Microsystems, Inc. -! - .seg ".text" - -#include "SYS.h" -#define ALIGNSIZE 8 - -#define SYS_brk 17 - - .global .curbrk - .type .curbrk,#object - .size .curbrk,4 - - ENTRY(brk) - add %o0, (ALIGNSIZE-1), %o0 ! round up new break to a - andn %o0, (ALIGNSIZE-1), %o0 ! multiple of alignsize - mov %o0, %o2 ! save new break - mov SYS_brk, %g1 - t 8 - CERROR(o5) -#ifdef PIC - PIC_SETUP(o5) - ld [%o5 + .curbrk], %g1 - st %o2, [%g1] -#else - sethi %hi(.curbrk), %g1 ! save new break - st %o2, [%g1 + %lo(.curbrk)] -#endif - RET - SET_SIZE(brk) diff --git a/usr/src/lib/libbc/libc/sys/common/sparc/cerror.s b/usr/src/lib/libbc/libc/sys/common/sparc/cerror.s deleted file mode 100644 index cc18490166..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/sparc/cerror.s +++ /dev/null @@ -1,52 +0,0 @@ -! -! CDDL HEADER START -! -! The contents of this file are subject to the terms of the -! Common Development and Distribution License, Version 1.0 only -! (the "License"). You may not use this file except in compliance -! with the License. -! -! You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -! or http://www.opensolaris.org/os/licensing. -! See the License for the specific language governing permissions -! and limitations under the License. -! -! When distributing Covered Code, include this CDDL HEADER in each -! file and include the License file at usr/src/OPENSOLARIS.LICENSE. -! If applicable, add the following below this CDDL HEADER, with the -! fields enclosed by brackets "[]" replaced with your own identifying -! information: Portions Copyright [yyyy] [name of copyright owner] -! -! CDDL HEADER END -! -! "%Z%%M% %I% %E% SMI" -! Copyright (c) 1986 by Sun Microsystems, Inc. -! -! Note this routine used to be called cerror, the -! file name will not change for now. We might go -! back to the old name. - -! .seg "text" - -#include "SYS.h" - -! .seg "text" - .global .cerror - .global errno - - ENTRY(.cerror) -#ifdef PIC - PIC_SETUP(o5) - ld [%o5 + errno], %g1 - st %o0, [%g1] -#else - sethi %hi(errno), %g1 - st %o0, [%g1 + %lo(errno)] -#endif - save %sp, -SA(MINFRAME), %sp - call maperror,0 - nop - ret - restore %g0, -1, %o0 - - SET_SIZE(.cerror) diff --git a/usr/src/lib/libbc/libc/sys/common/sparc/errno.s b/usr/src/lib/libbc/libc/sys/common/sparc/errno.s deleted file mode 100644 index 8b778008d2..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/sparc/errno.s +++ /dev/null @@ -1,32 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1992 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* #ident "%Z%%M% %I% %E% SMI" */ - .globl _errno - .seg ".data" - .align 4 -_errno: .word 0 - diff --git a/usr/src/lib/libbc/libc/sys/common/sparc/getmsg.s b/usr/src/lib/libbc/libc/sys/common/sparc/getmsg.s deleted file mode 100644 index 847a2a9e21..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/sparc/getmsg.s +++ /dev/null @@ -1,41 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - - -/* Copyright (c) 1989 by Sun Microsystems, Inc. */ - -.ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */ - -/* C library -- getmsg */ -/* int getmsg (int fd, struct strbuf *ctlptr, */ -/* struct strbuf *dataptr, int *flags) */ - -#include "SYS.h" - - .file "getmsg.s" - - SYSCALL_RESTART(getmsg) - RET - - SET_SIZE(getmsg) diff --git a/usr/src/lib/libbc/libc/sys/common/sparc/getppid.s b/usr/src/lib/libbc/libc/sys/common/sparc/getppid.s deleted file mode 100644 index 6072ab0986..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/sparc/getppid.s +++ /dev/null @@ -1,35 +0,0 @@ -! -! "%Z%%M% %I% %E%" -! ident "%Z%%M% %I% %E% SMI" -! Copyright 2005 Sun Microsystems, Inc. All rights reserved. -! Use is subject to license terms. -! -! CDDL HEADER START -! -! The contents of this file are subject to the terms of the -! Common Development and Distribution License, Version 1.0 only -! (the "License"). You may not use this file except in compliance -! with the License. -! -! You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -! or http://www.opensolaris.org/os/licensing. -! See the License for the specific language governing permissions -! and limitations under the License. -! -! When distributing Covered Code, include this CDDL HEADER in each -! file and include the License file at usr/src/OPENSOLARIS.LICENSE. -! If applicable, add the following below this CDDL HEADER, with the -! fields enclosed by brackets "[]" replaced with your own identifying -! information: Portions Copyright [yyyy] [name of copyright owner] -! -! CDDL HEADER END -! - .seg ".text" - -#include "SYS.h" - - PSEUDO(getppid,getpid) - retl /* ppid = getppid(); */ - mov %o1, %o0 - - SET_SIZE(getppid) diff --git a/usr/src/lib/libbc/libc/sys/common/sparc/mmap.s b/usr/src/lib/libbc/libc/sys/common/sparc/mmap.s deleted file mode 100644 index 8d50eb00f3..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/sparc/mmap.s +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * ident "%Z%%M% %I% %E% SMI" - */ - -/* - * Interface to mmap introduced in 4.0. Incorporates flag telling - * system to use 4.0 interface to mmap. - */ - -#include "SYS.h" -#include <sys/mman.h> - -#define FLAGS %o3 - -ENTRY(mmap) - sethi %hi(_MAP_NEW), %g1 - or %g1, FLAGS, FLAGS - mov SYS_mmap, %g1 - t 8 - CERROR(o5) - RET - -SET_SIZE(mmap) diff --git a/usr/src/lib/libbc/libc/sys/common/sparc/pipe.s b/usr/src/lib/libbc/libc/sys/common/sparc/pipe.s deleted file mode 100644 index 5f12b48f55..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/sparc/pipe.s +++ /dev/null @@ -1,41 +0,0 @@ -! -! ident "%Z%%M% %I% %E% SMI" -! Copyright 2005 Sun Microsystems, Inc. All rights reserved. -! Use is subject to license terms. -! -! CDDL HEADER START -! -! The contents of this file are subject to the terms of the -! Common Development and Distribution License, Version 1.0 only -! (the "License"). You may not use this file except in compliance -! with the License. -! -! You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -! or http://www.opensolaris.org/os/licensing. -! See the License for the specific language governing permissions -! and limitations under the License. -! -! When distributing Covered Code, include this CDDL HEADER in each -! file and include the License file at usr/src/OPENSOLARIS.LICENSE. -! If applicable, add the following below this CDDL HEADER, with the -! fields enclosed by brackets "[]" replaced with your own identifying -! information: Portions Copyright [yyyy] [name of copyright owner] -! -! CDDL HEADER END -! - .seg ".text" - -#include "SYS.h" - - - ENTRY(pipe) - mov %o0, %o2 ! save ptr to array - mov SYS_pipe, %g1 - t 8 - CERROR(o5); - st %o0, [%o2] - st %o1, [%o2 + 4] - retl - clr %o0 - - SET_SIZE(pipe) diff --git a/usr/src/lib/libbc/libc/sys/common/sparc/putmsg.s b/usr/src/lib/libbc/libc/sys/common/sparc/putmsg.s deleted file mode 100644 index 63714b4555..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/sparc/putmsg.s +++ /dev/null @@ -1,41 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - - -/* Copyright (c) 1989 by Sun Microsystems, Inc. */ - -.ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */ - -/* C library -- putmsg */ -/* int putmsg (int fd, struct const strbuf *ctlptr, - struct const strbuf *dataptr, int *flags) */ - -#include "SYS.h" - - .file "putmsg.s" - - SYSCALL_RESTART(putmsg) - RET - - SET_SIZE(putmsg) diff --git a/usr/src/lib/libbc/libc/sys/common/sparc/sbrk.s b/usr/src/lib/libbc/libc/sys/common/sparc/sbrk.s deleted file mode 100644 index 144c217961..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/sparc/sbrk.s +++ /dev/null @@ -1,71 +0,0 @@ -! -! CDDL HEADER START -! -! The contents of this file are subject to the terms of the -! Common Development and Distribution License, Version 1.0 only -! (the "License"). You may not use this file except in compliance -! with the License. -! -! You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -! or http://www.opensolaris.org/os/licensing. -! See the License for the specific language governing permissions -! and limitations under the License. -! -! When distributing Covered Code, include this CDDL HEADER in each -! file and include the License file at usr/src/OPENSOLARIS.LICENSE. -! If applicable, add the following below this CDDL HEADER, with the -! fields enclosed by brackets "[]" replaced with your own identifying -! information: Portions Copyright [yyyy] [name of copyright owner] -! -! CDDL HEADER END -! -! "%Z%%M% %I% %E% SMI" -! Copyright (c) 1986 by Sun Microsystems, Inc. -! -! .seg "text" - - .file "sbrk.s" - -#include "SYS.h" -#include <sys/syscall.h> - -#define ALIGNSIZE 8 - - .global .curbrk - .type .curbrk,#object - .size .curbrk,4 - - .global end - .section ".data" - .align 4 -.curbrk: - .word end - - ENTRY(sbrk) - add %o0, (ALIGNSIZE-1), %o0 ! round up request to align size - andn %o0, (ALIGNSIZE-1), %o0 -#ifdef PIC - PIC_SETUP(o5) - ld [%o5 + .curbrk], %g1 - ld [%g1], %o3 -#else - sethi %hi(.curbrk), %o2 - ld [%o2 + %lo(.curbrk)], %o3 -#endif - add %o3, (ALIGNSIZE-1), %o3 ! round up .curbrk to align size - andn %o3, (ALIGNSIZE-1), %o3 - add %o3, %o0, %o0 ! new break setting = request + .curbrk - mov %o0, %o4 ! save it - mov SYS_brk, %g1 - t 8 - CERROR(o5) -#ifdef PIC - PIC_SETUP(o5) - ld [%o5 + .curbrk], %g1 - st %o4, [%g1] -#else - st %o4, [%o2 + %lo(.curbrk)] ! store new break in .curbrk -#endif - retl - mov %o3, %o0 ! return old break - SET_SIZE(sbrk) diff --git a/usr/src/lib/libbc/libc/sys/common/sparc/sendsig.s b/usr/src/lib/libbc/libc/sys/common/sparc/sendsig.s deleted file mode 100644 index 1f95b5f05b..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/sparc/sendsig.s +++ /dev/null @@ -1,51 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - .ident "%Z%%M% %I% %E% SMI" - -/* - * Copyright (c) 1993 by Sun Microsystems, Inc. - */ - -#include <sys/asm_linkage.h> - -! -! __sendsig(sig, code, scp, addr, sigfunc) -! -! Call a signal handler in a way that's compatible with statically -! linked 4.x binaries. -! -! We have to save our first four arguments to the stack because -! that's what the 4.x kernel did and that's where the signal handler -! (__sigtramp, normally) expects to find them. -! -ENTRY_NP(__sendsig) - save %sp, -SA(MINFRAME), %sp - ! save i0-i3 to stack, %sp+64 (WINDOWSIZE) - std %i0, [%sp + WINDOWSIZE] - std %i2, [%sp + WINDOWSIZE + 8] - mov %i0, %o0 ! pass parameters in %o regs as well, in case - mov %i1, %o1 ! we're calling directly into C code (as will - mov %i2, %o2 ! happen if the a.out is dynamically linked) - jmpl %i4, %o7 ! call the signal handler - mov %i3, %o3 - ret - restore diff --git a/usr/src/lib/libbc/libc/sys/common/syscall.c b/usr/src/lib/libbc/libc/sys/common/syscall.c deleted file mode 100644 index 2ad69ed13b..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/syscall.c +++ /dev/null @@ -1,671 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. - */ - -#include <errno.h> -#include <stdio.h> -#include <stdarg.h> -#include <sys/syscall.h> -#include "xsyscall.h" - -/* - * Array of SVR4 system call numbers. The 4.1 numbers are mapped - * to their SVR4/5.0 equivalents before trapping into the kernel. - */ - -int syscallnum[190] = { SYS_syscall, SYS_exit, -1 /*fork1*/, - SYS_read, SYS_write, -1 /*open*/, SYS_close, - -1, -1 /*creat*/, -1 /*link*/, -1 /*unlink*/, - -1, SYS_chdir, 0, -1 /*mknod*/, - -1 /*chmod*/, -1 /*lchown*/, 0, 0, - SYS_lseek, SYS_getpid, 0, 0, - 0, SYS_getuid, 0, 0, - 0, 0, 0, 0, - 0, 0, -1 /*access*/, 0, - 0, SYS_sync, SYS_kill, -1 /*stat*/, - 0, -1 /*lstat*/, -1 /*dup*/, SYS_pipe, - 0, SYS_profil, 0, 0, - SYS_getgid, 0, 0, 0, - SYS_acct, 0, -1, SYS_ioctl, - -1 /*reboot*/, 0, -1 /*symlink*/, -1 /*readlink*/, - SYS_execve, SYS_umask, SYS_chroot, -1 /*fstat*/, - 0, -1/*getpagesize*/,-1, 0, - 0, 0, -1, -1, - SYS_mmap, -1, SYS_munmap, SYS_mprotect, - -1 /*advise*/, SYS_vhangup, 0, SYS_mincore, - SYS_getgroups, SYS_setgroups, -1 /*getpgrp*/, -1 /*setpgrp*/, - SYS_setitimer, 0, -1 /*swapon*/, SYS_getitimer, - -1/*gethostname*/,-1/*sethostname*/,-1/*getdtablesize*/,-1/*dup2*/, - -1/*getdopt*/, SYS_fcntl, -1 /*select*/, -1 /*setdopt*/, - SYS_fdsync, -1 /*setprio*/, -1 /*socket*/, -1 /*connect*/, - -1 /*accept*/, -1 /*getprio*/, -1 /*send*/, -1 /*recv*/, - 0, -1 /*bind*/, -1 /*setsockopt*/,-1 /*listen*/, - 0, -1 /*sigvec*/, -1 /*sigblock*/, -1 /*sigsetmask*/, - -1 /*sigpause*/, -1 /*sigstack*/, -1 /*recvmsg*/, -1 /*sendmsg*/, - -1 /*vtrace*/, SYS_gettimeofday, -1 /*getrusage*/, -1 /*getsockopt*/, - 0, SYS_readv, SYS_writev, -1 /*settimeofday*/, - -1 /*fchown*/, -1 /*fchmod*/, -1 /*recvfrom*/, -1 /*setreuid*/, - -1 /*getregid*/, -1 /*rename*/, -1 /*truncate*/, -1 /*ftruncate*/, - -1 /*flock*/, 0, -1 /*sendto*/, -1 /*shutdown*/, - -1 /*socketpair*/, -1 /*mkdir*/, -1 /*rmdir*/, -1 /*utimes*/, - 0, SYS_adjtime, -1 /*getpeername*/,-1 /*gethostid*/, - 0, SYS_getrlimit, SYS_setrlimit, -1 /*killpg*/, - 0, 0, 0, -1/*getsockname*/, - SYS_getmsg, SYS_putmsg, -1 /*poll*/, 0, - -1/*nfssvc*/, -1 /*getdirentries*/, SYS_statfs, SYS_fstatfs, - -1/*SYS_umount*/, -1 /*async_daemmon*/ -1 /*getfh*/, -1/*getdomain*/, - -1/*setdomain*/, 0, -1 /*quotactl*/, -1 /*exportfs*/, - SYS_mount, -1/*ustat*/, SYS_semsys, SYS_msgsys, - SYS_shmsys, -1 /*auditsys*/, -1 /*rfsys*/, SYS_getdents, - -1 /*setsid*/, SYS_fchdir, SYS_fchroot, -1 /*vpixsys*/, - -1 /*aioread*/, -1 /*aiowrite*/, -1 /*aiocancel*/, SYS_sigpending, - 0, -1 /*setpgid*/, SYS_pathconf, SYS_uname, -}; - -long -syscall(int sysnum, ...) -{ - va_list ap; - int i1, i2, i3, i4; - char *c1, *c2, *c3, *c4; - int ret_val; - - va_start(ap, sysnum); - switch(sysnum) { - case XSYS_read: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - i2 = va_arg(ap, int); - va_end(ap); - return (bc_read(i1, c1, i2)); - case XSYS_write: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - i2 = va_arg(ap, int); - va_end(ap); - return (bc_write(i1, c1, i2)); - case XSYS_readv: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - i2 = va_arg(ap, int); - va_end(ap); - return (bc_readv(i1, c1, i2)); - case XSYS_writev: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - i2 = va_arg(ap, int); - va_end(ap); - return (bc_writev(i1, c1, i2)); - case XSYS_open: - c1 = va_arg(ap, char *); - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - va_end(ap); - if (i2) - return (bc_open(c1, i1, i2)); - else - return (bc_open(c1, i1)); - case XSYS_close: - i1 = va_arg(ap, int); - va_end(ap); - return (bc_close(i1)); - case XSYS_fcntl: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - i3 = va_arg(ap, int); - va_end(ap); - return (bc_fcntl(i1, i2, i3)); - case XSYS_select: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - c2 = va_arg(ap, char *); - c3 = va_arg(ap, char *); - c4 = va_arg(ap, char *); - va_end(ap); - return (select(i1, c1, c2, c3, c4)); - case XSYS_ioctl : - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - c1 = va_arg(ap, char *); - va_end(ap); - return (bc_ioctl(i1, i2, c1)); - case XSYS_stat: - c1 = va_arg(ap, char *); - c2 = va_arg(ap, char *); - va_end(ap); - return (bc_stat(c1, c2)); - case XSYS_lstat: - c1 = va_arg(ap, char *); - c2 = va_arg(ap, char *); - va_end(ap); - return (bc_lstat(c1, c2)); - case XSYS_fstat: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - va_end(ap); - return (bc_fstat(i1, c1)); - case XSYS_getdents: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - i2 = va_arg(ap, int); - va_end(ap); - return (bc_getdents(i1, c1, i2)); - case XSYS_kill: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - va_end(ap); - return (bc_kill(i1, i2)); - case XSYS_mount: - c1 = va_arg(ap, char *); - c2 = va_arg(ap, char *); - i1 = va_arg(ap, int); - c3 = va_arg(ap, char *); - va_end(ap); - return (mount(c1, c2, i1, c3)); - case XSYS_getrlimit: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - va_end(ap); - return (bc_getrlimit(i1, c1)); - case XSYS_setrlimit: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - va_end(ap); - return (bc_setrlimit(i1, c1)); - case XSYS_uname: - c1 = va_arg(ap, char *); - va_end(ap); - return (bc_uname(c1)); - case XSYS_creat: - c1 = va_arg(ap, char *); - i1 = va_arg(ap, int); - va_end(ap); - return (creat(c1, i1)); - case XSYS_unmount: - c1 = va_arg(ap, char *); - va_end(ap); - return (umount(c1)); - case XSYS_link: - c1 = va_arg(ap, char *); - c2 = va_arg(ap, char *); - va_end(ap); - return (link(c1, c2)); - case XSYS_unlink: - c1 = va_arg(ap, char *); - va_end(ap); - return (unlink(c1)); - case XSYS_chdir: - c1 = va_arg(ap, char *); - va_end(ap); - return (chdir(c1)); - case XSYS_mknod: - c1 = va_arg(ap, char *); - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - va_end(ap); - return (mknod(c1, i1, i2)); - case XSYS_chmod: - c1 = va_arg(ap, char *); - i1 = va_arg(ap, int); - va_end(ap); - return (chmod(c1, i1)); - case XSYS_chown: - c1 = va_arg(ap, char *); - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - va_end(ap); - return (chown(c1, i1, i2)); - case XSYS_lseek: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - i3 = va_arg(ap, int); - va_end(ap); - return (lseek(i1, i2, i3)); - case XSYS_access: - c1 = va_arg(ap, char *); - i1 = va_arg(ap, int); - va_end(ap); - return (access(c1, i1)); - case XSYS_dup: - i1 = va_arg(ap, int); - va_end(ap); - return (dup(i1)); - case XSYS_dup2: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - va_end(ap); - return (dup2(i1, i2)); - case XSYS_pipe: - c1 = (char *)va_arg(ap, int *); - va_end(ap); - return (pipe(c1)); - case XSYS_symlink: - c1 = va_arg(ap, char *); - c2 = va_arg(ap, char *); - va_end(ap); - return (symlink(c1, c2)); - case XSYS_readlink: - c1 = va_arg(ap, char *); - c2 = va_arg(ap, char *); - i1 = va_arg(ap, int); - va_end(ap); - return (readlink(c1, c2, i1)); - case XSYS_execve: - c1 = va_arg(ap, char *); - c2 = (char *)va_arg(ap, char **); - c3 = (char *)va_arg(ap, char **); - va_end(ap); - return (execve(c1, c2, c3)); - case XSYS_chroot: - c1 = va_arg(ap, char *); - va_end(ap); - return (chroot(c1)); - case XSYS_getgroups: - i1 = va_arg(ap, int); - c1 = (char *)va_arg(ap, int *); - va_end(ap); - return (getgroups(i1, c1)); - case XSYS_setgroups: - i1 = va_arg(ap, int); - c1 = (char *)va_arg(ap, int *); - va_end(ap); - return (setgroups(i1, c1)); - case XSYS_fsync: - i1 = va_arg(ap, int); - va_end(ap); - return (fsync(i1)); - case XSYS_gettimeofday: - c1 = va_arg(ap, char *); - c2 = va_arg(ap, char *); - va_end(ap); - return (gettimeofday(c1, c2)); - case XSYS_settimeofday: - c1 = va_arg(ap, char *); - c2 = va_arg(ap, char *); - va_end(ap); - return (settimeofday(c1, c2)); - case XSYS_rename: - c1 = va_arg(ap, char *); - c2 = va_arg(ap, char *); - va_end(ap); - return (rename(c1, c2)); - case XSYS_mkdir: - c1 = va_arg(ap, char *); - i1 = va_arg(ap, int); - va_end(ap); - return (mkdir(c1, i1)); - case XSYS_rmdir: - c1 = va_arg(ap, char *); - va_end(ap); - return (rmdir(c1)); - case XSYS_statfs: - c1 = va_arg(ap, char *); - c2 = va_arg(ap, char *); - va_end(ap); - return (statfs(c1, c2)); - case XSYS_fstatfs: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - va_end(ap); - return (fstatfs(i1, c1)); - case XSYS_getpagesize: - va_end(ap); - return (getpagesize()); - case XSYS_gethostid: - va_end(ap); - return (gethostid()); - case XSYS_getdtablesize: - va_end(ap); - return (getdtablesize()); - case XSYS_pathconf: - c1 = va_arg(ap, char *); - i1 = va_arg(ap, int); - va_end(ap); - return (pathconf(c1, i1)); - case XSYS_gethostname: - c1 = va_arg(ap, char *); - i1 = va_arg(ap, int); - va_end(ap); - return (gethostname(c1, i1)); - case XSYS_sethostname: - c1 = va_arg(ap, char *); - i1 = va_arg(ap, int); - va_end(ap); - return (sethostname(c1, i1)); - case XSYS_setreuid: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - va_end(ap); - return (setreuid(i1, i2)); - case XSYS_setregid: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - va_end(ap); - return (setregid(i1, i2)); - case XSYS_getpriority: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - va_end(ap); - return (getpriority(i1, i2)); - case XSYS_setpriority: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - i3 = va_arg(ap, int); - va_end(ap); - return (setpriority(i1, i2, i3)); - case XSYS_sigvec: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - c2 = va_arg(ap, char *); - va_end(ap); - return (sigvec(i1, c1, c2)); - case XSYS_sigblock: - i1 = va_arg(ap, int); - va_end(ap); - return (sigblock(i1)); - case XSYS_sigpending: - c1 = va_arg(ap, char *); - va_end(ap); - return (sigpending(c1)); - case XSYS_sigsetmask: - i1 = va_arg(ap, int); - va_end(ap); - return (sigsetmask(i1)); - case XSYS_sigpause: - c1 = va_arg(ap, char *); - va_end(ap); - return (sigpause(c1)); - case XSYS_sigstack: - c1 = va_arg(ap, char *); - c2 = va_arg(ap, char *); - va_end(ap); - return (sigstack(c1, c2)); - case XSYS_truncate: - c1 = va_arg(ap, char *); - i1 = va_arg(ap, int); - va_end(ap); - return (truncate(c1, i1)); - case XSYS_ftruncate: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - va_end(ap); - return (ftruncate(i1, i2)); - case XSYS_killpg: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - va_end(ap); - return (killpg(i1, i2)); - case XSYS_setpgid: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - va_end(ap); - return (setpgid(i1, i2)); - case XSYS_ptrace: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - i3 = va_arg(ap, int); - c1 = va_arg(ap, char *); - i4 = va_arg(ap, int); - c2 = va_arg(ap, char *); - va_end(ap); - return (ptrace(i1, i2, i3, c1, i4, c2)); -#ifdef S5EMUL - case XSYS_getpgrp: - va_end(ap); - return (getpgrp()); - case XSYS_setpgrp: - va_end(ap); - return (setpgrp()); -#else - case XSYS_getpgrp: - i1 = va_arg(ap, int); - va_end(ap); - return (getpgrp(i1)); - case XSYS_setpgrp: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - va_end(ap); - return (setpgrp(i1, i2)); -#endif - case XSYS_getrusage: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - va_end(ap); - return (getrusage(i1, c1)); - case XSYS_setsid: - va_end(ap); - return (setsid()); - - case XSYS_flock: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - va_end(ap); - return (flock(i1, i2)); - case XSYS_utimes: - c1 = va_arg(ap, char *); - c2 = va_arg(ap, char *); - va_end(ap); - return (utimes(c1, c2)); - case XSYS_poll: - c1 = va_arg(ap, char *); - i2 = va_arg(ap, int); - i3 = va_arg(ap, int); - va_end(ap); - return (poll(c1, i2, i3)); - case XSYS_fchmod: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - va_end(ap); - return (fchmod(i1, i2)); - case XSYS_fchown: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - i3 = va_arg(ap, int); - va_end(ap); - return (fchown(i1, i2, i3)); - case XSYS_fork: - va_end(ap); - return (fork1()); - - /* the following system calls are now implemented in - * libsocket */ - case XSYS_accept: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - c2 = (char *)va_arg(ap, int *); - va_end(ap); - return (_accept(i1, c1, c2)); - case XSYS_bind: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - i2 = va_arg(ap, int); - va_end(ap); - return (_bind(i1, c1, i2)); - case XSYS_connect: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - i2 = va_arg(ap, int); - va_end(ap); - return (_connect(i1, c1, i2)); - case XSYS_getsockopt: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - i3 = va_arg(ap, int); - c1 = va_arg(ap, char *); - c2 = va_arg(ap, char *); - va_end(ap); - return (_getsockopt(i1, i2, i3, c1, c2)); - case XSYS_getpeername: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - c2 = va_arg(ap, char *); - va_end(ap); - return (_getpeername(i1, c1, c2)); - case XSYS_getsockname: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - c2 = va_arg(ap, char *); - va_end(ap); - return (_getsockname(i1, c1, c2)); - case XSYS_getdomainname: - c1 = va_arg(ap, char *); - i1 = va_arg(ap, int); - va_end(ap); - return (getdomainname(c1, i1)); - case XSYS_listen: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - va_end(ap); - return (_listen(i1, i2)); - case XSYS_recv: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - i2 = va_arg(ap, int); - i3 = va_arg(ap, int); - va_end(ap); - return (_recv(i1, c1, i2, i3)); - case XSYS_recvfrom: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - i2 = va_arg(ap, int); - i3 = va_arg(ap, int); - c2 = va_arg(ap, char *); - c3 = va_arg(ap, char *); - va_end(ap); - return (_recvfrom(i1, c1, i2, i3, c2, c3)); - case XSYS_recvmsg: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - i2 = va_arg(ap, int); - va_end(ap); - return (_recvmsg(i1, c1, i2)); - case XSYS_send: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - i2 = va_arg(ap, int); - i3 = va_arg(ap, int); - va_end(ap); - return (_send(i1, c1, i2, i3)); - case XSYS_sendto: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - i2 = va_arg(ap, int); - i3 = va_arg(ap, int); - c2 = va_arg(ap, char *); - i4 = va_arg(ap, int); - va_end(ap); - return (_sendto(i1, c1, i2, i3, c2, i4)); - case XSYS_sendmsg: - i1 = va_arg(ap, int); - c1 = va_arg(ap, char *); - i2 = va_arg(ap, int); - va_end(ap); - return (_sendmsg(i1, c1, i2)); - case XSYS_setdomainname: - c1 = va_arg(ap, char *); - i1 = va_arg(ap, int); - va_end(ap); - return (setdomainname(c1 ,i1)); - case XSYS_setsockopt: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - i3 = va_arg(ap, int); - c1 = va_arg(ap, char *); - i4 = va_arg(ap, int); - va_end(ap); - return (_setsockopt(i1, i2, i3, c1, i4)); - case XSYS_shutdown: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - va_end(ap); - return (_shutdown(i1, i2)); - case XSYS_socket: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - i3 = va_arg(ap, int); - va_end(ap); - return (_socket(i1, i2, i3)); - case XSYS_socketpair: - i1 = va_arg(ap, int); - i2 = va_arg(ap, int); - i3 = va_arg(ap, int); - c1 = va_arg(ap, char *); - va_end(ap); - return (_socketpair(i1, i2, i3, c1)); - - - /* The following can directly go through syscall */ - case XSYS_acct: - case XSYS_adjtime: - case XSYS_exit: - case XSYS_fchdir: - case XSYS_fchroot: - case XSYS_getgid: - case XSYS_getitimer: - case XSYS_getmsg: - case XSYS_getpid: - case XSYS_getuid: - case XSYS_mincore: - case XSYS_mprotect: - case XSYS_munmap: - case XSYS_putmsg: - case XSYS_profil: - case XSYS_setitimer: - case XSYS_sync: - case XSYS_umask: - case XSYS_semsys: - case XSYS_msgsys: - case XSYS_shmsys: - case XSYS_mmap: - case XSYS_vhangup: - ret_val = _syscall(syscallnum[sysnum], ap); - va_end(ap); - return (ret_val); - - case XSYS_aioread: - case XSYS_aiowrite: - case XSYS_aiocancel: - case XSYS_swapon: - case XSYS_async_daemon: - case XSYS_getfh: - case XSYS_nfssvc: - case XSYS_exportfs: - case XSYS_auditsys: - case XSYS_vpixsys: - case XSYS_quotactl: - case XSYS_getdopt: - case XSYS_setdopt: - case XSYS_ustat: - case XSYS_vtrace: - case XSYS_reboot: - case XSYS_madvise: - case XSYS_vadvise: - case XSYS_getdirentries: - va_end(ap); - fprintf(stderr,"system call not supported\n"); - return(-1); - } - va_end(ap); - return (-1); -} diff --git a/usr/src/lib/libbc/libc/sys/common/ucontext.h b/usr/src/lib/libbc/libc/sys/common/ucontext.h deleted file mode 100644 index 8f2243d85e..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/ucontext.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * This file contains all the type definitions necessary to - * define the equivalent of SVR4 struct ucontext. - */ - -/* Definition for alternate stack */ -typedef struct sigaltstack { - char *ss_sp; - int ss_size; - int ss_flags; -} stack_t; - -/* Register window */ -struct rwindow { - int rw_local[8]; /* locals */ - int rw_in[8]; /* ins */ -}; - -#define SPARC_MAXREGWINDOW 31 /* max windows in SPARC arch. */ - -struct gwindows { - int wbcnt; - int *spbuf[SPARC_MAXREGWINDOW]; - struct rwindow wbuf[SPARC_MAXREGWINDOW]; -}; - -typedef struct gwindows gwindows_t; - -/* Floating point registers */ -struct fpq { - unsigned long *fpq_addr; /* address */ - unsigned long fpq_instr; /* instruction */ -}; - -struct fq { - union { /* FPU inst/addr queue */ - double whole; - struct fpq fpq; - } FQu; -}; - -struct fpu { - union { /* FPU floating point regs */ - unsigned fpu_regs[32]; /* 32 singles */ - double fpu_dregs[16]; /* 16 doubles */ - } fpu_fr; - struct fq *fpu_q; /* ptr to array of FQ entries */ - unsigned fpu_fsr; /* FPU status register */ - unsigned char fpu_qcnt; /* # of entries in saved FQ */ - unsigned char fpu_q_entrysize; /* # of bytes per FQ entry */ - unsigned char fpu_en; /* flag signifying fpu in use */ -}; - -typedef struct fpu fpregset_t; - -/* Register set */ -#define NGREG 19 - -typedef int gregset_t[NGREG]; - -typedef struct mcontext{ - gregset_t gregs; /* general register set */ - gwindows_t *gwins; /* POSSIBLE pointer to register windows */ - fpregset_t fpregs; /* floating point register set */ - long filler[21]; -} mcontext_t; - - -typedef struct ucontext{ - unsigned long uc_flags; - struct ucontext *uc_link; - unsigned long uc_sigmask[4]; - stack_t uc_stack; - mcontext_t uc_mcontext; - long uc_filler[23]; -} ucontext_t; - - - -/* The following is needed by the setjmp/longjmp routines */ - -#define _ABI_JBLEN 12 /* _JBLEN from base */ - -/* - * The following structure MUST match the ABI size specifier _SIGJBLEN. - * This is 19 (words). The ABI value for _JBLEN is 12 (words). - * A sigset_t is 16 bytes and a stack_t is 12 bytes. The layout must - * match sigjmp_struct_t, defined in usr/src/lib/libc/inc/sigjmp_struct.h - */ -typedef struct setjmp_struct_t { - int sjs_flags; /* JBUF[ 0] */ - int sjs_sp; /* JBUF[ 1] */ - int sjs_pc; /* JBUF[ 2] */ - int sjs_fp; /* JBUF[ 3] */ - int sjs_i7; /* JBUF[ 4] */ - void *sjs_uclink; - unsigned long sjs_pad[_ABI_JBLEN - 6]; - unsigned long sjs_sigmask[4]; - stack_t sjs_stack; -} setjmp_struct_t; - -typedef struct o_setjmp_struct_t { - int sjs_flags; /* JBUF[ 0] */ - int sjs_sp; /* JBUF[ 1] */ - int sjs_pc; /* JBUF[ 2] */ - unsigned long sjs_sigmask[3]; - stack_t sjs_stack; -} o_setjmp_struct_t; - -#define JB_SAVEMASK 0x1 -#define UC_SIGMASK 001 -#define UC_STACK 002 - diff --git a/usr/src/lib/libbc/libc/sys/common/uname.c b/usr/src/lib/libbc/libc/sys/common/uname.c deleted file mode 100644 index 3d890a5ce9..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/uname.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1991 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include <errno.h> -#include <string.h> -#include <sys/utsname.h> -#include <sys/syscall.h> - -/* - * utsname structure has a different format in SVr4/SunOS 5.0. - * The data needs to be mapped before returning to the user. - */ - -/* - * The following values and structure are from the SVR4 utsname.h. - */ -#define NEW_SYS_NMLN 257 -#define SYS_NMLN 9 -#define SYS_NDLN 65 - -struct n_utsname { - char sysname[NEW_SYS_NMLN]; - char nodename[NEW_SYS_NMLN]; - char release[NEW_SYS_NMLN]; - char version[NEW_SYS_NMLN]; - char machine[NEW_SYS_NMLN]; -}; - -int -uname(struct utsname *uts) -{ - return (bc_uname(uts)); -} - -int -bc_uname(struct utsname *uts) -{ - struct n_utsname n_uts; - int ret; - - if ((ret = _syscall(SYS_uname, &n_uts)) != -1) { - memcpy(uts->sysname, n_uts.sysname, SYS_NMLN); - if (strlen(n_uts.sysname) > SYS_NMLN) - uts->sysname[SYS_NMLN-1] = '\0'; - - /* - * The nodename was originally 9 bytes (including NUL), but a - * field was added, following it, extending it to SYS_NDLN. - * So we have to copy it in two passes - */ - memcpy(uts->nodename, n_uts.nodename, SYS_NMLN); - memcpy(uts->nodeext, n_uts.nodename + SYS_NMLN, - SYS_NDLN - SYS_NMLN); - if (strlen(n_uts.nodename) > SYS_NDLN) - uts->nodeext[sizeof (uts->nodeext) - 1] = '\0'; - - memcpy(uts->release, n_uts.release, SYS_NMLN); - if (strlen(n_uts.release) > SYS_NMLN) - uts->release[SYS_NMLN-1] = '\0'; - memcpy(uts->version, n_uts.version, SYS_NMLN); - if (strlen(n_uts.version) > SYS_NMLN) - uts->version[SYS_NMLN-1] = '\0'; - memcpy(uts->machine, n_uts.machine, SYS_NMLN); - if (strlen(n_uts.machine) > SYS_NMLN) - uts->machine[SYS_NMLN-1] = '\0'; - } - - return (ret); -} diff --git a/usr/src/lib/libbc/libc/sys/common/unmount.c b/usr/src/lib/libbc/libc/sys/common/unmount.c deleted file mode 100644 index d2e87f4c3e..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/unmount.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -int -unmount(char *s) -{ - return (umount(s)); -} diff --git a/usr/src/lib/libbc/libc/sys/common/wait.c b/usr/src/lib/libbc/libc/sys/common/wait.c deleted file mode 100644 index 36f06ef44f..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/wait.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1995 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -/* - * Portions of this source code were derived from Berkeley 4.3 BSD - * under license from the Regents of the University of California. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Compatibility lib for BSD's wait3() and wait4(). - */ - -#include <errno.h> -#include <sys/types.h> -#include <sys/time.h> -#include <sys/times.h> -#include <sys/wait.h> -#include <sys/param.h> -#include <sys/resource.h> -#include "signalmap.h" - -/* - * Since sysV does not support rusage as in BSD, an approximate approach - * is: - * ... - * call times - * call waitid - * if ( a child is found ) - * call times again - * rusage ~= diff in the 2 times call - * ... - * - */ - -/* - * arguments to wait functions from SVR4 - */ - -#define N_WEXITED 0001 /* wait for processes that have exite */ -#define N_WTRAPPED 0002 /* wait for processes stopped while tracing */ -#define N_WSTOPPED 0004 /* wait for processes stopped by signals */ -#define N_WCONTINUED 0010 /* wait for processes continued */ - -#define N_WUNTRACED N_WSTOPPED /* for POSIX */ - -#define N_WNOHANG 0100 /* non blocking form of wait */ -#define N_WNOWAIT 0200 /* non destructive form of wait */ - -#define WCOREFLG 0200 - -/* - * SIGCLD signal codes from SVr4 - */ - -#define CLD_EXITED 1 /* child has exited */ -#define CLD_KILLED 2 /* child was killed */ -#define CLD_DUMPED 3 /* child has coredumped */ -#define CLD_TRAPPED 4 /* traced child has stopped */ -#define CLD_STOPPED 5 /* child has stopped on signal */ -#define CLD_CONTINUED 6 /* stopped child has continued */ -#define NSIGCLD 6 - -/* - * id type from SVR4 procset.h - */ -typedef enum idtype { - P_PID, /* A process identifier. */ - P_PPID, /* A parent process identifier. */ - P_PGID, /* A process group (job control group) */ - /* identifier. */ - P_SID, /* A session identifier. */ - P_CID, /* A scheduling class identifier. */ - P_UID, /* A user identifier. */ - P_GID, /* A group identifier. */ - P_ALL /* All processes. */ -} idtype_t; - -static void mapstatus(int *, int); - -int -wait(int *status) -{ - int ret, nstatus; - - if ((int)status == -1) { - errno = EFAULT; - return (-1); - } - - ret = _wait(&nstatus); - if (status) - mapstatus(status, nstatus); - return (ret); -} - -int -waitpid(int pid, int *status, int options) -{ - int noptions, ret; - int nstatus; - - if ((int)status == -1) { - errno = EFAULT; - return (-1); - } - - /* - * BSD's wait* routines only support WNOHANG & WUNTRACED - */ - if (options & ~(WNOHANG|WUNTRACED)) - return (EINVAL); - noptions = (N_WEXITED|N_WTRAPPED); - if (options & WNOHANG) - noptions |= N_WNOHANG; - if (options & WUNTRACED) - noptions |= N_WUNTRACED; /* == N_WSTOPPED */ - - ret = _waitpid(pid, &nstatus, noptions); - - if (status) - mapstatus(status, nstatus); - - return (ret); -} - -/* - * It would be -so- nice just to call _wait3 and mapstatus here. - */ -int -wait3(int *status, int options, struct rusage *rp) -{ - return (wait4(0, status, options, rp)); -} - -static int wstat(int, int); - -/* - * It would be -so- nice just to call _wait4 and mapstatus here. - */ -int -wait4(int pid, int *status, int options, struct rusage *rp) -{ - struct tms before_tms; - struct tms after_tms; - siginfo_t info; - int error; - int noptions; - idtype_t idtype; - - if ((int)status == -1 || (int)rp == -1) { - errno = EFAULT; - return(-1); - } - - if (rp) - memset(rp, 0, sizeof(struct rusage)); - memset(&info, 0, sizeof (siginfo_t)); - if (times(&before_tms) < 0) - return (-1); /* errno is set by times() */ - - /* - * BSD's wait* routines only support WNOHANG & WUNTRACED - */ - if (options & ~(WNOHANG|WUNTRACED)) - return (EINVAL); - noptions = N_WEXITED | N_WTRAPPED; - if (options & WNOHANG) - noptions |= N_WNOHANG; - if (options & WUNTRACED) - noptions |= N_WUNTRACED; /* == N_WSTOPPED */ - - /* - * Emulate undocumented 4.x semantics for 1186845 - */ - if (pid < 0) { - pid = -pid; - idtype = P_PGID; - } else if (pid == 0) - idtype = P_ALL; - else - idtype = P_PID; - - error = _waitid(idtype, pid, &info, noptions); - if (error == 0) { - long diffu; /* difference in usertime (ticks) */ - long diffs; /* difference in systemtime (ticks) */ - - if ((options & WNOHANG) && (info.si_pid == 0)) - return (0); /* no child found */ - - if (rp) { - if (times(&after_tms) < 0) - return (-1); /* errno already set by times() */ - /* - * The system/user time is an approximation only !!! - */ - diffu = after_tms.tms_cutime - before_tms.tms_cutime; - diffs = after_tms.tms_cstime - before_tms.tms_cstime; - rp->ru_utime.tv_sec = diffu / HZ; - rp->ru_utime.tv_usec = (diffu % HZ) * (1000000 / HZ); - rp->ru_stime.tv_sec = diffs / HZ; - rp->ru_stime.tv_usec = (diffs % HZ) * (1000000 / HZ); - } - if (status) - *status = wstat(info.si_code, info.si_status); - return (info.si_pid); - } else { - return (-1); /* error number is set by waitid() */ - } -} - - -/* - * Convert the status code to old style wait status - */ -static int -wstat(int code, int status) -{ - int stat = (status & 0377); - - switch (code) { - case CLD_EXITED: - stat <<= 8; - break; - case CLD_KILLED: - stat = maptooldsig(stat); - if (code == CLD_DUMPED) - stat |= WCOREFLG; - break; - case CLD_DUMPED: - stat |= WCOREFLG; - break; - case CLD_TRAPPED: - case CLD_STOPPED: - stat = maptooldsig(stat); - stat <<= 8; - stat |= _WSTOPPED; - break; - } - return (stat); -} - -static void -mapstatus(int *new, int old) -{ - int stat = old & 0xFF; - - switch(stat) { - case _WSTOPPED: - *new = maptooldsig(stat >> 8); - *new = (stat << 8) | _WSTOPPED; - break; - case 0: - *new = old; - break; - default: - *new = maptooldsig(old & 0x7F); - if (old & 0x80) - *new |= 0x80; /* set WCOREFLG */ - } -} diff --git a/usr/src/lib/libbc/libc/sys/common/xsyscall.h b/usr/src/lib/libbc/libc/sys/common/xsyscall.h deleted file mode 100644 index 780e4eb316..0000000000 --- a/usr/src/lib/libbc/libc/sys/common/xsyscall.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2000 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* from UCB 4.11 06/09/83 */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef __sys_syscall_h -#define __sys_syscall_h - -/* List of SunOS 4.1 system call numbers. All SYS_* have been - * renamed to XSYS_* to avoid confusion with the new SunOS/SVR4 - * numbers used in other routines in libbc. */ - -#define XSYS_exit 1 -#define XSYS_fork 2 -#define XSYS_read 3 -#define XSYS_write 4 -#define XSYS_open 5 -#define XSYS_close 6 -#define XSYS_wait4 7 -#define XSYS_creat 8 -#define XSYS_link 9 -#define XSYS_unlink 10 -#define XSYS_execv 11 -#define XSYS_chdir 12 - /* 13 is old: time */ -#define XSYS_mknod 14 -#define XSYS_chmod 15 -#define XSYS_chown 16 - /* 17 is old: sbreak */ - /* 18 is old: stat */ -#define XSYS_lseek 19 -#define XSYS_getpid 20 - /* 21 is old: mount */ - /* 22 is old: umount */ - /* 23 is old: setuid */ -#define XSYS_getuid 24 - /* 25 is old: stime */ -#define XSYS_ptrace 26 - /* 27 is old: alarm */ - /* 28 is old: fstat */ - /* 29 is old: pause */ - /* 30 is old: utime */ - /* 31 is old: stty */ - /* 32 is old: gtty */ -#define XSYS_access 33 - /* 34 is old: nice */ - /* 35 is old: ftime */ -#define XSYS_sync 36 -#define XSYS_kill 37 -#define XSYS_stat 38 - /* 39 is old: setpgrp */ -#define XSYS_lstat 40 -#define XSYS_dup 41 -#define XSYS_pipe 42 - /* 43 is old: times */ -#define XSYS_profil 44 - /* 45 is unused */ - /* 46 is old: setgid */ -#define XSYS_getgid 47 - /* 48 is old: sigsys */ - /* 49 is unused */ - /* 50 is unused */ -#define XSYS_acct 51 - /* 52 is old: phys */ -#define XSYS_mctl 53 -#define XSYS_ioctl 54 -#define XSYS_reboot 55 - /* 56 is old: mpxchan */ -#define XSYS_symlink 57 -#define XSYS_readlink 58 -#define XSYS_execve 59 -#define XSYS_umask 60 -#define XSYS_chroot 61 -#define XSYS_fstat 62 - /* 63 is unused */ -#define XSYS_getpagesize 64 -#define XSYS_msync 65 - /* 66 is old: vfork */ - /* 67 is old: vread */ - /* 68 is old: vwrite */ -#define XSYS_sbrk 69 -#define XSYS_sstk 70 -#define XSYS_mmap 71 -#define XSYS_vadvise 72 -#define XSYS_munmap 73 -#define XSYS_mprotect 74 -#define XSYS_madvise 75 -#define XSYS_vhangup 76 - /* 77 is old: vlimit */ -#define XSYS_mincore 78 -#define XSYS_getgroups 79 -#define XSYS_setgroups 80 -#define XSYS_getpgrp 81 -#define XSYS_setpgrp 82 -#define XSYS_setitimer 83 - /* 84 is old: wait & wait3 */ -#define XSYS_swapon 85 -#define XSYS_getitimer 86 -#define XSYS_gethostname 87 -#define XSYS_sethostname 88 -#define XSYS_getdtablesize 89 -#define XSYS_dup2 90 -#define XSYS_getdopt 91 -#define XSYS_fcntl 92 -#define XSYS_select 93 -#define XSYS_setdopt 94 -#define XSYS_fsync 95 -#define XSYS_setpriority 96 -#define XSYS_socket 97 -#define XSYS_connect 98 -#define XSYS_accept 99 -#define XSYS_getpriority 100 -#define XSYS_send 101 -#define XSYS_recv 102 - /* 103 was socketaddr */ -#define XSYS_bind 104 -#define XSYS_setsockopt 105 -#define XSYS_listen 106 - /* 107 was vtimes */ -#define XSYS_sigvec 108 -#define XSYS_sigblock 109 -#define XSYS_sigsetmask 110 -#define XSYS_sigpause 111 -#define XSYS_sigstack 112 -#define XSYS_recvmsg 113 -#define XSYS_sendmsg 114 -#define XSYS_vtrace 115 -#define XSYS_gettimeofday 116 -#define XSYS_getrusage 117 -#define XSYS_getsockopt 118 - /* 119 is old resuba */ -#define XSYS_readv 120 -#define XSYS_writev 121 -#define XSYS_settimeofday 122 -#define XSYS_fchown 123 -#define XSYS_fchmod 124 -#define XSYS_recvfrom 125 -#define XSYS_setreuid 126 -#define XSYS_setregid 127 -#define XSYS_rename 128 -#define XSYS_truncate 129 -#define XSYS_ftruncate 130 -#define XSYS_flock 131 - /* 132 is unused */ -#define XSYS_sendto 133 -#define XSYS_shutdown 134 -#define XSYS_socketpair 135 -#define XSYS_mkdir 136 -#define XSYS_rmdir 137 -#define XSYS_utimes 138 - /* 139 is unused */ -#define XSYS_adjtime 140 -#define XSYS_getpeername 141 -#define XSYS_gethostid 142 - /* 143 is old: sethostid */ -#define XSYS_getrlimit 144 -#define XSYS_setrlimit 145 -#define XSYS_killpg 146 - /* 147 is unused */ - /* 148 is old: setquota */ - /* 149 is old: quota */ -#define XSYS_getsockname 150 -#define XSYS_getmsg 151 -#define XSYS_putmsg 152 -#define XSYS_poll 153 - /* 154 is old: nfs_mount */ -#define XSYS_nfssvc 155 -#define XSYS_getdirentries 156 -#define XSYS_statfs 157 -#define XSYS_fstatfs 158 -#define XSYS_unmount 159 -#define XSYS_async_daemon 160 -#define XSYS_getfh 161 -#define XSYS_getdomainname 162 -#define XSYS_setdomainname 163 - /* 164 is old: pcfs_mount */ -#define XSYS_quotactl 165 -#define XSYS_exportfs 166 -#define XSYS_mount 167 -#define XSYS_ustat 168 -#define XSYS_semsys 169 -#define XSYS_msgsys 170 -#define XSYS_shmsys 171 -#define XSYS_auditsys 172 - /* 173 is old: rfsys */ -#define XSYS_getdents 174 -#define XSYS_setsid 175 -#define XSYS_fchdir 176 -#define XSYS_fchroot 177 -#define XSYS_vpixsys 178 - -#define XSYS_aioread 179 -#define XSYS_aiowrite 180 -#define XSYS_aiowait 181 -#define XSYS_aiocancel 182 - -#define XSYS_sigpending 183 - /* 184 is available */ -#define XSYS_setpgid 185 -#define XSYS_pathconf 186 -#define XSYS_fpathconf 187 -#define XSYS_sysconf 188 - -#define XSYS_uname 189 - -#endif /* !__sys_syscall_h */ diff --git a/usr/src/lib/libbc/libc/sys/sys5/access.c b/usr/src/lib/libbc/libc/sys/sys5/access.c deleted file mode 100644 index 7354450bd1..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/access.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/syscall.h> -#include <unistd.h> -#include <sys/param.h> - -int -access(char *path, int mode) -{ - return (access_com(path, mode)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/chdir.c b/usr/src/lib/libbc/libc/sys/sys5/chdir.c deleted file mode 100644 index 3bb3ea864a..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/chdir.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/syscall.h> - -int -chdir(char *s) -{ - return (_syscall(SYS_chdir, s)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/chmod.c b/usr/src/lib/libbc/libc/sys/sys5/chmod.c deleted file mode 100644 index 32840d46fb..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/chmod.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. - */ - -#include <sys/syscall.h> -#include <sys/fcntl.h> - -int -chmod(char *s, mode_t m) -{ - return (_syscall(SYS_fchmodat, AT_FDCWD, s, m, 0)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/chown.c b/usr/src/lib/libbc/libc/sys/sys5/chown.c deleted file mode 100644 index 7367a37871..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/chown.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include <sys/syscall.h> -#include <sys/fcntl.h> - -int -chown(char *s, int u, int g) -{ - return (_syscall(SYS_fchownat, AT_FDCWD, s, u, g, AT_SYMLINK_NOFOLLOW)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/chroot.c b/usr/src/lib/libbc/libc/sys/sys5/chroot.c deleted file mode 100644 index b52aac898c..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/chroot.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/syscall.h> - -int -chroot(char *d) -{ - return (_syscall(SYS_chroot, d)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/creat.c b/usr/src/lib/libbc/libc/sys/sys5/creat.c deleted file mode 100644 index 06e3de38ac..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/creat.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -int creat(path, mode) -char *path; -int mode; -{ - - return(creat_com(path, mode)); -} - diff --git a/usr/src/lib/libbc/libc/sys/sys5/execve.c b/usr/src/lib/libbc/libc/sys/sys5/execve.c deleted file mode 100644 index 1ade79a2d4..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/execve.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include <string.h> -#include <sys/file.h> -#include <sys/syscall.h> - -int -execve(char *file, char **argv, char **arge) -{ - char *c; - char path[256]; - - if (strncmp(file, "/usr/bin", strlen("/usr/bin")) == 0 || - strncmp(file, "/bin", strlen("/bin")) == 0) { - if (_syscall(SYS_faccessat, AT_FDCWD, file, F_OK, 0) == -1) { - strcpy(path, "/usr/ucb"); - strcat(path, strrchr(file, '/')); - file = path; - } - } - else if (strncmp(file, "/usr/ucb", strlen("/usr/ucb")) == 0) { - strcpy(path, "/usr/bin"); - strcat(path, strrchr(file, '/')); - if (_syscall(SYS_faccessat, AT_FDCWD, path, F_OK, 0) == 0) - file = path; - } - else if (strncmp(file, "/usr/5bin", strlen("/usr/5bin")) == 0) { - strcpy(path, "/usr/bin"); - strcat(path, strrchr(file, '/')); - if (_syscall(SYS_faccessat, AT_FDCWD, path, F_OK, 0) == 0) - file = path; - else { - strcpy(path, "/usr/ucb"); - strcat(path, strrchr(file, '/')); - if (_syscall(SYS_faccessat, AT_FDCWD, path, F_OK, 0) - == 0) - file = path; - } - } - - return (_syscall(SYS_execve, file, argv, arge)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/fcntl.c b/usr/src/lib/libbc/libc/sys/sys5/fcntl.c deleted file mode 100644 index 3d8342ba4c..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/fcntl.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1990-1996 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#ident "%Z%%M% %I% %E% SMI" - -#include <sys/syscall.h> -#include <sys/fcntl.h> -#include <sys/errno.h> -#include <sys/filio.h> -#include <sys/ioccom.h> -#include <unistd.h> - -/* The following is an array of fcntl commands. The numbers listed - * below are from SVR4. Array is indexed with SunOS 4.1 numbers to - * obtain the SVR4 numbers. - */ -int cmd_op[14] = {0, 1, 2, 3, 4, 23, 24, 14, 6, 7, 21, 20, -1, 22}; - -/* SVR4/SunOS 5.0 equivalent modes */ -#define N_O_NDELAY 0x04 -#define N_O_SYNC 0x10 -#define N_O_NONBLOCK 0x80 -#define N_O_CREAT 0x100 -#define N_O_TRUNC 0x200 -#define N_O_EXCL 0x400 - -#define S5_FASYNC 0x1000 - -/* from SVR4 stropts.h */ -#define S5_S_RDNORM 0x0040 -#define S5_S_WRNORM 0x0004 -#define S5_S_RDBAND 0x0080 -#define S5_S_BANDURG 0x0200 -#define S5_I_SETSIG (('S'<<8)|011) -#define S5_I_GETSIG (('S'<<8)|012) - -/* Mask corresponding to the bits above in SunOS 4.x */ -#define FLAGS_MASK (O_SYNC|O_NONBLOCK|O_CREAT|O_TRUNC|O_EXCL \ - |O_NDELAY|FASYNC) -#define N_FLAGS_MASK (N_O_NDELAY|N_O_SYNC|N_O_NONBLOCK|N_O_CREAT \ - |N_O_TRUNC|N_O_EXCL|S5_FASYNC) - -struct n_flock { - short l_type; - short l_whence; - long l_start; - long l_len; /* len == 0 means until end of file */ - long l_sysid; - long l_pid; - long pad[4]; /* reserve area */ -} ; - -int fcntl(fd, cmd, arg) -int fd, cmd, arg; -{ - return(bc_fcntl(fd, cmd, arg)); -} - -int bc_fcntl(fd, cmd, arg) -int fd, cmd, arg; -{ - int fds, ret; - struct flock *savarg; - struct n_flock nfl; - extern int errno; - int narg, i; - - if ((cmd == F_SETOWN) || (cmd == F_GETOWN)) { - ret = _s_fcntl(fd, cmd_op[cmd], arg); - if ((ret != -1) || (errno != EINVAL)) - return (ret); - else { - if (cmd == F_GETOWN) { - if (_ioctl(fd, S5_I_GETSIG, &i) < 0) { - if (errno == EINVAL) - i = 0; - else - return (-1); - } - if (i & (S5_S_RDBAND|S5_S_BANDURG| - S5_S_RDNORM|S5_S_WRNORM)) - return (getpid()); - return (0); - } else { /* cmd == F_SETOWN */ - i = S5_S_RDNORM|S5_S_WRNORM|S5_S_RDBAND|S5_S_BANDURG; - return (ioctl(fd, S5_I_SETSIG, i)); - } - } - } - if (cmd == F_SETFL) { - if (arg & FLAGS_MASK) { - narg = arg & ~FLAGS_MASK; - if (arg & FASYNC) - narg |= S5_FASYNC; - if (arg & O_SYNC) - narg |= N_O_SYNC; - if (arg & O_CREAT) - narg |= N_O_CREAT; - if (arg & O_TRUNC) - narg |= N_O_TRUNC; - if (arg & O_EXCL) - narg |= N_O_EXCL; - if (arg & (O_NDELAY)) - narg |= N_O_NDELAY; - if (arg & O_NONBLOCK) - narg |= N_O_NONBLOCK; - arg = narg; - } - } else if (cmd == F_SETLK || cmd == F_SETLKW || cmd == F_GETLK) { - if (arg == 0 || arg == -1) { - errno = EFAULT; - return(-1); - } - savarg = (struct flock *)arg; - arg = (int) &nfl; - nfl.l_type = savarg->l_type; - nfl.l_whence = savarg->l_whence; - nfl.l_start = savarg->l_start; - nfl.l_len = savarg->l_len; - nfl.l_pid = savarg->l_pid; - } - - ret = _s_fcntl(fd, cmd_op[cmd], arg); - - if (ret != -1) { - if (cmd == F_DUPFD) { - if ((fds = fd_get(fd)) != -1) - fd_add(ret, fds); - } else if (cmd == F_GETFL) { - if (ret & N_FLAGS_MASK) { - narg = ret & ~N_FLAGS_MASK; - if (ret & S5_FASYNC) - narg |= FASYNC; - if (ret & N_O_SYNC) - narg |= O_SYNC; - if (ret & N_O_NONBLOCK) - narg |= O_NONBLOCK; - if (ret & N_O_CREAT) - narg |= O_CREAT; - if (ret & N_O_TRUNC) - narg |= O_TRUNC; - if (ret & N_O_EXCL) - narg |= O_EXCL; - if (ret & (N_O_NDELAY)) - narg |= O_NDELAY; - ret = narg; - } - } else if (cmd == F_SETLK || cmd == F_SETLKW || - cmd == F_GETLK) { - savarg->l_type = nfl.l_type; - savarg->l_whence = nfl.l_whence; - savarg->l_start = nfl.l_start; - savarg->l_len = nfl.l_len; - savarg->l_pid = nfl.l_pid; - } - } - return(ret); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/getgroups.c b/usr/src/lib/libbc/libc/sys/sys5/getgroups.c deleted file mode 100644 index 5351a9d504..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/getgroups.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * POSIX.1 compatible getgroups() routine - * This is needed while gid_t is not the same size as int (or whatever the - * syscall is using at the time). - */ - -#include <sys/types.h> -#include <sys/param.h> -#include <sys/syscall.h> - -int -getgroups(int gidsetsize, gid_t grouplist[]) -{ - int glist[NGROUPS]; /* getgroups() syscall returns ints */ - int i; /* loop control */ - int rc; /* return code hold area */ - - rc = _syscall(SYS_getgroups, gidsetsize, glist); - if (rc > 0 && gidsetsize != 0) - for (i = 0; i < rc; i++) - grouplist[i] = (gid_t)glist[i]; - return (rc); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/getpgrp.c b/usr/src/lib/libbc/libc/sys/sys5/getpgrp.c deleted file mode 100644 index b1d6508297..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/getpgrp.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - getpgrp -- system call emulation for 4.2BSD - - last edit: 01-Jul-1983 D A Gwyn -*/ - -extern int _getpgrp(); - -int -getpgrp() - { - return _getpgrp( 0 ); /* 0 means this process */ - } diff --git a/usr/src/lib/libbc/libc/sys/sys5/link.c b/usr/src/lib/libbc/libc/sys/sys5/link.c deleted file mode 100644 index 85ecd49af3..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/link.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. - */ - -#include <sys/syscall.h> -#include <sys/fcntl.h> - -int -link(char *a, char *b) -{ - return (_syscall(SYS_linkat, AT_FDCWD, a, AT_FDCWD, b, 0)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/mkdir.c b/usr/src/lib/libbc/libc/sys/sys5/mkdir.c deleted file mode 100644 index 5f0c8106ea..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/mkdir.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. - */ - -#include <sys/syscall.h> -#include <sys/fcntl.h> - -int -mkdir(char *p, mode_t m) -{ - return (_syscall(SYS_mkdirat, AT_FDCWD, p, m)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/mkfifo.c b/usr/src/lib/libbc/libc/sys/sys5/mkfifo.c deleted file mode 100644 index e5ecd5d999..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/mkfifo.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/stat.h> - -int -mkfifo(char *path, mode_t mode) -{ - return (mknod(path, S_IFIFO | (mode & (S_IRWXU|S_IRWXG|S_IRWXO)))); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/mknod.c b/usr/src/lib/libbc/libc/sys/sys5/mknod.c deleted file mode 100644 index 4346b9ab05..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/mknod.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * If we're asked to make a directory, do a "mkdir" instead, so we meet - * the letter of the SVID (yuk!). - */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <errno.h> - -extern int _mknod(); - -int -mknod(char *path, int mode, int dev) -{ - if ((mode & S_IFMT) == S_IFDIR) - if (geteuid()) { - errno = EPERM; - return(-1); - } else - return (mkdir(path, mode & 07777)); - else - return (_mknod(path, mode, dev)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/mount.c b/usr/src/lib/libbc/libc/sys/sys5/mount.c deleted file mode 100644 index 4a4fd64645..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/mount.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1995 Sun Microsystems, Inc. All rights reserved. - */ - -#ident "%Z%%M% %I% %E% SMI" - -#include <errno.h> - -int -mount(spec, dir, rdonly) -char *spec; -char *dir; -int rdonly; -{ - int ret; - - if ((ret = _mount(spec, dir, rdonly)) != 0) { - maperror(errno); - } - return (ret); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/open.c b/usr/src/lib/libbc/libc/sys/sys5/open.c deleted file mode 100644 index 9a5b30d765..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/open.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1992 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <errno.h> - - -int -open(char *path, int flags, int mode) -{ - return (bc_open(path, flags, mode)); -} - - -int -bc_open(char *path, int flags, int mode) -{ - if ((path == (char*)0) || (path == (char*) -1)) { - errno = EFAULT; - return (-1); - } - return (open_com(path, flags, mode)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/pathconf.c b/usr/src/lib/libbc/libc/sys/sys5/pathconf.c deleted file mode 100644 index f14a00b6ba..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/pathconf.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/syscall.h> - -int -pathconf(char *p, int what) -{ - return (_syscall(SYS_pathconf, p, what)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/read.c b/usr/src/lib/libbc/libc/sys/sys5/read.c deleted file mode 100644 index a52f3f3cae..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/read.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "../common/compat.h" -#include <stdio.h> -#include <sys/types.h> -#include <unistd.h> -#include <sys/syscall.h> - -/* - * If reading from the utmp file, map the data to the SunOS 4.1 - * format on the fly. - */ - -extern void to_utmp(char *, char *, int); - -int -read(int fd, char *buf, int size) -{ - return (bc_read(fd, buf, size)); -} - -int -bc_read(int fd, char *buf, int size) -{ - int ret, off; - char *nbuf; - - if (fd_get(fd) != -1) { /* we're reading utmp (utmpx, really) */ - size = getmodsize(size, sizeof (struct compat_utmp), - sizeof (struct utmpx)); - - if ((nbuf = (void *)malloc(size)) == NULL) { - (void) fprintf(stderr, "read: malloc failed\n"); - exit(-1); - } - - if ((ret = _read(fd, nbuf, size)) == -1) { - free(nbuf); - return (-1); - } - - to_utmp(buf, nbuf, ret); - - ret = getmodsize(ret, sizeof (struct utmpx), - sizeof (struct compat_utmp)); - free(nbuf); - return (ret); - } - - return (_read(fd, buf, size)); -} - -void -to_utmp(char *buf, char *nbuf, int len) -{ - struct compat_utmp *ut; - struct utmpx *utx; - - utx = (struct utmpx *)nbuf; - ut = (struct compat_utmp *)buf; - - while ((char *)utx < (nbuf + len)) { - (void) strncpy(ut->ut_line, utx->ut_line, sizeof (ut->ut_line)); - (void) strncpy(ut->ut_name, utx->ut_user, sizeof (ut->ut_name)); - (void) strncpy(ut->ut_host, utx->ut_host, sizeof (ut->ut_host)); - ut->ut_time = utx->ut_tv.tv_sec; - utx++; - ut++; - } -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/readlink.c b/usr/src/lib/libbc/libc/sys/sys5/readlink.c deleted file mode 100644 index 9007d4065a..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/readlink.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. - */ - -#include <sys/syscall.h> -#include <sys/fcntl.h> - -int -readlink(char *p, char *b, int s) -{ - return (_syscall(SYS_readlinkat, AT_FDCWD, p, b, s)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/readv.c b/usr/src/lib/libbc/libc/sys/sys5/readv.c deleted file mode 100644 index 67323be984..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/readv.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "../common/compat.h" -#include <stdio.h> -#include <sys/types.h> -#include <unistd.h> -#include <sys/syscall.h> -#include <sys/uio.h> - -/* - * If reading from the utmp file, map the data to the SunOS 4.1 - * format on the fly. - */ -extern void to_utmp(char *, char *, int); - -int -readv(int fd, struct iovec *iov, int iovcnt) -{ - return (bc_readv(fd, iov, iovcnt)); -} - -int -bc_readv(int fd, struct iovec *iov, int iovcnt) -{ - int ret, off; - int i, size, total = 0; - char *nbuf; - - if (fd_get(fd) != -1) { - for (i = 0; i < iovcnt; i++) { - size = getmodsize(iov[i].iov_len, - sizeof (struct compat_utmp), - sizeof (struct utmpx)); - - if ((nbuf = (void *)malloc(size)) == NULL) { - fprintf(stderr, "readv: malloc failed\n"); - exit(-1); - } - - if ((ret = _read(fd, nbuf, size)) == -1) { - free(nbuf); - return (-1); - } - - to_utmp(iov[i].iov_base, nbuf, ret); - - ret = getmodsize(ret, sizeof (struct utmpx), - sizeof (struct compat_utmp)); - total += ret; - - free(nbuf); - } - return (total); - } - - return (_readv(fd, iov, iovcnt)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/rename.c b/usr/src/lib/libbc/libc/sys/sys5/rename.c deleted file mode 100644 index 4a534c0653..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/rename.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include <sys/syscall.h> -#include <sys/fcntl.h> - -int -rename(char *path1, char *path2) -{ - char buf2[256]; - - if (strcmp(path1, "/etc/utmp") == 0 || - strcmp(path1, "/var/adm/utmp") == 0) { - path1 = "/var/adm/utmpx"; - strcpy(buf2, path2); - strcat(buf2, "x"); - path2 = buf2; - } else if (strcmp(path1, "/var/adm/wtmp") == 0) { - path1 = "/var/adm/wtmpx"; - strcpy(buf2, path2); - strcat(buf2, "x"); - path2 = buf2; - } - - return (_syscall(SYS_renameat, AT_FDCWD, path1, AT_FDCWD, path2)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/rmdir.c b/usr/src/lib/libbc/libc/sys/sys5/rmdir.c deleted file mode 100644 index 61b12ef42a..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/rmdir.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include <sys/syscall.h> -#include <sys/fcntl.h> - -int -rmdir(char *d) -{ - - return (_syscall(SYS_unlinkat, AT_FDCWD, d, AT_REMOVEDIR)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/setgid.c b/usr/src/lib/libbc/libc/sys/sys5/setgid.c deleted file mode 100644 index fc3cf277ed..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/setgid.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1995, by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <errno.h> - -int -setgid(int gid) -{ - if (geteuid() == 0) - return (setregid(gid, gid)); - else - return (setregid(-1, gid)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/setgroups.c b/usr/src/lib/libbc/libc/sys/sys5/setgroups.c deleted file mode 100644 index 689d0165bd..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/setgroups.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * POSIX.1 compatible setgroups() routine - * This is needed while gid_t is not the same size as int (or whatever the - * syscall is using at the time). - */ - -#include <errno.h> -#include <sys/types.h> -#include <sys/param.h> -#include <sys/syscall.h> - -int -setgroups(int ngroups, gid_t grouplist[]) -{ - int glist[NGROUPS]; /* setgroups() syscall expects ints */ - int i; /* loop control */ - - if (ngroups > NGROUPS) { - errno = EINVAL; - return (-1); - } - for (i = 0; i < ngroups; i++) - glist[i] = (int)grouplist[i]; - return (_syscall(SYS_setgroups, ngroups, glist)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/setjmp.c b/usr/src/lib/libbc/libc/sys/sys5/setjmp.c deleted file mode 100644 index 3227218946..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/setjmp.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - - -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - - -#include <sys/setjmp.h> -#include "../common/ucontext.h" - -int _getsp(); - -int -setjmp(env) - jmp_buf env; -{ - register o_setjmp_struct_t *bp = (o_setjmp_struct_t *)env; - register int sp = _getsp(); - ucontext_t uc; - - /* - * Get the current machine context. - */ - uc.uc_flags = UC_STACK; - __getcontext(&uc); - - /* - * Note that the pc and former sp (fp) from the stack are valid - * because the call to __getcontext must flush the user windows - * to the stack. - */ - bp->sjs_flags = 0; - bp->sjs_sp = *((int *)sp+14); - bp->sjs_pc = *((int *)sp+15) + 0x8; - bp->sjs_sigmask[0] = 0; - bp->sjs_sigmask[1] = 0; - bp->sjs_sigmask[2] = 0; - bp->sjs_stack = uc.uc_stack; - - return (0); -} - - -void -longjmp(env, val) - jmp_buf env; - int val; -{ - o_setjmp_struct_t *bp = (o_setjmp_struct_t *)env; - setjmp_struct_t sjmp, *sp; - - sp = &sjmp; - sp->sjs_flags = bp->sjs_flags; - sp->sjs_sp = bp->sjs_sp; - sp->sjs_pc = bp->sjs_pc; - sp->sjs_fp = 0; - sp->sjs_i7 = 0; - sp->sjs_uclink = 0; - sp->sjs_sigmask[0] = bp->sjs_sigmask[0]; - sp->sjs_sigmask[1] = bp->sjs_sigmask[1]; - sp->sjs_sigmask[2] = bp->sjs_sigmask[2]; - sp->sjs_sigmask[3] = 0; - sp->sjs_stack = bp->sjs_stack; - _siglongjmp(sjmp, val); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/setpgrp.c b/usr/src/lib/libbc/libc/sys/sys5/setpgrp.c deleted file mode 100644 index d1f75e5097..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/setpgrp.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -extern int setsid(); - -int -setpgrp() -{ - - return (setsid()); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/setuid.c b/usr/src/lib/libbc/libc/sys/sys5/setuid.c deleted file mode 100644 index c5cfacff9e..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/setuid.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1995, by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -int -setuid(int uid) -{ - if (geteuid() == 0) - return (setreuid(uid, uid)); - else - return (setreuid(-1, uid)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/stat.c b/usr/src/lib/libbc/libc/sys/sys5/stat.c deleted file mode 100644 index 13d0726a41..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/stat.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include <sys/syscall.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/errno.h> - -extern int errno; - -int stat(path, buf) -char *path; -struct stat *buf; -{ - return(bc_stat(path, buf)); -} - -int bc_stat(path, buf) -char *path; -struct stat *buf; -{ - if (path == (char*)0) { - errno = EFAULT; - return (-1); - } - if ((buf == (struct stat*)0) || (buf == (struct stat*)-1)) { - errno = EFAULT; - return (-1); - } - return(stat_com(0, path, buf)); -} - - -int lstat(path, buf) -char *path; -struct stat *buf; -{ - return(bc_lstat(path, buf)); -} - -int bc_lstat(path, buf) -char *path; -struct stat *buf; -{ - return(stat_com(1, path, buf)); -} - diff --git a/usr/src/lib/libbc/libc/sys/sys5/statfs.c b/usr/src/lib/libbc/libc/sys/sys5/statfs.c deleted file mode 100644 index b2d663c20b..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/statfs.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/types.h> -#include <sys/vfs.h> - -int -statfs(char *s, struct statfs *b) -{ - return (statfs_com(s, b)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/symlink.c b/usr/src/lib/libbc/libc/sys/sys5/symlink.c deleted file mode 100644 index cf96a6cbd6..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/symlink.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. - */ - -#include <sys/syscall.h> -#include <sys/fcntl.h> - -int -symlink(char *t, char *f) -{ - return (_syscall(SYS_symlinkat, t, AT_FDCWD, f)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/truncate.c b/usr/src/lib/libbc/libc/sys/sys5/truncate.c deleted file mode 100644 index b322965d91..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/truncate.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/syscall.h> -#include <unistd.h> -#include <errno.h> -#include <sys/fcntl.h> -#include <sys/param.h> - -int -truncate(char *path, off_t length) -{ - int fd, ret = 0; - - if (strcmp(path, "/etc/mtab") == 0 || strcmp(path, "/etc/fstab") == 0) { - errno = ENOENT; - return (-1); - } - if ((fd = open(path, O_WRONLY)) == -1) { - return (-1); - } - - if (ftruncate(fd, length) == -1) { - close(fd); - return (-1); - } - close(fd); - return (0); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/unlink.c b/usr/src/lib/libbc/libc/sys/sys5/unlink.c deleted file mode 100644 index 7c30c45f0d..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/unlink.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include <sys/syscall.h> -#include <sys/fcntl.h> - -int -unlink(const char *path) -{ - if (strcmp(path, "/etc/utmp") == 0 || - strcmp(path, "/var/adm/utmp") == 0) - path = "/var/adm/utmpx"; - else if (strcmp(path, "/var/adm/wtmp") == 0) - path = "/var/adm/wtmpx"; - - return (_syscall(SYS_unlinkat, AT_FDCWD, path, 0)); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/write.c b/usr/src/lib/libbc/libc/sys/sys5/write.c deleted file mode 100644 index d385a23077..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/write.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1999 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "../common/compat.h" -#include <stdio.h> -#include <sys/types.h> -#include <unistd.h> - -/* - * If writing to a utmp-like file, map the utmp structure to - * new format on the fly. - */ -extern int conv2utmpx(char *, char *, int); - -int -write(int fd, char *buf, int size) -{ - return (bc_write(fd, buf, size)); -} - -int -bc_write(int fd, char *buf, int size) -{ - int ret, off; - int nsize; - char *nbuf; - - if (fd_get(fd) != -1) { - nsize = getmodsize(size, sizeof (struct compat_utmp), - sizeof (struct utmpx)); - - if ((nbuf = (void *)malloc(nsize)) == NULL) { - (void) fprintf(stderr, "write: malloc failed\n"); - exit(-1); - } - - (void) memset(nbuf, 0, nsize); - - ret = conv2utmpx(nbuf, buf, size); - - if ((ret = _write(fd, nbuf, ret)) == -1) { - free(nbuf); - return (-1); - } - - free(nbuf); - - ret = getmodsize(ret, sizeof (struct utmpx), - sizeof (struct compat_utmp)); - return (ret); - } - - return (_write(fd, buf, size)); -} - -/* From SunOS/SVR4 utmp.h */ -#define USER_PROCESS 7 -#define DEAD_PROCESS 8 - -extern int -conv2utmpx(char *nbuf, char *buf, int len) -{ - struct compat_utmp *ut; - struct utmpx *utx; - - utx = (struct utmpx *) nbuf; - ut = (struct compat_utmp *) buf; - - while ((char *)ut < (buf + len)) { - (void) strcpy(utx->ut_user, ut->ut_name); - (void) memset(utx->ut_id, 0, sizeof (utx->ut_id)); - (void) strcpy(utx->ut_line, ut->ut_line); - utx->ut_pid = 0; - if ((strcmp(utx->ut_user, "") == 0) && - (strcmp(utx->ut_host, "") == 0)) - utx->ut_type = DEAD_PROCESS; - else - utx->ut_type = USER_PROCESS; - utx->ut_exit.e_termination = 0; - utx->ut_exit.e_exit = 0; - utx->ut_tv.tv_sec = ut->ut_time; - utx->ut_tv.tv_usec = 0; - utx->ut_session = 0; - utx->ut_syslen = sizeof (ut->ut_name) + 1; - (void) strcpy(utx->ut_host, ut->ut_host); - ut++; - utx++; - } - return ((char *) utx - nbuf); -} diff --git a/usr/src/lib/libbc/libc/sys/sys5/writev.c b/usr/src/lib/libbc/libc/sys/sys5/writev.c deleted file mode 100644 index a833f4e3a2..0000000000 --- a/usr/src/lib/libbc/libc/sys/sys5/writev.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "../common/compat.h" -#include <stdio.h> -#include <sys/types.h> -#include <unistd.h> -#include <sys/uio.h> - -/* - * If writing to a utmp-like file, map the utmp structure to - * new format on the fly. - */ -extern int conv2utmpx(char *, char *, int); - -int -writev(int fd, struct iovec *iov, int iovcnt) -{ - return (bc_writev(fd, iov, iovcnt)); -} - -int -bc_writev(int fd, struct iovec *iov, int iovcnt) -{ - int ret, off; - int nsize, total = 0; - char *nbuf; - int i; - - if (fd_get(fd) != -1) { - for (i = 0; i < iovcnt; i++) { - nsize = getmodsize(iov[i].iov_len, - sizeof (struct compat_utmp), - sizeof (struct utmpx)); - - if ((nbuf = (void *)malloc(nsize)) == NULL) { - fprintf(stderr, "writev: malloc failed\n"); - exit(-1); - } - - (void) memset(nbuf, 0, nsize); - - ret = conv2utmpx(nbuf, iov[i].iov_base, iov[i].iov_len); - - if ((ret = _write(fd, nbuf, ret)) == -1) { - free(nbuf); - return (-1); - } - - free(nbuf); - - ret = getmodsize(ret, sizeof (struct utmpx), - sizeof (struct compat_utmp)); - total += ret; - } - return (total); - } - - return (_writev(fd, iov, iovcnt)); -} diff --git a/usr/src/lib/libbc/libc/yp/yp_bind.c b/usr/src/lib/libbc/libc/yp/yp_bind.c deleted file mode 100644 index 904b153ab4..0000000000 --- a/usr/src/lib/libbc/libc/yp/yp_bind.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1992 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <errno.h> -#include <sys/time.h> -#include <rpc/rpc.h> -#include <rpc/pmap_prot.h> -#include <sys/socket.h> -#include <sys/file.h> -#include <sys/syslog.h> - -#include "yp_prot.h" -#include "ypv1_prot.h" -#include "ypclnt.h" - -/* - * This is the same as struct dom_binding used by the base __yp_dobind(). - * Named differently here to avoid name conflict with the compat - * struct dom_binding. - */ - -/* Copied from base <sys/netconfig.h> */ - -struct netconfig { - char *nc_netid; /* network identifier */ - unsigned long nc_semantics; /* defined below */ - unsigned long nc_flag; /* defined below */ - char *nc_protofmly; /* protocol family name */ - char *nc_proto; /* protocol name */ - char *nc_device; /* device name for network id */ - unsigned long nc_nlookups; /* # of entries in nc_lookups */ - char **nc_lookups; /* list of lookup directories */ - unsigned long nc_unused[8]; -}; - -/* Copied from base <sys/tiuser.h> */ - -struct netbuf { - unsigned int maxlen; - unsigned int len; - char *buf; -}; - -struct s5_dom_binding { - struct s5_dom_binding *dom_next; - char *dom_domain; - struct s5_ypbind_binding *dom_binding; - CLIENT *dom_client; -}; - -struct s5_ypbind_binding { - struct netconfig *ypbind_conf; - struct netbuf *ypbind_svcaddr; - char *ypbind_servername; - long ypbind_hi_vers; - long ypbind_lo_vers; -}; - -static void _yp_unbind(); -static struct dom_binding *load_dom_binding_cache(); - -static struct dom_binding *bound_domains; /* List of bound domains */ - -/* - * This is a "wrapper" function that is implemented by the yp_bind() - * function in base libnsl/yp. - */ -#ifdef NOTDEFINED -int -yp_bind(domain) - char *domain; -{ - /* XXX */ - _yp_bind(domain); -} -#endif - -/* - * Attempts to find a dom_binding in the list at bound_domains having the - * domain name field equal to the passed domain name, and removes it if found. - * The domain-server binding will not exist after the call to this function. - * All resources associated with the binding will be freed. - */ -#ifdef NOTDEFINED -void -yp_unbind (domain) - char *domain; -{ - _yp_unbind(domain); /* clean our local cache */ - /* XXX */ - _yp_unbind(domain); -} -#endif - -/* - * This is a wrapper around the yp_get_default_domain() - * function in base libnsl/yp. - */ -#ifdef NOTDEFINED -int -yp_get_default_domain(domain) - char **domain; -{ - /* XXX */ - _yp_get_default_domain(domain); -} -#endif - -/* - * Attempts to locate a NIS server that serves a passed domain. - * This is a wrapper around the __yp_dobind() function in base - * libnsl/yp; it converts the libnsl [netbuf based] dom_binding structure into - * the [sockaddr based] one that is expected by binary compat apps. Note that, - * the wrapper must allocate memory resources in order to hold - * the - */ -int -_yp_dobind(domain, binding) - char *domain; - struct dom_binding **binding; /* if result == 0, ptr to dom_binding */ -{ - int retval; - struct s5_dom_binding *dom_binding; /* Ptr to dom_binding from libnsl __yp_dobind() */ - int status; - - /* XXX */ - retval = __yp_dobind(domain, &dom_binding); - if (retval != 0) - return(retval); - - if ((*binding = load_dom_binding_cache(domain, dom_binding)) == NULL) - return (YPERR_RESRC); /* make sure it is in our cache */ - return (0); /* This is the go path */ -} - - -/* - * This allocates some memory for a domain binding, initialize it, and - * returns a pointer to it. Based on the program version we ended up - * talking to ypbind with, fill out an opvector of appropriate protocol - * modules. - */ -static struct dom_binding * -load_dom_binding_cache(domain, dom_binding) - char *domain; - struct s5_dom_binding *dom_binding; -{ - struct dom_binding *pdomb = NULL; - struct sockaddr_in *sa; /* To get a port bound to socket */ - struct sockaddr_in local_name; - int local_name_len = sizeof(struct sockaddr_in); - - - for (pdomb = bound_domains; pdomb != NULL; pdomb = pdomb->dom_pnext) { - if (strcmp(domain, pdomb->dom_domain) == 0) - return (pdomb); - } - - if ((pdomb = (struct dom_binding *) malloc(sizeof(struct dom_binding))) - == NULL) { - (void) syslog(LOG_ERR, "load_dom_binding_cache: malloc failure."); - return (struct dom_binding *) (NULL); - } - - sa = (struct sockaddr_in *)dom_binding->dom_binding->ypbind_svcaddr->buf; - pdomb->dom_server_addr.sin_family = sa->sin_family; - pdomb->dom_server_addr.sin_port = sa->sin_port; - pdomb->dom_server_addr.sin_addr.s_addr = sa->sin_addr.s_addr; - bzero(pdomb->dom_server_addr.sin_zero, 8); - pdomb->dom_server_port = sa->sin_port; - pdomb->dom_socket = RPC_ANYSOCK; - pdomb->dom_vers = dom_binding->dom_binding->ypbind_hi_vers; - /* the claim is 5.0 CLIENT * can be used by a 4.x RPC user */ - pdomb->dom_client = dom_binding->dom_client; - - (void) strcpy(pdomb->dom_domain, domain);/* Remember the domain name */ - pdomb->dom_pnext = bound_domains; /* Link this to the list as */ - bound_domains = pdomb; /* ... the head entry */ - - return (pdomb); -} - -static void -_yp_unbind (domain) - char *domain; -{ - struct dom_binding *pdomb; - struct dom_binding *ptrail = 0; - - - if ( (domain == NULL) ||(strlen(domain) == 0) ) { - return; - } - - for (pdomb = bound_domains; pdomb != NULL; - ptrail = pdomb, pdomb = pdomb->dom_pnext) { - - if (strcmp(domain, pdomb->dom_domain) == 0) { - if (pdomb == bound_domains) - bound_domains = pdomb->dom_pnext; - else - ptrail->dom_pnext = pdomb->dom_pnext; - free((char *) pdomb); - break; - } - } -} - -int -yp_ismapthere(stat) - int stat; -{ - - switch (stat) { - - case 0: /* it actually succeeded! */ - case YPERR_KEY: /* no such key in map */ - case YPERR_NOMORE: - case YPERR_BUSY: - return (TRUE); - } - return (FALSE); -} diff --git a/usr/src/lib/libbc/libc/yp/yp_prot.h b/usr/src/lib/libbc/libc/yp/yp_prot.h deleted file mode 100644 index 54f78c52d3..0000000000 --- a/usr/src/lib/libbc/libc/yp/yp_prot.h +++ /dev/null @@ -1,347 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1997 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * This file contains symbols and structures defining the rpc protocol - * between the NIS clients and the NIS servers. The servers - * are the NIS database servers, and the NIS binders. - */ - -/* - * The following procedures are supported by the protocol: - * - * YPPROC_NULL() returns () takes nothing, returns nothing. This indicates - * that the NIS server is alive. - * - * YPPROC_DOMAIN (char *) returns (bool_t) TRUE. Indicates that the - * responding NIS server does serve the named domain; FALSE indicates no - * support. - * - * YPPROC_DOMAIN_NONACK (char *) returns (TRUE) if the NIS server does serve - * the named domain, otherwise does not return. Used in the broadcast case. - * - * YPPROC_MATCH (struct ypreq_key) returns (struct ypresp_val). Returns the - * right-hand value for a passed left-hand key, within a named map and - * domain. - * - * YPPROC_FIRST (struct ypreq_nokey) returns (struct ypresp_key_val). - * Returns the first key-value pair from a named domain and map. - * - * YPPROC_NEXT (struct ypreq_key) returns (struct ypresp_key_val). Returns - * the key-value pair following a passed key-value pair within a named - * domain and map. - * - * YPPROC_XFR (struct ypreq_xfr) returns nothing. Indicates to a server that - * a map should be updated. - * - * YPPROC_CLEAR takes nothing, returns nothing. Instructs a NIS server to - * close the current map, so that old versions of the disk file don't get - * held open. - * - * YPPROC_ALL (struct ypreq_nokey), returns - * union switch (bool more) { - * TRUE: (struct ypresp_key_val); - * FALSE: (struct) {}; - * } - * - * YPPROC_MASTER (struct ypreq_nokey), returns (ypresp_master) - * - * YPPROC_ORDER (struct ypreq_nokey), returns (ypresp_order) - * - * YPPROC_MAPLIST (char *), returns (struct ypmaplist *) - */ -#ifndef BOOL_DEFINED -typedef unsigned int bool; -#define BOOL_DEFINED -#endif - -extern bool xdr_datum(); -extern bool xdr_ypdomain_wrap_string(); -extern bool xdr_ypmap_wrap_string(); -extern bool xdr_ypreq_key(); -extern bool xdr_ypreq_nokey(); -extern bool xdr_ypreq_xfr(); -extern bool xdr_ypresp_val(); -extern bool xdr_ypresp_key_val(); -extern bool xdr_ypbind_resp(); -extern bool xdr_ypbind_setdom(); -extern bool xdr_yp_inaddr(); -extern bool xdr_ypmap_parms(); -extern bool xdr_ypowner_wrap_string(); -extern bool xdr_yppushresp_xfr(); -extern bool xdr_ypresp_order(); -extern bool xdr_ypresp_master(); -extern bool xdr_ypall(); -extern bool xdr_ypresp_maplist(); - -/* Program and version symbols, magic numbers */ - -#define YPPROG ((u_long)100004) -#define YPVERS ((u_long)2) -#define YPVERS_ORIG ((u_long)1) -#define YPMAXRECORD ((u_long)1024) -#define YPMAXDOMAIN ((u_long)256) -#define YPMAXMAP ((u_long)64) -#define YPMAXPEER ((u_long)256) - -/* byte size of a large NIS packet */ -#define YPMSGSZ 1600 - -#ifndef DATUM -typedef struct { - char *dptr; - int dsize; -} datum; -#define DATUM -#endif - -struct ypmap_parms { - char *domain; /* Null string means not available */ - char *map; /* Null string means not available */ - unsigned long int ordernum; /* 0 means not available */ - char *owner; /* Null string means not available */ -}; - -/* - * Request parameter structures - */ - -struct ypreq_key { - char *domain; - char *map; - datum keydat; -}; - -struct ypreq_nokey { - char *domain; - char *map; -}; - -struct ypreq_xfr { - struct ypmap_parms map_parms; - unsigned long transid; - unsigned long proto; - unsigned short port; -}; -#define ypxfr_domain map_parms.domain -#define ypxfr_map map_parms.map -#define ypxfr_ordernum map_parms.ordernum -#define ypxfr_owner map_parms.owner - -/* - * Response parameter structures - */ - -struct ypresp_val { - long unsigned status; - datum valdat; -}; - -struct ypresp_key_val { - long unsigned status; - datum keydat; - datum valdat; -}; - -struct ypresp_master { - long unsigned status; - char *master; -}; - -struct ypresp_order { - long unsigned status; - unsigned long int ordernum; -}; - -struct ypmaplist { - char ypml_name[YPMAXMAP + 1]; - struct ypmaplist *ypml_next; -}; - -struct ypresp_maplist { - long unsigned status; - struct ypmaplist *list; -}; - -/* - * Procedure symbols. YPPROC_NULL, YPPROC_DOMAIN, and YPPROC_DOMAIN_NONACK - * must keep the same values (0, 1, and 2) that they had in the first version - * of the protocol. - */ - -#define YPPROC_NULL ((u_long)0) -#define YPPROC_DOMAIN ((u_long)1) -#define YPPROC_DOMAIN_NONACK ((u_long)2) -#define YPPROC_MATCH ((u_long)3) -#define YPPROC_FIRST ((u_long)4) -#define YPPROC_NEXT ((u_long)5) -#define YPPROC_XFR ((u_long)6) -#define YPPROC_CLEAR ((u_long)7) -#define YPPROC_ALL ((u_long)8) -#define YPPROC_MASTER ((u_long)9) -#define YPPROC_ORDER ((u_long)10) -#define YPPROC_MAPLIST ((u_long)11) - -/* Return status values */ - -#define YP_TRUE ((long)1) /* General purpose success code */ -#define YP_NOMORE ((long)2) /* No more entries in map */ -#define YP_FALSE ((long)0) /* General purpose failure code */ -#define YP_NOMAP ((long)-1) /* No such map in domain */ -#define YP_NODOM ((long)-2) /* Domain not supported */ -#define YP_NOKEY ((long)-3) /* No such key in map */ -#define YP_BADOP ((long)-4) /* Invalid operation */ -#define YP_BADDB ((long)-5) /* Server data base is bad */ -#define YP_YPERR ((long)-6) /* NIS server error */ -#define YP_BADARGS ((long)-7) /* Request arguments bad */ -#define YP_VERS ((long)-8) /* NIS server version mismatch - server - * can't supply requested service. */ - -/* - * Domain binding data structure, used by ypclnt package and ypserv modules. - * Users of the ypclnt package (or of this protocol) don't HAVE to know about - * it, but it must be available to users because _yp_dobind is a public - * interface. - */ - -struct dom_binding { - struct dom_binding *dom_pnext; - char dom_domain[YPMAXDOMAIN + 1]; - struct sockaddr_in dom_server_addr; - unsigned short int dom_server_port; - int dom_socket; - CLIENT *dom_client; - unsigned short int dom_local_port; - long int dom_vers; -}; - - -/* - * Protocol between clients and NIS binder servers - */ - -/* - * The following procedures are supported by the protocol: - * - * YPBINDPROC_NULL() returns () - * takes nothing, returns nothing - * - * YPBINDPROC_DOMAIN takes (char *) returns (struct ypbind_resp) - * - * YPBINDPROC_SETDOM takes (struct ypbind_setdom) returns nothing - */ - -/* Program and version symbols, magic numbers */ - -#define YPBINDPROG ((u_long)100007) -#define YPBINDVERS ((u_long)2) -#define YPBINDVERS_ORIG ((u_long)1) - -/* Procedure symbols */ - -#define YPBINDPROC_NULL ((u_long)0) -#define YPBINDPROC_DOMAIN ((u_long)1) -#define YPBINDPROC_SETDOM ((u_long)2) -/* - * Response structure and overall result status codes. Success and failure - * represent two separate response message types. - */ - -enum ypbind_resptype {YPBIND_SUCC_VAL = 1, YPBIND_FAIL_VAL = 2}; - -struct ypbind_binding { - struct in_addr ypbind_binding_addr; /* In network order */ - unsigned short int ypbind_binding_port; /* In network order */ -}; -struct ypbind_resp { - enum ypbind_resptype ypbind_status; - union { - unsigned long ypbind_error; - struct ypbind_binding ypbind_bindinfo; - } ypbind_respbody; -}; - - -/* Detailed failure reason codes for response field ypbind_error*/ - -#define YPBIND_ERR_ERR 1 /* Internal error */ -#define YPBIND_ERR_NOSERV 2 /* No bound server for passed domain */ -#define YPBIND_ERR_RESC 3 /* System resource allocation failure */ - -/* - * Request data structure for ypbind "Set domain" procedure. - */ -struct ypbind_setdom { - char ypsetdom_domain[YPMAXDOMAIN + 1]; - struct ypbind_binding ypsetdom_binding; - unsigned short ypsetdom_vers; -}; -#define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr -#define ypsetdom_port ypsetdom_binding.ypbind_binding_port - -/* - * Protocol between clients (ypxfr, only) and yppush - * yppush speaks a protocol in the transient range, which - * is supplied to ypxfr as a command-line parameter when it - * is activated by ypserv. - */ -#define YPPUSHVERS ((u_long) 1) -#define YPPUSHVERS_ORIG ((u_long)1) - -/* Procedure symbols */ - -#define YPPUSHPROC_NULL ((u_long)0) -#define YPPUSHPROC_XFRRESP ((u_long)1) - -struct yppushresp_xfr { - unsigned long transid; - unsigned long status; -}; - -/* Status values for yppushresp_xfr.status */ - -#define YPPUSH_SUCC ((long)1) /* Success */ -#define YPPUSH_AGE ((long)2) /* Master's version not newer */ -#define YPPUSH_NOMAP ((long)-1) /* Can't find server for map */ -#define YPPUSH_NODOM ((long)-2) /* Domain not supported */ -#define YPPUSH_RSRC ((long)-3) /* Local resouce alloc failure */ -#define YPPUSH_RPC ((long)-4) /* RPC failure talking to server */ -#define YPPUSH_MADDR ((long)-5) /* Can't get master address */ -#define YPPUSH_YPERR ((long)-6) /* NIS server/map db error */ -#define YPPUSH_BADARGS ((long)-7) /* Request arguments bad */ -#define YPPUSH_DBM ((long)-8) /* Local dbm operation failed */ -#define YPPUSH_FILE ((long)-9) /* Local file I/O operation failed */ -#define YPPUSH_SKEW ((long)-10) /* Map version skew during transfer */ -#define YPPUSH_CLEAR ((long)-11) /* Can't send "Clear" req to local - * ypserv */ -#define YPPUSH_FORCE ((long)-12) /* No local order number in map - - * use -f flag. */ -#define YPPUSH_XFRERR ((long)-13) /* ypxfr error */ -#define YPPUSH_REFUSED ((long)-14) /* Transfer request refused by ypserv */ - - diff --git a/usr/src/lib/libbc/libc/yp/ypclnt.h b/usr/src/lib/libbc/libc/yp/ypclnt.h deleted file mode 100644 index e2404c5c06..0000000000 --- a/usr/src/lib/libbc/libc/yp/ypclnt.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1991 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * ypclnt.h - * This defines the symbols used in the c language - * interface to the NIS client functions. A description of this interface - * can be read in ypclnt(3N). - */ - -/* - * Failure reason codes. The success condition is indicated by a functional - * value of "0". - */ -#define YPERR_BADARGS 1 /* Args to function are bad */ -#define YPERR_RPC 2 /* RPC failure */ -#define YPERR_DOMAIN 3 /* Can't bind to a server which serves - * this domain. */ -#define YPERR_MAP 4 /* No such map in server's domain */ -#define YPERR_KEY 5 /* No such key in map */ -#define YPERR_YPERR 6 /* Internal NIS server or client - * interface error */ -#define YPERR_RESRC 7 /* Local resource allocation failure */ -#define YPERR_NOMORE 8 /* No more records in map database */ -#define YPERR_PMAP 9 /* Can't communicate with portmapper */ -#define YPERR_YPBIND 10 /* Can't communicate with ypbind */ -#define YPERR_YPSERV 11 /* Can't communicate with ypserv */ -#define YPERR_NODOM 12 /* Local domain name not set */ -#define YPERR_BADDB 13 /* NIS data base is bad */ -#define YPERR_VERS 14 /* NIS version mismatch */ -#define YPERR_ACCESS 15 /* Access violation */ -#define YPERR_BUSY 16 /* Database is busy */ - -/* - * Types of update operations - */ -#define YPOP_CHANGE 1 /* change, do not add */ -#define YPOP_INSERT 2 /* add, do not change */ -#define YPOP_DELETE 3 /* delete this entry */ -#define YPOP_STORE 4 /* add, or change */ - - - -/* - * Data definitions - */ - -/* - * struct ypall_callback * is the arg which must be passed to yp_all - */ - -struct ypall_callback { - int (*foreach)(); /* Return non-0 to stop getting - * called */ - char *data; /* Opaque pointer for use of callback - * function */ -}; - -/* - * External NIS client function references. - */ -extern int yp_bind(); -extern int _yp_dobind(); -extern void yp_unbind(); -extern int yp_get_default_domain (); -extern int yp_match (); -extern int yp_first (); -extern int yp_next(); -extern int yp_master(); -extern int yp_order(); -extern int yp_all(); -extern int yp_match(); -extern char *yperr_string(); -extern int ypprot_err(); - -/* - * Global NIS data structures - */ diff --git a/usr/src/lib/libbc/libc/yp/ypv1_prot.h b/usr/src/lib/libbc/libc/yp/ypv1_prot.h deleted file mode 100644 index 54d2c461b5..0000000000 --- a/usr/src/lib/libbc/libc/yp/ypv1_prot.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * This contains symbol and structure definitions used in supporting the old - * "v1" protocol. They were previously defined in yp_prot.h. - * - * This file exists so that the NIS system can provide backward compatibility. - * Normal NIS client processes should not use this interface: the old - * protocol will not be supported in the next release. - */ -#define YPOLDVERS (YPVERS - 1) -#define YPOLDPROC_NULL ((u_long)0) -#define YPOLDPROC_DOMAIN ((u_long)1) -#define YPOLDPROC_DOMAIN_NONACK ((u_long)2) -#define YPOLDPROC_MATCH ((u_long)3) -#define YPOLDPROC_FIRST ((u_long)4) -#define YPOLDPROC_NEXT ((u_long)5) -#define YPOLDPROC_POLL ((u_long)6) -#define YPOLDPROC_PUSH ((u_long)7) -#define YPOLDPROC_PULL ((u_long)8) -#define YPOLDPROC_GET ((u_long)9) - -enum ypreqtype {YPREQ_KEY = 1, YPREQ_NOKEY = 2, YPREQ_MAP_PARMS = 3}; -struct yprequest { - enum ypreqtype yp_reqtype; - union { - struct ypreq_key yp_req_keytype; - struct ypreq_nokey yp_req_nokeytype; - struct ypmap_parms yp_req_map_parmstype; - }yp_reqbody; -}; - -#define YPMATCH_REQTYPE YPREQ_KEY -#define ypmatch_req_domain yp_reqbody.yp_req_keytype.domain -#define ypmatch_req_map yp_reqbody.yp_req_keytype.map -#define ypmatch_req_keydat yp_reqbody.yp_req_keytype.keydat -#define ypmatch_req_keyptr yp_reqbody.yp_req_keytype.keydat.dptr -#define ypmatch_req_keysize yp_reqbody.yp_req_keytype.keydat.dsize - -#define YPFIRST_REQTYPE YPREQ_NOKEY -#define ypfirst_req_domain yp_reqbody.yp_req_nokeytype.domain -#define ypfirst_req_map yp_reqbody.yp_req_nokeytype.map - -#define YPNEXT_REQTYPE YPREQ_KEY -#define ypnext_req_domain yp_reqbody.yp_req_keytype.domain -#define ypnext_req_map yp_reqbody.yp_req_keytype.map -#define ypnext_req_keydat yp_reqbody.yp_req_keytype.keydat -#define ypnext_req_keyptr yp_reqbody.yp_req_keytype.keydat.dptr -#define ypnext_req_keysize yp_reqbody.yp_req_keytype.keydat.dsize - -#define YPPUSH_REQTYPE YPREQ_NOKEY -#define yppush_req_domain yp_reqbody.yp_req_nokeytype.domain -#define yppush_req_map yp_reqbody.yp_req_nokeytype.map - -#define YPPULL_REQTYPE YPREQ_NOKEY -#define yppull_req_domain yp_reqbody.yp_req_nokeytype.domain -#define yppull_req_map yp_reqbody.yp_req_nokeytype.map - -#define YPPOLL_REQTYPE YPREQ_NOKEY -#define yppoll_req_domain yp_reqbody.yp_req_nokeytype.domain -#define yppoll_req_map yp_reqbody.yp_req_nokeytype.map - -#define YPGET_REQTYPE YPREQ_MAP_PARMS -#define ypget_req_domain yp_reqbody.yp_req_map_parmstype.domain -#define ypget_req_map yp_reqbody.yp_req_map_parmstype.map -#define ypget_req_ordernum yp_reqbody.yp_req_map_parmstype.ordernum -#define ypget_req_owner yp_reqbody.yp_req_map_parmstype.owner - -enum ypresptype {YPRESP_VAL = 1, YPRESP_KEY_VAL = 2, YPRESP_MAP_PARMS = 3}; -struct ypresponse { - enum ypresptype yp_resptype; - union { - struct ypresp_val yp_resp_valtype; - struct ypresp_key_val yp_resp_key_valtype; - struct ypmap_parms yp_resp_map_parmstype; - } yp_respbody; -}; - -#define YPMATCH_RESPTYPE YPRESP_VAL -#define ypmatch_resp_status yp_respbody.yp_resp_valtype.status -#define ypmatch_resp_valdat yp_respbody.yp_resp_valtype.valdat -#define ypmatch_resp_valptr yp_respbody.yp_resp_valtype.valdat.dptr -#define ypmatch_resp_valsize yp_respbody.yp_resp_valtype.valdat.dsize - -#define YPFIRST_RESPTYPE YPRESP_KEY_VAL -#define ypfirst_resp_status yp_respbody.yp_resp_key_valtype.status -#define ypfirst_resp_keydat yp_respbody.yp_resp_key_valtype.keydat -#define ypfirst_resp_keyptr yp_respbody.yp_resp_key_valtype.keydat.dptr -#define ypfirst_resp_keysize yp_respbody.yp_resp_key_valtype.keydat.dsize -#define ypfirst_resp_valdat yp_respbody.yp_resp_key_valtype.valdat -#define ypfirst_resp_valptr yp_respbody.yp_resp_key_valtype.valdat.dptr -#define ypfirst_resp_valsize yp_respbody.yp_resp_key_valtype.valdat.dsize - -#define YPNEXT_RESPTYPE YPRESP_KEY_VAL -#define ypnext_resp_status yp_respbody.yp_resp_key_valtype.status -#define ypnext_resp_keydat yp_respbody.yp_resp_key_valtype.keydat -#define ypnext_resp_keyptr yp_respbody.yp_resp_key_valtype.keydat.dptr -#define ypnext_resp_keysize yp_respbody.yp_resp_key_valtype.keydat.dsize -#define ypnext_resp_valdat yp_respbody.yp_resp_key_valtype.valdat -#define ypnext_resp_valptr yp_respbody.yp_resp_key_valtype.valdat.dptr -#define ypnext_resp_valsize yp_respbody.yp_resp_key_valtype.valdat.dsize - -#define YPPOLL_RESPTYPE YPRESP_MAP_PARMS -#define yppoll_resp_domain yp_respbody.yp_resp_map_parmstype.domain -#define yppoll_resp_map yp_respbody.yp_resp_map_parmstype.map -#define yppoll_resp_ordernum yp_respbody.yp_resp_map_parmstype.ordernum -#define yppoll_resp_owner yp_respbody.yp_resp_map_parmstype.owner - - -extern bool _xdr_yprequest(); -extern bool _xdr_ypresponse(); - -#define YPBINDOLDVERS (YPBINDVERS - 1) -struct ypbind_oldsetdom { - char ypoldsetdom_domain[YPMAXDOMAIN + 1]; - struct ypbind_binding ypoldsetdom_binding; -}; -#define ypoldsetdom_addr ypoldsetdom_binding.ypbind_binding_addr -#define ypoldsetdom_port ypoldsetdom_binding.ypbind_binding_port - -extern bool _xdr_ypbind_oldsetdom(); diff --git a/usr/src/lib/libbc/sparc/Makefile b/usr/src/lib/libbc/sparc/Makefile deleted file mode 100644 index a15a6356b1..0000000000 --- a/usr/src/lib/libbc/sparc/Makefile +++ /dev/null @@ -1,476 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2019 Peter Tribble. -# - -# -# This builds all objects needed for libbc. -# - -LIBRARY= libc.a -# Default rules in ../../Makefile.targ not used. -VERS= bogus -DYNLIB4X= libc.so.1.9 -DYNLIBS5= libc.so.2.9 -#DYNLIBS5 is also defined in ../Makefile - -M4= m4 -ECHO= echo - -# objects are grouped by source directory. - -COMPATCOM= \ -gtty.o lockf.o pause.o stty.o tell.o ulimit.o \ -utime.o - -COMPAT4.1=\ -ftime.o nice.o rand.o vlimit.o vtimes.o getpw.o times.o - -COMPATSYS5=\ -nice.o rand.o getpw.o times.o - -CRTSPARC =\ -_ftou.o misalign.o ptr_call.o \ -start_float.o \ -alloc_pbuf.o mon.o muldiv.o - -GENCOM=\ -_crypt.o _nlist.o _perror.o _psignal.o a64l.o abs.o alarm.o\ -asctime.o atof.o atoi.o atol.o bcmp.o bsearch.o\ -clock.o closedir.o crypt.o ctime.o ctype_.o\ -drand48.o dysize.o errlst.o execvp.o exit.o exportent.o ecvt.o\ -fabs.o fmod.o frexp.o\ -fstab.o ftok.o ftw.o getauid.o getauditflags.o \ -getcwd.o getenv.o getgraent.o getlogin.o \ -getopt.o getsubopt.o getpwaent.o getttyent.o\ -getttynam.o getusershell.o grpauth.o hsearch.o\ -ieee_globals.o index.o isatty.o \ -issecure.o jcsetpgrp.o\ -l64a.o labeltostring.o ldexp.o lfind.o lsearch.o\ -madvise.o mallopt.o \ -euc.multibyte.o iso.multibyte.o xccs.multibyte.o \ -mblib.o mbstowcs.o mbtowc.o wcstombs.o wctomb.o \ -memalign.o memccpy.o memchr.o memcmp.o\ -mkstemp.o mktemp.o mlock.o mlockall.o\ -mntent.o modf.o msync.o munlock.o munlockall.o\ -nl_cxtime.o nl_strncmp.o ndbm.o on_exit.o\ -opendir.o optind.o perror.o plock.o \ -posix_sig.o posix_tty.o popen.o psignal.o putenv.o \ -pwdauth.o pwdnm.o qsort.o\ -random.o readdir.o realpath.o regex.o rindex.o scandir.o seekdir.o\ -setlocale.o setregid.o setreuid.o setrgid.o setruid.o sigfpe.o siglist.o\ -ssignal.o strchr.o stricmp.o \ -strftime.o strncat.o \ -strpbrk.o strptime.o strrchr.o strspn.o strstr.o \ -strtod.o strtok.o strtol.o swab.o syslog.o\ -telldir.o tfind.o time.o tsearch.o \ -ualarm.o usleep.o valloc.o string_decim.o \ -file_decim.o func_decim.o econvert.o seconvert.o gconvert.o \ -decimal_bin.o float_decim.o double_decim.o \ -pack_float.o _unpack_dble.o unpack_float.o \ -_base_S.o _base_il.o _base_sup.o _big_power.o _small_power.o \ -_sprintf_sup.o _times_power.o qeconvert.o \ -_Q_neg.o _Q_add.o _Q_sub.o _Q_mul.o _Q_div.o _Q_cmp.o \ -_Q_cmpe.o _Q_stoq.o _Q_dtoq.o _Q_itoq.o _Q_utoq.o _Q_qtos.o _Q_qtod.o \ -_Q_qtoi.o _Q_qtou.o _Q_sqrt.o _Qfaddsub.o _Qfcompare.o _Qfdiv.o \ -_Qfmul.o _Qfpack.o _Qfunpack.o _Qfutility.o _Q_fcc.o _Q_get_rp_rd.o \ -calloc.o malloc.o \ -getpass.o localtime.o ttyslot.o - -GENCOMSPARC=\ -alloca.o ffs.o insque.o remque.o isinf.o base_conv.o - -GEN4.2=\ -nlist.o timezone.o sleep.o system.o - -GENSYS5=\ -assert.o nlist.o sgetl.o sleep.o sputl.o system.o \ -sighold.o - -STDIOCOM=\ -clrerr.o ctermid.o cuserid.o doprnt.o doscan.o fdopen.o \ -feof.o ferror.o fgetc.o fgets.o fileno.o findiop.o \ -fputc.o fputs.o fread.o fseek.o ftell.o \ -fwrite.o getc.o getchar.o gets.o getw.o iob.o \ -putc.o putchar.o puts.o putw.o remove.o \ -rew.o scanf.o setbuffer.o setvbuf.o tmpnam.o tempnam.o \ -tmpfile.o ungetc.o - -STDIO4.2=\ -filbuf.o fopen.o fprintf.o printf.o flsbuf.o setbuf.o \ -sprintf.o vfprintf.o vprintf.o vsprintf.o - -STDIOSYS5=\ -filbuf.o fopen.o fprintf.o flsbuf.o printf.o setbuf.o \ -sprintf.o vfprintf.o vprintf.o vsprintf.o - -SYSCOM=\ -_access.o acct.o adjtime.o close.o _creat.o dup.o dup2.o \ -fchdir.o fchroot.o \ -fdlist.o flock.o fpathconf.o fsync.o ftruncate.o getdents.o \ -getdtablesize.o getgid.o getitimer.o getpid.o gettimeofday.o \ -getuid.o ioctl.o kill.o lseek.o mincore.o mprotect.o munmap.o\ -_open.o profil.o setitimer.o \ -rlimit.o _statfs.o sync.o umask.o uname.o\ -execl.o execle.o execv.o mkfifo.o msgsys.o\ -pathconf.o semsys.o shmsys.o unmount.o wait.o setuid.o\ -setgid.o _stat.o seteuid.o setegid.o signalmap.o syscall.o \ -maperror.o sigsetjmp.o accept.o bind.o connect.o getpeername.o \ -getsockname.o getsockopt.o listen.o recv.o send.o \ -setsockopt.o shutdown.o socket.o socketpair.o setsid.o sigaction.o - -SYSCOMSPARC=\ -_exit.o brk.o cerror.o errno.o \ -getegid.o geteuid.o getppid.o mmap.o pipe.o putmsg.o \ -sbrk.o _syscall.o getmsg.o _read.o _write.o \ -_readv.o _writev.o sendsig.o - -SYS4.2=\ -access.o chdir.o chmod.o chown.o chroot.o \ -creat.o execve.o getpgrp.o link.o mkdir.o \ -mknod.o open.o readlink.o rename.o rmdir.o \ -setpgrp.o stat.o symlink.o truncate.o unlink.o \ -statfs.o fcntl.o read.o write.o readv.o \ -writev.o setjmp.o mount.o - -SYS4.2SPARC=\ -getgroups.o setgroups.o - -SYSSYS5=\ -access.o chdir.o chmod.o chown.o chroot.o \ -creat.o execve.o getgroups.o getpgrp.o link.o \ -mkdir.o mknod.o open.o readlink.o rename.o \ -rmdir.o setgroups.o setpgrp.o stat.o statfs.o \ -stime.o symlink.o truncate.o unlink.o fcntl.o \ -read.o write.o readv.o writev.o setjmp.o \ -mount.o - -#SSYSSPARC=\ -#_getpgrp.o _kill.o _lseek.o _mknod.o _mount.o _setpgrp.o \ -#umount.o - -INET=\ -inet_addr.o inet_lnaof.o inet_makeaddr.o inet_netof.o \ -inet_network.o inet_ntoa.o - -NET=\ -ether_addr.o bindresvport.o getrpcport.o rcmd.o \ -rexec.o ruserpass.o authunix.o - -NETSPARC= htonl.o htons.o ntohl.o ntohs.o - -YP= yp_bind.o - -YP= yp_bind.o -PSEUDO_SRCS= adjtime.s fchdir.s \ -fchroot.s \ -fpathconf.s getitimer.s getpid.s \ -mincore.s mprotect.s munmap.s \ -profil.s setitimer.s \ -sync.s sysconf.s umask.s ustat.s \ -acct.s stime.s - -# -# libbc build rules -pics/%.o s5pics/%.o : ../libc/compat/common/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%.o : ../libc/compat/4.1/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -s5pics/%.o : ../libc/compat/sys5/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%.o s5pics/%.o : ../libc/crt/sparc/%.s - $(BUILD.s) - $(POST_PROCESS_O) - -pics/%.o s5pics/%.o : ../libc/crt/sparc/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%.o s5pics/%.o : ../csu/common/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%.o s5pics/%.o : ../libc/gen/common/%.S - $(BUILD.s) - $(POST_PROCESS_O) - -pics/%.o s5pics/%.o : ../libc/gen/common/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%.o s5pics/%.o : ../libc/gen/common/sparc/%.s - $(BUILD.s) - $(POST_PROCESS_O) - -pics/%.o s5pics/%.o : ../libc/gen/common/sparc/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%.o : ../libc/gen/4.2/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -s5pics/%.o : ../libc/gen/sys5/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%.o s5pics/%.o : ../libc/inet/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%.o s5pics/%.o : ../libc/net/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%.o s5pics/%.o : ../libc/net/sparc/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%.o s5pics/%.o : ../libc/stdio/common/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%.o : ../libc/stdio/4.2/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -s5pics/%.o : ../libc/stdio/sys5/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%.o s5pics/%.o : ../libc/sys/common/%.s - $(BUILD.s) - $(POST_PROCESS_O) - -pics/%.o s5pics/%.o : ../libc/sys/common/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%.o s5pics/%.o : ../libc/sys/common/sparc/%.s - $(BUILD.s) - $(POST_PROCESS_O) - -pics/%.o : ../libc/sys/4.2/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%.o : ../libc/sys/4.2/sparc/%.s - $(BUILD.s) - $(POST_PROCESS_O) - -s5pics/%.o : ../libc/sys/sys5/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -s5pics/%.o : ../libc/sys/sys5/sparc/%.s - $(BUILD.s) - $(POST_PROCESS_O) - -s5pics/%.o : ../libc/stdio/sys5/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%.o s5pics/%.o : ../libc/rpc/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - -pics/%.o s5pics/%.o : ../libc/yp/%.c - $(COMPILE.c) -o $@ $< - $(POST_PROCESS_O) - - -# include common library definitions -include ../../Makefile.lib - -# There should be a mapfile here -MAPFILES = - -CSTD= $(CSTD_GNU89) - -# -# The BCP include files depend on old preprocessor semantics. -# -CCMODE = -Xt - -# the bcp libraries go in /usr/4lib. override ROOTLIBDIR from ../../Makefile.lib -# and save it so we can find the libraries with which to link -ROOTLIBDIR= $(ROOT)/usr/4lib - -CPPFLAGS= -Dsparc \ - -I. -Iinc -I../inc/include -I../inc/include/sys $(CPPFLAGS.master) -# -# contents of CPPFLAGS copied to ASFLAGS so it's immune to CPPFLAGS -# being changed later -# -ASFLAGS= -P -D__STDC__ -DLOCORE -D_SYS_SYS_S -D_ASM -Dsparc \ - -I. -Iinc -I../inc/include -I../inc/include/sys $(CPPFLAGS.master) -LDLIBS= -t -R/usr/ucblib -L$(ROOT)/usr/ucblib $(LDLIBS.lib) \ - -lucb -lc -lnsl -lsocket - -CERRWARN += -_gcc=-Wno-implicit-function-declaration -CERRWARN += -_gcc=-Wno-char-subscripts -CERRWARN += -_gcc=-Wno-extra -CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += $(CNOWARN_UNINIT) -CERRWARN += -_gcc=-Wno-unused -CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-address - -# SONAME is used by DYNFLAGS -$(DYNLIB4X) := SONAME = $(DYNLIB4X) -$(DYNLIBS5) := SONAME = $(DYNLIBS5) - -pics/%.o:= ASFLAGS += $(AS_PICFLAGS) -DPIC -pics/%.o:= CPPFLAGS += $(C_PICFLAGS) -DPIC -DYNFLAGS += $(ZINTERPOSE) - -BUILD.s= $(AS) $(ASFLAGS) $< -o $@ - -# libbc method of building an archive -BUILD.AR= $(RM) $@ ; \ - $(AR) q $@ $(OBJECTS:%=$(DIR)/%) - -# the TXTS macro is used for NSE bootstrapping. -TXTS= inc/SYS.h inc/PIC.h inc/machine/asm_linkage.h - -LIBS = $(DYNLIB4X) $(DYNLIBS5) - -OBJECTS= $(COMPATCOM) $(COMPAT4.1) $(CRTSPARC) $(GENCOM) \ -$(GENCOMSPARC) $(GEN4.2) $(STDIOCOM) $(STDIO4.2) \ -$(INET) $(NET) $(NETSPARC) $(YP) \ -$(SYSCOM) $(SYSCOMSPARC) $(SYS4.2) - -# -# Since this library is strictly for binary compability with ancient -# applications, we deactivate CTF to avoid kicking up dust. -# -CTFCONVERT_POST = : -CTFMERGE_LIB = : - -S5OBJECTS= $(COMPATCOM) $(COMPATSYS5) $(CRTSPARC) $(GENCOM) \ -$(GENCOMSPARC) $(GENSYS5) $(STDIOCOM) $(STDIOSYS5) \ -$(SYSCOM) $(SYSCOMSPARC) $(SYSSYS5) $(SSYS5SPARC) \ -$(INET) $(NET) $(NETSPARC) $(YP) - -S5PICOBJS= $(S5OBJECTS:%=s5pics/%) - -CLEANFILES= ../libc/yp/ypupdate_prot.c ../inc/include/rpcsvc/ypupdate_prot.h \ - ../libc/compat/sys5/epoch.h \ - $(S5PICOBJS) -CLOBBERFILES= ../libc/compat/sys5/mkepoch - -# conditional assignments -s5pics/%.o:= CPPFLAGS = -Dsparc -DS5EMUL $(C_PICFLAGS) -DPIC -I. -Iinc \ - -I../inc/5include -I../inc/include -I../inc/include/sys \ - $(CPPFLAGS.master) -s5pics/%.o:= ASFLAGS = -P -D__STDC__ -DLOCORE -D_SYS_SYS_S -D_ASM \ - -Dsparc -DS5EMUL $(AS_PICFLAGS) -DPIC -I. -Iinc \ - -I../inc/5include -I../inc/include -I../inc/include/sys \ - $(CPPFLAGS.master) - -s5pics/%.o := CFLAGS += -xregs=no%appl -pics/%.o := CFLAGS += -xregs=no%appl - -$(DYNLIB4X):= DIR = pics -$(DYNLIBS5):= DIR = s5pics - -.KEEP_STATE: - -# Declare that all .o's can be made in parallel. -.PARALLEL: $(PICS) $(S5PICOBJS) - -all: $(TXTS) $(LIBS) - -$(DYNLIB4X): pics .WAIT $(PICS) - $(CC) -o $@ -G $(DYNFLAGS) $(PICS) $(LDLIBS) - $(POST_PROCESS_SO) - -$(DYNLIBS5): s5pics .WAIT $(S5PICOBJS) - $(CC) -o $@ -G $(DYNFLAGS) $(S5PICOBJS) $(LDLIBS) - $(POST_PROCESS_SO) - -# include common library targets -include ../../Makefile.targ - -s5pics: - -@mkdir -p $@ - -# special cases -PSEUDO_POBJS= $(PSEUDO_SRCS:%.s=pics/%.o) -PSEUDO_PS5OBJS= $(PSEUDO_SRCS:%.s=s5pics/%.o) - -$(PSEUDO_POBJS) $(PSEUDO_PS5OBJS): - @(echo '#include "SYS.h"'; \ - echo ' SYSCALL($(@F:.o=))'; \ - echo ' RET'; \ - echo ' SET_SIZE($(@F:.o=))') > tmp.$(@F:.o=).s - $(AS) $(ASFLAGS) -o $@ tmp.$(@F:.o=).s - $(POST_PROCESS_O) - @$(RM) tmp.$(@F:.o=).s - -s5pics/times.o : ../libc/compat/sys5/epoch.h ../libc/compat/sys5/times.c - $(COMPILE.c) -o $@ ../libc/compat/sys5/times.c - $(POST_PROCESS_O) - -../libc/compat/sys5/epoch.h: ../libc/compat/sys5/mkepoch - ../libc/compat/sys5/mkepoch > $@ - -../libc/compat/sys5/mkepoch: ../libc/compat/sys5/mkepoch.c - $(NATIVECC) -O -o $@ ../libc/compat/sys5/mkepoch.c - -pics/maperror.o s5pics/maperror.o: ../libc/sys/common/maperror.c - $(CC) -I../libc/sys/common $(CPPFLAGS) $(CFLAGS) -c -o $@ ../libc/sys/common/maperror.c - -# -# The following rules generate the .h file and XDR routines from the -# rpcgen source. Objects built here, look for it here. Further, when -# building ypupdated it should look here too, but doesn't at the moment. -# -# It would be nice to use a ".x.h" rule for this, but that causes problems. -# -pics/yp_update.o \ -s5pics/yp_update.o : ../inc/include/rpcsvc/ypupdate_prot.h ../libc/yp/yp_update.c - $(COMPILE.c) -o $@ ../libc/yp/yp_update.c - $(POST_PROCESS_O) - -pics/ypupdate_prot.o s5pics/ypupdate_prot.o : ../inc/include/rpcsvc/ypupdate_prot.h\ - ../libc/yp/ypupdate_prot.c - $(COMPILE.c) -o $@ ../libc/yp/ypupdate_prot.c - $(POST_PROCESS_O) - -../libc/yp/ypupdate_prot.c: ../libc/yp/ypupdate_prot.x - $(RM) $@ - $(RPCGEN) -c -o $@ ../libc/yp/ypupdate_prot.x - -../libc/yp/ypupdate_prot.h: ../libc/yp/ypupdate_prot.x - $(RM) $@ ../libc/yp/ypupdate_prot.h - $(RPCGEN) -h -o ../libc/yp/ypupdate_prot.h ../libc/yp/ypupdate_prot.x - -../inc/include/rpcsvc/ypupdate_prot.h: ../libc/yp/ypupdate_prot.h - cp ../libc/yp/ypupdate_prot.h $@ diff --git a/usr/src/lib/libbc/sparc/inc/PIC.h b/usr/src/lib/libbc/sparc/inc/PIC.h deleted file mode 100644 index b8b14ae32f..0000000000 --- a/usr/src/lib/libbc/sparc/inc/PIC.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef PIC -#define PIC_SETUP(r) \ - or %g0,%o7,%g1; \ -1: \ - call 2f; \ - nop; \ -2: \ - sethi %hi(_GLOBAL_OFFSET_TABLE_ - (1b-.)), %r; \ - or %r, %lo(_GLOBAL_OFFSET_TABLE_ - (1b-.)),%r; \ - add %r, %o7, %r; \ - or %g0,%g1,%o7 -#else -#define PIC_SETUP() -#endif - diff --git a/usr/src/lib/libbc/sparc/inc/SYS.h b/usr/src/lib/libbc/sparc/inc/SYS.h deleted file mode 100644 index 4586eded56..0000000000 --- a/usr/src/lib/libbc/sparc/inc/SYS.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -! -! "@(#)SYS.h 1.14 88/02/08" -! Copyright (c) 1986, 1996 by Sun Microsystems, Inc. -! All rights reserved. -! - -#include <sys/syscall.h> -#include <machine/asm_linkage.h> -#include "PIC.h" - -#define SV_ERESTART 91 /* ERESTART is returned by the kernel for - restartable system calls */ - -#define WINDOWSIZE (16*4) - - .global .cerror - -#define SYSCALL(x) \ - ENTRY(x); \ - mov SYS_/**/x, %g1; \ - t 8; \ - CERROR(o5) - -#define BSDSYSCALL(x) \ - ENTRY(_/**/x); \ - mov SYS_/**/x, %g1; \ - t 8; \ - CERROR(o5) - -/* - * SYSREENTRY provides the entry sequence for restartable system calls. - */ -#define SYSREENTRY(x) \ - ENTRY(x); \ - st %o0,[%sp+68]; \ -.restart_/**/x: - -#define PSEUDO(x, y) \ - ENTRY(x); \ - mov SYS_/**/y, %g1; \ - t 8; - -/* - * SYSCALL_RESTART provides the most common restartable system call sequence. - */ -#define SYSCALL_RESTART(x) \ - SYSREENTRY(x); \ - mov SYS_/**/x, %g1; \ - t 8; \ - SYSRESTART(.restart_/**/x) - -/* - * SYSREENTRY provides the entry sequence for restartable system calls. - */ -#define SYSREENTRY(x) \ - ENTRY(x); \ - st %o0,[%sp+68]; \ -.restart_/**/x: - -/* - * SYSRESTART provides the error handling sequence for restartable - * system calls. - */ -#ifdef PIC -#define SYSRESTART(x) \ - bcc noerr; \ - cmp %o0, SV_ERESTART; \ - be,a x; \ - ld [%sp+68], %o0; \ - PIC_SETUP(o5); \ - ld [%o5 + .cerror], %o5; \ - jmp %o5; \ - .empty; \ -noerr: nop ; -#else -#define SYSRESTART(x) \ - bcc noerr; \ - cmp %o0, SV_ERESTART; \ - be,a x; \ - ld [%sp+68], %o0; \ - ba .cerror; \ - .empty; \ -noerr: nop ; -#endif - -#define RET retl; nop; - -#ifdef PIC -#define CERROR(free_reg) \ - bcc noerr; \ - PIC_SETUP(free_reg); \ - .empty; \ - ld [%free_reg+ .cerror],%free_reg; \ - jmp %free_reg; \ - .empty; \ -noerr: nop; -#else -#define CERROR(free_reg) \ - bcc noerr; \ - .empty; \ - sethi %hi(.cerror), %free_reg;\ - or %free_reg, %lo(.cerror), %free_reg;\ - jmp %free_reg;\ - .empty;\ -noerr: nop; -#endif diff --git a/usr/src/lib/libbc/sparc/inc/sparc/asm_linkage.h b/usr/src/lib/libbc/sparc/inc/sparc/asm_linkage.h deleted file mode 100644 index 426cede7d9..0000000000 --- a/usr/src/lib/libbc/sparc/inc/sparc/asm_linkage.h +++ /dev/null @@ -1,332 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 1987 by Sun Microsystems, Inc. - */ - -#ifndef _SYS_ASM_LINKAGE_H -#define _SYS_ASM_LINKAGE_H - -#pragma ident "%Z%%M% %I% %E% SMI" - /* from SunOS 4.0 1.4 */ - -/* allow word aligned user stacks */ -#define PARTIAL_ALIGN - -/* - * A stack frame looks like: - * - * %fp->| | - * |-------------------------------| - * | Locals, temps, saved floats | - * |-------------------------------| - * | outgoing parameters past 6 | - * |-------------------------------|-\ - * | 6 words for callee to dump | | - * | register arguments | | - * |-------------------------------| > minimum stack frame - * | One word struct-ret address | | - * |-------------------------------| | - * | 16 words to save IN and | | - * %sp->| LOCAL register on overflow | | - * |-------------------------------|-/ - */ - -/* - * Constants defining a stack frame. - */ -#define WINDOWSIZE (16*4) /* size of window save area */ -#define ARGPUSHSIZE (6*4) /* size of arg dump area */ -#define ARGPUSH (WINDOWSIZE+4) /* arg dump area offset */ -#define MINFRAME (WINDOWSIZE+ARGPUSHSIZE+4) /* min frame */ - -/* - * Stack alignment macros. - */ -#define STACK_ALIGN 8 -#define SA(X) (((X)+(STACK_ALIGN-1)) & ~(STACK_ALIGN-1)) - -#ifdef _ASM /* The remainder of this file is only for assembly files */ - -/* - * Symbolic section definitions. - */ -#define RODATA ".rodata" - -/* - * profiling causes defintions of the MCOUNT and RTMCOUNT - * particular to the type - */ -#ifdef GPROF - -#define MCOUNT(x) \ - save %sp, -SA(MINFRAME), %sp; \ - call mcount; \ - nop ; \ - restore ; - -#endif /* GPROF */ - -#ifdef PROF - -#define MCOUNT(x) \ - save %sp, -SA(MINFRAME), %sp; \ - sethi %hi(.L_/**/x/**/1), %o0; \ - call mcount; \ - or %o0, %lo(.L_/**/x/**/1), %o0; \ - restore; \ - .common .L_/**/x/**/1, 4, ".bss"; - -#endif /* PROF */ - -/* - * if we are not profiling, MCOUNT should be defined to nothing - */ -#if !defined(PROF) && !defined(GPROF) -#define MCOUNT(x) -#endif /* !defined(PROF) && !defined(GPROF) */ - -#define RTMCOUNT(x) MCOUNT(x) - -/* - * Pre-ansi compiler versions prepended an underscore to function names. - * This macro provides this function. - */ -#ifndef __STDC__ -#define NAME(x) _/**/x -#endif /* __STDC__ */ - -/* - * Macro to define weak symbol aliases. These are similar to the ANSI-C - * #pragma weak name = _name - * except a compiler can determine type. The assembler must be told. Hence, - * the second parameter must be the type of the symbol (i.e.: function,...) - */ -#ifdef __STDC__ -#define ANSI_PRAGMA_WEAK(sym,stype) \ - .weak sym; \ - .type sym,#stype; \ -sym = _/**/sym -#endif /* __STDC__ */ - -/* - * ENTRY provides a way to insert the calls to mcount for profiling. - */ -#ifdef __STDC__ - -#define ENTRY(x) \ - .section ".text"; \ - .align 4; \ - .global x; \ - .type x,#function; \ -x: MCOUNT(x) - -#define RTENTRY(x) \ - .global x; x: RTMCOUNT(x) - -#else /* __STDC__ */ - -#define ENTRY(x) \ - .global NAME(x); \ - NAME(x): MCOUNT(x) - -#define RTENTRY(x) \ - .global x; x: RTMCOUNT(x) - -#endif /* __STDC__ */ - -/* - * ENTRY2 is identical to ENTRY but provides two labels for the entry point. - */ -#ifdef __STDC__ - -#define ENTRY2(x,y) \ - .section ".text"; \ - .align 4; \ - .global x, y; \ - .type x,#function; \ - .type y,#function; \ -x: ; \ -y: MCOUNT(x) - -#else /* __STDC__ */ - -#define ENTRY2(x,y) \ - .global NAME(x), NAME(y); \ - NAME(x): ; \ - NAME(y): MCOUNT(x) - -#endif /* __STDC__ */ - -/* - * ALTENTRY provides for additional entry points. - */ -#ifdef __STDC__ - -#define ALTENTRY(x) \ - .global x; \ - .type x,#function; \ -x: - -#else /* __STDC__ */ - -#define ALTENTRY(x) \ - .global NAME(x); \ - NAME(x): - -#endif /* __STDC__ */ - -/* - * DGDEF and DGDEF2 provide global data declarations. - */ -#ifdef __STDC__ - -#define DGDEF2(name,sz) \ - .section ".data"; \ - .global name; \ - .type name,#object; \ - .size name,sz; \ -name: - -#else /* __STDC__ */ - -#define DGDEF2(name,sz) \ - .section ".data"; \ - .global name; \ -name: - -#endif /* __STDC__ */ - -#define DGDEF(name) DGDEF2(name,4) - -/* - * SET_SIZE trails a function and set the size for the ELF symbol table. - */ -#ifdef __STDC__ - -#define SET_SIZE(x) \ - .size x,(.-x) - -#else /* __STDC__ */ - -#define SET_SIZE(x) - -#endif /* __STDC__ */ - -#ifdef _KERNEL -/* - * Macros for saving/restoring registers. - */ - -#define SAVE_GLOBALS(RP) \ - st %g1, [RP + G1*4]; \ - std %g2, [RP + G2*4]; \ - std %g4, [RP + G4*4]; \ - std %g6, [RP + G6*4]; \ - mov %y, %g1; \ - st %g1, [RP + Y*4] - -#define RESTORE_GLOBALS(RP) \ - ld [RP + Y*4], %g1; \ - mov %g1, %y; \ - ld [RP + G1*4], %g1; \ - ldd [RP + G2*4], %g2; \ - ldd [RP + G4*4], %g4; \ - ldd [RP + G6*4], %g6; - -#define SAVE_OUTS(RP) \ - std %i0, [RP + O0*4]; \ - std %i2, [RP + O2*4]; \ - std %i4, [RP + O4*4]; \ - std %i6, [RP + O6*4]; - -#define RESTORE_OUTS(RP) \ - ldd [RP + O0*4], %i0; \ - ldd [RP + O2*4], %i2; \ - ldd [RP + O4*4], %i4; \ - ldd [RP + O6*4], %i6; - -#define SAVE_WINDOW(SBP) \ - std %l0, [SBP + (0*4)]; \ - std %l2, [SBP + (2*4)]; \ - std %l4, [SBP + (4*4)]; \ - std %l6, [SBP + (6*4)]; \ - std %i0, [SBP + (8*4)]; \ - std %i2, [SBP + (10*4)]; \ - std %i4, [SBP + (12*4)]; \ - std %i6, [SBP + (14*4)]; - -#define RESTORE_WINDOW(SBP) \ - ldd [SBP + (0*4)], %l0; \ - ldd [SBP + (2*4)], %l2; \ - ldd [SBP + (4*4)], %l4; \ - ldd [SBP + (6*4)], %l6; \ - ldd [SBP + (8*4)], %i0; \ - ldd [SBP + (10*4)], %i2; \ - ldd [SBP + (12*4)], %i4; \ - ldd [SBP + (14*4)], %i6; - -#ifdef PARTIAL_ALIGN - -#define SAVE_WINDOW_S(SBP) \ - st %l0, [SBP + (0*4)]; \ - st %l1, [SBP + (1*4)]; \ - st %l2, [SBP + (2*4)]; \ - st %l3, [SBP + (3*4)]; \ - st %l4, [SBP + (4*4)]; \ - st %l5, [SBP + (5*4)]; \ - st %l6, [SBP + (6*4)]; \ - st %l7, [SBP + (7*4)]; \ - st %i0, [SBP + (8*4)]; \ - st %i1, [SBP + (9*4)]; \ - st %i2, [SBP + (10*4)]; \ - st %i3, [SBP + (11*4)]; \ - st %i4, [SBP + (12*4)]; \ - st %i5, [SBP + (13*4)]; \ - st %i6, [SBP + (14*4)]; \ - st %i7, [SBP + (15*4)] - -#define RESTORE_WINDOW_S(SBP) \ - ld [SBP + (0*4)], %l0; \ - ld [SBP + (1*4)], %l1; \ - ld [SBP + (2*4)], %l2; \ - ld [SBP + (3*4)], %l3; \ - ld [SBP + (4*4)], %l4; \ - ld [SBP + (5*4)], %l5; \ - ld [SBP + (6*4)], %l6; \ - ld [SBP + (7*4)], %l7; \ - ld [SBP + (8*4)], %i0; \ - ld [SBP + (9*4)], %i1; \ - ld [SBP + (10*4)], %i2; \ - ld [SBP + (11*4)], %i3; \ - ld [SBP + (12*4)], %i4; \ - ld [SBP + (13*4)], %i5; \ - ld [SBP + (14*4)], %i6; \ - ld [SBP + (15*4)], %i7 - -#endif /* PARTIAL_ALIGN */ - -#endif /* _KERNEL */ - -#endif /* _ASM */ - -#endif /* _SYS_ASM_LINKAGE_H */ diff --git a/usr/src/pkg/manifests/system-compatibility-sunos4.mf b/usr/src/pkg/manifests/system-compatibility-sunos4.mf index 9fb0c40d81..c82825c68e 100644 --- a/usr/src/pkg/manifests/system-compatibility-sunos4.mf +++ b/usr/src/pkg/manifests/system-compatibility-sunos4.mf @@ -24,21 +24,6 @@ # set name=pkg.fmri value=pkg:/system/compatibility/sunos4@$(PKGVERS) -set name=pkg.description \ - value="utilities to provide a binary-compatible execution environment for SunOS 4.x applications" -set name=pkg.summary value="SunOS 4.x Binary Compatibility" -set name=info.classification value=org.opensolaris.category.2008:System/Core +set name=pkg.obsolete value=true +set name=org.opensolaris.noincorp value=true set name=variant.arch value=sparc -dir path=usr group=sys -dir path=usr/4lib -file path=usr/4lib/libc.so.1.9 -file path=usr/4lib/libc.so.2.9 -file path=usr/4lib/sbcp mode=0755 -legacy pkg=SUNWbcp \ - desc="utilities to provide a binary-compatible execution environment for SunOS 4.x applications" \ - name="SunOS 4.x Binary Compatibility" -license cr_Sun license=cr_Sun -license lic_CDDL license=lic_CDDL -license usr/src/lib/libbc/THIRDPARTYLICENSE \ - license=usr/src/lib/libbc/THIRDPARTYLICENSE -link path=usr/4lib/libdl.so.1.0 target=../../lib/libdl.so.1 diff --git a/usr/src/ucbcmd/Makefile b/usr/src/ucbcmd/Makefile index 584f4763aa..22fbc32254 100644 --- a/usr/src/ucbcmd/Makefile +++ b/usr/src/ucbcmd/Makefile @@ -63,20 +63,15 @@ COMMON_SUBDIRS= \ whereis \ whoami -sparc_SUBDIRS= sbcp - -SUBDIRS= $(COMMON_SUBDIRS) $($(MACH)_SUBDIRS) +SUBDIRS= $(COMMON_SUBDIRS) # commands messaged MSGSUBDIRS = biff install.d mkstr rusage shutdown -BWOSDIRS= - all:= TARGET= all install:= TARGET= install clean:= TARGET= clean clobber:= TARGET= clobber -lint:= TARGET= lint _msg:= TARGET= _msg # Since pre-5.0 system users were told to put /usr/5bin in their path to @@ -165,11 +160,7 @@ install: $(SUBDIRS) .WAIT rootlinks # _msg: $(MSGSUBDIRS) - - -bwos: $(BWOSDIRS) .WAIT $(SUBDIRS) - -$(BWOSDIRS) $(SUBDIRS): FRC +$(SUBDIRS): FRC @cd $@; pwd; $(MAKE) $(TARGET) rootlinks: $(S5LINK) $(DICTLINK) $(ROOTBINLINKS) $(OTHERLINKS) diff --git a/usr/src/ucbcmd/sbcp/Makefile b/usr/src/ucbcmd/sbcp/Makefile deleted file mode 100644 index ce1bf79e32..0000000000 --- a/usr/src/ucbcmd/sbcp/Makefile +++ /dev/null @@ -1,69 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -PROG= sbcp - -include ../Makefile.ucbcmd - -CLEANFILES= sysent.s -POFILE= - -OBJS= sbcp.o sbcp_util.o - -FILEMODE= 755 - -.KEEP_STATE: - -# Preserve the relationship of libraries as they are defined in libc.so.1.9 -LIBBC= ../../lib/libbc/sparc/libc.so.1.9 -LIBUCB= ../../ucblib/libucb/sparc/libucb.so.1 - -# need libc/sparc/inc for PIC.h -ASFLAGS= -P -D_ASM -DPIC $(AS_PICFLAGS) -LDFLAGS= -R /usr/4lib:/usr/ucblib -e _start -G -t \ - $(BLOCAL) $(ZNOVERSION) $(ZDEFS) $(ZTEXT) \ - -I/usr/lib/ld.so.1 -LIBS= $(LDLIBS.lib) -lmapmalloc $(LIBBC) $(LIBUCB) -lnsl -lc - -CERRWARN += -_gcc=-Wno-unused-variable - -all: $(PROG) - -install: all $(ROOT4LIBPROG) - -clean: - $(RM) $(OBJS) $(CLEANFILES) - -$(PROG): $(OBJS) - $(LDOPTS) $(LD) $(LDFLAGS) -o sbcp $(OBJS) $(LIBS) - $(POST_PROCESS) - -$(OBJS): sysent.s - -sysent.s: syscalls.list mksysent - -$(RM) sysent.s - sh ./mksysent > sysent.s - -include ../Makefile.ucbtarg diff --git a/usr/src/ucbcmd/sbcp/mksysent b/usr/src/ucbcmd/sbcp/mksysent deleted file mode 100644 index c99368e855..0000000000 --- a/usr/src/ucbcmd/sbcp/mksysent +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 1993-2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#pragma ident "%Z%%M% %I% %E% SMI" -# -# mksysent - generate the sysent table from the list of system calls -# -nawk ' -BEGIN { - print "#include <sys/asm_linkage.h>" - print "#include <sys/syscall.h>" - print "" - print "! This file is automatically generated from syscalls.list." - print "! Do not edit by hand or your changes will be lost." - print "! See mksysent and syscalls.list for details." - print "" - print " .section \".text\"" - print " .align 4" - print "sysent:" -} -/^#/ { next; } # ignore comment lines -{ - f = $1; - if ($2 == "TRAP") { - printf "! %s\n", f; - printf "\trestore\t%%g0, SYS_%s, %%g1\n", f; - printf "\tta\t8\n"; - printf "\tjmp\t%%g6\n"; - printf "\tnop\n"; - } else if ($2 == "SIMPLE") { - printf "! %s\n", f; - printf "\t.global\t%s\n", f; - printf "\tcall\t%s\n", f; - printf "\tnop\n"; - printf "\tb,a\ttrap0rtn\n"; - printf "\tnop\n"; - } else { - printf "! %s\n", f; - printf "\tb,a\tnosys\n"; - printf "\tnop\n"; - printf "\tnop\n"; - printf "\tnop\n"; - } -} -' <syscalls.list diff --git a/usr/src/ucbcmd/sbcp/sbcp.s b/usr/src/ucbcmd/sbcp/sbcp.s deleted file mode 100644 index 4e9526d678..0000000000 --- a/usr/src/ucbcmd/sbcp/sbcp.s +++ /dev/null @@ -1,201 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - .file "sbcp.s" - -#include <sys/asm_linkage.h> -#include <sys/link.h> -#include <sys/syscall.h> - -#define PIC_SETUP(r) \ - mov %o7, %g1; \ -9: call 8f; \ - sethi %hi(_GLOBAL_OFFSET_TABLE_ - (9b - .)), %r; \ -8: or %r, %lo(_GLOBAL_OFFSET_TABLE_ - (9b - .)), %r; \ - add %r, %o7, %r; \ - mov %g1, %o7 - -#define FUNC(x) \ - .section ".text"; \ - .align 4; \ - .type x, #function; \ -x: - -#define ENOSYS 90 /* 4.x ENOSYS */ - -/* derived from <sys/exechdr.h>, which we can't include */ -#define A_MAGIC 0x02 /* offset of a_magic field */ -#define A_ENTRY 0x14 /* offset of a_entry field */ -#define ZMAGIC 0413 /* magic number for demand paged executable */ - - .global atexit, errno - -! -! _start - execution starts here (after the runtime linker runs) -! -! The SPARC ABI defines our "environment" at this point, see page 3-34. -! Register the exit handler, register the trap0 handler, find the -! entry point, and jump to it. We depend on the stack (argv, envp) -! being compatible between 4.x and 5.x. We also depend on the -! runtime linker to set up ``environ''. -! - -ENTRY_NP(_start) - tst %g1 ! is there a handler to register? - bz 1f ! no - nop - mov %g1, %o0 - call atexit ! yes, register it with atexit() - nop -1: - - ! - ! Aside from a value in %g1, there were no arguments explicitly - ! passed to this routine, but we do know how our initial stack has - ! been setup by the kernel. The stack format is documented in: - ! usr/src/cmd/sgs/rtld/sparc/boot.s - ! usr/src/cmd/sgs/rtld/sparcv9/boot.s - ! - ! Since we want to invoke the following c initalization routine: - ! sbcp_init(int argc, char *argv[], char *envp[])) - ! we need to troll through the stack to setup it's argument values. - ! - save %sp, -SA(MINFRAME + EB_MAX_SIZE32), %sp - - ldn [%fp + WINDOWSIZE + STACK_BIAS], %o0 ! get argc - add %fp, + WINDOWSIZE + CPTRSIZE + STACK_BIAS, %o1 ! get argv - - add %o0, 1, %l0 ! add 1 to argc for last element of 0 - sll %l0, CPTRSHIFT, %l0 ! multiply argc by pointer size - add %o1, %l0, %o2 ! and add to argv to get envp - - call sbcp_init ! Call our c initalization routine - nop - restore - - PIC_SETUP(g2) - ld [%g2+trap0], %g1 - ta 9 - - ! jump to the main program's entry point - - sethi %hi(0x2000), %o0 - lduh [%o0 + A_MAGIC], %g1 - cmp %g1, ZMAGIC ! is it a ZMAGIC executable? - be,a 1f ! yes, - ld [%o0 + A_ENTRY], %o0 ! get entry point -1: ! else, assume entry point is 0x2000 - jmp %o0 - nop - SET_SIZE(_start) - -! -! trap0 - glue between 4.x syscall trap and 5.x BCP routine -! -! enter with: -! %g1 syscall number -! %g6 return address (after trap instruction) -! -! We used to use %g7, but that conflicts with threading code -! which uses %g7 as the curthread pointer. That is why we -! changed to using %g6 instead. -! -! We use an extra window to save the %o registers we're entered -! with (which the 4.x system call stubs depend on) and to allow -! recursive traps (e.g., from a signal handler). -! - -FUNC(trap0) - save %sp, -SA(MINFRAME), %sp - tst %g1 - be 1f - nop - mov %i0, %o0 - mov %i1, %o1 - mov %i2, %o2 - mov %i3, %o3 - mov %i4, %o4 - mov %i5, %o5 - ba,a 2f -1: - ! indir syscall - mov %i0, %g1 - mov %i1, %o0 - mov %i2, %o1 - mov %i3, %o2 - mov %i4, %o3 - mov %i5, %o4 - ld [%fp + MINFRAME], %o5 -2: - sll %g1, 4, %l1 - PIC_SETUP(l0) - ld [%l0+sysent], %l0 - add %l1, %l0, %l1 - jmp %l1 ! jump into branch table - nop - SET_SIZE(trap0) - -FUNC(trap0rtn) - cmp %o0, -1 - bne 1f - addcc %g0, %g0, %g0 ! psr &= ~C - PIC_SETUP(o1) - ld [%o1+errno], %o1 - ld [%o1], %o0 - subcc %g0, 1, %g0 ! psr |= C -1: - mov %o0, %i0 - restore - jmp %g6 - nop - SET_SIZE(trap0rtn) - -! -! nullsys -! -FUNC(nullsys) - clr %o0 - b,a trap0rtn - SET_SIZE(nullsys) - -! -! nosys -! -FUNC(nosys) - set ENOSYS, %o1 - PIC_SETUP(g2) - ld [%g2+errno], %g2 - st %o1, [%g2] - set -1, %o0 - b,a trap0rtn - SET_SIZE(nosys) - -! -! Have to #include the sysent table and stubs so that all -! symbols referenced between here and there are "static" -! to this module so the assembler can resolve them without -! the linker needing to deal with them at run time. -! -#include "sysent.s" diff --git a/usr/src/ucbcmd/sbcp/sbcp_util.c b/usr/src/ucbcmd/sbcp/sbcp_util.c deleted file mode 100644 index 61ab8f21be..0000000000 --- a/usr/src/ucbcmd/sbcp/sbcp_util.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <sys/auxv.h> -#include <sys/types.h> - -void -sbcp_init(int argc, char *argv[], char *envp[]) -{ - auxv_t *ap; - uintptr_t *p; - int err; - - /* - * Find the aux vector on the stack. - */ - p = (uintptr_t *)envp; - while (*p != NULL) - p++; - - /* - * p is now pointing at the 0 word after the environ pointers. - * After that is the aux vectors. - * - * We need to clear the AF_SUN_NOPLM flag from the AT_SUN_AUXFLAGS - * aux vector. This flag told our linker that we don't have a - * primary link map. Now that our linker is done initializing, we - * want to clear this flag before we transfer control to the - * applications copy of the linker, since we want that linker to have - * a primary link map which will be the link map for the application - * we're running. - */ - p++; - for (ap = (auxv_t *)p; ap->a_type != AT_NULL; ap++) { - switch (ap->a_type) { - case AT_SUN_AUXFLAGS: - ap->a_un.a_val &= ~AF_SUN_NOPLM; - break; - default: - break; - } - } -} diff --git a/usr/src/ucbcmd/sbcp/syscalls.list b/usr/src/ucbcmd/sbcp/syscalls.list deleted file mode 100644 index 7004893578..0000000000 --- a/usr/src/ucbcmd/sbcp/syscalls.list +++ /dev/null @@ -1,213 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# Copyright 2010 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -nosys NOSYS /* 0 = 1, indir */ -exit TRAP /* 1 = 1, exit */ -fork SIMPLE /* 2 = 0, fork */ -read SIMPLE /* 3 = 3, read */ -write SIMPLE /* 4 = 3, write */ -open SIMPLE /* 5 = 3, open */ -close SIMPLE /* 6 = 1, close */ -wait4 SIMPLE /* 7 = 4, wait4 */ -creat SIMPLE /* 8 = 2, creat */ -link SIMPLE /* 9 = 2, link */ -unlink SIMPLE /* 10 = 1, unlink */ -execv SIMPLE /* 11 = 2, execv */ -chdir SIMPLE /* 12 = 1, chdir */ -nosys NOSYS /* 13 = 0, old time */ -mknod SIMPLE /* 14 = 3, mknod */ -chmod SIMPLE /* 15 = 2, chmod */ -chown SIMPLE /* 16 = 3, chown; now 3 args */ -brk SIMPLE /* 17 = 1, brk */ -nosys NOSYS /* 18 = 0, old stat */ -lseek SIMPLE /* 19 = 3, lseek */ -getpid TRAP /* 20 = 0, getpid */ -nosys NOSYS /* 21 = 0, old mount */ -umount SIMPLE /* 22 = 1, old umount */ -nosys NOSYS /* 23 = 0, old setuid */ -getuid TRAP /* 24 = 0, getuid */ -nosys NOSYS /* 25 = 0, old stime */ -ptrace SIMPLE /* 26 = 5, ptrace */ -nosys NOSYS /* 27 = 0, old alarm */ -nosys NOSYS /* 28 = 0, old fstat */ -nosys NOSYS /* 29 = 0, opause */ -nosys NOSYS /* 30 = 0, old utime */ -nosys NOSYS /* 31 = 0, was stty */ -nosys NOSYS /* 32 = 0, was gtty */ -access SIMPLE /* 33 = 2, access */ -nosys NOSYS /* 34 = 0, old nice */ -nosys NOSYS /* 35 = 0, old ftime */ -sync SIMPLE /* 36 = 0, sync */ -kill SIMPLE /* 37 = 2, kill */ -stat SIMPLE /* 38 = 2, stat */ -nosys NOSYS /* 39 = 0, old setpgrp */ -lstat SIMPLE /* 40 = 2, lstat */ -dup SIMPLE /* 41 = 2, dup */ -pipe TRAP /* 42 = 0, pipe */ -nosys NOSYS /* 43 = 0, old times */ -profil SIMPLE /* 44 = 4, profil */ -nosys NOSYS /* 45 = 0, nosys */ -nosys NOSYS /* 46 = 0, old setgid */ -getgid TRAP /* 47 = 0, getgid */ -nosys NOSYS /* 48 = 0, old sig */ -nosys NOSYS /* 49 = 0, reserved for USG */ -nosys NOSYS /* 50 = 0, reserved for USG */ -nosys NOSYS /* 51 = 1, turn acct off/on */ -nosys NOSYS /* 52 = 0, old set phys addr */ -mctl SIMPLE /* 53 = 4, memory control */ -ioctl SIMPLE /* 54 = 3, ioctl */ -reboot SIMPLE /* 55 = 2, reboot */ -wait3 NOSYS /* 56 = 3, wait3 (per-4.0) */ -symlink SIMPLE /* 57 = 2, symlink */ -readlink SIMPLE /* 58 = 3, readlink */ -execve SIMPLE /* 59 = 3, execve */ -umask SIMPLE /* 60 = 1, umask */ -chroot SIMPLE /* 61 = 1, chroot */ -fstat SIMPLE /* 62 = 2, fstat */ -nosys NOSYS /* 63 = 0, used internally */ -getpagesize SIMPLE /* 64 = 1, getpagesize */ -msync SIMPLE /* 65 = 3, old msync */ -vfork TRAP /* 66 = 0, vfork */ -read SIMPLE /* 67 = 0, old vread */ -write SIMPLE /* 68 = 0, old vwrite */ -sbrk SIMPLE /* 69 = 1, sbrk */ -nullsys SIMPLE /* 70 = 1, sstk (emulated as nop) */ -mmap SIMPLE /* 71 = 6, mmap */ -nullsys SIMPLE /* 72 = 1, old vadvise (emulated as nop) */ -munmap SIMPLE /* 73 = 2, munmap */ -mprotect SIMPLE /* 74 = 3, mprotect */ -madvise SIMPLE /* 75 = 3, old madvise */ -vhangup SIMPLE /* 76 = 1, vhangup */ -nosys NOSYS /* 77 = 0, old vlimit */ -mincore SIMPLE /* 78 = 3, mincore */ -getgroups SIMPLE /* 79 = 2, getgroups */ -setgroups SIMPLE /* 80 = 2, setgroups */ -getpgrp SIMPLE /* 81 = 1, getpgrp */ -setpgrp SIMPLE /* 82 = 2, setpgrp */ -setitimer SIMPLE /* 83 = 3, setitimer */ -wait NOSYS /* 84 = 0, old wait & wait3 (per-4.0) */ -nosys NOSYS /* 85 = 1, swapon */ -getitimer SIMPLE /* 86 = 2, getitimer */ -gethostname SIMPLE /* 87 = 2, gethostname */ -sethostname SIMPLE /* 88 = 2, sethostname */ -getdtablesize SIMPLE /* 89 = 0, getdtablesize */ -dup2 SIMPLE /* 90 = 2, dup2 */ -nullsys SIMPLE /* 91 = 2, getdopt (not implemented) */ -fcntl SIMPLE /* 92 = 3, fcntl */ -select SIMPLE /* 93 = 5, select */ -nullsys SIMPLE /* 94 = 2, setdopt (not implemented) */ -fsync SIMPLE /* 95 = 1, fsync */ -setpriority SIMPLE /* 96 = 3, setpriority */ -socket SIMPLE /* 97 = 3, socket */ -connect SIMPLE /* 98 = 3, connect */ -accept SIMPLE /* 99 = 3, accept */ -getpriority SIMPLE /* 100 = 2, getpriority */ -send SIMPLE /* 101 = 4, send */ -recv SIMPLE /* 102 = 4, recv */ -nosys NOSYS /* 103 = 0, old socketaddr */ -bind SIMPLE /* 104 = 3, bind */ -setsockopt SIMPLE /* 105 = 5, setsockopt */ -listen SIMPLE /* 106 = 2, listen */ -nosys NOSYS /* 107 = 0, old vtimes */ -sigvec SIMPLE /* 108 = 3, sigvec */ -sigblock SIMPLE /* 109 = 1, sigblock */ -sigsetmask SIMPLE /* 110 = 1, sigsetmask */ -sigpause SIMPLE /* 111 = 1, sigpause */ -sigstack SIMPLE /* 112 = 2, sigstack */ -recvmsg SIMPLE /* 113 = 3, recvmsg */ -sendmsg SIMPLE /* 114 = 3, sendmsg */ -nosys NOSYS /* 115 = 0, nosys */ -gettimeofday SIMPLE /* 116 = 2, gettimeofday */ -getrusage SIMPLE /* 117 = 2, getrusage */ -getsockopt SIMPLE /* 118 = 5, getsockopt */ -nosys NOSYS /* 119 = 0, nosys */ -readv SIMPLE /* 120 = 3, readv */ -writev SIMPLE /* 121 = 3, writev */ -settimeofday SIMPLE /* 122 = 2, settimeofday */ -fchown SIMPLE /* 123 = 3, fchown */ -fchmod SIMPLE /* 124 = 2, fchmod */ -recvfrom SIMPLE /* 125 = 6, recvfrom */ -setreuid SIMPLE /* 126 = 2, setreuid */ -setregid SIMPLE /* 127 = 2, setregid */ -rename SIMPLE /* 128 = 2, rename */ -truncate SIMPLE /* 129 = 2, truncate */ -ftruncate SIMPLE /* 130 = 2, ftruncate */ -flock SIMPLE /* 131 = 2, flock */ -nosys NOSYS /* 132 = 0, nosys */ -sendto SIMPLE /* 133 = 6, sendto */ -shutdown SIMPLE /* 134 = 2, shutdown */ -socketpair SIMPLE /* 135 = 5, socketpair */ -mkdir SIMPLE /* 136 = 2, mkdir */ -rmdir SIMPLE /* 137 = 1, rmdir */ -utimes SIMPLE /* 138 = 2, utimes */ -__sigcleanup SIMPLE /* 139 = 0, signalcleanup */ -adjtime SIMPLE /* 140 = 2, adjtime */ -getpeername SIMPLE /* 141 = 3, getpeername */ -gethostid SIMPLE /* 142 = 2, gethostid */ -nosys NOSYS /* 143 = 0, old sethostid */ -getrlimit SIMPLE /* 144 = 2, getrlimit */ -setrlimit SIMPLE /* 145 = 2, setrlimit */ -killpg SIMPLE /* 146 = 2, killpg */ -nosys NOSYS /* 147 = 0, nosys */ -nosys NOSYS /* 148 = 0, old quota */ -nosys NOSYS /* 149 = 0, old qquota */ -getsockname SIMPLE /* 150 = 3, getsockname */ -getmsg SIMPLE /* 151 = 4, getmsg */ -putmsg SIMPLE /* 152 = 4, putmsg */ -poll SIMPLE /* 153 = 3, poll */ -nosys NOSYS /* 154 = 0, old nfs_mount */ -nosys NOSYS /* 155 = 1, nfs_svc */ -getdirentries NOSYS /* 156 = 4, getdirentries (pre-4.0) */ -statfs SIMPLE /* 157 = 2, statfs */ -fstatfs SIMPLE /* 158 = 2, fstatfs */ -unmount SIMPLE /* 159 = 1, unmount */ -nosys NOSYS /* 160 = 0, async_daemon */ -nfs_getfh SIMPLE /* 161 = 2, get file handle */ -getdomainname SIMPLE /* 162 = 2, getdomainname */ -setdomainname SIMPLE /* 163 = 2, setdomainname */ -nosys NOSYS /* 164 = 0, not configured */ -nosys NOSYS /* 165 = 4, quotactl */ -exportfs SIMPLE /* 166 = 2, exportfs */ -mount SIMPLE /* 167 = 4, mount */ -ustat SIMPLE /* 168 = 2, ustat */ -semsys SIMPLE /* 169 = 5, semsys */ -msgsys SIMPLE /* 170 = 6, msgsys */ -shmsys SIMPLE /* 171 = 4, shmsys */ -nosys NOSYS /* 172 = 0, not configured */ -nosys NOSYS /* 173 = 0, not configured */ -getdents SIMPLE /* 174 = 3, getdents */ -setsid SIMPLE /* 175 = 1, setsid & s5 setpgrp() */ -fchdir SIMPLE /* 176 = 1, fchdir */ -fchroot SIMPLE /* 177 = 1, fchroot */ -nosys NOSYS /* 178 = 0, not configured */ -aioread SIMPLE /* 179 = 6, aioread */ -aiowrite SIMPLE /* 180 = 6, aiowrite */ -aiowait SIMPLE /* 181 = 1, aiowait */ -aiocancel SIMPLE /* 182 = 1, aiocancel */ -sigpending SIMPLE /* 183 = 1, sigpending */ -nosys NOSYS /* 184 = 0, AVAILABLE */ -setpgid SIMPLE /* 185 = 2, setpgid */ -pathconf SIMPLE /* 186 = 2, pathconf */ -fpathconf SIMPLE /* 187 = 2, fpathconf */ -sysconf SIMPLE /* 188 = 1, sysconf */ -uname SIMPLE /* 189 = 1, uname */ diff --git a/usr/src/ucblib/Makefile b/usr/src/ucblib/Makefile index eb72813393..edb2512a34 100644 --- a/usr/src/ucblib/Makefile +++ b/usr/src/ucblib/Makefile @@ -19,21 +19,15 @@ # # CDDL HEADER END # -# -#ident "%Z%%M% %I% %E% SMI" -# # Copyright 1989-1997,2002 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ucblib/Makefile # -# libbc is special. It depends on libucb and must be built after libucb. SUBDIRS= libucb librpcsoc libdbm libtermcap # libcurses needs libtermcap and libucb SUBDIRS2= libcurses -sparc_SUBDIR= ../lib/libbc -BWOSDIRS= all:= TARGET= all install:= TARGET= install @@ -45,13 +39,11 @@ lint:= TARGET= lint .PARALLEL: $(SUBDIRS) -all install clean clobber: $(SUBDIRS) .WAIT $(SUBDIRS2) .WAIT $($(MACH)_SUBDIR) - -bwos: $(BWOSDIRS) .WAIT $(SUBDIRS) .WAIT $(SUBDIRS2) .WAIT $($(MACH)_SUBDIR) +all install clean clobber: $(SUBDIRS) .WAIT $(SUBDIRS2) install_h: -$(BWOSDIRS) $(SUBDIRS) $(SUBDIRS2) $($(MACH)_SUBDIR) : FRC +$(SUBDIRS) $(SUBDIRS2): FRC @cd $@; pwd; $(MAKE) $(TARGET) FRC: |