-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbinds.d
80 lines (62 loc) · 1.65 KB
/
binds.d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#pragma D option quiet
syscall::bind:entry
/execname == "java"/
{
socks = (struct sockaddr *)copyin(arg1, arg2);
hport = (uint_t)socks->sa_data[0];
lport = (uint_t)socks->sa_data[1];
hport <<= 8;
self->bind_socket = arg0;
self->bind_port = hport + lport;
}
syscall::bind:return
/execname == "java"/
{
/* Error codes can be found in:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/sys/errno.h
*/
/*
printf("%s called socket=%d, port=%d, return=%d, errno=%d\n",
probefunc, self->bind_socket, self->bind_port, arg0, errno);
*/
}
syscall::getsockname:entry
/execname == "java"/
{
self->address = arg1;
self->address_length = arg2;
self->getsockname_socket = arg0
}
syscall::getsockname:return
/execname == "java"/
{
length_addr = (socklen_t *)copyin(self->address_length, sizeof(socklen_t));
length = *length_addr;
socks = (struct sockaddr *)copyin(self->address, length);
hport = (uint_t)socks->sa_data[0];
lport = (uint_t)socks->sa_data[1];
hport <<= 8;
port = hport + lport;
printf("%s called socket=%d, port=%d, return=%d, errno: %d\n",
probefunc, self->getsockname_socket, port, arg0, errno);
}
syscall::socket:return
/execname == "java"/
{
printf("%s called socket=%d\n", probefunc, arg0);
}
/*
syscall::close:entry
/execname == "java"/
{
printf("%d: %d: %s called socket=%d\n", pid, tid, probefunc, arg0);
}
*/
/* print the errno after any failing syscall: */
/*
syscall:::return
/errno != 0/
{
printf("%s: system call %s returned: %d, errno: %d\n", execname, probefunc, arg0, errno);
}
*/