1: /*
   2:  * Copyright (c) 1980 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #if defined(LIBC_SCCS) && !defined(lint)
   8: static char sccsid[] = "@(#)vlimit.c	5.2 (Berkeley) 3/9/86";
   9: #endif LIBC_SCCS and not lint
  10: 
  11: /*
  12:  * (Almost) backwards compatible vlimit.
  13:  */
  14: #include <sys/time.h>
  15: #include <sys/resource.h>
  16: #include <errno.h>
  17: 
  18: /* LIM_NORAISE is not emulated */
  19: #define LIM_NORAISE 0   /* if <> 0, can't raise limits */
  20: #define LIM_CPU     1   /* max secs cpu time */
  21: #define LIM_FSIZE   2   /* max size of file created */
  22: #define LIM_DATA    3   /* max growth of data space */
  23: #define LIM_STACK   4   /* max growth of stack */
  24: #define LIM_CORE    5   /* max size of ``core'' file */
  25: #define LIM_MAXRSS  6   /* max desired data+stack core usage */
  26: 
  27: #define NLIMITS     6
  28: 
  29: vlimit(limit, value)
  30:     int limit, value;
  31: {
  32:     struct rlimit rlim;
  33: 
  34:     if (limit <= 0 || limit > NLIMITS)
  35:         return (EINVAL);
  36:     if (value == -1) {
  37:         if (getrlimit(limit - 1, &rlim) < 0)
  38:             return (-1);
  39:         return (rlim.rlim_cur);
  40:     }
  41:     rlim.rlim_cur = value;
  42:     rlim.rlim_max = RLIM_INFINITY;
  43:     return (setrlimit(limit - 1, &rlim));
  44: }

Defined functions

vlimit defined in line 29; used 1 times

Defined variables

sccsid defined in line 8; never used

Defined macros

LIM_CORE defined in line 24; never used
LIM_CPU defined in line 20; never used
LIM_DATA defined in line 22; never used
LIM_FSIZE defined in line 21; never used
LIM_MAXRSS defined in line 25; never used
LIM_NORAISE defined in line 19; never used
LIM_STACK defined in line 23; never used
NLIMITS defined in line 27; used 1 times
  • in line 34
Last modified: 1986-03-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: ?E00
Valid CSS Valid XHTML 1.0 Strict