uiomove and mutex
fazaeli at sepehrs.com
Mon Jan 11 19:57:46 UTC 2010
man mutex(9) states that:
"No mutexes should be held (except for Giant) across functions which
access memory in userspace, such as copyin(9), copyout(9), uiomove(9),
fuword(9), etc. No locks are needed when calling these functions."
can someone pls. explain why it is so?
Suppose I have a kernel buffer to which kernel writes and
userland processes read via a character device. In the device
read method, If we unlock the mutex just before uiomove, is it
guaranteed that kernel does not write to the buffer in the middle
of uiomove? If yes, how? What is the solution in such a situation?
rwlocks? an intermediate buffer?
More information about the freebsd-hackers