I have a program that creates semaphore. But when i try to use SETALL, i get the error in errno as
Numerical result out of range
if((temp_semid = semget(IPC_PRIVATE, 250, 0666 | IPC_CREAT)) != -1)
{
semun arg;
ushort array[100];
memset(array,0, 100);
arg.array = array;
if(semctl(temp_semid, 0, SETALL, arg) == -1){
std::cout << " failed to setall semaphore" << std::endl;
std::cout << strerror(errno) << std::endl;
break;
}
}
What is wrong?
This worked.
i was using memset in the wrong way. thanks to hmjd for pointing that out.