Test whether /dev/zero works before attemping to us it

This commit is contained in:
Michael Meissner 1996-08-12 23:06:21 +00:00
parent d9538961cc
commit 9aecf50da5
3 changed files with 45 additions and 1 deletions

View file

@ -1,3 +1,17 @@
Mon Aug 12 18:42:37 1996 Michael Meissner <meissner@tiktok.cygnus.com>
* configure.in: Test whether /dev/zero works on the system, and if
it does, define HAVE_DEVZERO.
* configure: Regenerate.
* emul_generic.c (emul_add_tree_hardware): Do not add /iobus/disk
if we don't have a working /dev/zero on the system.
* emul_bugapi.c (emul_bugapi_init): If HAVE_DEVZERO is not
defined, don't add disk support.
(emul_bugapi_do_diskio): Ditto.
(emul_bugapi_instruction_call): Ditto.
Wed Aug 7 14:34:20 1996 Michael Meissner <meissner@tiktok.cygnus.com>
* emul_unix.c (HAVE_TCGETATTR): If HAVE_TERMIOS_STRUCTURE is not

View file

@ -88,6 +88,7 @@ MODEL_CFLAGS = @sim_model@ @sim_default_model@ @sim_model_issue@
STDIO_CFLAGS = @sim_stdio@
TERMIO_CFLAGS = @sim_termio@
WARNING_CFLAGS = @sim_warnings@
DEVZERO_CFLAGS = @sim_devzero@
CONFIG_CFLAGS = $(BSWAP_CFLAGS) \
$(ENDIAN_CFLAGS) \
$(REGPARM_CFLAGS) \
@ -107,7 +108,8 @@ CONFIG_CFLAGS = $(BSWAP_CFLAGS) \
$(MONITOR_CFLAGS) \
$(MODEL_CFLAGS) \
$(STDIO_CFLAGS) \
$(TERMIO_CFLAGS)
$(TERMIO_CFLAGS) \
$(DEVZERO_CFLAGS)
STD_CFLAGS = $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(WARNING_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES)
NOWARN_CFLAGS = $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES)

View file

@ -593,6 +593,33 @@ else
ac_cv_termio_cline=no
fi
dnl Figure out if /dev/zero exists or not
sim_devzero=""
AC_MSG_CHECKING(for /dev/zero)
AC_CACHE_VAL(ac_cv_devzero,
[AC_TRY_RUN([#include <fcntl.h>
main () {
char buf[2048];
int i;
int fd = open ("/dev/zero", O_RDONLY);
if (fd < 0)
return 1;
for (i = 0; i < sizeof (buf); i++)
buf[i] = 1;
if (read (fd, buf, sizeof (buf)) != sizeof (buf))
return 1;
for (i = 0; i < sizeof (buf); i++)
if (buf[i])
return 1;
return 0;
}],[ac_cv_devzero=yes],[ac_cv_devzero=no],[ac_cv_devzero=no])])
AC_MSG_RESULT($ac_cv_devzero)
if test $ac_cv_devzero = yes; then
sim_devzero="-DHAVE_DEVZERO"
else
sim_devzero=""
fi
AC_SUBST(CC_FOR_BUILD)
AC_SUBST(CFLAGS)
AC_SUBST(HDEFINES)
@ -637,6 +664,7 @@ AC_SUBST(sim_default_model)
AC_SUBST(sim_model_issue)
AC_SUBST(sim_stdio)
AC_SUBST(sim_termio)
AC_SUBST(sim_devzero)
AC_OUTPUT(Makefile,
[case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])