File operations on a Windows Driver (character device)

Corinna Vinschen corinna-cygwin@cygwin.com
Thu May 28 10:55:00 GMT 2015


On May 27 17:56, Alessio Faina wrote:
> Thanks Mark and Corinna.
> I'm sorry for the
> <https://cygwin.com/acronyms/#TOFU> and
> <https://cygwin.com/acronyms/#PCYMTNQREAIYR>.,
> I wont make those mistakes in the future, I promise.
> 
> Returning on the issue, I've decided to open the device with the
> open() provided by Cygwin
> and then intercept the IOCTLs and change them with the Win32
> DeviceIoControl (using
> _get_osfhandle() for the handle of the device).
> At this point I can even implement the mmap with an IOCTL without
> problems as I explained
> in a previous mail.
> I cannot use the read/write calls because I need to access the kernel
> memory directly with
> the mmap; in this way I can get better performances.
> 
> The last (and main) problem I'm facing is the poll()/select(); I've
> seen that doing a poll() on
> this kind of device always returns "1" because in
> select.cc->select_stuff::poll() the function
> pointer s->peek is NULL and in that way the counter "n" is always increased.
> 
> What I need to do is something that can be compiled under VS2013 and
> under Cygwin
> for compatibility with applications already written for linux OS;

That's a problem.  For Cygwin to recognize a device it needs support in
CYgwin itself.  What you probably need to write is some kind of
userspace access library which translates the required POSIX calls to
Windows calls when accessing your device.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20150528/4ae43b3c/attachment.sig>


More information about the Cygwin mailing list