This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

irix porting problem


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 <*>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]