title: Trouble Calling ioctl from user-space C
body: <p>I'm trying to implement a program to access memory on an embedded system. I need to access some control register so I think that ioctl is the best way to do it. I have added the ioctl to the fops:</p>
  
  <pre><code>struct file_operations aes_fops = {
    read: aes_read,
    write: aes_write,
    unlocked_ioctl: aes_ioctl,
    open: aes_open,
    release: aes_release
  };
  </code></pre>
  
  <p>And have set up the function:</p>
  
  <pre><code>int aes_ioctl(struct inode *inode,  
       struct file *file, 
       unsigned int ioctl_num,    
       unsigned long ioctl_param){
  
       printk(KERN_INFO "in ioctl\n");
  ....
  }
  </code></pre>
  
  <p>But I am not getting inside of this function. Here is my user space code. Please help me understand if I am doing this totally wrong.</p>
  
  <pre><code>int main(int argc, char* argv[]){
      int fd = fopen("/dev/aes", "r+");
      ioctl(fd, 0, 1);
      fclose(fd);
  }
  </code></pre>
  
  <p>Some of the code is apparently for older kernels, because I am compiling for an embedded system where an older version of Linux has been modified.</p>