per file descriptor device driver data ?

Luigi Rizzo rizzo at iet.unipi.it
Fri May 29 12:24:16 UTC 2015


Hi,
in the kernel module for netmap we need to store some
private data associated to each open netmap file descriptor.

Our current design uses devfs_set_cdevpriv() during the open()
handler, but for some reason a subsequent devfs_get_cdevpriv(p)
returns *p = NULL in additional threads created by the process
that did the open().

The manpage devfs_set_cdevpriv() does not mention threads,
and so i am a bit puzzled why the cdevpriv is only good
for the original thread.

In the linux version 'struct file' has a "private_data" field
that we use for that purpose, and remains valid on all threads.
i wonder if there is something similar we can use in FreeBSD.

cheers
luigi


More information about the freebsd-current mailing list