Martin Pieuchot wrote:
> I'd like to use a write lock to serialize accesses to ip_output(). This
> will be used to guarantee that atomic code sections in the socket layer
> stay atomic when the input/forwarding path won't run under KERNEL_LOCK().
>
> For such purpose I'll have to convert some tsleep(9) to an msleep(9)-like
> function operating on a write lock. That's why I'd like to introduce
> rwsleep(9). I did not bother exporting a read variant of this function
> since I don't need it for the moment.
Something feels a little weird about this. Usually you want to keep the rwlock
while sleeping. Instead we use mutex for passing control over sleep.
I don't know how this would make the code look, but something like
rw_enter();
/* do a bunch of stuff */
mtx_enter();
rw_exit();
msleep();
But I don't see anything wrong with rwsleep.