The problem with the type of st_size in struct stat

H . J . Lu hjl en valinux.com
Jue Ene 27 15:20:42 CST 2000


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 en gnu.org)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo en vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



Más información sobre la lista de distribución Ayuda