summaryrefslogtreecommitdiff
path: root/sys/compat/svr4
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/svr4')
-rw-r--r--sys/compat/svr4/Makefile11
-rw-r--r--sys/compat/svr4/files.svr413
-rw-r--r--sys/compat/svr4/svr4_exec.c3
-rw-r--r--sys/compat/svr4/svr4_fcntl.c21
-rw-r--r--sys/compat/svr4/svr4_ioctl.c7
-rw-r--r--sys/compat/svr4/svr4_ipc.c744
-rw-r--r--sys/compat/svr4/svr4_ipc.h175
-rw-r--r--sys/compat/svr4/svr4_misc.c17
-rw-r--r--sys/compat/svr4/svr4_net.c4
-rw-r--r--sys/compat/svr4/svr4_signal.h16
-rw-r--r--sys/compat/svr4/svr4_stat.c20
-rw-r--r--sys/compat/svr4/svr4_syscall.h5
-rw-r--r--sys/compat/svr4/svr4_syscallargs.h28
-rw-r--r--sys/compat/svr4/svr4_syscalls.c8
-rw-r--r--sys/compat/svr4/svr4_sysent.c14
-rw-r--r--sys/compat/svr4/svr4_termios.c7
-rw-r--r--sys/compat/svr4/svr4_ttold.c3
-rw-r--r--sys/compat/svr4/svr4_types.h3
-rw-r--r--sys/compat/svr4/syscalls.master13
19 files changed, 1046 insertions, 66 deletions
diff --git a/sys/compat/svr4/Makefile b/sys/compat/svr4/Makefile
new file mode 100644
index 00000000000..a5a4401770d
--- /dev/null
+++ b/sys/compat/svr4/Makefile
@@ -0,0 +1,11 @@
+# $NetBSD: Makefile,v 1.1 1995/10/14 20:24:14 christos Exp $
+
+DEP= syscalls.conf syscalls.master ../../kern/makesyscalls.sh
+OBJS= svr4_sysent.c svr4_syscalls.c svr4_syscall.h svr4_syscallargs.h
+
+${OBJS}: ${DEP}
+ -mv -f svr4_sysent.c svr4_sysent.c.bak
+ -mv -f svr4_syscalls.c svr4_syscalls.c.bak
+ -mv -f svr4_syscall.h svr4_syscall.h.bak
+ -mv -f svr4_syscallargs.h svr4_syscallargs.h.bak
+ sh ../../kern/makesyscalls.sh syscalls.conf syscalls.master
diff --git a/sys/compat/svr4/files.svr4 b/sys/compat/svr4/files.svr4
index fd59078d07e..23bf3e57a67 100644
--- a/sys/compat/svr4/files.svr4
+++ b/sys/compat/svr4/files.svr4
@@ -1,4 +1,4 @@
-# $NetBSD: files.svr4,v 1.4 1995/08/14 01:34:12 mycroft Exp $
+# $NetBSD: files.svr4,v 1.5 1995/10/14 20:24:17 christos Exp $
#
# Config.new file description for machine-independent SVR4 compat code.
# Included by ports that need it.
@@ -6,18 +6,19 @@
# ports should define any machine-specific files they need in their
# own file lists.
-file compat/svr4/svr4_error.c compat_svr4
file compat/svr4/svr4_exec.c compat_svr4
file compat/svr4/svr4_fcntl.c compat_svr4
-file compat/svr4/svr4_filio.c compat_svr4
file compat/svr4/svr4_ioctl.c compat_svr4
file compat/svr4/svr4_misc.c compat_svr4
-file compat/svr4/svr4_net.c compat_svr4
file compat/svr4/svr4_signal.c compat_svr4
-file compat/svr4/svr4_sockio.c compat_svr4
file compat/svr4/svr4_stat.c compat_svr4
-file compat/svr4/svr4_stream.c compat_svr4
file compat/svr4/svr4_syscalls.c compat_svr4
file compat/svr4/svr4_sysent.c compat_svr4
+file compat/svr4/svr4_net.c compat_svr4
file compat/svr4/svr4_termios.c compat_svr4
+file compat/svr4/svr4_stream.c compat_svr4
file compat/svr4/svr4_ttold.c compat_svr4
+file compat/svr4/svr4_filio.c compat_svr4
+file compat/svr4/svr4_sockio.c compat_svr4
+file compat/svr4/svr4_error.c compat_svr4
+file compat/svr4/svr4_ipc.c compat_svr4
diff --git a/sys/compat/svr4/svr4_exec.c b/sys/compat/svr4/svr4_exec.c
index 9393f63736a..866d421d9c8 100644
--- a/sys/compat/svr4/svr4_exec.c
+++ b/sys/compat/svr4/svr4_exec.c
@@ -1,4 +1,4 @@
-/* $NetBSD: svr4_exec.c,v 1.15 1995/06/24 20:29:19 christos Exp $ */
+/* $NetBSD: svr4_exec.c,v 1.16 1995/10/14 20:24:20 christos Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@@ -82,7 +82,6 @@ svr4_copyargs(pack, arginfo, stack, argp)
void *argp;
{
AuxInfo *a;
- struct elf_args *ap;
if (!(a = (AuxInfo *) elf_copyargs(pack, arginfo, stack, argp)))
return NULL;
diff --git a/sys/compat/svr4/svr4_fcntl.c b/sys/compat/svr4/svr4_fcntl.c
index a2421d32fc7..11f7d5f46f5 100644
--- a/sys/compat/svr4/svr4_fcntl.c
+++ b/sys/compat/svr4/svr4_fcntl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: svr4_fcntl.c,v 1.13 1995/10/09 23:56:17 thorpej Exp $ */
+/* $NetBSD: svr4_fcntl.c,v 1.14 1995/10/14 20:24:24 christos Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@@ -48,11 +48,18 @@
#include <compat/svr4/svr4_fcntl.h>
#include <compat/svr4/svr4_poll.h>
+static u_long svr4_to_bsd_cmd __P((u_long));
+static int svr4_to_bsd_flags __P((int));
+static int bsd_to_svr4_flags __P((int));
+static void bsd_to_svr4_flock __P((struct flock *, struct svr4_flock *));
+static void svr4_to_bsd_flock __P((struct svr4_flock *, struct flock *));
+static void svr4_pollscan __P((struct proc *, struct svr4_pollfd *, int,
+ register_t *));
+
static u_long
svr4_to_bsd_cmd(cmd)
- u_long cmd;
+ u_long cmd;
{
-
switch (cmd) {
case SVR4_F_DUPFD:
return F_DUPFD;
@@ -276,7 +283,8 @@ svr4_sys_fcntl(p, v, retval)
return error;
case F_SETFL:
- SCARG(&fa, arg) = (void *) svr4_to_bsd_flags(SCARG(uap, arg));
+ SCARG(&fa, arg) =
+ (void *) svr4_to_bsd_flags((u_long) SCARG(uap, arg));
return sys_fcntl(p, &fa, retval);
case F_GETLK:
@@ -377,13 +385,12 @@ svr4_sys_poll(p, v, retval)
int msec = SCARG(uap, timeout);
struct timeval atv;
int timo;
- u_int ni;
int ncoll;
extern int nselcoll, selwait;
pl = (struct svr4_pollfd *) malloc(sz, M_TEMP, M_WAITOK);
- if (error = copyin(SCARG(uap, fds), pl, sz))
+ if ((error = copyin(SCARG(uap, fds), pl, sz)) != 0)
goto bad;
for (i = 0; i < SCARG(uap, nfds); i++) {
@@ -440,7 +447,7 @@ done:
if (error == EWOULDBLOCK)
error = 0;
- if (error2 = copyout(pl, SCARG(uap, fds), sz))
+ if ((error2 = copyout(pl, SCARG(uap, fds), sz)) != 0)
error = error2;
bad:
diff --git a/sys/compat/svr4/svr4_ioctl.c b/sys/compat/svr4/svr4_ioctl.c
index 355e5135c87..ffb57cf9f09 100644
--- a/sys/compat/svr4/svr4_ioctl.c
+++ b/sys/compat/svr4/svr4_ioctl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: svr4_ioctl.c,v 1.12 1995/10/07 06:27:41 mycroft Exp $ */
+/* $NetBSD: svr4_ioctl.c,v 1.13 1995/10/14 20:24:27 christos Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@@ -55,10 +55,11 @@
#include <compat/svr4/svr4_sockio.h>
#ifdef DEBUG_SVR4
+static void svr4_decode_cmd __P((u_long, char *, char *, int *, int *));
/*
* Decode an ioctl command symbolically
*/
-void
+static void
svr4_decode_cmd(cmd, dir, c, num, argsiz)
u_long cmd;
char *dir, *c;
@@ -100,7 +101,7 @@ svr4_sys_ioctl(p, v, retval)
svr4_decode_cmd(SCARG(uap, com), dir, &c, &num, &argsiz);
printf("svr4_ioctl(%d, _IO%s(%c, %d, %d), %x);\n", SCARG(uap, fd),
- dir, c, num, argsiz, SCARG(uap, data));
+ dir, c, num, argsiz, (unsigned int) SCARG(uap, data));
#endif
fdp = p->p_fd;
cmd = SCARG(uap, com);
diff --git a/sys/compat/svr4/svr4_ipc.c b/sys/compat/svr4/svr4_ipc.c
new file mode 100644
index 00000000000..76da560f0c8
--- /dev/null
+++ b/sys/compat/svr4/svr4_ipc.c
@@ -0,0 +1,744 @@
+/* $NetBSD: svr4_ipc.c,v 1.1 1995/10/14 20:24:30 christos Exp $ */
+
+/*
+ * Copyright (c) 1995 Christos Zoulas. 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 Christos Zoulas.
+ * 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.
+ *
+ * Mostly stolen from: linux_ipc.c,v 1.4 1995/06/24 20:20:22 christos Exp
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/shm.h>
+#include <sys/msg.h>
+#include <sys/sem.h>
+#include <sys/proc.h>
+#include <sys/uio.h>
+#include <sys/time.h>
+#include <sys/malloc.h>
+#include <sys/mman.h>
+#include <sys/systm.h>
+#include <sys/stat.h>
+
+#include <sys/mount.h>
+#include <sys/syscallargs.h>
+
+#include <compat/svr4/svr4_types.h>
+#include <compat/svr4/svr4_signal.h>
+#include <compat/svr4/svr4_syscallargs.h>
+#include <compat/svr4/svr4_util.h>
+#include <compat/svr4/svr4_ipc.h>
+
+#define syscallarg(x) union { x datum; register_t pad; }
+
+#if defined(SYSVMSG) || defined(SYSVSHM) || defined(SYSVSEM)
+static void svr4_to_bsd_ipc_perm __P((const struct svr4_ipc_perm *,
+ struct ipc_perm *));
+static void bsd_to_svr4_ipc_perm __P((const struct ipc_perm *,
+ struct svr4_ipc_perm *));
+#endif
+
+#ifdef SYSVSEM
+static void bsd_to_svr4_semid_ds __P((const struct semid_ds *,
+ struct svr4_semid_ds *));
+static void svr4_to_bsd_semid_ds __P((const struct svr4_semid_ds *,
+ struct semid_ds *));
+static int svr4_semop __P((struct proc *, void *, register_t *));
+static int svr4_semget __P((struct proc *, void *, register_t *));
+static int svr4_semctl __P((struct proc *, void *, register_t *));
+#endif
+
+#ifdef SYSVMSG
+static void bsd_to_svr4_msqid_ds __P((const struct msqid_ds *,
+ struct svr4_msqid_ds *));
+static void svr4_to_bsd_msqid_ds __P((const struct svr4_msqid_ds *,
+ struct msqid_ds *));
+static int svr4_msgsnd __P((struct proc *, void *, register_t *));
+static int svr4_msgrcv __P((struct proc *, void *, register_t *));
+static int svr4_msgget __P((struct proc *, void *, register_t *));
+static int svr4_msgctl __P((struct proc *, void *, register_t *));
+#endif
+
+#ifdef SYSVSHM
+static void bsd_to_svr4_shmid_ds __P((const struct shmid_ds *,
+ struct svr4_shmid_ds *));
+static void svr4_to_bsd_shmid_ds __P((const struct svr4_shmid_ds *,
+ struct shmid_ds *));
+static int svr4_shmat __P((struct proc *, void *, register_t *));
+static int svr4_shmdt __P((struct proc *, void *, register_t *));
+static int svr4_shmget __P((struct proc *, void *, register_t *));
+static int svr4_shmctl __P((struct proc *, void *, register_t *));
+#endif
+
+#if defined(SYSVMSG) || defined(SYSVSHM) || defined(SYSVSEM)
+
+static void
+svr4_to_bsd_ipc_perm(spp, bpp)
+ const struct svr4_ipc_perm *spp;
+ struct ipc_perm *bpp;
+{
+ bpp->key = spp->key;
+ bpp->uid = spp->uid;
+ bpp->gid = spp->gid;
+ bpp->cuid = spp->cuid;
+ bpp->cgid = spp->cgid;
+ bpp->mode = spp->mode;
+ bpp->seq = spp->seq;
+}
+
+static void
+bsd_to_svr4_ipc_perm(bpp, spp)
+ const struct ipc_perm *bpp;
+ struct svr4_ipc_perm *spp;
+{
+ spp->key = bpp->key;
+ spp->uid = bpp->uid;
+ spp->gid = bpp->gid;
+ spp->cuid = bpp->cuid;
+ spp->cgid = bpp->cgid;
+ spp->mode = bpp->mode;
+ spp->seq = bpp->seq;
+}
+#endif
+
+#ifdef SYSVSEM
+static void
+bsd_to_svr4_semid_ds(bds, sds)
+ const struct semid_ds *bds;
+ struct svr4_semid_ds *sds;
+{
+ bsd_to_svr4_ipc_perm(&bds->sem_perm, &sds->sem_perm);
+ sds->sem_base = (struct svr4_sem *) bds->sem_base;
+ sds->sem_nsems = bds->sem_nsems;
+ sds->sem_otime = bds->sem_otime;
+ sds->sem_pad1 = bds->sem_pad1;
+ sds->sem_ctime = bds->sem_ctime;
+ sds->sem_pad2 = bds->sem_pad2;
+}
+
+static void
+svr4_to_bsd_semid_ds(sds, bds)
+ const struct svr4_semid_ds *sds;
+ struct semid_ds *bds;
+{
+ svr4_to_bsd_ipc_perm(&sds->sem_perm, &bds->sem_perm);
+ bds->sem_base = (struct sem *) bds->sem_base;
+ bds->sem_nsems = sds->sem_nsems;
+ bds->sem_otime = sds->sem_otime;
+ bds->sem_pad1 = sds->sem_pad1;
+ bds->sem_ctime = sds->sem_ctime;
+ bds->sem_pad2 = sds->sem_pad2;
+}
+
+struct svr4_sys_semctl_args {
+ syscallarg(int) what;
+ syscallarg(int) semid;
+ syscallarg(int) semnum;
+ syscallarg(int) cmd;
+ syscallarg(void *) arg;
+};
+
+static int
+svr4_semctl(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ int error;
+ struct svr4_sys_semctl_args *uap = v;
+ struct sys___semctl_args ap;
+ struct svr4_semid_ds ss;
+ struct semid_ds bs;
+ caddr_t sg = stackgap_init(p->p_emul);
+
+ SCARG(&ap, semid) = SCARG(uap, semid);
+ SCARG(&ap, semnum) = SCARG(uap, semnum);
+
+ switch (SCARG(uap, cmd)) {
+ case SVR4_SEM_GETZCNT:
+ case SVR4_SEM_GETNCNT:
+ case SVR4_SEM_GETPID:
+ case SVR4_SEM_GETVAL:
+ switch (SCARG(uap, cmd)) {
+ case SVR4_SEM_GETZCNT:
+ SCARG(&ap, cmd) = GETZCNT;
+ break;
+ case SVR4_SEM_GETNCNT:
+ SCARG(&ap, cmd) = GETNCNT;
+ break;
+ case SVR4_SEM_GETPID:
+ SCARG(&ap, cmd) = GETPID;
+ break;
+ case SVR4_SEM_GETVAL:
+ SCARG(&ap, cmd) = GETVAL;
+ break;
+ }
+ return sys___semctl(p, &ap, retval);
+
+ case SVR4_SEM_SETVAL:
+ SCARG(&ap, arg)->val = (int) SCARG(uap, arg);
+ SCARG(&ap, cmd) = SETVAL;
+ return sys___semctl(p, &ap, retval);
+
+ case SVR4_SEM_GETALL:
+ SCARG(&ap, arg)->array = SCARG(uap, arg);
+ SCARG(&ap, cmd) = GETVAL;
+ return sys___semctl(p, &ap, retval);
+
+ case SVR4_SEM_SETALL:
+ SCARG(&ap, arg)->array = SCARG(uap, arg);
+ SCARG(&ap, cmd) = SETVAL;
+ return sys___semctl(p, &ap, retval);
+
+ case SVR4_IPC_STAT:
+ SCARG(&ap, cmd) = IPC_STAT;
+ SCARG(&ap, arg)->buf = stackgap_alloc(&sg, sizeof(bs));
+ if ((error = sys___semctl(p, &ap, retval)) != 0)
+ return error;
+ error = copyin(&bs, SCARG(&ap, arg)->buf, sizeof bs);
+ if (error)
+ return error;
+ bsd_to_svr4_semid_ds(&bs, &ss);
+ return copyout(&ss, SCARG(uap, arg), sizeof ss);
+
+ case SVR4_IPC_SET:
+ SCARG(&ap, cmd) = IPC_SET;
+ SCARG(&ap, arg)->buf = stackgap_alloc(&sg, sizeof(bs));
+ error = copyin(SCARG(uap, arg), (caddr_t) &ss, sizeof ss);
+ if (error)
+ return error;
+ svr4_to_bsd_semid_ds(&ss, &bs);
+ error = copyout(&bs, SCARG(&ap, arg)->buf, sizeof bs);
+ if (error)
+ return error;
+ return sys___semctl(p, &ap, retval);
+
+ case SVR4_IPC_RMID:
+ SCARG(&ap, cmd) = IPC_RMID;
+ SCARG(&ap, arg)->buf = stackgap_alloc(&sg, sizeof(bs));
+ error = copyin(SCARG(uap, arg), &ss, sizeof ss);
+ if (error)
+ return error;
+ svr4_to_bsd_semid_ds(&ss, &bs);
+ error = copyout(&bs, SCARG(&ap, arg)->buf, sizeof bs);
+ if (error)
+ return error;
+ return sys___semctl(p, &ap, retval);
+
+ default:
+ return EINVAL;
+ }
+}
+
+struct svr4_sys_semget_args {
+ syscallarg(int) what;
+ syscallarg(svr4_key_t) key;
+ syscallarg(int) nsems;
+ syscallarg(int) semflg;
+};
+
+static int
+svr4_semget(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct svr4_sys_semget_args *uap = v;
+ struct sys_semget_args ap;
+
+ SCARG(&ap, key) = SCARG(uap, key);
+ SCARG(&ap, nsems) = SCARG(uap, nsems);
+ SCARG(&ap, semflg) = SCARG(uap, semflg);
+
+ return sys_semget(p, &ap, retval);
+}
+
+struct svr4_sys_semop_args {
+ syscallarg(int) what;
+ syscallarg(int) semid;
+ syscallarg(struct svr4_sembuf *) sops;
+ syscallarg(u_int) nsops;
+};
+
+static int
+svr4_semop(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct svr4_sys_semop_args *uap = v;
+ struct sys_semop_args ap;
+
+ SCARG(&ap, semid) = SCARG(uap, semid);
+ /* These are the same */
+ SCARG(&ap, sops) = (struct sembuf *) SCARG(uap, sops);
+ SCARG(&ap, nsops) = SCARG(uap, nsops);
+
+ return sys_semop(p, &ap, retval);
+}
+
+int
+svr4_sys_semsys(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct svr4_sys_semsys_args *uap = v;
+
+ DPRINTF(("svr4_semsys(%d)\n", SCARG(uap, what)));
+
+ switch (SCARG(uap, what)) {
+ case SVR4_semctl:
+ return svr4_semctl(p, v, retval);
+ case SVR4_semget:
+ return svr4_semget(p, v, retval);
+ case SVR4_semop:
+ return svr4_semop(p, v, retval);
+ default:
+ return EINVAL;
+ }
+}
+#endif
+
+#ifdef SYSVMSG
+static void
+bsd_to_svr4_msqid_ds(bds, sds)
+ const struct msqid_ds *bds;
+ struct svr4_msqid_ds *sds;
+{
+ bsd_to_svr4_ipc_perm(&bds->msg_perm, &sds->msg_perm);
+ sds->msg_first = (struct svr4_msg *) bds->msg_first;
+ sds->msg_last = (struct svr4_msg *) bds->msg_last;
+ sds->msg_cbytes = bds->msg_cbytes;
+ sds->msg_qnum = bds->msg_qnum;
+ sds->msg_qbytes = bds->msg_qbytes;
+ sds->msg_lspid = bds->msg_lspid;
+ sds->msg_lrpid = bds->msg_lrpid;
+ sds->msg_stime = bds->msg_stime;
+ sds->msg_pad1 = bds->msg_pad1;
+ sds->msg_rtime = bds->msg_rtime;
+ sds->msg_pad2 = bds->msg_pad2;
+ sds->msg_ctime = bds->msg_ctime;
+ sds->msg_pad3 = bds->msg_pad3;
+
+ /* use the padding for the rest of the fields */
+ {
+ short *pad = (short *) bds->msg_pad4;
+ sds->msg_cv = pad[0];
+ sds->msg_qnum_cv = pad[1];
+ }
+}
+
+static void
+svr4_to_bsd_msqid_ds(sds, bds)
+ const struct svr4_msqid_ds *sds;
+ struct msqid_ds *bds;
+{
+ svr4_to_bsd_ipc_perm(&sds->msg_perm, &bds->msg_perm);
+ bds->msg_first = (struct msg *) sds->msg_first;
+ bds->msg_last = (struct msg *) sds->msg_last;
+ bds->msg_cbytes = sds->msg_cbytes;
+ bds->msg_qnum = sds->msg_qnum;
+ bds->msg_qbytes = sds->msg_qbytes;
+ bds->msg_lspid = sds->msg_lspid;
+ bds->msg_lrpid = sds->msg_lrpid;
+ bds->msg_stime = sds->msg_stime;
+ bds->msg_pad1 = sds->msg_pad1;
+ bds->msg_rtime = sds->msg_rtime;
+ bds->msg_pad2 = sds->msg_pad2;
+ bds->msg_ctime = sds->msg_ctime;
+ bds->msg_pad3 = sds->msg_pad3;
+
+ /* use the padding for the rest of the fields */
+ {
+ short *pad = (short *) bds->msg_pad4;
+ pad[0] = sds->msg_cv;
+ pad[1] = sds->msg_qnum_cv;
+ }
+}
+
+struct svr4_sys_msgsnd_args {
+ syscallarg(int) what;
+ syscallarg(int) msqid;
+ syscallarg(void *) msgp;
+ syscallarg(size_t) msgsz;
+ syscallarg(int) msgflg;
+};
+
+static int
+svr4_msgsnd(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct svr4_sys_msgsnd_args *uap = v;
+ struct sys_msgsnd_args ap;
+
+ SCARG(&ap, msqid) = SCARG(uap, msqid);
+ SCARG(&ap, msgp) = SCARG(uap, msgp);
+ SCARG(&ap, msgsz) = SCARG(uap, msgsz);
+ SCARG(&ap, msgflg) = SCARG(uap, msgflg);
+
+ return sys_msgsnd(p, &ap, retval);
+}
+
+struct svr4_sys_msgrcv_args {
+ syscallarg(int) what;
+ syscallarg(int) msqid;
+ syscallarg(void *) msgp;
+ syscallarg(size_t) msgsz;
+ syscallarg(long) msgtyp;
+ syscallarg(int) msgflg;
+};
+
+static int
+svr4_msgrcv(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct svr4_sys_msgrcv_args *uap = v;
+ struct sys_msgrcv_args ap;
+
+ SCARG(&ap, msqid) = SCARG(uap, msqid);
+ SCARG(&ap, msgp) = SCARG(uap, msgp);
+ SCARG(&ap, msgsz) = SCARG(uap, msgsz);
+ SCARG(&ap, msgtyp) = SCARG(uap, msgtyp);
+ SCARG(&ap, msgflg) = SCARG(uap, msgflg);
+
+ return sys_msgrcv(p, &ap, retval);
+}
+
+struct svr4_sys_msgget_args {
+ syscallarg(int) what;
+ syscallarg(svr4_key_t) key;
+ syscallarg(int) msgflg;
+};
+
+static int
+svr4_msgget(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct svr4_sys_msgget_args *uap = v;
+ struct sys_msgget_args ap;
+
+ SCARG(&ap, key) = SCARG(uap, key);
+ SCARG(&ap, msgflg) = SCARG(uap, msgflg);
+
+ return sys_msgget(p, &ap, retval);
+}
+
+struct svr4_sys_msgctl_args {
+ syscallarg(int) what;
+ syscallarg(int) msqid;
+ syscallarg(int) cmd;
+ syscallarg(struct svr4_msqid_ds *) buf;
+};
+
+static int
+svr4_msgctl(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ int error;
+ struct svr4_sys_msgctl_args *uap = v;
+ struct sys_msgctl_args ap;
+ struct svr4_msqid_ds ss;
+ struct msqid_ds bs;
+ caddr_t sg = stackgap_init(p->p_emul);
+
+ SCARG(&ap, msqid) = SCARG(uap, msqid);
+ SCARG(&ap, cmd) = SCARG(uap, cmd);
+ SCARG(&ap, buf) = stackgap_alloc(&sg, sizeof(bs));
+
+ switch (SCARG(uap, cmd)) {
+ case SVR4_IPC_STAT:
+ SCARG(&ap, cmd) = IPC_STAT;
+ if ((error = sys_msgctl(p, &ap, retval)) != 0)
+ return error;
+ error = copyin(&bs, SCARG(&ap, buf), sizeof bs);
+ if (error)
+ return error;
+ bsd_to_svr4_msqid_ds(&bs, &ss);
+ return copyout(&ss, SCARG(uap, buf), sizeof ss);
+
+ case SVR4_IPC_SET:
+ SCARG(&ap, cmd) = IPC_SET;
+ error = copyin(SCARG(uap, buf), &ss, sizeof ss);
+ if (error)
+ return error;
+ svr4_to_bsd_msqid_ds(&ss, &bs);
+ error = copyout(&bs, SCARG(&ap, buf), sizeof bs);
+ if (error)
+ return error;
+ return sys_msgctl(p, &ap, retval);
+
+ case SVR4_IPC_RMID:
+ SCARG(&ap, cmd) = IPC_RMID;
+ error = copyin(SCARG(uap, buf), &ss, sizeof ss);
+ if (error)
+ return error;
+ svr4_to_bsd_msqid_ds(&ss, &bs);
+ error = copyout(&bs, SCARG(&ap, buf), sizeof bs);
+ if (error)
+ return error;
+ return sys_msgctl(p, &ap, retval);
+
+ default:
+ return EINVAL;
+ }
+}
+
+int
+svr4_sys_msgsys(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct svr4_sys_msgsys_args *uap = v;
+
+ DPRINTF(("svr4_msgsys(%d)\n", SCARG(uap, what)));
+
+ switch (SCARG(uap, what)) {
+ case SVR4_msgsnd:
+ return svr4_msgsnd(p, v, retval);
+ case SVR4_msgrcv:
+ return svr4_msgrcv(p, v, retval);
+ case SVR4_msgget:
+ return svr4_msgget(p, v, retval);
+ case SVR4_msgctl:
+ return svr4_msgctl(p, v, retval);
+ default:
+ return EINVAL;
+ }
+}
+#endif
+
+#ifdef SYSVSHM
+
+static void
+bsd_to_svr4_shmid_ds(bds, sds)
+ const struct shmid_ds *bds;
+ struct svr4_shmid_ds *sds;
+{
+ bsd_to_svr4_ipc_perm(&bds->shm_perm, &sds->shm_perm);
+ sds->shm_segsz = bds->shm_segsz;
+ sds->shm_lkcnt = 0;
+ sds->shm_lpid = bds->shm_lpid;
+ sds->shm_cpid = bds->shm_cpid;
+ sds->shm_amp = bds->shm_internal;
+ sds->shm_nattch = bds->shm_nattch;
+ sds->shm_cnattch = 0;
+ sds->shm_atime = bds->shm_atime;
+ sds->shm_pad1 = 0;
+ sds->shm_dtime = bds->shm_dtime;
+ sds->shm_pad2 = 0;
+ sds->shm_ctime = bds->shm_ctime;
+ sds->shm_pad3 = 0;
+}
+
+static void
+svr4_to_bsd_shmid_ds(sds, bds)
+ const struct svr4_shmid_ds *sds;
+ struct shmid_ds *bds;
+{
+ svr4_to_bsd_ipc_perm(&sds->shm_perm, &bds->shm_perm);
+ bds->shm_segsz = sds->shm_segsz;
+ bds->shm_lpid = sds->shm_lpid;
+ bds->shm_cpid = sds->shm_cpid;
+ bds->shm_internal = sds->shm_amp;
+ bds->shm_nattch = sds->shm_nattch;
+ bds->shm_atime = sds->shm_atime;
+ bds->shm_dtime = sds->shm_dtime;
+ bds->shm_ctime = sds->shm_ctime;
+}
+
+struct svr4_sys_shmat_args {
+ syscallarg(int) what;
+ syscallarg(int) shmid;
+ syscallarg(void *) shmaddr;
+ syscallarg(int) shmflg;
+};
+
+static int
+svr4_shmat(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct svr4_sys_shmat_args *uap = v;
+ struct sys_shmat_args ap;
+
+ SCARG(&ap, shmid) = SCARG(uap, shmid);
+ SCARG(&ap, shmaddr) = SCARG(uap, shmaddr);
+ SCARG(&ap, shmflg) = SCARG(uap, shmflg);
+
+ return sys_shmat(p, &ap, retval);
+}
+
+struct svr4_sys_shmdt_args {
+ syscallarg(int) what;
+ syscallarg(void *) shmaddr;
+};
+
+static int
+svr4_shmdt(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct svr4_sys_shmdt_args *uap = v;
+ struct sys_shmdt_args ap;
+
+ SCARG(&ap, shmaddr) = SCARG(uap, shmaddr);
+
+ return sys_shmdt(p, &ap, retval);
+}
+
+struct svr4_sys_shmget_args {
+ syscallarg(int) what;
+ syscallarg(key_t) key;
+ syscallarg(int) size;
+ syscallarg(int) shmflg;
+};
+
+static int
+svr4_shmget(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct svr4_sys_shmget_args *uap = v;
+ struct sys_shmget_args ap;
+
+ SCARG(&ap, key) = SCARG(uap, key);
+ SCARG(&ap, size) = SCARG(uap, size);
+ SCARG(&ap, shmflg) = SCARG(uap, shmflg);
+
+ return sys_shmget(p, &ap, retval);
+}
+
+struct svr4_sys_shmctl_args {
+ syscallarg(int) what;
+ syscallarg(int) shmid;
+ syscallarg(int) cmd;
+ syscallarg(struct svr4_shmid_ds *) buf;
+};
+
+int
+svr4_shmctl(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct svr4_sys_shmctl_args *uap = v;
+ int error;
+ caddr_t sg = stackgap_init(p->p_emul);
+ struct sys_shmctl_args ap;
+ struct shmid_ds bs;
+ struct svr4_shmid_ds ss;
+
+ SCARG(&ap, shmid) = SCARG(uap, shmid);
+ SCARG(&ap, buf) = stackgap_alloc(&sg, sizeof (struct shmid_ds));
+ switch (SCARG(uap, cmd)) {
+ case SVR4_IPC_STAT:
+ SCARG(&ap, cmd) = IPC_STAT;
+ if ((error = sys_shmctl(p, &ap, retval)) != 0)
+ return error;
+ error = copyin(&bs, SCARG(&ap, buf), sizeof bs);
+ if (error)
+ return error;
+ bsd_to_svr4_shmid_ds(&bs, &ss);
+ return copyout(&ss, SCARG(uap, buf), sizeof ss);
+
+ case SVR4_IPC_SET:
+ SCARG(&ap, cmd) = IPC_SET;
+ error = copyin(SCARG(uap, buf), (caddr_t) &ss, sizeof ss);
+ if (error)
+ return error;
+ svr4_to_bsd_shmid_ds(&ss, &bs);
+ error = copyout(&bs, SCARG(&ap, buf), sizeof bs);
+ if (error)
+ return error;
+ return sys_shmctl(p, &ap, retval);
+
+ case SVR4_IPC_RMID:
+ case SVR4_SHM_LOCK:
+ case SVR4_SHM_UNLOCK:
+ switch (SCARG(uap, cmd)) {
+ case SVR4_IPC_RMID:
+ SCARG(&ap, cmd) = IPC_RMID;
+ break;
+ case SVR4_SHM_LOCK:
+ SCARG(&ap, cmd) = SHM_LOCK;
+ break;
+ case SVR4_SHM_UNLOCK:
+ SCARG(&ap, cmd) = SHM_UNLOCK;
+ break;
+ }
+ error = copyin(SCARG(uap, buf), &ss, sizeof ss);
+ if (error)
+ return error;
+ svr4_to_bsd_shmid_ds(&ss, &bs);
+ error = copyout(&bs, SCARG(&ap, buf), sizeof bs);
+ if (error)
+ return error;
+ return sys_shmctl(p, &ap, retval);
+
+ default:
+ return EINVAL;
+ }
+}
+
+int
+svr4_sys_shmsys(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct svr4_sys_shmsys_args *uap = v;
+
+ DPRINTF(("svr4_shmsys(%d)\n", SCARG(uap, what)));
+
+ switch (SCARG(uap, what)) {
+ case SVR4_shmat:
+ return svr4_shmat(p, v, retval);
+ case SVR4_shmdt:
+ return svr4_shmdt(p, v, retval);
+ case SVR4_shmget:
+ return svr4_shmget(p, v, retval);
+ case SVR4_shmctl:
+ return svr4_shmctl(p, v, retval);
+ default:
+ return ENOSYS;
+ }
+}
+#endif /* SYSVSHM */
diff --git a/sys/compat/svr4/svr4_ipc.h b/sys/compat/svr4/svr4_ipc.h
new file mode 100644
index 00000000000..b87555d4280
--- /dev/null
+++ b/sys/compat/svr4/svr4_ipc.h
@@ -0,0 +1,175 @@
+/* $NetBSD: svr4_ipc.h,v 1.1 1995/10/14 20:24:32 christos Exp $ */
+
+/*
+ * Copyright (c) 1995 Christos Zoulas. 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 Christos Zoulas.
+ * 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 _SVR4_IPC_H_
+#define _SVR4_IPC_H_
+
+/*
+ * General IPC
+ */
+#define SVR4_IPC_RMID 10
+#define SVR4_IPC_SET 11
+#define SVR4_IPC_STAT 12
+
+struct svr4_ipc_perm {
+ svr4_uid_t uid;
+ svr4_gid_t gid;
+ svr4_uid_t cuid;
+ svr4_gid_t cgid;
+ svr4_mode_t mode;
+ u_long seq;
+ svr4_key_t key;
+ long pad[4];
+};
+
+/*
+ * Message queues
+ */
+#define SVR4_msgget 0
+#define SVR4_msgctl 1
+#define SVR4_msgrcv 2
+#define SVR4_msgsnd 3
+
+struct svr4_msg {
+ struct svr4_msg *msg_next;
+ long msg_type;
+ u_short msg_ts;
+ short msg_spot;
+};
+
+struct svr4_msqid_ds {
+ struct svr4_ipc_perm msg_perm;
+ struct svr4_msg *msg_first;
+ struct svr4_msg *msg_last;
+ u_long msg_cbytes;
+ u_long msg_qnum;
+ u_long msg_qbytes;
+ svr4_pid_t msg_lspid;
+ svr4_pid_t msg_lrpid;
+ svr4_time_t msg_stime;
+ long msg_pad1;
+ svr4_time_t msg_rtime;
+ long msg_pad2;
+ svr4_time_t msg_ctime;
+ long msg_pad3;
+ short msg_cv;
+ short msg_qnum_cv;
+ long msg_pad4[3];
+};
+
+struct svr4_msgbuf {
+ long mtype; /* message type */
+ char mtext[1]; /* message text */
+};
+
+struct svr4_msginfo {
+ int msgmap;
+ int msgmax;
+ int msgmnb;
+ int msgmni;
+ int msgssz;
+ int msgtql;
+ u_short msgseg;
+};
+
+/*
+ * Shared memory
+ */
+#define SVR4_shmat 0
+#define SVR4_shmctl 1
+#define SVR4_shmdt 2
+#define SVR4_shmget 3
+
+/* shmctl() operations */
+#define SVR4_SHM_LOCK 3
+#define SVR4_SHM_UNLOCK 4
+
+struct svr4_shmid_ds {
+ struct svr4_ipc_perm shm_perm;
+ int shm_segsz;
+ void *shm_amp;
+ u_short shm_lkcnt;
+ svr4_pid_t shm_lpid;
+ svr4_pid_t shm_cpid;
+ u_long shm_nattch;
+ u_long shm_cnattch;
+ svr4_time_t shm_atime;
+ long shm_pad1;
+ svr4_time_t shm_dtime;
+ long shm_pad2;
+ svr4_time_t shm_ctime;
+ long shm_pad3;
+ long shm_pad4[4];
+};
+
+/*
+ * Semaphores
+ */
+#define SVR4_semctl 0
+#define SVR4_semget 1
+#define SVR4_semop 2
+
+/* semctl() operations */
+#define SVR4_SEM_GETNCNT 3
+#define SVR4_SEM_GETPID 4
+#define SVR4_SEM_GETVAL 5
+#define SVR4_SEM_GETALL 6
+#define SVR4_SEM_GETZCNT 7
+#define SVR4_SEM_SETVAL 8
+#define SVR4_SEM_SETALL 9
+
+struct svr4_sem {
+ u_short semval;
+ svr4_pid_t sempid;
+ u_short semncnt;
+ u_short semzcnt;
+ u_short semncnt_cv;
+ u_short semzcnt_cv;
+};
+
+struct svr4_semid_ds {
+ struct svr4_ipc_perm sem_perm;
+ struct svr4_sem *sem_base;
+ u_short sem_nsems;
+ svr4_time_t sem_otime;
+ long sem_pad1;
+ svr4_time_t sem_ctime;
+ long sem_pad2;
+ long sem_pad3[4];
+};
+
+struct svr4_sembuf {
+ u_short sem_num;
+ short sem_op;
+ short sem_flg;
+};
+
+#endif /* _SVR4_IPC_H */
diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c
index bab1d019d8d..106c4f5ad05 100644
--- a/sys/compat/svr4/svr4_misc.c
+++ b/sys/compat/svr4/svr4_misc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: svr4_misc.c,v 1.28 1995/10/09 11:24:17 mycroft Exp $ */
+/* $NetBSD: svr4_misc.c,v 1.29 1995/10/14 20:24:35 christos Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@@ -60,6 +60,8 @@
#include <sys/times.h>
#include <sys/sem.h>
#include <sys/msg.h>
+#include <sys/ptrace.h>
+#include <sys/signalvar.h>
#include <netinet/in.h>
#include <sys/syscallargs.h>
@@ -79,7 +81,6 @@
#include <compat/svr4/svr4_sysconfig.h>
#include <vm/vm.h>
-/* XXX */ extern struct proc *pfind();
static __inline clock_t timeval_to_clock_t __P((struct timeval *));
static int svr4_setinfo __P((struct proc *, int, svr4_siginfo_t *));
@@ -306,9 +307,6 @@ svr4_sys_mmap(p, v, retval)
register_t *retval;
{
struct svr4_sys_mmap_args *uap = v;
- struct filedesc *fdp;
- struct file *fp;
- struct vnode *vp;
struct sys_mmap_args mm;
caddr_t rp;
#define _MAP_NEW 0x80000000
@@ -618,7 +616,7 @@ svr4_sys_times(p, v, retval)
if (error)
return error;
- if (error = copyin(ru, &r, sizeof r))
+ if ((error = copyin(ru, &r, sizeof r)) != 0)
return error;
tms.tms_utime = timeval_to_clock_t(&r.ru_utime);
@@ -629,7 +627,7 @@ svr4_sys_times(p, v, retval)
if (error)
return error;
- if (error = copyin(ru, &r, sizeof r))
+ if ((error = copyin(ru, &r, sizeof r)) != 0)
return error;
tms.tms_cutime = timeval_to_clock_t(&r.ru_utime);
@@ -945,7 +943,8 @@ svr4_sys_waitsys(p, v, retval)
}
DPRINTF(("waitsys(%d, %d, %x, %x)\n",
- SCARG(uap, grp), SCARG(uap, id), SCARG(uap, info),
+ SCARG(uap, grp), SCARG(uap, id),
+ (unsigned int) SCARG(uap, info),
SCARG(uap, options)));
loop:
@@ -1049,7 +1048,7 @@ loop:
return 0;
}
- if (error = tsleep((caddr_t)p, PWAIT | PCATCH, "svr4_wait", 0))
+ if ((error = tsleep((caddr_t)p, PWAIT | PCATCH, "svr4_wait", 0)) != 0)
return error;
goto loop;
}
diff --git a/sys/compat/svr4/svr4_net.c b/sys/compat/svr4/svr4_net.c
index 42f50403f54..e46b95c12df 100644
--- a/sys/compat/svr4/svr4_net.c
+++ b/sys/compat/svr4/svr4_net.c
@@ -1,4 +1,4 @@
-/* $NetBSD: svr4_net.c,v 1.4 1994/12/14 20:20:26 mycroft Exp $ */
+/* $NetBSD: svr4_net.c,v 1.5 1995/10/14 20:24:38 christos Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@@ -68,6 +68,8 @@ enum {
dev_udp = 36
};
+int svr4_netattach __P((int));
+
static int svr4_netclose __P((struct file *fp, struct proc *p));
static struct fileops svr4_netops = {
diff --git a/sys/compat/svr4/svr4_signal.h b/sys/compat/svr4/svr4_signal.h
index 8dfeee42749..fad82523a19 100644
--- a/sys/compat/svr4/svr4_signal.h
+++ b/sys/compat/svr4/svr4_signal.h
@@ -1,4 +1,4 @@
-/* $NetBSD: svr4_signal.h,v 1.13 1995/08/14 02:22:20 mycroft Exp $ */
+/* $NetBSD: svr4_signal.h,v 1.14 1995/10/14 20:24:41 christos Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@@ -76,13 +76,14 @@
#define SVR4_SIGIGNORE_MASK 0x0800
#define SVR4_SIGPAUSE_MASK 0x1000
-#define SVR4_SIGNO(x) ((x) & SVR4_SIGNO_MASK)
-#define SVR4_SIGCALL(x) ((x) & ~SVR4_SIGNO_MASK)
+typedef void (*svr4_sig_t) __P((int, svr4_siginfo_t *, void *));
+#define SVR4_SIG_DFL (svr4_sig_t) 0
+#define SVR4_SIG_ERR (svr4_sig_t) -1
+#define SVR4_SIG_IGN (svr4_sig_t) 1
+#define SVR4_SIG_HOLD (svr4_sig_t) 2
-#define SVR4_SIG_DFL (void(*)())0
-#define SVR4_SIG_ERR (void(*)())-1
-#define SVR4_SIG_IGN (void(*)())1
-#define SVR4_SIG_HOLD (void(*)())2
+#define SVR4_SIGNO(a) ((a) & SVR4_SIGNO_MASK)
+#define SVR4_SIGCALL(a) ((a) & ~SVR4_SIGNO_MASK)
#define SVR4_SIG_BLOCK 1
#define SVR4_SIG_UNBLOCK 2
@@ -91,7 +92,6 @@
typedef struct {
u_long bits[4];
} svr4_sigset_t;
-typedef void (*svr4_sig_t) __P((int));
struct svr4_sigaction {
int sa_flags;
diff --git a/sys/compat/svr4/svr4_stat.c b/sys/compat/svr4/svr4_stat.c
index b49e517b4fa..f8db45508d6 100644
--- a/sys/compat/svr4/svr4_stat.c
+++ b/sys/compat/svr4/svr4_stat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: svr4_stat.c,v 1.13 1995/10/07 06:27:49 mycroft Exp $ */
+/* $NetBSD: svr4_stat.c,v 1.14 1995/10/14 20:24:43 christos Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@@ -66,6 +66,12 @@
# define SVR4_NO_OSTAT
#endif
+static void bsd_to_svr4_xstat __P((struct stat *, struct svr4_xstat *));
+
+
+#ifndef SVR4_NO_OSTAT
+static void bsd_to_svr4_stat __P((struct stat *, struct svr4_stat *));
+
static void
bsd_to_svr4_stat(st, st4)
struct stat *st;
@@ -84,6 +90,8 @@ bsd_to_svr4_stat(st, st4)
st4->st_mtim = st->st_mtimespec.ts_sec;
st4->st_ctim = st->st_ctimespec.ts_sec;
}
+#endif
+
static void
@@ -351,7 +359,7 @@ svr4_ustat(p, uap, retval)
* XXX: should set f_tfree and f_tinode at least
* How do we translate dev -> fstat? (and then to svr4_ustat)
*/
- if (error = copyout(&us, SCARG(uap, name), sizeof us))
+ if ((error = copyout(&us, SCARG(uap, name), sizeof us)) != 0)
return (error);
return 0;
@@ -445,16 +453,16 @@ svr4_sys_systeminfo(p, v, retval)
break;
case SVR4_SI_SET_HOSTNAME:
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
return error;
name = KERN_HOSTNAME;
- return kern_sysctl(&name, 1, 0, 0, SCARG(uap, buf), rlen);
+ return kern_sysctl(&name, 1, 0, 0, SCARG(uap, buf), rlen, p);
case SVR4_SI_SET_SRPC_DOMAIN:
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
return error;
name = KERN_DOMAINNAME;
- return kern_sysctl(&name, 1, 0, 0, SCARG(uap, buf), rlen);
+ return kern_sysctl(&name, 1, 0, 0, SCARG(uap, buf), rlen, p);
default:
DPRINTF(("Bad systeminfo command %d\n", SCARG(uap, what)));
diff --git a/sys/compat/svr4/svr4_syscall.h b/sys/compat/svr4/svr4_syscall.h
index 2a3076df8e8..ed736807598 100644
--- a/sys/compat/svr4/svr4_syscall.h
+++ b/sys/compat/svr4/svr4_syscall.h
@@ -2,7 +2,7 @@
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.13 1995/10/07 06:27:57 mycroft Exp
+ * created from NetBSD: syscalls.master,v 1.14 1995/10/14 20:25:06 christos Exp
*/
#define SVR4_SYS_syscall 0
@@ -40,7 +40,10 @@
#define SVR4_SYS_setgid 46
#define SVR4_SYS_getgid 47
#define SVR4_SYS_signal 48
+#define SVR4_SYS_msgsys 49
#define SVR4_SYS_sysarch 50
+#define SVR4_SYS_shmsys 52
+#define SVR4_SYS_semsys 53
#define SVR4_SYS_ioctl 54
#define SVR4_SYS_utssys 57
#define SVR4_SYS_fsync 58
diff --git a/sys/compat/svr4/svr4_syscallargs.h b/sys/compat/svr4/svr4_syscallargs.h
index 79b22a29872..9823845dfa3 100644
--- a/sys/compat/svr4/svr4_syscallargs.h
+++ b/sys/compat/svr4/svr4_syscallargs.h
@@ -2,7 +2,7 @@
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.13 1995/10/07 06:27:57 mycroft Exp
+ * created from NetBSD: syscalls.master,v 1.14 1995/10/14 20:25:06 christos Exp
*/
#define syscallarg(x) union { x datum; register_t pad; }
@@ -80,11 +80,34 @@ struct svr4_sys_signal_args {
syscallarg(svr4_sig_t) handler;
};
+struct svr4_sys_msgsys_args {
+ syscallarg(int) what;
+ syscallarg(int) a2;
+ syscallarg(int) a3;
+ syscallarg(int) a4;
+ syscallarg(int) a5;
+};
+
struct svr4_sys_sysarch_args {
syscallarg(int) op;
syscallarg(void *) a1;
};
+struct svr4_sys_shmsys_args {
+ syscallarg(int) what;
+ syscallarg(int) a2;
+ syscallarg(int) a3;
+ syscallarg(int) a4;
+};
+
+struct svr4_sys_semsys_args {
+ syscallarg(int) what;
+ syscallarg(int) a2;
+ syscallarg(int) a3;
+ syscallarg(int) a4;
+ syscallarg(int) a5;
+};
+
struct svr4_sys_ioctl_args {
syscallarg(int) fd;
syscallarg(u_long) com;
@@ -302,13 +325,16 @@ int sys_setgid __P((struct proc *, void *, register_t *));
int sys_getgid __P((struct proc *, void *, register_t *));
int svr4_sys_signal __P((struct proc *, void *, register_t *));
#ifdef SYSVMSG
+int svr4_sys_msgsys __P((struct proc *, void *, register_t *));
#else
#endif
int svr4_sys_sysarch __P((struct proc *, void *, register_t *));
#ifdef SYSVSHM
+int svr4_sys_shmsys __P((struct proc *, void *, register_t *));
#else
#endif
#ifdef SYSVSEM
+int svr4_sys_semsys __P((struct proc *, void *, register_t *));
#else
#endif
int svr4_sys_ioctl __P((struct proc *, void *, register_t *));
diff --git a/sys/compat/svr4/svr4_syscalls.c b/sys/compat/svr4/svr4_syscalls.c
index 8019c68e7e8..3998cdb8eee 100644
--- a/sys/compat/svr4/svr4_syscalls.c
+++ b/sys/compat/svr4/svr4_syscalls.c
@@ -2,7 +2,7 @@
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.13 1995/10/07 06:27:57 mycroft Exp
+ * created from NetBSD: syscalls.master,v 1.14 1995/10/14 20:25:06 christos Exp
*/
char *svr4_syscallnames[] = {
@@ -56,19 +56,19 @@ char *svr4_syscallnames[] = {
"getgid", /* 47 = getgid */
"signal", /* 48 = signal */
#ifdef SYSVMSG
- "#49 (unimplemented { int sys_msgsys ( int which , int a2 , int a3 , int a4 , int a5 , int a6 ) ; })", /* 49 = unimplemented { int sys_msgsys ( int which , int a2 , int a3 , int a4 , int a5 , int a6 ) ; } */
+ "msgsys", /* 49 = msgsys */
#else
"#49 (unimplemented msgsys)", /* 49 = unimplemented msgsys */
#endif
"sysarch", /* 50 = sysarch */
"#51 (unimplemented acct)", /* 51 = unimplemented acct */
#ifdef SYSVSHM
- "#52 (unimplemented { int sys_shmsys ( int which , int a2 , int a3 , int a4 ) ; })", /* 52 = unimplemented { int sys_shmsys ( int which , int a2 , int a3 , int a4 ) ; } */
+ "shmsys", /* 52 = shmsys */
#else
"#52 (unimplemented shmsys)", /* 52 = unimplemented shmsys */
#endif
#ifdef SYSVSEM
- "#53 (unimplemented { int sys_semsys ( int which , int a2 , int a3 , int a4 , int a5 ) ; })", /* 53 = unimplemented { int sys_semsys ( int which , int a2 , int a3 , int a4 , int a5 ) ; } */
+ "semsys", /* 53 = semsys */
#else
"#53 (unimplemented semsys)", /* 53 = unimplemented semsys */
#endif
diff --git a/sys/compat/svr4/svr4_sysent.c b/sys/compat/svr4/svr4_sysent.c
index 0ebc6629df5..c48f9ebf9e1 100644
--- a/sys/compat/svr4/svr4_sysent.c
+++ b/sys/compat/svr4/svr4_sysent.c
@@ -2,7 +2,7 @@
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.13 1995/10/07 06:27:57 mycroft Exp
+ * created from NetBSD: syscalls.master,v 1.14 1995/10/14 20:25:06 christos Exp
*/
#include <sys/param.h>
@@ -136,8 +136,8 @@ struct sysent svr4_sysent[] = {
{ 2, s(struct svr4_sys_signal_args),
svr4_sys_signal }, /* 48 = signal */
#ifdef SYSVMSG
- { 0, 0,
- sys_nosys }, /* 49 = unimplemented { int sys_msgsys ( int which , int a2 , int a3 , int a4 , int a5 , int a6 ) ; } */
+ { 5, s(struct svr4_sys_msgsys_args),
+ svr4_sys_msgsys }, /* 49 = msgsys */
#else
{ 0, 0,
sys_nosys }, /* 49 = unimplemented msgsys */
@@ -147,15 +147,15 @@ struct sysent svr4_sysent[] = {
{ 0, 0,
sys_nosys }, /* 51 = unimplemented acct */
#ifdef SYSVSHM
- { 0, 0,
- sys_nosys }, /* 52 = unimplemented { int sys_shmsys ( int which , int a2 , int a3 , int a4 ) ; } */
+ { 4, s(struct svr4_sys_shmsys_args),
+ svr4_sys_shmsys }, /* 52 = shmsys */
#else
{ 0, 0,
sys_nosys }, /* 52 = unimplemented shmsys */
#endif
#ifdef SYSVSEM
- { 0, 0,
- sys_nosys }, /* 53 = unimplemented { int sys_semsys ( int which , int a2 , int a3 , int a4 , int a5 ) ; } */
+ { 5, s(struct svr4_sys_semsys_args),
+ svr4_sys_semsys }, /* 53 = semsys */
#else
{ 0, 0,
sys_nosys }, /* 53 = unimplemented semsys */
diff --git a/sys/compat/svr4/svr4_termios.c b/sys/compat/svr4/svr4_termios.c
index 984c7b514a1..b9c4a2f8b6e 100644
--- a/sys/compat/svr4/svr4_termios.c
+++ b/sys/compat/svr4/svr4_termios.c
@@ -1,4 +1,4 @@
-/* $NetBSD: svr4_termios.c,v 1.5 1995/10/07 06:27:55 mycroft Exp $ */
+/* $NetBSD: svr4_termios.c,v 1.6 1995/10/14 20:24:58 christos Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@@ -46,6 +46,7 @@
#include <compat/svr4/svr4_types.h>
#include <compat/svr4/svr4_util.h>
#include <compat/svr4/svr4_signal.h>
+#include <compat/svr4/svr4_ioctl.h>
#include <compat/svr4/svr4_syscallargs.h>
#include <compat/svr4/svr4_stropts.h>
#include <compat/svr4/svr4_termios.h>
@@ -458,7 +459,7 @@ svr4_termioctl(fp, cmd, data, p, retval)
{
int i;
printf("iflag=%o oflag=%o cflag=%o lflag=%o\n",
- bt.c_iflag, bt.c_oflag, bt.c_lflag);
+ bt.c_iflag, bt.c_oflag, bt.c_cflag, bt.c_lflag);
printf("cc: ");
for (i = 0; i < NCCS; i++)
printf("%o ", bt.c_cc[i]);
@@ -474,7 +475,7 @@ svr4_termioctl(fp, cmd, data, p, retval)
{
int i;
printf("iflag=%o oflag=%o cflag=%o lflag=%o\n",
- st.c_iflag, st.c_oflag, st.c_lflag);
+ bt.c_iflag, bt.c_oflag, bt.c_cflag, bt.c_lflag);
printf("cc: ");
for (i = 0; i < SVR4_NCCS; i++)
printf("%o ", st.c_cc[i]);
diff --git a/sys/compat/svr4/svr4_ttold.c b/sys/compat/svr4/svr4_ttold.c
index dd71697e779..0ce97072dad 100644
--- a/sys/compat/svr4/svr4_ttold.c
+++ b/sys/compat/svr4/svr4_ttold.c
@@ -1,4 +1,4 @@
-/* $NetBSD: svr4_ttold.c,v 1.6 1995/10/07 06:27:56 mycroft Exp $ */
+/* $NetBSD: svr4_ttold.c,v 1.7 1995/10/14 20:25:01 christos Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@@ -49,6 +49,7 @@
#include <compat/svr4/svr4_syscallargs.h>
#include <compat/svr4/svr4_stropts.h>
#include <compat/svr4/svr4_ttold.h>
+#include <compat/svr4/svr4_ioctl.h>
static void svr4_tchars_to_bsd_tchars __P((const struct svr4_tchars *st,
struct tchars *bt));
diff --git a/sys/compat/svr4/svr4_types.h b/sys/compat/svr4/svr4_types.h
index ba553d432fd..542fa328b40 100644
--- a/sys/compat/svr4/svr4_types.h
+++ b/sys/compat/svr4/svr4_types.h
@@ -1,4 +1,4 @@
-/* $NetBSD: svr4_types.h,v 1.6 1995/08/14 01:12:50 mycroft Exp $ */
+/* $NetBSD: svr4_types.h,v 1.7 1995/10/14 20:25:04 christos Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@@ -51,6 +51,7 @@ typedef short svr4_o_nlink_t;
typedef u_short svr4_o_uid_t;
typedef u_short svr4_o_gid_t;
typedef long svr4_clock_t;
+typedef int svr4_key_t;
typedef struct timespec svr4_timestruc_t;
diff --git a/sys/compat/svr4/syscalls.master b/sys/compat/svr4/syscalls.master
index 23c9202537a..2b8a3f11a3d 100644
--- a/sys/compat/svr4/syscalls.master
+++ b/sys/compat/svr4/syscalls.master
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.13 1995/10/07 06:27:57 mycroft Exp $
+ $NetBSD: syscalls.master,v 1.14 1995/10/14 20:25:06 christos Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -93,21 +93,22 @@
47 NOARGS { gid_t sys_getgid(void); }
48 STD { int svr4_sys_signal(int signum, svr4_sig_t handler); }
#ifdef SYSVMSG
-49 UNIMPL { int sys_msgsys(int which, int a2, int a3, int a4, \
- int a5, int a6); }
+49 STD { int svr4_sys_msgsys(int what, int a2, int a3, \
+ int a4, int a5); }
#else
49 UNIMPL msgsys
#endif
50 STD { int svr4_sys_sysarch(int op, void *a1); }
51 UNIMPL acct
#ifdef SYSVSHM
-52 UNIMPL { int sys_shmsys(int which, int a2, int a3, int a4); }
+52 STD { int svr4_sys_shmsys(int what, int a2, int a3, \
+ int a4); }
#else
52 UNIMPL shmsys
#endif
#ifdef SYSVSEM
-53 UNIMPL { int sys_semsys(int which, int a2, int a3, int a4, \
- int a5); }
+53 STD { int svr4_sys_semsys(int what, int a2, int a3, \
+ int a4, int a5); }
#else
53 UNIMPL semsys
#endif