The problem with the type of st_size in struct stat

From: H . J . Lu (hjl@valinux.com)
Date: Thu Jan 27 2000 - 12:55:42 EST


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)

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



This archive was generated by hypermail 2b29 : Mon Jan 31 2000 - 21:00:18 EST