- if (vec_max < (fd >> 5) + 1)
- {
- int new_max = (fd >> 5) + 1;
-
- vec_ri = (unsigned char *)ev_realloc (vec_ri, new_max * 4);
- vec_ro = (unsigned char *)ev_realloc (vec_ro, new_max * 4); /* could free/malloc */
- vec_wi = (unsigned char *)ev_realloc (vec_wi, new_max * 4);
- vec_wo = (unsigned char *)ev_realloc (vec_wo, new_max * 4); /* could free/malloc */
-
- for (; vec_max < new_max; ++vec_max)
- ((uint32_t *)vec_ri)[vec_max] =
- ((uint32_t *)vec_wi)[vec_max] = 0;
- }
-
- vec_ri [offs] |= mask;
- if (!(nev & EV_READ))
- vec_ri [offs] &= ~mask;
-
- vec_wi [offs] |= mask;
- if (!(nev & EV_WRITE))
- vec_wi [offs] &= ~mask;
+#if EV_SELECT_USE_FD_SET
+ if (nev & EV_READ)
+ FD_SET (fd, (struct fd_set *)vec_ri);
+ else
+ FD_CLR (fd, (struct fd_set *)vec_ri);
+
+ if (nev & EV_WRITE)
+ FD_SET (fd, (struct fd_set *)vec_wi);
+ else
+ FD_CLR (fd, (struct fd_set *)vec_wi);
+#else
+ {
+ int offs = fd >> 3;
+ int mask = 1 << (fd & 7);
+
+ if (vec_max < (fd >> 5) + 1)
+ {
+ int new_max = (fd >> 5) + 1;
+
+ vec_ri = (unsigned char *)ev_realloc (vec_ri, new_max * 4);
+ vec_ro = (unsigned char *)ev_realloc (vec_ro, new_max * 4); /* could free/malloc */
+ vec_wi = (unsigned char *)ev_realloc (vec_wi, new_max * 4);
+ vec_wo = (unsigned char *)ev_realloc (vec_wo, new_max * 4); /* could free/malloc */
+
+ for (; vec_max < new_max; ++vec_max)
+ ((uint32_t *)vec_ri)[vec_max] =
+ ((uint32_t *)vec_wi)[vec_max] = 0;
+ }
+
+ vec_ri [offs] |= mask;
+ if (!(nev & EV_READ))
+ vec_ri [offs] &= ~mask;
+
+ vec_wi [offs] |= mask;
+ if (!(nev & EV_WRITE))
+ vec_wi [offs] &= ~mask;
+ }
+#endif