trussing a non existing file causes misbehavior

Kostik Belousov kostikbel at gmail.com
Thu Nov 16 04:14:24 PST 2006


On Thu, Nov 16, 2006 at 12:26:32PM +0300, Oleg Dambaev wrote:
> Nikos Vassiliadis wrote:
> >Hello,
> >
> >In my 6.2-PRERELEASE(one month old approximately) truss gets stuck exiting
> >when trying to truss a non existing file. I think the problem is not in 
> >truss itself.
> >But I have not the skills to find it. So, will a build with updated 
> >sources help?
> >Is there anybody else with the same problem?
> >
> >nik:0:~$ truss /nothing
> >truss: execvp /nothing: No such file or directory
> >load: 1.04  cmd: truss 70662 [exithold] 0.00u 0.00s 0% 700k
> >
> >Thanks in advance, Nikos
> >  
> Never seen any dumbest thing.
> Re-read truss(1) man page and find out what truss must do.

I think that rude response is always wrong.

There, Nikos reported real, although cosmetic problem since the parent truss
process sleeps interruptible. The following change shall take care:

Index: fs/procfs/procfs_ioctl.c
===================================================================
RCS file: /usr/local/arch/ncvs/src/sys/fs/procfs/procfs_ioctl.c,v
retrieving revision 1.14
diff -u -r1.14 procfs_ioctl.c
--- fs/procfs/procfs_ioctl.c	6 Nov 2006 13:41:57 -0000	1.14
+++ fs/procfs/procfs_ioctl.c	16 Nov 2006 12:13:45 -0000
@@ -124,7 +124,7 @@
 		*(unsigned int *)data = p->p_pfsflags;
 		break;
 	case PIOCWAIT:
-		while (p->p_step == 0) {
+		while (p->p_step == 0 && (p->p_flag & P_WEXIT) == 0) {
 			/* sleep until p stops */
 			error = msleep(&p->p_stype, &p->p_mtx,
 			    PWAIT|PCATCH, "pioctl", 0);
@@ -142,7 +142,7 @@
 		break;
 #ifdef COMPAT_IA32
 	case PIOCWAIT32:
-		while (p->p_step == 0) {
+		while (p->p_step == 0 && (p->p_flag & P_WEXIT) == 0) {
 			/* sleep until p stops */
 			error = msleep(&p->p_stype, &p->p_mtx,
 			    PWAIT|PCATCH, "pioctl", 0);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20061116/87cfe6c4/attachment.pgp


More information about the freebsd-stable mailing list