Skip to content

Commit

Permalink
xnu-201.19
Browse files Browse the repository at this point in the history
  • Loading branch information
Darwin authored and das committed Jun 4, 2017
1 parent ab55f3a commit bfd5905
Show file tree
Hide file tree
Showing 52 changed files with 1,893 additions and 1,480 deletions.
2 changes: 1 addition & 1 deletion bsd/conf/version.minor
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2
3
38 changes: 21 additions & 17 deletions bsd/hfs/hfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,8 @@ struct proc *p;
struct hfsnode *hp;
struct hfsmount *hfsmp = VFSTOHFS(mp);
ExtendedVCB *vcb;
struct vnode *meta_vp[3];
int i;
int error, allerror = 0;

DBG_FUNC_NAME("hfs_sync");
Expand Down Expand Up @@ -1285,7 +1287,8 @@ loop:;
nvp = vp->v_mntvnodes.le_next;
hp = VTOH(vp);

if ((vp->v_type == VNON) || (((hp->h_nodeflags & (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0) &&
if ((vp->v_flag & VSYSTEM) || (vp->v_type == VNON) ||
(((hp->h_nodeflags & (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0) &&
(vp->v_dirtyblkhd.lh_first == NULL) && !(vp->v_flag & VHASDIRTY))) {
simple_unlock(&vp->v_interlock);
simple_unlock(&mntvnode_slock);
Expand Down Expand Up @@ -1315,30 +1318,31 @@ loop:;
simple_lock(&mntvnode_slock);
};

vcb = HFSTOVCB(hfsmp);
vcb = HFSTOVCB(hfsmp);
meta_vp[0] = vcb->extentsRefNum;
meta_vp[1] = vcb->catalogRefNum;
meta_vp[2] = vcb->allocationsRefNum; /* This is NULL for standard HFS */

/* Now sync our three metadata files */
for (i = 0; i < 3; ++i) {
struct vnode *btvp;

btvp = meta_vp[i];

/* Now reprocess the BTree node, stored above */
{
struct vnode *btvp;
/*
* If the vnode that we are about to sync is no longer
* associated with this mount point, start over.
*/
btvp = vcb->extentsRefNum;
if ((btvp==0) || (btvp->v_type == VNON) || (btvp->v_mount != mp))
goto skipBtree;
continue;
simple_lock(&btvp->v_interlock);
hp = VTOH(btvp);
if (((hp->h_nodeflags & (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0) &&
(btvp->v_dirtyblkhd.lh_first == NULL) && !(btvp->v_flag & VHASDIRTY)) {
simple_unlock(&btvp->v_interlock);
goto skipBtree;
continue;
}
simple_unlock(&mntvnode_slock);
error = vget(btvp, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, p);
if (error) {
simple_lock(&mntvnode_slock);
goto skipBtree;
continue;
}
if ((error = VOP_FSYNC(btvp, cred, waitfor, p)))
allerror = error;
Expand All @@ -1347,15 +1351,15 @@ loop:;
simple_lock(&mntvnode_slock);
};

skipBtree:;

simple_unlock(&mntvnode_slock);

/*
* Force stale file system control information to be flushed.
*/
if ((error = VOP_FSYNC(hfsmp->hfs_devvp, cred, waitfor, p)))
allerror = error;
if (vcb->vcbSigWord == kHFSSigWord) {
if ((error = VOP_FSYNC(hfsmp->hfs_devvp, cred, waitfor, p)))
allerror = error;
}
/*
* Write back modified superblock.
*/
Expand Down
7 changes: 4 additions & 3 deletions bsd/isofs/cd9660/cd9660_node.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
* Copyright (c) 2000-2001 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
Expand Down Expand Up @@ -306,8 +306,9 @@ cd9660_reclaim(ap)
*/
cache_purge(vp);
if (ip->i_devvp) {
vrele(ip->i_devvp);
ip->i_devvp = 0;
struct vnode *tvp = ip->i_devvp;
ip->i_devvp = NULL;
vrele(tvp);
}
if (ip->i_namep != isonullname)
FREE(ip->i_namep, M_TEMP);
Expand Down
4 changes: 2 additions & 2 deletions bsd/kern/bsd_init.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
* Copyright (c) 2000-2001 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
Expand Down Expand Up @@ -496,8 +496,8 @@ bsd_init()
/* Get the vnode for '/'. Set fdp->fd_fd.fd_cdir to reference it. */
if (VFS_ROOT(mountlist.cqh_first, &rootvnode))
panic("bsd_init: cannot find root vnode");
filedesc0.fd_cdir = rootvnode;
VREF(rootvnode);
filedesc0.fd_cdir = rootvnode;
VOP_UNLOCK(rootvnode, 0, p);


Expand Down
43 changes: 19 additions & 24 deletions bsd/kern/kern_descrip.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
* Copyright (c) 2000-2001 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
Expand Down Expand Up @@ -58,14 +58,6 @@
* SUCH DAMAGE.
*
* @(#)kern_descrip.c 8.8 (Berkeley) 2/14/95
*
* History:
* CHW 8/5/98 Added F_SETSIZE command to truncate without
* zero filling space
* CHW 7/6/98 Updated Preallocate command to take a structure
* and return output.
* CHW 6/25/98 Fixed a bug in the lock call in fcntl
* Preallocate command
*/

#include <sys/param.h>
Expand Down Expand Up @@ -103,7 +95,6 @@ getdtablesize(p, uap, retval)
void *uap;
register_t *retval;
{

*retval = min((int)p->p_rlimit[RLIMIT_NOFILE].rlim_cur, maxfiles);
return (0);
}
Expand All @@ -115,7 +106,6 @@ ogetdtablesize(p, uap, retval)
void *uap;
register_t *retval;
{

*retval = min((int)p->p_rlimit[RLIMIT_NOFILE].rlim_cur, NOFILE);
return (0);
}
Expand Down Expand Up @@ -200,8 +190,7 @@ dup2(p, uap, retval)
_fdrelse(fdp, i);
goto closeit;
}
}
else {
} else {
struct file **fpp;
char flags;
closeit:
Expand All @@ -214,7 +203,8 @@ dup2(p, uap, retval)
if (*(fpp = &fdp->fd_ofiles[new])) {
struct file *fp = *fpp;

*fpp = NULL; (void) closef(fp, p);
*fpp = NULL;
(void) closef(fp, p);
}
}
return (finishdup(fdp, old, new, retval));
Expand Down Expand Up @@ -972,9 +962,9 @@ ffree(fp)
fp->f_cred = NOCRED;
crfree(cred);
}
#if 1 || DIAGNOSTIC

fp->f_count = 0;
#endif

nfiles--;
FREE_ZONE(fp, sizeof *fp, M_FILE);
}
Expand Down Expand Up @@ -1062,8 +1052,7 @@ fdcopy(p)
*fpp = NULL;
*flags = 0;
}
}
else
} else
(void) memset(newfdp->fd_ofiles, 0, i * OFILESIZE);

return (newfdp);
Expand All @@ -1076,9 +1065,10 @@ void
fdfree(p)
struct proc *p;
{
register struct filedesc *fdp;
register struct file **fpp;
register int i;
struct filedesc *fdp;
struct file **fpp;
int i;
struct vnode *tvp;

if ((fdp = p->p_fd) == NULL)
return;
Expand All @@ -1093,9 +1083,14 @@ fdfree(p)
FREE_ZONE(fdp->fd_ofiles,
fdp->fd_nfiles * OFILESIZE, M_OFILETABL);
}
vrele(fdp->fd_cdir);
if (fdp->fd_rdir)
vrele(fdp->fd_rdir);
tvp = fdp->fd_cdir;
fdp->fd_cdir = NULL;
vrele(tvp);
if (fdp->fd_rdir) {
tvp = fdp->fd_rdir;
fdp->fd_rdir = NULL;
vrele(tvp);
}
FREE_ZONE(fdp, sizeof *fdp, M_FILEDESC);
}

Expand Down
3 changes: 2 additions & 1 deletion bsd/kern/kern_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,10 @@ execve(p, uap, retval)
* root set it.
*/
if (p->p_tracep && !(p->p_traceflag & KTRFAC_ROOT)) {
vrele(p->p_tracep);
struct vnode *tvp = p->p_tracep;
p->p_tracep = NULL;
p->p_traceflag = 0;
vrele(tvp);
}
#endif
if (origvattr.va_mode & VSUID)
Expand Down
35 changes: 25 additions & 10 deletions bsd/kern/kern_exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ proc_exit(struct proc *p)
register struct session *sp = p->p_session;

if (sp->s_ttyvp) {
struct vnode *ttyvp;

/*
* Controlling process.
* Signal foreground pgrp,
Expand All @@ -284,9 +286,10 @@ proc_exit(struct proc *p)
if (sp->s_ttyvp)
VOP_REVOKE(sp->s_ttyvp, REVOKEALL);
}
if (sp->s_ttyvp)
vrele(sp->s_ttyvp);
ttyvp = sp->s_ttyvp;
sp->s_ttyvp = NULL;
if (ttyvp)
vrele(ttyvp);
/*
* s_ttyp is not zero'd; we use this to indicate
* that the session once had a controlling terminal.
Expand All @@ -303,8 +306,11 @@ proc_exit(struct proc *p)
* release trace file
*/
p->p_traceflag = 0; /* don't trace the vrele() */
if (p->p_tracep)
vrele(p->p_tracep);
if (p->p_tracep) {
struct vnode *tvp = p->p_tracep;
p->p_tracep = NULL;
vrele(tvp);
}
#endif


Expand Down Expand Up @@ -520,6 +526,7 @@ wait1(q, uap, retval, compat)
register int nfound;
register struct proc *p, *t;
int status, error;
struct vnode *tvp;

retry:
if (uap->pid == 0)
Expand Down Expand Up @@ -610,8 +617,10 @@ wait1(q, uap, retval, compat)
/*
* Release reference to text vnode
*/
if (p->p_textvp)
vrele(p->p_textvp);
tvp = p->p_textvp;
p->p_textvp = NULL;
if (tvp)
vrele(tvp);

/*
* Finally finished with old proc entry.
Expand Down Expand Up @@ -824,6 +833,8 @@ vproc_exit(struct proc *p)
register struct session *sp = p->p_session;

if (sp->s_ttyvp) {
struct vnode *ttyvp;

/*
* Controlling process.
* Signal foreground pgrp,
Expand All @@ -841,9 +852,10 @@ vproc_exit(struct proc *p)
if (sp->s_ttyvp)
VOP_REVOKE(sp->s_ttyvp, REVOKEALL);
}
if (sp->s_ttyvp)
vrele(sp->s_ttyvp);
ttyvp = sp->s_ttyvp;
sp->s_ttyvp = NULL;
if (ttyvp)
vrele(ttyvp);
/*
* s_ttyp is not zero'd; we use this to indicate
* that the session once had a controlling terminal.
Expand All @@ -860,8 +872,11 @@ vproc_exit(struct proc *p)
* release trace file
*/
p->p_traceflag = 0; /* don't trace the vrele() */
if (p->p_tracep)
vrele(p->p_tracep);
if (p->p_tracep) {
struct vnode *tvp = p->p_tracep;
p->p_tracep = NULL;
vrele(tvp);
}
#endif

q = p->p_children.lh_first;
Expand Down
3 changes: 0 additions & 3 deletions bsd/kern/ubc_subr.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,10 @@ ubc_setsize(struct vnode *vp, off_t nsize)

/*
* Get the size of the file
* For local file systems the size is locally cached. For NFS
* there might be a network transaction for this.
*/
off_t
ubc_getsize(struct vnode *vp)
{
/* XXX deal with NFS */
return (vp->v_ubcinfo->ui_size);
}

Expand Down
Loading

0 comments on commit bfd5905

Please sign in to comment.