From 7f3eb72e97dd1d514adc8f96bc0bcb258a2661ab Mon Sep 17 00:00:00 2001 From: deraadt Date: Tue, 7 May 1996 08:48:26 +0000 Subject: [PATCH] sync with 0504; mostly proto changes (some svr4 ioctl changes) --- sys/compat/freebsd/freebsd_file.c | 6 ++- sys/compat/freebsd/freebsd_misc.c | 6 ++- sys/compat/freebsd/freebsd_ptrace.c | 7 +-- sys/compat/ibcs2/ibcs2_errno.c | 2 + sys/compat/ibcs2/ibcs2_errno.h | 2 + sys/compat/ibcs2/ibcs2_exec.c | 27 ++++++------ sys/compat/ibcs2/ibcs2_fcntl.c | 12 +++++- sys/compat/ibcs2/ibcs2_ioctl.c | 11 +++-- sys/compat/ibcs2/ibcs2_ipc.c | 52 +++++++++++++++-------- sys/compat/ibcs2/ibcs2_misc.c | 66 +++++++++++++++++------------ sys/compat/ibcs2/ibcs2_signal.c | 8 +++- sys/compat/ibcs2/ibcs2_signal.h | 10 ++--- sys/compat/ibcs2/ibcs2_socksys.c | 17 +++++--- sys/compat/ibcs2/ibcs2_socksys.h | 4 ++ sys/compat/ibcs2/ibcs2_stat.c | 23 +++++----- sys/compat/ibcs2/ibcs2_stropts.h | 2 + sys/compat/ibcs2/ibcs2_timeb.h | 2 + sys/compat/ibcs2/ibcs2_utime.h | 2 + sys/compat/svr4/svr4_sockio.c | 8 ++-- 19 files changed, 174 insertions(+), 93 deletions(-) diff --git a/sys/compat/freebsd/freebsd_file.c b/sys/compat/freebsd/freebsd_file.c index d997c2b7447..44c9cbca3a0 100644 --- a/sys/compat/freebsd/freebsd_file.c +++ b/sys/compat/freebsd/freebsd_file.c @@ -1,4 +1,4 @@ -/* $NetBSD: freebsd_file.c,v 1.2 1995/11/07 22:27:21 gwr Exp $ */ +/* $NetBSD: freebsd_file.c,v 1.3 1996/05/03 17:03:09 christos Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -54,6 +54,8 @@ const char freebsd_emul_path[] = "/emul/freebsd"; +static char * convert_from_freebsd_mount_type __P((int)); + static char * convert_from_freebsd_mount_type(type) int type; @@ -106,7 +108,7 @@ freebsd_sys_mount(p, v, retval) if ((type = convert_from_freebsd_mount_type(SCARG(uap, type))) == NULL) return ENODEV; s = stackgap_alloc(&sg, MFSNAMELEN + 1); - if (error = copyout(type, s, strlen(type) + 1)) + if ((error = copyout(type, s, strlen(type) + 1)) != 0) return error; SCARG(&bma, type) = s; FREEBSD_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); diff --git a/sys/compat/freebsd/freebsd_misc.c b/sys/compat/freebsd/freebsd_misc.c index 4692fedc17e..ed8d0f6123f 100644 --- a/sys/compat/freebsd/freebsd_misc.c +++ b/sys/compat/freebsd/freebsd_misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: freebsd_misc.c,v 1.1 1995/10/10 01:19:33 mycroft Exp $ */ +/* $NetBSD: freebsd_misc.c,v 1.2 1996/05/03 17:03:10 christos Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -78,11 +78,13 @@ freebsd_sys_rtprio(p, v, retval) void *v; register_t *retval; { +#ifdef notyet struct freebsd_sys_rtprio_args /* { syscallarg(int) function; syscallarg(pid_t) pid; syscallarg(struct freebsd_rtprio *) rtp; } */ *uap = v; +#endif return ENOSYS; /* XXX */ } @@ -93,9 +95,11 @@ freebsd_ntp_adjtime(p, v, retval) void *v; register_t *retval; { +#ifdef notyet struct freebsd_ntp_adjtime_args /* { syscallarg(struct freebsd_timex *) tp; } */ *uap = v; +#endif return ENOSYS; /* XXX */ } diff --git a/sys/compat/freebsd/freebsd_ptrace.c b/sys/compat/freebsd/freebsd_ptrace.c index 424caf59b19..da83623e768 100644 --- a/sys/compat/freebsd/freebsd_ptrace.c +++ b/sys/compat/freebsd/freebsd_ptrace.c @@ -1,4 +1,4 @@ -/* $NetBSD: freebsd_ptrace.c,v 1.1 1995/10/10 01:19:34 mycroft Exp $ */ +/* $NetBSD: freebsd_ptrace.c,v 1.2 1996/05/03 17:03:12 christos Exp $ */ /*- * Copyright (c) 1994 Christopher G. Demetriou. All rights reserved. @@ -126,8 +126,9 @@ freebsd_sys_ptrace(p, v, retval) retval); case FREEBSD_PT_WRITE_U: - if (error = freebsd_ptrace_setregs(&fr, - SCARG(uap, addr), SCARG(uap, data))) + error = freebsd_ptrace_setregs(&fr, + SCARG(uap, addr), SCARG(uap, data)); + if (error) return error; freebsd_to_netbsd_ptrace_regs(&fr, &nrp->regs, &nrp->fpregs); diff --git a/sys/compat/ibcs2/ibcs2_errno.c b/sys/compat/ibcs2/ibcs2_errno.c index 48cb88eb9c1..ec84dd24390 100644 --- a/sys/compat/ibcs2/ibcs2_errno.c +++ b/sys/compat/ibcs2/ibcs2_errno.c @@ -1,3 +1,5 @@ +/* $NetBSD: ibcs2_errno.c,v 1.2 1996/05/03 17:05:16 christos Exp $ */ + /* * ibcs2_errno.c * Copyright (c) 1995 Scott Bartram diff --git a/sys/compat/ibcs2/ibcs2_errno.h b/sys/compat/ibcs2/ibcs2_errno.h index 30ed8241ae2..501df05bdab 100644 --- a/sys/compat/ibcs2/ibcs2_errno.h +++ b/sys/compat/ibcs2/ibcs2_errno.h @@ -1,3 +1,5 @@ +/* $NetBSD: ibcs2_errno.h,v 1.2 1996/05/03 17:05:18 christos Exp $ */ + /* * ibcs2_errno.h * Copyright (c) 1995 Scott Bartram diff --git a/sys/compat/ibcs2/ibcs2_exec.c b/sys/compat/ibcs2/ibcs2_exec.c index 1e69c9d6101..03081f49917 100644 --- a/sys/compat/ibcs2/ibcs2_exec.c +++ b/sys/compat/ibcs2/ibcs2_exec.c @@ -1,4 +1,4 @@ -/* $NetBSD: ibcs2_exec.c,v 1.10 1995/06/24 20:18:55 christos Exp $ */ +/* $NetBSD: ibcs2_exec.c,v 1.11 1996/05/03 17:05:19 christos Exp $ */ /* * Copyright (c) 1994, 1995 Scott Bartram @@ -67,6 +67,10 @@ int exec_ibcs2_xout_prep_zmagic __P((struct proc *, struct exec_package *, struct xexec *, struct xext *)); int exec_ibcs2_xout_setup_stack __P((struct proc *, struct exec_package *)); int coff_load_shlib __P((struct proc *, char *, struct exec_package *)); +static int coff_find_section __P((struct proc *, struct vnode *, + struct coff_filehdr *, struct coff_scnhdr *, + int)); + extern int bsd2ibcs_errno[]; extern struct sysent ibcs2_sysent[]; @@ -108,8 +112,6 @@ exec_ibcs2_coff_makecmds(p, epp) struct proc *p; struct exec_package *epp; { - u_long midmag, magic; - u_short mid; int error; struct coff_filehdr *fp = epp->ep_hdr; struct coff_aouthdr *ap; @@ -141,7 +143,6 @@ exec_ibcs2_coff_makecmds(p, epp) if (error) kill_vmcmds(&epp->ep_vmcmds); -bad: return error; } @@ -286,10 +287,10 @@ coff_find_section(p, vp, fp, sh, s_type) pos = COFF_HDR_SIZE; for (i = 0; i < fp->f_nscns; i++, pos += sizeof(struct coff_scnhdr)) { siz = sizeof(struct coff_scnhdr); - if (error = vn_rdwr(UIO_READ, vp, (caddr_t) sh, - siz, pos, - UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, - &resid, p)) { + error = vn_rdwr(UIO_READ, vp, (caddr_t) sh, + siz, pos, UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, + &resid, p); + if (error) { DPRINTF(("section hdr %d read error %d\n", i, error)); return error; } @@ -478,15 +479,15 @@ coff_load_shlib(p, path, epp) IBCS2_CHECK_ALT_EXIST(p, &sg, path); NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path, p); /* first get the vnode */ - if (error = namei(&nd)) { + if ((error = namei(&nd)) != 0) { DPRINTF(("coff_load_shlib: can't find library %s\n", path)); return error; } siz = sizeof(struct coff_filehdr); - if (error = vn_rdwr(UIO_READ, nd.ni_vp, (caddr_t) fhp, siz, 0, - UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, - &resid, p)) { + error = vn_rdwr(UIO_READ, nd.ni_vp, (caddr_t) fhp, siz, 0, + UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, p); + if (error) { DPRINTF(("filehdr read error %d\n", error)); vrele(nd.ni_vp); return error; @@ -558,8 +559,6 @@ exec_ibcs2_xout_makecmds(p, epp) struct proc *p; struct exec_package *epp; { - u_long midmag, magic; - u_short mid; int error; struct xexec *xp = epp->ep_hdr; struct xext *xep; diff --git a/sys/compat/ibcs2/ibcs2_fcntl.c b/sys/compat/ibcs2/ibcs2_fcntl.c index a40d91b72e7..14681ae2d3b 100644 --- a/sys/compat/ibcs2/ibcs2_fcntl.c +++ b/sys/compat/ibcs2/ibcs2_fcntl.c @@ -1,3 +1,5 @@ +/* $NetBSD: ibcs2_fcntl.c,v 1.6 1996/05/03 17:05:20 christos Exp $ */ + /* * Copyright (c) 1995 Scott Bartram * All rights reserved. @@ -46,6 +48,12 @@ #include #include +static int cvt_o_flags __P((int)); +static void cvt_flock2iflock __P((struct flock *, struct ibcs2_flock *)); +static void cvt_iflock2flock __P((struct ibcs2_flock *, struct flock *)); +static int ioflags2oflags __P((int)); +static int oflags2ioflags __P((int)); + static int cvt_o_flags(flags) int flags; @@ -243,7 +251,7 @@ ibcs2_sys_eaccess(p, v, retval) NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, SCARG(uap, path), p); - if (error = namei(&nd)) + if ((error = namei(&nd)) != 0) return error; vp = nd.ni_vp; @@ -307,7 +315,7 @@ ibcs2_sys_fcntl(p, v, retval) case IBCS2_F_SETFL: SCARG(&fa, fd) = SCARG(uap, fd); SCARG(&fa, cmd) = F_SETFL; - SCARG(&fa, arg) = (void *)ioflags2oflags(SCARG(uap, arg)); + SCARG(&fa, arg) = (void *)ioflags2oflags((int) SCARG(uap, arg)); return sys_fcntl(p, &fa, retval); case IBCS2_F_GETLK: diff --git a/sys/compat/ibcs2/ibcs2_ioctl.c b/sys/compat/ibcs2/ibcs2_ioctl.c index 61729dc05b1..2da1fbfc785 100644 --- a/sys/compat/ibcs2/ibcs2_ioctl.c +++ b/sys/compat/ibcs2/ibcs2_ioctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: ibcs2_ioctl.c,v 1.10 1995/12/26 17:56:36 mycroft Exp $ */ +/* $NetBSD: ibcs2_ioctl.c,v 1.11 1996/05/03 17:05:22 christos Exp $ */ /* * Copyright (c) 1994, 1995 Scott Bartram @@ -111,6 +111,11 @@ static u_long s2btab[] = { 38400, }; +static void stios2btios __P((struct ibcs2_termios *, struct termios *)); +static void btios2stios __P((struct termios *, struct ibcs2_termios *)); +static void stios2stio __P((struct ibcs2_termios *, struct ibcs2_termio *)); +static void stio2stios __P((struct ibcs2_termio *, struct ibcs2_termios *)); + static void stios2btios(st, bt) struct ibcs2_termios *st; @@ -336,7 +341,7 @@ ibcs2_sys_ioctl(p, v, retval) } */ *uap = v; struct filedesc *fdp = p->p_fd; struct file *fp; - int (*ctl)(); + int (*ctl) __P((struct file *, u_long, caddr_t, struct proc *)); int error; if (SCARG(uap, fd) < 0 || SCARG(uap, fd) >= fdp->fd_nfiles || @@ -504,7 +509,7 @@ ibcs2_sys_ioctl(p, v, retval) SCARG(&sa, pid) = 0; SCARG(&sa, pgid) = (int)SCARG(uap, data); - if (error = sys_setpgid(p, &sa, retval)) + if ((error = sys_setpgid(p, &sa, retval)) != 0) return error; return 0; } diff --git a/sys/compat/ibcs2/ibcs2_ipc.c b/sys/compat/ibcs2/ibcs2_ipc.c index d8cc2e2844c..3744170d313 100644 --- a/sys/compat/ibcs2/ibcs2_ipc.c +++ b/sys/compat/ibcs2/ibcs2_ipc.c @@ -1,3 +1,5 @@ +/* $NetBSD: ibcs2_ipc.c,v 1.6 1996/05/03 17:05:23 christos Exp $ */ + /* * Copyright (c) 1995 Scott Bartram * All rights reserved. @@ -82,10 +84,13 @@ struct ibcs2_msqid_ds { ibcs2_time_t msg_ctime; }; +static void cvt_msqid2imsqid __P((struct msqid_ds *, struct ibcs2_msqid_ds *)); +static void cvt_imsqid2msqid __P((struct ibcs2_msqid_ds *, struct msqid_ds *)); + static void cvt_msqid2imsqid(bp, ibp) -struct msqid_ds *bp; -struct ibcs2_msqid_ds *ibp; + struct msqid_ds *bp; + struct ibcs2_msqid_ds *ibp; { ibp->msg_perm = bp->msg_perm; ibp->msg_first = bp->msg_first; @@ -103,8 +108,8 @@ struct ibcs2_msqid_ds *ibp; static void cvt_imsqid2msqid(ibp, bp) -struct ibcs2_msqid_ds *ibp; -struct msqid_ds *bp; + struct ibcs2_msqid_ds *ibp; + struct msqid_ds *bp; { bp->msg_perm = ibp->msg_perm; bp->msg_first = ibp->msg_first; @@ -154,13 +159,14 @@ ibcs2_sys_msgsys(p, v, retval) case IBCS2_IPC_STAT: error = compat_10_sys_msgsys(p, &margs, retval); if (!error) - cvt_msqid2imsqid(SCARG(&margs, a4), + cvt_msqid2imsqid((struct msqid_ds *) + SCARG(&margs, a4), (struct ibcs2_msqid_ds *)SCARG(uap, a4)); return error; case IBCS2_IPC_SET: cvt_imsqid2msqid((struct ibcs2_msqid_ds *)SCARG(uap, a4), - SCARG(&margs, a4)); + (struct msqid_ds *) SCARG(&margs, a4)); return compat_10_sys_msgsys(p, &margs, retval); case IBCS2_IPC_RMID: return compat_10_sys_msgsys(p, &margs, retval); @@ -200,10 +206,16 @@ struct ibcs2_sem { u_short semzcnt; }; +static void cvt_semid2isemid __P((struct semid_ds *, struct ibcs2_semid_ds *)); +static void cvt_isemid2semid __P((struct ibcs2_semid_ds *, struct semid_ds *)); +#ifdef notdef +static void cvt_sem2isem __P((struct sem *, struct ibcs2_sem *)); +static void cvt_isem2sem __P((struct ibcs2_sem *, struct sem *)); + static void cvt_sem2isem(bp, ibp) -struct sem *bp; -struct ibcs2_sem *ibp; + struct sem *bp; + struct ibcs2_sem *ibp; { ibp->semval = bp->semval; ibp->sempid = bp->sempid; @@ -214,8 +226,8 @@ struct ibcs2_sem *ibp; static void cvt_isem2sem(ibp, bp) -struct ibcs2_sem *ibp; -struct sem *bp; + struct ibcs2_sem *ibp; + struct sem *bp; { bp->semval = ibp->semval; bp->sempid = ibp->sempid; @@ -223,11 +235,12 @@ struct sem *bp; bp->semzcnt = ibp->semzcnt; return; } +#endif static void cvt_semid2isemid(bp, ibp) -struct semid_ds *bp; -struct ibcs2_semid_ds *ibp; + struct semid_ds *bp; + struct ibcs2_semid_ds *ibp; { ibp->sem_perm = bp->sem_perm; ibp->sem_base = (struct ibcs2_sem *)bp->sem_base; @@ -239,8 +252,8 @@ struct ibcs2_semid_ds *ibp; static void cvt_isemid2semid(ibp, bp) -struct ibcs2_semid_ds *ibp; -struct semid_ds *bp; + struct ibcs2_semid_ds *ibp; + struct semid_ds *bp; { bp->sem_perm = ibp->sem_perm; bp->sem_base = (struct sem *)ibp->sem_base; @@ -337,10 +350,13 @@ struct ibcs2_shmid_ds { ibcs2_time_t shm_ctime; }; +static void cvt_shmid2ishmid __P((struct shmid_ds *, struct ibcs2_shmid_ds *)); +static void cvt_ishmid2shmid __P((struct ibcs2_shmid_ds *, struct shmid_ds *)); + static void cvt_shmid2ishmid(bp, ibp) -struct shmid_ds *bp; -struct ibcs2_shmid_ds *ibp; + struct shmid_ds *bp; + struct ibcs2_shmid_ds *ibp; { ibp->shm_perm = bp->shm_perm; ibp->shm_segsz = bp->shm_segsz; @@ -356,8 +372,8 @@ struct ibcs2_shmid_ds *ibp; static void cvt_ishmid2shmid(ibp, bp) -struct ibcs2_shmid_ds *ibp; -struct shmid_ds *bp; + struct ibcs2_shmid_ds *ibp; + struct shmid_ds *bp; { bp->shm_perm = ibp->shm_perm; bp->shm_segsz = ibp->shm_segsz; diff --git a/sys/compat/ibcs2/ibcs2_misc.c b/sys/compat/ibcs2/ibcs2_misc.c index 6641a436463..0b7255b368c 100644 --- a/sys/compat/ibcs2/ibcs2_misc.c +++ b/sys/compat/ibcs2/ibcs2_misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ibcs2_misc.c,v 1.14 1996/01/07 06:11:13 mycroft Exp $ */ +/* $NetBSD: ibcs2_misc.c,v 1.15 1996/05/03 17:05:25 christos Exp $ */ /* * Copyright (c) 1994, 1995 Scott Bartram @@ -114,9 +114,11 @@ ibcs2_sys_ulimit(p, v, retval) syscallarg(int) cmd; syscallarg(int) newlimit; } */ *uap = v; +#ifdef notyet int error; struct rlimit rl; struct sys_setrlimit_args sra; +#endif #define IBCS2_GETFSIZE 1 #define IBCS2_SETFSIZE 2 #define IBCS2_GETPSIZE 3 @@ -163,7 +165,7 @@ ibcs2_sys_waitsys(p, v, retval) syscallarg(int) a2; syscallarg(int) a3; } */ *uap = v; - int error, status; + int error; struct sys_wait4_args w4; #define WAITPID_EFLAGS 0x8c4 /* OF, SF, ZF, PF */ @@ -246,6 +248,7 @@ ibcs2_sys_mount(p, v, retval) void *v; register_t *retval; { +#ifdef notyet struct ibcs2_sys_mount_args /* { syscallarg(char *) special; syscallarg(char *) dir; @@ -254,7 +257,6 @@ ibcs2_sys_mount(p, v, retval) syscallarg(char *) data; syscallarg(int) len; } */ *uap = v; -#ifdef notyet int oflags = SCARG(uap, flags), nflags, error; char fsname[MFSNAMELEN]; @@ -467,7 +469,7 @@ ibcs2_sys_read(p, v, retval) u_long *cookiebuf, *cookie; int ncookies; - if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) { + if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0) { if (error == EINVAL) return sys_read(p, uap, retval); else @@ -499,8 +501,9 @@ again: * First we read into the malloc'ed buffer, then * we massage it into user space, one record at a time. */ - if (error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, cookiebuf, - ncookies)) { + error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, cookiebuf, + ncookies); + if (error) { DPRINTF(("VOP_READDIR failed: %d\n", error)); goto out; } @@ -536,7 +539,8 @@ again: idb.ino = (bdp->d_fileno > 0xfffe) ? 0xfffe : bdp->d_fileno; (void)copystr(bdp->d_name, idb.name, 14, &size); bzero(idb.name + size, 14 - size); - if (error = copyout(&idb, outp, sizeof(struct ibcs2_direct))) + error = copyout(&idb, outp, sizeof(struct ibcs2_direct)); + if (error) goto out; /* advance past this real entry */ off = *cookie++; /* each entry points to the next */ @@ -596,7 +600,7 @@ ibcs2_sys_getgroups(p, v, retval) syscallarg(ibcs2_gid_t *) gidset; } */ *uap = v; int error, i; - ibcs2_gid_t igid, *iset; + ibcs2_gid_t *iset = NULL; struct sys_getgroups_args sa; gid_t *gp; caddr_t sg = stackgap_init(p->p_emul); @@ -608,7 +612,7 @@ ibcs2_sys_getgroups(p, v, retval) iset = stackgap_alloc(&sg, SCARG(uap, gidsetsize) * sizeof(ibcs2_gid_t)); } - if (error = sys_getgroups(p, &sa, retval)) + if ((error = sys_getgroups(p, &sa, retval)) != 0) return error; for (i = 0, gp = SCARG(&sa, gidset); i < retval[0]; i++) iset[i] = (ibcs2_gid_t)*gp++; @@ -630,7 +634,7 @@ ibcs2_sys_setgroups(p, v, retval) syscallarg(ibcs2_gid_t *) gidset; } */ *uap = v; int error, i; - ibcs2_gid_t igid, *iset; + ibcs2_gid_t *iset; struct sys_setgroups_args sa; gid_t *gp; caddr_t sg = stackgap_init(p->p_emul); @@ -641,9 +645,9 @@ ibcs2_sys_setgroups(p, v, retval) iset = stackgap_alloc(&sg, SCARG(&sa, gidsetsize) * sizeof(ibcs2_gid_t *)); if (SCARG(&sa, gidsetsize)) { - if (error = copyin((caddr_t)SCARG(uap, gidset), (caddr_t)iset, - sizeof(ibcs2_gid_t *) * - SCARG(uap, gidsetsize))) + error = copyin((caddr_t)SCARG(uap, gidset), (caddr_t)iset, + sizeof(ibcs2_gid_t *) * SCARG(uap, gidsetsize)); + if (error) return error; } for (i = 0, gp = SCARG(&sa, gidset); i < SCARG(&sa, gidsetsize); i++) @@ -774,7 +778,7 @@ ibcs2_sys_sysconf(p, v, retval) SCARG(&ga, which) = RLIMIT_NPROC; SCARG(&ga, rlp) = stackgap_alloc(&sg, sizeof(struct rlimit *)); - if (error = sys_getrlimit(p, &ga, retval)) + if ((error = sys_getrlimit(p, &ga, retval)) != 0) return error; *retval = SCARG(&ga, rlp)->rlim_cur; return 0; @@ -794,7 +798,7 @@ ibcs2_sys_sysconf(p, v, retval) SCARG(&ga, which) = RLIMIT_NOFILE; SCARG(&ga, rlp) = stackgap_alloc(&sg, sizeof(struct rlimit *)); - if (error = sys_getrlimit(p, &ga, retval)) + if ((error = sys_getrlimit(p, &ga, retval)) != 0) return error; *retval = SCARG(&ga, rlp)->rlim_cur; return 0; @@ -832,7 +836,7 @@ ibcs2_sys_sysconf(p, v, retval) SCARG(&sa, oldlenp) = &len; SCARG(&sa, new) = NULL; SCARG(&sa, newlen) = 0; - if (error = sys___sysctl(p, &sa, retval)) + if ((error = sys___sysctl(p, &sa, retval)) != 0) return error; *retval = value; return 0; @@ -876,12 +880,14 @@ ibcs2_sys_getmsg(p, v, retval) void *v; register_t *retval; { +#ifdef notyet struct ibcs2_sys_getmsg_args /* { syscallarg(int) fd; syscallarg(struct ibcs2_stropts *) ctl; syscallarg(struct ibcs2_stropts *) dat; syscallarg(int *) flags; } */ *uap = v; +#endif return 0; } @@ -892,12 +898,14 @@ ibcs2_sys_putmsg(p, v, retval) void *v; register_t *retval; { +#ifdef notyet struct ibcs2_sys_putmsg_args /* { syscallarg(int) fd; syscallarg(struct ibcs2_stropts *) ctl; syscallarg(struct ibcs2_stropts *) dat; syscallarg(int) flags; } */ *uap = v; +#endif return 0; } @@ -956,11 +964,12 @@ ibcs2_sys_stime(p, v, retval) SCARG(&sa, tv) = stackgap_alloc(&sg, sizeof(*SCARG(&sa, tv))); SCARG(&sa, tzp) = NULL; - if (error = copyin((caddr_t)SCARG(uap, timep), - &(SCARG(&sa, tv)->tv_sec), sizeof(long))) + error = copyin((caddr_t)SCARG(uap, timep), + &(SCARG(&sa, tv)->tv_sec), sizeof(long)); + if (error) return error; SCARG(&sa, tv)->tv_usec = 0; - if (error = sys_settimeofday(p, &sa, retval)) + if ((error = sys_settimeofday(p, &sa, retval)) != 0) return EPERM; return 0; } @@ -985,8 +994,9 @@ ibcs2_sys_utime(p, v, retval) if (SCARG(uap, buf)) { struct ibcs2_utimbuf ubuf; - if (error = copyin((caddr_t)SCARG(uap, buf), (caddr_t)&ubuf, - sizeof(ubuf))) + error = copyin((caddr_t)SCARG(uap, buf), (caddr_t)&ubuf, + sizeof(ubuf)); + if (error) return error; SCARG(&sa, tptr) = stackgap_alloc(&sg, 2 * sizeof(struct timeval *)); @@ -1010,13 +1020,13 @@ ibcs2_sys_nice(p, v, retval) struct ibcs2_sys_nice_args /* { syscallarg(int) incr; } */ *uap = v; - int error, cur_nice = p->p_nice; + int error; struct sys_setpriority_args sa; SCARG(&sa, which) = PRIO_PROCESS; SCARG(&sa, who) = 0; SCARG(&sa, prio) = p->p_nice + SCARG(uap, incr); - if (error = sys_setpriority(p, &sa, retval)) + if ((error = sys_setpriority(p, &sa, retval)) != 0) return EPERM; *retval = p->p_nice; return 0; @@ -1091,7 +1101,7 @@ ibcs2_sys_plock(p, v, retval) #define IBCS2_DATALOCK 4 - if (error = suser(p->p_ucred, &p->p_acflag)) + if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) return EPERM; switch(SCARG(uap, cmd)) { case IBCS2_UNLOCK: @@ -1135,7 +1145,7 @@ ibcs2_sys_uadmin(p, v, retval) #define SCO_AD_GETCMAJ 1 /* XXX: is this the right place for this call? */ - if (error = suser(p->p_ucred, &p->p_acflag)) + if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) return (error); switch(SCARG(uap, cmd)) { @@ -1191,11 +1201,13 @@ ibcs2_sys_poll(p, v, retval) void *v; register_t *retval; { +#ifdef notyet struct ibcs2_sys_poll_args /* { syscallarg(struct ibcs2_pollfd *) fds; syscallarg(long) nfds; syscallarg(int) timeout; } */ *uap = v; +#endif return EINVAL; /* XXX - TODO */ } @@ -1216,7 +1228,7 @@ xenix_sys_rdchk(p, v, retval) SCARG(&sa, fd) = SCARG(uap, fd); SCARG(&sa, com) = FIONREAD; SCARG(&sa, data) = stackgap_alloc(&sg, sizeof(int)); - if (error = sys_ioctl(p, &sa, retval)) + if ((error = sys_ioctl(p, &sa, retval)) != 0) return error; *retval = (*((int*)SCARG(&sa, data))) ? 1 : 0; return 0; @@ -1246,9 +1258,11 @@ xenix_sys_nap(p, v, retval) void *v; register_t *retval; { +#ifdef notyet struct xenix_sys_nap_args /* { syscallarg(int) millisec; } */ *uap = v; +#endif return ENOSYS; } diff --git a/sys/compat/ibcs2/ibcs2_signal.c b/sys/compat/ibcs2/ibcs2_signal.c index 9a024767192..5ff7ddfc5cd 100644 --- a/sys/compat/ibcs2/ibcs2_signal.c +++ b/sys/compat/ibcs2/ibcs2_signal.c @@ -1,4 +1,4 @@ -/* $NetBSD: ibcs2_signal.c,v 1.7 1995/10/07 06:26:52 mycroft Exp $ */ +/* $NetBSD: ibcs2_signal.c,v 1.8 1996/05/03 17:05:27 christos Exp $ */ /* * Copyright (c) 1995 Scott Bartram @@ -125,6 +125,12 @@ int ibcs2_to_bsd_sig[] = { 0, /* 31 */ }; +void ibcs2_to_bsd_sigset __P((const ibcs2_sigset_t *, sigset_t *)); +void bsd_to_ibcs2_sigset __P((const sigset_t *, ibcs2_sigset_t *)); +void ibcs2_to_bsd_sigaction __P((struct ibcs2_sigaction *, + struct sigaction *)); +void bsd_to_ibcs2_sigaction __P((struct sigaction *, struct ibcs2_sigaction *)); + void ibcs2_to_bsd_sigset(iss, bss) const ibcs2_sigset_t *iss; diff --git a/sys/compat/ibcs2/ibcs2_signal.h b/sys/compat/ibcs2/ibcs2_signal.h index 2858688d79d..44cc6bf8a27 100644 --- a/sys/compat/ibcs2/ibcs2_signal.h +++ b/sys/compat/ibcs2/ibcs2_signal.h @@ -1,4 +1,4 @@ -/* $NetBSD: ibcs2_signal.h,v 1.7 1995/08/14 02:26:01 mycroft Exp $ */ +/* $NetBSD: ibcs2_signal.h,v 1.8 1996/05/03 17:05:28 christos Exp $ */ /* * Copyright (c) 1994, 1995 Scott Bartram @@ -79,10 +79,10 @@ #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_DFL (void(*) __P((int))) 0 +#define IBCS2_SIG_ERR (void(*) __P((int))) -1 +#define IBCS2_SIG_IGN (void(*) __P((int))) 1 +#define IBCS2_SIG_HOLD (void(*) __P((int))) 2 #define IBCS2_SIG_SETMASK 0 #define IBCS2_SIG_BLOCK 1 diff --git a/sys/compat/ibcs2/ibcs2_socksys.c b/sys/compat/ibcs2/ibcs2_socksys.c index 1fb3b8193b0..1004e840b45 100644 --- a/sys/compat/ibcs2/ibcs2_socksys.c +++ b/sys/compat/ibcs2/ibcs2_socksys.c @@ -1,3 +1,5 @@ +/* $NetBSD: ibcs2_socksys.c,v 1.4 1996/05/03 17:05:29 christos Exp $ */ + /* * Copyright (c) 1994, 1995 Scott Bartram * Copyright (c) 1994 Arne H Juul @@ -24,6 +26,7 @@ */ #include +#include #include #include #include @@ -32,8 +35,12 @@ #include #include #include +#include #include + +#include + #include #include @@ -48,13 +55,12 @@ struct ibcs2_socksys_args { }; int -ibcs2_socksys(p, uap, retval) +ibcs2_socksys(p, v, retval) register struct proc *p; - register struct ibcs2_socksys_args *uap; + void *v; register_t *retval; { - register struct filedesc *fdp = p->p_fd; - register struct file *fp; + register struct ibcs2_socksys_args *uap = v; int error; int realargs[7]; /* 1 for command, 6 for recvfrom */ @@ -64,7 +70,8 @@ ibcs2_socksys(p, uap, retval) * The others are (and should be) only legal on sockets. */ - if (error = copyin(uap->argsp, (caddr_t)realargs, sizeof(realargs))) + error = copyin(uap->argsp, (caddr_t)realargs, sizeof(realargs)); + if (error) return error; DPRINTF(("ibcs2_socksys: %08x %08x %08x %08x %08x %08x %08x\n", realargs[0], realargs[1], realargs[2], realargs[3], diff --git a/sys/compat/ibcs2/ibcs2_socksys.h b/sys/compat/ibcs2/ibcs2_socksys.h index bc89180b44b..fc2ccb3cdc2 100644 --- a/sys/compat/ibcs2/ibcs2_socksys.h +++ b/sys/compat/ibcs2/ibcs2_socksys.h @@ -1,3 +1,5 @@ +/* $NetBSD: ibcs2_socksys.h,v 1.2 1996/05/03 17:05:30 christos Exp $ */ + /* * Copyright (c) 1994, 1995 Scott Bartram * Copyright (c) 1994 Arne H Juul @@ -115,4 +117,6 @@ struct socknewproto { int flags; }; +int ibcs2_socksys __P((struct proc *, void *, register_t *)); + #endif /* _IBCS2_SOCKSYS_H */ diff --git a/sys/compat/ibcs2/ibcs2_stat.c b/sys/compat/ibcs2/ibcs2_stat.c index 4e4e21437a6..dc54a096745 100644 --- a/sys/compat/ibcs2/ibcs2_stat.c +++ b/sys/compat/ibcs2/ibcs2_stat.c @@ -1,3 +1,4 @@ +/* $NetBSD: ibcs2_stat.c,v 1.5 1996/05/03 17:05:32 christos Exp $ */ /* * Copyright (c) 1995 Scott Bartram * All rights reserved. @@ -51,6 +52,8 @@ #include #include +static void bsd_stat2ibcs_stat __P((struct ostat *, struct ibcs2_stat *)); +static int cvt_statfs __P((struct statfs *, caddr_t, int)); static void bsd_stat2ibcs_stat(st, st4) @@ -112,12 +115,12 @@ ibcs2_sys_statfs(p, v, retval) IBCS2_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); - if (error = namei(&nd)) + if ((error = namei(&nd)) != 0) return (error); mp = nd.ni_vp->v_mount; sp = &mp->mnt_stat; vrele(nd.ni_vp); - if (error = VFS_STATFS(mp, sp, p)) + if ((error = VFS_STATFS(mp, sp, p)) != 0) return (error); sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; return cvt_statfs(sp, (caddr_t)SCARG(uap, buf), SCARG(uap, len)); @@ -140,11 +143,11 @@ ibcs2_sys_fstatfs(p, v, retval) register struct statfs *sp; int error; - if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) + if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0) return (error); mp = ((struct vnode *)fp->f_data)->v_mount; sp = &mp->mnt_stat; - if (error = VFS_STATFS(mp, sp, p)) + if ((error = VFS_STATFS(mp, sp, p)) != 0) return (error); sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; return cvt_statfs(sp, (caddr_t)SCARG(uap, buf), SCARG(uap, len)); @@ -169,9 +172,9 @@ ibcs2_sys_stat(p, v, retval) IBCS2_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); SCARG(&cup, path) = SCARG(uap, path); SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(st)); - if (error = compat_43_sys_stat(p, &cup, retval)) + if ((error = compat_43_sys_stat(p, &cup, retval)) != 0) return error; - if (error = copyin(SCARG(&cup, ub), &st, sizeof(st))) + if ((error = copyin(SCARG(&cup, ub), &st, sizeof(st))) != 0) return error; bsd_stat2ibcs_stat(&st, &ibcs2_st); return copyout((caddr_t)&ibcs2_st, (caddr_t)SCARG(uap, st), @@ -197,9 +200,9 @@ ibcs2_sys_lstat(p, v, retval) IBCS2_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); SCARG(&cup, path) = SCARG(uap, path); SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(st)); - if (error = compat_43_sys_lstat(p, &cup, retval)) + if ((error = compat_43_sys_lstat(p, &cup, retval)) != 0) return error; - if (error = copyin(SCARG(&cup, ub), &st, sizeof(st))) + if ((error = copyin(SCARG(&cup, ub), &st, sizeof(st))) != 0) return error; bsd_stat2ibcs_stat(&st, &ibcs2_st); return copyout((caddr_t)&ibcs2_st, (caddr_t)SCARG(uap, st), @@ -224,9 +227,9 @@ ibcs2_sys_fstat(p, v, retval) SCARG(&cup, fd) = SCARG(uap, fd); SCARG(&cup, sb) = stackgap_alloc(&sg, sizeof(st)); - if (error = compat_43_sys_fstat(p, &cup, retval)) + if ((error = compat_43_sys_fstat(p, &cup, retval)) != 0) return error; - if (error = copyin(SCARG(&cup, sb), &st, sizeof(st))) + if ((error = copyin(SCARG(&cup, sb), &st, sizeof(st))) != 0) return error; bsd_stat2ibcs_stat(&st, &ibcs2_st); return copyout((caddr_t)&ibcs2_st, (caddr_t)SCARG(uap, st), diff --git a/sys/compat/ibcs2/ibcs2_stropts.h b/sys/compat/ibcs2/ibcs2_stropts.h index 4d26e735826..a12df4a28a5 100644 --- a/sys/compat/ibcs2/ibcs2_stropts.h +++ b/sys/compat/ibcs2/ibcs2_stropts.h @@ -1,3 +1,5 @@ +/* $NetBSD: ibcs2_stropts.h,v 1.2 1996/05/03 17:05:33 christos Exp $ */ + /* * ibcs2_stropts.h * Copyright (c) 1995 Scott Bartram diff --git a/sys/compat/ibcs2/ibcs2_timeb.h b/sys/compat/ibcs2/ibcs2_timeb.h index d85202d9172..26650e2a946 100644 --- a/sys/compat/ibcs2/ibcs2_timeb.h +++ b/sys/compat/ibcs2/ibcs2_timeb.h @@ -1,3 +1,5 @@ +/* $NetBSD: ibcs2_timeb.h,v 1.2 1996/05/03 17:05:34 christos Exp $ */ + /* * Copyright (c) 1995 Scott Bartram * All rights reserved. diff --git a/sys/compat/ibcs2/ibcs2_utime.h b/sys/compat/ibcs2/ibcs2_utime.h index 02d83150a27..1dd7fdfed6c 100644 --- a/sys/compat/ibcs2/ibcs2_utime.h +++ b/sys/compat/ibcs2/ibcs2_utime.h @@ -1,3 +1,5 @@ +/* $NetBSD: ibcs2_utime.h,v 1.2 1996/05/03 17:05:35 christos Exp $ */ + /* * Copyright (c) 1995 Scott Bartram * All rights reserved. diff --git a/sys/compat/svr4/svr4_sockio.c b/sys/compat/svr4/svr4_sockio.c index 21a74af1c72..ed97e86afae 100644 --- a/sys/compat/svr4/svr4_sockio.c +++ b/sys/compat/svr4/svr4_sockio.c @@ -1,5 +1,5 @@ -/* $OpenBSD: svr4_sockio.c,v 1.5 1996/05/02 13:06:53 deraadt Exp $ */ -/* $NetBSD: svr4_sockio.c,v 1.9 1996/04/22 01:17:33 christos Exp $ */ +/* $OpenBSD: svr4_sockio.c,v 1.6 1996/05/07 08:49:20 deraadt Exp $ */ +/* $NetBSD: svr4_sockio.c,v 1.10 1996/05/03 17:09:15 christos Exp $ */ /* * Copyright (c) 1995 Christos Zoulas @@ -132,7 +132,9 @@ svr4_sock_ioctl(fp, p, retval, fd, cmd, data) if ((error = copyin(data, &sr, sizeof(sr))) != 0) return error; - (void) strcpy(br.ifr_name, sr.svr4_ifr_name); + (void) strncpy(br.ifr_name, sr.svr4_ifr_name, + sizeof(br.ifr_name)); + if ((error = (*ctl)(fp, SIOCGIFFLAGS, (caddr_t) &br, p)) != 0) { DPRINTF(("SIOCGIFFLAGS %s: error %d\n", -- 2.20.1