gcc get.c -o get -lpthread

#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>
#include <semaphore.h>
#include <stdio.h>
int
main(int argc,char**argv)
{
//sem_t *sem;
int val;
if(argc != 2)
return -1;
//i sem=sem_open(argv[1],O_CREAT,0777,0);

sem_t * p = sem_open(argv[1], O_CREAT, 0777, val);
sem_getvalue(p,&val);
printf("value = %d\n",val);
printf("hello,world");

}