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