DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

ulimit(2)


ulimit -- get and set user limits

Synopsis

   #include <ulimit.h>
   

long ulimit(int cmd, . . . /* newlimit */ );

Description

This function provides for control over process limits. The cmd values available are:

UL_SFILLIM
Set the regular file size limit of the process to the value of newlimit, taken as a long. Any process may decrease this limit, but only a process with the P_SYSOPS privilege may increase the limit.

UL_GFILLIM
Get the regular file size limit of the process. The limit is in units of 512-byte blocks and is inherited by child processes. Files of any size can be read.

UL_GMEMLIM
Get the maximum possible break value [see brk].

UL_GDESLIM
Get the current value of the maximum number of open files per process configured in the system.

Return values

On success, ulimit returns a non-negative value that depends on cmd as described above. On failure, ulimit returns -1 and sets errno to identify the error.

Errors

In the following conditions, ulimit fails and sets errno to:

EINVAL
The cmd argument is not valid.

EPERM
An attempt was made to increase the process's file size limit and the calling process does not have the P_SYSOPS privilege.

References

Intro(2), brk(2), getrlimit(2), privilege(5), write(2)

Notices

ulimit is effective in limiting the growth of regular files. Pipes are currently limited to {PIPE_MAX}.

The getrlimit system call provides a more general interface for controlling process limits.

Considerations for threads programming

These resource limits are an attribute of the containing process and are shared by sibling threads.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004