1GETADDRINFO_A(3) Linux Programmer's Manual GETADDRINFO_A(3)
2
3
4
6 getaddrinfo_a, gai_suspend, gai_error, gai_cancel - asynchronous net‐
7 work address and service translation
8
10 #define _GNU_SOURCE /* See feature_test_macros(7) */
11 #include <netdb.h>
12
13 int getaddrinfo_a(int mode, struct gaicb *list[restrict],
14 int nitems, struct sigevent *restrict sevp);
15 int gai_suspend(const struct gaicb *const list[], int nitems,
16 const struct timespec *timeout);
17
18 int gai_error(struct gaicb *req);
19 int gai_cancel(struct gaicb *req);
20
21 Link with -lanl.
22
24 The getaddrinfo_a() function performs the same task as getaddrinfo(3),
25 but allows multiple name look-ups to be performed asynchronously, with
26 optional notification on completion of look-up operations.
27
28 The mode argument has one of the following values:
29
30 GAI_WAIT
31 Perform the look-ups synchronously. The call blocks until the
32 look-ups have completed.
33
34 GAI_NOWAIT
35 Perform the look-ups asynchronously. The call returns immedi‐
36 ately, and the requests are resolved in the background. See the
37 discussion of the sevp argument below.
38
39 The array list specifies the look-up requests to process. The nitems
40 argument specifies the number of elements in list. The requested look-
41 up operations are started in parallel. NULL elements in list are ig‐
42 nored. Each request is described by a gaicb structure, defined as fol‐
43 lows:
44
45 struct gaicb {
46 const char *ar_name;
47 const char *ar_service;
48 const struct addrinfo *ar_request;
49 struct addrinfo *ar_result;
50 };
51
52 The elements of this structure correspond to the arguments of getad‐
53 drinfo(3). Thus, ar_name corresponds to the node argument and ar_ser‐
54 vice to the service argument, identifying an Internet host and a ser‐
55 vice. The ar_request element corresponds to the hints argument, speci‐
56 fying the criteria for selecting the returned socket address struc‐
57 tures. Finally, ar_result corresponds to the res argument; you do not
58 need to initialize this element, it will be automatically set when the
59 request is resolved. The addrinfo structure referenced by the last two
60 elements is described in getaddrinfo(3).
61
62 When mode is specified as GAI_NOWAIT, notifications about resolved re‐
63 quests can be obtained by employing the sigevent structure pointed to
64 by the sevp argument. For the definition and general details of this
65 structure, see sigevent(7). The sevp->sigev_notify field can have the
66 following values:
67
68 SIGEV_NONE
69 Don't provide any notification.
70