--- //depot/vendor/freebsd/src/sys/alpha/linux/syscalls.master 2004/06/04 13:55:42 +++ //depot/projects/smpng/sys/alpha/linux/syscalls.master 2004/08/09 18:35:43 @@ -133,7 +133,7 @@ 89 STD { int linux_getdtablesize(void); } 90 MNOPROTO { int dup2(u_int from, u_int to); } 91 STD { int linux_newfstat(l_uint fd, struct l_newstat *buf); } -92 STD { int linux_fcntl(l_uint fd, l_uint cmd, l_ulong arg); } +92 MSTD { int linux_fcntl(l_uint fd, l_uint cmd, l_ulong arg); } 93 STD { int osf1_select(u_int nd, fd_set *in, fd_set *ou, \ fd_set *ex, struct timeval *tv); } 94 NOPROTO { int poll(struct pollfd*, unsigned int nfds, long timeout); } --- //depot/vendor/freebsd/src/sys/alpha/osf1/osf1_misc.c 2004/07/26 07:25:53 +++ //depot/projects/smpng/sys/alpha/osf1/osf1_misc.c 2004/08/09 18:35:43 @@ -758,19 +758,14 @@ { int error; long tmp; - caddr_t oarg, sg; - struct fcntl_args a; struct osf1_flock osf_flock; struct flock bsd_flock; - struct flock *nflock; error = 0; switch (uap->cmd) { case F_SETFL: - a.fd = uap->fd; - a.cmd = F_SETFL; /* need to translate flags here */ tmp = 0; if ((long)uap->arg & OSF1_FNONBLOCK) @@ -791,8 +786,7 @@ tmp |= FNDELAY; if ((long)uap->arg & OSF1_FSYNC) tmp |= FFSYNC; - a.arg = tmp; - error = fcntl(td, &a); + error = kern_fcntl(td, uap->fd, F_SETFL, tmp); break; case F_SETLK: @@ -803,20 +797,15 @@ * the BSD one, but all else is the same. We must * reorder the one we've gotten so that flock() groks it. */ - if ((error = copyin(uap->arg, &osf_flock, sizeof(osf_flock)))) - return error; + error = copyin(uap->arg, &osf_flock, sizeof(osf_flock)); + if (error) + return (error); bsd_flock.l_type = osf_flock.l_type; bsd_flock.l_whence = osf_flock.l_whence; bsd_flock.l_start = osf_flock.l_start; bsd_flock.l_len = osf_flock.l_len; bsd_flock.l_pid = osf_flock.l_pid; - sg = stackgap_init(); - nflock = stackgap_alloc(&sg, sizeof(struct flock)); - if ((error = copyout(&bsd_flock, nflock, sizeof(bsd_flock))) != 0) - return error; - oarg = uap->arg; - uap->arg = nflock; - error = fcntl(td, (struct fcntl_args *) uap); + error = kern_fcntl(td, uap->fd, uap->cmd, (intptr_t)&bsd_flock); /* if (error) { printf("fcntl called with cmd=%d, args=0x%lx\n returns %d\n",uap->cmd,(long)uap->arg,error); printf("bsd_flock.l_type = 0x%x\n", bsd_flock.l_type); @@ -827,14 +816,17 @@ } */ if ((uap->cmd == F_GETLK) && !error) { + /* + * XXX: Why are we hardcoding F_UNLCK here instead of + * copying the structure members from bsd_flock? + */ osf_flock.l_type = F_UNLCK; - if ((error = copyout(&osf_flock, oarg, - sizeof(osf_flock)))) - return error; + error = copyout(&osf_flock, uap->arg, + sizeof(osf_flock)); } break; default: - error = fcntl(td, (struct fcntl_args *) uap); + error = kern_fcntl(td, uap->fd, uap->cmd, uap->arg); if ((uap->cmd == OSF1_F_GETFL) && !error ) { tmp = td->td_retval[0] & O_ACCMODE; --- //depot/vendor/freebsd/src/sys/alpha/osf1/syscalls.master 2004/03/15 22:45:34 +++ //depot/projects/smpng/sys/alpha/osf1/syscalls.master 2004/08/09 18:35:43 @@ -135,7 +135,7 @@ 89 MNOPROTO { int getdtablesize(void); } 90 MNOPROTO { int dup2(u_int from, u_int to); } 91 STD { int osf1_fstat(int fd, void *sb); } -92 STD { int osf1_fcntl(int fd, int cmd, void *arg); } +92 MSTD { int osf1_fcntl(int fd, int cmd, void *arg); } 93 STD { int osf1_select(u_int nd, fd_set *in, fd_set *ou, \ fd_set *ex, struct timeval *tv); } 94 NOPROTO { int poll(struct pollfd *fds, u_int nfds, int timeout); } --- //depot/vendor/freebsd/src/sys/compat/linux/linux_socket.c 2004/07/18 09:30:37 +++ //depot/projects/smpng/sys/compat/linux/linux_socket.c 2004/08/09 18:35:43 @@ -663,12 +663,7 @@ struct close_args /* { int fd; } */ c_args; - struct fcntl_args /* { - int fd; - int cmd; - long arg; - } */ f_args; - int error; + int error, fd; if ((error = copyin(args, &linux_args, sizeof(linux_args)))) return (error); @@ -694,11 +689,9 @@ * accepted one, so we must clear the flags in the new descriptor. * Ignore any errors, because we already have an open fd. */ - f_args.fd = td->td_retval[0]; - f_args.cmd = F_SETFL; - f_args.arg = 0; - (void)fcntl(td, &f_args); - td->td_retval[0] = f_args.fd; + fd = td->td_retval[0]; + (void)kern_fcntl(td, fd, F_SETFL, 0); + td->td_retval[0] = fd; return (0); } --- //depot/vendor/freebsd/src/sys/compat/svr4/svr4_fcntl.c 2003/06/22 08:45:25 +++ //depot/projects/smpng/sys/compat/svr4/svr4_fcntl.c 2004/08/09 18:35:43 @@ -580,29 +580,24 @@ register struct thread *td; struct svr4_sys_fcntl_args *uap; { - int error; - struct fcntl_args fa; - int *retval; + int cmd, error, *retval; retval = td->td_retval; - fa.fd = uap->fd; - fa.cmd = svr4_to_bsd_cmd(uap->cmd); + cmd = svr4_to_bsd_cmd(uap->cmd); - switch (fa.cmd) { + switch (cmd) { case F_DUPFD: case F_GETFD: case F_SETFD: - fa.arg = (long) uap->arg; - return fcntl(td, &fa); + return (kern_fcntl(td, uap->fd, cmd, uap->arg)); case F_GETFL: - fa.arg = (long) uap->arg; - error = fcntl(td, &fa); + error = kern_fcntl(td, uap->fd, cmd, uap->arg); if (error) - return error; + return (error); *retval = bsd_to_svr4_flags(*retval); - return error; + return (error); case F_SETFL: { @@ -610,55 +605,42 @@ * we must save the O_ASYNC flag, as that is * handled by ioctl(_, I_SETSIG, _) emulation. */ - long cmd; int flags; DPRINTF(("Setting flags %p\n", uap->arg)); - cmd = fa.cmd; /* save it for a while */ - fa.cmd = F_GETFL; - if ((error = fcntl(td, &fa)) != 0) - return error; + error = kern_fcntl(td, uap->fd, F_GETFL, 0); + if (error) + return (error); flags = *retval; flags &= O_ASYNC; flags |= svr4_to_bsd_flags((u_long) uap->arg); - fa.cmd = cmd; - fa.arg = (long) flags; - return fcntl(td, &fa); + return (kern_fcntl(td, uap->fd, F_SETFL, flags); } case F_GETLK: case F_SETLK: case F_SETLKW: { - struct svr4_flock ifl; - struct flock *flp, fl; - caddr_t sg = stackgap_init(); + struct svr4_flock ifl; + struct flock fl; flp = stackgap_alloc(&sg, sizeof(struct flock)); fa.arg = (long) flp; - error = copyin(uap->arg, &ifl, sizeof ifl); + error = copyin(uap->arg, &ifl, sizeof (ifl)); if (error) - return error; + return (error); svr4_to_bsd_flock(&ifl, &fl); - error = copyout(&fl, flp, sizeof fl); - if (error) - return error; - - error = fcntl(td, &fa); - if (error || fa.cmd != F_GETLK) - return error; + error = kern_fcntl(td, uap->fd, cmd, (intptr_t)&fl); + if (error || cmd != F_GETLK) + return (error); - error = copyin(flp, &fl, sizeof fl); - if (error) - return error; - bsd_to_svr4_flock(&fl, &ifl); - return copyout(&ifl, uap->arg, sizeof ifl); + return (copyout(&ifl, uap->arg, sizeof (ifl))); } case -1: switch (uap->cmd) { @@ -692,36 +674,36 @@ case SVR4_F_SETLK64: case SVR4_F_SETLKW64: { - struct svr4_flock64 ifl; - struct flock *flp, fl; - caddr_t sg = stackgap_init(); + struct svr4_flock64 ifl; + struct flock fl; - flp = stackgap_alloc(&sg, sizeof(struct flock)); - fa.arg = (long) flp; - + switch (uap->cmd) { + case SVR4_F_GETLK64: + cmd = F_GETLK; + break; + case SVR4_F_SETLK64: + cmd = F_SETLK; + break; + case SVR4_F_SETLKW64: + cmd = F_SETLKW; + break; + } error = copyin(uap->arg, &ifl, - sizeof ifl); + sizeof (ifl)); if (error) - return error; + return (error); svr4_to_bsd_flock64(&ifl, &fl); - error = copyout(&fl, flp, sizeof fl); - if (error) - return error; + error = kern_fcntl(td, uap->fd, cmd, + (intptr_t)&fl); + if (error || cmd != F_GETLK) + return (error); - error = fcntl(td, &fa); - if (error || fa.cmd != F_GETLK) - return error; - - error = copyin(flp, &fl, sizeof fl); - if (error) - return error; - bsd_to_svr4_flock64(&fl, &ifl); - return copyout(&ifl, uap->arg, - sizeof ifl); + return (copyout(&ifl, uap->arg, + sizeof (ifl))); } case SVR4_F_FREESP64: --- //depot/vendor/freebsd/src/sys/compat/svr4/svr4_stream.c 2004/07/10 15:45:28 +++ //depot/projects/smpng/sys/compat/svr4/svr4_stream.c 2004/08/09 18:35:43 @@ -1473,7 +1473,6 @@ * We alse have to fix the O_ASYNC fcntl bit, so the * process will get SIGPOLLs. */ - struct fcntl_args fa; int error; register_t oflags, flags; struct svr4_strm *st = svr4_stream_get(fp); @@ -1483,10 +1482,9 @@ return EINVAL; } /* get old status flags */ - fa.fd = fd; - fa.cmd = F_GETFL; - if ((error = fcntl(td, &fa)) != 0) - return error; + error = kern_fcntl(td, fd, F_GETFL, 0); + if (error) + return (error); oflags = td->td_retval[0]; @@ -1512,19 +1510,15 @@ /* set the new flags, if changed */ if (flags != oflags) { - fa.cmd = F_SETFL; - fa.arg = (long) flags; - if ((error = fcntl(td, &fa)) != 0) - return error; + error = kern_fcntl(td, fd, F_SETFL, flags); + if (error) + return (error); flags = td->td_retval[0]; } /* set up SIGIO receiver if needed */ - if (dat != NULL) { - fa.cmd = F_SETOWN; - fa.arg = (long) td->td_proc->p_pid; - return fcntl(td, &fa); - } + if (dat != NULL) + return (kern_fcntl(td, fd, F_SETOWN, td->td_proc->p_pid); return 0; } --- //depot/vendor/freebsd/src/sys/compat/svr4/syscalls.master 2004/02/06 20:10:30 +++ //depot/projects/smpng/sys/compat/svr4/syscalls.master 2004/08/09 18:35:43 @@ -100,7 +100,7 @@ 59 STD { int svr4_sys_execve(char *path, char **argp, char **envp); } 60 MNOPROTO { int umask(int newmask); } 61 NOPROTO { int chroot(char *path); } -62 STD { int svr4_sys_fcntl(int fd, int cmd, char *arg); } +62 MSTD { int svr4_sys_fcntl(int fd, int cmd, char *arg); } 63 MSTD { int svr4_sys_ulimit(int cmd, long newlimit); } 64 UNIMPL reserved 65 UNIMPL reserved --- //depot/vendor/freebsd/src/sys/i386/ibcs2/ibcs2_fcntl.c 2003/06/02 06:50:35 +++ //depot/projects/smpng/sys/i386/ibcs2/ibcs2_fcntl.c 2004/08/09 18:35:43 @@ -247,91 +247,59 @@ struct ibcs2_fcntl_args *uap; { int error; - struct fcntl_args fa; - struct flock *flp; + struct flock fl; struct ibcs2_flock ifl; switch(uap->cmd) { case IBCS2_F_DUPFD: - fa.fd = uap->fd; - fa.cmd = F_DUPFD; - fa.arg = (/* XXX */ int)uap->arg; - return fcntl(td, &fa); + return (kern_fcntl(td, uap->fd, F_DUPFD, uap->arg)); case IBCS2_F_GETFD: - fa.fd = uap->fd; - fa.cmd = F_GETFD; - fa.arg = (/* XXX */ int)uap->arg; - return fcntl(td, &fa); + return (kern_fcntl(td, uap->fd, F_GETFD, uap->arg)); case IBCS2_F_SETFD: - fa.fd = uap->fd; - fa.cmd = F_SETFD; - fa.arg = (/* XXX */ int)uap->arg; - return fcntl(td, &fa); + return (kern_fcntl(td, uap->fd, F_SETFD, uap->arg)); case IBCS2_F_GETFL: - fa.fd = uap->fd; - fa.cmd = F_GETFL; - fa.arg = (/* XXX */ int)uap->arg; - error = fcntl(td, &fa); + error = kern_fcntl(td, uap->fd, F_GETFL, uap->arg); if (error) return error; td->td_retval[0] = oflags2ioflags(td->td_retval[0]); return error; case IBCS2_F_SETFL: - fa.fd = uap->fd; - fa.cmd = F_SETFL; - fa.arg = (/* XXX */ int) - ioflags2oflags((int)uap->arg); - return fcntl(td, &fa); + return (kern_fcntl(td, uap->fd, F_SETFL, + ioflags2oflags((int)uap->arg))); case IBCS2_F_GETLK: { - caddr_t sg = stackgap_init(); - flp = stackgap_alloc(&sg, sizeof(*flp)); error = copyin((caddr_t)uap->arg, (caddr_t)&ifl, ibcs2_flock_len); if (error) return error; - cvt_iflock2flock(&ifl, flp); - fa.fd = uap->fd; - fa.cmd = F_GETLK; - fa.arg = (/* XXX */ int)flp; - error = fcntl(td, &fa); + cvt_iflock2flock(&ifl, &fl); + error = kern_fcntl(td, uap->fd, F_GETLK, &fl); if (error) return error; - cvt_flock2iflock(flp, &ifl); + cvt_flock2iflock(&fl, &ifl); return copyout((caddr_t)&ifl, (caddr_t)uap->arg, ibcs2_flock_len); } case IBCS2_F_SETLK: { - caddr_t sg = stackgap_init(); - flp = stackgap_alloc(&sg, sizeof(*flp)); error = copyin((caddr_t)uap->arg, (caddr_t)&ifl, ibcs2_flock_len); if (error) return error; - cvt_iflock2flock(&ifl, flp); - fa.fd = uap->fd; - fa.cmd = F_SETLK; - fa.arg = (/* XXX */ int)flp; - - return fcntl(td, &fa); + cvt_iflock2flock(&ifl, &fl); + return (kern_fcntl(td, uap->fd, F_SETLK, &fl)); } case IBCS2_F_SETLKW: { - caddr_t sg = stackgap_init(); - flp = stackgap_alloc(&sg, sizeof(*flp)); error = copyin((caddr_t)uap->arg, (caddr_t)&ifl, ibcs2_flock_len); if (error) return error; - cvt_iflock2flock(&ifl, flp); - fa.fd = uap->fd; - fa.cmd = F_SETLKW; - fa.arg = (/* XXX */ int)flp; - return fcntl(td, &fa); + cvt_iflock2flock(&ifl, &fl); + return (kern_fcntl(td, uap->fd, F_SETLKW, &fl)); } } return ENOSYS; --- //depot/vendor/freebsd/src/sys/i386/ibcs2/syscalls.master 2004/03/28 22:56:34 +++ //depot/projects/smpng/sys/i386/ibcs2/syscalls.master 2004/08/09 18:35:43 @@ -98,7 +98,7 @@ 59 STD { int ibcs2_execve(char *path, char **argp, char **envp); } 60 MNOPROTO { int umask(int newmask); } 61 NOPROTO { int chroot(char *path); } -62 STD { int ibcs2_fcntl(int fd, int cmd, char *arg); } +62 MSTD { int ibcs2_fcntl(int fd, int cmd, char *arg); } 63 MSTD { long ibcs2_ulimit(int cmd, int newlimit); } 64 UNIMPL reserved for unix/pc 65 UNIMPL reserved for unix/pc --- //depot/vendor/freebsd/src/sys/i386/linux/syscalls.master 2004/03/28 21:46:05 +++ //depot/projects/smpng/sys/i386/linux/syscalls.master 2004/08/09 18:35:43 @@ -89,7 +89,7 @@ 52 STD { int linux_umount(char *path, l_int flags); } 53 UNIMPL lock 54 STD { int linux_ioctl(l_uint fd, l_uint cmd, l_ulong arg); } -55 STD { int linux_fcntl(l_uint fd, l_uint cmd, l_ulong arg); } +55 MSTD { int linux_fcntl(l_uint fd, l_uint cmd, l_ulong arg); } 56 UNIMPL mpx 57 MNOPROTO { int setpgid(int pid, int pgid); } 58 UNIMPL ulimit @@ -294,7 +294,7 @@ 218 STD { int linux_mincore(l_ulong start, l_size_t len, u_char *vec); } 219 MNOPROTO { int madvise(void *addr, size_t len, int behav); } 220 STD { int linux_getdents64(l_uint fd, void *dirent, l_uint count); } -221 STD { int linux_fcntl64(l_uint fd, l_uint cmd, l_ulong arg); } +221 MSTD { int linux_fcntl64(l_uint fd, l_uint cmd, l_ulong arg); } 222 UNIMPL 223 UNIMPL 224 UNIMPL linux_gettid