Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Nov 2005 16:35:39 +0800
From:      "Jon" <comepu@gmail.com>
To:        <freebsd-net@freebsd.org>
Subject:   a question about socket-syscall, thinks
Message-ID:  <002001c5f19b$3c198ee0$ba00a8c0@wtfzhangj>

next in thread | raw e-mail | index | archive | help

 NET_LOCK_GIANT();
 error = socreate(uap->domain, &so, uap->type, uap->protocol,
     td->td_ucred, td);
 NET_UNLOCK_GIANT();
 if (error) {
  fdclose(fdp, fp, fd, td);
 } else {
  FILEDESC_LOCK_FAST(fdp);
  fp->f_data = so; /* already has ref count */
  fp->f_flag = FREAD|FWRITE;
  fp->f_ops = &socketops;
  fp->f_type = DTYPE_SOCKET;
  FILEDESC_UNLOCK_FAST(fdp);
  td->td_retval[0] = fd;
 }
 fdrop(fp, td);
 return (error);

I found these lines in "kern/uipc_syscalls.c(166-182, version:5.4)". I had a question! Why drop "fp" if socreate function return success? Can you tell me? Thank you very much!

Joe




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?002001c5f19b$3c198ee0$ba00a8c0>