VN_FULLPATH(9)

NAME
vn_fullpath - construct a pathname by inspecting a vnode's namecache topology

SYNOPSIS
#include <sys/param.h>
#include <sys/vnode.h>
int
vn_fullpath(struct proc *p, struct vnode *vp, char **retbuf, char **freebuf, int guess);

DESCRIPTION
The vn_fullpath function makes an attempt to generate a string pathname with the passed-in vnode, vp. The returned path in retbuf will be relative to the root directory of the process associated with the p argument.

Its arguments are:

p   The process performing the call; this pointer will be dereferenced to find the process and its file descriptor structure, in order to identify the root vnode to use.

vp  The vnode for constructing the pathname; the vnode is used for enumerating its namecache topology. If NULL is supplied, then it is assumed that the client wants to use the vnode of the process image, i.e., ( p->p_textvp).

retbuf [out]
    Pointer address to a char * which vn_fullpath uses for storing the address to a newly allocated buffer, containing the constructed pathname.

freebuf
    Auxiliary buffer that is used to by vn_fullpath for temporary purposes.

guess
    If guess is not 0, the mountpoint will be guessed if it can't be determined when traversing the namecache entries upwards.

Typical consumers will declare two character pointers: fullpath and freepath; they will set freepath to NULL, and fullpath to a name to use in the event that the call to vn_fullpath fails. After done with the value of fullpath, the caller will check if freepath is non-NULL, and if so, invoke kfree(9) with a malloc type of M_TEMP.

RETURN VALUES
If the vnode can be successfully used to construct a pathname, ‘0’ is returned, otherwise an errno value is returned.

CODE REFERENCES
All file references in this section are relative to the DragonFly base source directory.

The ‘Resident Executables’ code utilizes the vn_fullpath function; sys/kern/imgact_resident.c.

SEE ALSO
kfree(9), vnode(9)

AUTHORS
-nosplit This manual page was written by Robert Watson <rwatson@FreeBSD.org> and adapted for DragonFly by Hiten Pandya <hmp@backplane.com>.