I am working on the dining philosopher's problem and can't use threads so I need to use shared memory to make the array of chopsticks and philosophers visible to all child processes. I am trying to use mmap, however, my use of mmap is incorrect and I am unsure how to fix it since my argument is an array of ints not an int as per this question. Should I be using a different function to make it in shared memory?
(declared at the global scope)
int chopsticks[5];
int sizeOfSticks=sizeof(int)*5;
void* map = mmap(0,sizeOfSticks,PROT_READ|PROT_WRITE, MAP_SHARED,chopsticks,0);