Re: POSIX
Re: POSIX
- Subject: Re: POSIX
- From: Alastair Houghton <email@hidden>
- Date: Fri, 9 Feb 2007 17:37:38 +0000
On 9 Feb 2007, at 02:50, Andrew Farmer wrote:
On 08 Feb 07, at 18:18, <email@hidden> wrote:
I have been trying to interpret POSIX values returned from the
attributes obtained from NSFilePosixPermissions and cannot make
heads or tails out of the returned value.
The value returned is 420. What does this mean and how do I go
about parsing this number into the specific permissions? And
please tell me where this is documented. (I have looked).
It's not particularly well-documented;
That's not really true, now, is it? :-)
Not only is there the official POSIX spec (variously named IEEE 1003,
SUS, and "Open Group Base Specifications"), which you can get here:
<http://www.unix.org/single_unix_specification/>
but there are quite a number of man pages that cover this material.
The best ones are probably
man chmod
man 2 chmod
if all you're interested in is the permission bits themselves, though
it's also worth looking at
man 2 stat
because that includes the meaning of the S_IFMT bits (which tell you
what type of file you've got).
(You can type those man commands in Terminal; the "2" on the second
and third ones is to select the System Calls Manual rather than the
General Commands Manual, which you would get otherwise because there
is a shell command called "stat" as well.)
A particularly useful page if you haven't done much UNIX-y work
before is
man 2 intro
which not only lists many (all?) of the errno values defined in OS X,
but also includes definitions of things like File Access Permissions
and even a hint that you might want to look at "chmod(2)" for more
information.
Also, if you're looking at the POSIX spec., you should remember that
Mac OS X, like any other implementation, differs from POSIX on one or
two things, so it's always worth checking the man pages if you're
unsure.
The problem (if there is one) is really that the Cocoa docs don't
reference any of this material---at least, I assume they don't, since
otherwise this question wouldn't have come up.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >POSIX (From: <email@hidden>) |
| >Re: POSIX (From: Andrew Farmer <email@hidden>) |