MCPcopy Create free account
hub / github.com/F-Stack/f-stack / selsetbits

Function selsetbits

freebsd/kern/sys_generic.c:1279–1306  ·  view source on GitHub ↗

* Set the appropriate output bits given a mask of fired events and the * input bits originally requested. */

Source from the content-addressed store, hash-verified

1277 * input bits originally requested.
1278 */
1279static __inline int
1280selsetbits(fd_mask **ibits, fd_mask **obits, int idx, fd_mask bit, int events)
1281{
1282 int msk;
1283 int n;
1284
1285 n = 0;
1286 for (msk = 0; msk < 3; msk++) {
1287 if ((events & select_flags[msk]) == 0)
1288 continue;
1289 if (ibits[msk] == NULL)
1290 continue;
1291 if ((ibits[msk][idx] & bit) == 0)
1292 continue;
1293 /*
1294 * XXX Check for a duplicate set. This can occur because a
1295 * socket calls selrecord() twice for each poll() call
1296 * resulting in two selfds per real fd. selrescan() will
1297 * call selsetbits twice as a result.
1298 */
1299 if ((obits[msk][idx] & bit) != 0)
1300 continue;
1301 obits[msk][idx] |= bit;
1302 n++;
1303 }
1304
1305 return (n);
1306}
1307
1308/*
1309 * Traverse the list of fds attached to this thread's seltd and check for

Callers 2

selrescanFunction · 0.85
selscanFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected