patch-2.4.21 linux-2.4.21/include/net/af_unix.h
Next file: linux-2.4.21/include/net/bluetooth/hci.h
Previous file: linux-2.4.21/include/net/addrconf.h
Back to the patch index
Back to the overall index
-  Lines: 33
-  Date:
2003-06-13 07:51:39.000000000 -0700
-  Orig file: 
linux-2.4.20/include/net/af_unix.h
-  Orig date: 
2000-04-24 13:43:04.000000000 -0700
diff -urN linux-2.4.20/include/net/af_unix.h linux-2.4.21/include/net/af_unix.h
@@ -13,9 +13,30 @@
 
 extern atomic_t unix_tot_inflight;
 
+static inline unix_socket *first_unix_socket(int *i)
+{
+	for (*i = 0; *i <= UNIX_HASH_SIZE; (*i)++) {
+		if (unix_socket_table[*i])
+			return unix_socket_table[*i];
+	}
+	return NULL;
+}
+
+static inline unix_socket *next_unix_socket(int *i, unix_socket *s)
+{
+	/* More in this chain? */
+	if (s->next)
+		return s->next;
+	/* Look for next non-empty chain. */
+	for ((*i)++; *i <= UNIX_HASH_SIZE; (*i)++) {
+		if (unix_socket_table[*i])
+			return unix_socket_table[*i];
+	}
+	return NULL;
+}
 
-#define forall_unix_sockets(i, s) for (i=0; i<=UNIX_HASH_SIZE; i++) \
-                                    for (s=unix_socket_table[i]; s; s=s->next)
+#define forall_unix_sockets(i, s) \
+	for (s = first_unix_socket(&(i)); s; s = next_unix_socket(&(i),(s)))
 
 struct unix_address
 {
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)