uipc_shm.c (180059) | uipc_shm.c (184413) |
---|---|
1/*- 2 * Copyright (c) 2006 Robert N. M. Watson 3 * 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 --- 39 unchanged lines hidden (view full) --- 48 * swapped back in for us? 49 * 50 * (6) Add MAC support in mac_biba(4) and mac_mls(4). 51 * 52 * (7) Add a MAC check_create() hook for creating new named objects. 53 */ 54 55#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2006 Robert N. M. Watson 3 * 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 --- 39 unchanged lines hidden (view full) --- 48 * swapped back in for us? 49 * 50 * (6) Add MAC support in mac_biba(4) and mac_mls(4). 51 * 52 * (7) Add a MAC check_create() hook for creating new named objects. 53 */ 54 55#include <sys/cdefs.h> |
56__FBSDID("$FreeBSD: head/sys/kern/uipc_shm.c 180059 2008-06-27 05:39:04Z jhb $"); | 56__FBSDID("$FreeBSD: head/sys/kern/uipc_shm.c 184413 2008-10-28 13:44:11Z trasz $"); |
57 58#include "opt_mac.h" 59 60#include <sys/param.h> 61#include <sys/fcntl.h> 62#include <sys/file.h> 63#include <sys/filedesc.h> 64#include <sys/fnv_hash.h> --- 297 unchanged lines hidden (view full) --- 362 363/* 364 * Determine if the credentials have sufficient permissions for a 365 * specified combination of FREAD and FWRITE. 366 */ 367static int 368shm_access(struct shmfd *shmfd, struct ucred *ucred, int flags) 369{ | 57 58#include "opt_mac.h" 59 60#include <sys/param.h> 61#include <sys/fcntl.h> 62#include <sys/file.h> 63#include <sys/filedesc.h> 64#include <sys/fnv_hash.h> --- 297 unchanged lines hidden (view full) --- 362 363/* 364 * Determine if the credentials have sufficient permissions for a 365 * specified combination of FREAD and FWRITE. 366 */ 367static int 368shm_access(struct shmfd *shmfd, struct ucred *ucred, int flags) 369{ |
370 int acc_mode; | 370 accmode_t accmode; |
371 | 371 |
372 acc_mode = 0; | 372 accmode = 0; |
373 if (flags & FREAD) | 373 if (flags & FREAD) |
374 acc_mode |= VREAD; | 374 accmode |= VREAD; |
375 if (flags & FWRITE) | 375 if (flags & FWRITE) |
376 acc_mode |= VWRITE; | 376 accmode |= VWRITE; |
377 return (vaccess(VREG, shmfd->shm_mode, shmfd->shm_uid, shmfd->shm_gid, | 377 return (vaccess(VREG, shmfd->shm_mode, shmfd->shm_uid, shmfd->shm_gid, |
378 acc_mode, ucred, NULL)); | 378 accmode, ucred, NULL)); |
379} 380 381/* 382 * Dictionary management. We maintain an in-kernel dictionary to map 383 * paths to shmfd objects. We use the FNV hash on the path to store 384 * the mappings in a hash table. 385 */ 386static void --- 231 unchanged lines hidden --- | 379} 380 381/* 382 * Dictionary management. We maintain an in-kernel dictionary to map 383 * paths to shmfd objects. We use the FNV hash on the path to store 384 * the mappings in a hash table. 385 */ 386static void --- 231 unchanged lines hidden --- |