Re: [PATCH][RFC] Lightweight user-level semaphores

Linus Torvalds (torvalds@transmeta.com)
Mon, 7 Jan 2002 14:38:45 -0800 (PST)


On Mon, 7 Jan 2002, Matthew Kirkwood wrote:
> >
> > Yes, I was going to just attach to the vma,
>
> Wouldn't that have to be an address_space, so separate maps
> of the same object will use the same count? Or (not unlikely)
> am I misunderstanding the way these structures are laid out?

I would just mke the creator be special. The guy who creates the semaphore
owns it, and if he unmaps it, it's gone.

Note that there are other, potentially cleaner solutions. In particular,
some people like the "semaphore as file descriptor" approach, and I have
to say that I think they may be right. Then you just pass the file
descriptor along as the cookie, and you can do dup()/close() etc on it.

Mind trying that approach instead? It's not all that far off from your
current setup, and it would certainly have none of the security
implications..

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/