misc/134919: Additional detail for truss when tracing linux apps

Steven Hartland killing at multiplay.co.uk
Sun May 24 22:00:09 UTC 2009


The following reply was made to PR misc/134919; it has been noted by GNATS.

From: "Steven Hartland" <killing at multiplay.co.uk>
To: <bug-followup at FreeBSD.org>,
	<steven.hartland at multiplay.co.uk>
Cc:  
Subject: Re: misc/134919: Additional detail for truss when tracing linux apps
Date: Sun, 24 May 2009 22:47:42 +0100

 This is a multi-part message in MIME format.
 
 ------=_NextPart_000_08DA_01C9DCC1.A590F830
 Content-Type: text/plain;
 	format=flowed;
 	charset="Windows-1252";
 	reply-type=original
 Content-Transfer-Encoding: 7bit
 
 Updated patch that applies on 7.2-RELEASE
 
 ================================================
 This e.mail is private and confidential between Multiplay (UK) Ltd. and the person or entity to whom it is addressed. In the event of misdirection, the recipient is prohibited from using, copying, printing or otherwise disseminating it or any information contained in it. 
 
 In the event of misdirection, illegible or incomplete transmission please telephone +44 845 868 1337
 or return the E.mail to postmaster at multiplay.co.uk.
 ------=_NextPart_000_08DA_01C9DCC1.A590F830
 Content-Type: application/octet-stream;
 	name="syscalls.c.patch"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment;
 	filename="syscalls.c.patch"
 
 --- /usr/src/usr.bin/truss/syscalls.c.orig	2009-04-15 04:14:26.000000000 =
 +0100=0A=
 +++ /usr/src/usr.bin/truss/syscalls.c	2009-05-24 22:41:54.000000000 +0100=0A=
 @@ -96,4 +96,8 @@=0A=
  	{ "readlink", 1, 3,=0A=
  	  { { Name, 0 } , { Readlinkres | OUT, 1 }, { Int, 2 } } },=0A=
 +	{ "linux_readlink", 1, 3,=0A=
 +	  { { Name, 0 } , { Name | OUT, 1 }, { Int, 2 }}},=0A=
 +	{ "linux_socketcall", 1, 2,=0A=
 +	  { { Int, 0 } , { LinuxSockArgs, 1 }}},=0A=
  	{ "lseek", 2, 3,=0A=
  	  { { Int, 0 }, { Quad, 1 + QUAD_ALIGN }, { Whence, 1 + QUAD_SLOTS + =
 QUAD_ALIGN } } },=0A=
 @@ -112,4 +116,6 @@=0A=
  	{ "close", 1, 1,=0A=
  	  { { Int, 0 } } },=0A=
 +	{ "linux_mkdir", 1, 2,=0A=
 +	  { { Name | IN, 0} , {Int, 1}}},=0A=
  	{ "link", 0, 2,=0A=
  	  { { Name, 0 }, { Name, 1 } } },=0A=
 @@ -136,4 +142,6 @@=0A=
  	{ "lstat", 1, 2,=0A=
  	  { { Name | IN, 0 }, { Stat | OUT, 1 } } },=0A=
 +	{ "linux_stat64", 1, 3,=0A=
 +	  { { Name | IN, 0 }, { Ptr | OUT, 1 }, { Ptr | IN, 1 }}},=0A=
  	{ "linux_newstat", 1, 2,=0A=
  	  { { Name | IN, 0 }, { Ptr | OUT, 1 } } },=0A=
 @@ -149,4 +157,5 @@=0A=
  	{ "sigaction", 1, 3,=0A=
  	  { { Signal, 0 }, { Sigaction | IN, 1 }, { Sigaction | OUT, 2 } } },=0A=
 +	{ "linux_access", 1, 2, { { Name, 0 }, { Int, 1 }}},=0A=
  	{ "accept", 1, 3,=0A=
  	  { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } },=0A=
 @@ -672,4 +681,74 @@=0A=
  		break;=0A=
  	}=0A=
 +	case LinuxSockArgs:=0A=
 +	{=0A=
 +		struct linux_socketcall_args largs;=0A=
 +		if ( get_struct(pid, (void *)args[sc->offset], (void *)&largs, =
 sizeof(largs)) =3D=3D -1)=0A=
 +		{=0A=
 +			err(1, "get_struct %p", (void *)args[sc->offset]);=0A=
 +		}=0A=
 +		const char *what;=0A=
 +		char buf[30];=0A=
 +=0A=
 +		switch (largs.what) {=0A=
 +		case LINUX_SOCKET:=0A=
 +			what =3D "LINUX_SOCKET";=0A=
 +			break;=0A=
 +		case LINUX_BIND:=0A=
 +			what =3D "LINUX_BIND";=0A=
 +			break;=0A=
 +		case LINUX_CONNECT:=0A=
 +			what =3D "LINUX_CONNECT";=0A=
 +			break;=0A=
 +		case LINUX_LISTEN:=0A=
 +			what =3D "LINUX_LISTEN";=0A=
 +			break;=0A=
 +		case LINUX_ACCEPT:=0A=
 +			what =3D "LINUX_ACCEPT";=0A=
 +			break;=0A=
 +		case LINUX_GETSOCKNAME:=0A=
 +			what =3D "LINUX_GETSOCKNAME";=0A=
 +			break;=0A=
 +		case LINUX_GETPEERNAME:=0A=
 +			what =3D "LINUX_GETPEERNAME";=0A=
 +			break;=0A=
 +		case LINUX_SOCKETPAIR:=0A=
 +			what =3D "LINUX_SOCKETPAIR";=0A=
 +			break;=0A=
 +		case LINUX_SEND:   =0A=
 +			what =3D "LINUX_SEND";=0A=
 +			break;=0A=
 +		case LINUX_RECV: =0A=
 +			what =3D "LINUX_RECV";=0A=
 +			break;=0A=
 +		case LINUX_SENDTO:=0A=
 +			what =3D "LINUX_SENDTO";=0A=
 +			break;=0A=
 +		case LINUX_RECVFROM:=0A=
 +			what =3D "LINUX_RECVFROM";=0A=
 +			break;=0A=
 +		case LINUX_SHUTDOWN:=0A=
 +			what =3D "LINUX_SHUTDOWN";=0A=
 +			break;=0A=
 +		case LINUX_SETSOCKOPT:=0A=
 +			what =3D "LINUX_SETSOCKOPT";=0A=
 +			break;=0A=
 +		case LINUX_GETSOCKOPT:=0A=
 +			what =3D "LINUX_GETSOCKOPT";=0A=
 +			break;=0A=
 +		case LINUX_SENDMSG:=0A=
 +			what =3D "LINUX_SENDMSG";=0A=
 +			break;=0A=
 +		case LINUX_RECVMSG:=0A=
 +			what =3D "LINUX_RECVMSG";=0A=
 +			break;=0A=
 +		default:=0A=
 +			sprintf( buf, "%d", largs.what );=0A=
 +			what =3D buf;=0A=
 +			break;=0A=
 +		}=0A=
 +		asprintf(&tmp, "(0x%lx)%s, 0x%lx", args[sc->offset], what, (long =
 unsigned int)largs.args );=0A=
 +		break;=0A=
 +	}=0A=
  	case Pollfd: {=0A=
  		/*=0A=
 
 ------=_NextPart_000_08DA_01C9DCC1.A590F830--
 


More information about the freebsd-bugs mailing list