Lines Matching refs:fd

260 	int size, ralloc, fd;  in fd_find()  local
265 for (fd = minfd; (uint_t)fd < fip->fi_nfiles; fd |= fd + 1) { in fd_find()
266 size = fd ^ (fd | (fd + 1)); in fd_find()
267 if (fip->fi_list[fd].uf_alloc == size) in fd_find()
270 ralloc += fip->fi_list[fd + size].uf_alloc; in fd_find()
271 if (fip->fi_list[fd].uf_alloc == ralloc + size) { in fd_find()
272 fd += size; in fd_find()
276 return (fd); in fd_find()
282 fd_reserve(uf_info_t *fip, int fd, int incr) in fd_reserve() argument
285 uf_entry_t *ufp = &fip->fi_list[fd]; in fd_reserve()
287 ASSERT((uint_t)fd < fip->fi_nfiles); in fd_reserve()
293 for (pfd = fd; pfd >= 0; pfd = (pfd & (pfd + 1)) - 1) in fd_reserve()
302 int fd; in flist_minsize() local
311 for (fd = fip->fi_nfiles; fd != 0; fd >>= 1) in flist_minsize()
312 if (fip->fi_list[fd >> 1].uf_alloc != 0) in flist_minsize()
315 return (fd); in flist_minsize()
321 int fd; in flist_nalloc() local
327 for (fd = fip->fi_nfiles; fd != 0; fd >>= 1) in flist_nalloc()
328 nalloc += fip->fi_list[fd >> 1].uf_alloc; in flist_nalloc()
492 set_active_fd(int fd) in set_active_fd() argument
502 ASSERT(fd == -1); in set_active_fd()
511 afd->a_fd[i] = fd; in set_active_fd()
519 ASSERT(fd == -1); in set_active_fd()
532 afd->a_fd[i] = fd; in set_active_fd()
542 clear_active_fd(int fd) /* called below and from aio.c */ in clear_active_fd() argument
548 if (afd->a_fd[i] == fd) { in clear_active_fd()
560 is_active_fd(kthread_t *t, int fd) in is_active_fd() argument
569 if (afd->a_fd[i] == fd) { in is_active_fd()
584 getf_gen(int fd, uf_entry_gen_t *genp) in getf_gen() argument
590 if ((uint_t)fd >= fip->fi_nfiles) in getf_gen()
599 UF_ENTER(ufp, fip, fd); in getf_gen()
604 if (fd == fip->fi_badfd && fip->fi_action > 0) in getf_gen()
614 set_active_fd(fd); /* record the active file descriptor */ in getf_gen()
622 getf(int fd) in getf() argument
624 return (getf_gen(fd, NULL)); in getf()
636 closeandsetf(int fd, file_t *newfp) in closeandsetf() argument
646 if ((uint_t)fd >= fip->fi_nfiles) { in closeandsetf()
649 flist_grow(fd); in closeandsetf()
660 if (fd == fip->fi_badfd) { in closeandsetf()
666 UF_ENTER(ufp, fip, fd); in closeandsetf()
672 UF_ENTER(ufp, fip, fd); in closeandsetf()
677 fd_reserve(fip, fd, 1); in closeandsetf()
686 UF_ENTER(ufp, fip, fd); in closeandsetf()
734 UF_ENTER(ufp, fip, fd); in closeandsetf()
741 if (is_active_fd(t, fd)) { in closeandsetf()
757 UF_ENTER(ufp, fip, fd); in closeandsetf()
772 UF_ENTER(ufp, fip, fd); in closeandsetf()
800 pollcacheclean(fpip, fd); in closeandsetf()
809 setf(fd, newfp); in closeandsetf()
819 releasef(int fd) in releasef() argument
824 UF_ENTER(ufp, fip, fd); in releasef()
826 clear_active_fd(fd); /* clear the active file descriptor */ in releasef()
836 areleasef(int fd, uf_info_t *fip) in areleasef() argument
840 UF_ENTER(ufp, fip, fd); in areleasef()
853 int fd, nfiles; in flist_fork() local
868 for (fd = 0, pufp = pfip->fi_list, cufp = cfip->fi_list; fd < nfiles; in flist_fork()
869 fd++, pufp++, cufp++) { in flist_fork()
883 fd_reserve(cfip, fd, -1); in flist_fork()
899 int fd; in closeall() local
904 for (fd = 0; fd < fip->fi_nfiles; fd++, ufp++) { in closeall()
1006 int fd; in ufalloc_file() local
1017 fd = fd_find(fip, start); in ufalloc_file()
1018 if (fd >= 0 && fd == fip->fi_badfd) { in ufalloc_file()
1019 start = fd + 1; in ufalloc_file()
1023 if ((uint_t)fd < filelimit) in ufalloc_file()
1025 if (fd >= filelimit) { in ufalloc_file()
1039 UF_ENTER(ufp, fip, fd); in ufalloc_file()
1040 fd_reserve(fip, fd, 1); in ufalloc_file()
1048 return (fd); in ufalloc_file()
1108 int fd; in falloc() local
1111 if ((fd = ufalloc(0)) == -1) in falloc()
1133 *fdp = fd; in falloc()
1185 setf(int fd, file_t *fp) in setf() argument
1191 audit_setf(fp, fd); in setf()
1195 UF_ENTER(ufp, fip, fd); in setf()
1196 fd_reserve(fip, fd, -1); in setf()
1199 UF_ENTER(ufp, fip, fd); in setf()
1216 f_getfl(int fd, int *flagp) in f_getfl() argument
1223 if ((uint_t)fd >= fip->fi_nfiles) in f_getfl()
1226 UF_ENTER(ufp, fip, fd); in f_getfl()
1253 f_getfd_error(int fd, int *flagp) in f_getfd_error() argument
1261 if ((uint_t)fd >= fip->fi_nfiles) in f_getfd_error()
1264 UF_ENTER(ufp, fip, fd); in f_getfd_error()
1284 f_getfd(int fd) in f_getfd() argument
1287 (void) f_getfd_error(fd, &flag); in f_getfd()
1297 f_setfd_error(int fd, int flags) in f_setfd_error() argument
1303 if ((uint_t)fd >= fip->fi_nfiles) in f_setfd_error()
1306 UF_ENTER(ufp, fip, fd); in f_setfd_error()
1319 f_setfd(int fd, char flags) in f_setfd() argument
1321 (void) f_setfd_error(fd, flags); in f_setfd()
1395 int fd; in fassign() local
1397 if (error = falloc((vnode_t *)NULL, mode, &fp, &fd)) in fassign()
1400 setf(fd, NULL); in fassign()
1409 setf(fd, fp); in fassign()
1410 *fdp = fd; in fassign()
1447 int fd; in close_exec() local
1454 for (fd = 0; fd < fip->fi_nfiles; fd++, ufp++) { in close_exec()
1461 fd_reserve(fip, fd, -1); in close_exec()
1483 pollcacheclean(fpip, fd); in close_exec()
1507 fgetstartvp(int fd, char *path, vnode_t **startvpp) in fgetstartvp() argument
1513 if (fd == AT_FDCWD && path == NULL) in fgetstartvp()
1516 if (fd == AT_FDCWD) { in fgetstartvp()
1537 if ((startfp = getf(fd)) == NULL) in fgetstartvp()
1541 releasef(fd); in fgetstartvp()
1553 fsetattrat(int fd, char *path, int flags, struct vattr *vap) in fsetattrat() argument
1565 if ((error = fgetstartvp(fd, path, &startvp)) != 0) in fsetattrat()
1610 int fd; in fisopen() local
1617 for (fd = 0; fd < fip->fi_nfiles; fd++) { in fisopen()
1618 UF_ENTER(ufp, fip, fd); in fisopen()
1638 int fd; in files_can_change_zones() local
1644 for (fd = 0; fd < fip->fi_nfiles; fd++) { in files_can_change_zones()
1645 UF_ENTER(ufp, fip, fd); in files_can_change_zones()
1688 int fd; in checkfpollinfo() local
1693 for (fd = 0; fd < fip->fi_nfiles; fd++) { in checkfpollinfo()
1694 UF_ENTER(ufp, fip, fd); in checkfpollinfo()
1708 infpollinfo(int fd) in infpollinfo() argument
1714 UF_ENTER(ufp, fip, fd); in infpollinfo()
1728 addfpollinfo(int fd) in addfpollinfo() argument
1736 UF_ENTER(ufp, fip, fd); in addfpollinfo()
1755 delfpollinfo(int fd) in delfpollinfo() argument
1762 UF_ENTER(ufp, fip, fd); in delfpollinfo()
1786 addfd_port(int fd, portfd_t *pfd) in addfd_port() argument
1791 UF_ENTER(ufp, fip, fd); in addfd_port()
1809 delfd_port(int fd, portfd_t *pfd) in delfd_port() argument
1814 UF_ENTER(ufp, fip, fd); in delfd_port()