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

Function getsock_cap

freebsd/kern/uipc_syscalls.c:96–116  ·  view source on GitHub ↗

* Convert a user file descriptor to a kernel file entry and check if required * capability rights are present. * If required copy of current set of capability rights is returned. * A reference on the file entry is held upon returning. */

Source from the content-addressed store, hash-verified

94 * A reference on the file entry is held upon returning.
95 */
96int
97getsock_cap(struct thread *td, int fd, cap_rights_t *rightsp,
98 struct file **fpp, u_int *fflagp, struct filecaps *havecapsp)
99{
100 struct file *fp;
101 int error;
102
103 error = fget_cap(td, fd, rightsp, &fp, havecapsp);
104 if (error != 0)
105 return (error);
106 if (fp->f_type != DTYPE_SOCKET) {
107 fdrop(fp, td);
108 if (havecapsp != NULL)
109 filecaps_free(havecapsp);
110 return (ENOTSOCK);
111 }
112 if (fflagp != NULL)
113 *fflagp = fp->f_flag;
114 *fpp = fp;
115 return (0);
116}
117
118/*
119 * System call interface to the socket abstraction.

Callers 15

sys_sctp_peeloffFunction · 0.85
sys_sctp_generic_sendmsgFunction · 0.85
sys_sctp_generic_recvmsgFunction · 0.85
sendfile_getsockFunction · 0.85
uipc_syscalls.cFile · 0.85
kern_listenFunction · 0.85
kern_accept4Function · 0.85
kern_connectatFunction · 0.85
kern_senditFunction · 0.85
kern_recvitFunction · 0.85
kern_shutdownFunction · 0.85

Calls 2

fget_capFunction · 0.85
filecaps_freeFunction · 0.85

Tested by

no test coverage detected