poll tests: Avoid test failure on BSD and Solaris systems.
[gnulib.git] / doc / posix-functions / readlinkat.texi
blob2cd2e7be5bb20b93f7e970d4fb46b3d14397f010
1 @node readlinkat
2 @section @code{readlinkat}
3 @findex readlinkat
5 POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlinkat.html}
7 Gnulib module: readlinkat
9 Portability problems fixed by Gnulib:
10 @itemize
11 @item
12 This function is missing on some platforms:
13 glibc 2.3.6, Mac OS X 10.9, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 10, Cygwin 1.5.x, mingw, MSVC 14, Android 4.4.
14 But the replacement function is not safe to be used in libraries and is not multithread-safe.
15 @item
16 Some platforms mistakenly succeed on file names ending in @file{/}:
17 OS X 10.10.
18 @item
19 On some platforms, this function returns @code{int} instead of
20 @code{ssize_t}:
21 AIX 7.1.
22 @end itemize
24 Portability problems mostly fixed by Gnulib:
25 @itemize
26 @item
27 On some platforms, this function fails and sets @code{errno} to
28 @code{ERANGE} rather than returning truncated contents:
29 AIX 7.2.
30 The Gnulib replacement normally works as POSIX requires by returning
31 the truncated contents.  However, if the full link contents are
32 unreasonably large (more than 4000 bytes) the replacement clears the
33 entire buffer and returns the buffer size; although this is not a
34 complete fix, it suffices for typical callers, which ignore the buffer
35 contents anyway.
36 @end itemize
38 Portability problems not fixed by Gnulib:
39 @itemize
40 @item
41 This function always fails on platforms that don't support symlinks:
42 mingw, MSVC 14.
43 @item
44 When this function is called on a directory: In the case of NFS mounted
45 directories, Cygwin sets @code{errno} to @code{ENOENT} or @code{EIO} instead of
46 @code{EINVAL}.  To avoid this problem, check for a directory before calling
47 this function.
48 @item
49 When this function is called on a file that is not a symbolic link:
50 IRIX may set @code{errno} to @code{ENXIO} instead of @code{EINVAL}.  Cygwin
51 may set errno to @code{EACCES} instead of @code{EINVAL}.
52 @item
53 When this function fails because it is called on an existing
54 non-directory's name concatenated to @file{/},
55 it sets @code{errno} to @code{EINVAL}:
56 AIX 7.2.
57 @item
58 Symlink contents do not always have a trailing null byte, and there is
59 no indication if symlink contents were truncated if the return value
60 matches the length.  Furthermore,
61 Linux sets @code{errno} to @code{EINVAL} if the
62 requested length is zero.  Use the gnulib module @code{areadlink} for
63 improved ability to read symlink contents.
64 @end itemize