Fork me on GitHub

root/include/fiwix/resource.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * fiwix/include/fiwix/resource.h
   3  *
   4  * Copyright 2018, Jordi Sanfeliu. All rights reserved.
   5  * Distributed under the terms of the Fiwix License.
   6  */
   7 
   8 #ifndef _FIWIX_RESOURCE_H
   9 #define _FIWIX_RESOURCE_H
  10 
  11 #include <fiwix/time.h>
  12 
  13 #define RLIMIT_INFINITY 0x7FFFFFFF      /* value to indicate "no limit" */
  14 #define RLIM_INFINITY   RLIMIT_INFINITY /* traditional name */
  15 
  16 #define RUSAGE_SELF     0               /* the calling process */
  17 #define RUSAGE_CHILDREN (-1)            /* all of its termin. child processes */
  18 
  19 #define RLIMIT_CPU      0               /* per-process CPU limit (secs) */
  20 #define RLIMIT_FSIZE    1               /* largest file that can be created
  21                                            (bytes */
  22 #define RLIMIT_DATA     2               /* maximum size of data segment
  23                                            (bytes) */
  24 #define RLIMIT_STACK    3               /* maximum size of stack segment
  25                                            (bytes) */
  26 #define RLIMIT_CORE     4               /* largest core file that can be created
  27                                            (bytes) */
  28 #define RLIMIT_RSS      5               /* largest resident set size (bytes) */
  29 #define RLIMIT_NPROC    6               /* number of processes */
  30 #define RLIMIT_NOFILE   7               /* number of open files */
  31 #define RLIMIT_MEMLOCK  8               /* locked-in-memory address space */
  32 #define RLIMIT_AS       9               /* address space limit */
  33 
  34 #define RLIM_NLIMITS    10
  35 
  36 struct rusage {
  37         struct timeval ru_utime;        /* total amount of user time used */
  38         struct timeval ru_stime;        /* total amount of system time used */
  39         long ru_maxrss;                 /* maximum resident set size (KB) */
  40         long ru_ixrss;                  /* amount of sharing of text segment
  41                                            memory with other processes
  42                                            (KB-secs) */
  43         long ru_idrss;                  /* amount of data segment memory used
  44                                            (KB-secs) */
  45         long ru_isrss;                  /* amount of stack memory used
  46                                            (KB-secs) */
  47         long ru_minflt;                 /* number of soft page faults (i.e.
  48                                            those serviced by reclaiming a page
  49                                            from the list of pages awaiting
  50                                            rellocation) */
  51         long ru_majflt;                 /* number of hard page faults (i.e.
  52                                            those that required I/O) */
  53         long ru_nswap;                  /* number of times a process was swapped
  54                                            out of physical memory */
  55         long ru_inblock;                /* number of input operations via the
  56                                            file system. Note this and
  57                                            'ru_outblock' do not include
  58                                            operations with the cache */
  59         long ru_oublock;                /* number of output operations via the
  60                                            file system */
  61         long ru_msgsnd;                 /* number of IPC messages sent */
  62         long ru_msgrcv;                 /* number of IPC messages received */
  63         long ru_nsignals;               /* number of signals delivered */
  64         long ru_nvcsw;                  /* number of voluntary context switches,
  65                                            i.e. because the process gave up the
  66                                            process before it had to (usually to
  67                                            wait for some resouce to be
  68                                            availabe */
  69         long ru_nivcsw;                 /* number of involuntary context
  70                                            switches. i.e. a higher priority
  71                                            process became runnable or the
  72                                            current process used up its time
  73                                            slice */
  74 };
  75 
  76 struct rlimit {
  77         int rlim_cur;                   /* the current (soft) limit */
  78         int rlim_max;                   /* the maximum (hard) limit */
  79 };
  80 
  81 #endif /* _FIWIX_RESOURCE_H */

/* [previous][next][first][last][top][bottom][index][help] */