/* Serial interface for local (hardwired) serial ports on Windows systems
- Copyright (C) 2006-2015 Free Software Foundation, Inc.
+ Copyright (C) 2006-2017 Free Software Foundation, Inc.
This file is part of GDB.
/* CancelIo is not available for Windows 95 OS, so we need to use
LoadLibrary/GetProcAddress to avoid a startup failure. */
#define CancelIo dyn_CancelIo
-static BOOL WINAPI (*CancelIo) (HANDLE);
+typedef BOOL WINAPI (CancelIo_ftype) (HANDLE);
+static CancelIo_ftype *CancelIo;
/* Open up a real live device for serial I/O. */
state.fAbortOnError = FALSE;
state.ByteSize = 8;
- scb->current_timeout = 0;
-
if (SetCommState (h, &state) == 0)
warning (_("SetCommState failed"));
}
by calling close (scb->fd) below. */
if (CancelIo)
CancelIo ((HANDLE) _get_osfhandle (scb->fd));
- state = scb->state;
+ state = (struct ser_windows_state *) scb->state;
CloseHandle (state->ov.hEvent);
CloseHandle (state->except_event);
DWORD errors;
HANDLE h = (HANDLE) _get_osfhandle (scb->fd);
- state = scb->state;
+ state = (struct ser_windows_state *) scb->state;
*except = state->except_event;
*read = state->ov.hEvent;
HANDLE h;
gdb_byte *p;
- state = scb->state;
+ state = (struct ser_windows_state *) scb->state;
if (state->in_progress)
{
WaitForSingleObject (state->ov.hEvent, INFINITE);
static DWORD WINAPI
console_select_thread (void *arg)
{
- struct serial *scb = arg;
+ struct serial *scb = (struct serial *) arg;
struct ser_console_state *state;
int event_index;
HANDLE h;
- state = scb->state;
+ state = (struct ser_console_state *) scb->state;
h = (HANDLE) _get_osfhandle (scb->fd);
while (1)
static DWORD WINAPI
pipe_select_thread (void *arg)
{
- struct serial *scb = arg;
+ struct serial *scb = (struct serial *) arg;
struct ser_console_state *state;
int event_index;
HANDLE h;
- state = scb->state;
+ state = (struct ser_console_state *) scb->state;
h = (HANDLE) _get_osfhandle (scb->fd);
while (1)
static DWORD WINAPI
file_select_thread (void *arg)
{
- struct serial *scb = arg;
+ struct serial *scb = (struct serial *) arg;
struct ser_console_state *state;
int event_index;
HANDLE h;
- state = scb->state;
+ state = (struct ser_console_state *) scb->state;
h = (HANDLE) _get_osfhandle (scb->fd);
while (1)
static void
ser_console_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
{
- struct ser_console_state *state = scb->state;
+ struct ser_console_state *state = (struct ser_console_state *) scb->state;
if (state == NULL)
{
static void
ser_console_done_wait_handle (struct serial *scb)
{
- struct ser_console_state *state = scb->state;
+ struct ser_console_state *state = (struct ser_console_state *) scb->state;
if (state == NULL)
return;
static void
ser_console_close (struct serial *scb)
{
- struct ser_console_state *state = scb->state;
+ struct ser_console_state *state = (struct ser_console_state *) scb->state;
if (scb->state)
{
static void
cleanup_pipe_state (void *untyped)
{
- struct pipe_state *ps = untyped;
+ struct pipe_state *ps = (struct pipe_state *) untyped;
free_pipe_state (ps);
}
static void
pipe_windows_close (struct serial *scb)
{
- struct pipe_state *ps = scb->state;
+ struct pipe_state *ps = (struct pipe_state *) scb->state;
/* In theory, we should try to kill the subprocess here, but the pex
interface doesn't give us enough information to do that. Usually
static int
pipe_windows_write (struct serial *scb, const void *buf, size_t count)
{
- struct pipe_state *ps = scb->state;
+ struct pipe_state *ps = (struct pipe_state *) scb->state;
HANDLE pipeline_in;
DWORD written;
static void
pipe_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
{
- struct pipe_state *ps = scb->state;
+ struct pipe_state *ps = (struct pipe_state *) scb->state;
/* Have we allocated our events yet? */
if (ps->wait.read_event == INVALID_HANDLE_VALUE)
static void
pipe_done_wait_handle (struct serial *scb)
{
- struct pipe_state *ps = scb->state;
+ struct pipe_state *ps = (struct pipe_state *) scb->state;
/* Have we allocated our events yet? */
if (ps->wait.read_event == INVALID_HANDLE_VALUE)
static int
net_windows_socket_check_pending (struct serial *scb)
{
- struct net_windows_state *state = scb->state;
+ struct net_windows_state *state = (struct net_windows_state *) scb->state;
unsigned long available;
if (ioctlsocket (scb->fd, FIONREAD, &available) != 0)
static DWORD WINAPI
net_windows_select_thread (void *arg)
{
- struct serial *scb = arg;
+ struct serial *scb = (struct serial *) arg;
struct net_windows_state *state;
int event_index;
- state = scb->state;
+ state = (struct net_windows_state *) scb->state;
while (1)
{
static void
net_windows_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
{
- struct net_windows_state *state = scb->state;
+ struct net_windows_state *state = (struct net_windows_state *) scb->state;
/* Start from a clean slate. */
ResetEvent (state->base.read_event);
static void
net_windows_done_wait_handle (struct serial *scb)
{
- struct net_windows_state *state = scb->state;
+ struct net_windows_state *state = (struct net_windows_state *) scb->state;
stop_select_thread (&state->base);
}
static void
net_windows_close (struct serial *scb)
{
- struct net_windows_state *state = scb->state;
+ struct net_windows_state *state = (struct net_windows_state *) scb->state;
destroy_select_thread (&state->base);
CloseHandle (state->sock_event);
hm = LoadLibrary ("kernel32.dll");
if (hm)
{
- CancelIo = (void *) GetProcAddress (hm, "CancelIo");
+ CancelIo = (CancelIo_ftype *) GetProcAddress (hm, "CancelIo");
FreeLibrary (hm);
}
else