Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ======= script code start =======
- %{
- #include <stdlib.h>
- #include <sys/socket.h>
- %}
- function sockname:string(sock:long)
- %{
- struct sockaddr *addr = (struct sockaddr *) malloc (sizeof (struct sockaddr))
- if (addr != NULL) {
- size_t *addrlen = sizeof (struct sockaddr)
- ret = getsockname (sock, addr, addrlen)
- if (ret < 0) {
- print ("error\n")
- }
- }
- %}
- probe syscall.connect.return {
- if ($return >= 0) {
- sockname ($return)
- }
- }
- ======= script code end =======
- ======= run start =======
- [root@rhel5-stap stps]# stap -g strace-connect.stp -c "curl www.google.com"
- Pass 4: compilation failed. Try again with another '--vp 0001' option.
- [root@rhel5-stap stps]# stap -g --vp 0001 strace-connect.stp -c "curl www.google.com"
- Pass 4: compiled C into "stap_b7800dfc97ca81afbd4921aaa452d856_6437.ko" in 740usr/190sys/932real ms.
- Pass 4: compilation failed. Try again with another '--vp 0001' option.
- ======= run end =======
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement