forked from Imagelibrary/binutils-gdb
sim: dv-sockser: enable for mingw targets too
We have enough functionality from gnulib now to build sockser on all platforms. Non-blocking I/O is supported when F_GETFL/F_SETFL are unavailable, but we can address that in a follow up commit. This mirrors what is done in other places in the sim already.
This commit is contained in:
@@ -40,10 +40,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
#include <sys/select.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#ifndef __CYGWIN32__
|
||||
#include <netinet/tcp.h>
|
||||
#endif
|
||||
|
||||
#include "sim-main.h"
|
||||
#include "sim-assert.h"
|
||||
#include "sim-options.h"
|
||||
@@ -198,6 +194,7 @@ dv_sockser_init (SIM_DESC sd)
|
||||
|
||||
/* Handle writes to missing client -> SIGPIPE.
|
||||
??? Need a central signal management module. */
|
||||
#ifdef SIGPIPE
|
||||
{
|
||||
RETSIGTYPE (*orig) ();
|
||||
orig = signal (SIGPIPE, SIG_IGN);
|
||||
@@ -205,6 +202,7 @@ dv_sockser_init (SIM_DESC sd)
|
||||
if (orig != SIG_DFL && orig != SIG_IGN)
|
||||
signal (SIGPIPE, orig);
|
||||
}
|
||||
#endif
|
||||
|
||||
return SIM_RC_OK;
|
||||
}
|
||||
@@ -276,6 +274,7 @@ connected_p (SIM_DESC sd)
|
||||
return 0;
|
||||
|
||||
/* Set non-blocking i/o. */
|
||||
#ifdef F_GETFL
|
||||
flags = fcntl (sockser_fd, F_GETFL);
|
||||
flags |= O_NONBLOCK | O_NDELAY;
|
||||
if (fcntl (sockser_fd, F_SETFL, flags) == -1)
|
||||
@@ -285,6 +284,7 @@ connected_p (SIM_DESC sd)
|
||||
sockser_fd = -1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
12
sim/configure
vendored
12
sim/configure
vendored
@@ -14439,16 +14439,8 @@ if test "$enable_sim_hardware" = no; then
|
||||
sim_hw_cflags="-DWITH_HW=0"
|
||||
elif test "$enable_sim_hardware" = yes; then
|
||||
sim_hw_cflags="-DWITH_HW=1"
|
||||
# mingw does not support sockser
|
||||
case ${host} in
|
||||
*mingw*) ;;
|
||||
*) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
|
||||
# that you instatiate. Instead, other code will call into it directly.
|
||||
# At some point, we should convert it over.
|
||||
sim_hw_sockser="dv-sockser.o"
|
||||
sim_hw_cflags="$sim_hw_cflags -DHAVE_DV_SOCKSER"
|
||||
;;
|
||||
esac
|
||||
sim_hw_sockser="dv-sockser.o"
|
||||
sim_hw_cflags="$sim_hw_cflags -DHAVE_DV_SOCKSER"
|
||||
else
|
||||
as_fn_error $? "unknown argument \"$enable_sim_hardware\"" "$LINENO" 5
|
||||
fi
|
||||
|
||||
@@ -26,16 +26,11 @@ if test "$enable_sim_hardware" = no; then
|
||||
sim_hw_cflags="-DWITH_HW=0"
|
||||
elif test "$enable_sim_hardware" = yes; then
|
||||
sim_hw_cflags="-DWITH_HW=1"
|
||||
# mingw does not support sockser
|
||||
case ${host} in
|
||||
*mingw*) ;;
|
||||
*) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
|
||||
# that you instatiate. Instead, other code will call into it directly.
|
||||
# At some point, we should convert it over.
|
||||
sim_hw_sockser="dv-sockser.o"
|
||||
sim_hw_cflags="$sim_hw_cflags -DHAVE_DV_SOCKSER"
|
||||
;;
|
||||
esac
|
||||
dnl TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
|
||||
dnl that you instatiate. Instead, other code will call into it directly.
|
||||
dnl At some point, we should convert it over.
|
||||
sim_hw_sockser="dv-sockser.o"
|
||||
sim_hw_cflags="$sim_hw_cflags -DHAVE_DV_SOCKSER"
|
||||
else
|
||||
AC_MSG_ERROR([unknown argument "$enable_sim_hardware"])
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user