Module Name:    src
Committed By:   christos
Date:           Fri Nov  6 15:41:25 UTC 2015

Modified Files:
        src/sys/sys: fd_set.h

Log Message:
Generalize the length macro, and also provide a macro that returns the size
in bytes needed for a given fd.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/sys/fd_set.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/sys/fd_set.h
diff -u src/sys/sys/fd_set.h:1.5 src/sys/sys/fd_set.h:1.6
--- src/sys/sys/fd_set.h:1.5	Thu Jul  8 14:56:17 2010
+++ src/sys/sys/fd_set.h	Fri Nov  6 10:41:25 2015
@@ -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 @@ typedef	__uint32_t	__fd_mask;
 #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];

Reply via email to