'\" te .\" Copyright (c) 1997, Sun Microsystems, Inc. All Rights Reserved .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .TH RESOLVEPATH 2 "May 12, 1997" .SH NAME resolvepath \- resolve all symbolic links of a path name .SH SYNOPSIS .LP .nf #include \fBint\fR \fBresolvepath\fR(\fBconst char *\fR\fIpath\fR, \fBchar *\fR\fIbuf\fR, \fBsize_t\fR \fIbufsiz\fR); .fi .SH DESCRIPTION .sp .LP The \fBresolvepath()\fR function fully resolves all symbolic links in the path name \fIpath\fR into a resulting path name free of symbolic links and places the resulting path name in the buffer \fIbuf\fR which has size \fIbufsiz\fR. The resulting path name names the same file or directory as the original path name. All ``\fB\&.\fR'' components are eliminated and every non-leading ``\fB\&..\fR'' component is eliminated together with its preceding directory component. If leading ``\fB\&..\fR'' components reach to the root directory, they are replaced by ``\fB/\fR''. If the number of bytes in the resulting path name is less than \fIbufsiz\fR, the contents of the remainder of \fIbuf\fR are unspecified. .SH RETURN VALUES .sp .LP Upon successful completion, \fBresolvepath()\fR returns the count of bytes placed in the buffer. Otherwise, it returns \fB\(mi1\fR, leaves the buffer unchanged, and sets \fBerrno\fR to indicate the error. .SH ERRORS .sp .LP The \fBresolvepath()\fR function will fail if: .sp .ne 2 .na \fB\fBEACCES\fR\fR .ad .RS 16n Search permission is denied for a component of the path prefix of \fIpath\fR or for a path prefix component resulting from the resolution of a symbolic link. .RE .sp .ne 2 .na \fB\fBEFAULT\fR\fR .ad .RS 16n The \fIpath\fR or \fIbuf\fR argument points to an illegal address. .RE .sp .ne 2 .na \fB\fBEIO\fR\fR .ad .RS 16n An I/O error occurred while reading from the file system. .RE .sp .ne 2 .na \fB\fBENOENT\fR\fR .ad .RS 16n The \fIpath\fR argument is an empty string or a component of \fIpath\fR or a path name component produced by resolving a symbolic link does not name an existing file. .RE .sp .ne 2 .na \fB\fBELOOP\fR\fR .ad .RS 16n Too many symbolic links were encountered in resolving \fIpath\fR. .RE .sp .ne 2 .na \fB\fBENAMETOOLONG\fR\fR .ad .RS 16n The length of \fIpath\fR exceeds \fIPATH_MAX\fR, or a path name component is longer than \fINAME_MAX\fR. Path name resolution of a symbolic link produced an intermediate result whose length exceeds \fIPATH_MAX\fR or a component whose length exceeds \fINAME_MAX\fR. .RE .sp .ne 2 .na \fB\fBENOTDIR\fR\fR .ad .RS 16n A component of the path prefix of \fIpath\fR or of a path prefix component resulting from the resolution of a symbolic link is not a directory. .RE .SH USAGE .sp .LP No more than \fIPATH_MAX\fR bytes will be placed in the buffer. Applications should not assume that the returned contents of the buffer are null-terminated. .SH SEE ALSO .sp .LP \fBreadlink\fR(2), \fBrealpath\fR(3C)