[Info-vax] decc$stat() variants on VMS.

John E. Malmberg wb8tyw at qsl.net_work
Wed Jun 29 09:25:31 EDT 2016


Since this is discussed on other threads.

 From looking at stat.h, it looks like there are at least 7 different 
variants of stat() as of VMS 8.4 as Compile time options.

The standard stat() call is probably closest to Unix.  The main thing 
about the others is that the dev_t returns a pointer to the VMS device 
name for the file.

The standard stat returns a unique dev_t number for the device. 
Unfortunately VMS does not provide the routines to parse the dev_t 
number or translate it to an actual disk device.

Interestingly the non-standard stats() are the easiest way for a C 
program to get the device name and fid of a file in order to use the 
FID_TO_NAME service to simulate realpath().

The stat() call only returns the correct byte count for stream files.

For VMS text file formats, the only way to get the byte count seen by 
reading the file is to actually read the file.  VMS ports of Curl now do 
this in most cases.  While I have not seen a bug reported on this, I am 
not certain port of Curl handles all cases of VMS text files everywhere.

For fixed block size files, like .EXE files, which are 512 byte files, 
they use the number of blocks to calculate the byte count.

Unfortunately that is the wrong number because .EXE files can have 
partial blocks in them.

This is why all the ports of GNU Tar that I know of access violate with 
EXE files in the tarball.

The VMS Perl (5.10+) tar has the fix for that so it can deal with VMS 
executables and objects properly.

Regards,
-John
wb8tyw at qsl.net_work





More information about the Info-vax mailing list