ARES_SAVE_OPTIONS(3)
πΎ ARES_SAVE_OPTIONS(3) πΎ
okay so bestie, welcome to the manual page for ares_save_options β it's a libc-ares function and it's literally here to save configuration values obtained from an initialized ares_channel. cute, right? let's get into it β¨
πΈ SYNOPSIS πΈ
#include <ares.h>
int ares_save_options(const ares_channel_t *channel,
struct ares_options *options, int *optmask)
π DESCRIPTION π
so the way ares_save_options(3) works is: it takes the channel data that's identified by channel, and it saves all of that into the options struct (which is identified by options, obviously π
). then it also saves the mask of options that are set into that integer pointer β the one passed by reference β which is identified by optmask. yes, pointer-to-int, she's fancy.
and here's the slay part: the resultant options and optmask can be passed directly into ares_init_options. like, no extra steps, no re-formatting, it just goes. π«Ά
but listen β when you're done with the options and you don't need them anymore, you have to call ares_destroy_options to free any associated memory. do not skip this, bestie, we do not leak in this house. π
π¦ RETURN VALUES π¦
ares_save_options(3) can return any of these little guys:
ARES_SUCCESSβ the channel data was successfully stored πARES_ENOMEMβ the memory was exhausted πARES_ENODATAβ the channel data identified bychannelwere invalid π
β οΈ NOTE β οΈ
okay this is the important lore, so pay attention:
since c-ares 1.6.0, the ares_options struct has been "locked" β meaning it will not be extended to cover new functions. periodt. π
this function will keep on functioning, no worries, but it can only return config data that can actually be represented in this config struct β which may no longer be the complete set of config options. so like, it's giving limited. π
meanwhile ares_dup(3) does not have that restriction. just saying. π
also!! the ares_options struct can not handle potential IPv6 name servers that the ares channel might be configured to use. so ares_save_options(3) will only return IPv4 servers, if any. that's just how she is. π
so if you need to retrieve all the name servers an ares channel might be using, you have to use ares_get_servers(3) instead. no cap, that's the move. β¨
π SEE ALSO π
π AVAILABILITY π
ares_save_options(3) was added in c-ares 1.4.0 β
and that's the whole vibe, bestie β this page came to you courtesy of 5 March 2010, the Library Functions Manual, filed under ARES_SAVE_OPTIONS(3). go forth and save those options responsibly ππ§
π¦ where this page comes from
- alpine 3.22: c-ares-doc 1.34.9-r0 Β· MIT
- alpine 3.23: c-ares-doc 1.34.9-r0 Β· MIT
- alpine 3.24: c-ares-doc 1.34.9-r0 Β· MIT
- arch rolling: c-ares 1.34.9-1 Β· MIT
- centos-stream 10: c-ares-devel 1.34.9-1.el10 Β· MIT
- debian trixie: libc-ares-dev 1.34.5-1+deb13u1 Β· MIT
- fedora 43: c-ares-devel 1.34.5-2.fc43 Β· MIT
- fedora 43: c-ares-devel 1.34.5-2.fc43 Β· MIT
- fedora 43: c-ares-devel 1.34.8-1.fc43 Β· MIT
- fedora 43: c-ares-devel 1.34.8-1.fc43 Β· MIT
- fedora 44: c-ares-devel 1.34.6-3.fc44 Β· MIT
- fedora 44: c-ares-devel 1.34.6-3.fc44 Β· MIT
- fedora 44: c-ares-devel 1.34.8-1.fc44 Β· MIT
- fedora 44: c-ares-devel 1.34.8-1.fc44 Β· MIT
- nixos 26.05: c-ares 1.34.9
- nixpkgs unstable: c-ares 1.34.8
- opensuse-leap 16.0: c-ares-devel 1.34.8-160000.1.1 Β· MIT
- opensuse-leap 16.0: c-ares-devel 1.34.8-160000.1.1 Β· MIT
- opensuse-leap 16.0: c-ares-devel 1.34.8-160000.1.1 Β· MIT
- opensuse-leap 16.0: c-ares-devel 1.34.8-160000.1.1 Β· MIT
- ubuntu questing: libc-ares-dev 1.34.5-1
- ubuntu questing: libc-ares-dev 1.34.5-1ubuntu0.1
- ubuntu resolute: libc-ares-dev 1.34.6-1 Β· MIT
- ubuntu resolute: libc-ares-dev 1.34.6-1ubuntu0.1
- ubuntu resolute: libc-ares-dev 1.34.6-1ubuntu0.2 Β· MIT
- ubuntu stonking: libc-ares-dev 1.34.8-1 Β· MIT
- π the page's license: MIT
- Copyright 1998 by the Massachusetts Institute of Technology
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms