Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
24e92084
Commit
24e92084
authored
Mar 11, 1998
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Logical markup.
parent
98b09005
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
62 deletions
+62
-62
Doc/lib/libresource.tex
Doc/lib/libresource.tex
+31
-31
Doc/libresource.tex
Doc/libresource.tex
+31
-31
No files found.
Doc/lib/libresource.tex
View file @
24e92084
...
...
@@ -20,7 +20,7 @@ A single exception is defined for errors:
\subsection
{
Resource Limits
}
Resources usage can be limited using the
\
code
{
setrlimit()
}
function
Resources usage can be limited using the
\
function
{
setrlimit()
}
function
described below. Each resource is controlled by a pair of limits: a
soft limit and a hard limit. The soft limit is the current limit, and
may be lowered or raised by a process over time. The soft limit can
...
...
@@ -29,15 +29,15 @@ value greater than the soft limit, but not raised. (Only processes with
the effective UID of the super-user can raise a hard limit.)
The specific resources that can be limited are system dependent. They
are described in the
\
code
{
getrlimit()
}
man page. The resources
are described in the
\
manpage
{
getrlimit
}{
2
}
man page. The resources
listed below are supported when the underlying operating system
supports them; resources which cannot be checked or controlled by the
operating system are not defined in this module for those platforms.
\begin{funcdesc}
{
getrlimit
}{
resource
}
Returns a tuple
\code
{
(
\var
{
soft
}
,
\var
{
hard
}
)
}
with the current
soft and hard limits of
\var
{
resource
}
. Raises
\
code
{
ValueError
}
if
an invalid resource is specified, or
\
code
{
resource.
error
}
if the
soft and hard limits of
\var
{
resource
}
. Raises
\
exception
{
ValueError
}
if
an invalid resource is specified, or
\
exception
{
error
}
if the
underyling system call fails unexpectedly.
\end{funcdesc}
...
...
@@ -47,19 +47,19 @@ operating system are not defined in this module for those platforms.
integers describing the new limits. A value of
\code
{
-1
}
can be used to
specify the maximum possible upper limit.
Raises
\
code
{
ValueError
}
if an invalid resource is specified, if the new
soft limit exceeds the hard limit, or if a process tries to raise it
s
hard limit (unless the process has an effective UID of
super-user).
Can also raise a
\code
{
resource.error
}
if the
underyling
system call fails.
Raises
\
exception
{
ValueError
}
if an invalid resource is specified,
if the new soft limit exceeds the hard limit, or if a process trie
s
to raise its
hard limit (unless the process has an effective UID of
super-user).
Can also raise
\exception
{
error
}
if the underyling
system call fails.
\end{funcdesc}
These symbols define resources whose consumption can be controlled
using the
\
code
{
setrlimit()
}
and
\code
{
getrlimit()
}
functions defined
below. The values of these symbols are exactly the constants used
by C
programs.
using the
\
function
{
setrlimit()
}
and
\function
{
getrlimit()
}
functions
described below. The values of these symbols are exactly the constants
used by
\C
{}
programs.
The
\UNIX
{}
man page for
\
code
{
getrlimit()
}
lists the available
The
\UNIX
{}
man page for
\
manpage
{
getrlimit
}{
2
}
lists the available
resources. Note that not all systems use the same symbol or same
value to denote the same resource.
...
...
@@ -72,8 +72,8 @@ value to denote the same resource.
\begin{datadesc}
{
RLIMIT
_
CPU
}
The maximum amount of CPU time (in seconds) that a process can
use. If this limit is exceeded, a
\co
de
{
SIGXCPU
}
signal is sent to
the process. (See the
\
cod
e
{
signal
}
module documentation for
use. If this limit is exceeded, a
\co
nstant
{
SIGXCPU
}
signal is sent to
the process. (See the
\
modul
e
{
signal
}
module documentation for
information about how to catch this signal and do something useful,
e.g. flush open files to disk.)
\end{datadesc}
...
...
@@ -107,7 +107,7 @@ value to denote the same resource.
\end{datadesc}
\begin{datadesc}
{
RLIMIT
_
OFILE
}
The BSD name for
\co
de
{
RLIMIT
_
NOFILE
}
.
The BSD name for
\co
nstant
{
RLIMIT
_
NOFILE
}
.
\end{datadesc}
\begin{datadesc}
{
RLIMIT
_
MEMLOC
}
...
...
@@ -131,7 +131,7 @@ These functiona are used to retrieve resource usage information:
This function returns a large tuple that describes the resources
consumed by either the current process or its children, as specified
by the
\var
{
who
}
parameter. The
\var
{
who
}
parameter should be
specified using one of the
\code
{
RUSAGE
_
}
*
constants described
specified using one of the
\code
{
RUSAGE
_
*
}
constants described
below.
The elements of the return value each
...
...
@@ -143,9 +143,9 @@ These functiona are used to retrieve resource usage information:
The first two elements of the return value are floating point values
representing the amount of time spent executing in user mode and the
amount of time spent executing in system mode, respectively. The
remaining values are integers. Consult the
\
code
{
getrusage()
}
man page
for detailed information about these values. A brief summary is
presented here:
remaining values are integers. Consult the
\
manpage
{
getrusage
}{
2
}
man page for detailed information about these values. A brief
summary is
presented here:
\begin{tableii}
{
|r|l|
}{
code
}{
Offset
}{
Resource
}
\lineii
{
0
}{
time in user mode (float)
}
...
...
@@ -166,36 +166,36 @@ These functiona are used to retrieve resource usage information:
\lineii
{
15
}{
involuntary context switches
}
\end{tableii}
This function will raise a
\
code
{
ValueError
}
if an invalid
\var
{
who
}
parameter is specified. It may also raise a
\code
{
resource.error
}
exception in unusual circumstances.
This function will raise a
\
exception
{
ValueError
}
if an invalid
\var
{
who
}
parameter is specified. It may also raise
\exception
{
error
}
exception in unusual circumstances.
\end{funcdesc}
\begin{funcdesc}
{
getpagesize
}{}
Returns the number of bytes in a system page. (This need not be the
same as the hardware page size.) This function is useful for
determining the number of bytes of memory a process is using. The
third element of the tuple returned by
\
code
{
getrusage
}
describes
third element of the tuple returned by
\
function
{
getrusage()
}
describes
memory usage in pages; multiplying by page size produces number of
bytes.
\end{funcdesc}
The following
\code
{
RUSAGE
_
}
*
symbols are passed to the
\
code
{
getrusage()
}
function to specify which processes information
The following
\code
{
RUSAGE
_
*
}
symbols are passed to the
\
function
{
getrusage()
}
function to specify which processes information
should be provided for.
\begin{datadesc}
{
RUSAGE
_
SELF
}
\co
de
{
RUSAGE
_
SELF
}
should be used to
\co
nstant
{
RUSAGE
_
SELF
}
should be used to
request information pertaining only to the process itself.
\end{datadesc}
\begin{datadesc}
{
RUSAGE
_
CHILDREN
}
Pass to
\
code
{
getrusage()
}
to request resource information for child
processes of the calling process.
Pass to
\
function
{
getrusage()
}
to request resource information for
child
processes of the calling process.
\end{datadesc}
\begin{datadesc}
{
RUSAGE
_
BOTH
}
Pass to
\
code
{
getrusage()
}
to request resources consumed by both the
current process and child processes. May not be available on all
Pass to
\
function
{
getrusage()
}
to request resources consumed by both
the
current process and child processes. May not be available on all
systems.
\end{datadesc}
Doc/libresource.tex
View file @
24e92084
...
...
@@ -20,7 +20,7 @@ A single exception is defined for errors:
\subsection
{
Resource Limits
}
Resources usage can be limited using the
\
code
{
setrlimit()
}
function
Resources usage can be limited using the
\
function
{
setrlimit()
}
function
described below. Each resource is controlled by a pair of limits: a
soft limit and a hard limit. The soft limit is the current limit, and
may be lowered or raised by a process over time. The soft limit can
...
...
@@ -29,15 +29,15 @@ value greater than the soft limit, but not raised. (Only processes with
the effective UID of the super-user can raise a hard limit.)
The specific resources that can be limited are system dependent. They
are described in the
\
code
{
getrlimit()
}
man page. The resources
are described in the
\
manpage
{
getrlimit
}{
2
}
man page. The resources
listed below are supported when the underlying operating system
supports them; resources which cannot be checked or controlled by the
operating system are not defined in this module for those platforms.
\begin{funcdesc}
{
getrlimit
}{
resource
}
Returns a tuple
\code
{
(
\var
{
soft
}
,
\var
{
hard
}
)
}
with the current
soft and hard limits of
\var
{
resource
}
. Raises
\
code
{
ValueError
}
if
an invalid resource is specified, or
\
code
{
resource.
error
}
if the
soft and hard limits of
\var
{
resource
}
. Raises
\
exception
{
ValueError
}
if
an invalid resource is specified, or
\
exception
{
error
}
if the
underyling system call fails unexpectedly.
\end{funcdesc}
...
...
@@ -47,19 +47,19 @@ operating system are not defined in this module for those platforms.
integers describing the new limits. A value of
\code
{
-1
}
can be used to
specify the maximum possible upper limit.
Raises
\
code
{
ValueError
}
if an invalid resource is specified, if the new
soft limit exceeds the hard limit, or if a process tries to raise it
s
hard limit (unless the process has an effective UID of
super-user).
Can also raise a
\code
{
resource.error
}
if the
underyling
system call fails.
Raises
\
exception
{
ValueError
}
if an invalid resource is specified,
if the new soft limit exceeds the hard limit, or if a process trie
s
to raise its
hard limit (unless the process has an effective UID of
super-user).
Can also raise
\exception
{
error
}
if the underyling
system call fails.
\end{funcdesc}
These symbols define resources whose consumption can be controlled
using the
\
code
{
setrlimit()
}
and
\code
{
getrlimit()
}
functions defined
below. The values of these symbols are exactly the constants used
by C
programs.
using the
\
function
{
setrlimit()
}
and
\function
{
getrlimit()
}
functions
described below. The values of these symbols are exactly the constants
used by
\C
{}
programs.
The
\UNIX
{}
man page for
\
code
{
getrlimit()
}
lists the available
The
\UNIX
{}
man page for
\
manpage
{
getrlimit
}{
2
}
lists the available
resources. Note that not all systems use the same symbol or same
value to denote the same resource.
...
...
@@ -72,8 +72,8 @@ value to denote the same resource.
\begin{datadesc}
{
RLIMIT
_
CPU
}
The maximum amount of CPU time (in seconds) that a process can
use. If this limit is exceeded, a
\co
de
{
SIGXCPU
}
signal is sent to
the process. (See the
\
cod
e
{
signal
}
module documentation for
use. If this limit is exceeded, a
\co
nstant
{
SIGXCPU
}
signal is sent to
the process. (See the
\
modul
e
{
signal
}
module documentation for
information about how to catch this signal and do something useful,
e.g. flush open files to disk.)
\end{datadesc}
...
...
@@ -107,7 +107,7 @@ value to denote the same resource.
\end{datadesc}
\begin{datadesc}
{
RLIMIT
_
OFILE
}
The BSD name for
\co
de
{
RLIMIT
_
NOFILE
}
.
The BSD name for
\co
nstant
{
RLIMIT
_
NOFILE
}
.
\end{datadesc}
\begin{datadesc}
{
RLIMIT
_
MEMLOC
}
...
...
@@ -131,7 +131,7 @@ These functiona are used to retrieve resource usage information:
This function returns a large tuple that describes the resources
consumed by either the current process or its children, as specified
by the
\var
{
who
}
parameter. The
\var
{
who
}
parameter should be
specified using one of the
\code
{
RUSAGE
_
}
*
constants described
specified using one of the
\code
{
RUSAGE
_
*
}
constants described
below.
The elements of the return value each
...
...
@@ -143,9 +143,9 @@ These functiona are used to retrieve resource usage information:
The first two elements of the return value are floating point values
representing the amount of time spent executing in user mode and the
amount of time spent executing in system mode, respectively. The
remaining values are integers. Consult the
\
code
{
getrusage()
}
man page
for detailed information about these values. A brief summary is
presented here:
remaining values are integers. Consult the
\
manpage
{
getrusage
}{
2
}
man page for detailed information about these values. A brief
summary is
presented here:
\begin{tableii}
{
|r|l|
}{
code
}{
Offset
}{
Resource
}
\lineii
{
0
}{
time in user mode (float)
}
...
...
@@ -166,36 +166,36 @@ These functiona are used to retrieve resource usage information:
\lineii
{
15
}{
involuntary context switches
}
\end{tableii}
This function will raise a
\
code
{
ValueError
}
if an invalid
\var
{
who
}
parameter is specified. It may also raise a
\code
{
resource.error
}
exception in unusual circumstances.
This function will raise a
\
exception
{
ValueError
}
if an invalid
\var
{
who
}
parameter is specified. It may also raise
\exception
{
error
}
exception in unusual circumstances.
\end{funcdesc}
\begin{funcdesc}
{
getpagesize
}{}
Returns the number of bytes in a system page. (This need not be the
same as the hardware page size.) This function is useful for
determining the number of bytes of memory a process is using. The
third element of the tuple returned by
\
code
{
getrusage
}
describes
third element of the tuple returned by
\
function
{
getrusage()
}
describes
memory usage in pages; multiplying by page size produces number of
bytes.
\end{funcdesc}
The following
\code
{
RUSAGE
_
}
*
symbols are passed to the
\
code
{
getrusage()
}
function to specify which processes information
The following
\code
{
RUSAGE
_
*
}
symbols are passed to the
\
function
{
getrusage()
}
function to specify which processes information
should be provided for.
\begin{datadesc}
{
RUSAGE
_
SELF
}
\co
de
{
RUSAGE
_
SELF
}
should be used to
\co
nstant
{
RUSAGE
_
SELF
}
should be used to
request information pertaining only to the process itself.
\end{datadesc}
\begin{datadesc}
{
RUSAGE
_
CHILDREN
}
Pass to
\
code
{
getrusage()
}
to request resource information for child
processes of the calling process.
Pass to
\
function
{
getrusage()
}
to request resource information for
child
processes of the calling process.
\end{datadesc}
\begin{datadesc}
{
RUSAGE
_
BOTH
}
Pass to
\
code
{
getrusage()
}
to request resources consumed by both the
current process and child processes. May not be available on all
Pass to
\
function
{
getrusage()
}
to request resources consumed by both
the
current process and child processes. May not be available on all
systems.
\end{datadesc}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment