blob: 8f460f77a44b90dd9cbc74a99a3b96167f730b7d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
$NetBSD: patch-aj,v 1.2 2003/05/02 11:49:49 wiz Exp $
--- pth_util.c.orig Wed Jan 1 15:45:06 2003
+++ pth_util.c
@@ -182,3 +182,25 @@ intern int pth_util_fds_select(int nfd,
return n;
}
+/*
+ * zero the first 'nfd' file descriptors in an fd_set.
+ */
+intern void pth_util_fd_zero(int nfd, fd_set *fds)
+{
+ int i;
+ for (i=0; i<nfd; i++)
+ FD_CLR(i, fds);
+}
+
+/*
+ * copy the first 'nfd' file descriptors from one fd_set to another.
+ */
+intern void pth_util_fd_copy(int nfd, fd_set* dfds, fd_set* sfds)
+{
+ int i;
+ for (i=0; i < nfd; i++)
+ if (FD_ISSET(i, sfds))
+ FD_SET(i, dfds);
+ else
+ FD_CLR(i, dfds);
+}
|