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,261 of 264,096   
   Waldek Hebisch to All   
   Unix stat on VMS   
   07 Sep 25 15:03:45   
   
   From: antispam@fricas.org   
      
   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'.   
      
   I am worried by this.  And of course important question is if   
   'stat' works as described in Posix?  I did not check Posix spec,   
   but I would expect that ino_t is supposed to be type of 'st_ino'   
   field of of 'struct stat', which apparently fails on VMS.   
   And fundamental thing: Posix promises that two files are in   
   fact the same file if and only if both 'st_dev' field and   
   'st_ino' fields match.  And libgfortran depends on this.   
   Does it hold on VMS?   
      
   -------------------------------------   
   #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;   
   }   
   ------------------------------   
      
      
   --   
                                 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