Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple sem_open() program doesn't work

Status
Not open for further replies.

eduoli

Programmer
Jul 18, 2002
1
ES
In solaris 2.6 I'm trying this program:
Code:
#include <semaphore.h>
#include <errno.h>
 
int main(void){
  sem_t *semf;
  semf=sem_open(&quot;tsem&quot;,O_CREAT,0644,5);
  if(semf==(void*)-1){
    printf(&quot;No se ha podido crear el semaforo\n&quot;);
    perror(&quot;&quot;);
    exit(1);
  }
  sleep(60);
}
[\code]
with different options in sem_open, I always get an &quot;Invalid Argument&quot; error.

Any idea?

Thanks,
--edu
 
From the man-page for sem_open in solaris:

The name argument conforms to the construction rules for a pathname. The first character of name must be a slash (/) character and the remaining characters of name cannot include any slash characters.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top