This is the mail archive of the libc-alpha@cygnus.com mailing list for the glibc project.


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

Re: struct stat


   Date: Sat, 13 Mar 1999 13:40:14 -0500
   From: "David A. Greene" <greened@eecs.umich.edu>

OK, let's get some things straight.  To use all features in glibc 2
and linux 2.2 you need a 64-bit integer type.  The types quad_t and
u_quad_t are abstractions for such a type (just like int64_t and
uint64_t).  Since dev_t is an unsigned  64-bit integer type in the
glibc ABI, it is defined in terms of u_quad_t.  If you are using a
compiler that does not support a 64-bit integer type, you'll lose in
certain cases.  One of such cases is when you try to compare two
dev_t's.  Fortunately there are not too many programs that actually do
that.  If you use stat() but never actually make a comparison against
the st_rdev member.  Your program will compile and work correctly
because of the definition of u_quad_t as a struct.

Right now gcc is the only compiler that we now of that supports a 64-bit
integer type.  This implies that if you want to compare two dev_t's
you have to use gcc.

If there is another compiler that supports a 64-bit integer type,
which is available for enough people outside a specific research group
or company, we'll add support for it.

In your case, where your compiler is only used in your research group,
I suggest that you just modify `/usr/include/bits/types.h' such that
it correctly defines u_quad_t as a 64-bit integer type.  This should
not be very hard, and if you keep your patches as diffs to the
origional files it should be easy to reapply them when you update your
copy of glibc.

The bottonline is that some features will never be available on
compilers that do not have a 64-bit integer type.  If you want to keep
using older compilers that do not support such a type, and depend on
features which are implemented in glibc 2 by using such a type, you
shoud stick with older versions of the C library.  For Linux this
means libc5.

By the way, since you keep mentioning __dev_t, I must warn you that
all symbols with a double underscore are reserved for internal use in
the library.  You should never use them in your programs, so always
use dev_t, and also try to use that name in discussions to avoid
setting bad examples.

Mark


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