confstr man page on Oracle

Man page or keyword search:  
man Server   33470 pages
apropos Keyword Search (all sections)
Output format
Oracle logo
[printable version]

CONFSTR(3P)		   POSIX Programmer's Manual		   CONFSTR(3P)

       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
       implementation of this interface may differ (consult the	 corresponding
       Linux  manual page for details of Linux behavior), or the interface may
       not be implemented on Linux.

       confstr - get configurable variables

       #include <unistd.h>

       size_t confstr(int name, char *buf, size_t len);

       The confstr() function shall return configuration-defined  string  val‐
       ues. Its use and purpose are similar to sysconf(), but it is used where
       string values rather than numeric values are returned.

       The name argument represents the system variable to  be	queried.   The
       implementation  shall  support  the  following  name values, defined in
       <unistd.h>. It may support others:


       _CS_XBS5_LP64_OFF64_LIBS (LEGACY)

       If len is not 0, and if name has a configuration-defined	 value,	 conf‐
       str() shall copy that value into the len-byte buffer pointed to by buf.
       If the string to be returned is longer than len	bytes,	including  the
       terminating  null,  then	 confstr()  shall truncate the string to len-1
       bytes and null-terminate the result. The application  can  detect  that
       the  string  was truncated by comparing the value returned by confstr()
       with len.

       If len is 0 and buf is a	 null  pointer,	 then  confstr()  shall	 still
       return  the  integer  value  as	defined	 below, but shall not return a
       string. If len is 0 but buf is  not  a  null  pointer,  the  result  is

       If  the	implementation	supports  the  POSIX  shell option, the string
       stored in buf after a call to:

	      confstr(_CS_PATH, buf, sizeof(buf))

       can be used as a value of the PATH environment variable	that  accesses
       all  of	the  standard utilities of IEEE Std 1003.1-2001, if the return
       value is less than or equal to sizeof( buf).

       If name has a configuration-defined value, confstr() shall  return  the
       size  of	 buffer that would be needed to hold the entire configuration-
       defined value including the terminating null.  If this return value  is
       greater than len, the string returned in buf is truncated.

       If  name is invalid, confstr() shall return 0 and set errno to indicate
       the error.

       If name does not have a configuration-defined  value,  confstr()	 shall
       return 0 and leave errno unchanged.

       The confstr() function shall fail if:

       EINVAL The value of the name argument is invalid.

       The following sections are informative.


       An  application can distinguish between an invalid name parameter value
       and one that corresponds to a configurable variable that has no config‐
       uration-defined	value  by  checking if errno is modified. This mirrors
       the behavior of sysconf().

       The original need for this function was to provide a way of finding the
       configuration-defined  default value for the environment variable PATH.
       Since PATH can be modified by the  user	to  include  directories  that
       could  contain  utilities replacing the standard utilities in the Shell
       and Utilities volume of IEEE Std 1003.1-2001, applications need	a  way
       to  determine  the system-supplied PATH environment variable value that
       contains the correct search path for the standard utilities.

       An application could use:

	      confstr(name, (char *)NULL, (size_t)0)

       to find out how big a buffer is needed for the string value;  use  mal‐
       loc() to allocate a buffer to hold the string; and call confstr() again
       to get the string. Alternately, it could allocate a fixed, static  buf‐
       fer  that  is  big  enough  to  hold  most answers (perhaps 512 or 1024
       bytes), but then use malloc() to allocate a larger buffer if  it	 finds
       that this is too small.

       Application  developers	can normally determine any configuration vari‐
       able by means of reading from the stream opened by a call to:

	      popen("command -p getconf variable", "r");

       The confstr() function with a  name  argument  of  _CS_PATH  returns  a
       string  that  can  be  used as a PATH environment variable setting that
       will reference the standard shell and utilities	as  described  in  the
       Shell and Utilities volume of IEEE Std 1003.1-2001.

       The  confstr()  function	 copies the returned string into a buffer sup‐
       plied by the application instead of returning a pointer	to  a  string.
       This  allows  a cleaner function in some implementations (such as those
       with lightweight threads) and resolves questions about when the	appli‐
       cation must copy the string returned.


       pathconf(),    sysconf(),    the	   Base	   Definitions	  volume    of
       IEEE Std 1003.1-2001, <unistd.h>, the Shell  and	 Utilities  volume  of
       IEEE Std 1003.1-2001, c99

       Portions	 of  this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
       --  Portable  Operating	System	Interface (POSIX), The Open Group Base
       Specifications Issue 6, Copyright (C) 2001-2003	by  the	 Institute  of
       Electrical  and	Electronics  Engineers, Inc and The Open Group. In the
       event of any discrepancy between this version and the original IEEE and
       The  Open Group Standard, the original IEEE and The Open Group Standard
       is the referee document. The original Standard can be  obtained	online
       at .

IEEE/The Open Group		     2003			   CONFSTR(3P)

List of man pages available for Oracle

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net