sysconf - get configuration information at run time


   #include <unistd.h>

   long sysconf(int name);


   POSIX  allows  an  application  to  test at compile or run time whether
   certain options  are  supported,  or  what  the  value  is  of  certain
   configurable constants or limits.

   At  compile time this is done by including <unistd.h> and/or <limits.h>
   and testing the value of certain macros.

   At run time, one  can  ask  for  numerical  values  using  the  present
   function  sysconf().   One can ask for numerical values that may depend
   on the filesystem a  file  is  in  using  the  calls  fpathconf(3)  and
   pathconf(3).  One can ask for string values using confstr(3).

   The  values  obtained  from  these  functions  are system configuration
   constants.  They do not change during the lifetime of a process.

   For options, typically, there is a  constant  _POSIX_FOO  that  may  be
   defined in <unistd.h>.  If it is undefined, one should ask at run time.
   If it is defined to -1, then the option is not  supported.   If  it  is
   defined to 0, then relevant functions and headers exist, but one has to
   ask at run time what degree of support is available.  If it is  defined
   to  a  value other than -1 or 0, then the option is supported.  Usually
   the value (such as 200112L) indicates the year and month of  the  POSIX
   revision  describing  the  option.   Glibc uses the value 1 to indicate
   support as long as the POSIX revision has not been published yet.   The
   sysconf()  argument  will  be  _SC_FOO.   For  a  list  of options, see

   For variables or limits, typically, there is  a  constant  _FOO,  maybe
   defined in <limits.h>, or _POSIX_FOO, maybe defined in <unistd.h>.  The
   constant will not be defined if  the  limit  is  unspecified.   If  the
   constant  is  defined, it gives a guaranteed value, and a greater value
   might actually be supported.  If an application wants to take advantage
   of  values which may change between systems, a call to sysconf() can be
   made.  The sysconf() argument will be _SC_FOO.

   POSIX.1 variables
   We give the name of the variable, the name of  the  sysconf()  argument
   used to inquire about its value, and a short description.

   First, the POSIX.1 compatible values.

          The  maximum  length  of  the arguments to the exec(3) family of
          functions.  Must not be less than _POSIX_ARG_MAX (4096).

          The maximum number of simultaneous processes per user ID.   Must
          not be less than _POSIX_CHILD_MAX (25).

          Maximum length of a hostname, not including the terminating null
          byte, as returned by gethostname(2).   Must  not  be  less  than
          _POSIX_HOST_NAME_MAX (255).

          Maximum  length  of a login name, including the terminating null
          byte.  Must not be less than _POSIX_LOGIN_NAME_MAX (9).

          Maximum number of supplementary group IDs.

   clock ticks - _SC_CLK_TCK
          The  number  of  clock  ticks  per  second.   The  corresponding
          variable  is obsolete.  It was of course called CLK_TCK.  (Note:
          the macro CLOCKS_PER_SEC does  not  give  information:  it  must
          equal 1000000.)

          The  maximum number of files that a process can have open at any
          time.  Must not be less than _POSIX_OPEN_MAX (20).

          Size of a page in bytes.   Must  not  be  less  than  1.   (Some
          systems use PAGE_SIZE instead.)

          The  number  of  repeated  occurrences  of  a  BRE  permitted by
          regexec(3)   and   regcomp(3).    Must   not   be   less    than
          _POSIX2_RE_DUP_MAX (255).

          The  maximum  number  of streams that a process can have open at
          any time.  If defined, it has the same value as the  standard  C
          macro FOPEN_MAX.  Must not be less than _POSIX_STREAM_MAX (8).

          The  maximum  number of symbolic links seen in a pathname before
          resolution   returns   ELOOP.    Must   not   be    less    than
          _POSIX_SYMLOOP_MAX (8).

          The  maximum  length  of  terminal  device  name,  including the
          terminating   null   byte.     Must    not    be    less    than
          _POSIX_TTY_NAME_MAX (9).

          The  maximum  number  of  bytes in a timezone name.  Must not be
          less than _POSIX_TZNAME_MAX (6).

          indicates the year and month the POSIX.1 standard  was  approved
          in  the  format  YYYYMML;  the value 199009L indicates the Sept.
          1990 revision.

   POSIX.2 variables
   Next, the POSIX.2 values, giving limits for utilities.

          indicates the maximum obase value accepted by the bc(1) utility.

          indicates the maximum value of elements permitted in an array by

          indicates the maximum scale value allowed by bc(1).

          indicates the maximum length of a string accepted by bc(1).

          indicates the maximum numbers of weights that can be assigned to
          an  entry  of  the  LC_COLLATE  order  keyword  in  the   locale
          definition file,

          is  the maximum number of expressions which can be nested within
          parentheses by expr(1).

          The maximum length  of  a  utility's  input  line,  either  from
          standard  input  or  from  a  file.   This  includes space for a
          trailing newline.

          The  maximum  number  of  repeated  occurrences  of  a   regular
          expression when the interval notation \{m,n\} is used.

          indicates  the  version of the POSIX.2 standard in the format of

          indicates whether the POSIX.2 C language development  facilities
          are supported.

          indicates  whether the POSIX.2 FORTRAN development utilities are

          indicates whether the POSIX.2  FORTRAN  run-time  utilities  are

          indicates   whether   the   POSIX.2   creation  of  locates  via
          localedef(1) is supported.

          indicates whether the  POSIX.2  software  development  utilities
          option is supported.

   These values also exist, but may not be standard.

          The  number  of  pages  of  physical  memory.   Note  that it is
          possible for  the  product  of  this  value  and  the  value  of
          _SC_PAGESIZE to overflow.

          The number of currently available pages of physical memory.

          The number of processors configured.

          The number of processors currently online (available).


   If  name  is  invalid,  -1  is  returned,  and  errno is set to EINVAL.
   Otherwise, the value returned is the value of the system  resource  and
   errno  is  not  changed.   In  the case of options, a positive value is
   returned if a queried option is available, and -1 if it is not.  In the
   case of limits, -1 means that there is no definite limit.


   For   an   explanation   of   the  terms  used  in  this  section,  see

   Interface  Attribute      Value       
   sysconf()  Thread safety  MT-Safe env 


   POSIX.1-2001, POSIX.1-2008.


   It is difficult to use ARG_MAX because it is not specified how much  of
   the  argument  space  for exec(3) is consumed by the user's environment

   Some returned values may be huge; they are not suitable for  allocating


   bc(1),   expr(1),   getconf(1),  locale(1),  confstr(3),  fpathconf(3),
   pathconf(3), posixoptions(7)


   This page is part of release 4.09 of the Linux  man-pages  project.   A
   description  of  the project, information about reporting bugs, and the
   latest    version    of    this    page,    can     be     found     at


Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.

Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.

Free Software

Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.

Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.

Free Books

The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.

Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.


Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.

Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.