patch to follow freebsd rfork correctly

Russ Cox rsc at plan9.bell-labs.com
Mon Jan 13 10:10:06 UTC 2003


This should go either into strace or into the FreeBSD ports patches.
It makes strace -f follow rforks properly.  The change to syscall.c
adds the case for rfork, and the change to process.c doesn't try to
trace the cases when rfork has not created a new process.

Enjoy.
Russ Cox

frenulum=; diff -c syscall.c.before-rsc syscall.c
*** syscall.c.before-rsc	Mon Jan 13 13:03:20 2003
--- syscall.c	Mon Jan 13 13:04:25 2003
***************
*** 603,608 ****
--- 603,611 ----
  #ifdef SYS_rforkall
  	case SYS_rforkall:
  #endif
+ #ifdef SYS_rfork
+ 	case SYS_rfork:
+ #endif
  		internal_fork(tcp);
  		break;
  #ifdef SYS_clone
frenulum=; diff -c process.c.before-rsc process.c
*** process.c.before-rsc	Mon Jan 13 13:03:17 2003
--- process.c	Mon Jan 13 13:04:20 2003
***************
*** 393,398 ****
--- 393,402 ----
  	struct tcb *tcpchild;
  
  	if (exiting(tcp)) {
+ #ifdef SYS_rfork
+ 		if (tcp->scno == SYS_rfork && !(tcp->u_arg[0]&RFPROC))
+ 			return 0;
+ #endif
  		if (getrval2(tcp))
  			return 0;
  		if (!followfork)
frenulum=; 





More information about the Strace-devel mailing list