1.\" Copyright (c) 1983, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)readlink.2 8.1 (Berkeley) 06/04/93 7.\" 8.Dd 9.Dt READLINK 2 10.Os BSD 4.2 11.Sh NAME 12.Nm readlink 13.Nd read value of a symbolic link 14.Sh SYNOPSIS 15.Fd #include <unistd.h> 16.Ft int 17.Fn readlink "const char *path" "char *buf" "int bufsiz" 18.Sh DESCRIPTION 19.Fn Readlink 20places the contents of the symbolic link 21.Fa path 22in the buffer 23.Fa buf , 24which has size 25.Fa bufsiz . 26.Nm Readlink 27does not append a 28.Dv NUL 29character to 30.Fa buf . 31.Sh RETURN VALUES 32The call returns the count of characters placed in the buffer 33if it succeeds, or a -1 if an error occurs, placing the error 34code in the global variable 35.Va errno . 36.Sh ERRORS 37.Fn Readlink 38will fail if: 39.Bl -tag -width ENAMETOOLONG 40.It Bq Er ENOTDIR 41A component of the path prefix is not a directory. 42.It Bq Er EINVAL 43The pathname contains a character with the high-order bit set. 44.It Bq Er ENAMETOOLONG 45A component of a pathname exceeded 255 characters, 46or an entire path name exceeded 1023 characters. 47.It Bq Er ENOENT 48The named file does not exist. 49.It Bq Er EACCES 50Search permission is denied for a component of the path prefix. 51.It Bq Er ELOOP 52Too many symbolic links were encountered in translating the pathname. 53.It Bq Er EINVAL 54The named file is not a symbolic link. 55.It Bq Er EIO 56An I/O error occurred while reading from the file system. 57.It Bq Er EFAULT 58.Fa Buf 59extends outside the process's allocated address space. 60.El 61.Sh SEE ALSO 62.Xr stat 2 , 63.Xr lstat 2 , 64.Xr symlink 2 65.Xr symlink 7 , 66.Sh HISTORY 67The 68.Nm 69function call appeared in 70.Bx 4.2 . 71