plimit - 获取或设置正在运行的进程的资源限制
plimit [-hkm] [--scale[=item1,,item2,...]] pid...
plimit {-cdfnstv [soft][,hard]}... pid...
如果指定了一个或多个 cdfnstv 选项,plimit 会在由进程 ID 列表 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.
支持以下选项:
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.
在输出中,以千字节(1024 个字节)而非 512 个字节的块显示文件大小。
在输出中,以兆字节(1024*1024 个字节)显示文件和内存大小。
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.
输出用法消息并立即退出。
其余选项用于更改指定的资源限制。它们接受以下形式的参数:
soft,hard
soft 指定软(当前)限制,hard 指定硬(最大)限制。如果未指定硬限制,则逗号可以省略。如果软限制是空字符串,则仅设置硬限制。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).
软限制不能超过硬限制。
设置核心文件的大小限制(缺省单位是 512 字节的块)。
设置数据段(堆)的大小限制(缺省单位是千字节)。
设置文件的大小限制(缺省单位是 512 字节的块)。
设置文件描述符的限制(没有缺省单位)。
设置栈段的大小限制(缺省单位是千字节)。
设置 CPU 时间限制(缺省单位是秒)。
设置虚拟内存的大小限制(缺省单位是千字节)。
支持以下操作数。
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.
示例 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 在成功时返回退出值零,失败时(例如,没有这样的进程、权限遭拒或选项无效)返回非零退出值。
进程信息和控制文件
有关下列属性的说明,请参见 attributes(7):
|
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.