1*433d6423SLionel Sambuc /* asyn_close() - forcefully forget about a file descriptor 2*433d6423SLionel Sambuc * Author: Kees J. Bot 3*433d6423SLionel Sambuc * 7 Jul 1997 4*433d6423SLionel Sambuc */ 5*433d6423SLionel Sambuc #include "asyn.h" 6*433d6423SLionel Sambuc asyn_close(asynchio_t * asyn,int fd)7*433d6423SLionel Sambucint asyn_close(asynchio_t *asyn, int fd) 8*433d6423SLionel Sambuc /* Stop caring about any async operations on this file descriptor. */ 9*433d6423SLionel Sambuc { 10*433d6423SLionel Sambuc asynfd_t *afd; 11*433d6423SLionel Sambuc int op; 12*433d6423SLionel Sambuc 13*433d6423SLionel Sambuc if ((unsigned) fd >= FD_SETSIZE) { errno= EBADF; return -1; } 14*433d6423SLionel Sambuc 15*433d6423SLionel Sambuc afd= &asyn->asyn_afd[fd]; 16*433d6423SLionel Sambuc 17*433d6423SLionel Sambuc for (op= 0; op < SEL_NR; op++) { 18*433d6423SLionel Sambuc afd->afd_state[op]= IDLE; 19*433d6423SLionel Sambuc FD_CLR(fd, &asyn->asyn_fdset[op]); 20*433d6423SLionel Sambuc } 21*433d6423SLionel Sambuc afd->afd_seen= 0; 22*433d6423SLionel Sambuc asyn->asyn_more++; 23*433d6423SLionel Sambuc return 0; 24*433d6423SLionel Sambuc } 25