This is the mail archive of the cygwin-developers@sourceware.cygnus.com mailing list for the Cygwin project. See the Cygwin home page for more information.
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

struct stat st_dev question


I'm trying to debug a problem with egcs and the causes seems to be the
fact that the st_dev member of struct stat is always set to 4096. This 
is with Cygwin b20.1 DLL (and needs to be since egcs-1.2 needs to work
with b20.1 as well as any future release). Can anyone confirm if this 
is indeed intended? 

Here's a simple test case:

=== cut here

  #include <sys/types.h>
  #include <sys/stat.h>
  #include <stdio.h>

  int main (int argc, char *argv[]) {
    const char *path = (argc >= 2) ? argv[1] : "/";
    struct stat s;
    int i = stat (path, &s);
    printf ("stat (%s) = %d\n", path, i);
    printf ("inode = %d\n", s.st_ino);
    printf ("%s.st_dev = %d\n", path, s.st_dev);

    return 0;
  }

=== to here

  $ ./stdev-test-cyg / 
  stat (/) = 0
  inode = 22896814
  /.st_dev = 4096
  $ ./stdev-test-cyg //d
  stat (//d) = 0
  inode = 22642860
  //d.st_dev = 4096
  $ ./stdev-test-cyg //u 
  stat (//u) = 0
  inode = 13213796
  //u.st_dev = 4096

Microsoft's runtime does report different device id's.

Regards,
Mumit