{"id":7232,"date":"2022-12-20T19:35:55","date_gmt":"2022-12-20T22:35:55","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/getnetent_r-man3\/"},"modified":"2022-12-20T19:35:55","modified_gmt":"2022-12-20T22:35:55","slug":"getnetent_r-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/getnetent_r-man3\/","title":{"rendered":"GETNETENT_R (man3)"},"content":{"rendered":"<h1 align=\"center\">GETNETENT_R<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#RETURN VALUE\">RETURN VALUE<\/a><br \/> <a href=\"#ERRORS\">ERRORS<\/a><br \/> <a href=\"#ATTRIBUTES\">ATTRIBUTES<\/a><br \/> <a href=\"#CONFORMING TO\">CONFORMING TO<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#COLOPHON\">COLOPHON<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">getnetent_r, getnetbyname_r, getnetbyaddr_r \u2212 get network entry (reentrant)<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>#include <netdb.h><\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>int getnetent_r(struct netent *<\/b><i>result_buf<\/i><b>, char *<\/b><i>buf<\/i><b>, <br \/> size_t<\/b> <i>buflen<\/i><b>, struct netent **<\/b><i>result<\/i><b>, <br \/> int *<\/b><i>h_errnop<\/i><b>);<\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>int getnetbyname_r(const char *<\/b><i>name<\/i><b>, <br \/> struct netent *<\/b><i>result_buf<\/i><b>, char *<\/b><i>buf<\/i><b>, <br \/> size_t<\/b> <i>buflen<\/i><b>, struct netent **<\/b><i>result<\/i><b>, <br \/> int *<\/b><i>h_errnop<\/i><b>);<\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>int getnetbyaddr_r(uint32_t<\/b> <i>net<\/i><b>, int<\/b> <i>type<\/i><b>, <br \/> struct netent *<\/b><i>result_buf<\/i><b>, char *<\/b><i>buf<\/i><b>, <br \/> size_t<\/b> <i>buflen<\/i><b>, struct netent **<\/b><i>result<\/i><b>, <br \/> int *<\/b><i>h_errnop<\/i><b>);<\/b><\/p>\n<p style=\"margin-left:5%; margin-top: 1em\">Feature Test Macro Requirements for glibc (see <b>feature_test_macros<\/b>(7)):<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>getnetent_r<\/b>(), <b>getnetbyname_r<\/b>(), <b>getnetbyaddr_r<\/b>(): <br \/> Since glibc 2.19: <br \/> _DEFAULT_SOURCE <br \/> Glibc 2.19 and earlier: <br \/> _BSD_SOURCE || _SVID_SOURCE<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>getnetent_r<\/b>(), <b>getnetbyname_r<\/b>(), and <b>getnetbyaddr_r<\/b>() functions are the reentrant equivalents of, respectively, <b>getnetent<\/b>(3), <b>getnetbyname<\/b>(3), and <b>getnetbynumber<\/b>(3). They differ in the way that the <i>netent<\/i> structure is returned, and in the function calling signature and return value. This manual page describes just the differences from the nonreentrant functions.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Instead of returning a pointer to a statically allocated <i>netent<\/i> structure as the function result, these functions copy the structure into the location pointed to by <i>result_buf<\/i>.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <i>buf<\/i> array is used to store the string fields pointed to by the returned <i>netent<\/i> structure. (The nonreentrant functions allocate these strings in static storage.) The size of this array is specified in <i>buflen<\/i>. If <i>buf<\/i> is too small, the call fails with the error <b>ERANGE<\/b>, and the caller must try again with a larger buffer. (A buffer of length 1024 bytes should be sufficient for most applications.)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">If the function call successfully obtains a network record, then <i>*result<\/i> is set pointing to <i>result_buf<\/i>; otherwise, <i>*result<\/i> is set to NULL.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The buffer pointed to by <i>h_errnop<\/i> is used to return the value that would be stored in the global variable <i>h_errno<\/i> by the nonreentrant versions of these functions.<\/p>\n<h2>RETURN VALUE <a name=\"RETURN VALUE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">On success, these functions return 0. On error, they return one of the positive error numbers listed in ERRORS.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">On error, record not found (<b>getnetbyname_r<\/b>(), <b>getnetbyaddr_r<\/b>()), or end of input (<b>getnetent_r<\/b>()) <i>result<\/i> is set to NULL.<\/p>\n<h2>ERRORS <a name=\"ERRORS\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p style=\"margin-top: 1em\"><b>ENOENT<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p style=\"margin-top: 1em\">(<b>getnetent_r<\/b>()) No more records in database.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><b>ERANGE<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p><i>buf<\/i> is too small. Try again with a larger buffer (and increased <i>buflen<\/i>).<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<h2>ATTRIBUTES <a name=\"ATTRIBUTES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">For an explanation of the terms used in this section, see <b>attributes<\/b>(7).<\/p>\n<p align=\"center\" style=\"margin-top: 1em\"><img decoding=\"async\" src=\"grohtml-1662341.png\" alt=\"Image grohtml-1662341.png\"><\/p>\n<h2>CONFORMING TO <a name=\"CONFORMING TO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">These functions are GNU extensions. Functions with similar names exist on some other systems, though typically with different calling signatures.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>getnetent<\/b>(3), <b>networks<\/b>(5)<\/p>\n<h2>COLOPHON <a name=\"COLOPHON\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This page is part of release 5.10 of the Linux <i>man-pages<\/i> project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https:\/\/www.kernel.org\/doc\/man\u2212pages\/.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  getnetent_r, getnetbyname_r, getnetbyaddr_r \u2212 get network entry (reentrant) <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2536],"tags":[2538,3558,3007],"class_list":["post-7232","post","type-post","status-publish","format-standard","hentry","category-3-llamadas-de-bibliotecas","tag-2538","tag-getnetent_r","tag-man3"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=7232"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7232\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}