Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@elta.co.il>
To: gdb-patches@sources.redhat.com
Subject: [RFC] Fix compilation failure of remote-fileio.c
Date: Sun, 28 Dec 2003 13:50:00 -0000	[thread overview]
Message-ID: <ubrpt6odu.fsf@elta.co.il> (raw)

remote-fileio.c won't compile if `struct stat' doesn't have the
`st_blocks' member.  The patch below fixes that, but I'm not sure it
(and the associated patch to gdb/configure.in, which is not shown
below) is the right fix.  Is it perhaps better not to use st_blocks at
all, and instead compute the number of blocks as shown by the patch,
for all platforms?

2003-12-28  Eli Zaretskii  <eliz@elta.co.il>

	* 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 in their `struct stat'.


--- gdb/remote-fileio.c~0	2003-06-11 13:50:10.000000000 +0000
+++ gdb/remote-fileio.c	2003-12-28 10:21:06.000000000 +0000
@@ -411,7 +411,13 @@ remote_fileio_to_fio_stat (struct stat *
   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
+  remote_fileio_to_fio_ulong ((LONGEST) st->st_size / (LONGEST) st->st_blksize
+			      + ((LONGEST) st->st_size % (LONGEST) st->st_blksize) != 0,
+			      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 +1137,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


             reply	other threads:[~2003-12-28 13:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-28 13:50 Eli Zaretskii [this message]
2003-12-28 23:38 ` Daniel Jacobowitz
2003-12-29  7:01   ` Eli Zaretskii
2003-12-29 16:01     ` Daniel Jacobowitz
2003-12-30  7:20       ` Eli Zaretskii
2003-12-30  8:26 Michael Elizabeth Chastain
2003-12-30  9:12 ` Eli Zaretskii
2003-12-30 10:34 ` Eli Zaretskii
2003-12-30 19:20 Michael Elizabeth Chastain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ubrpt6odu.fsf@elta.co.il \
    --to=eliz@elta.co.il \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox