summaryrefslogtreecommitdiff
path: root/gdb/remote-fileio.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2003-12-30 06:52:09 +0000
committerEli Zaretskii <eliz@gnu.org>2003-12-30 06:52:09 +0000
commit0fb99254cb1ed72d00a00e16288969c571389f5d (patch)
treef385fffb5cd9957a4e09d5798a13d267dbdb963a /gdb/remote-fileio.c
parent3cbf68ded34c222edc122f2f0c4fd42f2bff4af1 (diff)
downloadgdb-0fb99254cb1ed72d00a00e16288969c571389f5d.tar.gz
* remote-fileio.c (remote_fileio_to_fio_stat)
(remote_fileio_func_fstat) [HAVE_STRUCT_STAT_ST_BLOCKS]: Support systems that don't have `st_blocks' member in `struct stat'. * configure.in (HAVE_STRUCT_STAT_ST_BLOCKS): Ditto.
Diffstat (limited to 'gdb/remote-fileio.c')
-rw-r--r--gdb/remote-fileio.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c
index fd57617acd5..ead40f04783 100644
--- a/gdb/remote-fileio.c
+++ b/gdb/remote-fileio.c
@@ -411,7 +411,16 @@ remote_fileio_to_fio_stat (struct stat *st, struct fio_stat *fst)
remote_fileio_to_fio_uint ((long) st->st_rdev, fst->fst_rdev);
remote_fileio_to_fio_ulong ((LONGEST) st->st_size, fst->fst_size);
remote_fileio_to_fio_ulong ((LONGEST) st->st_blksize, fst->fst_blksize);
+#if HAVE_STRUCT_STAT_ST_BLOCKS
remote_fileio_to_fio_ulong ((LONGEST) st->st_blocks, fst->fst_blocks);
+#else
+ /* FIXME: This is correct for DJGPP, but other systems that don't
+ have st_blocks, if any, might prefer 512 instead of st_blksize.
+ (eliz, 30-12-2003) */
+ remote_fileio_to_fio_ulong (((LONGEST) st->st_size + st->st_blksize - 1)
+ / (LONGEST) st->st_blksize,
+ fst->fst_blocks);
+#endif
remote_fileio_to_fio_time (st->st_atime, fst->fst_atime);
remote_fileio_to_fio_time (st->st_mtime, fst->fst_mtime);
remote_fileio_to_fio_time (st->st_ctime, fst->fst_ctime);
@@ -1131,7 +1140,9 @@ remote_fileio_func_fstat (char *buf)
st.st_rdev = 0;
st.st_size = 0;
st.st_blksize = 512;
+#if HAVE_STRUCT_STAT_ST_BLOCKS
st.st_blocks = 0;
+#endif
if (!gettimeofday (&tv, NULL))
st.st_atime = st.st_mtime = st.st_ctime = tv.tv_sec;
else