Lines Matching defs:chunk

401 	rsm_pollfd_chunk_t *chunk;
407 chunk = pollfd_table.buckets[hash];
408 while (chunk) {
409 if (chunk->nfree > 0)
411 chunk = chunk->next;
414 if (!chunk) { /* couldn't find a free chunk - allocate a new one */
415 chunk = malloc(sizeof (rsm_pollfd_chunk_t));
416 if (!chunk) {
420 chunk->nfree = RSM_POLLFD_PER_CHUNK - 1;
421 chunk->fdarray[0].fd = segfd;
422 chunk->fdarray[0].segrnum = segrnum;
424 chunk->fdarray[i].fd = -1;
425 chunk->fdarray[i].segrnum = 0;
428 chunk->next = pollfd_table.buckets[hash];
429 pollfd_table.buckets[hash] = chunk;
431 "rsm_insert_pollfd: new chunk(%p) @ %d for %d:%d\n",
432 chunk, hash, segfd, segrnum));
433 } else { /* a chunk with free slot was found */
435 if (chunk->fdarray[i].fd == -1) {
436 chunk->fdarray[i].fd = segfd;
437 chunk->fdarray[i].segrnum = segrnum;
438 chunk->nfree--;
443 "rsm_insert_pollfd: inserted @ %d for %d:%d chunk(%p)\n",
444 hash, segfd, segrnum, chunk));
462 rsm_pollfd_chunk_t *chunk;
469 chunk = pollfd_table.buckets[RSM_POLLFD_HASH(segfd)];
470 while (chunk) {
471 assert(chunk->nfree < RSM_POLLFD_PER_CHUNK);
474 if (chunk->fdarray[i].fd == segfd) {
478 segfd, chunk->fdarray[i].segrnum));
479 return (chunk->fdarray[i].segrnum);
482 chunk = chunk->next;
502 rsm_pollfd_chunk_t *chunk;
512 prev_chunk = chunk = pollfd_table.buckets[hash];
513 while (chunk) {
514 assert(chunk->nfree < RSM_POLLFD_PER_CHUNK);
517 if (chunk->fdarray[i].fd == segfd) {
520 chunk->fdarray[i].fd,
521 chunk->fdarray[i].segrnum));
522 chunk->fdarray[i].fd = -1;
523 chunk->fdarray[i].segrnum = 0;
524 chunk->nfree++;
525 if (chunk->nfree == RSM_POLLFD_PER_CHUNK) {
526 /* chunk is empty free it */
527 if (prev_chunk == chunk) {
529 chunk->next;
531 prev_chunk->next = chunk->next;
536 chunk));
537 free(chunk);
543 prev_chunk = chunk;
544 chunk = chunk->next;