0

I am working on a NetBSD system.

As I recollect from my memory from a book on UNIX programming by Richard Stevens, I lerant that semget() call returns different values for different invocations, even for the same thread.

I recently happen to see a group of processes where different invocations of this semget() to be returning same set of values for respective IPC keys. I see that same process image in different boxes also yield same value for semid.

So, my question is - Is there anyway we can force semget() to exhibit this behaviour?

ultimate cause
  • 2,264
  • 4
  • 27
  • 44

1 Answers1

0

semget always returns the semaphore associated with the specified key. If you specify the same key, you will get the same semaphore. I believe this has to be true even with netbsd.

int semget(key_t key, int nsems, int semflg);
Ashok Vairavan
  • 1,862
  • 1
  • 15
  • 21
  • I think my question was NOT clear enough - I mean that for same IPC key different calls for semget return different semid (due to slot sequencing). This is true even for same thread. NOw my question is - is it possible to retain the same semid as well ? – ultimate cause Aug 04 '14 at 11:28