Fri Nov 6 15:41:25 2015 UTC ()
Generalize the length macro, and also provide a macro that returns the size
in bytes needed for a given fd.


(christos)
diff -r1.5 -r1.6 src/sys/sys/fd_set.h

cvs diff -r1.5 -r1.6 src/sys/sys/fd_set.h (expand / switch to context diff)
--- src/sys/sys/fd_set.h 2010/07/08 18:56:17 1.5
+++ src/sys/sys/fd_set.h 2015/11/06 15:41:25 1.6
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd_set.h,v 1.5 2010/07/08 18:56:17 rmind Exp $	*/
+/*	$NetBSD: fd_set.h,v 1.6 2015/11/06 15:41:25 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -59,7 +59,9 @@
 #define	FD_SETSIZE	256
 #endif
 
-#define	__NFD_SIZE	(((FD_SETSIZE) + (__NFDBITS - 1)) / __NFDBITS)
+#define	__NFD_LEN(a)	(((a) + (__NFDBITS - 1)) / __NFDBITS)
+#define	__NFD_SIZE	__NFD_LEN(FD_SETSIZE)
+#define	__NFD_BYTES(a)	(__NFD_LEN(a) * sizeof(__fd_mask))
 
 typedef	struct fd_set {
 	__fd_mask	fds_bits[__NFD_SIZE];