Advertisement
Tanmoy058

Untitled

Dec 11th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. /*
  2. * Test the stephen syscall (#329)
  3. */
  4.  
  5. #define _GNU_SOURCE
  6. #include <unistd.h>
  7. #include <sys/syscall.h>
  8. #include <stdio.h>
  9. #include <sys/resource.h>
  10.  
  11. /*
  12. * Put your syscall number here.
  13. */
  14.  
  15. #define SYS_setrlimit2 549
  16.  
  17.  
  18.  
  19. int main(int argc, char **argv)
  20. {
  21. struct rlimit test;
  22. struct rlimit rtest;
  23. test.rlim_cur = 50*1024*1024;
  24. test.rlim_max = 100*1024*1024;
  25. setrlimit(RLIMIT_AS,&test);
  26. int pid = fork();
  27. if(pid ==0)
  28. {
  29. getrlimit(RLIMIT_AS,&rtest);
  30. printf(" From Child: %d %d\n",rtest.rlim_cur,rtest.rlim_max);
  31. }
  32.  
  33. else if(pid > 0)
  34. {
  35. getrlimit(RLIMIT_AS,&rtest);
  36. printf("From Parent: %d %d\n",rtest.rlim_cur,rtest.rlim_max);
  37. }
  38.  
  39. //long res = syscall(SYS_setrlimit2,RLIMIT_AS,);
  40. //printf("System call returned %ld.\n", res);
  41. //return res;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement