MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sys_cap_enter

Function sys_cap_enter

freebsd/kern/sys_capability.c:101–119  ·  view source on GitHub ↗

* System call to enter capability mode for the process. */

Source from the content-addressed store, hash-verified

99 * System call to enter capability mode for the process.
100 */
101int
102sys_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.

Callers 1

do_execveFunction · 0.85

Calls 4

crcopysafeFunction · 0.85
proc_set_credFunction · 0.85
crgetFunction · 0.70
crfreeFunction · 0.70

Tested by

no test coverage detected