1 .\" Copyright (c) 2020 The DragonFly Project. All rights reserved.
3 .\" This code is derived from software contributed to The DragonFly Project
4 .\" by Matthew Dillon <dillon@backplane.com>
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in
14 .\" the documentation and/or other materials provided with the
16 .\" 3. Neither the name of The DragonFly Project nor the names of its
17 .\" contributors may be used to endorse or promote products derived
18 .\" from this software without specific, prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 .\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 .\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 .Nd resolves the canonicalized absolute pathname
42 .Fn __realpath "const char * restrict pathname" "char * restrict resolved_path" "size_t len"
46 system call is used to support the libc
49 It basically does the same thing but with a lower-level system-call
51 The system call differs from the libc function as follows:
52 It requires that the target buffer and the size of the target
53 buffer be supplied, it does not (obviously) allocate a target buffer if NULL
54 is supplied, and it returns the string length of the target buffer (not
55 including the terminator) or -1.
56 If a failure occurs, the target buffer will not be modified (whereas it is
57 in the libc function).
59 The system call will resolves all symbolic links, extra
61 characters and references to
67 and copies the resulting absolute pathname into
68 the memory pointed to by
74 point to a buffer capable of storing at least
76 characters, and may not be
81 function will resolve both absolute and relative paths
82 and return the absolute pathname corresponding to
88 is called, and all but the last component must name either directories or
89 symlinks pointing to the directories.
94 the string length of the path stored in the target buffer, not including
95 the terminator, or -1 on failure.
98 may fail and set the external variable
100 for any of the errors specified for the library function
107 function first appeared in
110 This is the system call version of the libc
112 function, but is not a replacement for the libc function due to
113 necessary API differences.