2011-02-21 Hui Zhu <teawater@gmail.com>
[deliverable/binutils-gdb.git] / gdb / posix-hdep.c
CommitLineData
121ce6e5
DJ
1/* Host support routines for MinGW, for GDB, the GNU debugger.
2
7b6bb8da
JB
3 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
4 Free Software Foundation, Inc.
121ce6e5
DJ
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
a9762ec7 10 the Free Software Foundation; either version 3 of the License, or
121ce6e5
DJ
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
a9762ec7 19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
121ce6e5
DJ
20
21#include "defs.h"
b803fb0f 22#include "event-loop.h"
121ce6e5
DJ
23
24#include "gdb_string.h"
25
0ea3f30e
DJ
26#include "gdb_select.h"
27
121ce6e5
DJ
28/* The strerror() function can return NULL for errno values that are
29 out of range. Provide a "safe" version that always returns a
0df8b418 30 printable string. */
121ce6e5
DJ
31
32char *
33safe_strerror (int errnum)
34{
35 char *msg;
36
37 msg = strerror (errnum);
38 if (msg == NULL)
39 {
40 static char buf[32];
ad3bbd48 41
121ce6e5
DJ
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
50int
51gdb_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}
b803fb0f
DJ
56
57/* Wrapper for the body of signal handlers. Nothing special needed on
58 POSIX platforms. */
59
60void
61gdb_call_async_signal_handler (struct async_signal_handler *handler,
62 int immediate_p)
63{
64 if (immediate_p)
65 call_async_signal_handler (handler);
66 else
67 mark_async_signal_handler (handler);
68}
This page took 0.490498 seconds and 4 git commands to generate.