ensure bmap run list is initialised
[unix-history] / usr / src / sys / miscfs / procfs / procfs_vnops.c
index 1294d34..5d9dee5 100644 (file)
@@ -8,7 +8,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)procfs_vnops.c      8.8 (Berkeley) %G%
+ *     @(#)procfs_vnops.c      8.11 (Berkeley) %G%
  *
  * From:
  *     $Id: procfs_vnops.c,v 3.2 1993/12/15 09:40:17 jsp Exp $
  *
  * From:
  *     $Id: procfs_vnops.c,v 3.2 1993/12/15 09:40:17 jsp Exp $
@@ -178,6 +178,8 @@ procfs_bmap(ap)
                *ap->a_vpp = ap->a_vp;
        if (ap->a_bnp != NULL)
                *ap->a_bnp = ap->a_bn;
                *ap->a_vpp = ap->a_vp;
        if (ap->a_bnp != NULL)
                *ap->a_bnp = ap->a_bn;
+       if (ap->a_runp != NULL)
+               *ap->a_runp = 0;
        return (0);
 }
 
        return (0);
 }
 
@@ -325,6 +327,7 @@ procfs_getattr(ap)
        struct pfsnode *pfs = VTOPFS(ap->a_vp);
        struct vattr *vap = ap->a_vap;
        struct proc *procp;
        struct pfsnode *pfs = VTOPFS(ap->a_vp);
        struct vattr *vap = ap->a_vap;
        struct proc *procp;
+       struct timeval tv;
        int error;
 
        /* first check the process still exists */
        int error;
 
        /* first check the process still exists */
@@ -360,11 +363,9 @@ procfs_getattr(ap)
         * no "file creation" time stamp anyway, and the
         * p_stat structure is not addressible if u. gets
         * swapped out for that process.
         * no "file creation" time stamp anyway, and the
         * p_stat structure is not addressible if u. gets
         * swapped out for that process.
-        *
-        * XXX
-        * Note that microtime() returns a timeval, not a timespec.
         */
         */
-       microtime(&vap->va_ctime);
+       microtime(&tv);
+       TIMEVAL_TO_TIMESPEC(&tv, &vap->va_ctime);
        vap->va_atime = vap->va_mtime = vap->va_ctime;
 
        /*
        vap->va_atime = vap->va_mtime = vap->va_ctime;
 
        /*
@@ -744,7 +745,7 @@ procfs_readdir(ap)
                int doingzomb = 0;
 #endif
                int pcnt = 0;
                int doingzomb = 0;
 #endif
                int pcnt = 0;
-               volatile struct proc *p = allproc;
+               volatile struct proc *p = allproc.lh_first;
 
        again:
                for (; p && uio->uio_resid >= UIO_MX; i++, pcnt++) {
 
        again:
                for (; p && uio->uio_resid >= UIO_MX; i++, pcnt++) {
@@ -771,7 +772,7 @@ procfs_readdir(ap)
                        default:
                                while (pcnt < i) {
                                        pcnt++;
                        default:
                                while (pcnt < i) {
                                        pcnt++;
-                                       p = p->p_next;
+                                       p = p->p_list.le_next;
                                        if (!p)
                                                goto done;
                                }
                                        if (!p)
                                                goto done;
                                }
@@ -779,7 +780,7 @@ procfs_readdir(ap)
                                dp->d_namlen = sprintf(dp->d_name, "%ld",
                                    (long)p->p_pid);
                                dp->d_type = DT_REG;
                                dp->d_namlen = sprintf(dp->d_name, "%ld",
                                    (long)p->p_pid);
                                dp->d_type = DT_REG;
-                               p = p->p_next;
+                               p = p->p_list.le_next;
                                break;
                        }
 
                                break;
                        }
 
@@ -791,7 +792,7 @@ procfs_readdir(ap)
 #ifdef PROCFS_ZOMBIE
                if (p == 0 && doingzomb == 0) {
                        doingzomb = 1;
 #ifdef PROCFS_ZOMBIE
                if (p == 0 && doingzomb == 0) {
                        doingzomb = 1;
-                       p = zombproc;
+                       p = zombproc.lh_first;
                        goto again;
                }
 #endif
                        goto again;
                }
 #endif