* Install a file in a file descriptor table. */
| 2056 | * Install a file in a file descriptor table. |
| 2057 | */ |
| 2058 | void |
| 2059 | _finstall(struct filedesc *fdp, struct file *fp, int fd, int flags, |
| 2060 | struct filecaps *fcaps) |
| 2061 | { |
| 2062 | struct filedescent *fde; |
| 2063 | |
| 2064 | MPASS(fp != NULL); |
| 2065 | if (fcaps != NULL) |
| 2066 | filecaps_validate(fcaps, __func__); |
| 2067 | FILEDESC_XLOCK_ASSERT(fdp); |
| 2068 | |
| 2069 | fde = &fdp->fd_ofiles[fd]; |
| 2070 | #ifdef CAPABILITIES |
| 2071 | seqc_write_begin(&fde->fde_seqc); |
| 2072 | #endif |
| 2073 | fde->fde_file = fp; |
| 2074 | fde->fde_flags = (flags & O_CLOEXEC) != 0 ? UF_EXCLOSE : 0; |
| 2075 | if (fcaps != NULL) |
| 2076 | filecaps_move(fcaps, &fde->fde_caps); |
| 2077 | else |
| 2078 | filecaps_fill(&fde->fde_caps); |
| 2079 | #ifdef CAPABILITIES |
| 2080 | seqc_write_end(&fde->fde_seqc); |
| 2081 | #endif |
| 2082 | } |
| 2083 | |
| 2084 | int |
| 2085 | finstall_refed(struct thread *td, struct file *fp, int *fd, int flags, |
no test coverage detected