drd/tests/swapcontext: Improve the portability of this test further
[valgrind.git] / none / tests / fdleak.h
blob66fd84e96f7539ecafae3e7c84addd77efe313b6
1 #ifndef _FDLEAK_H_
2 #define _FDLEAK_H_
4 #include <stdlib.h>
5 #include <stdio.h>
7 #define DO(op) \
8 ({ \
9 long res = op; \
10 if (res < 0) { \
11 perror(#op); \
12 exit(1); \
13 }; \
14 res; \
18 * The macro below closes file descriptors inherited from the process
19 * that forked the current process. Close these file descriptors right
20 * after the start of main() in order to get consistent results across
21 * different releases. Known behavior:
22 * - Fedora Core 1's Perl opens /dev/pts/2 as fd 10.
23 * - For Ubuntu 8.04, see also
24 * https://bugs.launchpad.net/ubuntu/+source/seahorse/+bug/235184
26 #define CLOSE_INHERITED_FDS { int i; for (i = 3; i < 64; i++) close(i); }
28 #endif /* _FDLEAK_H_ */