* 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. */
| 94 | * A reference on the file entry is held upon returning. |
| 95 | */ |
| 96 | int |
| 97 | getsock_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. |
no test coverage detected