1 /* Include the C files directly. */
2 #include <ccan/failtest/failtest.c>
5 #include <ccan/tap/tap.h>
12 if (getrlimit(RLIMIT_NOFILE, &lim) != 0)
13 err(1, "getrlimit RLIMIT_NOFILE fail?");
15 printf("rlimit = %lu/%lu (inf=%lu)\n",
16 (long)lim.rlim_cur, (long)lim.rlim_max,
20 errx(1, "getrlimit limit %li too low", (long)lim.rlim_cur);
21 if (setrlimit(RLIMIT_NOFILE, &lim) != 0)
22 err(1, "setrlimit RLIMIT_NOFILE (%li/%li)",
23 (long)lim.rlim_cur, (long)lim.rlim_max);
26 failtest_init(0, NULL);
31 fd = failtest_open("run-with-fdlimit-scratch", "run-with_fdlimit.c", 1,
32 O_RDWR|O_CREAT, 0600);
34 /* We are the child: write error code for parent to check. */
36 if (write(pfd[1], &ecode, sizeof(ecode)) != sizeof(ecode))
41 /* Check child got correct errno. */
42 ok1(read(pfd[0], &ecode, sizeof(ecode)) == sizeof(ecode));
46 failtest_close(fd, "run-open.c", 1);