{"id":7112,"date":"2022-12-20T19:35:19","date_gmt":"2022-12-20T22:35:19","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/confstr-man3\/"},"modified":"2022-12-20T19:35:19","modified_gmt":"2022-12-20T22:35:19","slug":"confstr-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/confstr-man3\/","title":{"rendered":"CONFSTR (man3)"},"content":{"rendered":"<h1 align=\"center\">CONFSTR<\/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=\"#EXAMPLES\">EXAMPLES<\/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\">confstr \u2212 get configuration dependent string variables<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>#include <unistd.h><\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>size_t confstr(int<\/b> <i>name<\/i><b>, char *<\/b><i>buf<\/i><b>, size_t<\/b> <i>len<\/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>confstr<\/b>(): _POSIX_C_SOURCE\u00a0>=\u00a02 || _XOPEN_SOURCE<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>confstr<\/b>() gets the value of configuration-dependent string variables.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <i>name<\/i> argument is the system variable to be queried. The following variables are supported: <b><br \/> _CS_GNU_LIBC_VERSION<\/b> (GNU C library only; since glibc 2.3.2)<\/p>\n<p style=\"margin-left:22%;\">A string which identifies the GNU C library version on this system (e.g., &#8220;glibc 2.3.4&#8221;).<\/p>\n<p style=\"margin-left:11%;\"><b>_CS_GNU_LIBPTHREAD_VERSION<\/b> (GNU C library only; since glibc 2.3.2)<\/p>\n<p style=\"margin-left:22%;\">A string which identifies the POSIX implementation supplied by this C library (e.g., &#8220;NPTL 2.3.4&#8221; or &#8220;linuxthreads-0.10&#8221;).<\/p>\n<p style=\"margin-left:11%;\"><b>_CS_PATH<\/b><\/p>\n<p style=\"margin-left:22%;\">A value for the <b>PATH<\/b> variable which indicates where all the POSIX.2 standard utilities can be found.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">If <i>buf<\/i> is not NULL and <i>len<\/i> is not zero, <b>confstr<\/b>() copies the value of the string to <i>buf<\/i> truncated to <i>len \u2212 1<\/i> bytes if necessary, with a null byte (&#8216;\u0000&#8217;) as terminator. This can be detected by comparing the return value of <b>confstr<\/b>() against <i>len<\/i>.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">If <i>len<\/i> is zero and <i>buf<\/i> is NULL, <b>confstr<\/b>() just returns the value as defined below.<\/p>\n<h2>RETURN VALUE <a name=\"RETURN VALUE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">If <i>name<\/i> is a valid configuration variable, <b>confstr<\/b>() returns the number of bytes (including the terminating null byte) that would be required to hold the entire value of that variable. This value may be greater than <i>len<\/i>, which means that the value in <i>buf<\/i> is truncated.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">If <i>name<\/i> is a valid configuration variable, but that variable does not have a value, then <b>confstr<\/b>() returns 0. If <i>name<\/i> does not correspond to a valid configuration variable, <b>confstr<\/b>() returns 0, and <i>errno<\/i> is set to <b>EINVAL<\/b>.<\/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>EINVAL<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"44%\">\n<p style=\"margin-top: 1em\">The value of <i>name<\/i> is invalid.<\/p>\n<\/td>\n<td width=\"34%\"> <\/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-1597941.png\" alt=\"Image grohtml-1597941.png\"><\/p>\n<h2>CONFORMING TO <a name=\"CONFORMING TO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">POSIX.1-2001, POSIX.1-2008.<\/p>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The following code fragment determines the path where to find the POSIX.2 system utilities:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">char *pathbuf; <br \/> size_t n;<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">n = confstr(_CS_PATH, NULL, (size_t) 0); <br \/> pathbuf = malloc(n); <br \/> if (pathbuf == NULL) <br \/> abort(); <br \/> confstr(_CS_PATH, pathbuf, n);<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>getconf<\/b>(1), <b>sh<\/b>(1), <b>exec<\/b>(3), <b>fpathconf<\/b>(3), <b>pathconf<\/b>(3), <b>sysconf<\/b>(3), <b>system<\/b>(3)<\/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>  confstr \u2212 get configuration dependent string variables <\/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,1720,3007],"class_list":["post-7112","post","type-post","status-publish","format-standard","hentry","category-3-llamadas-de-bibliotecas","tag-2538","tag-confstr","tag-man3"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7112","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=7112"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7112\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7112"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}