Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] Fix compilation failure of remote-fileio.c
@ 2003-12-28 13:50 Eli Zaretskii
  2003-12-28 23:38 ` Daniel Jacobowitz
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2003-12-28 13:50 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: [RFC] Fix compilation failure of remote-fileio.c
@ 2003-12-30  8:26 Michael Elizabeth Chastain
  2003-12-30  9:12 ` Eli Zaretskii
  2003-12-30 10:34 ` Eli Zaretskii
  0 siblings, 2 replies; 9+ messages in thread
From: Michael Elizabeth Chastain @ 2003-12-30  8:26 UTC (permalink / raw)
  To: eliz; +Cc: gdb-patches

Hi Eli,

src/gdb/configure is produced with this version of autoconf:

  ftp://sources.redhat.com/pub/binutils/autoconf-000227.tar.bz2

This version of autoconf identifies itself as "autoconf version 2.13",
but produces different "configure" files than autoconf 2.13.
Fun fun fun!

The difference is that autoconf-000227 has some "--site-file"
stuff in it that I don't even understand.  But that's the blessed
version for gdb.

eli> Because running Autoconf 2.13 installed on fencepost.gnu.org
eli> produces quite a few errors about undefined macros.  What am I missing?

Oddly, when I run the real autoconf 2.13 on current cvs HEAD,
it does run.  It just produces a different "configure" than the
version in cvs.  autoconf 000227 produces the identical "configure".
So if you are getting "undefined macros" then there is something
even more wrong.

I would recommend:

  -- download autoconf 000227
  -- build your own private copy of it
  -- check that it generates identical "configure"

Do that before banging on configure.in

eli> Also, if it _is_ Autoconf 2.13, then it seems like it doesn't know
eli> about AC_CHECK_MEMBER, so what should I put in configure.in for
eli> testing the existence of st_blocks?

Maybe cut-and-paste from the l_addr check?

Michael C


^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: [RFC] Fix compilation failure of remote-fileio.c
@ 2003-12-30 19:20 Michael Elizabeth Chastain
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Elizabeth Chastain @ 2003-12-30 19:20 UTC (permalink / raw)
  To: eliz; +Cc: gdb-patches

eli> Okay, but how do you run autoconf to regenerate gdb/configure?  I'm
eli> used to have some Makefile rule to DTRT, but I cannot seem to find it
eli> in the current CVS, or did I miss something?

It's easy.  You just run autoconf without any parameters:

  mv configure SAVE-configure
  /berman/migchain/install/host/autoconf-000227/bin/autoconf
  diff SAVE-configure configure

You could mess with your $PATH, but I find it easier to just type
in the long path name (using a lot of TAB autocompletion the first
time, and "!/" after that).

eli> Thanks, I suspected that AC_TRY_COMPILE is the only way to go, but I
eli> wasn't sure, as my autoconf experience is virtually non-existent.

My autoconf skills are only a little bit higher than yours, so if
Nathanael or Daniel comes in and tells you to do it different,
that's fine.

Michael C


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-12-30 19:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-28 13:50 [RFC] Fix compilation failure of remote-fileio.c Eli Zaretskii
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox