aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-03-17 19:03:30 +0000
committerMike Frysinger <vapier@gentoo.org>2011-03-17 19:03:30 +0000
commit9e6584c9a0e5a21e2aac8537c1443fbcf08ea91b (patch)
tree6626fe254933603f748e5e3a4db256ebd417f98e /sim
parentd4862372c6a47c5d2e5abfed59a0c757bc494343 (diff)
downloadgdb-9e6584c9a0e5a21e2aac8537c1443fbcf08ea91b.zip
gdb-9e6584c9a0e5a21e2aac8537c1443fbcf08ea91b.tar.gz
gdb-9e6584c9a0e5a21e2aac8537c1443fbcf08ea91b.tar.bz2
sim: bfin: check for kill/pread
If the host system (like Windows) doesn't support these functions, then make sure we don't use them. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'sim')
-rw-r--r--sim/bfin/ChangeLog8
-rw-r--r--sim/bfin/config.in6
-rwxr-xr-xsim/bfin/configure2
-rw-r--r--sim/bfin/configure.ac2
-rw-r--r--sim/bfin/interp.c9
5 files changed, 25 insertions, 2 deletions
diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index 1dea111..ad816c5 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,3 +1,11 @@
+2011-03-17 Mike Frysinger <vapier@gentoo.org>
+
+ * configure.ac (AC_CHECK_FUNCS): Check for kill and pread.
+ * configure: Regenerate.
+ * config.in: Regenerate.
+ * interp.c (bfin_syscall): Check for HAVE_{KILL,PREAD} before using
+ kill or pread.
+
2011-03-15 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (dv-bfin_gpio.o): New target.
diff --git a/sim/bfin/config.in b/sim/bfin/config.in
index b44011d..2b25645 100644
--- a/sim/bfin/config.in
+++ b/sim/bfin/config.in
@@ -55,6 +55,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* Define to 1 if you have the `kill' function. */
+#undef HAVE_KILL
+
/* Define to 1 if you have the `nsl' library (-lnsl). */
#undef HAVE_LIBNSL
@@ -79,6 +82,9 @@
/* Define to 1 if you have the <net/if.h> header file. */
#undef HAVE_NET_IF_H
+/* Define to 1 if you have the `pread' function. */
+#undef HAVE_PREAD
+
/* Define to 1 if you have the `setgid' function. */
#undef HAVE_SETGID
diff --git a/sim/bfin/configure b/sim/bfin/configure
index 02bfebb..70e038d 100755
--- a/sim/bfin/configure
+++ b/sim/bfin/configure
@@ -5151,7 +5151,7 @@ fi
fi
-for ac_func in getuid getgid geteuid getegid setuid setgid mmap munmap
+for ac_func in getuid getgid geteuid getegid setuid setgid mmap munmap kill pread
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/sim/bfin/configure.ac b/sim/bfin/configure.ac
index fddebc9..6c03107 100644
--- a/sim/bfin/configure.ac
+++ b/sim/bfin/configure.ac
@@ -47,7 +47,7 @@ SIM_AC_OPTION_HARDWARE(yes,,\
eth_phy \
)
-AC_CHECK_FUNCS([getuid getgid geteuid getegid setuid setgid mmap munmap])
+AC_CHECK_FUNCS([getuid getgid geteuid getegid setuid setgid mmap munmap kill pread])
AC_CHECK_HEADERS([sys/ioctl.h sys/mman.h net/if.h linux/if_tun.h linux/mii.h])
BFIN_SIM_EXTRA_OBJS=
diff --git a/sim/bfin/interp.c b/sim/bfin/interp.c
index 1f8681d..f8669d3 100644
--- a/sim/bfin/interp.c
+++ b/sim/bfin/interp.c
@@ -297,6 +297,7 @@ bfin_syscall (SIM_CPU *cpu)
sc.errcode = TARGET_ENOSYS;
else
{
+#ifdef HAVE_PREAD
char *data = xmalloc (sc.arg2);
/* XXX: Should add a cb->pread. */
@@ -306,6 +307,9 @@ bfin_syscall (SIM_CPU *cpu)
sc.errcode = TARGET_EINVAL;
free (data);
+#else
+ sc.errcode = TARGET_ENOSYS;
+#endif
}
if (sc.errcode)
@@ -495,8 +499,13 @@ bfin_syscall (SIM_CPU *cpu)
}
else
{
+#ifdef HAVE_KILL
sc.result = kill (sc.arg1, sc.arg2);
goto sys_finish;
+#else
+ sc.result = -1;
+ sc.errcode = TARGET_ENOSYS;
+#endif
}
break;