source: azure_iot_hub/trunk/musl-1.1.18/src/linux/prlimit.c@ 388

Last change on this file since 388 was 388, checked in by coas-nagasima, 5 years ago

Azure IoT Hub Device C SDK を使ったサンプルの追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-csrc
File size: 675 bytes
RevLine 
[388]1#define _GNU_SOURCE
2#include <sys/resource.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
8int prlimit(pid_t pid, int resource, const struct rlimit *new_limit, struct rlimit *old_limit)
9{
10 struct rlimit tmp;
11 int r;
12 if (new_limit && SYSCALL_RLIM_INFINITY != RLIM_INFINITY) {
13 tmp = *new_limit;
14 FIX(tmp.rlim_cur);
15 FIX(tmp.rlim_max);
16 new_limit = &tmp;
17 }
18 r = syscall(SYS_prlimit64, pid, resource, new_limit, old_limit);
19 if (!r && old_limit && SYSCALL_RLIM_INFINITY != RLIM_INFINITY) {
20 FIX(old_limit->rlim_cur);
21 FIX(old_limit->rlim_max);
22 }
23 return r;
24}
25
26#undef prlimit64
27LFS64(prlimit);
Note: See TracBrowser for help on using the repository browser.