The ulimit routine examines or changes process' file size limits.
The cmd values available are:
UL_GETFSIZE
Return the process's regular file size limit
in units of 512-byte blocks.
The regular file size limit is inherited by child processes.
Files of any size may be read.
UL_SETFSIZE
Set the regular file size limit for output operations of the process to the
value of the optional second argument (must be of type long).
Any process may decrease its own file size limit, but only a process with
an effective user ID of super user may increase the
limit. The new file size limit is returned by the routine.
Return value
Upon successful completion, the ulimit
routine returns the value of the limit requested.
If the routine fails, ulimit returns a value of -1 and
errno is set to indicate the appropriate error.
Diagnostics
If one of the following conditions occurs,
the ulimit routine fails (no values will be changed)
and errno is set to the corresponding value:
[EINVAL]
The cmd argument is invalid.
[EPERM]
A process with an effective user
ID other than super user attempted to increase its
regular file size limit.