devfs_clear_cdevpriv man page on FreeBSD

Man page or keyword search:  
man Server   9747 pages
apropos Keyword Search (all sections)
Output format
FreeBSD logo
[printable version]

DEVFS_CDEVPRIV			     LOCAL			DEVFS_CDEVPRIV

NAME
     devfs_set_cdevpriv, devfs_get_cdevpriv, devfs_clear_cdevpriv — manage
     per-open filedescriptor data for devices

SYNOPSIS
     #include <sys/param.h>
     #include <sys/conf.h>

     typedef void (*cdevpriv_dtr_t)(void *data);

     int
     devfs_get_cdevpriv(void **datap);

     int
     devfs_set_cdevpriv(void *priv, cdevpriv_dtr_t dtr);

     void
     devfs_clear_cdevpriv(void);

DESCRIPTION
     The devfs_xxx_cdevpriv() family of functions allows the cdev driver meth‐
     ods to associate some driver-specific data with each user process open(2)
     of the device special file.  Currently, functioning of these functions is
     restricted to the context of the cdevsw switch method calls performed as
     devfs(5) operations in response to system calls that use filedescriptors.

     The devfs_set_cdevpriv() function associates a data pointed by priv with
     current calling context (filedescriptor).	The data may be retrieved
     later, possibly from another call performed on this filedescriptor, by
     the devfs_get_cdevpriv() function.	 The devfs_clear_cdevpriv() disassoci‐
     ates previously attached data from context.  Immediately after
     devfs_clear_cdevpriv() finished operating, the dtr callback is called,
     with private data supplied data argument.

     On the last filedescriptor close, system automatically arranges
     devfs_clear_cdevpriv() call.

     If successful, the functions return 0.

     The function devfs_set_cdevpriv() returns the following values on error:

     [ENOENT]		The current call is not associated with some
			filedescriptor.

     [EBUSY]		The private driver data is already associated with
			current filedescriptor.

     The function devfs_get_cdevpriv() returns the following values on error:

     [EBADF]		The current call is not associated with some
			filedescriptor.

     [ENOENT]		The private driver data was not associated with cur‐
			rent filedescriptor, or devfs_clear_cdevpriv() was
			called.

SEE ALSO
     open(2), close(2), devfs(5), kern_openat(9)

HISTORY
     The devfs_cdevpriv() family of functions first appeared in FreeBSD 7.1.

BSD			       September 8, 2008			   BSD
[top]

List of man pages available for FreeBSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
...................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net