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

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10
11

NAME

13       ulimit — get and set process limits
14

SYNOPSIS

16       #include <ulimit.h>
17
18       long ulimit(int cmd, ...);
19

DESCRIPTION

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

RETURN VALUE

52       Upon successful completion, ulimit() shall  return  the  value  of  the
53       requested limit. Otherwise, −1 shall be returned and errno set to indi‐
54       cate the error.
55

ERRORS

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

EXAMPLES

67       None.
68

APPLICATION USAGE

70       Since  the  ulimit()  function  uses type long rather than rlim_t, this
71       function is not sufficient for file  sizes  on  many  current  systems.
72       Applications  should  use  the  getrlimit()  or  setrlimit()  functions
73       instead of the obsolescent ulimit() function.
74

RATIONALE

76       None.
77

FUTURE DIRECTIONS

79       The ulimit() function may be removed in a future version.
80

SEE ALSO

82       exec, getrlimit(), write()
83
84       The Base Definitions volume of POSIX.1‐2008, <ulimit.h>
85
87       Portions of this text are reprinted and reproduced in  electronic  form
88       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
89       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
90       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
91       cal and Electronics Engineers,  Inc  and  The  Open  Group.   (This  is
92       POSIX.1-2008  with  the  2013  Technical Corrigendum 1 applied.) In the
93       event of any discrepancy between this version and the original IEEE and
94       The  Open Group Standard, the original IEEE and The Open Group Standard
95       is the referee document. The original Standard can be  obtained  online
96       at http://www.unix.org/online.html .
97
98       Any  typographical  or  formatting  errors that appear in this page are
99       most likely to have been introduced during the conversion of the source
100       files  to  man page format. To report such errors, see https://www.ker
101       nel.org/doc/man-pages/reporting_bugs.html .
102
103
104
105IEEE/The Open Group                  2013                           ULIMIT(3P)
Impressum