This is the mail archive of the cygwin-xfree@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Xggi/glide


On Wed, 14 Jul 1999, Suhaib M. Siddiqi wrote:

> thanks.  It was misc.h in Xserver/include.  It had
> #if!defined(LYNX) && !defined(AMOEBA)
> #ifndef (abs)
> #define abs(x) ((x) > 0 ? (x) : -(x))
> 
> 
> I added && !defined(__CYGWIN32__) to it.

Too bad you have to deal with sloppy code. This can be done the right
way without these adhoc defines. Also, please use __CYGWIN__, not
__CYGWIN32__.

> Should I upgrade to gcc 2.95?  gcc from egcs-1.1.2, with July 03 snapshot,
> is skipping files and
> complaining file not found or giving compiler errors, as I wrote in previous
> mail.

The problem is in Cygwin, and I believe on Win9x, where multiple files end
up getting the same inode numbers. The C preprocessor in egcs and gcc use
the inode numbers to avoid including the same file multiple times, and this
causes problems when two *different* files have the same inode number.

I'm going to disable this inode optimization for the next snapshot and
quit possibly for the release as well. This has caused a tremendous 
amount of confusion and eaten up lots of my time trying to find a problem
that only shows up on others people's machines!

If you see this problem on NT as well, please let me know. In the meantime,
here's to see if you have the same problem:

- compile file foo.c file with -H option. You'll see all the includes.
- now check the inode numbers of these includes. I'm including a simple
  program at the end.

    $ gcc -o inode-test.exe inode-test.c
    $ ./inode-test file1 [file2 ... ]

Regards,
Mumit

== cut here to end
/* inode-test.c: Find the inode given a file.  */

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

int
main (int argc, char *argv[])
{
   int i;
   for (i = 1; i < argc; i++)
     {
       struct stat buf1, buf2;
       int result;
       const char *path = argv[i];
       printf ("File: %s\n", path);

       result = stat (path, &buf1);

       if (result == 0)
	 {
	   printf ("STAT() reports:\n  ================\n");
	   printf ("    st_mode = %d\n", buf1.st_mode);
	   printf ("    st_ino = %ld\n", buf1.st_ino);
	   printf ("    st_dev = %d\n", buf1.st_dev);
	   printf ("    st_nlink = %d\n", buf1.st_nlink);
	   printf ("    st_uid = %d\n", buf1.st_uid);
	   printf ("    st_gid = %d\n", buf1.st_gid);
	   printf ("    st_size = %ld\n", buf1.st_size);
	   printf ("    st_rdev = %d\n", buf1.st_rdev);
	   printf ("    st_blksize = %ld\n", buf1.st_blksize);
	   printf ("    st_blocks = %ld\n", buf1.st_blocks);
	 }
       else
	 {
	   perror (path);
	 }

       result = lstat (path, &buf2);

       if (result == 0)
	 {
	   printf ("LSTAT() reports:\n  ================\n");
	   printf ("    st_mode = %d\n", buf2.st_mode);
	   printf ("    st_ino = %ld\n", buf2.st_ino);
	   printf ("    st_dev = %d\n", buf2.st_dev);
	   printf ("    st_nlink = %d\n", buf2.st_nlink);
	   printf ("    st_uid = %d\n", buf2.st_uid);
	   printf ("    st_gid = %d\n", buf2.st_gid);
	   printf ("    st_size = %ld\n", buf2.st_size);
	   printf ("    st_rdev = %d\n", buf2.st_rdev);
	   printf ("    st_blksize = %ld\n", buf2.st_blksize);
	   printf ("    st_blocks = %ld\n", buf2.st_blocks);
	 }
       else
	 {
	   perror (path);
	 }
     }
  return 0;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]