xref: /openbsd-src/lib/libc/sys/w_select.c (revision fe38b55cb0aae270de3f844146814682e8cd345c)
1*fe38b55cSguenther /*	$OpenBSD: w_select.c,v 1.1 2016/05/07 19:05:22 guenther Exp $ */
2*fe38b55cSguenther /*
3*fe38b55cSguenther  * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org>
4*fe38b55cSguenther  *
5*fe38b55cSguenther  * Permission to use, copy, modify, and distribute this software for any
6*fe38b55cSguenther  * purpose with or without fee is hereby granted, provided that the above
7*fe38b55cSguenther  * copyright notice and this permission notice appear in all copies.
8*fe38b55cSguenther  *
9*fe38b55cSguenther  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10*fe38b55cSguenther  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*fe38b55cSguenther  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12*fe38b55cSguenther  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*fe38b55cSguenther  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14*fe38b55cSguenther  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15*fe38b55cSguenther  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16*fe38b55cSguenther  */
17*fe38b55cSguenther 
18*fe38b55cSguenther #include <sys/select.h>
19*fe38b55cSguenther #include "cancel.h"
20*fe38b55cSguenther 
21*fe38b55cSguenther int
select(int nfds,fd_set * readfds,fd_set * writefds,fd_set * exceptfds,struct timeval * timeout)22*fe38b55cSguenther select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
23*fe38b55cSguenther     struct timeval *timeout)
24*fe38b55cSguenther {
25*fe38b55cSguenther 	int ret;
26*fe38b55cSguenther 
27*fe38b55cSguenther 	ENTER_CANCEL_POINT(1);
28*fe38b55cSguenther 	ret = HIDDEN(select)(nfds, readfds, writefds, exceptfds, timeout);
29*fe38b55cSguenther 	LEAVE_CANCEL_POINT(ret == -1);
30*fe38b55cSguenther 	return (ret);
31*fe38b55cSguenther }
32*fe38b55cSguenther DEF_CANCEL(select);
33