aboutsummaryrefslogtreecommitdiff
path: root/sim/common/callback.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2005-04-29 14:48:03 +0000
committerPaul Brook <paul@codesourcery.com>2005-04-29 14:48:03 +0000
commit33aa0cbb6b98b9b52070d0cdbf6462dfdd7070ec (patch)
tree69e534aad1bc4888265affcae8b87215437d9587 /sim/common/callback.c
parent547b869acde1ba964366d966c020340b243b1080 (diff)
downloadgdb-33aa0cbb6b98b9b52070d0cdbf6462dfdd7070ec.zip
gdb-33aa0cbb6b98b9b52070d0cdbf6462dfdd7070ec.tar.gz
gdb-33aa0cbb6b98b9b52070d0cdbf6462dfdd7070ec.tar.bz2
2005-04-29 Paul Brook <paul@codesourcery.com>
* common/callback.c (PIPE_BUF): Provide default refinition. (os_lstat): Use stat if lstat is not available on the host. (os_ftruncate): Return EINVAL if not available on the host. (os_truncate): Ditto. * common/configure.ac: Check for lstat, truncate and ftruncate. * common/configure: Regenerate. * common/config.in: Regenerate.
Diffstat (limited to 'sim/common/callback.c')
-rw-r--r--sim/common/callback.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sim/common/callback.c b/sim/common/callback.c
index 512590d..bb7bc47 100644
--- a/sim/common/callback.c
+++ b/sim/common/callback.c
@@ -60,6 +60,10 @@
#include <unistd.h>
#endif
+#ifndef PIPE_BUF
+#define PIPE_BUF 512
+#endif
+
/* ??? sim_cb_printf should be cb_printf, but until the callback support is
broken out of the simulator directory, these are here to not require
sim-utils.h. */
@@ -577,7 +581,11 @@ os_lstat (p, file, buf)
struct stat *buf;
{
/* NOTE: hpn/2004-12-12: Same issue here as with os_fstat. */
+#ifdef HAVE_LSTAT
return wrap (p, lstat (file, buf));
+#else
+ return wrap (p, stat (file, buf));
+#endif
}
static int
@@ -596,7 +604,12 @@ os_ftruncate (p, fd, len)
}
if (result)
return result;
+#ifdef HAVE_FTRUNCATE
result = wrap (p, ftruncate (fdmap (p, fd), len));
+#else
+ p->last_errno = EINVAL;
+ result = -1;
+#endif
return result;
}
@@ -606,7 +619,12 @@ os_truncate (p, file, len)
const char *file;
long len;
{
+#ifdef HAVE_TRUNCATE
return wrap (p, truncate (file, len));
+#else
+ p->last_errno = EINVAL;
+ return -1;
+#endif
}
static int