FreeBSD regtest: add missing helgrind expecteds
[valgrind.git] / helgrind / tests / getaddrinfo.c
blobfc3b0a9d5692ec10128c0a8b613ea21f0dbd9f33
1 #include <netdb.h>
2 #include <pthread.h>
3 #include <sys/socket.h>
4 #include <sys/types.h>
6 struct data {
7 const char *hostname;
8 struct addrinfo *res;
9 };
11 struct data threaddat[] = {
12 { "www.freebsd.org", 0 },
13 { "www.google.com", 0 },
14 { "www.freshports.org", 0 },
15 { "www.github.com", 0 },
16 { "www.kernel.org", 0 },
17 { "petunia.bogus.address", 0 }
20 static const size_t threaddat_size = sizeof(threaddat)/sizeof(threaddat[0]);
22 pthread_t threads[sizeof(threaddat)/sizeof(threaddat[0])];
24 void *resolve(void *d) {
25 struct data *data = d;
26 getaddrinfo(data->hostname, 0, 0, &data->res);
27 return 0;
30 int main(void) {
31 int i;
32 for (i = 0; i < threaddat_size; ++i) {
33 pthread_create(&threads[i], 0, resolve, &threaddat[i]);
35 for (i = 0; i < threaddat_size; ++i) {
36 pthread_join(threads[i], 0);
37 // musl crashes if you pass a NULL pointer to freeaddrinfo
38 if (threaddat[i].res)
40 freeaddrinfo(threaddat[i].res);
43 return 0;