Home Man
Today's Posts

Linux & Unix Commands - Search Man Pages
Man Page or Keyword Search:
Select Section of Man Page:
Select Man Page Repository:

NetBSD 6.1.5 - man page for pathbuf (netbsd section 9)

PATHBUF(9)			  BSD Kernel Developer's Manual 		       PATHBUF(9)

     pathbuf, pathbuf_create, pathbuf_assimilate, pathbuf_copyin, pathbuf_destroy -- path buffer

     #include <sys/namei.h>

     struct pathbuf *
     pathbuf_create(const char *path);

     struct pathbuf *
     pathbuf_assimilate(char *pnbuf);

     pathbuf_copyin(const char *userpath, struct pathbuf **ret);

     pathbuf_destroy(struct pathbuf *path);

     The pathbuf interface is used to carry around pathnames.  This helps simplify the namei(9)
     interface.  A pathbuf should be thought of as a path name string combined with whatever
     flags and metadata are needed to interpret it correctly.  It is an abstract type; the inter-
     nals are hidden within the namei(9) implementation.

     The pathbuf_create() function allocates and initializes a new pathbuf containing a copy of
     the path string path, which should be a kernel pointer.  The return value should be checked
     for being NULL in case the system is out of memory.  Passing a path name larger than
     PATH_MAX will cause an assertion failure.

     The pathbuf_copyin() function allocates and initializes a new pathbuf containing a path
     string copied from user space with copyinstr(9).  It returns an error code.

     The pathbuf_assimilate() function creates a pathbuf using the string buffer provided as
     pnbuf.  This buffer must be of size PATH_MAX and must have been allocated with PNBUF_GET().
     The buffer is ``taken over'' by the returned pathbuf and will be released when the pathbuf
     is destroyed.  Note: to avoid confusion and pointer bugs, pathbuf_assimilate() should only
     be used where absolutely necessary; e.g. the NFS server code uses it to generate pathbufs
     from strings fetched from mbufs.

     The pathbuf_destroy() function deallocates a pathbuf.  Caution: because calling namei(9)
     loads pointers to memory belonging to the pathbuf into the nameidata structure, a pathbuf
     should only be destroyed by the namei() caller once all manipulations of the nameidata are

     Also note that calling namei() destroys the contents of the pathbuf.  Do not reuse a pathbuf
     for a second call to namei().

     The pathbuf code is part of the name lookup code in sys/kern/vfs_lookup.c.


     There are cases where it is necessary to get the path string left behind after namei() has
     run.  This produces an effect similar to realpath(3).  The interface for doing this is, for
     the time being, intentionally undocumented and subject to change.

BSD					November 30, 2010				      BSD

All times are GMT -4. The time now is 10:58 PM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
Show Password