Last change
on this file since 413 was 398, checked in by coas-nagasima, 5 years ago |
mbedTLS版Azure IoT Hub接続サンプルのソースコードを追加
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
676 bytes
|
Rev | Line | |
---|
[398] | 1 | #include <sys/resource.h>
|
---|
| 2 | #include <errno.h>
|
---|
| 3 | #include "syscall.h"
|
---|
| 4 | #include "libc.h"
|
---|
| 5 |
|
---|
| 6 | #define FIX(x) do{ if ((x)>=SYSCALL_RLIM_INFINITY) (x)=RLIM_INFINITY; }while(0)
|
---|
| 7 |
|
---|
| 8 | int getrlimit(int resource, struct rlimit *rlim)
|
---|
| 9 | {
|
---|
| 10 | unsigned long k_rlim[2];
|
---|
| 11 | int ret = syscall(SYS_prlimit64, 0, resource, 0, rlim);
|
---|
| 12 | if (!ret) {
|
---|
| 13 | FIX(rlim->rlim_cur);
|
---|
| 14 | FIX(rlim->rlim_max);
|
---|
| 15 | }
|
---|
| 16 | if (!ret || errno != ENOSYS)
|
---|
| 17 | return ret;
|
---|
| 18 | if (syscall(SYS_getrlimit, resource, k_rlim) < 0)
|
---|
| 19 | return -1;
|
---|
| 20 | rlim->rlim_cur = k_rlim[0] == -1UL ? RLIM_INFINITY : k_rlim[0];
|
---|
| 21 | rlim->rlim_max = k_rlim[1] == -1UL ? RLIM_INFINITY : k_rlim[1];
|
---|
| 22 | FIX(rlim->rlim_cur);
|
---|
| 23 | FIX(rlim->rlim_max);
|
---|
| 24 | return 0;
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | LFS64(getrlimit);
|
---|
Note:
See
TracBrowser
for help on using the repository browser.