fix compiler warning
[platform/upstream/c-ares.git] / ares_getsock.3
1 .\" $Id$
2 .\"
3 .\" Copyright 1998 by Daniel Stenberg
4 .\"
5 .\" Permission to use, copy, modify, and distribute this
6 .\" software and its documentation for any purpose and without
7 .\" fee is hereby granted, provided that the above copyright
8 .\" notice appear in all copies and that both that copyright
9 .\" notice and this permission notice appear in supporting
10 .\" documentation, and that the name of M.I.T. not be used in
11 .\" advertising or publicity pertaining to distribution of the
12 .\" software without specific, written prior permission.
13 .\" M.I.T. makes no representations about the suitability of
14 .\" this software for any purpose.  It is provided "as is"
15 .\" without express or implied warranty.
16 .\"
17 .TH ARES_GETSOCK 3 "11 March 2010"
18 .SH NAME
19 ares_getsock \- get socket descriptors to wait on
20 .SH SYNOPSIS
21 .nf
22 .B #include <ares.h>
23 .PP
24 .B int ares_getsock(ares_channel \fIchannel\fP, ares_socket_t *\fIsocks\fP,
25 .B int \fInumsocks\fP);
26 .fi
27 .SH DESCRIPTION
28 The
29 .B ares_getsock
30 function retrieves the set of socket descriptors which the calling
31 application should wait on for reading and/or writing for the
32 processing of name service queries pending on the name service channel
33 identified by
34 .IR channel .
35 Socket descriptors will be set in the socket descriptor array pointed to by
36 \fIsocks\fP.
37 \fInumsocks\fP is the size of the given array in number of ints.
38
39 This function can only return information about up to 16 sockets. If more are
40 in use (however unlikely that is), they are simply not reported back.
41 .SH RETURN VALUES
42 \fBares_getsock\fP returns a bitmask for what actions to wait for on the
43 different sockets. The ares.h header file provides these convenience macros to
44 extract the information appropriately:
45
46 .nf
47 #define ARES_GETSOCK_MAXNUM 16 /* ares_getsock() can return info about
48                                   this many sockets */
49 #define ARES_GETSOCK_READABLE(bits,num) (bits & (1<< (num)))
50 #define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \
51                                          ARES_GETSOCK_MAXNUM)))
52 .fi
53 .SH NOTES
54 This function was added in c-ares 1.3.1
55 .SH SEE ALSO
56 .BR ares_timeout (3),
57 .BR ares_fds (3),
58 .BR ares_process (3)