Skip to content

Instantly share code, notes, and snippets.

@stevenwilliamson
Created October 12, 2016 12:45
Show Gist options
  • Select an option

  • Save stevenwilliamson/5a7224de61cb2591b434c394d896b428 to your computer and use it in GitHub Desktop.

Select an option

Save stevenwilliamson/5a7224de61cb2591b434c394d896b428 to your computer and use it in GitHub Desktop.
#!/usr/sbin/dtrace -Cs
struct hostent {
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
int h_addrtype; /* host address type */
int h_length; /* length of address */
char **h_addr_list; /* list of addresses from name server */
};
typedef struct hostent hostent_t;
pid$target::getipnodebyname:entry {
self->name = arg0;
self->errno = arg3;
}
pid$target::getipnodebyname:return / self->name / {
ustack(10);
}
pid$target::getipnodebyname:return / self->name / {
printf("looked up host %s errno is %d\n", copyinstr(self->name), *(int *)copyin(self->errno,sizeof(int)));
self->hostent = (hostent_t *)copyin(arg1,sizeof(hostent_t));
printf("hostent->h_name is %s\n", copyinstr((uintptr_t)self->hostent->h_name));
printf("hostent->h_length is %d", self->hostent->h_length);
self->name = 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment