Re: Running o32 code on n32 (Part 2, fancier programs)

David Holland <[email protected]>
Newsgroups gmane.os.netbsd.ports.mips.devel
Message-ID <[email protected]>
On Tue, Oct 11, 2016 at 04:21:19AM +1100, matthew green wrote:
 > there's an infinite loop in readdir(3).  what i guess is happening is
 > that each run through the loop dp->d_reclen is 0, so that the value
 > of dirp->dd_loc always remains 0.  so, something is wrong here, but
 > i don't see it in a simple test case (i haven't gotten pkgsrc on my
 > gxemul system yet.)

The way directory reading works is really nasty - it makes destructive
changes to the struct file as it goes. However, netbsd32___getdents30
is different from sys___getdents30 (as far as I can tell) only by
being missing a ktrace hook.

If someone can test this, I'll commit it, and then we'll be able to
see what's happening better:

Index: netbsd32_fs.c
===================================================================
RCS file: /cvsroot/src/sys/compat/netbsd32/netbsd32_fs.c,v
retrieving revision 1.75
diff -u -r1.75 netbsd32_fs.c
--- netbsd32_fs.c	16 Oct 2016 20:09:53 -0000	1.75
+++ netbsd32_fs.c	16 Oct 2016 20:11:13 -0000
@@ -519,6 +519,7 @@
 	}
 	error = vn_readdir(fp, SCARG_P32(uap, buf),
 	    UIO_USERSPACE, SCARG(uap, count), &done, l, 0, 0);
+	ktrgenio(SCARG(uap, fd), UIO_READ, SCARG_P32(uap, buf), done, error);
 	*retval = done;
  out:
 	fd_putfile(SCARG(uap, fd));

-- 
David A. Holland
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.