[klibc] [patch] sparc64 fix stat()

maximilian attems maks at sternwelten.at
Wed Dec 28 16:19:42 PST 2005

From: Jurij Smakov <jurij at wooyd.org>

I've investigated the sparc stat() klibc problem a bit and found that the
definition of 'struct stat' in klibc's include/arch/sparc64/archstat.h is
(most probably) incorrect. I've written a simple test case using stat()
function and then looked at preprocessed source, which includes the
'struct stat' definition (from glibc headers) and copied that to
include/arch/sparc64/archstat.h. That required changing the storage size
for some fields, rearranging them, and adding some padding fields where
neccessary. Attached patch implements these changes.

With this change I was able to successfully boot my ultra5 box.

Signed-off-by: maximilian attems <maks at sternwelten.at>

--- a/include/arch/sparc64/klibc/archstat.h	2005-09-06 13:49:34.000000000 -0700
+++ b/include/arch/sparc64/klibc/archstat.h	2005-10-29 10:31:26.000000000 -0700
@@ -3,20 +3,26 @@
 /* No nsec fields?! */
 struct stat {
-	unsigned   st_dev;
+	unsigned long st_dev;
+	unsigned short __pad1;
 	ino_t   st_ino;
 	mode_t  st_mode;
-	short   st_nlink;
+	unsigned int st_nlink;
 	uid_t   st_uid;
 	gid_t   st_gid;
-	unsigned   st_rdev;
+	unsigned long st_rdev;
+	unsigned short __pad2;
 	off_t   st_size;
+	off_t   st_blksize;
+	off_t   st_blocks;
 	time_t  st_atime;
+	unsigned long __unused1;
 	time_t  st_mtime;
+	unsigned long __unused2;
 	time_t  st_ctime;
-	off_t   st_blksize;
-	off_t   st_blocks;
-	unsigned long  __unused4[2];
+	unsigned long __unused3;
+	unsigned long __unused4;
+	unsigned long __unused5;

More information about the klibc mailing list