From 1f5621728039a2009fc163d345508d0ee9fae2e9 Mon Sep 17 00:00:00 2001 From: John Dyson Date: Mon, 11 May 1998 03:55:28 +0000 Subject: [PATCH] Fix the futimes/undelete/utrace conflict with other BSD's. Note that the only common usage of utrace (the possible problem with this commit) is with malloc, so this should be a real problem. Add the various NetBSD syscalls that allow full emulation of their development environment. --- sys/kern/init_sysent.c | 23 +-- sys/kern/kern_descrip.c | 52 ++++- sys/kern/syscalls.c | 23 +-- sys/kern/syscalls.master | 27 ++- sys/kern/vfs_extattr.c | 411 ++++++++++++++++++++++++++++++++------- sys/kern/vfs_syscalls.c | 411 ++++++++++++++++++++++++++++++++------- sys/sys/stat.h | 34 +++- sys/sys/syscall-hide.h | 13 +- sys/sys/syscall.h | 17 +- sys/sys/syscall.mk | 15 +- sys/sys/sysproto.h | 48 ++++- sys/sys/vnode.h | 4 +- 12 files changed, 873 insertions(+), 205 deletions(-) diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index 7336ac8d1be8..b07b8809b509 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -2,7 +2,7 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * created from Id: syscalls.master,v 1.48 1998/02/03 17:45:43 bde Exp + * created from Id: syscalls.master,v 1.49 1998/03/28 11:50:01 dufault Exp */ #include "opt_compat.h" @@ -224,8 +224,8 @@ struct sysent sysent[] = { { 6, (sy_call_t *)__sysctl }, /* 202 = __sysctl */ { 2, (sy_call_t *)mlock }, /* 203 = mlock */ { 2, (sy_call_t *)munlock }, /* 204 = munlock */ - { 2, (sy_call_t *)utrace }, /* 205 = utrace */ - { 1, (sy_call_t *)undelete }, /* 206 = undelete */ + { 1, (sy_call_t *)undelete }, /* 205 = undelete */ + { 2, (sy_call_t *)futimes }, /* 206 = futimes */ { 1, (sy_call_t *)getpgid }, /* 207 = getpgid */ { 0, (sy_call_t *)nosys }, /* 208 = newreboot */ { 3, (sy_call_t *)poll }, /* 209 = poll */ @@ -291,15 +291,15 @@ struct sysent sysent[] = { { 0, (sy_call_t *)nosys }, /* 269 = nosys */ { 0, (sy_call_t *)nosys }, /* 270 = nosys */ { 0, (sy_call_t *)nosys }, /* 271 = nosys */ - { 0, (sy_call_t *)nosys }, /* 272 = nosys */ + { 3, (sy_call_t *)getdents }, /* 272 = getdents */ { 0, (sy_call_t *)nosys }, /* 273 = nosys */ - { 0, (sy_call_t *)nosys }, /* 274 = nosys */ - { 0, (sy_call_t *)nosys }, /* 275 = nosys */ - { 0, (sy_call_t *)nosys }, /* 276 = nosys */ - { 0, (sy_call_t *)nosys }, /* 277 = nosys */ - { 0, (sy_call_t *)nosys }, /* 278 = nosys */ - { 0, (sy_call_t *)nosys }, /* 279 = nosys */ - { 0, (sy_call_t *)nosys }, /* 280 = nosys */ + { 2, (sy_call_t *)lchmod }, /* 274 = lchmod */ + { 3, (sy_call_t *)lchown }, /* 275 = netbsd_lchown */ + { 2, (sy_call_t *)lutimes }, /* 276 = lutimes */ + { 3, (sy_call_t *)msync }, /* 277 = netbsd_msync */ + { 2, (sy_call_t *)nstat }, /* 278 = nstat */ + { 2, (sy_call_t *)nfstat }, /* 279 = nfstat */ + { 2, (sy_call_t *)nlstat }, /* 280 = nlstat */ { 0, (sy_call_t *)nosys }, /* 281 = nosys */ { 0, (sy_call_t *)nosys }, /* 282 = nosys */ { 0, (sy_call_t *)nosys }, /* 283 = nosys */ @@ -354,4 +354,5 @@ struct sysent sysent[] = { { 1, (sy_call_t *)sched_get_priority_max }, /* 332 = sched_get_priority_max */ { 1, (sy_call_t *)sched_get_priority_min }, /* 333 = sched_get_priority_min */ { 2, (sy_call_t *)sched_rr_get_interval }, /* 334 = sched_rr_get_interval */ + { 2, (sy_call_t *)utrace }, /* 335 = utrace */ }; diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 50af8967de9f..1e7a19cdaf14 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94 - * $Id: kern_descrip.c,v 1.50 1998/02/06 12:13:22 eivind Exp $ + * $Id: kern_descrip.c,v 1.51 1998/02/15 04:16:59 dyson Exp $ */ #include "opt_compat.h" @@ -493,6 +493,56 @@ fstat(p, uap) return (error); } +/* + * Return status information about a file descriptor. + */ +#ifndef _SYS_SYSPROTO_H_ +struct nfstat_args { + int fd; + struct nstat *sb; +}; +#endif +/* ARGSUSED */ +int +nfstat(p, uap) + struct proc *p; + register struct nfstat_args *uap; +{ + register struct filedesc *fdp = p->p_fd; + register struct file *fp; + struct stat ub; + struct nstat nub; + int error; + + if ((unsigned)uap->fd >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[uap->fd]) == NULL) + return (EBADF); + switch (fp->f_type) { + + case DTYPE_FIFO: + case DTYPE_VNODE: + error = vn_stat((struct vnode *)fp->f_data, &ub, p); + break; + + case DTYPE_SOCKET: + error = soo_stat((struct socket *)fp->f_data, &ub); + break; + + case DTYPE_PIPE: + error = pipe_stat((struct pipe *)fp->f_data, &ub); + break; + + default: + panic("fstat"); + /*NOTREACHED*/ + } + if (error == 0) { + cvtnstat(&ub, &nub); + error = copyout((caddr_t)&nub, (caddr_t)uap->sb, sizeof (nub)); + } + return (error); +} + /* * Return pathconf information about a file descriptor. */ diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c index 5a640914fca3..d295b20ace14 100644 --- a/sys/kern/syscalls.c +++ b/sys/kern/syscalls.c @@ -2,7 +2,7 @@ * System call names. * * DO NOT EDIT-- this file is automatically generated. - * created from Id: syscalls.master,v 1.48 1998/02/03 17:45:43 bde Exp + * created from Id: syscalls.master,v 1.49 1998/03/28 11:50:01 dufault Exp */ char *syscallnames[] = { @@ -211,8 +211,8 @@ char *syscallnames[] = { "__sysctl", /* 202 = __sysctl */ "mlock", /* 203 = mlock */ "munlock", /* 204 = munlock */ - "utrace", /* 205 = utrace */ - "undelete", /* 206 = undelete */ + "undelete", /* 205 = undelete */ + "futimes", /* 206 = futimes */ "getpgid", /* 207 = getpgid */ "#208", /* 208 = newreboot */ "poll", /* 209 = poll */ @@ -278,15 +278,15 @@ char *syscallnames[] = { "#269", /* 269 = nosys */ "#270", /* 270 = nosys */ "#271", /* 271 = nosys */ - "#272", /* 272 = nosys */ + "getdents", /* 272 = getdents */ "#273", /* 273 = nosys */ - "#274", /* 274 = nosys */ - "#275", /* 275 = nosys */ - "#276", /* 276 = nosys */ - "#277", /* 277 = nosys */ - "#278", /* 278 = nosys */ - "#279", /* 279 = nosys */ - "#280", /* 280 = nosys */ + "lchmod", /* 274 = lchmod */ + "netbsd_lchown", /* 275 = netbsd_lchown */ + "lutimes", /* 276 = lutimes */ + "netbsd_msync", /* 277 = netbsd_msync */ + "nstat", /* 278 = nstat */ + "nfstat", /* 279 = nfstat */ + "nlstat", /* 280 = nlstat */ "#281", /* 281 = nosys */ "#282", /* 282 = nosys */ "#283", /* 283 = nosys */ @@ -341,4 +341,5 @@ char *syscallnames[] = { "sched_get_priority_max", /* 332 = sched_get_priority_max */ "sched_get_priority_min", /* 333 = sched_get_priority_min */ "sched_rr_get_interval", /* 334 = sched_rr_get_interval */ + "utrace", /* 335 = utrace */ }; diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index e2333487974a..3b8ef7b61f64 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -1,4 +1,4 @@ - $Id: syscalls.master,v 1.48 1998/02/03 17:45:43 bde Exp $ + $Id: syscalls.master,v 1.49 1998/03/28 11:50:01 dufault Exp $ ; from: @(#)syscalls.master 8.2 (Berkeley) 1/13/94 ; ; System call name/number master file. @@ -311,14 +311,10 @@ ; here allows to avoid one in libc/sys/Makefile.inc. 203 STD BSD { int mlock(const void *addr, size_t len); } 204 STD BSD { int munlock(const void *addr, size_t len); } -; big problem here. Lite2, NetBSD and OpenBSD have syscall 205 as undelete() -; we should move utrace before it's too late. -205 STD BSD { int utrace(caddr_t addr, size_t len); } -; problem here. NetBSD/OpenBSD have syscall 206 as futimes() -206 STD BSD { int undelete(char *path); } +205 STD BSD { int undelete(char *path); } +206 STD BSD { int futimes(int fd, struct timeval *tptr); } 207 STD BSD { int getpgid(pid_t pid); } 208 UNIMPL NOHIDE newreboot (NetBSD) -; problem. NetBSD and OpenBSD have a different syscall number for poll() 209 STD BSD { int poll(struct pollfd *fds, u_int nfds, \ int timeout); } @@ -404,15 +400,15 @@ 269 UNIMPL NOHIDE nosys 270 UNIMPL NOHIDE nosys 271 UNIMPL NOHIDE nosys -272 UNIMPL NOHIDE nosys +272 STD BSD { int getdents(int fd, char *buf, size_t count); } 273 UNIMPL NOHIDE nosys -274 UNIMPL NOHIDE nosys -275 UNIMPL NOHIDE nosys -276 UNIMPL NOHIDE nosys -277 UNIMPL NOHIDE nosys -278 UNIMPL NOHIDE nosys -279 UNIMPL NOHIDE nosys -280 UNIMPL NOHIDE nosys +274 STD BSD { int lchmod(char *path, mode_t mode); } +275 NOPROTO BSD { int lchown(char *path, uid_t uid, gid_t gid); } netbsd_lchown netbsd_lchown int +276 STD BSD { int lutimes(char *path, struct timeval *tptr); } +277 NOPROTO BSD { int msync(void *addr, size_t len, int flags); } netbsd_msync netbsd_msync int +278 STD BSD { int nstat(char *path, struct nstat *ub); } +279 STD BSD { int nfstat(int fd, struct nstat *sb); } +280 STD BSD { int nlstat(char *path, struct nstat *ub); } 281 UNIMPL NOHIDE nosys 282 UNIMPL NOHIDE nosys 283 UNIMPL NOHIDE nosys @@ -472,3 +468,4 @@ 332 STD POSIX { int sched_get_priority_max (int policy); } 333 STD POSIX { int sched_get_priority_min (int policy); } 334 STD POSIX { int sched_rr_get_interval (pid_t pid, struct timespec *interval); } +335 STD BSD { int utrace(caddr_t addr, size_t len); } diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index 7fd30cc789e3..b79f0f5e09ba 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $Id: vfs_syscalls.c,v 1.99 1998/04/19 22:20:32 des Exp $ + * $Id: vfs_syscalls.c,v 1.100 1998/05/07 04:58:23 msmith Exp $ */ /* For 4.3 integer FS ID compatibility */ @@ -80,6 +80,14 @@ static int change_dir __P((struct nameidata *ndp, struct proc *p)); static void checkdirs __P((struct vnode *olddp)); +static int setfown __P((struct proc *, struct vnode *, uid_t, gid_t)); +static int setfmode __P((struct proc *, struct vnode *, int)); +static int setfflags __P((struct proc *, struct vnode *, int)); +static int setutimes __P((struct proc *, struct vnode *, struct timeval *, int)); + struct proc *p; + struct vnode *vp; + struct timeval *tv; + int nullflag; static int usermount = 0; /* if 1, non-root can mount fs. */ @@ -1617,6 +1625,99 @@ lstat(p, uap) return (error); } +void +cvtnstat(sb, nsb) + struct stat *sb; + struct nstat *nsb; +{ + nsb->st_dev = sb->st_dev; + nsb->st_ino = sb->st_ino; + nsb->st_mode = sb->st_mode; + nsb->st_nlink = sb->st_nlink; + nsb->st_uid = sb->st_uid; + nsb->st_gid = sb->st_gid; + nsb->st_rdev = sb->st_rdev; + nsb->st_atimespec = sb->st_atimespec; + nsb->st_mtimespec = sb->st_mtimespec; + nsb->st_ctimespec = sb->st_ctimespec; + nsb->st_size = sb->st_size; + nsb->st_blocks = sb->st_blocks; + nsb->st_blksize = sb->st_blksize; + nsb->st_flags = sb->st_flags; + nsb->st_gen = sb->st_gen; +} + +#ifndef _SYS_SYSPROTO_H_ +struct nstat_args { + char *path; + struct nstat *ub; +}; +#endif +/* ARGSUSED */ +int +nstat(p, uap) + struct proc *p; + register struct nstat_args /* { + syscallarg(char *) path; + syscallarg(struct nstat *) ub; + } */ *uap; +{ + struct stat sb; + struct nstat nsb; + int error; + struct nameidata nd; + + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, + SCARG(uap, path), p); + if (error = namei(&nd)) + return (error); + error = vn_stat(nd.ni_vp, &sb, p); + vput(nd.ni_vp); + if (error) + return (error); + cvtnstat(&sb, &nsb); + error = copyout((caddr_t)&nsb, (caddr_t)SCARG(uap, ub), sizeof (nsb)); + return (error); +} + +/* + * Get file status; this version does not follow links. + */ +#ifndef _SYS_SYSPROTO_H_ +struct lstat_args { + char *path; + struct stat *ub; +}; +#endif +/* ARGSUSED */ +int +nlstat(p, uap) + struct proc *p; + register struct nlstat_args /* { + syscallarg(char *) path; + syscallarg(struct nstat *) ub; + } */ *uap; +{ + int error; + struct vnode *vp; + struct stat sb; + struct nstat nsb; + struct nameidata nd; + + NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, + SCARG(uap, path), p); + if (error = namei(&nd)) + return (error); + vp = nd.ni_vp; + error = vn_stat(vp, &sb, p); + vput(vp); + if (error) + return (error); + cvtnstat(&sb, &nsb); + error = copyout((caddr_t)&nsb, (caddr_t)SCARG(uap, ub), sizeof (nsb)); + return (error); +} + /* * Get configurable pathname variables. */ @@ -1697,6 +1798,27 @@ readlink(p, uap) return (error); } +static int +setfflags(p, vp, flags) + struct proc *p; + struct vnode *vp; + int flags; +{ + int error; + struct vattr vattr; + + VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); + if (error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p)) { + return error; + } + + VATTR_NULL(&vattr); + vattr.va_flags = flags; + error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); + VOP_UNLOCK(vp, 0, p); + return error; +} + /* * Change flags of a file given a path name. */ @@ -1715,22 +1837,15 @@ chflags(p, uap) syscallarg(int) flags; } */ *uap; { - register struct vnode *vp; - struct vattr vattr; int error; struct nameidata nd; NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); - vp = nd.ni_vp; - VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); - VATTR_NULL(&vattr); - vattr.va_flags = SCARG(uap, flags); - error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); - vput(vp); - return (error); + error = setfflags(p, nd.ni_vp, SCARG(uap, flags)); + vrele(nd.ni_vp); + return error; } /* @@ -1751,21 +1866,33 @@ fchflags(p, uap) syscallarg(int) flags; } */ *uap; { - struct vattr vattr; - struct vnode *vp; struct file *fp; int error; if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) return (error); - vp = (struct vnode *)fp->f_data; + return setfflags(p, (struct vnode *) fp->f_data, SCARG(uap, flags)); +} + +static int +setfmode(p, vp, mode) + struct proc *p; + struct vnode *vp; + int mode; +{ + int error; + struct vattr vattr; VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + + if (error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p)) { + return error; + } + VATTR_NULL(&vattr); - vattr.va_flags = SCARG(uap, flags); + vattr.va_mode = mode & ALLPERMS; error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); VOP_UNLOCK(vp, 0, p); - return (error); + return error; } /* @@ -1786,22 +1913,44 @@ chmod(p, uap) syscallarg(int) mode; } */ *uap; { - register struct vnode *vp; - struct vattr vattr; int error; struct nameidata nd; NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); - vp = nd.ni_vp; - VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); - VATTR_NULL(&vattr); - vattr.va_mode = SCARG(uap, mode) & ALLPERMS; - error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); - vput(vp); - return (error); + error = setfmode(p, nd.ni_vp, SCARG(uap, mode)); + vrele(nd.ni_vp); + return error; +} + +/* + * Change mode of a file given path name (don't follow links.) + */ +#ifndef _SYS_SYSPROTO_H_ +struct lchmod_args { + char *path; + int mode; +}; +#endif +/* ARGSUSED */ +int +lchmod(p, uap) + struct proc *p; + register struct lchmod_args /* { + syscallarg(char *) path; + syscallarg(int) mode; + } */ *uap; +{ + int error; + struct nameidata nd; + + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), p); + if (error = namei(&nd)) + return (error); + error = setfmode(p, nd.ni_vp, SCARG(uap, mode)); + vrele(nd.ni_vp); + return error; } /* @@ -1822,21 +1971,35 @@ fchmod(p, uap) syscallarg(int) mode; } */ *uap; { - struct vattr vattr; - struct vnode *vp; struct file *fp; int error; if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) return (error); - vp = (struct vnode *)fp->f_data; + return setfmode(p, (struct vnode *)fp->f_data, SCARG(uap, mode)); +} + +static int +setfown(p, vp, uid, gid) + struct proc *p; + struct vnode *vp; + uid_t uid; + gid_t gid; +{ + int error; + struct vattr vattr; VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + + if (error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p)) { + return error; + } + VATTR_NULL(&vattr); - vattr.va_mode = SCARG(uap, mode) & ALLPERMS; + vattr.va_uid = uid; + vattr.va_gid = gid; error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); VOP_UNLOCK(vp, 0, p); - return (error); + return error; } /* @@ -1859,22 +2022,15 @@ chown(p, uap) syscallarg(int) gid; } */ *uap; { - register struct vnode *vp; - struct vattr vattr; int error; struct nameidata nd; NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); - vp = nd.ni_vp; - VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); - VATTR_NULL(&vattr); - vattr.va_uid = SCARG(uap, uid); - vattr.va_gid = SCARG(uap, gid); - error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); - vput(vp); + error = setfown(p, nd.ni_vp, SCARG(uap, uid), SCARG(uap, gid)); + vrele(nd.ni_vp); + return (error); } @@ -1898,22 +2054,14 @@ lchown(p, uap) syscallarg(int) gid; } */ *uap; { - register struct vnode *vp; - struct vattr vattr; int error; struct nameidata nd; NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); - vp = nd.ni_vp; - VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); - VATTR_NULL(&vattr); - vattr.va_uid = SCARG(uap, uid); - vattr.va_gid = SCARG(uap, gid); - error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); - vput(vp); + error = setfown(p, nd.ni_vp, SCARG(uap, uid), SCARG(uap, gid)); + vrele(nd.ni_vp); return (error); } @@ -1937,22 +2085,41 @@ fchown(p, uap) syscallarg(int) gid; } */ *uap; { - struct vattr vattr; - struct vnode *vp; struct file *fp; int error; if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) return (error); - vp = (struct vnode *)fp->f_data; + return setfown(p, (struct vnode *)fp->f_data, + SCARG(uap, uid), SCARG(uap, gid)); +} + +static int +setutimes(p, vp, tv, nullflag) + struct proc *p; + struct vnode *vp; + struct timeval *tv; + int nullflag; +{ + int error; + struct vattr vattr; + VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + + if (error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p)) { + return error; + } + VATTR_NULL(&vattr); - vattr.va_uid = SCARG(uap, uid); - vattr.va_gid = SCARG(uap, gid); + vattr.va_atime.tv_sec = tv[0].tv_sec; + vattr.va_atime.tv_nsec = tv[0].tv_usec * 1000; + vattr.va_mtime.tv_sec = tv[1].tv_sec; + vattr.va_mtime.tv_nsec = tv[1].tv_usec * 1000; + if (nullflag) + vattr.va_vaflags |= VA_UTIMES_NULL; error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); VOP_UNLOCK(vp, 0, p); - return (error); + return error; } /* @@ -1973,35 +2140,104 @@ utimes(p, uap) syscallarg(struct timeval *) tptr; } */ *uap; { - register struct vnode *vp; struct timeval tv[2]; - struct vattr vattr; int error; struct nameidata nd; + int nullflag; - VATTR_NULL(&vattr); + nullflag = 0; if (SCARG(uap, tptr) == NULL) { microtime(&tv[0]); tv[1] = tv[0]; - vattr.va_vaflags |= VA_UTIMES_NULL; + nullflag = 1; } else if (error = copyin((caddr_t)SCARG(uap, tptr), (caddr_t)tv, sizeof (tv))) return (error); NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); - vp = nd.ni_vp; - VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); - vattr.va_atime.tv_sec = tv[0].tv_sec; - vattr.va_atime.tv_nsec = tv[0].tv_usec * 1000; - vattr.va_mtime.tv_sec = tv[1].tv_sec; - vattr.va_mtime.tv_nsec = tv[1].tv_usec * 1000; - error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); - vput(vp); + error = setutimes(p, nd.ni_vp, tv, nullflag); + vrele(nd.ni_vp); return (error); } +/* + * Set the access and modification times of a file. + */ +#ifndef _SYS_SYSPROTO_H_ +struct lutimes_args { + char *path; + struct timeval *tptr; +}; +#endif +/* ARGSUSED */ +int +lutimes(p, uap) + struct proc *p; + register struct lutimes_args /* { + syscallarg(char *) path; + syscallarg(struct timeval *) tptr; + } */ *uap; +{ + struct timeval tv[2]; + int error; + struct nameidata nd; + int nullflag; + + nullflag = 0; + if (SCARG(uap, tptr) == NULL) { + microtime(&tv[0]); + tv[1] = tv[0]; + nullflag = 1; + } else if (error = copyin((caddr_t)SCARG(uap, tptr), (caddr_t)tv, + sizeof (tv))) + return (error); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); + if (error = namei(&nd)) + return (error); + + error = setutimes(p, nd.ni_vp, tv, nullflag); + vrele(nd.ni_vp); + return (error); +} + +/* + * Set the access and modification times of a file. + */ +#ifndef _SYS_SYSPROTO_H_ +struct futimes_args { + int fd; + struct timeval *tptr; +}; +#endif +/* ARGSUSED */ +int +futimes(p, uap) + struct proc *p; + register struct futimes_args /* { + syscallarg(int ) fd; + syscallarg(struct timeval *) tptr; + } */ *uap; +{ + struct timeval tv[2]; + struct file *fp; + int error; + int nullflag; + + nullflag = 0; + if (SCARG(uap, tptr) == NULL) { + microtime(&tv[0]); + tv[1] = tv[0]; + nullflag = 1; + } else if (error = copyin((caddr_t)SCARG(uap, tptr), (caddr_t)tv, + sizeof (tv))) + return (error); + + if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) + return (error); + return setutimes(p, (struct vnode *)fp->f_data, tv, nullflag); +} + /* * Truncate a file given its path name. */ @@ -2672,11 +2908,36 @@ getdirentries(p, uap) vrele(tvp); goto unionread; } - error = copyout((caddr_t)&loff, (caddr_t)SCARG(uap, basep), - sizeof(long)); + if (SCARG(uap, basep) != NULL) { + error = copyout((caddr_t)&loff, (caddr_t)SCARG(uap, basep), + sizeof(long)); + } p->p_retval[0] = SCARG(uap, count) - auio.uio_resid; return (error); } +#ifndef _SYS_SYSPROTO_H_ +struct getdents_args { + int fd; + char *buf; + size_t count; +}; +#endif +int +getdents(p, uap) + struct proc *p; + register struct getdents_args /* { + syscallarg(int) fd; + syscallarg(char *) buf; + syscallarg(u_int) count; + } */ *uap; +{ + struct getdirentries_args ap; + ap.fd = uap->fd; + ap.buf = uap->buf; + ap.count = uap->count; + ap.basep = NULL; + return getdirentries(p, &ap); +} /* * Set the mode mask for creation of filesystem nodes. diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 7fd30cc789e3..b79f0f5e09ba 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $Id: vfs_syscalls.c,v 1.99 1998/04/19 22:20:32 des Exp $ + * $Id: vfs_syscalls.c,v 1.100 1998/05/07 04:58:23 msmith Exp $ */ /* For 4.3 integer FS ID compatibility */ @@ -80,6 +80,14 @@ static int change_dir __P((struct nameidata *ndp, struct proc *p)); static void checkdirs __P((struct vnode *olddp)); +static int setfown __P((struct proc *, struct vnode *, uid_t, gid_t)); +static int setfmode __P((struct proc *, struct vnode *, int)); +static int setfflags __P((struct proc *, struct vnode *, int)); +static int setutimes __P((struct proc *, struct vnode *, struct timeval *, int)); + struct proc *p; + struct vnode *vp; + struct timeval *tv; + int nullflag; static int usermount = 0; /* if 1, non-root can mount fs. */ @@ -1617,6 +1625,99 @@ lstat(p, uap) return (error); } +void +cvtnstat(sb, nsb) + struct stat *sb; + struct nstat *nsb; +{ + nsb->st_dev = sb->st_dev; + nsb->st_ino = sb->st_ino; + nsb->st_mode = sb->st_mode; + nsb->st_nlink = sb->st_nlink; + nsb->st_uid = sb->st_uid; + nsb->st_gid = sb->st_gid; + nsb->st_rdev = sb->st_rdev; + nsb->st_atimespec = sb->st_atimespec; + nsb->st_mtimespec = sb->st_mtimespec; + nsb->st_ctimespec = sb->st_ctimespec; + nsb->st_size = sb->st_size; + nsb->st_blocks = sb->st_blocks; + nsb->st_blksize = sb->st_blksize; + nsb->st_flags = sb->st_flags; + nsb->st_gen = sb->st_gen; +} + +#ifndef _SYS_SYSPROTO_H_ +struct nstat_args { + char *path; + struct nstat *ub; +}; +#endif +/* ARGSUSED */ +int +nstat(p, uap) + struct proc *p; + register struct nstat_args /* { + syscallarg(char *) path; + syscallarg(struct nstat *) ub; + } */ *uap; +{ + struct stat sb; + struct nstat nsb; + int error; + struct nameidata nd; + + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, + SCARG(uap, path), p); + if (error = namei(&nd)) + return (error); + error = vn_stat(nd.ni_vp, &sb, p); + vput(nd.ni_vp); + if (error) + return (error); + cvtnstat(&sb, &nsb); + error = copyout((caddr_t)&nsb, (caddr_t)SCARG(uap, ub), sizeof (nsb)); + return (error); +} + +/* + * Get file status; this version does not follow links. + */ +#ifndef _SYS_SYSPROTO_H_ +struct lstat_args { + char *path; + struct stat *ub; +}; +#endif +/* ARGSUSED */ +int +nlstat(p, uap) + struct proc *p; + register struct nlstat_args /* { + syscallarg(char *) path; + syscallarg(struct nstat *) ub; + } */ *uap; +{ + int error; + struct vnode *vp; + struct stat sb; + struct nstat nsb; + struct nameidata nd; + + NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, + SCARG(uap, path), p); + if (error = namei(&nd)) + return (error); + vp = nd.ni_vp; + error = vn_stat(vp, &sb, p); + vput(vp); + if (error) + return (error); + cvtnstat(&sb, &nsb); + error = copyout((caddr_t)&nsb, (caddr_t)SCARG(uap, ub), sizeof (nsb)); + return (error); +} + /* * Get configurable pathname variables. */ @@ -1697,6 +1798,27 @@ readlink(p, uap) return (error); } +static int +setfflags(p, vp, flags) + struct proc *p; + struct vnode *vp; + int flags; +{ + int error; + struct vattr vattr; + + VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); + if (error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p)) { + return error; + } + + VATTR_NULL(&vattr); + vattr.va_flags = flags; + error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); + VOP_UNLOCK(vp, 0, p); + return error; +} + /* * Change flags of a file given a path name. */ @@ -1715,22 +1837,15 @@ chflags(p, uap) syscallarg(int) flags; } */ *uap; { - register struct vnode *vp; - struct vattr vattr; int error; struct nameidata nd; NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); - vp = nd.ni_vp; - VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); - VATTR_NULL(&vattr); - vattr.va_flags = SCARG(uap, flags); - error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); - vput(vp); - return (error); + error = setfflags(p, nd.ni_vp, SCARG(uap, flags)); + vrele(nd.ni_vp); + return error; } /* @@ -1751,21 +1866,33 @@ fchflags(p, uap) syscallarg(int) flags; } */ *uap; { - struct vattr vattr; - struct vnode *vp; struct file *fp; int error; if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) return (error); - vp = (struct vnode *)fp->f_data; + return setfflags(p, (struct vnode *) fp->f_data, SCARG(uap, flags)); +} + +static int +setfmode(p, vp, mode) + struct proc *p; + struct vnode *vp; + int mode; +{ + int error; + struct vattr vattr; VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + + if (error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p)) { + return error; + } + VATTR_NULL(&vattr); - vattr.va_flags = SCARG(uap, flags); + vattr.va_mode = mode & ALLPERMS; error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); VOP_UNLOCK(vp, 0, p); - return (error); + return error; } /* @@ -1786,22 +1913,44 @@ chmod(p, uap) syscallarg(int) mode; } */ *uap; { - register struct vnode *vp; - struct vattr vattr; int error; struct nameidata nd; NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); - vp = nd.ni_vp; - VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); - VATTR_NULL(&vattr); - vattr.va_mode = SCARG(uap, mode) & ALLPERMS; - error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); - vput(vp); - return (error); + error = setfmode(p, nd.ni_vp, SCARG(uap, mode)); + vrele(nd.ni_vp); + return error; +} + +/* + * Change mode of a file given path name (don't follow links.) + */ +#ifndef _SYS_SYSPROTO_H_ +struct lchmod_args { + char *path; + int mode; +}; +#endif +/* ARGSUSED */ +int +lchmod(p, uap) + struct proc *p; + register struct lchmod_args /* { + syscallarg(char *) path; + syscallarg(int) mode; + } */ *uap; +{ + int error; + struct nameidata nd; + + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), p); + if (error = namei(&nd)) + return (error); + error = setfmode(p, nd.ni_vp, SCARG(uap, mode)); + vrele(nd.ni_vp); + return error; } /* @@ -1822,21 +1971,35 @@ fchmod(p, uap) syscallarg(int) mode; } */ *uap; { - struct vattr vattr; - struct vnode *vp; struct file *fp; int error; if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) return (error); - vp = (struct vnode *)fp->f_data; + return setfmode(p, (struct vnode *)fp->f_data, SCARG(uap, mode)); +} + +static int +setfown(p, vp, uid, gid) + struct proc *p; + struct vnode *vp; + uid_t uid; + gid_t gid; +{ + int error; + struct vattr vattr; VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + + if (error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p)) { + return error; + } + VATTR_NULL(&vattr); - vattr.va_mode = SCARG(uap, mode) & ALLPERMS; + vattr.va_uid = uid; + vattr.va_gid = gid; error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); VOP_UNLOCK(vp, 0, p); - return (error); + return error; } /* @@ -1859,22 +2022,15 @@ chown(p, uap) syscallarg(int) gid; } */ *uap; { - register struct vnode *vp; - struct vattr vattr; int error; struct nameidata nd; NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); - vp = nd.ni_vp; - VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); - VATTR_NULL(&vattr); - vattr.va_uid = SCARG(uap, uid); - vattr.va_gid = SCARG(uap, gid); - error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); - vput(vp); + error = setfown(p, nd.ni_vp, SCARG(uap, uid), SCARG(uap, gid)); + vrele(nd.ni_vp); + return (error); } @@ -1898,22 +2054,14 @@ lchown(p, uap) syscallarg(int) gid; } */ *uap; { - register struct vnode *vp; - struct vattr vattr; int error; struct nameidata nd; NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); - vp = nd.ni_vp; - VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); - VATTR_NULL(&vattr); - vattr.va_uid = SCARG(uap, uid); - vattr.va_gid = SCARG(uap, gid); - error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); - vput(vp); + error = setfown(p, nd.ni_vp, SCARG(uap, uid), SCARG(uap, gid)); + vrele(nd.ni_vp); return (error); } @@ -1937,22 +2085,41 @@ fchown(p, uap) syscallarg(int) gid; } */ *uap; { - struct vattr vattr; - struct vnode *vp; struct file *fp; int error; if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) return (error); - vp = (struct vnode *)fp->f_data; + return setfown(p, (struct vnode *)fp->f_data, + SCARG(uap, uid), SCARG(uap, gid)); +} + +static int +setutimes(p, vp, tv, nullflag) + struct proc *p; + struct vnode *vp; + struct timeval *tv; + int nullflag; +{ + int error; + struct vattr vattr; + VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + + if (error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p)) { + return error; + } + VATTR_NULL(&vattr); - vattr.va_uid = SCARG(uap, uid); - vattr.va_gid = SCARG(uap, gid); + vattr.va_atime.tv_sec = tv[0].tv_sec; + vattr.va_atime.tv_nsec = tv[0].tv_usec * 1000; + vattr.va_mtime.tv_sec = tv[1].tv_sec; + vattr.va_mtime.tv_nsec = tv[1].tv_usec * 1000; + if (nullflag) + vattr.va_vaflags |= VA_UTIMES_NULL; error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); VOP_UNLOCK(vp, 0, p); - return (error); + return error; } /* @@ -1973,35 +2140,104 @@ utimes(p, uap) syscallarg(struct timeval *) tptr; } */ *uap; { - register struct vnode *vp; struct timeval tv[2]; - struct vattr vattr; int error; struct nameidata nd; + int nullflag; - VATTR_NULL(&vattr); + nullflag = 0; if (SCARG(uap, tptr) == NULL) { microtime(&tv[0]); tv[1] = tv[0]; - vattr.va_vaflags |= VA_UTIMES_NULL; + nullflag = 1; } else if (error = copyin((caddr_t)SCARG(uap, tptr), (caddr_t)tv, sizeof (tv))) return (error); NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); - vp = nd.ni_vp; - VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); - vattr.va_atime.tv_sec = tv[0].tv_sec; - vattr.va_atime.tv_nsec = tv[0].tv_usec * 1000; - vattr.va_mtime.tv_sec = tv[1].tv_sec; - vattr.va_mtime.tv_nsec = tv[1].tv_usec * 1000; - error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); - vput(vp); + error = setutimes(p, nd.ni_vp, tv, nullflag); + vrele(nd.ni_vp); return (error); } +/* + * Set the access and modification times of a file. + */ +#ifndef _SYS_SYSPROTO_H_ +struct lutimes_args { + char *path; + struct timeval *tptr; +}; +#endif +/* ARGSUSED */ +int +lutimes(p, uap) + struct proc *p; + register struct lutimes_args /* { + syscallarg(char *) path; + syscallarg(struct timeval *) tptr; + } */ *uap; +{ + struct timeval tv[2]; + int error; + struct nameidata nd; + int nullflag; + + nullflag = 0; + if (SCARG(uap, tptr) == NULL) { + microtime(&tv[0]); + tv[1] = tv[0]; + nullflag = 1; + } else if (error = copyin((caddr_t)SCARG(uap, tptr), (caddr_t)tv, + sizeof (tv))) + return (error); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); + if (error = namei(&nd)) + return (error); + + error = setutimes(p, nd.ni_vp, tv, nullflag); + vrele(nd.ni_vp); + return (error); +} + +/* + * Set the access and modification times of a file. + */ +#ifndef _SYS_SYSPROTO_H_ +struct futimes_args { + int fd; + struct timeval *tptr; +}; +#endif +/* ARGSUSED */ +int +futimes(p, uap) + struct proc *p; + register struct futimes_args /* { + syscallarg(int ) fd; + syscallarg(struct timeval *) tptr; + } */ *uap; +{ + struct timeval tv[2]; + struct file *fp; + int error; + int nullflag; + + nullflag = 0; + if (SCARG(uap, tptr) == NULL) { + microtime(&tv[0]); + tv[1] = tv[0]; + nullflag = 1; + } else if (error = copyin((caddr_t)SCARG(uap, tptr), (caddr_t)tv, + sizeof (tv))) + return (error); + + if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) + return (error); + return setutimes(p, (struct vnode *)fp->f_data, tv, nullflag); +} + /* * Truncate a file given its path name. */ @@ -2672,11 +2908,36 @@ getdirentries(p, uap) vrele(tvp); goto unionread; } - error = copyout((caddr_t)&loff, (caddr_t)SCARG(uap, basep), - sizeof(long)); + if (SCARG(uap, basep) != NULL) { + error = copyout((caddr_t)&loff, (caddr_t)SCARG(uap, basep), + sizeof(long)); + } p->p_retval[0] = SCARG(uap, count) - auio.uio_resid; return (error); } +#ifndef _SYS_SYSPROTO_H_ +struct getdents_args { + int fd; + char *buf; + size_t count; +}; +#endif +int +getdents(p, uap) + struct proc *p; + register struct getdents_args /* { + syscallarg(int) fd; + syscallarg(char *) buf; + syscallarg(u_int) count; + } */ *uap; +{ + struct getdirentries_args ap; + ap.fd = uap->fd; + ap.buf = uap->buf; + ap.count = uap->count; + ap.basep = NULL; + return getdirentries(p, &ap); +} /* * Set the mode mask for creation of filesystem nodes. diff --git a/sys/sys/stat.h b/sys/sys/stat.h index 2e1a72797b3f..f5f3d81b0b05 100644 --- a/sys/sys/stat.h +++ b/sys/sys/stat.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)stat.h 8.12 (Berkeley) 6/16/95 - * $Id: stat.h,v 1.13 1997/06/02 06:24:51 julian Exp $ + * $Id: stat.h,v 1.14 1998/02/25 02:00:44 bde Exp $ */ #ifndef _SYS_STAT_H_ @@ -98,6 +98,37 @@ struct stat { int32_t st_lspare; int64_t st_qspare[2]; }; + +#ifndef _POSIX_SOURCE +struct nstat { + dev_t st_dev; /* inode's device */ + ino_t st_ino; /* inode's number */ + u_int32_t st_mode; /* inode protection mode */ + u_int32_t st_nlink; /* number of hard links */ + uid_t st_uid; /* user ID of the file's owner */ + gid_t st_gid; /* group ID of the file's group */ + dev_t st_rdev; /* device type */ +#ifndef _POSIX_SOURCE + struct timespec st_atimespec; /* time of last access */ + struct timespec st_mtimespec; /* time of last data modification */ + struct timespec st_ctimespec; /* time of last file status change */ +#else + time_t st_atime; /* time of last access */ + long st_atimensec; /* nsec of last access */ + time_t st_mtime; /* time of last data modification */ + long st_mtimensec; /* nsec of last data modification */ + time_t st_ctime; /* time of last file status change */ + long st_ctimensec; /* nsec of last file status change */ +#endif + off_t st_size; /* file size, in bytes */ + int64_t st_blocks; /* blocks allocated for file */ + u_int32_t st_blksize; /* optimal blocksize for I/O */ + u_int32_t st_flags; /* user defined flags for file */ + u_int32_t st_gen; /* file generation number */ + int64_t st_qspare[2]; +}; +#endif + #ifndef _POSIX_SOURCE #define st_atime st_atimespec.tv_sec #define st_mtime st_mtimespec.tv_sec @@ -206,6 +237,7 @@ int mkdir __P((const char *, mode_t)); int mkfifo __P((const char *, mode_t)); int stat __P((const char *, struct stat *)); mode_t umask __P((mode_t)); + #ifndef _POSIX_SOURCE int chflags __P((const char *, u_long)); int fchflags __P((int, u_long)); diff --git a/sys/sys/syscall-hide.h b/sys/sys/syscall-hide.h index 4f9a7abc429f..799c1873a4d0 100644 --- a/sys/sys/syscall-hide.h +++ b/sys/sys/syscall-hide.h @@ -2,7 +2,7 @@ * System call hiders. * * DO NOT EDIT-- this file is automatically generated. - * created from Id: syscalls.master,v 1.48 1998/02/03 17:45:43 bde Exp + * created from Id: syscalls.master,v 1.49 1998/03/28 11:50:01 dufault Exp */ HIDE_POSIX(fork) @@ -181,8 +181,8 @@ HIDE_BSD(ftruncate) HIDE_BSD(__sysctl) HIDE_BSD(mlock) HIDE_BSD(munlock) -HIDE_BSD(utrace) HIDE_BSD(undelete) +HIDE_BSD(futimes) HIDE_BSD(getpgid) HIDE_BSD(poll) HIDE_BSD(__semctl) @@ -206,6 +206,14 @@ HIDE_BSD(rfork) HIDE_BSD(openbsd_poll) HIDE_BSD(issetugid) HIDE_BSD(lchown) +HIDE_BSD(getdents) +HIDE_BSD(lchmod) +HIDE_BSD(lchown) +HIDE_BSD(lutimes) +HIDE_BSD(msync) +HIDE_BSD(nstat) +HIDE_BSD(nfstat) +HIDE_BSD(nlstat) HIDE_BSD(modnext) HIDE_BSD(modstat) HIDE_BSD(modfnext) @@ -239,3 +247,4 @@ HIDE_POSIX(sched_yield) HIDE_POSIX(sched_get_priority_max) HIDE_POSIX(sched_get_priority_min) HIDE_POSIX(sched_rr_get_interval) +HIDE_BSD(utrace) diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h index ec744632c806..a29f08202625 100644 --- a/sys/sys/syscall.h +++ b/sys/sys/syscall.h @@ -2,7 +2,7 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * created from Id: syscalls.master,v 1.48 1998/02/03 17:45:43 bde Exp + * created from Id: syscalls.master,v 1.49 1998/03/28 11:50:01 dufault Exp */ #define SYS_syscall 0 @@ -186,8 +186,8 @@ #define SYS___sysctl 202 #define SYS_mlock 203 #define SYS_munlock 204 -#define SYS_utrace 205 -#define SYS_undelete 206 +#define SYS_undelete 205 +#define SYS_futimes 206 #define SYS_getpgid 207 #define SYS_poll 209 #define SYS___semctl 220 @@ -211,6 +211,14 @@ #define SYS_openbsd_poll 252 #define SYS_issetugid 253 #define SYS_lchown 254 +#define SYS_getdents 272 +#define SYS_lchmod 274 +#define SYS_netbsd_lchown 275 +#define SYS_lutimes 276 +#define SYS_netbsd_msync 277 +#define SYS_nstat 278 +#define SYS_nfstat 279 +#define SYS_nlstat 280 #define SYS_modnext 300 #define SYS_modstat 301 #define SYS_modfnext 302 @@ -244,4 +252,5 @@ #define SYS_sched_get_priority_max 332 #define SYS_sched_get_priority_min 333 #define SYS_sched_rr_get_interval 334 -#define SYS_MAXSYSCALL 335 +#define SYS_utrace 335 +#define SYS_MAXSYSCALL 336 diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk index 3a85bd9827e3..253fb68e03b7 100644 --- a/sys/sys/syscall.mk +++ b/sys/sys/syscall.mk @@ -1,6 +1,6 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. -# created from Id: syscalls.master,v 1.48 1998/02/03 17:45:43 bde Exp +# created from Id: syscalls.master,v 1.49 1998/03/28 11:50:01 dufault Exp MIASM = \ syscall.o \ exit.o \ @@ -143,8 +143,8 @@ MIASM = \ __sysctl.o \ mlock.o \ munlock.o \ - utrace.o \ undelete.o \ + futimes.o \ getpgid.o \ poll.o \ __semctl.o \ @@ -168,6 +168,14 @@ MIASM = \ openbsd_poll.o \ issetugid.o \ lchown.o \ + getdents.o \ + lchmod.o \ + netbsd_lchown.o \ + lutimes.o \ + netbsd_msync.o \ + nstat.o \ + nfstat.o \ + nlstat.o \ modnext.o \ modstat.o \ modfnext.o \ @@ -200,4 +208,5 @@ MIASM = \ sched_yield.o \ sched_get_priority_max.o \ sched_get_priority_min.o \ - sched_rr_get_interval.o + sched_rr_get_interval.o \ + utrace.o \ No newline at end of file diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h index 16c56c637cc2..0e7a8dc6cb90 100644 --- a/sys/sys/sysproto.h +++ b/sys/sys/sysproto.h @@ -2,7 +2,7 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * created from Id: syscalls.master,v 1.48 1998/02/03 17:45:43 bde Exp + * created from Id: syscalls.master,v 1.49 1998/03/28 11:50:01 dufault Exp */ #ifndef _SYS_SYSPROTO_H_ @@ -626,13 +626,13 @@ struct munlock_args { const void * addr; size_t len; }; -struct utrace_args { - caddr_t addr; - size_t len; -}; struct undelete_args { char * path; }; +struct futimes_args { + int fd; + struct timeval * tptr; +}; struct getpgid_args { pid_t pid; }; @@ -737,6 +737,31 @@ struct lchown_args { int uid; int gid; }; +struct getdents_args { + int fd; + char * buf; + size_t count; +}; +struct lchmod_args { + char * path; + mode_t mode; +}; +struct lutimes_args { + char * path; + struct timeval * tptr; +}; +struct nstat_args { + char * path; + struct nstat * ub; +}; +struct nfstat_args { + int fd; + struct nstat * sb; +}; +struct nlstat_args { + char * path; + struct nstat * ub; +}; struct modnext_args { int modid; }; @@ -852,6 +877,10 @@ struct sched_rr_get_interval_args { pid_t pid; struct timespec * interval; }; +struct utrace_args { + caddr_t addr; + size_t len; +}; int nosys __P((struct proc *, struct nosys_args *)); void exit __P((struct proc *, struct rexit_args *)) __dead2; int fork __P((struct proc *, struct fork_args *)); @@ -992,8 +1021,8 @@ int ftruncate __P((struct proc *, struct ftruncate_args *)); int __sysctl __P((struct proc *, struct sysctl_args *)); int mlock __P((struct proc *, struct mlock_args *)); int munlock __P((struct proc *, struct munlock_args *)); -int utrace __P((struct proc *, struct utrace_args *)); int undelete __P((struct proc *, struct undelete_args *)); +int futimes __P((struct proc *, struct futimes_args *)); int getpgid __P((struct proc *, struct getpgid_args *)); int poll __P((struct proc *, struct poll_args *)); int lkmnosys __P((struct proc *, struct nosys_args *)); @@ -1018,6 +1047,12 @@ int rfork __P((struct proc *, struct rfork_args *)); int openbsd_poll __P((struct proc *, struct openbsd_poll_args *)); int issetugid __P((struct proc *, struct issetugid_args *)); int lchown __P((struct proc *, struct lchown_args *)); +int getdents __P((struct proc *, struct getdents_args *)); +int lchmod __P((struct proc *, struct lchmod_args *)); +int lutimes __P((struct proc *, struct lutimes_args *)); +int nstat __P((struct proc *, struct nstat_args *)); +int nfstat __P((struct proc *, struct nfstat_args *)); +int nlstat __P((struct proc *, struct nlstat_args *)); int modnext __P((struct proc *, struct modnext_args *)); int modstat __P((struct proc *, struct modstat_args *)); int modfnext __P((struct proc *, struct modfnext_args *)); @@ -1051,6 +1086,7 @@ int sched_yield __P((struct proc *, struct sched_yield_args *)); int sched_get_priority_max __P((struct proc *, struct sched_get_priority_max_args *)); int sched_get_priority_min __P((struct proc *, struct sched_get_priority_min_args *)); int sched_rr_get_interval __P((struct proc *, struct sched_rr_get_interval_args *)); +int utrace __P((struct proc *, struct utrace_args *)); #ifdef COMPAT_43 diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index c109a0a434e0..79f985ec29a9 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)vnode.h 8.7 (Berkeley) 2/4/94 - * $Id: vnode.h,v 1.69 1998/03/16 01:55:35 dyson Exp $ + * $Id: vnode.h,v 1.70 1998/03/28 10:33:24 bde Exp $ */ #ifndef _SYS_VNODE_H_ @@ -460,6 +460,7 @@ struct nameidata; struct ostat; struct proc; struct stat; +struct nstat; struct ucred; struct uio; struct vattr; @@ -477,6 +478,7 @@ int cache_lookup __P((struct vnode *dvp, struct vnode **vpp, void cache_purge __P((struct vnode *vp)); void cache_purgevfs __P((struct mount *mp)); void cvtstat __P((struct stat *st, struct ostat *ost)); +void cvtnstat __P((struct stat *sb, struct nstat *nsb)); int getnewvnode __P((enum vtagtype tag, struct mount *mp, vop_t **vops, struct vnode **vpp)); int lease_check __P((struct vop_lease_args *ap));