aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/unpcb.h
diff options
context:
space:
mode:
authorJeff Roberson <jeff@FreeBSD.org>2007-12-30 01:42:15 +0000
committerJeff Roberson <jeff@FreeBSD.org>2007-12-30 01:42:15 +0000
commit397c19d1753d210247d77eb3ca33d1c7c1eb2fa9 (patch)
tree0f2354bfc200294c2629e6ecfba76e364beda579 /sys/sys/unpcb.h
parent2a79fd39b4cf409d2c0bd7a449d7f3e91d7b9007 (diff)
downloadsrc-397c19d1753d210247d77eb3ca33d1c7c1eb2fa9.tar.gz
src-397c19d1753d210247d77eb3ca33d1c7c1eb2fa9.zip
Remove explicit locking of struct file.
- Introduce a finit() which is used to initailize the fields of struct file in such a way that the ops vector is only valid after the data, type, and flags are valid. - Protect f_flag and f_count with atomic operations. - Remove the global list of all files and associated accounting. - Rewrite the unp garbage collection such that it no longer requires the global list of all files and instead uses a list of all unp sockets. - Mark sockets in the accept queue so we don't incorrectly gc them. Tested by: kris, pho
Notes
Notes: svn path=/head/; revision=174988
Diffstat (limited to 'sys/sys/unpcb.h')
-rw-r--r--sys/sys/unpcb.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/sys/unpcb.h b/sys/sys/unpcb.h
index c7b3a44588ef..4d69f3e5ace5 100644
--- a/sys/sys/unpcb.h
+++ b/sys/sys/unpcb.h
@@ -67,6 +67,7 @@ LIST_HEAD(unp_head, unpcb);
struct unpcb {
LIST_ENTRY(unpcb) unp_link; /* glue on list of all PCBs */
struct socket *unp_socket; /* pointer back to socket */
+ struct file *unp_file; /* back-pointer to file for gc. */
struct vnode *unp_vnode; /* if associated with file */
ino_t unp_ino; /* fake inode number */
struct unpcb *unp_conn; /* control block of connected socket */
@@ -76,9 +77,11 @@ struct unpcb {
int unp_cc; /* copy of rcv.sb_cc */
int unp_mbcnt; /* copy of rcv.sb_mbcnt */
unp_gen_t unp_gencnt; /* generation count of this instance */
- int unp_flags; /* flags */
+ short unp_flags; /* flags */
+ short unp_gcflag; /* Garbage collector flags. */
struct xucred unp_peercred; /* peer credentials, if applicable */
u_int unp_refcount;
+ u_int unp_msgcount; /* references from message queue */
struct mtx unp_mtx; /* mutex */
};
@@ -100,6 +103,10 @@ struct unpcb {
#define UNP_WANTCRED 0x004 /* credentials wanted */
#define UNP_CONNWAIT 0x008 /* connect blocks until accepted */
+#define UNPGC_REF 0x1 /* unpcb has external ref. */
+#define UNPGC_DEAD 0x2 /* unpcb might be dead. */
+#define UNPGC_SCANNED 0x4 /* Has been scanned. */
+
/*
* These flags are used to handle non-atomicity in connect() and bind()
* operations on a socket: in particular, to avoid races between multiple