Go to main content

手册页部分 1:用户命令

退出打印视图

更新时间: 2022年7月27日 星期三
 
 

plimit(1)

名称

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.

选项

支持以下选项:

–h

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.

–k

在输出中,以千字节(1024 个字节)而非 512 个字节的块显示文件大小。

–m

在输出中,以兆字节(1024*1024 个字节)显示文件和内存大小。

–scale[=item1,item2,...]

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.

binary

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, ...).

max

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.

min

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.

minwide

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.

1000

Scaling is done by repetitively dividing by a scale factor of 1000.

1024

Scaling is done by repetitively dividing by a scale factor of 1024.

–?
–-help

输出用法消息并立即退出。

其余选项用于更改指定的资源限制。它们接受以下形式的参数:

soft,hard

soft 指定软(当前)限制,hard 指定硬(最大)限制。如果未指定硬限制,则逗号可以省略。如果软限制是空字符串,则仅设置硬限制。Each limit can have one of the following forms:

unlimited

The literal string unlimited indicates that no limit applies to the given resource.

n[.n][scale]

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.

mm:ss

Minutes and seconds (for CPU time only).

软限制不能超过硬限制。

–c soft,hard

设置核心文件的大小限制(缺省单位是 512 字节的块)。

–d soft,hard

设置数据段(堆)的大小限制(缺省单位是千字节)。

–f soft,hard

设置文件的大小限制(缺省单位是 512 字节的块)。

–n soft,hard

设置文件描述符的限制(没有缺省单位)。

–s soft,hard

设置栈段的大小限制(缺省单位是千字节)。

–t soft,hard

设置 CPU 时间限制(缺省单位是秒)。

–v soft,hard

设置虚拟内存的大小限制(缺省单位是千字节)。

操作数

支持以下操作数。

pid

Process ID list.May be specified as a numeric id or /proc/pid.

示例

示例 1 Setting a limit for a single process

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 processes

The 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 在成功时返回退出值零,失败时(例如,没有这样的进程、权限遭拒或选项无效)返回非零退出值。

文件

/proc/pid/*

进程信息和控制文件

属性

有关下列属性的说明,请参见 attributes(7)

属性类型
属性值
可用性
system/core-os

另请参见

proc(1), ulimit(1), getpflags(2), getrlimit(2), setrlimit(2), proc(5), attributes(7), privileges(7)

History

The –h and –-scale options were added in Oracle Solaris 11.4.42.

The plimit command was added in Solaris 7.