1*61183Sbostic.\" Copyright (c) 1983, 1991, 1993 2*61183Sbostic.\" The Regents of the University of California. All rights reserved. 320247Smckusick.\" 443568Strent.\" %sccs.include.redist.man% 520247Smckusick.\" 6*61183Sbostic.\" @(#)readlink.2 8.1 (Berkeley) 06/04/93 738053Sbostic.\" 847208Scael.Dd 947208Scael.Dt READLINK 2 1047208Scael.Os BSD 4.2 1147208Scael.Sh NAME 1247208Scael.Nm readlink 1347208Scael.Nd read value of a symbolic link 1447208Scael.Sh SYNOPSIS 1547208Scael.Fd #include <unistd.h> 1647208Scael.Ft int 1747208Scael.Fn readlink "const char *path" "char *buf" "int bufsiz" 1847208Scael.Sh DESCRIPTION 1947208Scael.Fn Readlink 2020247Smckusickplaces the contents of the symbolic link 2147208Scael.Fa path 2220247Smckusickin the buffer 2347208Scael.Fa buf , 2420247Smckusickwhich has size 2547208Scael.Fa bufsiz . 2647208Scael.Nm Readlink 2747208Scaeldoes not append a 2847208Scael.Dv NUL 2947208Scaelcharacter to 3047208Scael.Fa buf . 3147208Scael.Sh RETURN VALUES 3220247SmckusickThe call returns the count of characters placed in the buffer 3347208Scaelif it succeeds, or a -1 if an error occurs, placing the error 3447208Scaelcode in the global variable 3547208Scael.Va errno . 3647208Scael.Sh ERRORS 3747208Scael.Fn Readlink 3838764Sbosticwill fail if: 3947208Scael.Bl -tag -width ENAMETOOLONG 4047208Scael.It Bq Er ENOTDIR 4120247SmckusickA component of the path prefix is not a directory. 4247208Scael.It Bq Er EINVAL 4321004SmckusickThe pathname contains a character with the high-order bit set. 4447208Scael.It Bq Er ENAMETOOLONG 4521004SmckusickA component of a pathname exceeded 255 characters, 4621004Smckusickor an entire path name exceeded 1023 characters. 4747208Scael.It Bq Er ENOENT 4820247SmckusickThe named file does not exist. 4947208Scael.It Bq Er EACCES 5021004SmckusickSearch permission is denied for a component of the path prefix. 5147208Scael.It Bq Er ELOOP 5221004SmckusickToo many symbolic links were encountered in translating the pathname. 5347208Scael.It Bq Er EINVAL 5420247SmckusickThe named file is not a symbolic link. 5547208Scael.It Bq Er EIO 5624440SmckusickAn I/O error occurred while reading from the file system. 5747208Scael.It Bq Er EFAULT 5847208Scael.Fa Buf 5920247Smckusickextends outside the process's allocated address space. 6047208Scael.El 6147208Scael.Sh SEE ALSO 6247208Scael.Xr stat 2 , 6347208Scael.Xr lstat 2 , 6447208Scael.Xr symlink 2 6555727Sbostic.Xr symlink 7 , 6647208Scael.Sh HISTORY 6747208ScaelThe 6847208Scael.Nm 6947208Scaelfunction call appeared in 7047208Scael.Bx 4.2 . 71