This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
irix porting problem
- To: java-discuss@sourceware.cygnus.com
- Subject: irix porting problem
- From: jmc@cmpharm.ucsf.edu
- Date: Thu, 1 Jul 1999 08:04:43 -0700 (PDT)
I've been testing libjava on IRIX 6.5, using the gc patches from
Gilles Zunino, and noticed the following bug: the available()
method for a FileInputStream is always zero. I traced this back
to natFileDescriptor.cc, and found that the ioctl call to find
out how many bytes are available always seems to return zero.
The following test program works on linux, showing the total
number of bytes in a file, but always gets zero on irix.
Does anybody know the correct way to do this?
Thanks,
JMC
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
int main(int argc, char **argv) {
int fd;
int rv;
size_t num;
fd = open(argv[1],O_RDONLY); /* O_NDELAY also? no change in result. */
if (fd== -1)
perror("fd open()");
rv = ioctl(fd,FIONREAD,&num);
printf("rv is %d; num is %ld\n",rv,num);
}
--
John-Marc Chandonia (jmc@cmpharm.ucsf.edu) We're everywhere...
Cohen Lab, University of California San Francisco for your convenience.
http://yuri.harvard.edu/~jmc -- Psi Corps <*>