Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Richard Black <rjb@dcs.gla.ac.uk>
Cc: axp-list@redhat.com, bugs@redhat.com
Subject: Re: Another bug in strace-3.1
Date: Thu, 24 Sep 1998 21:10:47 +0200	[thread overview]
Message-ID: <19980924211047.32722@alpha.franken.de> (raw)
In-Reply-To: <9809231748.AA00702@bathurst>; from Richard Black on Wed, Sep 23, 1998 at 06:48:19PM +0100

On Wed, Sep 23, 1998 at 06:48:19PM +0100, Richard Black wrote:
> Many thanks to Thomas for his patches, though I have looked on ftp.redhat.com 
> and can only find strace-3.1-5.

this sucks. strace-3.1-7 is on my PowerTools CD, but I couldn't find it on
ftp.redhat.com either. There are more newer SRPMS on the PowerTools CD, which
are _not_ on ftp.redhat.com:-(

> Here is another problem -- the fstat (and related) calls appear to report 
> something wrong i.e. neither the contents of the stat buffer before the call, 
> nor the contents after the call.  This happens on *both* intel and alpha.

that's a mismatch between kernel structures and glibc structures. Below is
a fix this problem.

I've uploaded a SRPM, a Intel RPM and an Alpha RPM of the fixed strace. 
You can find them in

ftp://ftp.franken.de/pub/people/tsbogend/strace/strace-3.1-9.*.rpm

Thomas.

diff -ru strace-3.1-orig/file.c strace-3.1/file.c
--- strace-3.1-orig/file.c	Thu Sep 24 12:15:39 1998
+++ strace-3.1/file.c	Thu Sep 24 20:54:43 1998
@@ -413,8 +413,9 @@
 }
 #endif
 
-#ifdef LINUXSPARC
+#ifdef LINUX
 /* Ugly, bug GLIBC makes this necessary. */
+#ifdef LINUXSPARC
 struct kernel_stat
 {
     unsigned short int st_dev;
@@ -437,13 +438,59 @@
     unsigned long int __unused5;
 };
 #endif
+#ifdef ALPHA
+struct kernel_stat
+{
+    unsigned int    st_dev;
+    unsigned int    st_ino;
+    unsigned int    st_mode;
+    unsigned int    st_nlink;
+    unsigned int    st_uid;
+    unsigned int    st_gid;
+    unsigned int    st_rdev;
+    long            st_size;
+    unsigned long   st_atime;
+    unsigned long   st_mtime;
+    unsigned long   st_ctime;
+    unsigned int    st_blksize;
+    int             st_blocks;
+    unsigned int    st_flags;
+    unsigned int    st_gen;
+};
+#endif
+#ifdef I386
+struct kernel_stat
+{
+    unsigned short st_dev;
+    unsigned short __pad1;
+    unsigned long st_ino;
+    unsigned short st_mode;
+    unsigned short st_nlink;
+    unsigned short st_uid;
+    unsigned short st_gid;
+    unsigned short st_rdev;
+    unsigned short __pad2;
+    unsigned long  st_size;
+    unsigned long  st_blksize;
+    unsigned long  st_blocks;
+    unsigned long  st_atime;
+    unsigned long  __unused1;
+    unsigned long  st_mtime;
+    unsigned long  __unused2;
+    unsigned long  st_ctime;
+    unsigned long  __unused3;
+    unsigned long  __unused4;
+    unsigned long  __unused5;
+};
+#endif
+#endif
 
 static void
 printstat(tcp, addr)
 struct tcb *tcp;
-int addr;
+long addr;
 {
-#ifdef LINUXSPARC
+#ifdef LINUX
 	struct kernel_stat statbuf;
 #else
 	struct stat statbuf;
@@ -460,7 +506,7 @@
 		return;
 	}
 	if (syserror(tcp) || !verbose(tcp)) {
-		tprintf("%#x", addr);
+		tprintf("%#lx", addr);
 		return;
 	}
 	if (umove(tcp, addr, &statbuf) < 0) {
diff -ru strace-3.1-orig/linux/alpha/syscallent.h strace-3.1/linux/alpha/syscallent.h
--- strace-3.1-orig/linux/alpha/syscallent.h	Thu Sep 24 12:15:39 1998
+++ strace-3.1/linux/alpha/syscallent.h	Thu Sep 24 12:21:35 1998
@@ -119,8 +119,8 @@
 	{ 2,	0,	sys_sethostname,	"sethostname"	}, /* 88 */
 	{ 0,	0,	sys_getdtablesize,	"getdtablesize"	}, /* 89 */
 	{ 2,	0,	sys_dup2,		"dup2"		}, /* 90 */
-	{ 2,	0,	sys_fstat,		"fstat"		}, /* 91 */
-	{ 3,	0,	sys_fcntl,		"fcntl"		}, /* 92 */
+	{ 2,	TF,	sys_fstat,		"fstat"		}, /* 91 */
+	{ 3,	TF,	sys_fcntl,		"fcntl"		}, /* 92 */
 	{ 5,	0,	sys_select,		"select"	}, /* 93 */
 	{ 5,	0,	printargs,		"SYS_94"	}, /* 94 */
 	{ 1,	0,	sys_fsync,		"fsync"		}, /* 95 */


-- 
See, you not only have to be a good coder to create a system like Linux,
you have to be a sneaky bastard too ;-)
                   [Linus Torvalds in <4rikft$7g5@linux.cs.Helsinki.FI>]


      reply	other threads:[~1998-09-24 19:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-09-21 14:41 at least two bugs in strace-3.1-5 Richard Black
1998-09-21 23:35 ` Thomas Bogendoerfer
1998-09-23 17:48   ` Another bug in strace-3.1 Richard Black
1998-09-24 19:10     ` Thomas Bogendoerfer [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox