[klibc] semget() failed
BERTRAND Joel
joel.bertrand at systella.fr
Tue Aug 10 12:40:59 PDT 2010
Hello,
I'm trying to port RPL/2 (http://www.rpl2.net) to OS/2 and I don't
understand OS/2 semget(). RPL/2 uses POSIX semaphores. I have written a
minimal library that emulates POSIX semaphores with SysV ones. I have
tested this library on several Unix systems without any trouble.
On OS/2, semget() always returns -1 and I don't understand my mistake.
int
sem_init_SysV(sem_t *semaphore, int shared, unsigned int valeur)
{
int ios;
union semun argument;
if (shared != 0)
{
return(ENOSYS);
}
(*semaphore) = semget(IPC_PRIVATE, 1, IPC_CREAT | IPC_EXCL | SEM_R
| SEM_A);
if ((*semaphore) == -1)
{
// Always true with OS/2 (libc 0.6.3)
return(EINVAL);
}
argument.val = valeur;
ios = semctl((*semaphore), 0, SETVAL, argument);
return(ios);
}
Any explanation ?
Thanks in advance,
JKB
More information about the klibc
mailing list