home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.os.vms      DEC's VAX* line of computers & VMS.      264,096 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 263,269 of 264,096   
   Waldek Hebisch to arne@vajhoej.dk   
   Re: Unix stat on VMS   
   07 Sep 25 20:46:03   
   
   From: antispam@fricas.org   
      
   Arne Vajhøj  wrote:   
   > On 9/7/2025 11:03 AM, Waldek Hebisch wrote:   
   >> As I wrote I am trying to compile gcc-15 cross-compiler targeting   
   >> VMS.  I now have trouble with libgfortran.  Namely libgfortran   
   >> tries to use Posix compatiblity to perform some file operations.   
   >> I have trouble with st_ino filed in 'struct stat'.  Code below   
   >> ilustrates the problem.  I am getting warning from VMS C compiler:   
   >>   
   >>      mp->st_ino = sb.st_ino;   
   >> ....^   
   >> %CC-W-CVTDIFTYPES, In this statement, "sb.st_ino" of type "pointer to   
   unsigned s   
   >> hort", is being converted to "unsigned short".   
   >>   
   >>   
   >>      mp->st_ino = sb.st_ino;   
   >> .................^   
   >> %CC-W-MAYLOSEDATA, In this statement, "sb.st_ino" has a larger data size   
   than "u   
   >> nsigned short".  Assignment can result in data loss.   
   >>   
   >> While this is only a warning in VMS C, such thing may indicate serious   
   >> problem.  Also, I tried to print 'sizeof(sb.st_ino)' and   
   >> 'sizeof(unsigned short *)'.  The results are 6 and 4 respecitvely.   
   >> So size of type reported above does not match with size of 'sb.st_ino'.   
   >   
   >> #include    
   >> typedef struct   
   >> {   
   >>    /* Cached stat(2) values.  */   
   >>    dev_t st_dev;   
   >>    ino_t st_ino;   
   >>    long long file_size;   
   >> }   
   >> my_sb;   
   >>   
   >> int   
   >> my_stat(const char * name, my_sb * mp) {   
   >>      struct stat sb;   
   >>      int res = stat(name, &sb);   
   >>      mp->st_dev = sb.st_dev;   
   >>      mp->st_ino = sb.st_ino;   
   >>      mp->file_size = sb.st_size;   
   >>      return res;   
   >> }   
   >   
   > A VMS FID is 3 words, so 6 bytes seems right.   
   >   
   > stat.h is a nightmare of #ifdef's.   
   >   
   > I can see 2 approaches worth investigating.   
   >   
   > A)   
   >   
   > Change my_sb to:   
   >   
   > __ino16_t st_ino[3];   
   >   
   > and handle the array.   
      
   Yes, I did it that way.   
      
   > B)   
   >   
   > Compile with:   
   >   
   > /def="_USE_STD_STAT"   
   >   
   > (then it looks like your code compiles)   
   >   
   > I have no idea if any of them will work in the bigger context.   
      
   That looks nice.  But ATM I want code to compile using gcc in its   
   basic setup, so this is less attractive.   
      
   --   
                                 Waldek Hebisch   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca