Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

ulimit - get and set process limits

&pagelevel(4)&pagelevel

Syntax

#include <ulimit.h>

long int ulimit (int cmd, ...);

Description

Description ulimit() provides for control over process limits. The possible values for cmd, which are defined in ulimit.h, include:

UL_GETFSIZE

Returns the file size limit for the process. The limit is specified in 512-byte blocks and is inherited by child processes. Files of any size can be read.

UL_SETFSIZE

Sets the file size limit for output operations of the process to the value of the second argument, which is interpreted as a long int. Any process may lower its own limit, but only a process with appropriate privileges may increase the limit. The return value is the new file size limit.

Return val.

Value of the requested limit


if successful.

-1

if an error occurs. errno is set to indicate the error.

Errors

ulimit() will fail and the limit will not be changed if:

 

EINVAL

The argument cmd is invalid.

 

EPERM

A process without appropriate privileges is attempting to increase the file size limit.

Notes

Since any return value is permitted if the function is successful, an application wishing to check for error conditions should set errno to 0 before calling ulimit(). If the return value after the function returns is -1 and errno is set, an error has occurred.

See also

write(), ulimit.h.