Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ulimit(3) — Digital UNIX 4.0d

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ulimit(1)

brk(2)

getrlimit(2)

write(2)

pathconf(2)

standards(5)

ulimit(3)  —  Subroutines

NAME

ulimit − Sets and gets process limits

LIBRARY

Standard C Library (libc.so, libc.a)

SYNOPSIS

#include <ulimit.h>

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

STANDARDS

Interfaces documented on this reference page conform to industry standards as follows:

ulimit():  XPG4, XPG4−UNIX

Refer to the standards(5) reference page for more information about industry standards and associated tags. 

PARAMETERS

commandSpecifies the form of control. The command parameter can have the following values:

UL_GETFSIZE
Returns the soft file size limit of the process. The limit is reported in 512-byte blocks (see the sys/param.h file) and is inherited by child processes.  The function can read files of any size. 

[XPG4−UNIX]  The return value is the integer part of the soft file size limit divided by 512.  If the result cannot be represented as a long int, the result is unspecified. 

UL_SETFSIZE
Sets the hard and soft process file size limit for output operations to the value of the second parameter, taken as long int, and returns the new file size limit.  Any process can decrease its own hard limit, but only a process with superuser privileges can increase the limit. 

[XPG4−UNIX]  The hard and soft file size limits are set to the specified value multiplied by 512. If the result would overflow an rlim_t, the actual value set is unspecified. 

UL_GETBREAK
[Digital]  Returns the maximum possible break value as described in the brk(2) reference page. 

DESCRIPTION

The ulimit() function controls process limits. 

During access to remote files, the process limits of the local node are used. 

On success, the ulimit() function returns the requested limit or an arbitrary value.  Therefore, no particular return value indicates failure.  To check for failure of this function, set the errno variable to 0 (zero) before you call the ulimit() function.  After the function has returned, test its return value.  If the return value from ulimit() is -1, test the value of errno to determine whether an error occurred. 

For the purposes of future expansion, the ulimit() function accepts a variable number of parameters, but currently only the first two parameters are used. 

NOTES

The ulimit() function is implemented in terms of setrlimit(); therefore, the two interfaces should not be used in the same program.  The result of doing so is undefined. 

RETURN VALUES

Upon successful completion, ulimit() returns the value of the requested limit.  Otherwise, a value of -1 is returned and errno is set to indicate the error. 

ERRORS

If the ulimit() function fails, the limit remains unchanged and errno might be set to one of the following values:

[EPERM]A process without appropriate system privilege attempted to increase the file size limit. 

[EINVAL]The command parameter is invalid. 

RELATED INFORMATION

Commands: ulimit(1)

Functions: brk(2), getrlimit(2), write(2)

Routines: pathconf(2)

Standards: standards(5)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026