1/*
2** Copyright 2004, Axel D��rfler, axeld@pinc-software.de. All rights reserved.
3** Distributed under the terms of the Haiku License.
4*/
5
6
7#include <sys/resource.h>
8#include <syscalls.h>
9#include <errno.h>
10
11#include <errno_private.h>
12
13
14#define RETURN_AND_SET_ERRNO(err) \
15	if (err < 0) { \
16		__set_errno(err); \
17		return -1; \
18	} \
19	return err;
20
21
22int
23getrlimit(int resource, struct rlimit *rlimit)
24{
25	int status = _kern_getrlimit(resource, rlimit);
26
27	RETURN_AND_SET_ERRNO(status);
28}
29
30
31int
32setrlimit(int resource, const struct rlimit *rlimit)
33{
34	int status = _kern_setrlimit(resource, rlimit);
35
36	RETURN_AND_SET_ERRNO(status);
37}
38
39