Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getrlimit(2) — Atari System V ue12

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

open(2)

sigaltstack(2)

malloc(3C)

signal(5)





   getrlimit(2)                                                   getrlimit(2)


   NAME
         getrlimit, setrlimit - control maximum system resource consumption

   SYNOPSIS
         #include <sys/time.h>
         #include <sys/resource.h>
         int getrlimit(int resource, struct rlimit *rlp);
         int setrlimit(int resource, const struct rlimit *rlp);

   DESCRIPTION
         Limits on the consumption of a variety of system resources by a
         process and each process it creates may be obtained with getrlimit
         and set with setrlimit.

         Each call to either getrlimit or setrlimit identifies a specific
         resource to be operated upon as well as a resource limit.  A resource
         limit is a pair of values:  one specifying the current (soft) limit,
         the other a maximum (hard) limit.  Soft limits may be changed by a
         process to any value that is less than or equal to the hard limit.  A
         process may (irreversibly) lower its hard limit to any value that is
         greater than or equal to the soft limit.  Only a process with an
         effective user ID or superuser can raise a hard limit.  Both hard and
         soft limits can be changed in a single call to setrlimit subject to
         the constraints described above.  Limits may have an infinite value
         of RLIMINFINITY.  rlp is a pointer to struct rlimit that includes
         the following members:
              rlimt rlimcur; /* current (soft) limit */
              rlimt rlimmax; /* hard limit */

         rlimt is an arithmetic data type to which objects of type int,
         sizet, and offt can be cast without loss of information.

         The possible resources, their descriptions, and the actions taken
         when current limit is exceeded, are summarized in the table below:
          Resources      Description         Action
         _______________________________________________
         RLIMITCORE   The maximum       The writing of
                       size of a core    a core file
                       file in bytes     will terminate
                       that may be       at this size.
                       created by a
                       process.  A
                       limit of 0 will
                       prevent the
                       creation of a
                       core file.







   7/91                                                                 Page 1









   getrlimit(2)                                                   getrlimit(2)


         RLIMITCPU    The maximum       SIGXCPU is sent
                       amount of CPU     to the process.
                       time in seconds   If the process
                       used by a         is holding or
                       process.          ignoring
                                         SIGXCPU, the
                                         behavior is
                                         scheduling
                                         class defined.
         RLIMITDATA   The maximum       brk(2) will
                       size of a         fail with errno
                       process's heap    set to ENOMEM.
                       in bytes.
           Resources       Description          Action
         __________________________________________________
         RLIMITFSIZE    The maximum       SIGXFSZ is sent
                         size of a file    to the process.
                         in bytes that     If the process
                         may be created    is holding or
                         by a process.     ignoring
                         A limit of 0      SIGXFSZ,
                         will prevent      continued
                         the creation of   attempts to
                         a file.           increase the
                                           size of a file
                                           beyond the
                                           limit will fail
                                           with errno set
                                           to EFBIG.
         RLIMITNOFILE   The maximum       Functions that
                         number of open    create new file
                         file              descriptors
                         descriptors       will fail with
                         that the          errno set to
                         process can       EMFILE.
                         have.

















   Page 2                                                                 7/91









   getrlimit(2)                                                   getrlimit(2)


         RLIMITSTACK    The maximum       SIGSEGV is sent
                         size of a         to the process.
                         process's stack   If the process
                         in bytes.  The    is holding or
                         system will not   ignoring
                         automatically     SIGSEGV, or is
                         grow the stack    catching
                         beyond this       SIGSEGV and has
                         limit.            not made
                                           arrangements to
                                           use an
                                           alternate stack
                                           [see
                                           sigaltstack(2)],
                                           the disposition
                                           of SIGSEGV will
                                           be set to
                                           SIGDFL before
                                           it is sent.
         RLIMITVMEM     The maximum       brk(2) and
                         size of a         mmap(2)
                         process's         functions will
                         mapped address    fail with errno
                         space in bytes.   set to ENOMEM.
                                           In addition,
                                           the automatic
                                           stack growth
                                           will fail with
                                           the effects
                                           outlined above.

         Because limit information is stored in the per-process information,
         the shell builtin ulimit must directly execute this system call if it
         is to affect all future processes created by the shell.

         The value of the current limit of the following resources affect
         these implementation defined constants:
                    Limit           Implementation Defined Constant
                    _______________________________________________
                    RLIMITFSIZE    FCHRMAX
                    RLIMITNOFILE   OPENMAX

   RETURN VALUE
         Upon successful completion, the function getrlimit returns a value of
         0; otherwise, it returns a value of -1 and sets errno to indicate an
         error.

   ERRORS
         Under the following conditions, the functions getrlimit and setrlimit
         fail and set errno to:



   7/91                                                                 Page 3









   getrlimit(2)                                                   getrlimit(2)


        EINVAL if an invalid resource was specified; or in a setrlimit call,
                the new rlimcur exceeds the new rlimmax.

        EPERM  if the limit specified to setrlimit would have raised the
                maximum limit value, and the caller is the superuser

   SEE ALSO
         open(2), sigaltstack(2), malloc(3C), signal(5).













































   Page 4                                                                 7/91





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