]> Git Repo - binutils.git/blobdiff - sim/common/dv-sockser.c
sim: switch config.h usage to defs.h
[binutils.git] / sim / common / dv-sockser.c
index ef249e6b3e07b518195fd1de10412a0bc4746f97..ef652f62f4681ac55905a0b102dee07c1c8a1454 100644 (file)
@@ -1,6 +1,5 @@
 /* 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
@@ -19,19 +18,14 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 /* 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
@@ -175,12 +169,12 @@ dv_sockser_init (SIM_DESC sd)
     }
 
   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));
@@ -230,8 +224,11 @@ dv_sockser_uninstall (SIM_DESC sd)
     }
 }
 
+/* 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)
This page took 0.023376 seconds and 4 git commands to generate.