From 3ca4d560ef5ba6cd8585dc5214df2f53feab2eed Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Fri, 29 Sep 2006 02:45:48 +0000 Subject: [PATCH] * cris/configure.ac: Check for limits.h and sys/param.h. * cris/configure, cris/config.in: Rebuild. * cris/traps.c (SIM_PATHMAX): New macro. (cris_break_13_handler): Use SIM_PATHMAX, not MAXPATHLEN. --- sim/ChangeLog | 7 +++ sim/cris/config.in | 108 ++++++++++++++++++++++++++++++++++++++++++ sim/cris/configure | 4 +- sim/cris/configure.ac | 2 +- sim/cris/traps.c | 33 +++++++++---- 5 files changed, 143 insertions(+), 11 deletions(-) diff --git a/sim/ChangeLog b/sim/ChangeLog index b68d793fd39..d68f2300ea1 100644 --- a/sim/ChangeLog +++ b/sim/ChangeLog @@ -1,3 +1,10 @@ +2006-09-29 Hans-Peter Nilsson + + * cris/configure.ac: Check for limits.h and sys/param.h. + * cris/configure, cris/config.in: Rebuild. + * cris/traps.c (SIM_PATHMAX): New macro. + (cris_break_13_handler): Use SIM_PATHMAX, not MAXPATHLEN. + 2006-08-08 Joel Sherrill * configure.ac (sparc-*-rtems*|sparc-*-elf*): Enable erc32 simulator. diff --git a/sim/cris/config.in b/sim/cris/config.in index e69de29bb2d..41eb0868593 100644 --- a/sim/cris/config.in +++ b/sim/cris/config.in @@ -0,0 +1,108 @@ +/* config.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#undef ENABLE_NLS + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ERRNO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FPU_CONTROL_H + +/* Define to 1 if you have the `getrusage' function. */ +#undef HAVE_GETRUSAGE + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define to 1 if you have the `socket' library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `sigaction' function. */ +#undef HAVE_SIGACTION + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_RESOURCE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the `time' function. */ +#undef HAVE_TIME + +/* Define to 1 if you have the header file. */ +#undef HAVE_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `__setfpucw' function. */ +#undef HAVE___SETFPUCW + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN diff --git a/sim/cris/configure b/sim/cris/configure index 47065279f6d..96bb0cc6aad 100755 --- a/sim/cris/configure +++ b/sim/cris/configure @@ -4355,7 +4355,9 @@ sim_link_links="${sim_link_links} targ-vals.def" # For dv-rv and rvdummy. -for ac_header in sys/socket.h sys/select.h + + +for ac_header in sys/socket.h sys/select.h limits.h sys/param.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then diff --git a/sim/cris/configure.ac b/sim/cris/configure.ac index a349d8da945..6ff1c0e6559 100644 --- a/sim/cris/configure.ac +++ b/sim/cris/configure.ac @@ -10,7 +10,7 @@ sinclude(../common/aclocal.m4) sinclude(../common/common.m4) # For dv-rv and rvdummy. -AC_CHECK_HEADERS(sys/socket.h sys/select.h) +AC_CHECK_HEADERS(sys/socket.h sys/select.h limits.h sys/param.h) SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT) SIM_AC_OPTION_HOSTENDIAN diff --git a/sim/cris/traps.c b/sim/cris/traps.c index 2eb0a1b4d24..487fadd83a1 100644 --- a/sim/cris/traps.c +++ b/sim/cris/traps.c @@ -38,6 +38,21 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifdef HAVE_SYS_STAT_H #include #endif +/* For PATH_MAX, originally. */ +#ifdef HAVE_LIMITS_H +#include +#endif + +/* From ld/sysdep.h. */ +#ifdef PATH_MAX +# define SIM_PATHMAX PATH_MAX +#else +# ifdef MAXPATHLEN +# define SIM_PATHMAX MAXPATHLEN +# else +# define SIM_PATHMAX 1024 +# endif +#endif /* The verbatim values are from asm-cris/unistd.h. */ @@ -2413,8 +2428,8 @@ cris_break_13_handler (SIM_CPU *current_cpu, USI callnum, USI arg1, USI buf = arg1; USI size = arg2; - char *cwd = xmalloc (MAXPATHLEN); - if (cwd != getcwd (cwd, MAXPATHLEN)) + char *cwd = xmalloc (SIM_PATHMAX); + if (cwd != getcwd (cwd, SIM_PATHMAX)) abort (); /* FIXME: When and if we support chdir, we need something @@ -2440,8 +2455,8 @@ cris_break_13_handler (SIM_CPU *current_cpu, USI callnum, USI arg1, SI path = arg1; SI buf = arg2; SI bufsiz = arg3; - char *pbuf = xmalloc (MAXPATHLEN); - char *lbuf = xmalloc (MAXPATHLEN); + char *pbuf = xmalloc (SIM_PATHMAX); + char *lbuf = xmalloc (SIM_PATHMAX); char *lbuf_alloc = lbuf; int nchars = -1; int i; @@ -2453,7 +2468,7 @@ cris_break_13_handler (SIM_CPU *current_cpu, USI callnum, USI arg1, o += strlen (simulator_sysroot); } - for (i = 0; i + o < MAXPATHLEN; i++) + for (i = 0; i + o < SIM_PATHMAX; i++) { pbuf[i + o] = sim_core_read_unaligned_1 (current_cpu, pc, 0, path + i); @@ -2461,7 +2476,7 @@ cris_break_13_handler (SIM_CPU *current_cpu, USI callnum, USI arg1, break; } - if (i + o == MAXPATHLEN) + if (i + o == SIM_PATHMAX) { retval = -cb_host_to_target_errno (cb, ENAMETOOLONG); break; @@ -2497,8 +2512,8 @@ cris_break_13_handler (SIM_CPU *current_cpu, USI callnum, USI arg1, } else { - if (getcwd (lbuf, MAXPATHLEN) != NULL - && strlen (lbuf) + 2 + strlen (argv0) < MAXPATHLEN) + if (getcwd (lbuf, SIM_PATHMAX) != NULL + && strlen (lbuf) + 2 + strlen (argv0) < SIM_PATHMAX) { if (strncmp (simulator_sysroot, lbuf, strlen (simulator_sysroot)) == 0) @@ -2513,7 +2528,7 @@ cris_break_13_handler (SIM_CPU *current_cpu, USI callnum, USI arg1, } } else - nchars = readlink (pbuf, lbuf, MAXPATHLEN); + nchars = readlink (pbuf, lbuf, SIM_PATHMAX); /* We trust that the readlink result returns a *relative* link, or one already adjusted for the file-path-prefix. -- 2.30.2