This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[PATCH] Fix FileChannelImpl::available failure on s390x
- From: "Ulrich Weigand" <weigand at i1 dot informatik dot uni-erlangen dot de>
- To: gcc-patches at gcc dot gnu dot org, java-patches at gcc dot gnu dot org
- Date: Tue, 19 Oct 2004 23:46:00 +0200 (CEST)
- Subject: [PATCH] Fix FileChannelImpl::available failure on s390x
Hello,
I've found the cause of the intermittent Process_[123] test case failures
on s390x-ibm-linux (64-bit only). It turned out to be a call to the
FIONREAD ioctl using an incorrect parameter: the Linux kernel assumes
the argument is an 'int *', not a 'long *'.
The following patch fixes the above-mentioned test case failures.
Bootstrapped/regtested on s390-ibm-linux and s390x-ibm-linux.
OK for mainline?
Bye,
Ulrich
ChangeLog:
* gnu/java/nio/channels/natFileChannelPosix.cc
(FileChannelImpl::available): Call FIONREAD ioctl with 'int *'
argument instead of 'long *'.
Index: libjava/gnu/java/nio/channels/natFileChannelPosix.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/channels/natFileChannelPosix.cc,v
retrieving revision 1.4
diff -c -p -r1.4 natFileChannelPosix.cc
*** libjava/gnu/java/nio/channels/natFileChannelPosix.cc 17 Jul 2004 13:46:02 -0000 1.4
--- libjava/gnu/java/nio/channels/natFileChannelPosix.cc 19 Oct 2004 19:12:29 -0000
*************** jint
*** 380,386 ****
FileChannelImpl::available (void)
{
#if defined (FIONREAD) || defined (HAVE_SELECT) || defined (HAVE_FSTAT)
! long num = 0;
int r = 0;
bool num_set = false;
--- 380,386 ----
FileChannelImpl::available (void)
{
#if defined (FIONREAD) || defined (HAVE_SELECT) || defined (HAVE_FSTAT)
! int num = 0;
int r = 0;
bool num_set = false;
*************** FileChannelImpl::available (void)
*** 423,429 ****
&& S_ISREG (sb.st_mode)
&& (where = lseek (fd, 0, SEEK_CUR)) != (off_t) -1)
{
! num = (long) (sb.st_size - where);
num_set = true;
}
}
--- 423,429 ----
&& S_ISREG (sb.st_mode)
&& (where = lseek (fd, 0, SEEK_CUR)) != (off_t) -1)
{
! num = (int) (sb.st_size - where);
num_set = true;
}
}
--
Dr. Ulrich Weigand
weigand@informatik.uni-erlangen.de