Re: what different btw the owner uid and creator id of semaphore

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi:
   What is the original purpose of uid of semaphore?

On Fri, Dec 26, 2008 at 3:09 PM, shark huang <shark.hh@xxxxxxxxx> wrote:
Hi:

On Fri, Dec 26, 2008 at 2:44 PM, ajit mote <mail2blackmen@xxxxxxxxx> wrote:
How can I know who own the semaphore at one moment?

ipcs -s
 'cat /proc/sysvipc/sem' should be same.
 

 
On Thu, Dec 25, 2008 at 12:26 AM, shark huang <shark.hh@xxxxxxxxx> wrote:
Hi:
  is the value of cuid and uid always same? Looks like they only are given a same value in function "ipc_addid", which means the value was initialized when the semaphore is created.

  When performing the first task, the process which calls semget becomes the owner/creator, and  Remember, ownership can be changed, but the creating process always remains the creator. So values of uid and cuid may not be always same.
    Several user can operate one semaphore  at the same time, so how to decide who is the owner  ? Could you show me in source code? 
Unfortunately, there isn't really a way to know what pid is "owning" the critical region that is being protected by this semaphore.  This is because semaphores don't really enforce the notion of a critical section.  Semaphores aren't binary gates, they aren't locked or unlocked (although they can be used that way).  Its entirely possible for two processes to manipulate a semaphore in such a way as both complete the operation without blocking.  So its not like the semphore defines a critical region by virtue solely of the call sites where it referenced.
So the answer is no, there isn't a way to get what pids which are operating on the semaphore


Yes, Yes. So I confuse what does mean the uid for? 



br
shark


Note: Please send mail to mailing list, this way everybody will be reading the thread




--
Thanks & Regards,
Ajit Subhash Mote





--
Thanks & Regards,
Ajit Subhash Mote





--
Thanks & Regards,
Ajit Subhash Mote




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux