Coder Social home page Coder Social logo

cl-rlimit's Introduction

Simple interface to Unix getrlimit and setrlimit. For further reference see man getrlimit(2) and man getrusage(2).

rlimit, (setf rlimit)

function rlimit resource -> current, max

function (setf rlimit) resource size -> size-or-error

size should be an integer. resource should be one of:

  • +RLIMIT-ADDRESS-SPACE+ or +RLIMIT-AS+
  • +RLIMIT-CORE+
  • +RLIMIT-CPU+ or +RLIMIT-CPU-TIME+
  • +RLIMIT-DATA+
  • +RLIMIT-FILE-SIZE+ or +RLIMIT-FSIZE+
  • +RLIMIT-MEMLOCK+
  • +RLIMIT-MSGQUEUE+
  • +RLIMIT-NICE+
  • +RLIMIT-NOFILE+ or + +RLIMIT-NUMBER-OF-FILES+
  • +RLIMIT-NPROC+ or +RLIMIT-NUMBER-OF-PROCESSES+
  • +RLIMIT-OFILE+
  • +RLIMIT-REAL-TIME-PRIORITY+
  • +RLIMIT-RSS+
  • +RLIMIT-RTPRIO+
  • +RLIMIT-SIGPENDING+
  • +RLIMIT-STACK+

some of these are synonyms. To set a limit as infinity, use

  • +RLIM-INFINITY+

If the values to be set are inappropriate (exceeds the current limit), it returns the appropriate errors like +EFAULT+,+EINVAL+,+EPERM+,+ESRCH+.

rusage

(rusage &optional (who +RUSAGE-SELF+))

This takes one of +RUSAGE-SELF+, +RUSAGE-CHILDREN+, +RUSAGE-THREAD and returns a lisp structure rusage. utime and stime is converted to a full microsecond (combining tv_sec and tv_usec).

(defstruct rusage
  (utime 0 :type integer)
  (stime 0 :type integer)
  (maxrss 0 :type integer)
  (ixrss 0 :type integer)    ;x on linux
  (idrss 0 :type integer)    ;x on linux
  (isrss 0 :type integer)    ;x on linux
  (minflt 0 :type integer)
  (majflt 0 :type integer)
  (nswap 0 :type integer)    ;x on linux
  (inblock 0 :type integer)
  (oublock 0 :type integer)
  (msgsnd 0 :type integer)   ;x on linux
  (msgrcv 0 :type integer)   ;x on linux
  (nsignals 0 :type integer) ;x on linux
  (nvcsw 0 :type integer)
  (nivcsw 0 :type integer))

TODOs

  • DONE: further support for struct rusage
  • TODO: signal a lisp condition instread of error integers
  • TODO: integration to OSICAT-POSIX

Author: Masataro Asai guicho2.71828-at-gmail-dot-com

cl-rlimit's People

Contributors

guicho271828 avatar

Stargazers

Akasha Peppermint avatar Jonathan McHugh avatar repository-tasks avatar  avatar

Watchers

Sergey Katrevich avatar  avatar James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.