* Allocate n file descriptors for the process. */
| 1951 | * Allocate n file descriptors for the process. |
| 1952 | */ |
| 1953 | int |
| 1954 | fdallocn(struct thread *td, int minfd, int *fds, int n) |
| 1955 | { |
| 1956 | struct proc *p = td->td_proc; |
| 1957 | struct filedesc *fdp = p->p_fd; |
| 1958 | int i; |
| 1959 | |
| 1960 | FILEDESC_XLOCK_ASSERT(fdp); |
| 1961 | |
| 1962 | for (i = 0; i < n; i++) |
| 1963 | if (fdalloc(td, 0, &fds[i]) != 0) |
| 1964 | break; |
| 1965 | |
| 1966 | if (i < n) { |
| 1967 | for (i--; i >= 0; i--) |
| 1968 | fdunused(fdp, fds[i]); |
| 1969 | return (EMFILE); |
| 1970 | } |
| 1971 | |
| 1972 | return (0); |
| 1973 | } |
| 1974 | |
| 1975 | /* |
| 1976 | * Create a new open file structure and allocate a file descriptor for the |
no test coverage detected