From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15400 invoked by alias); 16 Mar 2005 16:37:27 -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 14855 invoked from network); 16 Mar 2005 16:37:15 -0000 Received: from unknown (HELO sethra.codesourcery.com) (65.74.133.9) by sourceware.org with SMTP; 16 Mar 2005 16:37:15 -0000 Received: from sethra.codesourcery.com (localhost.localdomain [127.0.0.1]) by sethra.codesourcery.com (8.12.11/8.12.11) with ESMTP id j2GGbEcJ023705 for ; Wed, 16 Mar 2005 08:37:14 -0800 Received: (from mitchell@localhost) by sethra.codesourcery.com (8.12.11/8.12.11/Submit) id j2GGbEAw023701; Wed, 16 Mar 2005 08:37:14 -0800 Date: Wed, 16 Mar 2005 16:37:00 -0000 Message-Id: <200503161637.j2GGbEAw023701@sethra.codesourcery.com> From: Mark Mitchell To: gdb-patches@sources.redhat.com Subject: PATCH: Adjust for more Windows oddities Reply-to: mark@codesourcery.com X-SW-Source: 2005-03/txt/msg00213.txt.bz2 Windows does not have getuid or getgid, so I've added autoconf checks for those functions. There is also no "st_blksize" member in "struct stat". Technically, this patch should perhaps be two separate patches, but since the code modified in remote-fileio.c was all in the same place, I've submitted it as one patch. Tested on x86_64-unknown-linux-gnu. OK to apply? (After this patch, we'll be on to the "good part".) -- Mark Mitchell CodeSourcery, LLC mark@codesourcery.com 2005-03-16 Mark Mitchell * configure.ac (stat.st_blksize): Check for it. (getuid): Likewise. (getgid): Likewise. * configure: Regenerated. * config.in: Likewise. * remote-fileio.c (remote_fileio_to_fio_stat): Check HAVE_STRUCT_STAT_ST_BLKSIZE. Index: configure.ac =================================================================== RCS file: /cvs/src/src/gdb/configure.ac,v retrieving revision 1.14 diff -c -5 -p -r1.14 configure.ac *** configure.ac 13 Mar 2005 05:37:48 -0000 1.14 --- configure.ac 16 Mar 2005 16:30:21 -0000 *************** AC_CHECK_DECLS(getopt) *** 423,432 **** --- 423,433 ---- # ----------------------- # # Checks for structures. # # ----------------------- # AC_CHECK_MEMBERS([struct stat.st_blocks]) + AC_CHECK_MEMBERS([struct stat.st_blksize]) # ------------------ # # Checks for types. # # ------------------ # *************** AC_C_INLINE *** 445,454 **** --- 446,456 ---- AC_FUNC_ALLOCA AC_FUNC_MMAP AC_FUNC_VFORK AC_CHECK_FUNCS(canonicalize_file_name realpath) + AC_CHECK_FUNCS(getuid getgid) AC_CHECK_FUNCS(poll) AC_CHECK_FUNCS(pread64) AC_CHECK_FUNCS(sbrk) AC_CHECK_FUNCS(setpgid setpgrp) AC_CHECK_FUNCS(sigaction sigprocmask sigsetmask) Index: remote-fileio.c =================================================================== RCS file: /cvs/src/src/gdb/remote-fileio.c,v retrieving revision 1.13 diff -c -5 -p -r1.13 remote-fileio.c *** remote-fileio.c 16 Mar 2005 15:58:41 -0000 1.13 --- remote-fileio.c 16 Mar 2005 16:30:21 -0000 *************** remote_fileio_to_fio_ulong (LONGEST num, *** 415,441 **** } static void remote_fileio_to_fio_stat (struct stat *st, struct fio_stat *fst) { /* `st_dev' is set in the calling function */ remote_fileio_to_fio_uint ((long) st->st_ino, fst->fst_ino); remote_fileio_to_fio_mode (st->st_mode, fst->fst_mode); remote_fileio_to_fio_uint ((long) st->st_nlink, fst->fst_nlink); remote_fileio_to_fio_uint ((long) st->st_uid, fst->fst_uid); remote_fileio_to_fio_uint ((long) st->st_gid, fst->fst_gid); 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); --- 415,448 ---- } static void remote_fileio_to_fio_stat (struct stat *st, struct fio_stat *fst) { + LONGEST blksize; + /* `st_dev' is set in the calling function */ remote_fileio_to_fio_uint ((long) st->st_ino, fst->fst_ino); remote_fileio_to_fio_mode (st->st_mode, fst->fst_mode); remote_fileio_to_fio_uint ((long) st->st_nlink, fst->fst_nlink); remote_fileio_to_fio_uint ((long) st->st_uid, fst->fst_uid); remote_fileio_to_fio_uint ((long) st->st_gid, fst->fst_gid); remote_fileio_to_fio_uint ((long) st->st_rdev, fst->fst_rdev); remote_fileio_to_fio_ulong ((LONGEST) st->st_size, fst->fst_size); ! #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE ! blksize = st->st_blksize; ! #else ! blksize = 512; ! #endif ! remote_fileio_to_fio_ulong (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 + blksize - 1) ! / 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); *************** remote_fileio_func_fstat (char *buf) *** 1148,1162 **** --- 1155,1179 ---- if (fd == FIO_FD_CONSOLE_IN || fd == FIO_FD_CONSOLE_OUT) { remote_fileio_to_fio_uint (1, fst.fst_dev); st.st_mode = S_IFCHR | (fd == FIO_FD_CONSOLE_IN ? S_IRUSR : S_IWUSR); st.st_nlink = 1; + #if HAVE_GETUID st.st_uid = getuid (); + #else + st.st_uid = 0; + #endif + #if HAVE_GETGID st.st_gid = getgid (); + #else + st.st_gid = 0; + #endif st.st_rdev = 0; st.st_size = 0; + #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE st.st_blksize = 512; + #endif #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;