sysv_shm.c (219028) | sysv_shm.c (220388) |
---|---|
1/* $NetBSD: sysv_shm.c,v 1.23 1994/07/04 23:25:12 glass Exp $ */ 2/*- 3 * Copyright (c) 1994 Adam Glass and Charles Hannum. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 46 unchanged lines hidden (view full) --- 55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 59 * SUCH DAMAGE. 60 */ 61 62#include <sys/cdefs.h> | 1/* $NetBSD: sysv_shm.c,v 1.23 1994/07/04 23:25:12 glass Exp $ */ 2/*- 3 * Copyright (c) 1994 Adam Glass and Charles Hannum. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 46 unchanged lines hidden (view full) --- 55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 59 * SUCH DAMAGE. 60 */ 61 62#include <sys/cdefs.h> |
63__FBSDID("$FreeBSD: head/sys/kern/sysv_shm.c 219028 2011-02-25 10:11:01Z netchild $"); | 63__FBSDID("$FreeBSD: head/sys/kern/sysv_shm.c 220388 2011-04-06 16:59:54Z trasz $"); |
64 65#include "opt_compat.h" 66#include "opt_sysvipc.h" 67 68#include <sys/param.h> 69#include <sys/systm.h> 70#include <sys/kernel.h> 71#include <sys/limits.h> --- 169 unchanged lines hidden (view full) --- 241 shmseg->object = NULL; 242 size = round_page(shmseg->u.shm_segsz); 243 shm_committed -= btoc(size); 244 shm_nused--; 245 shmseg->u.shm_perm.mode = SHMSEG_FREE; 246#ifdef MAC 247 mac_sysvshm_cleanup(shmseg); 248#endif | 64 65#include "opt_compat.h" 66#include "opt_sysvipc.h" 67 68#include <sys/param.h> 69#include <sys/systm.h> 70#include <sys/kernel.h> 71#include <sys/limits.h> --- 169 unchanged lines hidden (view full) --- 241 shmseg->object = NULL; 242 size = round_page(shmseg->u.shm_segsz); 243 shm_committed -= btoc(size); 244 shm_nused--; 245 shmseg->u.shm_perm.mode = SHMSEG_FREE; 246#ifdef MAC 247 mac_sysvshm_cleanup(shmseg); 248#endif |
249 crfree(shmseg->cred); 250 shmseg->cred = NULL; |
|
249} 250 251static int 252shm_delete_mapping(struct vmspace *vm, struct shmmap_state *shmmap_s) 253{ 254 struct shmid_kernel *shmseg; 255 int segnum, result; 256 vm_size_t size; --- 432 unchanged lines hidden (view full) --- 689 vm_object_set_flag(shm_object, OBJ_NOSPLIT); 690 VM_OBJECT_UNLOCK(shm_object); 691 692 shmseg->object = shm_object; 693 shmseg->u.shm_perm.cuid = shmseg->u.shm_perm.uid = cred->cr_uid; 694 shmseg->u.shm_perm.cgid = shmseg->u.shm_perm.gid = cred->cr_gid; 695 shmseg->u.shm_perm.mode = (shmseg->u.shm_perm.mode & SHMSEG_WANTED) | 696 (mode & ACCESSPERMS) | SHMSEG_ALLOCATED; | 251} 252 253static int 254shm_delete_mapping(struct vmspace *vm, struct shmmap_state *shmmap_s) 255{ 256 struct shmid_kernel *shmseg; 257 int segnum, result; 258 vm_size_t size; --- 432 unchanged lines hidden (view full) --- 691 vm_object_set_flag(shm_object, OBJ_NOSPLIT); 692 VM_OBJECT_UNLOCK(shm_object); 693 694 shmseg->object = shm_object; 695 shmseg->u.shm_perm.cuid = shmseg->u.shm_perm.uid = cred->cr_uid; 696 shmseg->u.shm_perm.cgid = shmseg->u.shm_perm.gid = cred->cr_gid; 697 shmseg->u.shm_perm.mode = (shmseg->u.shm_perm.mode & SHMSEG_WANTED) | 698 (mode & ACCESSPERMS) | SHMSEG_ALLOCATED; |
699 crhold(cred); 700 shmseg->cred = cred; |
|
697 shmseg->u.shm_segsz = uap->size; 698 shmseg->u.shm_cpid = td->td_proc->p_pid; 699 shmseg->u.shm_lpid = shmseg->u.shm_nattch = 0; 700 shmseg->u.shm_atime = shmseg->u.shm_dtime = 0; 701#ifdef MAC 702 mac_sysvshm_create(cred, shmseg); 703#endif 704 shmseg->u.shm_ctime = time_second; --- 678 unchanged lines hidden --- | 701 shmseg->u.shm_segsz = uap->size; 702 shmseg->u.shm_cpid = td->td_proc->p_pid; 703 shmseg->u.shm_lpid = shmseg->u.shm_nattch = 0; 704 shmseg->u.shm_atime = shmseg->u.shm_dtime = 0; 705#ifdef MAC 706 mac_sysvshm_create(cred, shmseg); 707#endif 708 shmseg->u.shm_ctime = time_second; --- 678 unchanged lines hidden --- |