title: trying to add FIFO queue system call
body: <p>I'm currently taking an Operating System class at my school.</p>
  
  <p>Right now, I've been trying to add some new system call that makes a queue in the kernel space.</p>
  
  <p>I'm trying to do three things here:</p>
  
  <p>1) make the queue(either by dynamically allocating or just declaring an array)</p>
  
  <p>2) enqueue</p>
  
  <p>3) dequeue</p>
  
  <p>The problem is with 1).</p>
  
  <p>Here's a sample code for the system call source file:</p>
  
  <pre><code>asmlinkage long sys_allocqueue(unsigned int size){
     int *queue = kmalloc(sizeof(int) * size, GFP_KERNEL);
     return 0;
  }
  </code></pre>
  
  <p>and this is just declaring array:</p>
  
  <pre><code>asmlinkage long sys_allocqueue(unsigned int size){
     int queue[size];
     return 0;
  }
  </code></pre>
  
  <p>Either way, I'm getting a return of -1 which is an error for syscall in a test application.</p>
  
  <p>I have no clue why this is not working.</p>
  
  <p>P.S.</p>
  
  <p>I also found out about using kfifo.h for creating a queue, but that did not work out well either.</p>