345 lines
9.5 KiB
HTML
345 lines
9.5 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
|
|
<title>sysconf()--Get System Configuration Variables</title>
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<!-- Begin Header Records ========================================== -->
|
|
<!-- file cleaned -->
|
|
<!-- Unix2 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
|
|
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
|
|
<!-- Change History: -->
|
|
<!-- 0206?? JET This file has undergone html cleanup -->
|
|
<!-- 050407 JTROUS: fix enums, no change flag, V5R4 -->
|
|
<!--End Header Records -->
|
|
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
|
|
</head>
|
|
<body>
|
|
<a name="Top_Of_Page"></a>
|
|
<!-- Java sync-link -->
|
|
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript">
|
|
</script>
|
|
|
|
<h2>sysconf()--Get System Configuration Variables</h2>
|
|
|
|
<div class="box" style="width: 60%;">
|
|
<br>
|
|
Syntax<br>
|
|
|
|
|
|
<pre>
|
|
#include <unistd.h>
|
|
|
|
long sysconf(int <strong>name</strong>);
|
|
</pre>
|
|
|
|
<br>
|
|
Service Program Name: QP0LLIB1<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
Default Public Authority: *USE<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
Threadsafe: Yes<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
</div>
|
|
|
|
<p>The <strong>sysconf()</strong> function returns the value of a system
|
|
configuration option. The configuration option to be obtained is specified by
|
|
<strong>name</strong>.</p>
|
|
|
|
<br>
|
|
<h3>Parameters</h3>
|
|
|
|
<dl>
|
|
<dt><strong><em>name</em></strong></dt>
|
|
|
|
<dd>(Input) The named variable whose value is to be returned.</dd>
|
|
</dl>
|
|
|
|
<p>The value of <strong>name</strong> can be any one of the following symbols
|
|
defined in the <<strong>unistd.h</strong>> header file, each
|
|
corresponding to a system configuration option:</p>
|
|
|
|
<table cellpadding="5">
|
|
<!-- cols="25 75" -->
|
|
<tr>
|
|
<td align="left" valign="top"><em>_SC_ARG_MAX</em></td>
|
|
<td align="left" valign="top">(Not supported by the iSeries server). Represents
|
|
ARG_MAX, which indicates the maximum number of bytes of arguments and
|
|
environment data that can be passed in an <strong>exec</strong> function.<br>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>_SC_CHILD_MAX</em></td>
|
|
<td align="left" valign="top">(Not supported by the iSeries server). Represents
|
|
CHILD_MAX, which indicates the maximum number of jobs that a real user ID (UID)
|
|
can have running simultaneously.<br>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>_SC_CLK_TCK</em></td>
|
|
<td align="left" valign="top">Represents the CLK_TCK macro, which indicates the
|
|
number of clock ticks in a second. CLK_TCK is defined in the
|
|
<<strong>time.h</strong>> header file.<br>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>_SC_JOB_CONTROL</em></td>
|
|
<td align="left" valign="top">(Not supported by the iSeries server). Represents
|
|
the _POSIX_JOB_CONTROL macro, which indicates that certain job control
|
|
operations are implemented by this version of the operating system. If
|
|
_POSIX_JOB_CONTROL is defined (in the <<strong>unistd.h</strong>> header
|
|
file), various APIs, such as <strong>setpgid()</strong>, provide more function
|
|
than when the macro is not defined.<br>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>_SC_NGROUPS_MAX</em></td>
|
|
<td align="left" valign="top">Represents NGROUPS_MAX, which indicates the
|
|
maximum number of supplementary group IDs (GIDs) that can be associated with a
|
|
job.<br>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>_SC_OPEN_MAX</em></td>
|
|
<td align="left" valign="top">Represents OPEN_MAX, which indicates the maximum
|
|
number of files that a single job can have open at one time.<br>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>_SC_PAGESIZE</em></td>
|
|
<td align="left" valign="top">Represents the system hardware page size. The
|
|
symbol _SC_PAGESIZE is defined as the decimal value 11.<br>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>_SC_PAGE_SIZE</em></td>
|
|
<td align="left" valign="top">Represents the system hardware page size. The
|
|
symbol _SC_PAGE_SIZE is defined as the decimal value 12.<br>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>_SC_SAVED_IDS</em></td>
|
|
<td align="left" valign="top">(Not supported by the iSeries server). Represents
|
|
the _POSIX_SAVED_IDS macro, which indicates that this POSIX implementation has
|
|
a saved set UID and a saved set GID. If the macro exists, it is defined in the
|
|
<<strong>unistd.h</strong>> header file. This symbol affects the behavior
|
|
of such functions as <strong>setuid()</strong> and <strong>
|
|
setgid()</strong>.<br>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>_SC_STREAM_MAX</em></td>
|
|
<td align="left" valign="top">Represents the STREAM_MAX macro, which indicates
|
|
the maximum number of streams that a job can have open at one time. The macro
|
|
is defined in the <<strong>limits.h</strong>> header file.<br>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>_SC_TZNAME_MAX</em></td>
|
|
<td align="left" valign="top">(Not supported by the iSeries server). Represents
|
|
the TZNAME_MAX macro, which indicates the maximum length of the name of a time
|
|
zone. If the macro exists, it is defined in the
|
|
<<strong>limits.h</strong>> header file.<br>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>_SC_VERSION</em></td>
|
|
<td align="left" valign="top">(Not supported by the iSeries server). Represents
|
|
the _POSIX_VERSION macro, which indicates the version of the POSIX.1 standard
|
|
that the system conforms to. If the macro exists, it is defined in the
|
|
<<strong>unistd.h</strong>> header file.<br>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>_SC_CCSID</em></td>
|
|
<td align="left" valign="top">Represents the default coded character set
|
|
identifier (CCSID) used internally for integrated file system path names. A
|
|
CCSID uniquely identifies the coded graphic character representation of a path
|
|
name and includes such information as the character set and code page
|
|
identifier. The symbol _SC_CCSID is defined as the decimal value 10.</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br>
|
|
<br>
|
|
<h3>Authorities</h3>
|
|
|
|
<p>No authorization is required.</p>
|
|
|
|
<br>
|
|
<h3>Return Value</h3>
|
|
|
|
<table cellpadding="5">
|
|
<!-- cols="10 90" -->
|
|
<tr>
|
|
<td align="left" valign="top"><em>value</em></td>
|
|
<td align="left" valign="top"><strong>sysconf()</strong> was successful. The
|
|
value associated with the specified option is returned.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>-1</em></td>
|
|
<td align="left" valign="top">One of the following has occurred:
|
|
|
|
<ul>
|
|
<li>The variable corresponding to <strong>name</strong> is valid but is not
|
|
supported by the system. The <strong>errno</strong> global variable is not
|
|
changed.</li>
|
|
|
|
<li><strong>sysconf()</strong> failed in some other way. The <strong>
|
|
errno</strong> is set to indicate the error.</li>
|
|
</ul>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br>
|
|
<br>
|
|
<h3>Error Conditions</h3>
|
|
|
|
<p>If <strong>sysconf()</strong> is not successful, <strong>errno</strong>
|
|
usually indicates one of the following errors. Under some conditions, <strong>
|
|
errno</strong> could indicate an error other than those listed here.</p>
|
|
|
|
<table cellpadding="5">
|
|
<!-- cols="25 75" -->
|
|
|
|
<tr>
|
|
<th align="left" valign="bottom">Error condition</th>
|
|
<th align="left" valign="bottom">Additional information</th>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top">
|
|
<em>[<a href="unix14.htm#EBADFID">EBADFID</a>]</em></td>
|
|
<td align="left" valign="top">
|
|
|
|
</td></tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top">
|
|
<em>[<a href="unix14.htm#EINVAL">EINVAL</a>]</em></td>
|
|
|
|
<td align="left" valign="top">
|
|
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br>
|
|
<br>
|
|
<h3>Error Messages</h3>
|
|
|
|
<p>The following messages may be sent from this function:</p>
|
|
|
|
<table width="100%" cellpadding="5">
|
|
<!-- cols="15 85" -->
|
|
<tr>
|
|
<th align="left" valign="top">Message ID</th>
|
|
<th align="left" valign="top">Error Message Text</th>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top">CPE3418 E</td>
|
|
<td align="left" valign="top">Possible APAR condition or hardware failure.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top">CPF3CF2 E</td>
|
|
<td align="left" valign="top">Error(s) occurred during running of &1
|
|
API.</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br>
|
|
<br>
|
|
<h3>Related Information</h3>
|
|
|
|
<ul>
|
|
<li>The <<strong>unistd.h</strong>> file (see <a href="unix13.htm">Header
|
|
Files for UNIX-Type Functions</a>)</li>
|
|
</ul>
|
|
|
|
<br>
|
|
<h3>Example</h3>
|
|
|
|
<p>See <a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
|
|
for information pertaining to code examples.</p>
|
|
|
|
<p>The following example determines the value of OPEN_MAX:</p>
|
|
|
|
<pre>
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
#include <errno.h>
|
|
|
|
main() {
|
|
long result;
|
|
|
|
errno = 0;
|
|
puts("examining OPEN_MAX limit");
|
|
if ((result = sysconf(_SC_OPEN_MAX)) == -1)
|
|
if (errno == 0)
|
|
puts("OPEN_MAX is not supported.");
|
|
else perror("sysconf() error");
|
|
else
|
|
printf("OPEN_MAX is %ld\n", result);
|
|
}
|
|
</pre>
|
|
|
|
<br>
|
|
<p><strong>Output:</strong></p>
|
|
|
|
<pre>
|
|
examining OPEN_MAX limit
|
|
OPEN_MAX is 200
|
|
</pre>
|
|
|
|
<br>
|
|
<hr>
|
|
API introduced: V3R1
|
|
|
|
<hr>
|
|
<center>
|
|
<table cellpadding="2" cellspacing="2">
|
|
<tr align="center">
|
|
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
|
|
"unix.htm">UNIX-Type APIs</a> | <a href="aplist.htm">APIs by category</a></td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
</body>
|
|
</html>
|
|
|