/* Serial port emulation using sockets.
- Copyright (C) 1998, 2007, 2008, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 1998-2021 Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
This program is free software; you can redistribute it and/or modify
/* FIXME: will obviously need to evolve.
- connectionless sockets might be more appropriate. */
+/* This must come before any other includes. */
+#include "defs.h"
+
#include "sim-main.h"
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
#include <signal.h>
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
}
sockaddr.sin_family = PF_INET;
- sockaddr.sin_port = htons(port);
+ sockaddr.sin_port = htons (port);
memcpy (&sockaddr.sin_addr.s_addr, hostent->h_addr,
sizeof (struct in_addr));
tmp = 1;
- if (setsockopt (sockser_listen_fd, SOL_SOCKET, SO_REUSEADDR, (void*)& tmp, sizeof(tmp)) < 0)
+ if (setsockopt (sockser_listen_fd, SOL_SOCKET, SO_REUSEADDR, (void*)& tmp, sizeof (tmp)) < 0)
{
sim_io_eprintf (sd, "sockser init: unable to set SO_REUSEADDR: %s\n",
strerror (errno));
}
}
+/* Provide a prototype to silence -Wmissing-prototypes. */
+extern MODULE_INIT_FN sim_install_dv_sockser;
+
SIM_RC
-dv_sockser_install (SIM_DESC sd)
+sim_install_dv_sockser (SIM_DESC sd)
{
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
if (sim_add_option_table (sd, NULL, sockser_options) != SIM_RC_OK)