Find the answer to your Linux question:
Results 1 to 3 of 3
Hello all, I am porting the code of a device driver from 32bit to 64bit. We have both 32bit and 64bit processes talking to the driver through ioctl, read and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2006
    Posts
    25

    Is there a compat_read/compat_write (CONFIG_COMPAT)???


    Hello all,

    I am porting the code of a device driver from 32bit to 64bit. We have both 32bit and 64bit processes talking to the driver through ioctl, read and write system calls. To handle 32 bit ioctl, we implement the .compat_ioctl. Is there any way that we can handle 32 bit read/write? In the device driver, is there anyway we can tell if a read/write is from a 32 bit process or from a 64 bit process?

    Your help is very much appreciated. Thank you.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,529
    I'm not sure it should matter since you have implemented compat_ioctl() in your driver. When that call is made, you would convert 32 to 64-bit structures and pass to your 64-bit driver code, and vice-versa. I haven't done this, but I did do some reading up on the issue, and this seems to be the method folks use when they have implemented compat_ioctl in their driver. I would suggest that you look at some current 64-bit kernel drivers that have implemented this, such as fs/compat_ioctl.c, drivers/char/agp/compat_ioctl.c, and block/compat_ioctl.c
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Mar 2006
    Posts
    25
    Hello Rubberman,

    Thank you for your reply. We already implemented the compat_ioctl() to handle 32 bit ioctl. But don't know if there 's something similar to that to handle 32bit read/write (from 32 bit process).

    Regards,
    pvpnguyen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •