Lines Matching refs:fdp

129     struct filedesc *fdp, int old, int new, int flags, int32_t *retval);
342 * Parameters: fdp Pointer to filedesc fd lies in
348 * Locks: Assumes proc_fdlock for process pointing to fdp is held by
354 struct filedesc *fdp = p->p_fd;
357 if (fd < fdp->fd_freefile)
358 fdp->fd_freefile = fd;
360 if (fd > fdp->fd_lastfile)
365 while ((nfd = fdp->fd_lastfile) > 0 &&
366 fdp->fd_ofiles[nfd] == NULL &&
367 !(fdp->fd_ofileflags[nfd] & UF_RESERVED))
368 fdp->fd_lastfile--;
466 struct filedesc *fdp = p->p_fd;
481 error = finishdup(p, fdp, old, new, 0, retval);
507 struct filedesc *fdp = p->p_fd;
532 if (new < 0 || new >= fdp->fd_nfiles) {
544 while ((fdp->fd_ofileflags[new] & UF_RESERVED) == UF_RESERVED) {
553 if ((fdp->fd_ofiles[new] != NULL) &&
564 if (fdp->fd_ofiles[new] != NULL)
576 if (fdp->fd_ofiles[new] != 0)
578 if ((fdp->fd_ofileflags[new] & UF_RESERVED) == 0)
581 error = finishdup(p, fdp, old, new, 0, retval);
675 struct filedesc *fdp = p->p_fd;
717 pop = &fdp->fd_ofileflags[fd];
739 error = finishdup(p, fdp, fd, i,
1437 cmode = ((fopen.o_mode &~ fdp->fd_cmask) & ALLPERMS) & ~S_ISTXT;
2150 * Locks: Assumes proc_fdlock for process pointing to fdp is held by
2159 struct filedesc *fdp, int old, int new, int fd_flags, int32_t *retval)
2170 if ((ofp = fdp->fd_ofiles[old]) == NULL ||
2171 (fdp->fd_ofileflags[old] & UF_RESERVED)) {
2206 if (fdp->fd_ofiles[new] != 0)
2208 if ((fdp->fd_ofileflags[new] & UF_RESERVED) == 0)
2212 if (new > fdp->fd_lastfile)
2213 fdp->fd_lastfile = new;
2295 struct filedesc *fdp = p->p_fd;
2314 if ((fdp->fd_ofileflags[fd] & UF_RESERVED) == 0)
2347 if (fd < fdp->fd_knlistsize)
2375 if ((fdp->fd_ofileflags[fd] & UF_RESERVED) == 0)
2759 struct filedesc *fdp = p->p_fd;
2776 last = min(fdp->fd_nfiles, lim);
2777 if ((i = want) < fdp->fd_freefile)
2778 i = fdp->fd_freefile;
2780 if (fdp->fd_ofiles[i] == NULL && !(fdp->fd_ofileflags[i] & UF_RESERVED)) {
2782 if (i > fdp->fd_lastfile)
2783 fdp->fd_lastfile = i;
2784 if (want <= fdp->fd_freefile)
2785 fdp->fd_freefile = i;
2794 if (fdp->fd_nfiles >= lim)
2796 if (fdp->fd_nfiles < NDEXTENT)
2799 numfiles = 2 * fdp->fd_nfiles;
2810 if (fdp->fd_nfiles >= numfiles) {
2819 oldnfiles = fdp->fd_nfiles;
2820 (void) memcpy(newofiles, fdp->fd_ofiles,
2821 oldnfiles * sizeof(*fdp->fd_ofiles));
2823 (numfiles - oldnfiles) * sizeof(*fdp->fd_ofiles));
2825 (void) memcpy(newofileflags, fdp->fd_ofileflags,
2826 oldnfiles * sizeof(*fdp->fd_ofileflags));
2829 sizeof(*fdp->fd_ofileflags));
2830 ofiles = fdp->fd_ofiles;
2831 fdp->fd_ofiles = newofiles;
2832 fdp->fd_ofileflags = newofileflags;
2833 fdp->fd_nfiles = numfiles;
2860 struct filedesc *fdp = p->p_fd;
2866 if ((i = lim - fdp->fd_nfiles) > 0 && (n -= i) <= 0)
2868 fpp = &fdp->fd_ofiles[fdp->fd_freefile];
2869 flags = &fdp->fd_ofileflags[fdp->fd_freefile];
2870 for (i = fdp->fd_nfiles - fdp->fd_freefile; --i >= 0; fpp++, flags++)
2921 struct filedesc *fdp = p->p_fd;
2924 if (fd < 0 || fd >= fdp->fd_nfiles ||
2925 (fp = fdp->fd_ofiles[fd]) == NULL ||
2926 (fdp->fd_ofileflags[fd] & UF_RESERVED)) {
2965 struct filedesc *fdp = p->p_fd;
2969 if (fd < 0 || fd >= fdp->fd_nfiles ||
2970 (fp = fdp->fd_ofiles[fd]) == NULL ||
2971 (fdp->fd_ofileflags[fd] & UF_RESERVED)) {
3024 struct filedesc *fdp = p->p_fd;
3028 if (fd < 0 || fd >= fdp->fd_nfiles ||
3029 (fp = fdp->fd_ofiles[fd]) == NULL ||
3030 (fdp->fd_ofileflags[fd] & UF_RESERVED)) {
3081 struct filedesc *fdp = p->p_fd;
3085 if (fd < 0 || fd >= fdp->fd_nfiles ||
3086 (fp = fdp->fd_ofiles[fd]) == NULL ||
3087 (fdp->fd_ofileflags[fd] & UF_RESERVED)) {
3136 struct filedesc *fdp = p->p_fd;
3140 if ( fd < 0 || fd >= fdp->fd_nfiles ||
3141 (fp = fdp->fd_ofiles[fd]) == NULL ||
3142 (fdp->fd_ofileflags[fd] & UF_RESERVED)) {
3193 struct filedesc *fdp = p->p_fd;
3197 if (fd < 0 || fd >= fdp->fd_nfiles ||
3198 (fp = fdp->fd_ofiles[fd]) == NULL ||
3199 (fdp->fd_ofileflags[fd] & UF_RESERVED)) {
3260 struct filedesc *fdp = p->p_fd;
3264 if (fd < 0 || fd >= fdp->fd_nfiles ||
3265 (fp = fdp->fd_ofiles[fd]) == NULL ||
3266 (fdp->fd_ofileflags[fd] & UF_RESERVED)) {
3315 struct filedesc *fdp = p->p_fd;
3319 if (fd < 0 || fd >= fdp->fd_nfiles ||
3320 (fp = fdp->fd_ofiles[fd]) == NULL ||
3321 (fdp->fd_ofileflags[fd] & UF_RESERVED)) {
3375 struct filedesc *fdp = p->p_fd;
3379 if (fd < 0 || fd >= fdp->fd_nfiles ||
3380 (fp = fdp->fd_ofiles[fd]) == NULL ||
3381 (fdp->fd_ofileflags[fd] & UF_RESERVED)) {
3429 struct filedesc *fdp = p->p_fd;
3434 if (fd < 0 || fdp == NULL || fd >= fdp->fd_nfiles ||
3435 (fp = fdp->fd_ofiles[fd]) == NULL ||
3436 (fdp->fd_ofileflags[fd] & UF_RESERVED)) {
3550 struct filedesc *fdp = p->p_fd;
3555 if ((fp == FILEPROC_NULL) && (fd < 0 || fd >= fdp->fd_nfiles ||
3556 (fp = fdp->fd_ofiles[fd]) == NULL ||
3557 ((fdp->fd_ofileflags[fd] & UF_RESERVED) &&
3558 !(fdp->fd_ofileflags[fd] & UF_CLOSING)))) {
4119 struct filedesc *fdp = p->p_fd;
4124 for (i = fdp->fd_lastfile; i >= 0; i--) {
4126 struct fileproc *fp = fdp->fd_ofiles[i];
4127 char *flagp = &fdp->fd_ofileflags[i];
4147 if (i < fdp->fd_knlistsize)
4150 if (i == fdp->fd_lastfile && i > 0)
4151 fdp->fd_lastfile--;
4152 if (i < fdp->fd_freefile)
4153 fdp->fd_freefile = i;
4213 struct filedesc *newfdp, *fdp = p->p_fd;
4228 (void) memcpy(newfdp, fdp, sizeof(*newfdp));
4254 if (newfdp->fd_cdir == NULL && fdp->fd_cdir) {
4264 vnode_rele(fdp->fd_cdir);
4265 fdp->fd_cdir = NULL;
4278 if (newfdp->fd_rdir == NULL && fdp->fd_rdir) {
4331 if (fdp->fd_nfiles > 0) {
4335 (void) memcpy(newfdp->fd_ofiles, fdp->fd_ofiles,
4336 (newfdp->fd_lastfile + 1) * sizeof(*fdp->fd_ofiles));
4337 (void) memcpy(newfdp->fd_ofileflags, fdp->fd_ofileflags,
4338 (newfdp->fd_lastfile + 1) * sizeof(*fdp->fd_ofileflags));
4411 struct filedesc *fdp;
4418 fdp = p->p_fd;
4420 if ((fdp == NULL) || (--fdp->fd_refcnt > 0)) {
4424 if (fdp->fd_refcnt == 0xffff)
4429 if (fdp->fd_nfiles > 0 && fdp->fd_ofiles) {
4430 for (i = fdp->fd_lastfile; i >= 0; i--) {
4431 if ((fp = fdp->fd_ofiles[i]) != NULL) {
4433 if (fdp->fd_ofileflags[i] & UF_RESERVED)
4441 if (i < fdp->fd_knlistsize)
4449 FREE_ZONE(fdp->fd_ofiles, fdp->fd_nfiles * OFILESIZE, M_OFILETABL);
4450 fdp->fd_ofiles = NULL;
4451 fdp->fd_nfiles = 0;
4456 if (fdp->fd_cdir)
4457 vnode_rele(fdp->fd_cdir);
4458 if (fdp->fd_rdir)
4459 vnode_rele(fdp->fd_rdir);
4465 if (fdp->fd_knlist)
4466 FREE(fdp->fd_knlist, M_KQUEUE);
4467 if (fdp->fd_knhash)
4468 FREE(fdp->fd_knhash, M_KQUEUE);
4470 FREE_ZONE(fdp, sizeof(*fdp), M_FILEDESC);
4959 * Parameters: fdp filedesc pointer to fill in
4974 dupfdopen(struct filedesc *fdp, int indx, int dfd, int flags, int error)
4992 fp = fdp->fd_ofiles[indx];
4993 if (dfd < 0 || dfd >= fdp->fd_nfiles ||
4994 (wfp = fdp->fd_ofiles[dfd]) == NULL || wfp == fp ||
4995 (fdp->fd_ofileflags[dfd] & UF_RESERVED)) {
5029 if (indx > fdp->fd_lastfile)
5030 fdp->fd_lastfile = indx;
5037 fdp->fd_ofileflags[indx] = fdp->fd_ofileflags[dfd] |