title: Unexpected behavior of sem_open
body: <p>I have the following code:</p>
  
  <pre><code>// DIE is macro i defined for catching errors
  
  semc = sem_open(sem_name, O_CREAT, 0644, 1);    
  DIE(semc == SEM_FAILED, "sem_open");
  
  unsigned int val;
  rc = sem_getvalue(semc, &amp;val);
  DIE(rc == -1, "sem_getvalue");
  printf("sem is %d\n" , val);
  </code></pre>
  
  <p>Although I initialized the semaphore with 1, the value printed is 0 ...
  How can this be explained ?</p>