Home :: International :: Manuals :: Howto :: FAQ :: Man Pages :: Email Login

 
 

 

GETRLIMIT

Section: Linux Programmer's Manual (2)
Updated: 4 May 2001
Index Return to Main Contents
 

̾Á°

getrlimit, getrusage, setrlimit - »ñ¸»¤Î¸Â³¦¤ä»ÈÍÑÎ̤ò¼èÆÀ/ÀßÄꤹ¤ë  

½ñ¼°

#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>

int getrlimit (int resource, struct rlimit *rlim);
int getrusage (int who, struct rusage *usage);
int setrlimit (int resource, const struct rlimit *rlim);  

ÀâÌÀ

getrlimit ¤È setrlimit ¤Ï¤½¤ì¤¾¤ì»ñ¸» (resource) ¤Î¸Â³¦ (limit) ¤ÎÀßÄê¤È¼èÆÀ¤ò¹Ô¤Ê¤¦¡£ resource ¤Ï°Ê²¼¤Î¤É¤ì¤«¤Ç¤¢¤ë:

RLIMIT_CPU     /* CPU time in seconds */

RLIMIT_FSIZE   /* Maximum filesize */

RLIMIT_DATA    /* max data size */

RLIMIT_STACK   /* max stack size */

RLIMIT_CORE    /* max core file size */

RLIMIT_RSS     /* max resident set size */

RLIMIT_NPROC   /* max number of processes */

RLIMIT_NOFILE  /* max number of open files */

RLIMIT_MEMLOCK /* max locked-in-memory address space*/

RLIMIT_AS              /* address space (virtual memory) limit */

¸Â³¦¤ò RLIM_INFINITY ¤ËÀßÄꤷ¤¿¾ì¹ç¡¢»ñ¸»¤ò¸Â³¦Ìµ¤· (unlimited) ¤Ë¤Ç¤­¤ë¡£ RLIMIT_OFILE ¤Ï RLIMIT_NOFILE ¤Î BSD ¤Ë¤ª¤±¤ë̾Á°¤Ç¤¢¤ë¡£

rlimit ¤Ï°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤ë¹½Â¤ÂΤǤ¢¤ë:

struct rlimit {
        rlim_t  rlim_cur;
        rlim_t  rlim_max;
};

getrusage ¤Ï¸½ºß¤Î»ñ¸»¤Î»ÈÍÑÎÌ (usage) ¤òÊÖ¤¹¡£ who ¤Ë¤Ï RUSAGE_SELF ¤« RUSAGE_CHILDREN ¤Î¤É¤Á¤é¤«¤ò»ØÄꤹ¤ë¡£

struct rusage {
        struct timeval ru_utime;        /* user time used */
        struct timeval ru_stime;        /* system time used */
        long    ru_maxrss;              /* maximum resident set size */
        long    ru_ixrss;               /* integral shared memory size */
        long    ru_idrss;               /* integral unshared data size */
        long    ru_isrss;               /* integral unshared stack size */
        long    ru_minflt;              /* page reclaims */
        long    ru_majflt;              /* page faults */
        long    ru_nswap;               /* swaps */
        long    ru_inblock;             /* block input operations */
        long    ru_oublock;             /* block output operations */
        long    ru_msgsnd;              /* messages sent */
        long    ru_msgrcv;              /* messages received */
        long    ru_nsignals;            /* signals received */
        long    ru_nvcsw;               /* voluntary context switches */
        long    ru_nivcsw;              /* involuntary context switches */
};
 

ÊÖ¤êÃÍ

À®¸ù¤·¤¿¾ì¹ç¤Ï¥¼¥í¤¬ÊÖ¤µ¤ì¤ë¡£¥¨¥é¡¼¤Î¾ì¹ç¤Ï -1 ¤¬ÊÖ¤µ¤ì¡¢ errno ¤ËŬÀÚ¤ÊÃͤ¬ÀßÄꤵ¤ì¤ë¡£  

¥¨¥é¡¼

EFAULT
rlim ¤Þ¤¿¤Ï usage ¤¬¥¢¥¯¥»¥¹²Äǽ¤Ê¥¢¥É¥ì¥¹¶õ´Ö¤Î³°¤ò»Ø¤·¤Æ¤¤¤ë¡£
EINVAL
getrlimit ¤Þ¤¿¤Ï setrlimit ¤¬ÉÔÀµ¤Ê resource ¤Ç¸Æ¤Ó½Ð¤µ¤ì¤¿¤«¡¢getrusage ¤¬ÉÔÀµ¤Ê who ¤Ç¸Æ¤Ó½Ð¤µ¤ì¤¿¡£
EPERM
¥¹¡¼¥Ñ¡¼¡¦¥æ¡¼¥¶¡¼°Ê³°¤¬ setrlimit() ¤ò»ÈÍѤ·¤Æ ¥½¥Õ¥È¤Þ¤¿¤Ï¥Ï¡¼¥É¤Î¸Â³¦¤ò¸½ºß¤Î¥Ï¡¼¥É¤Î¸Â³¦°Ê¾å¤Ë¤·¤è¤¦¤È»î¤ß¤¿¡£ ¤Þ¤¿¤Ï¥¹¡¼¥Ñ¡¼¡¦¥æ¡¼¥¶¡¼¤¬ RLIMIT_NOFILE ¤ò ¸½ºß¤Î¥«¡¼¥Í¥ë¤ÎºÇÂçÃͰʾå¤ËÁý²Ã¤µ¤»¤è¤¦¤È¤·¤¿¡£
 

½àµò

SVr4, BSD 4.3  

Ãí°Õ

¾åµ­¤Î¹½Â¤ÂÎ¤Ï BSD 4.3 Reno ¤Î¤â¤Î¤òºÎÍѤ·¤¿¡£ Linux ¤Ç¤ÏÁ´¤Æ¤Î¥Õ¥£¡¼¥ë¥É¤¬°ÕÌ£¤ò»ý¤Ä¤È¤¤¤¦¤ï¤±¤Ç¤Ï¤Ê¤¤¡£ ¸½ºß¤Î¤È¤³¤í (Linux 2.4 ¤Ç¤Ï)¡¢¥Õ¥£¡¼¥ë¥É ru_utime, ru_stime, ru_minflt, ru_majflt, ru_nswap ¤Î¤ß¤¬´ÉÍý¤µ¤ì¤Æ¤¤¤ë¡£  

´ØÏ¢¹àÌÜ

quotactl(2), ulimit(3)


 

Index

̾Á°
½ñ¼°
ÀâÌÀ
ÊÖ¤êÃÍ
¥¨¥é¡¼
½àµò
Ãí°Õ
´ØÏ¢¹àÌÜ

 
 
 
 
Google
  Web Linuxinfor   
 

Home :: Copyright :: Privacy :: Credits :: Get a free Linuxinfor Email Account

Document on this page is part of "Linuxinfor Man Pages in HTML Format: man2". See Index Page for more info about Authorship and Copyright.

1999-2008 Linuxinfor.com. No rights reserved.