From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21362 invoked by alias); 28 Dec 2003 13:50:32 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 21354 invoked from network); 28 Dec 2003 13:50:31 -0000 Received: from unknown (HELO monty-python.gnu.org) (199.232.76.173) by sources.redhat.com with SMTP; 28 Dec 2003 13:50:31 -0000 Received: from [207.232.27.5] (helo=WST0054) by monty-python.gnu.org with asmtp (Exim 4.24) id 1AacGn-0008GW-V6 for gdb-patches@sources.redhat.com; Sun, 28 Dec 2003 09:51:54 -0500 Date: Sun, 28 Dec 2003 13:50:00 -0000 Message-Id: From: Eli Zaretskii To: gdb-patches@sources.redhat.com Subject: [RFC] Fix compilation failure of remote-fileio.c Reply-to: Eli Zaretskii X-SW-Source: 2003-12/txt/msg00494.txt.bz2 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 * 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