title: aio_read from file error on OS X
body: <p>The following code:</p>
  
  <pre><code>#include &lt;fcntl.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;aio.h&gt;
  #include &lt;errno.h&gt;
  
  int main (int argc, char const *argv[])
  {
    char name[] = "abc";
    int fdes;
    if ((fdes = open(name, O_RDWR | O_CREAT, 0600 )) &lt; 0)
      printf("%d, create file", errno);
  
    int buffer[] = {0, 1, 2, 3, 4, 5};
    if (write(fdes, &amp;buffer, sizeof(buffer)) == 0){
      printf("writerr\n");
    }
  
    struct aiocb aio;
    int n = 2;
    while (n--){
      aio.aio_reqprio = 0;
      aio.aio_fildes = fdes;
      aio.aio_offset = sizeof(int);
      aio.aio_sigevent.sigev_notify = SIGEV_NONE; 
  
      int buffer2;
      aio.aio_buf = &amp;buffer2;
      aio.aio_nbytes = sizeof(buffer2);
  
      if (aio_read(&amp;aio) != 0){
        printf("%d, readerr\n", errno);
      }else{
        const struct aiocb *aio_l[] = {&amp;aio};
        if (aio_suspend(aio_l, 1, 0) != 0){
           printf("%d, suspenderr\n", errno);
        }else{
          printf("%d\n", *(int *)aio.aio_buf);
        }
      }
    }
  
    return 0;
  }
  </code></pre>
  
  <p>Works fine on Linux (Ubuntu 9.10, compiled with -lrt), printing</p>
  
  <pre><code>1
  1
  </code></pre>
  
  <p>But fails on OS X (10.6.6 and 10.6.5, I've tested it on two machines):</p>
  
  <pre><code>1
  35, readerr
  </code></pre>
  
  <p>Is this possible that this is due to some library error on OS X, or am I doing something wrong?</p>