Back to index

glibc  2.9
Functions
getrlimit.c File Reference
#include <errno.h>
#include <sys/resource.h>
#include <sysdep.h>
#include <sys/syscall.h>
#include <shlib-compat.h>
#include <bp-checks.h>
#include <kernel-features.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int __new_getrlimit (enum __rlimit_resource resource, struct rlimit *__unbounded rlimits)
int __new_getrlimit (enum __rlimit_resource resource, struct rlimit *rlimits)
 weak_alias (__new_getrlimit, __getrlimit)
 versioned_symbol (libc, __new_getrlimit, getrlimit, GLIBC_2_2)

Function Documentation

int __new_getrlimit ( enum __rlimit_resource  resource,
struct rlimit *__unbounded  rlimits 
)
int __new_getrlimit ( enum __rlimit_resource  resource,
struct rlimit rlimits 
)

Definition at line 40 of file getrlimit.c.

{
#ifdef __ASSUME_NEW_GETRLIMIT_SYSCALL
  return INLINE_SYSCALL (ugetrlimit, 2, resource, CHECK_1 (rlimits));
#else
  int result;

# ifdef __NR_ugetrlimit
  if (__have_no_new_getrlimit <= 0)
    {
      result = INLINE_SYSCALL (ugetrlimit, 2, resource, CHECK_1 (rlimits));

      /* If the system call is available remember this fact and return.  */
      if (result != -1 || errno != ENOSYS)
       {
         __have_no_new_getrlimit = -1;
         return result;
       }

      /* Remember that the system call is not available.  */
      __have_no_new_getrlimit = 1;
    }
# endif

  /* Fall back to the old system call.  */
  result = INLINE_SYSCALL (getrlimit, 2, resource, CHECK_1 (rlimits));

  if (result == -1)
    return result;

  /* We might have to correct the limits values.  Since the old values
     were signed the infinity value is too small.  */
  if (rlimits->rlim_cur == RLIM_INFINITY >> 1)
    rlimits->rlim_cur = RLIM_INFINITY;
  if (rlimits->rlim_max == RLIM_INFINITY >> 1)
    rlimits->rlim_max = RLIM_INFINITY;

  return result;
#endif
}

Here is the call graph for this function:

versioned_symbol ( libc  ,
__new_getrlimit  ,
getrlimit  ,
GLIBC_2_2   
)