Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/guicho271828/cl-rlimit
Common lisp interface to unix rlimit -- ensure the performance of your program!
https://github.com/guicho271828/cl-rlimit
Last synced: 29 days ago
JSON representation
Common lisp interface to unix rlimit -- ensure the performance of your program!
- Host: GitHub
- URL: https://github.com/guicho271828/cl-rlimit
- Owner: guicho271828
- Created: 2014-07-13T11:54:49.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-05-27T04:11:21.000Z (over 9 years ago)
- Last Synced: 2024-10-15T14:11:01.091Z (3 months ago)
- Language: Common Lisp
- Size: 289 KB
- Stars: 4
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
Simple interface to Unix getrlimit and setrlimit.
For further reference see [[http://man7.org/linux/man-pages/man2/setrlimit.2.html][man getrlimit(2)]] and [[http://man7.org/linux/man-pages/man2/getrusage.2.html][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).#+BEGIN_SRC lisp
(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))
#+END_SRC* TODOs
+ DONE: further support for =struct rusage=
+ TODO: signal a lisp condition instread of error integers
+ TODO: integration to OSICAT-POSIXAuthor: Masataro Asai guicho2.71828-at-gmail-dot-com