2 #include <netinet/in.h>
13 struct gaicb reqmem
[N
];
17 for (n
= 0; n
< N
; ++n
)
19 asprintf (&reqmem
[n
].ar_name
, "test%d.test.redhat.com", 140 + n
);
20 reqmem
[n
].ar_service
= NULL
;
21 reqmem
[n
].ar_request
= NULL
;
22 reqmem
[n
].ar_result
= NULL
;
26 if (getaddrinfo_a (GAI_NOWAIT
, req
, N
, NULL
) != 0)
28 puts ("queue call failed");
32 puts ("queue call successful");
38 for (n
= 0; n
< N
; ++n
)
39 if (req
[n
] != NULL
&& gai_error (req
[n
]) != EAI_INPROGRESS
)
41 if (gai_error (req
[n
]) == 0)
43 struct addrinfo
*runp
= req
[n
]->ar_result
;
47 switch (runp
->ai_family
)
51 struct sockaddr_in
*sinp
;
53 sinp
= (struct sockaddr_in
*) runp
->ai_addr
;
54 printf ("%2d: %s = %s\n", n
,
55 req
[n
]->ar_name
, inet_ntoa (sinp
->sin_addr
));
59 printf ("%2d: family %d\n", n
, runp
->ai_family
);
66 printf ("error for %d: %s\n", n
,
67 gai_strerror (gai_error (req
[n
])));
71 else if (req
[n
] != NULL
)
77 gai_suspend (req
, N
, NULL
);
83 __libc_write(1,"got all\n", 8);
85 for (n
= 0; n
< N
; ++n
)
86 if (gai_error (&reqmem
[n
]) == 0)
88 struct addrinfo
*runp
= reqmem
[n
].ar_result
;
92 struct addrinfo
*oldp
= runp
;