diff options
Diffstat (limited to 'usr/src/lib/libbc/libc/gen/sys5')
| -rw-r--r-- | usr/src/lib/libbc/libc/gen/sys5/assert.c | 67 | ||||
| -rw-r--r-- | usr/src/lib/libbc/libc/gen/sys5/nlist.c | 45 | ||||
| -rw-r--r-- | usr/src/lib/libbc/libc/gen/sys5/sgetl.c | 49 | ||||
| -rw-r--r-- | usr/src/lib/libbc/libc/gen/sys5/sighold.c | 118 | ||||
| -rw-r--r-- | usr/src/lib/libbc/libc/gen/sys5/sleep.c | 113 | ||||
| -rw-r--r-- | usr/src/lib/libbc/libc/gen/sys5/sputl.c | 48 | ||||
| -rw-r--r-- | usr/src/lib/libbc/libc/gen/sys5/system.c | 97 |
7 files changed, 0 insertions, 537 deletions
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); -} |
