Hi !

I would like to use named semaphores but I have an error message when I
try to create one.

The following attached test code (sem.c) compiles and runs under Tru64
(DECUNIX) but fails with the message "Function not implemented" when
compiled and run on Redhat 6.1 :

cc sem.c -lrt
a.out
sem_open: Function not implemented

Could someone tell me the good procedure to follow.

How to get a system supporting named semaphores and POSIX calls ?

Thanks in advance,

***
Christophe DIARRA
Institut de Physique Nucleaire
15, Rue Georges Clemenceau
Bat 102 - S2I
91406 ORSAY Cedex
Tel: (33) 1 69 15 65 60
Fax: (33) 1 69 15 45 03
     (33) 1 69 15 64 70
E-mail: [EMAIL PROTECTED]
***
#include<stdio.h>
#include<fcntl.h>
#include<semaphore.h>
main()
{
sem_t *sem;
int value;

sem = sem_open("/tmp/sem_cc", O_CREAT, 0755, 2);
if ((long int) sem == -1 || sem == NULL) {
  perror("sem_open");
  exit(1);
}
sem_getvalue(sem, &value);
printf("value after sem_open = %d \n", value);
sem_wait(sem);
sem_getvalue(sem, &value);
printf("value after 1st sem_wait = %d \n", value);
}

Reply via email to