truss and procfs strange problem.

Dan Nelson dnelson at
Thu Jan 26 09:13:36 PST 2006

In the last episode (Jan 26), Proniewski Patrick said:
> I experience a strange problem with truss on FreeBSD 5.4 p8 :
> 	$ truss ls
> 	truss: cannot open /proc/4509/mem: No such file or directory
> 	$ truss ls
> 	truss: PIOCWAIT: Input/output error

The child process probably hasn't been fully started by the time the
parent tries to attach to it.  Adding a sleep(1) inside
setup_and_wait() in setup.c just before it tries to open /proc/%d/mem
is a quick hack that works.  A better solution would be to retry the
open and ioctl calls if they fail, after a short wait (but only doing
so for a couple seconds in case there was a problem starting the child

I have no idea why the PIOCWAIT ioctl would fail like that; the code
path doesn't look like it's even able to return EIO.

	Dan Nelson
	dnelson at

More information about the freebsd-questions mailing list