poll tests: Avoid test failure on BSD and Solaris systems.
[gnulib.git] / doc / posix-functions / dup2.texi
blobd81def5cddb71fb08511dfc71071d1e4a399ff92
1 @node dup2
2 @section @code{dup2}
3 @findex dup2
5 POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html}
7 Gnulib module: dup2
9 Portability problems fixed by Gnulib:
10 @itemize
11 @item
12 This function is declared in a different header file (namely, @code{<io.h>})
13 on some platforms:
14 MSVC 14.
16 @item
17 This function always returns 0 for success on some platforms:
18 mingw, MSVC 14.
20 @item
21 This function can hang when duplicating an fd to itself on some platforms:
22 mingw, MSVC 14.
24 @item
25 This function crashes when invoked with invalid arguments on some platforms:
26 Cygwin 1.7.17, MSVC 14.
28 @item
29 This function crashes when invoked with valid arguments on some platforms:
30 Cygwin 1.7.25.
32 @item
33 This function fails with @code{EINVAL} when duplicating an fd to itself:
34 Android.
36 @item
37 This function resets the @code{FD_CLOEXEC} flag when duplicating an fd
38 to itself on some platforms:
39 Haiku.
41 @item
42 This function returns 0 for @code{dup2 (1, 1)} on some platforms:
43 Cygwin 1.5.x.
45 @item
46 This function may return @code{-EBADF} instead of @code{-1} on some platforms:
47 Linux releases between July 2008 and May 2009 (versions 2.6.27 to 2.6.29).
49 @item
50 This function returns @code{EMFILE} instead of @code{EBADF} for
51 large targets, which interferes with using
52 @code{dup2(fd,fd)==fd)} as the minimal @code{EBADF} filter:
53 AIX 7.1, FreeBSD 6.1, Cygwin 1.5.
54 @end itemize
56 Portability problems not fixed by Gnulib:
57 @itemize
58 @end itemize