plimit - get or set the resource limits of running processes
plimit [-hkm] [--scale[=item1,,item2,...]] pid...
plimit {-cdfnstv [soft][,hard]}... pid...
If one or more of the cdfnstv options is specified, plimit sets the soft (current) limit and/or the hard (maximum) limit of the indicated resource(s) in the processes identified by the process-ID list, pid. Otherwise plimit reports the resource limits of the processes identified by the process-ID list, pid.
The owner of a process is permitted to either get or set the resource limits of a process, unless the process has the {PRIV_PROC_SENSITIVE} flag set (see the getpflags(2) man page). The {PRIV_PROC_OWNER} privilege is required to get or set the resource limits of a process which is either owned by another uid or has the {PRIV_PROC_SENSITIVE} flag set. The {PRIV_SYS_RESOURCE} privilege is required to increase a hard limit.
The following options are supported:
On output, file and memory sizes are scaled to a human readable format. The –h option is equivalent to using the –scale=max,1024 option.
On output, show file sizes in kilobytes (1024 bytes) rather than in 512-byte blocks.
On output, show file and memory sizes in megabytes (1024*1024 bytes).
On output, file and memory sizes are scaled to a human readable format, for example, 14K, 234M, 2.7G, or 3.0T. Scaling is done by repetitively dividing by 1024, unless otherwise specified.
–scale specified without arguments enables default scaled output, and is equivalent to –scale=max,1024.
–scale can be specified with the following arguments.
Scaling is done by repetitively dividing by a scale factor of 1024. The use of binary scaling is indicated by the addition of an 'i' modifier to the suffix (Ki, Mi, Gi, ...).
Values are scaled to the largest unit for which the result retains a non-zero integer part. Up to 2 decimal places of fractional output may be shown.
Values are scaled to the smallest unit capable of showing the full value within the allotted space of 5 columns, and displayed without the use of fractional output.
Values are scaled to the smallest unit capable of showing the full value within the allotted space of 8 columns, and displayed without the use of fractional output.
Scaling is done by repetitively dividing by a scale factor of 1000.
Scaling is done by repetitively dividing by a scale factor of 1024.
Print usage message and immediately exit.
The remainder of the options are used to change specified resource limits. They each accept an argument of the form:
soft,hard
where soft specifies the soft (current) limit and hard specifies the hard (maximum) limit. If the hard limit is not specified, the comma may be omitted. If the soft limit is an empty string, only the hard limit is set. Each limit can have one of the following forms:
The literal string unlimited indicates that no limit applies to the given resource.
A plain number, with an optional fraction and scale factor. When specifying CPU time, the h or m scale factors can be applied, indicating hours or minutes respectively. When specifying file or memory sizes, the k, m, g, t, p, and e scale factors can be specified, denoting kilobytes, megabytes, gigabytes, terabytes, petabytes, or exabytes, respectively.
Minutes and seconds (for CPU time only).
The soft limit cannot exceed the hard limit.
Set core file size limits (default unit is 512-byte blocks).
Set data segment (heap) size limits (default unit is kilobytes).
Set file size limits (default unit is 512-byte blocks).
Set file descriptor limits (no default unit).
Set stack segment size limits (default unit is kilobytes).
Set CPU time limits (default unit is seconds).
Set virtual memory size limits (default unit is kilobytes).
The following operands are supported.
Process ID list. May be specified as a numeric id or /proc/pid.
The following example sets the file descriptor soft limit to 1024 and does not change the hard limit, for process id 5114:
$ plimit -n 1024 5114
Note that some programs do not check if the number of file descriptors they can use has changed while running and may continue to use to the number they had at startup.
Example 2 Setting a limit for all running processesThe following example sets the maximum core dump size (both soft and hard limits) to zero bytes for all processes running on the system:
# plimit -c 0,0 /proc/*
plimit returns the exit value zero on success, non-zero on failure (such as no such process, permission denied, or invalid option).
process information and control files
See attributes(7) for descriptions of the following attributes:
|
proc(1), ulimit(1), getpflags(2), getrlimit(2), setrlimit(2), proc(5), attributes(7), privileges(7)
The –h and –-scale options were added in Oracle Solaris 11.4.42.
The plimit command was added in Solaris 7.