* sysv_shm.cc (vm_object_reference): remove Cygwin specific define.
(vm_map_find): Ditto. (vm_map_inherit): Ditto. (kern_shmat): On Cygwin, take shmaddr just as is. Don't call vm system calls on Cygwin. Add comment.
This commit is contained in:
		| @@ -1,3 +1,11 @@ | |||||||
|  | 2004-09-21  Corinna Vinschen  <corinna@vinschen.de> | ||||||
|  |  | ||||||
|  | 	* sysv_shm.cc (vm_object_reference): remove Cygwin specific define. | ||||||
|  | 	(vm_map_find): Ditto. | ||||||
|  | 	(vm_map_inherit): Ditto. | ||||||
|  | 	(kern_shmat): On Cygwin, take shmaddr just as is.  Don't call vm | ||||||
|  | 	system calls on Cygwin.  Add comment. | ||||||
|  |  | ||||||
| 2004-09-15  Corinna Vinschen  <corinna@vinschen.de> | 2004-09-15  Corinna Vinschen  <corinna@vinschen.de> | ||||||
|  |  | ||||||
| 	Fix copyright throughout.  | 	Fix copyright throughout.  | ||||||
|   | |||||||
| @@ -80,10 +80,7 @@ __FBSDID("$FreeBSD: /repoman/r/ncvs/src/sys/kern/sysv_shm.c,v 1.89 2003/11/07 04 | |||||||
| #define vm_object_clear_flag(a,b) | #define vm_object_clear_flag(a,b) | ||||||
| #define vm_object_set_flag(a,b) | #define vm_object_set_flag(a,b) | ||||||
| #define VM_OBJECT_UNLOCK(a) | #define VM_OBJECT_UNLOCK(a) | ||||||
| #define vm_object_reference(a) |  | ||||||
| #define vm_map_remove(a,b,c) KERN_SUCCESS | #define vm_map_remove(a,b,c) KERN_SUCCESS | ||||||
| #define vm_map_find(a,b,c,d,e,f,g,h,i) KERN_SUCCESS |  | ||||||
| #define vm_map_inherit(a,b,c,d) |  | ||||||
| typedef int vm_prot_t; | typedef int vm_prot_t; | ||||||
| #endif /* __CYGWIN__ */ | #endif /* __CYGWIN__ */ | ||||||
|  |  | ||||||
| @@ -383,6 +380,13 @@ kern_shmat(struct thread *td, int shmid, const void *shmaddr, int shmflg) | |||||||
| 		prot |= VM_PROT_WRITE; | 		prot |= VM_PROT_WRITE; | ||||||
| 	flags = MAP_ANON | MAP_SHARED; | 	flags = MAP_ANON | MAP_SHARED; | ||||||
| 	debug_printf ("shmaddr: %x, shmflg: %x", shmaddr, shmflg); | 	debug_printf ("shmaddr: %x, shmflg: %x", shmaddr, shmflg); | ||||||
|  | #ifdef __CYGWIN__ | ||||||
|  | 	/* The alignment checks have already been made in the Cygwin DLL | ||||||
|  | 	   and shmat's only job is to keep record of the attached mem. | ||||||
|  | 	   These checks break shm on 9x since MapViewOfFileEx apparently | ||||||
|  | 	   returns memory which isn't aligned to SHMLBA.  Go figure!  */ | ||||||
|  | 	attach_va = (vm_offset_t)shmaddr; | ||||||
|  | #else | ||||||
| 	if (shmaddr) { | 	if (shmaddr) { | ||||||
| 		flags |= MAP_FIXED; | 		flags |= MAP_FIXED; | ||||||
| 		if (shmflg & SHM_RND) { | 		if (shmflg & SHM_RND) { | ||||||
| @@ -390,7 +394,6 @@ kern_shmat(struct thread *td, int shmid, const void *shmaddr, int shmflg) | |||||||
| 		} else if (((vm_offset_t)shmaddr & (SHMLBA-1)) == 0) { | 		} else if (((vm_offset_t)shmaddr & (SHMLBA-1)) == 0) { | ||||||
| 			attach_va = (vm_offset_t)shmaddr; | 			attach_va = (vm_offset_t)shmaddr; | ||||||
| 		} else { | 		} else { | ||||||
| 			debug_printf ("Odd shmaddr: EINVAL"); |  | ||||||
| 			error = EINVAL; | 			error = EINVAL; | ||||||
| 			goto done2; | 			goto done2; | ||||||
| 		} | 		} | ||||||
| @@ -399,12 +402,8 @@ kern_shmat(struct thread *td, int shmid, const void *shmaddr, int shmflg) | |||||||
| 		 * This is just a hint to vm_map_find() about where to | 		 * This is just a hint to vm_map_find() about where to | ||||||
| 		 * put it. | 		 * put it. | ||||||
| 		 */ | 		 */ | ||||||
| #ifdef __CYGWIN__ |  | ||||||
| 		attach_va = 0; |  | ||||||
| #else |  | ||||||
| 		attach_va = round_page((vm_offset_t)p->p_vmspace->vm_taddr | 		attach_va = round_page((vm_offset_t)p->p_vmspace->vm_taddr | ||||||
| 		    + maxtsiz + maxdsiz); | 		    + maxtsiz + maxdsiz); | ||||||
| #endif |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	shm_handle = shmseg->shm_internal; | 	shm_handle = shmseg->shm_internal; | ||||||
| @@ -417,6 +416,7 @@ kern_shmat(struct thread *td, int shmid, const void *shmaddr, int shmflg) | |||||||
| 	} | 	} | ||||||
| 	vm_map_inherit(&p->p_vmspace->vm_map, | 	vm_map_inherit(&p->p_vmspace->vm_map, | ||||||
| 		attach_va, attach_va + size, VM_INHERIT_SHARE); | 		attach_va, attach_va + size, VM_INHERIT_SHARE); | ||||||
|  | #endif | ||||||
|  |  | ||||||
| 	shmmap_s->va = attach_va; | 	shmmap_s->va = attach_va; | ||||||
| 	shmmap_s->shmid = shmid; | 	shmmap_s->shmid = shmid; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user