4.2 distribution
[unix-history] / usr / src / sys / kern / vfs_syscalls.c
index 95de59c..45eaea1 100644 (file)
@@ -1,4 +1,4 @@
-/*     vfs_syscalls.c  4.58    83/05/28        */
+/*     vfs_syscalls.c  6.1     83/07/29        */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -371,12 +371,25 @@ lseek()
        fp = getinode(uap->fd);
        if (fp == NULL)
                return;
        fp = getinode(uap->fd);
        if (fp == NULL)
                return;
-       if (uap->sbase == L_INCR)
-               uap->off += fp->f_offset;
-       else if (uap->sbase == L_XTND)
-               uap->off += ((struct inode *)fp->f_data)->i_size;
-       fp->f_offset = uap->off;
-       u.u_r.r_off = uap->off;
+       switch (uap->sbase) {
+
+       case L_INCR:
+               fp->f_offset += uap->off;
+               break;
+
+       case L_XTND:
+               fp->f_offset = uap->off + ((struct inode *)fp->f_data)->i_size;
+               break;
+
+       case L_SET:
+               fp->f_offset = uap->off;
+               break;
+
+       default:
+               u.u_error = EINVAL;
+               return;
+       }
+       u.u_r.r_off = fp->f_offset;
 }
 
 /*
 }
 
 /*
@@ -443,7 +456,7 @@ stat1(follow)
        ip = namei(uchar, LOOKUP, follow);
        if (ip == NULL)
                return;
        ip = namei(uchar, LOOKUP, follow);
        if (ip == NULL)
                return;
-       (void) statinode(ip, &sb);
+       (void) ino_stat(ip, &sb);
        iput(ip);
        u.u_error = copyout((caddr_t)&sb, (caddr_t)uap->ub, sizeof (sb));
 }
        iput(ip);
        u.u_error = copyout((caddr_t)&sb, (caddr_t)uap->ub, sizeof (sb));
 }
@@ -621,34 +634,6 @@ chown1(ip, uid, gid)
 #endif
 }
 
 #endif
 }
 
-#ifndef NOCOMPAT
-/*
- * Set IUPD and IACC times on file.
- * Can't set ICHG.
- */
-outime()
-{
-       register struct a {
-               char    *fname;
-               time_t  *tptr;
-       } *uap = (struct a *)u.u_ap;
-       register struct inode *ip;
-       time_t tv[2];
-       struct timeval tv0, tv1;
-
-       if ((ip = owner(1)) == NULL)
-               return;
-       u.u_error = copyin((caddr_t)uap->tptr, (caddr_t)tv, sizeof (tv));
-       if (u.u_error == 0) {
-               ip->i_flag |= IACC|IUPD|ICHG;
-               tv0.tv_sec = tv[0]; tv0.tv_usec = 0;
-               tv1.tv_sec = tv[1]; tv1.tv_usec = 0;
-               iupdat(ip, &tv0, &tv1, 0);
-       }
-       iput(ip);
-}
-#endif
-
 utimes()
 {
        register struct a {
 utimes()
 {
        register struct a {
@@ -677,43 +662,6 @@ sync()
        update();
 }
 
        update();
 }
 
-/*
- * Apply an advisory lock on a file descriptor.
- */
-flock()
-{
-       register struct a {
-               int     fd;
-               int     how;
-       } *uap = (struct a *)u.u_ap;
-       register struct file *fp;
-       register int cmd, flags;
-
-       fp = getinode(uap->fd);
-       if (fp == NULL)
-               return;
-       cmd = uap->how;
-       flags = u.u_pofile[uap->fd] & (UF_SHLOCK|UF_EXLOCK);
-       if (cmd&LOCK_UN) {
-               if (flags == 0) {
-                       u.u_error = EINVAL;
-                       return;
-               }
-               funlocki((struct inode *)fp->f_data, flags);
-               u.u_pofile[uap->fd] &= ~(UF_SHLOCK|UF_EXLOCK);
-               return;
-       }
-       /*
-        * No reason to write lock a file we've already
-        * write locked, similarly with a read lock.
-        */
-       if ((flags&UF_EXLOCK) && (cmd&LOCK_EX) ||
-           (flags&UF_SHLOCK) && (cmd&LOCK_SH))
-               return;
-       u.u_pofile[uap->fd] =
-           flocki((struct inode *)fp->f_data, u.u_pofile[uap->fd], cmd);
-}
-
 /*
  * Truncate a file given its path name.
  */
 /*
  * Truncate a file given its path name.
  */