print errno when init can't be executed
[unix-history] / usr / src / sys / kern / vfs_vnops.c
index 5c4c8ba..1e92578 100644 (file)
@@ -1,47 +1,26 @@
-/*     vfs_vnops.c     4.34    83/03/31        */
-
-#include "../machine/reg.h"
-
-#include "../h/param.h"
-#include "../h/systm.h"
-#include "../h/dir.h"
-#include "../h/user.h"
-#include "../h/fs.h"
-#include "../h/file.h"
-#include "../h/conf.h"
-#include "../h/inode.h"
-#include "../h/acct.h"
-#include "../h/mount.h"
-#include "../h/socket.h"
-#include "../h/socketvar.h"
-#include "../h/proc.h"
-#include "../h/nami.h"
-
 /*
 /*
- * Openi called to allow handler
- * of special files to initialize and
- * validate before actual IO.
+ * Copyright (c) 1982, 1986 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *     @(#)vfs_vnops.c 7.1 (Berkeley) %G%
  */
  */
-openi(ip, mode)
-       register struct inode *ip;
-{
-       dev_t dev = (dev_t)ip->i_rdev;
-       register u_int maj = major(dev);
 
 
-       switch (ip->i_mode&IFMT) {
-
-       case IFCHR:
-               if (maj >= nchrdev)
-                       return (ENXIO);
-               return ((*cdevsw[maj].d_open)(dev, mode));
+#include "../machine/reg.h"
 
 
-       case IFBLK:
-               if (maj >= nblkdev)
-                       return (ENXIO);
-               return ((*bdevsw[maj].d_open)(dev, mode));
-       }
-       return (0);
-}
+#include "param.h"
+#include "systm.h"
+#include "dir.h"
+#include "user.h"
+#include "fs.h"
+#include "file.h"
+#include "conf.h"
+#include "inode.h"
+#include "acct.h"
+#include "mount.h"
+#include "socket.h"
+#include "socketvar.h"
+#include "proc.h"
 
 /*
  * Check mode permission on inode pointer.
 
 /*
  * Check mode permission on inode pointer.
@@ -61,7 +40,7 @@ access(ip, mode)
        int mode;
 {
        register m;
        int mode;
 {
        register m;
-       register int *gp;
+       register gid_t *gp;
 
        m = mode;
        if (m == IWRITE) {
 
        m = mode;
        if (m == IWRITE) {
@@ -107,7 +86,8 @@ access(ip, mode)
                m >>= 3;
                if (u.u_gid == ip->i_gid)
                        goto found;
                m >>= 3;
                if (u.u_gid == ip->i_gid)
                        goto found;
-               for (gp = u.u_groups; gp < &u.u_groups[NGROUPS]; gp++)
+               gp = u.u_groups;
+               for (; gp < &u.u_groups[NGROUPS] && *gp != NOGROUP; gp++)
                        if (ip->i_gid == *gp)
                                goto found;
                m >>= 3;
                        if (ip->i_gid == *gp)
                                goto found;
                m >>= 3;
@@ -129,12 +109,17 @@ found:
  * return inode pointer.
  */
 struct inode *
  * return inode pointer.
  */
 struct inode *
-owner(follow)
+owner(fname, follow)
+       caddr_t fname;
        int follow;
 {
        register struct inode *ip;
        int follow;
 {
        register struct inode *ip;
+       register struct nameidata *ndp = &u.u_nd;
 
 
-       ip = namei(uchar, LOOKUP, follow);
+       ndp->ni_nameiop = LOOKUP | follow;
+       ndp->ni_segflg = UIO_USERSPACE;
+       ndp->ni_dirp = fname;
+       ip = namei(ndp);
        if (ip == NULL)
                return (NULL);
        if (u.u_uid == ip->i_uid)
        if (ip == NULL)
                return (NULL);
        if (u.u_uid == ip->i_uid)