--- 2.3.47/ipc/shm.c Wed Mar 1 10:33:26 2000 +++ make48/ipc/shm.c Wed Mar 1 12:54:49 2000 @@ -11,6 +11,7 @@ * HIGHMEM support, Ingo Molnar * avoid vmalloc and make shmmax, shmall, shmmni sysctl'able, * Christoph Rohland + * Shared /dev/zero support, Kanoj Sarcar */ #include @@ -1100,3 +1101,24 @@ return len; } #endif + +int map_zero_setup(struct vm_area_struct *vma) +{ + int shmid; + struct shmid_kernel *shp; + + down(&shm_ids.sem); + shmid = newseg(IPC_PRIVATE, S_IRWXUGO, vma->vm_end - vma->vm_start); + up(&shm_ids.sem); + if (shmid < 0) + return shmid; + + if (!(shp = shm_lock (shmid))) + BUG(); + shp->shm_perm.mode |= SHM_DEST; + shm_unlock (shmid); + vma->vm_private_data = shp; + vma->vm_ops = &shm_vm_ops; + shm_open (vma); + return 0; +}