4 #include <sys/resource.h>
14 /* The following 7 limits are part of POSIX and must exist. */
15 { "RLIMIT_CORE", RLIMIT_CORE, true },
16 { "RLIMIT_CPU", RLIMIT_CPU, true },
17 { "RLIMIT_DATA", RLIMIT_DATA, true },
18 { "RLIMIT_FSIZE", RLIMIT_FSIZE, true },
19 { "RLIMIT_NOFILE", RLIMIT_NOFILE, true },
20 { "RLIMIT_STACK", RLIMIT_STACK, true },
21 { "RLIMIT_AS", RLIMIT_AS, true },
22 /* The following are traditional Unix limits which are also
24 { "RLIMIT_RSS", RLIMIT_RSS, true },
25 { "RLIMIT_NPROC", RLIMIT_NPROC, true },
26 /* The following are extensions. */
28 { "RLIMIT_MEMLOCK", RLIMIT_MEMLOCK, false },
31 { "RLIMIT_LOCKS", RLIMIT_LOCKS, false },
33 #ifdef RLIMIT_SIGPENDING
34 { "RLIMIT_SIGPENDING", RLIMIT_SIGPENDING, false },
36 #ifdef RLIMIT_MSGQUEUE
37 { "RLIMIT_MSGQUEUE", RLIMIT_MSGQUEUE, false },
40 { "RLIMIT_NICE", RLIMIT_NICE, false },
43 { "RLIMIT_RTPRIO", RLIMIT_RTPRIO, false },
46 #define ntests (sizeof (tests) / sizeof (tests[0]))
54 for (int i = 0; i < ntests; ++i)
59 int res = getrlimit (tests[i].resource, &r);
64 if (tests[i].required)
66 printf ("limit %s expectedly not available for getrlimit\n",
74 printf ("getrlimit for %s returned unexpected error: %m\n",
82 res = getrlimit64 (tests[i].resource, &r64);
87 if (tests[i].required)
89 printf ("limit %s expectedly not available for getrlimit64"
97 printf ("getrlimit64 for %s returned unexpected error: %m\n",
105 printf ("limit %s OK\n", tests[i].name);
111 #define TEST_FUNCTION do_test ()
112 #include "../test-skeleton.c"