From: Scott Moore <samoore@us.ibm.com>
Subject: Re: POSIX.4 Semaphore questions
Date: 1997/11/19 [thread overview]
Message-ID: <34732680.197D@us.ibm.com> (raw)
In-Reply-To: 3472C81E.1D889693@zko.dec.com
Dave Butenhof wrote:
> This is a fascinating issue, but, unfortunately, the standard isn't going
> to help you much here. I suspect that any restriction of permissions with
> semaphores is going to be fairly non-portable.
That is kinda what I thought. It seems like the standard is VERY brief
about permissions, other than they can be specified when creating a
semaphore, and the sem_open() can fail with EACCESS (But it does not
mention the circumstances that it can fail with EACCESS! Does it fail
if the caller only has read, or only has write? Or does it require both
to do the sem_open? I guess that this is implementation specific...).
A lot of good that does us!!
> POSIX doesn't say what access is required to open a semaphore. It does
> allow sem_open to return EACCES if "the permissions specified by oflag are
> denied". (Which is a typo, in any case, since it is mode, not oflag, that
> specifies permissions.) That implies that, if your second open were
> sem_open("/mysem", O_CREAT, 0606, 0), it would fail with EACCES because the
> original creator hadn't allowed write access to other users.
>
> I can't imagine that you'd be able to open a semaphore without read
> permission, and you certainly couldn't do anything with it. There are no
> "pure write" operations on a semaphore -- only "read" and "modify"
> operations (which would require a read followed by a write).
Good point! But on system V semaphores, you only need write access to
decrement a semaphore, but this is a "read" and "modify" operation as
well. Yet another gripe on Sys V IPC. %^).
Sajjad-
It is recommended that you specify the macro's for permissions. It is
possible that the implementation does not have the octal representation
for the permissions (I don't know of an implementation, but I'm sure one
rebel platform exists!)
Thank you for the answers guys!
Scott
next prev parent reply other threads:[~1997-11-19 5:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-11-18 5:00 POSIX.4 Semaphore questions Scott Moore
1997-11-19 5:00 ` Dave Butenhof
1997-11-19 5:00 ` Scott Moore [this message]
1997-11-19 5:00 ` Sajjad Lateef
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox