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

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

The problem with the type of st_size in struct stat


Hi,

This is a problem with the type of st_size in struct stat. According
to The Single UNIX (R) Specification, Version 2, st_size should be
type of off_t which is signed on most systems. However, Linux kernel
defines it as unsigned long. I have a damanged filesystem. Some
files in lost+found are device files and have st_size == 0xffffffff.
On i386, glibc converts the kernel st_size to the 64bit off_t. As
the result, unsigned 0xffffffff is converted into 64bit signed
0xffffffff, instead of -1. My question is is st_size treated as
unsigned long in kernel?

Thanks.

-- 
H.J. Lu (hjl@gnu.org)

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