]>
Commit | Line | Data |
---|---|---|
121ce6e5 DJ |
1 | /* Host support routines for MinGW, for GDB, the GNU debugger. |
2 | ||
3 | Copyright (C) 2006 | |
4 | Free Software Foundation, Inc. | |
5 | ||
6 | This file is part of GDB. | |
7 | ||
8 | This program is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 2 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | This program is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with this program; if not, write to the Free Software | |
20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
21 | Boston, MA 02110-1301, USA. */ | |
22 | ||
23 | #include "defs.h" | |
24 | ||
25 | #include "gdb_string.h" | |
26 | ||
0ea3f30e DJ |
27 | #include "gdb_select.h" |
28 | ||
121ce6e5 DJ |
29 | /* The strerror() function can return NULL for errno values that are |
30 | out of range. Provide a "safe" version that always returns a | |
31 | printable string. */ | |
32 | ||
33 | char * | |
34 | safe_strerror (int errnum) | |
35 | { | |
36 | char *msg; | |
37 | ||
38 | msg = strerror (errnum); | |
39 | if (msg == NULL) | |
40 | { | |
41 | static char buf[32]; | |
42 | xsnprintf (buf, sizeof buf, "(undocumented errno %d)", errnum); | |
43 | msg = buf; | |
44 | } | |
45 | return (msg); | |
46 | } | |
47 | ||
0ea3f30e DJ |
48 | /* Wrapper for select. Nothing special needed on POSIX platforms. */ |
49 | ||
50 | int | |
51 | gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, | |
52 | struct timeval *timeout) | |
53 | { | |
54 | return select (n, readfds, writefds, exceptfds, timeout); | |
55 | } |