Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys Generalize the length macro, and also provide a macr...



details:   https://anonhg.NetBSD.org/src/rev/2aa0a335f251
branches:  trunk
changeset: 341446:2aa0a335f251
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Nov 06 15:41:25 2015 +0000

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

diffstat:

 sys/sys/fd_set.h |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (20 lines):

diff -r 7bb9c628fcff -r 2aa0a335f251 sys/sys/fd_set.h
--- a/sys/sys/fd_set.h  Fri Nov 06 15:30:59 2015 +0000
+++ b/sys/sys/fd_set.h  Fri Nov 06 15:41:25 2015 +0000
@@ -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];



Home | Main Index | Thread Index | Old Index