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

Function fdallocn

freebsd/kern/kern_descrip.c:1953–1973  ·  view source on GitHub ↗

* Allocate n file descriptors for the process. */

Source from the content-addressed store, hash-verified

1951 * Allocate n file descriptors for the process.
1952 */
1953int
1954fdallocn(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

Callers 1

unp_externalizeFunction · 0.85

Calls 2

fdallocFunction · 0.85
fdunusedFunction · 0.85

Tested by

no test coverage detected