From: Ian Lance Taylor <ian@wasabisystems.com>
To: gdb-patches@sourceware.org
Subject: PATCH RFA: Handle lack of struct statfs in ppc/sim/emul_netbsd.c
Date: Tue, 21 Sep 2004 02:26:00 -0000 [thread overview]
Message-ID: <20040921022638.24707.qmail@gossamer.airs.com> (raw)
NetBSD post 2.0 has deprecated statfs in favor of statvfs. The statfs
system call still exists for compatibility purposes (if COMPAT_20),
but struct statfs has been removed from the header files.
This breaks the PowerPC simulator, which assumes that the existence of
the statfs function implies the existence of struct statfs.
This patch fixes this problem in the obvious way.
I'm not sure why the NetBSD emulation implements fstatfs(). With this
patch, it will stop doing so. If implementing fstatfs() is important,
somebody will have to add support for the new fstatvfs() system call.
OK for mainline?
Ian
* configure.in: Check for sys/mount.h, sys/vfs.h, sys/statfs.h.
Check for struct statfs.
* emul_netbsd.c: If not HAVE_STRUCT_STATFS, #undef HAVE_FSTATFS.
* configure, config.in: Regenerate.
[ Diffs for configure and config.in omitted ]
Index: configure.in
===================================================================
RCS file: /cvs/src/src/sim/ppc/configure.in,v
retrieving revision 1.5
diff -u -r1.5 configure.in
--- configure.in 11 May 2004 02:21:58 -0000 1.5
+++ configure.in 21 Sep 2004 02:19:53 -0000
@@ -585,7 +585,7 @@
AC_CHECK_FUNCS(access cfgetispeed cfgetospeed cfsetispeed cfsetospeed chdir chmod chown dup dup2 fchmod fchown fcntl fstat fstatfs getdirentries getegid geteuid getgid getpid getppid getrusage gettimeofday getuid ioctl kill link lseek lstat mkdir pipe readlink rmdir setreuid setregid stat sigprocmask stat symlink tcgetattr tcsetattr tcsendbreak tcdrain tcflush tcflow tcgetpgrp tcsetpgrp time umask unlink)
-AC_CHECK_HEADERS(fcntl.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h time.h unistd.h)
+AC_CHECK_HEADERS(fcntl.h stdlib.h string.h strings.h sys/ioctl.h sys/mount.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h time.h unistd.h sys/vfs.h sys/statfs.h)
AC_HEADER_DIRENT
dnl Figure out what type of termio/termios support there is
@@ -658,6 +658,30 @@
ac_cv_termio_cline=no
fi
+dnl Check for struct statfs
+AC_MSG_CHECKING(for struct statfs)
+AC_CACHE_VAL(ac_cv_struct_statfs,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#ifdef HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+#ifdef HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif],
+[static struct statfs s;],
+ac_cv_struct_statfs=yes, ac_cv_struct_statfs=no)])
+AC_MSG_RESULT($ac_cv_struct_statfs)
+if test $ac_cv_struct_statfs = yes; then
+ AC_DEFINE(HAVE_STRUCT_STATFS, 1,
+ [Define if struct statfs is defined in <sys/mount.h>])
+fi
+
dnl Figure out if /dev/zero exists or not
sim_devzero=""
AC_MSG_CHECKING(for /dev/zero)
Index: emul_netbsd.c
===================================================================
RCS file: /cvs/src/src/sim/ppc/emul_netbsd.c,v
retrieving revision 1.4
diff -u -r1.4 emul_netbsd.c
--- emul_netbsd.c 17 Oct 2003 00:15:25 -0000 1.4
+++ emul_netbsd.c 21 Sep 2004 02:19:53 -0000
@@ -94,6 +94,14 @@
#include <sys/sysctl.h>
#include <sys/mount.h>
extern int getdirentries(int fd, char *buf, int nbytes, long *basep);
+
+/* NetBSD post 2.0 has the statfs system call (if COMPAT_20), but does
+ not have struct statfs. In this case don't implement fstatfs.
+ FIXME: Should implement fstatvfs. */
+#ifndef HAVE_STRUCT_STATFS
+#undef HAVE_FSTATFS
+#endif
+
#else
/* If this is not netbsd, don't allow fstatfs or getdirentries at this time */
next reply other threads:[~2004-09-21 2:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-21 2:26 Ian Lance Taylor [this message]
2004-09-24 18:11 ` Andrew Cagney
2004-09-24 20:09 ` Ian Lance Taylor
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=20040921022638.24707.qmail@gossamer.airs.com \
--to=ian@wasabisystems.com \
--cc=gdb-patches@sourceware.org \
/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