diff options
Diffstat (limited to 'usr/src/lib/libbc/libc/sys')
148 files changed, 0 insertions, 11709 deletions
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)); -} |
