Example #1
0
 def rlimit(self, resource, limits=None):
     # if pid is 0 prlimit() applies to the calling process and
     # we don't want that
     if self.pid == 0:
         raise ValueError("can't use prlimit() against PID 0 process")
     if limits is None:
         # get
         return cext.linux_prlimit(self.pid, resource)
     else:
         # set
         if len(limits) != 2:
             raise ValueError(
                 "second argument must be a (soft, hard) tuple")
         soft, hard = limits
         cext.linux_prlimit(self.pid, resource, soft, hard)
Example #2
0
 def rlimit(self, resource, limits=None):
     # if pid is 0 prlimit() applies to the calling process and
     # we don't want that
     if self.pid == 0:
         raise ValueError("can't use prlimit() against PID 0 process")
     if limits is None:
         # get
         return cext.linux_prlimit(self.pid, resource)
     else:
         # set
         if len(limits) != 2:
             raise ValueError(
                 "second argument must be a (soft, hard) tuple")
         soft, hard = limits
         cext.linux_prlimit(self.pid, resource, soft, hard)