Hi
I've been working on an STI implementation for wine, and recently I made some progress.
At present I've got a basic STI.DLL and I've made a Linux kernel module replacement of USBSCAN.SYS on Windows. I've only changed CreateFile() and NtDeviceIoControl(). When CreateFile() gets a devicepath "\.\USBSCAN..." it opens the kernel module's device file using open(), and sends the file descriptor to the wine server using wine_server_fd_to_handle(). NtDeviceIoControl() checks the IOCTL code to see whether it is a scanner code, and if so, does an ioctl() call.
The problem seems to be that after running for a couple of seconds, all the file system calls like ioctl() start failing with EBADF (bad file descriptor). Is there something other than wine_server_fd_to_handle() I have to do? The scanning application I am testing uses multiple threads and several processes.
Thank you Damjan
__________________________________ Start your day with Yahoo! - Make it your home page! http://www.yahoo.com/r/hs
Damjan Jovanovic wrote:
The problem seems to be that after running for a couple of seconds, all the file system calls like ioctl() start failing with EBADF (bad file descriptor). Is there something other than wine_server_fd_to_handle() I have to do? The scanning application I am testing uses multiple threads and several processes.
Once you register the handle with wine_server_fd_to_handle(), you need to use wine_server_handle_to_fd() to access it again.
If you're already doing that, you may have a handle leak and be running out of file descriptors. You need to make sure to close the handle you receive from wine_server_handle_to_fd(), as the returned value is a dup'd unix file handle.
Mike
--- Mike McCormack mike@codeweavers.com wrote:
Damjan Jovanovic wrote:
The problem seems to be that after running for a couple of seconds, all the file system calls like ioctl() start failing with EBADF (bad file descriptor). Is there something other than wine_server_fd_to_handle() I have to do? The
scanning
application I am testing uses multiple threads and several processes.
Once you register the handle with wine_server_fd_to_handle(), you need to use wine_server_handle_to_fd() to access it again.
If you're already doing that, you may have a handle leak and be running out of file descriptors. You need to make sure to close the handle you receive from wine_server_handle_to_fd(), as the returned value is a dup'd unix file handle.
Mike
You were right, I wasn't calling wine_server_release_fd(), so wine was hitting the maximum number of open files limit. I fixed it, AND IT SCANS!!!
Thank you Mike, you made my day. I'll be submitting patch in the next few weeks.
__________________________________ Yahoo! Music Unlimited Access over 1 million songs. Try it free. http://music.yahoo.com/unlimited/