1ULIMIT(P)                  POSIX Programmer's Manual                 ULIMIT(P)
2
3
4

NAME

6       ulimit - get and set process limits
7

SYNOPSIS

9       #include <ulimit.h>
10
11       long ulimit(int cmd, ...);
12
13

DESCRIPTION

15       The  ulimit() function shall control process limits. The process limits
16       that can be controlled by this function include the maximum size  of  a
17       single  file  that  can  be  written (this is equivalent to using setr‐
18       limit() with RLIMIT_FSIZE). The  cmd  values,  defined  in  <ulimit.h>,
19       include:
20
21       UL_GETFSIZE
22              Return  the  file  size limit (RLIMIT_FSIZE) of the process. The
23              limit shall be in units of 512-byte blocks and shall  be  inher‐
24              ited  by  child  processes.  Files  of any size can be read. The
25              return value shall be the integer part of  the  soft  file  size
26              limit  divided  by 512. If the result cannot be represented as a
27              long, the result is unspecified.
28
29       UL_SETFSIZE
30              Set the file size limit for output operations of the process  to
31              the value of the second argument, taken as a long, multiplied by
32              512. If the result would overflow an rlim_t,  the  actual  value
33              set  is unspecified. Any process may decrease its own limit, but
34              only a process with  appropriate  privileges  may  increase  the
35              limit.  The  return  value  shall be the integer part of the new
36              file size limit divided by 512.
37
38
39       The ulimit() function shall not change the setting of errno if success‐
40       ful.
41
42       As  all  return  values  are  permissible in a successful situation, an
43       application wishing to check for error situations should set  errno  to
44       0,  then call ulimit(), and, if it returns -1, check to see if errno is
45       non-zero.
46

RETURN VALUE

48       Upon successful completion, ulimit() shall  return  the  value  of  the
49       requested limit. Otherwise, -1 shall be returned and errno set to indi‐
50       cate the error.
51

ERRORS

53       The ulimit() function shall fail and the limit shall be unchanged if:
54
55       EINVAL The cmd argument is not valid.
56
57       EPERM  A process not having appropriate privileges attempts to increase
58              its file size limit.
59
60
61       The following sections are informative.
62

EXAMPLES

64       None.
65

APPLICATION USAGE

67       None.
68

RATIONALE

70       None.
71

FUTURE DIRECTIONS

73       None.
74

SEE ALSO

76       getrlimit()  ,  setrlimit()  , write() , the Base Definitions volume of
77       IEEE Std 1003.1-2001, <ulimit.h>
78
80       Portions of this text are reprinted and reproduced in  electronic  form
81       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
82       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
83       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
84       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
85       event of any discrepancy between this version and the original IEEE and
86       The Open Group Standard, the original IEEE and The Open Group  Standard
87       is  the  referee document. The original Standard can be obtained online
88       at http://www.opengroup.org/unix/online.html .
89
90
91
92IEEE/The Open Group                  2003                            ULIMIT(P)
Impressum