[Coco] SysCall to get the Attr on a file or directory

Gregory Law glaw at live.com
Tue Feb 14 23:44:33 EST 2017


You need to call I$Open to open a path to the file or directory and then using I$GetStt with B=SS.FD to get the file descriptor. The code might be something like this:

fdesc rmb 256
path rmb 1
...
fnam fcc "/dd/cmds/attr"
...
 lda #$01 See FD.ATT for the attribute byte definitions
 leax fnam,u
 os9 I$Open
 sta path,U

 lda path,U
 ldb #SS.FD
 leax buffer,u
 ldy #256
 os9 I$GetStt

 lda FD.ATT,x Get the attribute byte from the file descriptor
 ...

I don't remember if ldy #256 is valid so take this with a grain of salt. The general idea is that you need to open the file with at least read access or directory+read access for directories to get a path to the file or directory. Once you do this, call I$GetStt with B=SS.FD to read the file descriptor. I specified 256 bytes here to read the entire file descriptor, although I think you can specify how many bytes to return and the attributes are in the first byte of the file descriptor.

See the documentation (link below) for the layout of the file descriptor and the layout of the FD.ATT attribute byte.

http://nitros9.sourceforge.net/wiki/index.php/Random_Block_File_Manager#File_Descriptor_Sector

On 2/14/2017 2:00:50 PM, "Taylor, Phillip L CIV" <Phillip.L.Taylor at uscg.mil<mailto:Phillip.L.Taylor at uscg.mil>> wrote:

Does anyone have a example of the syscall to get the attr file permissions
on a file or a directory?

Thanks


More information about the Coco mailing list