* System call to enter capability mode for the process. */
| 99 | * System call to enter capability mode for the process. |
| 100 | */ |
| 101 | int |
| 102 | sys_cap_enter(struct thread *td, struct cap_enter_args *uap) |
| 103 | { |
| 104 | struct ucred *newcred, *oldcred; |
| 105 | struct proc *p; |
| 106 | |
| 107 | if (IN_CAPABILITY_MODE(td)) |
| 108 | return (0); |
| 109 | |
| 110 | newcred = crget(); |
| 111 | p = td->td_proc; |
| 112 | PROC_LOCK(p); |
| 113 | oldcred = crcopysafe(p, newcred); |
| 114 | newcred->cr_flags |= CRED_FLAG_CAPMODE; |
| 115 | proc_set_cred(p, newcred); |
| 116 | PROC_UNLOCK(p); |
| 117 | crfree(oldcred); |
| 118 | return (0); |
| 119 | } |
| 120 | |
| 121 | /* |
| 122 | * System call to query whether the process is in capability mode. |
no test coverage detected