summaryrefslogtreecommitdiff
path: root/src/misc/getrlimit.c
blob: 84a659d4cf9552a5d8f2a5b2717024f83f5fe937 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <sys/resource.h>
#include "syscall.h"
#include "libc.h"

int getrlimit(int resource, struct rlimit *rlim)
{
	long k_rlim[2];
	if (syscall2(__NR_getrlimit, resource, (long)k_rlim) < 0)
		return -1;
	rlim->rlim_cur = k_rlim[0] == -1 ? -1 : (unsigned long)k_rlim[0];
	rlim->rlim_max = k_rlim[1] == -1 ? -1 : (unsigned long)k_rlim[1];
	return 0;
}

LFS64(getrlimit);