Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Test the stephen syscall (#329)
- */
- #define _GNU_SOURCE
- #include <unistd.h>
- #include <sys/syscall.h>
- #include <stdio.h>
- #include <sys/resource.h>
- /*
- * Put your syscall number here.
- */
- #define SYS_setrlimit2 549
- int main(int argc, char **argv)
- {
- struct rlimit test;
- struct rlimit rtest;
- test.rlim_cur = 50*1024*1024;
- test.rlim_max = 100*1024*1024;
- setrlimit(RLIMIT_AS,&test);
- int pid = fork();
- if(pid ==0)
- {
- getrlimit(RLIMIT_AS,&rtest);
- printf(" From Child: %d %d\n",rtest.rlim_cur,rtest.rlim_max);
- }
- else if(pid > 0)
- {
- getrlimit(RLIMIT_AS,&rtest);
- printf("From Parent: %d %d\n",rtest.rlim_cur,rtest.rlim_max);
- }
- //long res = syscall(SYS_setrlimit2,RLIMIT_AS,);
- //printf("System call returned %ld.\n", res);
- //return res;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement