108 lines
2.5 KiB
Groff
108 lines
2.5 KiB
Groff
'\"macro stdmacro
|
|
.if n .pH g2.ulimit @(#)ulimit 41.4 of 5/26/91
|
|
.\" Copyright 1991 UNIX System Laboratories, Inc.
|
|
.\" Copyright 1989, 1990 AT&T
|
|
.nr X
|
|
.if \nX=0 .ds x} ulimit 2 "" "\&"
|
|
.if \nX=1 .ds x} ulimit 2 ""
|
|
.if \nX=2 .ds x} ulimit 2 "" "\&"
|
|
.if \nX=3 .ds x} ulimit "" "" "\&"
|
|
.TH \*(x}
|
|
.SH NAME
|
|
.Op c p a
|
|
.B ulimit
|
|
\- get and set user limits
|
|
.Op
|
|
.Op f
|
|
.B ulimit, ulimit64
|
|
\- get and set user limits
|
|
.Op
|
|
.SH SYNOPSIS
|
|
.Op c p a
|
|
\f4#include <ulimit.h>\f1
|
|
.PP
|
|
\f4long ulimit(int cmd, ... /* newlimit */ );\f1
|
|
.Op
|
|
.Op f
|
|
\f4integer\(**4 function ulimit (cmd, newlimit)\f1
|
|
.br
|
|
\f4integer\(**4 cmd, newlimit\f1
|
|
.sp
|
|
\f4integer\(**8 function ulimit64 (cmd, newlimit64)\f1
|
|
.br
|
|
\f4integer\(**8 newlimit64\f1
|
|
.Op
|
|
.SH DESCRIPTION
|
|
This function provides for control over process limits.
|
|
The
|
|
.I cmd\^
|
|
values
|
|
available are:
|
|
.TP 15
|
|
\f4UL_GETFSIZE\f1
|
|
Get the regular file size limit of the process.
|
|
The limit is in units of 512-byte blocks
|
|
and is inherited by child processes.
|
|
Files of any size can be read.
|
|
.TP 15
|
|
\f4UL_SETFSIZE\f1
|
|
Set the regular file size limit of the process to
|
|
the value of
|
|
.IR newlimit
|
|
.Op c p a
|
|
, taken as a \f4long\fP.
|
|
.Op
|
|
.Op f
|
|
(or newlimit64).
|
|
.Op
|
|
.I newlimit
|
|
is interpreted in units of 512-byte blocks.
|
|
If, when converted to bytes,
|
|
.I newlimit
|
|
exceeds \f4RLIM_INFINITY\fP, the new file size limit is set to
|
|
\f4RLIM_INFINITY\fP bytes.
|
|
No error is returned.
|
|
Any process may decrease this limit,
|
|
but only a process with an effective user
|
|
.SM ID
|
|
of super-user may increase the limit.
|
|
.TP 15
|
|
\f4UL_GMEMLIM\f1
|
|
Get the maximum possible break value
|
|
[see
|
|
\f4brk\fP(2)].
|
|
.TP 15
|
|
\f4UL_GDESLIM\f1
|
|
Get the current value of the maximum number of open files per process
|
|
configured in the system.
|
|
.PP
|
|
The
|
|
\f4getrlimit\fP
|
|
system call provides a more general interface for controlling process limits.
|
|
.PP
|
|
\f4ulimit\fP fails if the following is true:
|
|
.TP 15
|
|
\f4EINVAL\fP
|
|
The \f2cmd\fP argument is not valid.
|
|
.TP 15
|
|
\f4EPERM\fP
|
|
An attempt was made to increase the process's file size limit and the
|
|
calling process does not have the super-user privilege.
|
|
.SH SEE ALSO
|
|
\f4brk\fP(2), \f4getrlimit\fP(2), \f4write\fP(2)
|
|
.SH NOTES
|
|
\f4ulimit\fP
|
|
is effective in limiting
|
|
the growth of regular files.
|
|
Pipes are currently limited to {\f4PIPE_MAX\f1}.
|
|
.Op f
|
|
.PP
|
|
\f4ulimit64\fP can be used on 64 bit operating systems, this allows a
|
|
much larger range of values for newlimit.
|
|
.Op
|
|
.SH "DIAGNOSTICS"
|
|
Upon successful completion, a non-negative value is returned.
|
|
Otherwise, a value of \-1 is returned and
|
|
\f4errno\fP
|
|
is set to indicate the error.
|