8 void fd_list_add(fd_list_t **fd_list, int fd)
12 new_fd = my_malloc( sizeof(fd_list_t) );
14 new_fd->next = *fd_list;
20 void fd_list_remove(fd_list_t **fd_list, int fd)
22 fd_list_t *current_fd = *fd_list;
25 if(current_fd->fd == fd) {
27 current_fd->prev->next = current_fd->next;
29 *fd_list = current_fd->next;
31 current_fd->next->prev = current_fd->prev;
37 current_fd = current_fd->next;
41 void fd_list_close_all(fd_list_t **fd_list)
46 for(retries = 0; retries < CLOSE_MAX_RETRIES &&
47 close((*fd_list)->fd) == -1 &&
50 fd_list_remove(fd_list, (*fd_list)->fd);
54 bool fd_list_empty(fd_list_t *fd_list)
56 return (fd_list == NULL) ? true : false;