Nifty idea from Jeroen van Gelderen; don't call a routine to check if

we are using the /dev/zero device, just check a flag (supplied by
/dev/zero).
Reviewed by:	dfr
This commit is contained in:
Mark Murray 2000-06-25 09:44:32 +00:00
parent 3fce691075
commit 2589f2499d
1 changed files with 2 additions and 1 deletions

View File

@ -299,7 +299,8 @@ mmap(p, uap)
* XXX hack to handle use of /dev/zero to map anon memory (ala
* SunOS).
*/
if (vp->v_type == VCHR && iszerodev(vp->v_rdev)) {
if ((vp->v_type == VCHR) &&
(vp->v_rdev->si_devsw->d_flags & D_MMAP_ANON)) {
handle = NULL;
maxprot = VM_PROT_ALL;
flags |= MAP_ANON;