headers/bsd: Add sys/queue.h.
[haiku.git] / src / system / libroot / posix / sys / rlimit.c
bloba5a94dc05fa3417bed1d84aeb10f2bad8a9a1ecb
1 /*
2 ** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the Haiku License.
4 */
7 #include <sys/resource.h>
8 #include <syscalls.h>
9 #include <errno.h>
11 #include <errno_private.h>
14 #define RETURN_AND_SET_ERRNO(err) \
15 if (err < 0) { \
16 __set_errno(err); \
17 return -1; \
18 } \
19 return err;
22 int
23 getrlimit(int resource, struct rlimit *rlimit)
25 int status = _kern_getrlimit(resource, rlimit);
27 RETURN_AND_SET_ERRNO(status);
31 int
32 setrlimit(int resource, const struct rlimit *rlimit)
34 int status = _kern_setrlimit(resource, rlimit);
36 RETURN_AND_SET_ERRNO(status);