12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #include <_lfs_64.h>
- #include <bits/wordsize.h>
- #include <sys/resource.h>
- #include <sys/syscall.h>
- #include <stddef.h> // needed for NULL to be defined
- #if defined(__NR_prlimit64)
- int getrlimit64 (__rlimit_resource_t resource, struct rlimit64 *rlimits)
- {
- return INLINE_SYSCALL (prlimit64, 4, 0, resource, NULL, rlimits);
- }
- # if !defined(__NR_ugetrlimit) && (__WORDSIZE == 64 || defined (__USE_FILE_OFFSET64))
- strong_alias_untyped(getrlimit64, getrlimit)
- libc_hidden_def(getrlimit)
- # endif
- #else
- int getrlimit64 (__rlimit_resource_t resource, struct rlimit64 *rlimits)
- {
- struct rlimit rlimits32;
- if (getrlimit (resource, &rlimits32) < 0)
- return -1;
- if (rlimits32.rlim_cur == RLIM_INFINITY)
- rlimits->rlim_cur = RLIM64_INFINITY;
- else
- rlimits->rlim_cur = rlimits32.rlim_cur;
- if (rlimits32.rlim_max == RLIM_INFINITY)
- rlimits->rlim_max = RLIM64_INFINITY;
- else
- rlimits->rlim_max = rlimits32.rlim_max;
- return 0;
- }
- #endif
|