sys_capability.c (75e9b455a9044b4162e264a56f2b9ef8c78534e2) | sys_capability.c (acbde29858530248556cea9a363660c48db383f0) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2008-2011 Robert N. M. Watson 5 * Copyright (c) 2010-2011 Jonathan Anderson 6 * Copyright (c) 2012 FreeBSD Foundation 7 * All rights reserved. 8 * --- 169 unchanged lines hidden (view full) --- 178 179 return (_cap_check(havep, needp, CAPFAIL_NOTCAPABLE)); 180} 181 182/* 183 * Convert capability rights into VM access flags. 184 */ 185u_char | 1/*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2008-2011 Robert N. M. Watson 5 * Copyright (c) 2010-2011 Jonathan Anderson 6 * Copyright (c) 2012 FreeBSD Foundation 7 * All rights reserved. 8 * --- 169 unchanged lines hidden (view full) --- 178 179 return (_cap_check(havep, needp, CAPFAIL_NOTCAPABLE)); 180} 181 182/* 183 * Convert capability rights into VM access flags. 184 */ 185u_char |
186cap_rights_to_vmprot(cap_rights_t *havep) | 186cap_rights_to_vmprot(const cap_rights_t *havep) |
187{ 188 u_char maxprot; 189 190 maxprot = VM_PROT_NONE; 191 if (cap_rights_is_set(havep, CAP_MMAP_R)) 192 maxprot |= VM_PROT_READ; 193 if (cap_rights_is_set(havep, CAP_MMAP_W)) 194 maxprot |= VM_PROT_WRITE; --- 4 unchanged lines hidden (view full) --- 199} 200 201/* 202 * Extract rights from a capability for monitoring purposes -- not for use in 203 * any other way, as we want to keep all capability permission evaluation in 204 * this one file. 205 */ 206 | 187{ 188 u_char maxprot; 189 190 maxprot = VM_PROT_NONE; 191 if (cap_rights_is_set(havep, CAP_MMAP_R)) 192 maxprot |= VM_PROT_READ; 193 if (cap_rights_is_set(havep, CAP_MMAP_W)) 194 maxprot |= VM_PROT_WRITE; --- 4 unchanged lines hidden (view full) --- 199} 200 201/* 202 * Extract rights from a capability for monitoring purposes -- not for use in 203 * any other way, as we want to keep all capability permission evaluation in 204 * this one file. 205 */ 206 |
207cap_rights_t * 208cap_rights_fde(struct filedescent *fdep) | 207const cap_rights_t * 208cap_rights_fde(const struct filedescent *fdep) |
209{ 210 211 return (&fdep->fde_rights); 212} 213 | 209{ 210 211 return (&fdep->fde_rights); 212} 213 |
214cap_rights_t * | 214const cap_rights_t * |
215cap_rights(struct filedesc *fdp, int fd) 216{ 217 218 return (cap_rights_fde(&fdp->fd_ofiles[fd])); 219} 220 221int 222kern_cap_rights_limit(struct thread *td, int fd, cap_rights_t *rights) --- 447 unchanged lines hidden --- | 215cap_rights(struct filedesc *fdp, int fd) 216{ 217 218 return (cap_rights_fde(&fdp->fd_ofiles[fd])); 219} 220 221int 222kern_cap_rights_limit(struct thread *td, int fd, cap_rights_t *rights) --- 447 unchanged lines hidden --- |