Hemachandran
2007-Jun-15 02:22 UTC
[dtrace-discuss] Help required on tracing connect system call
Hi,
How do I dtrace the arguments of connect system call. Can some one send
in me any pointers or scripts I can use.
I am looking for some thing like this.
connect(4, {sa_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("128.200.1.201")}, 28) = 0
-Regards
Hemachandran
Dave Marquardt
2007-Jun-15 15:58 UTC
[dtrace-discuss] Help required on tracing connect system call
"Hemachandran" == Hemachandran <Hemachandran.Namachivayam at
Sun.COM> writes:
Hemachandran> Hi,
Hemachandran> How do I dtrace the arguments of connect system call. Can some
one send in
Hemachandran> me any pointers or scripts I can use.
Hemachandran> I am looking for some thing like this.
Hemachandran> connect(4, {sa_family=AF_INET, sin_port=htons(53),
Hemachandran> sin_addr=inet_addr("128.200.1.201")}, 28) = 0
Do you want dtrace, or would truss work for you? truss can do that,
something like `truss -v connect <program>'' or `truss -v connect
-p
<pid>''.
--
Dave Marquardt
Sun Microsystems, Inc.
Austin, TX
+1 512 401-1077 (SUN internal: x64077)
Chip Bennett
2007-Jun-15 17:26 UTC
[dtrace-discuss] Help required on tracing connect system call
How about something like this:
#include <sys/socket.h>
syscall::connect:entry
{
printf ("Socket: %d, DataLen: %d\n", arg0, arg2);
name = copyin (arg1, arg2);
tracemem (name, sizeof(struct sockaddr));
}
You need the -C option on the command line to pick the header file, plus
the length in socket.h might not be right for you.
Unfortunately, you need a constant for the tracemem length because of
DTrace''s requirement for fixed length trace records. If we some day
get
a way of specifying a tracemem with fixed max and a variable
"current",
then you could just specify the most it could ever be and be done with it.
Chip
Hemachandran wrote:> Hi,
>
> How do I dtrace the arguments of connect system call. Can some one
> send in me any pointers or scripts I can use.
>
> I am looking for some thing like this.
>
> connect(4, {sa_family=AF_INET, sin_port=htons(53),
> sin_addr=inet_addr("128.200.1.201")}, 28) = 0
>
> -Regards
> Hemachandran
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss at opensolaris.org