7 #include <linux/close_range.h>
12 // Create a new file descriptor that we immediately close.
13 // This is of course fine.
16 fprintf(stderr
, "close fd %d\n", fd
);
20 // Shouldn't warn, we are closing everything
21 // This is a special case for close_range if the last
22 // argument is ~0U (infinity).
23 fprintf(stderr
, "Closing range (%d, %d).\n", fd
, ~0U);
24 close_range(fd
, ~0U, 0);
28 fprintf(stderr
, "Closing range (%d, %d).\n", fd5
, fd7
);
31 // Should warn, we close a small range
32 fprintf(stderr
, "Double closing range (%d, %d).\n", fd5
, fd7
);