Inappropriate ioctl for device from FileOutputStream.close()

空扰寡人 提交于 2019-12-06 01:41:12

I am pretty sure you are correct with the 32/64 bit mode idea. We had this issue a couple of years ago working on an embedded device, the error was stemming from a lib that we were using to talk to a pci switch and the library did not support 64 bit ioctls.

My suggestion if you really want to get to the bottom of it and I have used this technique to debug jni code. Set a break point in the java app, then use gdb to attach to the process. You can then set a break point in gdb to watch for the ioctl on the device. See which request is being sent to the device and verify that it is correctly support for that architecture.

If fileoutput stream is reading from a filesystem file and not another type of device file. Then this is probably a problem with selinux, or some kind of virtualization like a chroot environment as in the following link.

This link may point in the right direction. It was a problem with the chroot
http://us.generation-nt.com/answer/sndctl-tmr-timebase-tcgets-help-170073041.html

Also definitely check the jre they are running, is it openjdk or is it sun java? I have had some very odd quirks with the older gcc jdk java and this may explain some of the discrepancies.

Java's close() method is a thin wrapper around the OS native close(); it will translate the native error code into an exception.

The linked-to docs are relatively ambiguous about what could cause a close to fail, noting that errors during write may be reported by close, and that "This can especially be observed with NFS...".

So, to debug I'd first look at the name of the file, and where the file is being stored for this particular user. I wouldn't place too much emphasis on non-close()-related hits for "Inappropriate ioctl".

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!