Find the answer to your Linux question:
Results 1 to 2 of 2
Hi I am getting this error: ioctl: inappropriate ioctl for device on the ioctl() call shown below. Code: fd = open(mount, O_RDONLY); destid = ioctl(fd, TRACEFS_IOCTL_ADD_OUTPUT_DRIVERS, data); #define IOCBASE 10 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2012
    Posts
    6

    ioctl: inappropriate ioctl for device


    Hi I am getting this error: ioctl: inappropriate ioctl for device on the ioctl() call shown below.
    Code:
    fd = open(mount, O_RDONLY);
    
    destid = ioctl(fd, TRACEFS_IOCTL_ADD_OUTPUT_DRIVERS, data);
    
    
    
    #define IOCBASE 10
    
    #define TRACEFS_IOCTL_ADD_OUTPUT_DRIVERS    _IOW(0x15, IOCBASE + 0, int)
    I am not sure how to debug this issue or go about resolving the error.

    Any help would be greatly appreciated. Thanks.

  2. #2
    Just Joined!
    Join Date
    Oct 2012
    Posts
    6
    From this article
    site: lwn,, Kernel/LDD3/
    Chapter 6.1 (cant post links just yet)

    It seems that the ioctl command is not a proper command:

    The POSIX standard, however, states that if an inappropriate ioctl command has been issued, then -ENOTTY should be returned. This error code is interpreted by the C library as "inappropriate ioctl for device," which is usually exactly what the programmer needs to hear.

    So how is it determined that the ioctl is a proper command? or how can I find out the list of valid commands, which I believe are user defined:

    #define IOCBASE 10
    /* Add output driver stack. Returns integer ID. */
    #define TRACEFS_IOCTL_ADD_OUTPUT_DRIVERS _IOW(0x15, IOCBASE + 0, int)
    /* Add assembly driver on top of output driver stack. */
    #define TRACEFS_IOCTL_ADD_ASSEMBLY_DRIVERS _IOW(0x15, IOCBASE + 1, int)


    Another question is what is a proper value for IOCBASE?

    Thanks.

Posting Permissions

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