[TUHS] Also, relative to absolute pathnames?

Warner Losh via TUHS tuhs at tuhs.org
Sat Jun 27 01:46:49 AEST 2026


On Fri, Jun 26, 2026 at 9:37 AM Clem Cole via TUHS <tuhs at tuhs.org> wrote:

> The POSIX-defined function
>
> char *realpath(const char *restrict *file_name*,
>        char *restrict *resolved_name*);
>
>
> See:
> https://pubs.opengroup.org/onlinepubs/009696799/functions/realpath.html
>
> The sources and man page for the BSD implementation can be found in Disk3
> of Kirk's CD in the 4.4BSD-Lite1/usr/src/lib/libc/stdlib/ and on Disk4
> in lib/libc/gen/
> which also includes the SCCS file
>

One problem with realpath is that it's not possible to implement in
userspace
in POSIX. You can come close for most cases, but there's a number of edge
cases that require kernel assist. FreeBSD has an undocumented system call
to do this, for example. But Warren's remote filesystem thing likely can use
the good enough from userland stuff.


> Although grep(1) reports that only its man page was included in
> 4.4BSD-Lite2
>
> I will note that on a POSIX-conforming system, it must be included and
> defined in the stdlib.h
> But it should also be remembered that none of the C standards, including
> the current C23 standard, require it.
>

Most systems today have this.


> I believe gcc includes a version in its runtime library, but I'm not sure
> about LLVM's clang, although I would be mildly surprised if it wasn't.
>

gcc does not include this in their runtime library, nor does clang. This
isnt' a runtime library thing, it's a libc thing. glibc has an
implementation.
I know this is a pedantic point, but the detail helps you know where to
look.

Warner


More information about the TUHS mailing list