diff --git a/sys/i386/ibcs2/ibcs2_dirent.h b/sys/i386/ibcs2/ibcs2_dirent.h new file mode 100644 index 000000000000..f93e3a93c5a2 --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_dirent.h @@ -0,0 +1,57 @@ +/* $NetBSD: ibcs2_dirent.h,v 1.2 1994/10/26 02:52:51 cgd Exp $ */ + +/* + * Copyright (c) 1994 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Scott Bartram. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#ifndef _IBCS2_DIRENT_H +#define _IBCS2_DIRENT_H 1 + +#include + +#define IBCS2_MAXNAMLEN 512 +#define IBCS2_DIRBUF 1048 + +typedef struct { + int dd_fd; + int dd_loc; + int dd_size; + char *dd_buf; +} IBCS2_DIR; + +struct ibcs2_dirent { + ibcs2_ino_t d_ino; + short d_pad; + ibcs2_off_t d_off; + u_short d_reclen; + char d_name[1]; +}; + +#endif /* _IBCS2_DIRENT_H */ diff --git a/sys/i386/ibcs2/ibcs2_errno.c b/sys/i386/ibcs2/ibcs2_errno.c new file mode 100644 index 000000000000..48cb88eb9c16 --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_errno.c @@ -0,0 +1,118 @@ +/* + * ibcs2_errno.c + * Copyright (c) 1995 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Scott Bartram. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +int bsd2ibcs_errno[] = { + 0, /* 0 */ + IBCS2_EPERM, /* 1 */ + IBCS2_ENOENT, /* 2 */ + IBCS2_ESRCH, /* 3 */ + IBCS2_EINTR, /* 4 */ + IBCS2_EIO, /* 5 */ + IBCS2_ENXIO, /* 6 */ + IBCS2_E2BIG, /* 7 */ + IBCS2_ENOEXEC, /* 8 */ + IBCS2_EBADF, /* 9 */ + IBCS2_ECHILD, /* 10 */ + IBCS2_EDEADLK, /* 11 */ + IBCS2_ENOMEM, /* 12 */ + IBCS2_EACCES, /* 13 */ + IBCS2_EFAULT, /* 14 */ + IBCS2_ENOTBLK, /* 15 */ + IBCS2_EBUSY, /* 16 */ + IBCS2_EEXIST, /* 17 */ + IBCS2_EXDEV, /* 18 */ + IBCS2_ENODEV, /* 19 */ + IBCS2_ENOTDIR, /* 20 */ + IBCS2_EISDIR, /* 21 */ + IBCS2_EINVAL, /* 22 */ + IBCS2_ENFILE, /* 23 */ + IBCS2_EMFILE, /* 24 */ + IBCS2_ENOTTY, /* 25 */ + IBCS2_ETXTBSY, /* 26 */ + IBCS2_EFBIG, /* 27 */ + IBCS2_ENOSPC, /* 28 */ + IBCS2_ESPIPE, /* 29 */ + IBCS2_EROFS, /* 30 */ + IBCS2_EMLINK, /* 31 */ + IBCS2_EPIPE, /* 32 */ + IBCS2_EDOM, /* 33 */ + IBCS2_ERANGE, /* 34 */ + IBCS2_EAGAIN, /* 35 */ + IBCS2_EINPROGRESS, /* 36 */ + IBCS2_EALREADY, /* 37 */ + IBCS2_ENOTSOCK, /* 38 */ + IBCS2_EDESTADDRREQ, /* 39 */ + IBCS2_EMSGSIZE, /* 40 */ + IBCS2_EPROTOTYPE, /* 41 */ + IBCS2_ENOPROTOOPT, /* 42 */ + IBCS2_EPROTONOSUPPORT, /* 43 */ + IBCS2_ESOCKTNOSUPPORT, /* 44 */ + IBCS2_EOPNOTSUPP, /* 45 */ + IBCS2_EPFNOSUPPORT, /* 46 */ + IBCS2_EAFNOSUPPORT, /* 47 */ + IBCS2_EADDRINUSE, /* 48 */ + IBCS2_EADDRNOTAVAIL, /* 49 */ + IBCS2_ENETDOWN, /* 50 */ + IBCS2_ENETUNREACH, /* 51 */ + IBCS2_ENETRESET, /* 52 */ + IBCS2_ECONNABORTED, /* 53 */ + IBCS2_ECONNRESET, /* 54 */ + IBCS2_ENOBUFS, /* 55 */ + IBCS2_EISCONN, /* 56 */ + IBCS2_ENOTCONN, /* 57 */ + IBCS2_ESHUTDOWN, /* 58 */ + IBCS2_ETOOMANYREFS, /* 59 */ + IBCS2_ETIMEDOUT, /* 60 */ + IBCS2_ECONNREFUSED, /* 61 */ + IBCS2_ELOOP, /* 62 */ + IBCS2_ENAMETOOLONG, /* 63 */ + IBCS2_EHOSTDOWN, /* 64 */ + IBCS2_EHOSTUNREACH, /* 65 */ + IBCS2_ENOTEMPTY, /* 66 */ + 0, /* 67 */ + 0, /* 68 */ + 0, /* 69 */ + IBCS2_ESTALE, /* 70 */ + IBCS2_EREMOTE, /* 71 */ + 0, /* 72 */ + 0, /* 73 */ + 0, /* 74 */ + 0, /* 75 */ + 0, /* 76 */ + IBCS2_ENOLCK, /* 77 */ + IBCS2_ENOSYS, /* 78 */ + 0, /* 79 */ + 0, /* 80 */ + 0, /* 81 */ +}; + diff --git a/sys/i386/ibcs2/ibcs2_errno.h b/sys/i386/ibcs2/ibcs2_errno.h new file mode 100644 index 000000000000..30ed8241ae28 --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_errno.h @@ -0,0 +1,153 @@ +/* + * ibcs2_errno.h + * Copyright (c) 1995 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Scott Bartram. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _IBCS2_ERRNO_H +#define _IBCS2_ERRNO_H + +#define _SCO_NET 1 + +#define IBCS2_EPERM 1 +#define IBCS2_ENOENT 2 +#define IBCS2_ESRCH 3 +#define IBCS2_EINTR 4 +#define IBCS2_EIO 5 +#define IBCS2_ENXIO 6 +#define IBCS2_E2BIG 7 +#define IBCS2_ENOEXEC 8 +#define IBCS2_EBADF 9 +#define IBCS2_ECHILD 10 +#define IBCS2_EAGAIN 11 +#define IBCS2_ENOMEM 12 +#define IBCS2_EACCES 13 +#define IBCS2_EFAULT 14 +#define IBCS2_ENOTBLK 15 +#define IBCS2_EBUSY 16 +#define IBCS2_EEXIST 17 +#define IBCS2_EXDEV 18 +#define IBCS2_ENODEV 19 +#define IBCS2_ENOTDIR 20 +#define IBCS2_EISDIR 21 +#define IBCS2_EINVAL 22 +#define IBCS2_ENFILE 23 +#define IBCS2_EMFILE 24 +#define IBCS2_ENOTTY 25 +#define IBCS2_ETXTBSY 26 +#define IBCS2_EFBIG 27 +#define IBCS2_ENOSPC 28 +#define IBCS2_ESPIPE 29 +#define IBCS2_EROFS 30 +#define IBCS2_EMLINK 31 +#define IBCS2_EPIPE 32 +#define IBCS2_EDOM 33 +#define IBCS2_ERANGE 34 +#define IBCS2_ENOMSG 35 +#define IBCS2_EIDRM 36 +#define IBCS2_ECHRNG 37 +#define IBCS2_EL2NSYNC 38 +#define IBCS2_EL3HLT 39 +#define IBCS2_EL3RST 40 +#define IBCS2_ELNRNG 41 +#define IBCS2_EUNATCH 42 +#define IBCS2_ENOCSI 43 +#define IBCS2_EL2HLT 44 +#define IBCS2_EDEADLK 45 +#define IBCS2_ENOLCK 46 +#define IBCS2_ENOSTR 60 +#define IBCS2_ENODATA 61 +#define IBCS2_ETIME 62 +#define IBCS2_ENOSR 63 +#define IBCS2_ENONET 64 +#define IBCS2_ENOPKG 65 +#define IBCS2_EREMOTE 66 +#define IBCS2_ENOLINK 67 +#define IBCS2_EADV 68 +#define IBCS2_ESRMNT 69 +#define IBCS2_ECOMM 70 +#define IBCS2_EPROTO 71 +#define IBCS2_EMULTIHOP 74 +#define IBCS2_ELBIN 75 +#define IBCS2_EDOTDOT 76 +#define IBCS2_EBADMSG 77 +#define IBCS2_ENAMETOOLONG 78 +#define IBCS2_EOVERFLOW 79 +#define IBCS2_ENOTUNIQ 80 +#define IBCS2_EBADFD 81 +#define IBCS2_EREMCHG 82 +#define IBCS2_EILSEQ 88 +#define IBCS2_ENOSYS 89 + +#if defined(_SCO_NET) /* not strict iBCS2 */ +#define IBCS2_EWOULDBLOCK 90 +#define IBCS2_EINPROGRESS 91 +#define IBCS2_EALREADY 92 +#define IBCS2_ENOTSOCK 93 +#define IBCS2_EDESTADDRREQ 94 +#define IBCS2_EMSGSIZE 95 +#define IBCS2_EPROTOTYPE 96 +#define IBCS2_EPROTONOSUPPORT 97 +#define IBCS2_ESOCKTNOSUPPORT 98 +#define IBCS2_EOPNOTSUPP 99 +#define IBCS2_EPFNOSUPPORT 100 +#define IBCS2_EAFNOSUPPORT 101 +#define IBCS2_EADDRINUSE 102 +#define IBCS2_EADDRNOTAVAIL 103 +#define IBCS2_ENETDOWN 104 +#define IBCS2_ENETUNREACH 105 +#define IBCS2_ENETRESET 106 +#define IBCS2_ECONNABORTED 107 +#define IBCS2_ECONNRESET 108 +#define IBCS2_ENOBUFS IBCS2_ENOSR +#define IBCS2_EISCONN 110 +#define IBCS2_ENOTCONN 111 +#define IBCS2_ESHUTDOWN 112 +#define IBCS2_ETOOMANYREFS 113 +#define IBCS2_ETIMEDOUT 114 +#define IBCS2_ECONNREFUSED 115 +#define IBCS2_EHOSTDOWN 116 +#define IBCS2_EHOSTUNREACH 117 +#define IBCS2_ENOPROTOOPT 118 +#define IBCS2_ENOTEMPTY 145 +#define IBCS2_ELOOP 150 +#else +#define IBCS2_ELOOP 90 +#define IBCS2_EWOULDBLOCK 90 +#define IBCS2_ERESTART 91 +#define IBCS2_ESTRPIPE 92 +#define IBCS2_ENOTEMPTY 93 +#define IBCS2_EUSERS 94 +#endif + +#define IBCS2_ESTALE 151 +#define IBCS2_EIORESID 500 + +extern int bsd2ibcs_errno[]; + +#endif /* _IBCS2_ERRNO_H */ diff --git a/sys/i386/ibcs2/ibcs2_fcntl.c b/sys/i386/ibcs2/ibcs2_fcntl.c new file mode 100644 index 000000000000..4dede8c15b52 --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_fcntl.c @@ -0,0 +1,305 @@ +/* + * Copyright (c) 1995 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + + +static int +cvt_o_flags(flags) + int flags; +{ + int r = 0; + + /* convert mode into NetBSD mode */ + if (flags & IBCS2_O_WRONLY) r |= O_WRONLY; + if (flags & IBCS2_O_RDWR) r |= O_RDWR; + if (flags & (IBCS2_O_NDELAY | IBCS2_O_NONBLOCK)) r |= O_NONBLOCK; + if (flags & IBCS2_O_APPEND) r |= O_APPEND; + if (flags & IBCS2_O_SYNC) r |= O_FSYNC; + if (flags & IBCS2_O_CREAT) r |= O_CREAT; + if (flags & IBCS2_O_TRUNC) r |= O_TRUNC; + if (flags & IBCS2_O_EXCL) r |= O_EXCL; + return r; +} + +static void +cvt_flock2iflock(flp, iflp) + struct flock *flp; + struct ibcs2_flock *iflp; +{ + switch (flp->l_type) { + case F_RDLCK: + iflp->l_type = IBCS2_F_RDLCK; + break; + case F_WRLCK: + iflp->l_type = IBCS2_F_WRLCK; + break; + case F_UNLCK: + iflp->l_type = IBCS2_F_UNLCK; + break; + } + iflp->l_whence = (short)flp->l_whence; + iflp->l_start = (ibcs2_off_t)flp->l_start; + iflp->l_len = (ibcs2_off_t)flp->l_len; + iflp->l_sysid = 0; + iflp->l_pid = (ibcs2_pid_t)flp->l_pid; +} + +static void +cvt_iflock2flock(iflp, flp) + struct ibcs2_flock *iflp; + struct flock *flp; +{ + flp->l_start = (off_t)iflp->l_start; + flp->l_len = (off_t)iflp->l_len; + flp->l_pid = (pid_t)iflp->l_pid; + switch (iflp->l_type) { + case IBCS2_F_RDLCK: + flp->l_type = F_RDLCK; + break; + case IBCS2_F_WRLCK: + flp->l_type = F_WRLCK; + break; + case IBCS2_F_UNLCK: + flp->l_type = F_UNLCK; + break; + } + flp->l_whence = iflp->l_whence; +} + +/* convert iBCS2 mode into NetBSD mode */ +static int +ioflags2oflags(flags) + int flags; +{ + int r = 0; + + if (flags & IBCS2_O_RDONLY) r |= O_RDONLY; + if (flags & IBCS2_O_WRONLY) r |= O_WRONLY; + if (flags & IBCS2_O_RDWR) r |= O_RDWR; + if (flags & IBCS2_O_NDELAY) r |= O_NONBLOCK; + if (flags & IBCS2_O_APPEND) r |= O_APPEND; + if (flags & IBCS2_O_SYNC) r |= O_FSYNC; + if (flags & IBCS2_O_NONBLOCK) r |= O_NONBLOCK; + if (flags & IBCS2_O_CREAT) r |= O_CREAT; + if (flags & IBCS2_O_TRUNC) r |= O_TRUNC; + if (flags & IBCS2_O_EXCL) r |= O_EXCL; + if (flags & IBCS2_O_NOCTTY) r |= O_NOCTTY; + return r; +} + +/* convert NetBSD mode into iBCS2 mode */ +static int +oflags2ioflags(flags) + int flags; +{ + int r = 0; + + if (flags & O_RDONLY) r |= IBCS2_O_RDONLY; + if (flags & O_WRONLY) r |= IBCS2_O_WRONLY; + if (flags & O_RDWR) r |= IBCS2_O_RDWR; + if (flags & O_NDELAY) r |= IBCS2_O_NONBLOCK; + if (flags & O_APPEND) r |= IBCS2_O_APPEND; + if (flags & O_FSYNC) r |= IBCS2_O_SYNC; + if (flags & O_NONBLOCK) r |= IBCS2_O_NONBLOCK; + if (flags & O_CREAT) r |= IBCS2_O_CREAT; + if (flags & O_TRUNC) r |= IBCS2_O_TRUNC; + if (flags & O_EXCL) r |= IBCS2_O_EXCL; + if (flags & O_NOCTTY) r |= IBCS2_O_NOCTTY; + return r; +} + +int +ibcs2_open(p, uap, retval) + struct proc *p; + struct ibcs2_open_args *uap; + int *retval; +{ + int noctty = SCARG(uap, flags) & IBCS2_O_NOCTTY; + int ret; + caddr_t sg = stackgap_init(); + + SCARG(uap, flags) = cvt_o_flags(SCARG(uap, flags)); + if (SCARG(uap, flags) & O_CREAT) + CHECKALTCREAT(p, &sg, SCARG(uap, path)); + else + CHECKALTEXIST(p, &sg, SCARG(uap, path)); + ret = open(p, uap, retval); + + if (!ret && !noctty && SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) { + struct filedesc *fdp = p->p_fd; + struct file *fp = fdp->fd_ofiles[*retval]; + + /* ignore any error, just give it a try */ + if (fp->f_type == DTYPE_VNODE) + (fp->f_ops->fo_ioctl)(fp, TIOCSCTTY, (caddr_t) 0, p); + } + return ret; +} + +int +ibcs2_creat(p, uap, retval) + struct proc *p; + struct ibcs2_creat_args *uap; + int *retval; +{ + struct open_args cup; + caddr_t sg = stackgap_init(); + + CHECKALTCREAT(p, &sg, SCARG(uap, path)); + SCARG(&cup, path) = SCARG(uap, path); + SCARG(&cup, mode) = SCARG(uap, mode); + SCARG(&cup, flags) = O_WRONLY | O_CREAT | O_TRUNC; + return open(p, &cup, retval); +} + +int +ibcs2_access(p, uap, retval) + struct proc *p; + struct ibcs2_access_args *uap; + int *retval; +{ + struct access_args cup; + caddr_t sg = stackgap_init(); + + CHECKALTEXIST(p, &sg, SCARG(uap, path)); + SCARG(&cup, path) = SCARG(uap, path); + SCARG(&cup, flags) = SCARG(uap, flags); + return access(p, &cup, retval); +} + +int +ibcs2_fcntl(p, uap, retval) + struct proc *p; + struct ibcs2_fcntl_args *uap; + int *retval; +{ + int error; + struct fcntl_args fa; + struct flock *flp; + struct ibcs2_flock ifl; + + switch(SCARG(uap, cmd)) { + case IBCS2_F_DUPFD: + SCARG(&fa, fd) = SCARG(uap, fd); + SCARG(&fa, cmd) = F_DUPFD; + SCARG(&fa, arg) = SCARG(uap, arg); + return fcntl(p, &fa, retval); + case IBCS2_F_GETFD: + SCARG(&fa, fd) = SCARG(uap, fd); + SCARG(&fa, cmd) = F_GETFD; + SCARG(&fa, arg) = SCARG(uap, arg); + return fcntl(p, &fa, retval); + case IBCS2_F_SETFD: + SCARG(&fa, fd) = SCARG(uap, fd); + SCARG(&fa, cmd) = F_SETFD; + SCARG(&fa, arg) = SCARG(uap, arg); + return fcntl(p, &fa, retval); + case IBCS2_F_GETFL: + SCARG(&fa, fd) = SCARG(uap, fd); + SCARG(&fa, cmd) = F_GETFL; + SCARG(&fa, arg) = SCARG(uap, arg); + error = fcntl(p, &fa, retval); + if (error) + return error; + *retval = oflags2ioflags(*retval); + return error; + case IBCS2_F_SETFL: + SCARG(&fa, fd) = SCARG(uap, fd); + SCARG(&fa, cmd) = F_SETFL; + SCARG(&fa, arg) = (void *)ioflags2oflags(SCARG(uap, arg)); + return fcntl(p, &fa, retval); + + case IBCS2_F_GETLK: + { + caddr_t sg = stackgap_init(); + flp = stackgap_alloc(&sg, sizeof(*flp)); + error = copyin((caddr_t)SCARG(uap, arg), (caddr_t)&ifl, + ibcs2_flock_len); + if (error) + return error; + cvt_iflock2flock(&ifl, flp); + SCARG(&fa, fd) = SCARG(uap, fd); + SCARG(&fa, cmd) = F_GETLK; + SCARG(&fa, arg) = (void *)flp; + error = fcntl(p, &fa, retval); + if (error) + return error; + cvt_flock2iflock(flp, &ifl); + return copyout((caddr_t)&ifl, (caddr_t)SCARG(uap, arg), + ibcs2_flock_len); + } + + case IBCS2_F_SETLK: + { + caddr_t sg = stackgap_init(); + flp = stackgap_alloc(&sg, sizeof(*flp)); + error = copyin((caddr_t)SCARG(uap, arg), (caddr_t)&ifl, + ibcs2_flock_len); + if (error) + return error; + cvt_iflock2flock(&ifl, flp); + SCARG(&fa, fd) = SCARG(uap, fd); + SCARG(&fa, cmd) = F_SETLK; + SCARG(&fa, arg) = (void *)flp; + return fcntl(p, &fa, retval); + } + + case IBCS2_F_SETLKW: + { + caddr_t sg = stackgap_init(); + flp = stackgap_alloc(&sg, sizeof(*flp)); + error = copyin((caddr_t)SCARG(uap, arg), (caddr_t)&ifl, + ibcs2_flock_len); + if (error) + return error; + cvt_iflock2flock(&ifl, flp); + SCARG(&fa, fd) = SCARG(uap, fd); + SCARG(&fa, cmd) = F_SETLKW; + SCARG(&fa, arg) = (void *)flp; + return fcntl(p, &fa, retval); + } + } + return ENOSYS; +} diff --git a/sys/i386/ibcs2/ibcs2_fcntl.h b/sys/i386/ibcs2/ibcs2_fcntl.h new file mode 100644 index 000000000000..b75537cb66f5 --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_fcntl.h @@ -0,0 +1,76 @@ +/* $NetBSD: ibcs2_fcntl.h,v 1.2 1994/10/26 02:52:54 cgd Exp $ */ + +/* + * Copyright (c) 1994 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Scott Bartram. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _IBCS2_FCNTL_H +#define _IBCS2_FCNTL_H 1 + +#include + +#define IBCS2_O_RDONLY 0x0000 +#define IBCS2_O_WRONLY 0x0001 +#define IBCS2_O_RDWR 0x0002 +#define IBCS2_O_NDELAY 0x0004 +#define IBCS2_O_APPEND 0x0008 +#define IBCS2_O_SYNC 0x0010 +#define IBCS2_O_NONBLOCK 0x0080 +#define IBCS2_O_CREAT 0x0100 +#define IBCS2_O_TRUNC 0x0200 +#define IBCS2_O_EXCL 0x0400 +#define IBCS2_O_NOCTTY 0x0800 + +#define IBCS2_F_DUPFD 0 +#define IBCS2_F_GETFD 1 +#define IBCS2_F_SETFD 2 +#define IBCS2_F_GETFL 3 +#define IBCS2_F_SETFL 4 +#define IBCS2_F_GETLK 5 +#define IBCS2_F_SETLK 6 +#define IBCS2_F_SETLKW 7 + +struct ibcs2_flock { + short l_type; + short l_whence; + ibcs2_off_t l_start; + ibcs2_off_t l_len; + short l_sysid; + ibcs2_pid_t l_pid; +}; +#define ibcs2_flock_len (sizeof(struct ibcs2_flock)) + +#define IBCS2_F_RDLCK 1 +#define IBCS2_F_WRLCK 2 +#define IBCS2_F_UNLCK 3 + +#define IBCS2_O_ACCMODE 3 +#define IBCS2_FD_CLOEXEC 1 + +#endif /* _IBCS2_FCNTL_H */ diff --git a/sys/i386/ibcs2/ibcs2_mount.h b/sys/i386/ibcs2/ibcs2_mount.h new file mode 100644 index 000000000000..d1b9aaaedc24 --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_mount.h @@ -0,0 +1,41 @@ +/* $NetBSD: ibcs2_mount.h,v 1.2 1994/10/26 02:53:00 cgd Exp $ */ + +/* + * Copyright (c) 1994 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Scott Bartram. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _IBCS2_MOUNT_H +#define _IBCS2_MOUNT_H + +#define IBCS2_MS_RDONLY 0x01 +#define IBCS2_MS_FSS 0x02 +#define IBCS2_MS_DATA 0x04 +#define IBCS2_MS_CACHE 0x08 + +#endif /* _IBCS2_MOUNT_H */ diff --git a/sys/i386/ibcs2/ibcs2_signal.h b/sys/i386/ibcs2/ibcs2_signal.h new file mode 100644 index 000000000000..2858688d79d8 --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_signal.h @@ -0,0 +1,105 @@ +/* $NetBSD: ibcs2_signal.h,v 1.7 1995/08/14 02:26:01 mycroft Exp $ */ + +/* + * Copyright (c) 1994, 1995 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Scott Bartram. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _IBCS2_SIGNAL_H +#define _IBCS2_SIGNAL_H + +#define IBCS2_SIGHUP 1 +#define IBCS2_SIGINT 2 +#define IBCS2_SIGQUIT 3 +#define IBCS2_SIGILL 4 +#define IBCS2_SIGTRAP 5 +#define IBCS2_SIGIOT 6 +#define IBCS2_SIGABRT 6 +#define IBCS2_SIGEMT 7 +#define IBCS2_SIGFPE 8 +#define IBCS2_SIGKILL 9 +#define IBCS2_SIGBUS 10 +#define IBCS2_SIGSEGV 11 +#define IBCS2_SIGSYS 12 +#define IBCS2_SIGPIPE 13 +#define IBCS2_SIGALRM 14 +#define IBCS2_SIGTERM 15 +#define IBCS2_SIGUSR1 16 +#define IBCS2_SIGUSR2 17 +#define IBCS2_SIGCLD 18 +#define IBCS2_SIGPWR 19 +#define IBCS2_SIGWINCH 20 +#define IBCS2_SIGPOLL 22 +#define IBCS2_NSIG 32 + +/* + * SCO-specific + */ +#define IBCS2_SIGSTOP 23 +#define IBCS2_SIGTSTP 24 +#define IBCS2_SIGCONT 25 +#define IBCS2_SIGTTIN 26 +#define IBCS2_SIGTTOU 27 +#define IBCS2_SIGVTALRM 28 +#define IBCS2_SIGPROF 29 + +#define IBCS2_SIGNO_MASK 0x00FF +#define IBCS2_SIGNAL_MASK 0x0000 +#define IBCS2_SIGSET_MASK 0x0100 +#define IBCS2_SIGHOLD_MASK 0x0200 +#define IBCS2_SIGRELSE_MASK 0x0400 +#define IBCS2_SIGIGNORE_MASK 0x0800 +#define IBCS2_SIGPAUSE_MASK 0x1000 + +#define IBCS2_SIGNO(x) ((x) & IBCS2_SIGNO_MASK) +#define IBCS2_SIGCALL(x) ((x) & ~IBCS2_SIGNO_MASK) + +#define IBCS2_SIG_DFL (void(*)())0 +#define IBCS2_SIG_ERR (void(*)())-1 +#define IBCS2_SIG_IGN (void(*)())1 +#define IBCS2_SIG_HOLD (void(*)())2 + +#define IBCS2_SIG_SETMASK 0 +#define IBCS2_SIG_BLOCK 1 +#define IBCS2_SIG_UNBLOCK 2 + +typedef long ibcs2_sigset_t; +typedef void (*ibcs2_sig_t) __P((int)); + +struct ibcs2_sigaction { + ibcs2_sig_t sa_handler; + ibcs2_sigset_t sa_mask; + int sa_flags; +}; + +/* sa_flags */ +#define IBCS2_SA_NOCLDSTOP 1 + +extern int bsd_to_ibcs2_sig[]; + +#endif /* _IBCS2_SIGNAL_H */ diff --git a/sys/i386/ibcs2/ibcs2_stat.c b/sys/i386/ibcs2/ibcs2_stat.c new file mode 100644 index 000000000000..a9d5c4bb0f9f --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_stat.c @@ -0,0 +1,244 @@ +/* + * Copyright (c) 1995 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +static void +bsd_stat2ibcs_stat(st, st4) + struct ostat *st; + struct ibcs2_stat *st4; +{ + bzero(st4, sizeof(*st4)); + st4->st_dev = (ibcs2_dev_t)st->st_dev; + st4->st_ino = (ibcs2_ino_t)st->st_ino; + st4->st_mode = (ibcs2_mode_t)st->st_mode; + st4->st_nlink = (ibcs2_nlink_t)st->st_nlink; + st4->st_uid = (ibcs2_uid_t)st->st_uid; + st4->st_gid = (ibcs2_gid_t)st->st_gid; + st4->st_rdev = (ibcs2_dev_t)st->st_rdev; + st4->st_size = (ibcs2_off_t)st->st_size; + st4->st_atim = (ibcs2_time_t)st->st_atime; + st4->st_mtim = (ibcs2_time_t)st->st_mtime; + st4->st_ctim = (ibcs2_time_t)st->st_ctime; +} + +static int +cvt_statfs(sp, buf, len) + struct statfs *sp; + caddr_t buf; + int len; +{ + struct ibcs2_statfs ssfs; + + bzero(&ssfs, sizeof ssfs); + ssfs.f_fstyp = 0; + ssfs.f_bsize = sp->f_bsize; + ssfs.f_frsize = 0; + ssfs.f_blocks = sp->f_blocks; + ssfs.f_bfree = sp->f_bfree; + ssfs.f_files = sp->f_files; + ssfs.f_ffree = sp->f_ffree; + ssfs.f_fname[0] = 0; + ssfs.f_fpack[0] = 0; + return copyout((caddr_t)&ssfs, buf, len); +} + +int +ibcs2_statfs(p, uap, retval) + struct proc *p; + struct ibcs2_statfs_args *uap; + int *retval; +{ + register struct mount *mp; + register struct statfs *sp; + int error; + struct nameidata nd; + caddr_t sg = stackgap_init(); + + CHECKALTEXIST(p, &sg, SCARG(uap, path)); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); + if (error = namei(&nd)) + return (error); + mp = nd.ni_vp->v_mount; + sp = &mp->mnt_stat; + vrele(nd.ni_vp); + if (error = VFS_STATFS(mp, sp, p)) + return (error); + sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; + return cvt_statfs(sp, (caddr_t)SCARG(uap, buf), SCARG(uap, len)); +} + +int +ibcs2_fstatfs(p, uap, retval) + struct proc *p; + struct ibcs2_fstatfs_args *uap; + int *retval; +{ + struct file *fp; + struct mount *mp; + register struct statfs *sp; + int error; + + if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) + return (error); + mp = ((struct vnode *)fp->f_data)->v_mount; + sp = &mp->mnt_stat; + if (error = VFS_STATFS(mp, sp, p)) + return (error); + sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; + return cvt_statfs(sp, (caddr_t)SCARG(uap, buf), SCARG(uap, len)); +} + +int +ibcs2_stat(p, uap, retval) + struct proc *p; + struct ibcs2_stat_args *uap; + int *retval; +{ + struct ostat st; + struct ibcs2_stat ibcs2_st; + struct compat_43_stat_args cup; + int error; + caddr_t sg = stackgap_init(); + + CHECKALTEXIST(p, &sg, SCARG(uap, path)); + SCARG(&cup, path) = SCARG(uap, path); + SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(st)); + if (error = compat_43_stat(p, &cup, retval)) + return error; + if (error = copyin(SCARG(&cup, ub), &st, sizeof(st))) + return error; + bsd_stat2ibcs_stat(&st, &ibcs2_st); + return copyout((caddr_t)&ibcs2_st, (caddr_t)SCARG(uap, st), + ibcs2_stat_len); +} + +int +ibcs2_lstat(p, uap, retval) + struct proc *p; + struct ibcs2_lstat_args *uap; + int *retval; +{ + struct ostat st; + struct ibcs2_stat ibcs2_st; + struct compat_43_lstat_args cup; + int error; + caddr_t sg = stackgap_init(); + + CHECKALTEXIST(p, &sg, SCARG(uap, path)); + SCARG(&cup, path) = SCARG(uap, path); + SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(st)); + if (error = compat_43_lstat(p, &cup, retval)) + return error; + if (error = copyin(SCARG(&cup, ub), &st, sizeof(st))) + return error; + bsd_stat2ibcs_stat(&st, &ibcs2_st); + return copyout((caddr_t)&ibcs2_st, (caddr_t)SCARG(uap, st), + ibcs2_stat_len); +} + +int +ibcs2_fstat(p, uap, retval) + struct proc *p; + struct ibcs2_fstat_args *uap; + int *retval; +{ + struct ostat st; + struct ibcs2_stat ibcs2_st; + struct compat_43_fstat_args cup; + int error; + caddr_t sg = stackgap_init(); + + SCARG(&cup, fd) = SCARG(uap, fd); + SCARG(&cup, sb) = stackgap_alloc(&sg, sizeof(st)); + if (error = compat_43_fstat(p, &cup, retval)) + return error; + if (error = copyin(SCARG(&cup, sb), &st, sizeof(st))) + return error; + bsd_stat2ibcs_stat(&st, &ibcs2_st); + return copyout((caddr_t)&ibcs2_st, (caddr_t)SCARG(uap, st), + ibcs2_stat_len); +} + +int +ibcs2_utssys(p, uap, retval) + struct proc *p; + struct ibcs2_utssys_args *uap; + int *retval; +{ + switch (SCARG(uap, flag)) { + case 0: /* uname(2) */ + { + struct ibcs2_utsname sut; + extern char ostype[], machine[], osrelease[]; + + bzero(&sut, ibcs2_utsname_len); + bcopy(ostype, sut.sysname, sizeof(sut.sysname) - 1); + bcopy(hostname, sut.nodename, sizeof(sut.nodename)); + sut.nodename[sizeof(sut.nodename)-1] = '\0'; + bcopy(osrelease, sut.release, sizeof(sut.release) - 1); + bcopy("1", sut.version, sizeof(sut.version) - 1); + bcopy(machine, sut.machine, sizeof(sut.machine) - 1); + + return copyout((caddr_t)&sut, (caddr_t)SCARG(uap, a1), + ibcs2_utsname_len); + } + + case 2: /* ustat(2) */ + { + return ENOSYS; /* XXX - TODO */ + } + + default: + return ENOSYS; + } +} diff --git a/sys/i386/ibcs2/ibcs2_stat.h b/sys/i386/ibcs2/ibcs2_stat.h new file mode 100644 index 000000000000..2eb01027e0cc --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_stat.h @@ -0,0 +1,89 @@ +/* $NetBSD: ibcs2_stat.h,v 1.2 1994/10/26 02:53:03 cgd Exp $ */ + +/* + * Copyright (c) 1994 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Scott Bartram. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _IBCS2_STAT_H +#define _IBCS2_STAT_H + +#include + +struct ibcs2_stat { + ibcs2_dev_t st_dev; + ibcs2_ino_t st_ino; + ibcs2_mode_t st_mode; + ibcs2_nlink_t st_nlink; + ibcs2_uid_t st_uid; + ibcs2_gid_t st_gid; + ibcs2_dev_t st_rdev; + ibcs2_off_t st_size; + ibcs2_time_t st_atim; + ibcs2_time_t st_mtim; + ibcs2_time_t st_ctim; +}; + +#define ibcs2_stat_len (sizeof(struct ibcs2_stat)) + +#define IBCS2_S_IFMT 0xf000 +#define IBCS2_S_IFIFO 0x1000 +#define IBCS2_S_IFCHR 0x2000 +#define IBCS2_S_IFDIR 0x4000 +#define IBCS2_S_IFBLK 0x6000 +#define IBCS2_S_IFREG 0x8000 +#define IBCS2_S_IFSOCK 0xc000 + +#define IBCS2_S_IFNAM 0x5000 +#define IBCS2_S_IFLNK 0xa000 + +#define IBCS2_S_ISUID 0x0800 +#define IBCS2_S_ISGID 0x0400 +#define IBCS2_S_ISVTX 0x0200 + +#define IBCS2_S_IRWXU 0x01c0 +#define IBCS2_S_IRUSR 0x0100 +#define IBCS2_S_IWUSR 0x0080 +#define IBCS2_S_IXUSR 0x0040 +#define IBCS2_S_IRWXG 0x0038 +#define IBCS2_S_IRGRP 0x0020 +#define IBCS2_S_IWGRP 0x000f +#define IBCS2_S_IXGRP 0x0008 +#define IBCS2_S_IRWXO 0x0007 +#define IBCS2_S_IROTH 0x0004 +#define IBCS2_S_IWOTH 0x0002 +#define IBCS2_S_IXOTH 0x0001 + +#define IBCS2_S_ISFIFO(mode) (((mode) & IBCS2_S_IFMT) == IBCS2_S_IFIFO) +#define IBCS2_S_ISCHR(mode) (((mode) & IBCS2_S_IFMT) == IBCS2_S_IFCHR) +#define IBCS2_S_ISDIR(mode) (((mode) & IBCS2_S_IFMT) == IBCS2_S_IFDIR) +#define IBCS2_S_ISBLK(mode) (((mode) & IBCS2_S_IFMT) == IBCS2_S_IFBLK) +#define IBCS2_S_ISREG(mode) (((mode) & IBCS2_S_IFMT) == IBCS2_S_IFREG) +#define IBCS2_S_ISSOCK(mode) (((mode) & IBCS2_S_IFMT) == IBCS2_S_IFSOCK) + +#endif /* _IBCS2_STAT_H */ diff --git a/sys/i386/ibcs2/ibcs2_statfs.h b/sys/i386/ibcs2/ibcs2_statfs.h new file mode 100644 index 000000000000..d6e0100c1eb9 --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_statfs.h @@ -0,0 +1,48 @@ +/* $NetBSD: ibcs2_statfs.h,v 1.2 1994/10/26 02:53:06 cgd Exp $ */ + +/* + * Copyright (c) 1994 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Scott Bartram. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _IBCS2_STATFS_H +#define _IBCS2_STATFS_H + +struct ibcs2_statfs { + short f_fstyp; + long f_bsize; + long f_frsize; + long f_blocks; + long f_bfree; + long f_files; + long f_ffree; + char f_fname[6]; + char f_fpack[6]; +}; + +#endif /* _IBCS2_STATFS_H */ diff --git a/sys/i386/ibcs2/ibcs2_stropts.h b/sys/i386/ibcs2/ibcs2_stropts.h new file mode 100644 index 000000000000..4d26e7358265 --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_stropts.h @@ -0,0 +1,48 @@ +/* + * ibcs2_stropts.h + * Copyright (c) 1995 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _IBCS2_STROPTS_H +#define _IBCS2_STROPTS_H + +#define IBCS2_STR ('S'<<8) +#define IBCS2_I_NREAD (IBCS2_STR|01) +#define IBCS2_I_PUSH (IBCS2_STR|02) +#define IBCS2_I_POP (IBCS2_STR|03) +#define IBCS2_I_LOOK (IBCS2_STR|04) +#define IBCS2_I_FLUSH (IBCS2_STR|05) +#define IBCS2_I_SRDOPT (IBCS2_STR|06) +#define IBCS2_I_GRDOPT (IBCS2_STR|07) +#define IBCS2_I_STR (IBCS2_STR|010) +#define IBCS2_I_SETSIG (IBCS2_STR|011) +#define IBCS2_I_GETSIG (IBCS2_STR|012) +#define IBCS2_I_FIND (IBCS2_STR|013) +#define IBCS2_I_LINK (IBCS2_STR|014) +#define IBCS2_I_UNLINK (IBCS2_STR|015) +#define IBCS2_I_PEEK (IBCS2_STR|017) +#define IBCS2_I_FDINSERT (IBCS2_STR|020) +#define IBCS2_I_SENDFD (IBCS2_STR|021) +#define IBCS2_I_RECVFD (IBCS2_STR|022) + +#endif /* _IBCS2_STROPTS_H */ diff --git a/sys/i386/ibcs2/ibcs2_syscall.h b/sys/i386/ibcs2/ibcs2_syscall.h new file mode 100644 index 000000000000..f02ad4242204 --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_syscall.h @@ -0,0 +1,97 @@ +/* + * System call numbers. + * + * DO NOT EDIT-- this file is automatically generated. + * created from NetBSD: syscalls.master,v 1.4 1995/03/14 15:12:52 scottb Exp + */ + +#define IBCS2_SYS_syscall 0 +#define IBCS2_SYS_exit 1 +#define IBCS2_SYS_fork 2 +#define IBCS2_SYS_ibcs2_read 3 +#define IBCS2_SYS_write 4 +#define IBCS2_SYS_ibcs2_open 5 +#define IBCS2_SYS_close 6 +#define IBCS2_SYS_ibcs2_waitsys 7 +#define IBCS2_SYS_ibcs2_creat 8 +#define IBCS2_SYS_link 9 +#define IBCS2_SYS_ibcs2_unlink 10 +#define IBCS2_SYS_ibcs2_execv 11 +#define IBCS2_SYS_ibcs2_chdir 12 +#define IBCS2_SYS_ibcs2_time 13 +#define IBCS2_SYS_ibcs2_mknod 14 +#define IBCS2_SYS_ibcs2_chmod 15 +#define IBCS2_SYS_ibcs2_chown 16 +#define IBCS2_SYS_obreak 17 +#define IBCS2_SYS_ibcs2_stat 18 +#define IBCS2_SYS_compat_43_lseek 19 +#define IBCS2_SYS_getpid 20 +#define IBCS2_SYS_ibcs2_mount 21 +#define IBCS2_SYS_ibcs2_umount 22 +#define IBCS2_SYS_ibcs2_setuid 23 +#define IBCS2_SYS_getuid 24 +#define IBCS2_SYS_ibcs2_stime 25 +#define IBCS2_SYS_ibcs2_alarm 27 +#define IBCS2_SYS_ibcs2_fstat 28 +#define IBCS2_SYS_ibcs2_pause 29 +#define IBCS2_SYS_ibcs2_utime 30 +#define IBCS2_SYS_ibcs2_access 33 +#define IBCS2_SYS_ibcs2_nice 34 +#define IBCS2_SYS_ibcs2_statfs 35 +#define IBCS2_SYS_sync 36 +#define IBCS2_SYS_ibcs2_kill 37 +#define IBCS2_SYS_ibcs2_fstatfs 38 +#define IBCS2_SYS_ibcs2_pgrpsys 39 +#define IBCS2_SYS_dup 41 +#define IBCS2_SYS_pipe 42 +#define IBCS2_SYS_ibcs2_times 43 +#define IBCS2_SYS_ibcs2_plock 45 +#define IBCS2_SYS_ibcs2_setgid 46 +#define IBCS2_SYS_getgid 47 +#define IBCS2_SYS_ibcs2_sigsys 48 +#define IBCS2_SYS_ibcs2_msgsys 49 +#define IBCS2_SYS_ibcs2_shmsys 52 +#define IBCS2_SYS_ibcs2_semsys 53 +#define IBCS2_SYS_ibcs2_ioctl 54 +#define IBCS2_SYS_ibcs2_uadmin 55 +#define IBCS2_SYS_ibcs2_utssys 57 +#define IBCS2_SYS_ibcs2_execve 59 +#define IBCS2_SYS_umask 60 +#define IBCS2_SYS_chroot 61 +#define IBCS2_SYS_ibcs2_fcntl 62 +#define IBCS2_SYS_ibcs2_ulimit 63 + /* 70 is obsolete rfs_advfs */ + /* 71 is obsolete rfs_unadvfs */ + /* 72 is obsolete rfs_rmount */ + /* 73 is obsolete rfs_rumount */ + /* 74 is obsolete rfs_rfstart */ + /* 75 is obsolete rfs_sigret */ + /* 76 is obsolete rfs_rdebug */ + /* 77 is obsolete rfs_rfstop */ +#define IBCS2_SYS_ibcs2_rmdir 79 +#define IBCS2_SYS_ibcs2_mkdir 80 +#define IBCS2_SYS_ibcs2_getdents 81 +#define IBCS2_SYS_ibcs2_sysfs 84 +#define IBCS2_SYS_ibcs2_getmsg 85 +#define IBCS2_SYS_ibcs2_putmsg 86 +#define IBCS2_SYS_ibcs2_poll 87 +#define IBCS2_SYS_ibcs2_symlink 90 +#define IBCS2_SYS_ibcs2_lstat 91 +#define IBCS2_SYS_ibcs2_readlink 92 +#define IBCS2_SYS_sigreturn 103 +#define IBCS2_SYS_xenix_rdchk 135 +#define IBCS2_SYS_xenix_chsize 138 +#define IBCS2_SYS_xenix_ftime 139 +#define IBCS2_SYS_xenix_nap 140 +#define IBCS2_SYS_select 164 +#define IBCS2_SYS_ibcs2_sigaction 167 +#define IBCS2_SYS_ibcs2_sigprocmask 168 +#define IBCS2_SYS_ibcs2_sigpending 169 +#define IBCS2_SYS_ibcs2_sigsuspend 170 +#define IBCS2_SYS_ibcs2_getgroups 171 +#define IBCS2_SYS_ibcs2_setgroups 172 +#define IBCS2_SYS_ibcs2_sysconf 173 +#define IBCS2_SYS_ibcs2_pathconf 174 +#define IBCS2_SYS_ibcs2_fpathconf 175 +#define IBCS2_SYS_ibcs2_rename 176 +#define IBCS2_SYS_MAXSYSCALL 177 diff --git a/sys/i386/ibcs2/ibcs2_termios.h b/sys/i386/ibcs2/ibcs2_termios.h new file mode 100644 index 000000000000..35602cf999d9 --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_termios.h @@ -0,0 +1,235 @@ +/* $NetBSD: ibcs2_termios.h,v 1.3 1994/10/26 02:53:07 cgd Exp $ */ + +/* + * Copyright (c) 1994 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Scott Bartram. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _IBCS2_TERMIOS_H +#define _IBCS2_TERMIOS_H 1 + +#include + +#define IBCS2_NCC 8 +#define IBCS2_NCCS 13 + +typedef u_short ibcs2_tcflag_t; +typedef u_char ibcs2_cc_t; +typedef u_long ibcs2_speed_t; + +struct ibcs2_termio { + u_short c_iflag; + u_short c_oflag; + u_short c_cflag; + u_short c_lflag; + char c_line; + u_char c_cc[IBCS2_NCC]; +}; + +struct ibcs2_termios { + ibcs2_tcflag_t c_iflag; + ibcs2_tcflag_t c_oflag; + ibcs2_tcflag_t c_cflag; + ibcs2_tcflag_t c_lflag; + char c_line; + ibcs2_cc_t c_cc[IBCS2_NCCS]; + char c_ispeed; + char c_ospeed; +}; + +#define IBCS2_VINTR 0 +#define IBCS2_VQUIT 1 +#define IBCS2_VERASE 2 +#define IBCS2_VKILL 3 +#define IBCS2_VEOF 4 +#define IBCS2_VEOL 5 +#define IBCS2_VEOL2 6 +#define IBCS2_VMIN 4 +#define IBCS2_VTIME 5 +#define IBCS2_VSWTCH 7 +#define IBCS2_VSUSP 10 +#define IBCS2_VSTART 11 +#define IBCS2_VSTOP 12 + +#define IBCS2_CNUL 0 +#define IBCS2_CDEL 0377 +#define IBCS2_CESC '\\' +#define IBCS2_CINTR 0177 +#define IBCS2_CQUIT 034 +#define IBCS2_CERASE '#' +#define IBCS2_CKILL '@' +#define IBCS2_CSTART 021 +#define IBCS2_CSTOP 023 +#define IBCS2_CSWTCH 032 +#define IBCS2_CNSWTCH 0 +#define IBCS2_CSUSP 032 + +#define IBCS2_IGNBRK 0000001 +#define IBCS2_BRKINT 0000002 +#define IBCS2_IGNPAR 0000004 +#define IBCS2_PARMRK 0000010 +#define IBCS2_INPCK 0000020 +#define IBCS2_ISTRIP 0000040 +#define IBCS2_INLCR 0000100 +#define IBCS2_IGNCR 0000200 +#define IBCS2_ICRNL 0000400 +#define IBCS2_IUCLC 0001000 +#define IBCS2_IXON 0002000 +#define IBCS2_IXANY 0004000 +#define IBCS2_IXOFF 0010000 +#define IBCS2_IMAXBEL 0020000 +#define IBCS2_DOSMODE 0100000 + +#define IBCS2_OPOST 0000001 +#define IBCS2_OLCUC 0000002 +#define IBCS2_ONLCR 0000004 +#define IBCS2_OCRNL 0000010 +#define IBCS2_ONOCR 0000020 +#define IBCS2_ONLRET 0000040 +#define IBCS2_OFILL 0000100 +#define IBCS2_OFDEL 0000200 +#define IBCS2_NLDLY 0000400 +#define IBCS2_NL0 0000000 +#define IBCS2_NL1 0000400 +#define IBCS2_CRDLY 0003000 +#define IBCS2_CR0 0000000 +#define IBCS2_CR1 0001000 +#define IBCS2_CR2 0002000 +#define IBCS2_CR3 0003000 +#define IBCS2_TABDLY 0014000 +#define IBCS2_TAB0 0000000 +#define IBCS2_TAB1 0004000 +#define IBCS2_TAB2 0010000 +#define IBCS2_TAB3 0014000 +#define IBCS2_BSDLY 0020000 +#define IBCS2_BS0 0000000 +#define IBCS2_BS1 0020000 +#define IBCS2_VTDLY 0040000 +#define IBCS2_VT0 0000000 +#define IBCS2_VT1 0040000 +#define IBCS2_FFDLY 0100000 +#define IBCS2_FF0 0000000 +#define IBCS2_FF1 0100000 + +#define IBCS2_CBAUD 0000017 +#define IBCS2_CSIZE 0000060 +#define IBCS2_CS5 0000000 +#define IBCS2_CS6 0000020 +#define IBCS2_CS7 0000040 +#define IBCS2_CS8 0000060 +#define IBCS2_CSTOPB 0000100 +#define IBCS2_CREAD 0000200 +#define IBCS2_PARENB 0000400 +#define IBCS2_PARODD 0001000 +#define IBCS2_HUPCL 0002000 +#define IBCS2_CLOCAL 0004000 +#define IBCS2_RCV1EN 0010000 +#define IBCS2_XMT1EN 0020000 +#define IBCS2_LOBLK 0040000 +#define IBCS2_XCLUDE 0100000 + +#define IBCS2_ISIG 0000001 +#define IBCS2_ICANON 0000002 +#define IBCS2_XCASE 0000004 +#define IBCS2_ECHO 0000010 +#define IBCS2_ECHOE 0000020 +#define IBCS2_ECHOK 0000040 +#define IBCS2_ECHONL 0000100 +#define IBCS2_NOFLSH 0000200 +#define IBCS2_IEXTEN 0000400 +#define IBCS2_TOSTOP 0001000 + +#define IBCS2_XIOC (('i'<<24)|('X'<<16)) +#define IBCS2_XCGETA (IBCS2_XIOC|1) +#define IBCS2_XCSETA (IBCS2_XIOC|2) +#define IBCS2_XCSETAW (IBCS2_XIOC|3) +#define IBCS2_XCSETAF (IBCS2_XIOC|4) + +#define IBCS2_OXIOC ('x'<<8) +#define IBCS2_OXCGETA (IBCS2_OXIOC|1) +#define IBCS2_OXCSETA (IBCS2_OXIOC|2) +#define IBCS2_OXCSETAW (IBCS2_OXIOC|3) +#define IBCS2_OXCSETAF (IBCS2_OXIOC|4) + +#define IBCS2_TIOC ('T'<<8) +#define IBCS2_TCGETA (IBCS2_TIOC|1) +#define IBCS2_TCSETA (IBCS2_TIOC|2) +#define IBCS2_TCSETAW (IBCS2_TIOC|3) +#define IBCS2_TCSETAF (IBCS2_TIOC|4) +#define IBCS2_TCSBRK (IBCS2_TIOC|5) +#define IBCS2_TCXONC (IBCS2_TIOC|6) +#define IBCS2_TCFLSH (IBCS2_TIOC|7) + +#define IBCS2_TCGETSC (IBCS2_TIOC|34) +#define IBCS2_TCSETSC (IBCS2_TIOC|35) + +#define IBCS2_TIOCSWINSZ (IBCS2_TIOC|103) +#define IBCS2_TIOCGWINSZ (IBCS2_TIOC|104) +#define IBCS2_TIOCSPGRP (IBCS2_TIOC|118) +#define IBCS2_TIOCGPGRP (IBCS2_TIOC|119) + +#define IBCS2_TCSANOW IBCS2_XCSETA +#define IBCS2_TCSADRAIN IBCS2_XCSETAW +#define IBCS2_TCSAFLUSH IBCS2_XCSETAF +#define IBCS2_TCSADFLUSH IBCS2_XCSETAF + +#define IBCS2_TCIFLUSH 0 +#define IBCS2_TCOFLUSH 1 +#define IBCS2_TCIOFLUSH 2 + +#define IBCS2_TCOOFF 0 +#define IBCS2_TCOON 1 +#define IBCS2_TCIOFF 2 +#define IBCS2_TCION 3 + +#define IBCS2_B0 0 +#define IBCS2_B50 1 +#define IBCS2_B75 2 +#define IBCS2_B110 3 +#define IBCS2_B134 4 +#define IBCS2_B150 5 +#define IBCS2_B200 6 +#define IBCS2_B300 7 +#define IBCS2_B600 8 +#define IBCS2_B1200 9 +#define IBCS2_B1800 10 +#define IBCS2_B2400 11 +#define IBCS2_B4800 12 +#define IBCS2_B9600 13 +#define IBCS2_B19200 14 +#define IBCS2_B38400 15 + +struct ibcs2_winsize { + u_short ws_row; + u_short ws_col; + u_short ws_xpixel; + u_short ws_ypixel; +}; + +#endif /* _IBCS2_H_ */ + diff --git a/sys/i386/ibcs2/ibcs2_time.h b/sys/i386/ibcs2/ibcs2_time.h new file mode 100644 index 000000000000..a3b669b6ae3f --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_time.h @@ -0,0 +1,50 @@ +/* $NetBSD: ibcs2_time.h,v 1.2 1994/10/26 02:53:08 cgd Exp $ */ + +/* + * Copyright (c) 1994 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Scott Bartram. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _IBCS2_TIME_H +#define _IBCS2_TIME_H + +#include + +struct ibcs2_tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; +}; + +#endif /* _IBCS2_TIME_H */ diff --git a/sys/i386/ibcs2/ibcs2_timeb.h b/sys/i386/ibcs2/ibcs2_timeb.h new file mode 100644 index 000000000000..d85202d91725 --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_timeb.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 1995 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Scott Bartram. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _IBCS2_TIMEB_H +#define _IBCS2_TIMEB_H + +#pragma pack(2) +struct xenix_timeb { + ibcs2_time_t time; + unsigned short millitm; + short timezone; + short dstflag; +}; +#pragma pack() + +#define xenix_timeb_len 10 /* packed struct */ + +#endif /* _IBCS2_TIMEB_H */ diff --git a/sys/i386/ibcs2/ibcs2_types.h b/sys/i386/ibcs2/ibcs2_types.h new file mode 100644 index 000000000000..305a1fc6f440 --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_types.h @@ -0,0 +1,54 @@ +/* $NetBSD: ibcs2_types.h,v 1.5 1995/08/14 01:11:54 mycroft Exp $ */ + +/* + * Copyright (c) 1994 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Scott Bartram. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _IBCS2_TYPES_H +#define _IBCS2_TYPES_H + +typedef unsigned char ibcs2_uchar_t; +typedef unsigned long ibcs2_ulong_t; + +typedef char * ibcs2_caddr_t; +typedef long ibcs2_daddr_t; +typedef long ibcs2_off_t; +typedef long ibcs2_key_t; +typedef unsigned short ibcs2_uid_t; +typedef unsigned short ibcs2_gid_t; +typedef short ibcs2_nlink_t; +typedef short ibcs2_dev_t; +typedef unsigned short ibcs2_ino_t; +typedef unsigned int ibcs2_size_t; +typedef long ibcs2_time_t; +typedef long ibcs2_clock_t; +typedef unsigned short ibcs2_mode_t; +typedef short ibcs2_pid_t; + +#endif /* _IBCS2_TYPES_H */ diff --git a/sys/i386/ibcs2/ibcs2_unistd.h b/sys/i386/ibcs2/ibcs2_unistd.h new file mode 100644 index 000000000000..1a0dd6694128 --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_unistd.h @@ -0,0 +1,75 @@ +/* $NetBSD: ibcs2_unistd.h,v 1.2 1994/10/26 02:53:11 cgd Exp $ */ + +/* + * Copyright (c) 1994 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Scott Bartram. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _IBCS2_UNISTD_H +#define _IBCS2_UNISTD_H + +#define IBCS2_R_OK 4 +#define IBCS2_W_OK 2 +#define IBCS2_X_OK 1 +#define IBCS2_F_OK 0 + +#define IBCS2_F_ULOCK 0 +#define IBCS2_F_LOCK 1 +#define IBCS2_F_TLOCK 2 +#define IBCS2_F_TEST 3 + +#define IBCS2_SEEK_SET 0 +#define IBCS2_SEEK_CUR 1 +#define IBCS2_SEEK_END 2 + +#define IBCS2_SC_ARG_MAX 0 +#define IBCS2_SC_CHILD_MAX 1 +#define IBCS2_SC_CLK_TCK 2 +#define IBCS2_SC_NGROUPS_MAX 3 +#define IBCS2_SC_OPEN_MAX 4 +#define IBCS2_SC_JOB_CONTROL 5 +#define IBCS2_SC_SAVED_IDS 6 +#define IBCS2_SC_VERSION 7 +#define IBCS2_SC_PASS_MAX 8 +#define IBCS2_SC_XOPEN_VERSION 9 + +#define IBCS2_PC_LINK_MAX 0 +#define IBCS2_PC_MAX_CANON 1 +#define IBCS2_PC_MAX_INPUT 2 +#define IBCS2_PC_NAME_MAX 3 +#define IBCS2_PC_PATH_MAX 4 +#define IBCS2_PC_PIPE_BUF 5 +#define IBCS2_PC_CHOWN_RESTRICTED 6 +#define IBCS2_PC_NO_TRUNC 7 +#define IBCS2_PC_VDISABLE 8 + +#define IBCS2_STDIN_FILENO 0 +#define IBCS2_STDOUT_FILENO 1 +#define IBCS2_STDERR_FILENO 2 + +#endif /* _IBCS2_UNISTD_H */ diff --git a/sys/i386/ibcs2/ibcs2_ustat.h b/sys/i386/ibcs2/ibcs2_ustat.h new file mode 100644 index 000000000000..03c714635918 --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_ustat.h @@ -0,0 +1,46 @@ +/* $NetBSD: ibcs2_ustat.h,v 1.2 1994/10/26 02:53:13 cgd Exp $ */ + +/* + * Copyright (c) 1994 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Scott Bartram. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _IBCS2_USTAT_H +#define _IBCS2_USTAT_H 1 + +#include + +struct ibcs2_ustat { + long f_tfree; + ibcs2_ino_t f_tinode; + char f_fname[6]; + char f_fpack[6]; +}; +#define ibcs2_ustat_len (sizeof(struct ibcs2_ustat)) + +#endif /* _IBCS2_USTAT_H */ diff --git a/sys/i386/ibcs2/ibcs2_util.c b/sys/i386/ibcs2/ibcs2_util.c new file mode 100644 index 000000000000..69937acda294 --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_util.c @@ -0,0 +1,178 @@ +/* + * Copyright (c) 1994 Christos Zoulas + * Copyright (c) 1995 Frank van der Linden + * Copyright (c) 1995 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * from: svr4_util.c,v 1.5 1995/01/22 23:44:50 christos Exp + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +const char ibcs2_emul_path[] = "/emul/ibcs2"; + +/* + * Search an alternate path before passing pathname arguments on + * to system calls. Useful for keeping a seperate 'emulation tree'. + * + * If cflag is set, we check if an attempt can be made to create + * the named file, i.e. we check if the directory it should + * be in exists. + */ +int +ibcs2_emul_find(p, sgp, prefix, path, pbuf, cflag) + struct proc *p; + caddr_t *sgp; /* Pointer to stackgap memory */ + const char *prefix; + char *path; + char **pbuf; + int cflag; +{ + struct nameidata nd; + struct nameidata ndroot; + struct vattr vat; + struct vattr vatroot; + int error; + char *ptr, *buf, *cp; + size_t sz, len; + + buf = (char *) malloc(MAXPATHLEN, M_TEMP, M_WAITOK); + *pbuf = path; + + for (ptr = buf; (*ptr = *prefix) != '\0'; ptr++, prefix++) + continue; + + sz = MAXPATHLEN - (ptr - buf); + + /* + * If sgp is not given then the path is already in kernel space + */ + if (sgp == NULL) + error = copystr(path, ptr, sz, &len); + else + error = copyinstr(path, ptr, sz, &len); + + if (error) { + free(buf, M_TEMP); + return error; + } + + if (*ptr != '/') { + free(buf, M_TEMP); + return EINVAL; + } + + /* + * We know that there is a / somewhere in this pathname. + * Search backwards for it, to find the file's parent dir + * to see if it exists in the alternate tree. If it does, + * and we want to create a file (cflag is set). We don't + * need to worry about the root comparison in this case. + */ + + if (cflag) { + for (cp = &ptr[len] - 1; *cp != '/'; cp--); + *cp = '\0'; + + NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, p); + + if ((error = namei(&nd)) != 0) { + free(buf, M_TEMP); + return error; + } + + *cp = '/'; + } + else { + NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, p); + + if ((error = namei(&nd)) != 0) { + free(buf, M_TEMP); + return error; + } + + /* + * We now compare the vnode of the ibcs2_root to the one + * vnode asked. If they resolve to be the same, then we + * ignore the match so that the real root gets used. + * This avoids the problem of traversing "../.." to find the + * root directory and never finding it, because "/" resolves + * to the emulation root directory. This is expensive :-( + */ + /* XXX: prototype should have const here for NDINIT */ + NDINIT(&ndroot, LOOKUP, FOLLOW, UIO_SYSSPACE, + (char *) ibcs2_emul_path, p); + + if ((error = namei(&ndroot)) != 0) { + /* Cannot happen! */ + free(buf, M_TEMP); + vrele(nd.ni_vp); + return error; + } + + if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, p)) != 0) { + goto done; + } + + if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, p->p_ucred, p)) + != 0) { + goto done; + } + + if (vat.va_fsid == vatroot.va_fsid && + vat.va_fileid == vatroot.va_fileid) { + error = ENOENT; + goto done; + } + + } + if (sgp == NULL) + *pbuf = buf; + else { + sz = &ptr[len] - buf; + *pbuf = stackgap_alloc(sgp, sz + 1); + error = copyout(buf, *pbuf, sz); + free(buf, M_TEMP); + } + + +done: + vrele(nd.ni_vp); + if (!cflag) + vrele(ndroot.ni_vp); + return error; +} diff --git a/sys/i386/ibcs2/ibcs2_util.h b/sys/i386/ibcs2/ibcs2_util.h new file mode 100644 index 000000000000..6aa4e8c9a503 --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_util.h @@ -0,0 +1,82 @@ + +/* + * Copyright (c) 1994 Christos Zoulas + * Copyright (c) 1995 Frank van der Linden + * Copyright (c) 1995 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * from: svr4_util.h,v 1.5 1994/11/18 02:54:31 christos Exp + * from: linux_util.h,v 1.2 1995/03/05 23:23:50 fvdl Exp + */ + +/* + * This file is pretty much the same as Christos' svr4_util.h + * (for now). + */ + +#ifndef _IBCS2_UTIL_H_ +#define _IBCS2_UTIL_H_ + +#include +#include +#include + +static __inline caddr_t +stackgap_init() +{ + extern char sigcode[], esigcode[]; +#define szsigcode ((caddr_t)(esigcode - sigcode)) + return STACKGAPBASE; +} + + +static __inline void * +stackgap_alloc(sgp, sz) + caddr_t *sgp; + size_t sz; +{ + void *p = (void *) *sgp; + *sgp += ALIGN(sz); + return p; +} + +#ifdef DEBUG_IBCS2 +#define DPRINTF(a) printf a; +#else +#define DPRINTF(a) +#endif + +extern const char ibcs2_emul_path[]; + +int ibcs2_emul_find __P((struct proc *, caddr_t *, const char *, char *, + char **, int)); + +#define CHECKALTEXIST(p, sgp, path) \ + ibcs2_emul_find(p, sgp, ibcs2_emul_path, path, &(path), 0) + +#define CHECKALTCREAT(p, sgp, path) \ + ibcs2_emul_find(p, sgp, ibcs2_emul_path, path, &(path), 1) + +#endif /* !_IBCS2_UTIL_H_ */ diff --git a/sys/i386/ibcs2/ibcs2_utime.h b/sys/i386/ibcs2/ibcs2_utime.h new file mode 100644 index 000000000000..02d83150a27a --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_utime.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 1995 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Scott Bartram. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _IBCS2_UTIME_H +#define _IBCS2_UTIME_H + +#include + +struct ibcs2_utimbuf { + ibcs2_time_t actime; + ibcs2_time_t modtime; +}; + +#endif /* _IBCS2_UTIME_H */ diff --git a/sys/i386/ibcs2/ibcs2_utsname.h b/sys/i386/ibcs2/ibcs2_utsname.h new file mode 100644 index 000000000000..4f2ee68f7a9b --- /dev/null +++ b/sys/i386/ibcs2/ibcs2_utsname.h @@ -0,0 +1,45 @@ +/* $NetBSD: ibcs2_utsname.h,v 1.2 1994/10/26 02:53:14 cgd Exp $ */ + +/* + * Copyright (c) 1994 Scott Bartram + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Scott Bartram. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _IBCS2_UTSNAME_H +#define _IBCS2_UTSNAME_H + +struct ibcs2_utsname { + char sysname[9]; + char nodename[9]; + char release[9]; + char version[9]; + char machine[9]; +}; +#define ibcs2_utsname_len (sizeof(struct ibcs2_utsname)) + +#endif /* _IBCS2_UTSNAME_H */ diff --git a/sys/i386/ibcs2/syscalls.conf b/sys/i386/ibcs2/syscalls.conf new file mode 100644 index 000000000000..7f46f4433407 --- /dev/null +++ b/sys/i386/ibcs2/syscalls.conf @@ -0,0 +1,12 @@ +# syscalls.conf + +sysnames="ibcs2_syscalls.c" +sysnumhdr="ibcs2_syscall.h" +syssw="ibcs2_sysent.c" +sysarghdr="ibcs2_syscallargs.h" +compatopts="compat_43 compat_09 compat_10" +libcompatopts="" + +switchname="ibcs2_sysent" +namesname="ibcs2_syscallnames" +constprefix="IBCS2_SYS_" diff --git a/sys/i386/ibcs2/syscalls.master b/sys/i386/ibcs2/syscalls.master new file mode 100644 index 000000000000..db907d72e555 --- /dev/null +++ b/sys/i386/ibcs2/syscalls.master @@ -0,0 +1,243 @@ + $NetBSD: syscalls.master,v 1.4 1995/03/14 15:12:52 scottb Exp $ + +; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 +; System call name/number master file (or rather, slave, from IBCS2). +; Processed to created ibcs2_sysent.c, ibcs2_syscalls.c and ibcs2_syscall.h. + +; Columns: number type nargs name altname/comments +; number system call number, must be in order +; type one of STD, OBSOL, UNIMPL, STD +; nargs number of arguments +; name name of syscall routine +; altname name of system call if different +; for UNIMPL/OBSOL, name continues with comments + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +; types: +; STD always included +; STD included on COMPAT #ifdef +; LIBSTD included on COMPAT #ifdef, and placed in syscall.h +; OBSOL obsolete, not included in system, only specifies name +; UNIMPL not implemented, placeholder only + +; #ifdef's, etc. may be included, and are copied to the output files. + +0 NOARGS { int nosys(void); } syscall +1 NOARGS { int exit(int rval); } +2 NOARGS { int fork(void); } +3 STD { int ibcs2_read(int fd, char *buf, u_int nbytes); } +4 NOARGS { int write(int fd, char *buf, u_int nbytes); } +5 STD { int ibcs2_open(char *path, int flags, int mode); } +6 NOARGS { int close(int fd); } +7 STD { int ibcs2_waitsys(int a1, int a2, int a3); } +8 STD { int ibcs2_creat(char *path, int mode); } +9 NOARGS { int link(char *path, char *link); } +10 STD { int ibcs2_unlink(char *path); } +11 STD { int ibcs2_execv(char *path, char **argp); } +12 STD { int ibcs2_chdir(char *path); } +13 STD { int ibcs2_time(ibcs2_time_t *tp); } +14 STD { int ibcs2_mknod(char* path, int mode, int dev); } +15 STD { int ibcs2_chmod(char *path, int mode); } +16 STD { int ibcs2_chown(char *path, int uid, int gid); } +17 NOARGS { int obreak(caddr_t nsize); } +18 STD { int ibcs2_stat(char* path, struct ibcs2_stat *st); } +19 NOARGS { long compat_43_lseek(int fd, long offset, \ + int whence); } +20 NOARGS { pid_t getpid(void); } +21 STD { int ibcs2_mount(char *special, char *dir, int flags, \ + int fstype, char *data, int len); } +22 STD { int ibcs2_umount(char *name); } +23 STD { int ibcs2_setuid(int uid); } +24 NOARGS { uid_t getuid(void); } +25 STD { int ibcs2_stime(long *timep); } +26 UNIMPL ibcs2_ptrace +27 STD { int ibcs2_alarm(unsigned sec); } +28 STD { int ibcs2_fstat(int fd, struct ibcs2_stat *st); } +29 STD { int ibcs2_pause(void); } +30 STD { int ibcs2_utime(char *path, \ + struct ibcs2_utimbuf *buf); } +31 UNIMPL was stty +32 UNIMPL was gtty +33 STD { int ibcs2_access(char *path, int flags); } +34 STD { int ibcs2_nice(int incr); } +35 STD { int ibcs2_statfs(char *path, \ + struct ibcs2_statfs *buf, \ + int len, int fstype); } +36 NOARGS { int sync(void); } +37 STD { int ibcs2_kill(int pid, int signo); } +38 STD { int ibcs2_fstatfs(int fd, struct ibcs2_statfs *buf, \ + int len, int fstype); } +39 STD { int ibcs2_pgrpsys(int type, caddr_t dummy, int pid, \ + int pgid); } +40 UNIMPL ibcs2_xenix +41 NOARGS { int dup(u_int fd); } +42 NOARGS { int pipe(void); } +43 STD { int ibcs2_times(struct tms *tp); } +44 UNIMPL profil +45 STD { int ibcs2_plock(int cmd); } +46 STD { int ibcs2_setgid(int gid); } +47 NOARGS { gid_t getgid(void); } +48 STD { int ibcs2_sigsys(int sig, ibcs2_sig_t fp); } +#ifdef SYSVMSG +49 STD { int ibcs2_msgsys(int which, int a2, int a3, int a4, \ + int a5, int a6); } +#else +49 UNIMPL nosys +#endif +50 UNIMPL ibcs2_sys3b +51 UNIMPL ibcs2_acct +#ifdef SYSVSHM +52 STD { int ibcs2_shmsys(int which, int a2, int a3, int a4); } +#else +52 UNIMPL nosys +#endif +#ifdef SYSVSEM +53 STD { int ibcs2_semsys(int which, int a2, int a3, int a4, \ + int a5); } +#else +53 UNIMPL nosys +#endif +54 STD { int ibcs2_ioctl(int fd, int cmd, caddr_t data); } +55 STD { int ibcs2_uadmin(int cmd, int func, caddr_t data); } +56 UNIMPL nosys +57 STD { int ibcs2_utssys(int a1, int a2, int flag); } +58 UNIMPL nosys +59 STD { int ibcs2_execve(char *path, char **argp, \ + char **envp); } +60 NOARGS { int umask(int newmask); } +61 NOARGS { int chroot(char *path); } +62 STD { int ibcs2_fcntl(int fd, int cmd, char *arg); } +63 STD { long ibcs2_ulimit(int cmd, int newlimit); } +64 UNIMPL reserved for unix/pc +65 UNIMPL reserved for unix/pc +66 UNIMPL reserved for unix/pc +67 UNIMPL reserved for unix/pc +68 UNIMPL reserved for unix/pc +69 UNIMPL reserved for unix/pc +70 OBSOL rfs_advfs +71 OBSOL rfs_unadvfs +72 OBSOL rfs_rmount +73 OBSOL rfs_rumount +74 OBSOL rfs_rfstart +75 OBSOL rfs_sigret +76 OBSOL rfs_rdebug +77 OBSOL rfs_rfstop +78 UNIMPL rfs_rfsys +79 STD { int ibcs2_rmdir(char *path); } +80 STD { int ibcs2_mkdir(char *path, int mode); } +81 STD { int ibcs2_getdents(int fd, char *buf, int nbytes); } +82 UNIMPL nosys +83 UNIMPL nosys +84 STD { int ibcs2_sysfs(int cmd, caddr_t d1, char *buf); } +85 STD { int ibcs2_getmsg(int fd, struct ibcs2_stropts *ctl, \ + struct ibcs2_stropts *dat, \ + int *flags); } +86 STD { int ibcs2_putmsg(int fd, struct ibcs2_stropts *ctl, \ + struct ibcs2_stropts *dat, \ + int flags); } +87 STD { int ibcs2_poll(struct ibcs2_pollfd *fds, long nfds, \ + int timeout); } +88 UNIMPL nosys +89 UNIMPL nosys +90 STD { int ibcs2_symlink(char *path, char *link); } +91 STD { int ibcs2_lstat(char *path, struct ibcs2_stat *st); } +92 STD { int ibcs2_readlink(char *path, char *buf, int count); } +93 UNIMPL nosys +94 UNIMPL nosys +95 UNIMPL nosys +96 UNIMPL nosys +97 UNIMPL nosys +98 UNIMPL nosys +99 UNIMPL nosys +100 UNIMPL nosys +101 UNIMPL nosys +102 UNIMPL nosys +103 NOARGS { int sigreturn(struct sigcontext *sigcntxp); } +104 UNIMPL nosys +105 UNIMPL nosys +106 UNIMPL nosys +107 UNIMPL nosys +108 UNIMPL nosys +109 UNIMPL nosys +110 UNIMPL nosys +111 UNIMPL nosys +112 UNIMPL nosys +113 UNIMPL nosys +114 UNIMPL nosys +115 UNIMPL nosys +116 UNIMPL nosys +117 UNIMPL nosys +118 UNIMPL nosys +119 UNIMPL nosys +120 UNIMPL nosys +121 UNIMPL nosys +122 UNIMPL nosys +123 UNIMPL nosys +124 UNIMPL nosys +125 UNIMPL nosys +126 UNIMPL nosys +127 UNIMPL nosys +128 UNIMPL nosys +129 UNIMPL xenix_xlocking +130 UNIMPL xenix_creatsem +131 UNIMPL xenix_opensem +132 UNIMPL xenix_sigsem +133 UNIMPL xenix_waitsem +134 UNIMPL xenix_nbwaitsem +135 STD { int xenix_rdchk(int fd); } +136 UNIMPL nosys +137 UNIMPL nosys +138 STD { int xenix_chsize(int fd, long size); } +139 STD { int xenix_ftime(struct xenix_timeb *tp); } +140 STD { int xenix_nap(int millisec); } +141 UNIMPL xenix_sdget +142 UNIMPL xenix_sdfree +143 UNIMPL xenix_sdenter +144 UNIMPL xenix_sdleave +145 UNIMPL xenix_sdgetv +146 UNIMPL xenix_sdwaitv +147 UNIMPL nosys +148 UNIMPL nosys +149 UNIMPL nosys +150 UNIMPL nosys +151 UNIMPL nosys +152 UNIMPL nosys +153 UNIMPL nosys +154 UNIMPL nosys +155 UNIMPL nosys +156 UNIMPL nosys +157 UNIMPL nosys +158 UNIMPL nosys +159 UNIMPL nosys +160 UNIMPL xenix_proctl +161 UNIMPL xenix_execseg +162 UNIMPL xenix_unexecseg +163 UNIMPL nosys +164 NOARGS { int select(u_int nd, fd_set *in, fd_set *ou, \ + fd_set *ex, struct timeval *tv); } +165 UNIMPL xenix_eaccess +166 UNIMPL xenix_paccess +167 STD { int ibcs2_sigaction(int sig, \ + struct ibcs2_sigaction *act, \ + struct ibcs2_sigaction *oact); } +168 STD { int ibcs2_sigprocmask(int how, ibcs2_sigset_t *set, \ + ibcs2_sigset_t *oset); } +169 STD { int ibcs2_sigpending(ibcs2_sigset_t *mask); } +170 STD { int ibcs2_sigsuspend(ibcs2_sigset_t *mask); } +171 STD { int ibcs2_getgroups(int gidsetsize, \ + ibcs2_gid_t *gidset); } +172 STD { int ibcs2_setgroups(int gidsetsize, \ + ibcs2_gid_t *gidset); } +173 STD { int ibcs2_sysconf(int name); } +174 STD { int ibcs2_pathconf(char *path, int name); } +175 STD { int ibcs2_fpathconf(int fd, int name); } +176 STD { int ibcs2_rename(char *from, char *to); }