]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: bfin: check for kill/pread
authorMike Frysinger <vapier@gentoo.org>
Thu, 17 Mar 2011 19:03:30 +0000 (19:03 +0000)
committerMike Frysinger <vapier@gentoo.org>
Thu, 17 Mar 2011 19:03:30 +0000 (19:03 +0000)
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>
sim/bfin/ChangeLog
sim/bfin/config.in
sim/bfin/configure
sim/bfin/configure.ac
sim/bfin/interp.c

index 1dea1111349120162cd13dc9a210144d9acf647b..ad816c533516add853cfc1cc3cb655e110d772af 100644 (file)
@@ -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.
index b44011d7e80c2fd314a27b0dcf331548b878b722..2b25645ecf807cbbbdd67ae8572da758e3d376ce 100644 (file)
@@ -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
 
index 02bfebbbf851e1467f4cd76becd56c8e8ce1407c..70e038d0fbf9f9b6e445d27e23a41691b1d36181 100755 (executable)
@@ -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"
index fddebc9ca099ec725a1457df3ec4987314bab5b8..6c031077bda02fcdf8790603f6f01d5ad39d1529 100644 (file)
@@ -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=
index 1f8681df16aeb692ae8a98717d2440e45162cb55..f8669d308809d4a53a189131c7ee7e5694461d44 100644 (file)
@@ -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;