Back to index

glibc  2.9
setrlimit.c File Reference
#include <errno.h>
#include <hurd.h>
#include <hurd/fd.h>
#include <hurd/resource.h>

Go to the source code of this file.


int __setrlimit (enum __rlimit_resource resource, const struct rlimit *rlimits)

Function Documentation

int __setrlimit ( enum __rlimit_resource  resource,
const struct rlimit rlimits 

Definition at line 29 of file setrlimit.c.

  struct rlimit lim;

  if (rlimits == NULL || (unsigned int) resource >= RLIMIT_NLIMITS)
      errno = EINVAL;
      return -1;

  lim = *rlimits;

  /* Even though most limits do nothing, there is no inheritance, and hard
     limits are not really hard, we just let any old call succeed to make
     life easier for programs that expect normal behavior.  */

  if (lim.rlim_cur > lim.rlim_max)
    lim.rlim_cur = lim.rlim_max;

  __mutex_lock (&_hurd_rlimit_lock);
  _hurd_rlimits[resource] = lim;
  __mutex_unlock (&_hurd_rlimit_lock);

  return 0;

Here is the call graph for this function:

Here is the caller graph for this function: