As part of the great "clean up the dangling bits" sweep...

File stat stuff. Let's do:

   stat [PINS]x, Sy, Iz
   stat Px, Sy

where Y is the filename. Z is the stat element, and X is the value for that element. (In the two-arg case it's an array PMC, where the offset matches the element number in the three arg case) Whether an element returns a string, int, or float depends on what it is.

The returned PMC in the two-arg case could be a hash/array pmc and allow string-keyed access to elements. If we do that, then the names correspond to the constant names that follow.

NAME            Filename, no extension or path
EXTENSION       File extension
PATH            File path
DEVICE          Device file is on
SIZE            Filesize
ISDIR           True if is a directory
ISDEV           True if is a device
CTIME           Creation time
MTIME           Last modified time
ATIME           Last accessed time
BTIME           Last backup time
OWNER_READ      True if owner can read
OWNER_WRITE     True if owner can write
OWNER_EXECUTE   True if owner can run
OWNER_DELETE    True if owner can delete
GROUP_CD        True if owner can enter this directory
GROUP_READ      True if group can read
GROUP_WRITE     True if group can write
GROUP_EXECUTE   True if group can execute
GROUP_DELETE    True if group can delete
GROUP_CD        True if group can enter this directory
SYSTEM_READ     True if system/root/admin can read
SYSTEM_WRITE    True if system/root/admin can write
SYSTEM_EXECUTE  True if system/root/admin can run
SYSTEM_DELETE   True if system/root/admin can delete
GROUP_CD        True if group can enter this directory
OTHER_READ      True if anyone can read
OTHER_WRITE     True if anyone can write
OTHER_EXECUTE   True if anyone can run
OTHER_DELETE    True if anyone can delete
GROUP_CD        True if anyone can enter this directory
UMASK           System bitmask for privs
ACL_LIST        An array PMC with the ACL list for this file

If there's stuff missing, let's add it to the list, then we can assign numbers and appropriate return types.

I can see adding in a separate op for priv testing on files, something like:

   canI Ix, Sy, Iz

where X is true or false, Y is the file, and Z is read, write, execute, delete, or cd, so we don't have to figure out a way to walk ACL lists when all we want to know is "Can I write to the damn file or not?" and leave it to the system to sort out the privs there.
--
Dan


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to