|
NAMEdev_refthread , devvn_refthread ,
dev_relthread —
safely access device methods
SYNOPSIS#include <sys/param.h>
#include <sys/conf.h>
struct cdevsw *
struct cdevsw *
void
DESCRIPTIONThedev_refthread () (or
devvn_refthread ()) and
dev_relthread () routines provide a safe way to access
devfs(5)
devices that may be concurrently destroyed by
destroy_dev () (e.g., removable media).
If successful, A reference cannot prevent media removal. It is an implementation
detail of individual drivers how method calls from callers with
The
CONTEXTstruct cdev objects have two reference counts, si_refcount and si_threadcount. Thedev_refthread (),
devvn_refthread (), and
dev_relthread () functions manipulate the
si_threadcount. The si_threadcount
reference guarantees the liveness of the struct cdev
object. The other si_refcount reference provides only
the weaker guarantee that the memory backing the struct
cdev has not been freed.
RETURN VALUESIfdev_refthread () or
devvn_refthread () are unsuccessful, they return
NULL .
If these routines are unsuccessful, they do not increment the
struct cdev si_threadcount and do
not initialize the value pointed to by the *ref
parameter in any way.
SEE ALSOdestroy_dev(9), devfs(5)CAVEATSDo not invokedev_relthread () unless the matching
refthread routine succeeded!
Visit the GSP FreeBSD Man Page Interface. |