Good morning,
I want to allocate memory by using shmget,I want this memory to consist of 4 integers and three semaphores(type sem_t) which are going to have access to the same buffer.
How can ido that?
Thanks, in advance!
Good morning,
I want to allocate memory by using shmget,I want this memory to consist of 4 integers and three semaphores(type sem_t) which are going to have access to the same buffer.
How can ido that?
Thanks, in advance!
Create a struct containing those items, then allocate sizeof(struct) amount of shared memory.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.