03-21-2002
1,
0
Join Date: Mar 2002
Last Activity: 21 March 2002, 1:29 PM EST
Posts: 1
Thanks Given: 0
Thanked 0 Times in 0 Posts
Hi...Need Help
Hi,
I am getting a bus error when i run the following code.
#include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <errno.h>
main()
{
int semid,retval;
semid=semget(0x20,1,IPC_CREAT|0666);
retval= semctl(semid,0,GETVAL,0);
printf("The value returned by the Getval is %d\n",retval);
semctl(semid,0,SETVAL,1);
printf("HI2\n");
retval= semctl(semid,0,GETVAL,0);
printf("The value returned by the Getval is %d\n",retval);
}
The bus error is due to this statement semctl(semid,0,SETVAL,1);
Can any one help to solve the problem.
Ur help will be appreciated.
Thanks..Jack