Commit 90d36cc6 authored by Yang Tse's avatar Yang Tse
Browse files

Update man page

parent 1bb68cbc
Loading
Loading
Loading
Loading
+36 −19
Original line number Original line Diff line number Diff line
@@ -23,38 +23,41 @@ ares_library_init \- c-ares library initialization
.B #include <ares.h>
.B #include <ares.h>
.PP
.PP
.B int ares_library_init(int \fIflags\fP)
.B int ares_library_init(int \fIflags\fP)
.PP
.B cc file.c -lcares
.fi
.fi
.SH DESCRIPTION
.SH DESCRIPTION
.PP
.PP
The
The
.B ares_library_init
.B ares_library_init
function performs initializations internally required by the c-ares
function performs initializations internally required by the c-ares
library that must take place before any other c-ares function can be
library that must take place before any other function provided by
used.
c-ares can be used in a program.
.PP
.PP
This function must be called one time within the life of a program
This function must be called one time within the life of a program,
before the program actually executes any other c-ares library function
before the program actually executes any other c-ares library function.
call. Initializations done by this function remain effective until a
Initializations done by this function remain effective until a
call to \fIares_library_cleanup(3)\fP is performed.
call to \fIares_library_cleanup(3)\fP is performed.
.PP
.PP
Successive calls to this function are ignored, only the first one with
Successive calls to this function do nothing, only the first call done
c-ares in an uninitialized state is effective.
when c-ares is in an uninitialized state is actually effective.
.PP
.PP
The
The
.I flags
.I flags
parameter is a bit pattern that tells c-ares exactly which features
parameter is a bit pattern that tells c-ares exactly which features
should be initialized, as described below. Set the desired bits by
should be initialized, as described below. Set the desired bits by
ORing the values together. In normal operation, you must specify
ORing the values together. In normal operation you should specify
.I ARES_LIB_INIT_ALL.
\fIARES_LIB_INIT_ALL\fP. Don't use any other value unless you are
Don't use any other value unless you are familiar with it and trying
familiar with it and trying to control some internal c-ares feature.
to control some internal c-ares features.
.PP
.PP
.B This function is not thread safe.
.B This function is not thread safe.
You have to call it once the program
You have to call it once the program
has started but must be called before the program starts any other thread.
has started, but this call must be done before the program starts any
Due to the fact that ares_library_init() might call functions from other
other thread. This is required to avoid potential race conditions in
libraries that are thread unsafe, it could conflict with any other thread
library initialization, and also due to the fact that ares_library_init()
that uses these other libraries.
might call functions from other libraries that are thread unsafe, and
could conflict with any other thread that is already using these other
libraries.
.SH FLAGS
.SH FLAGS
.TP 5
.TP 5
.B ARES_LIB_INIT_ALL
.B ARES_LIB_INIT_ALL
@@ -66,13 +69,27 @@ Initialize Win32 specific libraries.
.B ARES_LIB_INIT_NONE
.B ARES_LIB_INIT_NONE
Initialize nothing extra. This sets no bit.
Initialize nothing extra. This sets no bit.
.SH RETURN VALUE
.SH RETURN VALUE
If this function returns non-zero, something went wrong and you cannot
Upon successful completion, ares_library_init() will return 0.
use the other c-ares functions.
Otherwise, a non-zero error number will be returned to indicate
the error. Except for \fIares_strerror(3)\fP, you shall not call any
other c-ares function upon ares_library_init() failure.
.SH NOTES
.SH NOTES
This function was first introduced in c-ares version 1.6.1 along with
This function was first introduced in c-ares version 1.6.1 along with
the definition of preprocessor symbol CARES_HAVE_ARES_LIBRARY_INIT
the definition of preprocessor symbol \fICARES_HAVE_ARES_LIBRARY_INIT\fP
as an indication of the availability of this function.
as an indication of the availability of this function.
.PP
Since the introduction of this function it is absolutely mandatory to
call it for any Win32 program using c-ares.
.PP
Non-Win32 systems can still use c-ares version 1.6.1 without calling
ares_library_init() due to the fact that it is nearly a do-nothing
function on non-Win32 platforms.
.SH SEE ALSO
.SH SEE ALSO
.BR ares_library_cleanup (3)
.BR ares_library_cleanup(3),
.BR ares_strerror(3)
.SH AUTHOR
.SH AUTHOR
Yang Tse
Yang Tse
.PP
Copyright 1998 by the Massachusetts Institute of Technology.
.br
Copyright (C) 2004-2009 by Daniel Stenberg.