xref: /netbsd-src/external/gpl3/gdb/dist/gdbsupport/gdb_select.h (revision 5ba1f45f2a09259cc846f20c7c5501604d633c90)
18dffb485Schristos /* Slightly more portable version of <sys/select.h>.
28dffb485Schristos 
3*5ba1f45fSchristos    Copyright (C) 2006-2024 Free Software Foundation, Inc.
48dffb485Schristos 
58dffb485Schristos    This file is part of GDB.
68dffb485Schristos 
78dffb485Schristos    This program is free software; you can redistribute it and/or modify
88dffb485Schristos    it under the terms of the GNU General Public License as published by
98dffb485Schristos    the Free Software Foundation; either version 3 of the License, or
108dffb485Schristos    (at your option) any later version.
118dffb485Schristos 
128dffb485Schristos    This program is distributed in the hope that it will be useful,
138dffb485Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
148dffb485Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
158dffb485Schristos    GNU General Public License for more details.
168dffb485Schristos 
178dffb485Schristos    You should have received a copy of the GNU General Public License
188dffb485Schristos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
198dffb485Schristos 
208dffb485Schristos #if !defined(GDB_SELECT_H)
218dffb485Schristos #define GDB_SELECT_H
228dffb485Schristos 
238dffb485Schristos #ifdef HAVE_SYS_SELECT_H
248dffb485Schristos #include <sys/select.h>
258dffb485Schristos #else
268dffb485Schristos #include "gdbsupport/gdb_sys_time.h"
278dffb485Schristos #endif
288dffb485Schristos 
298dffb485Schristos #ifdef USE_WIN32API
308dffb485Schristos #include <winsock2.h>
318dffb485Schristos #endif
328dffb485Schristos 
338dffb485Schristos extern int gdb_select (int n, fd_set *readfds, fd_set *writefds,
348dffb485Schristos 		       fd_set *exceptfds, struct timeval *timeout);
358dffb485Schristos 
368dffb485Schristos /* Convenience wrapper around gdb_select that returns -1/EINTR if
378dffb485Schristos    set_quit_flag is set, either on entry or from a signal handler or
388dffb485Schristos    from a different thread while select is blocked.  The quit flag is
398dffb485Schristos    not cleared on exit -- the caller is responsible to check it with
408dffb485Schristos    check_quit_flag or QUIT.
418dffb485Schristos 
428dffb485Schristos    Note this does NOT return -1/EINTR if any signal handler other than
438dffb485Schristos    SIGINT runs, nor if the current SIGINT handler does not call
448dffb485Schristos    set_quit_flag.  */
458dffb485Schristos extern int interruptible_select (int n,
468dffb485Schristos 				 fd_set *readfds,
478dffb485Schristos 				 fd_set *writefds,
488dffb485Schristos 				 fd_set *exceptfds,
498dffb485Schristos 				 struct timeval *timeout);
508dffb485Schristos 
518dffb485Schristos #endif /* !defined(GDB_SELECT_H) */
52