networking guru question

Eric Norum eric.norum at
Thu Oct 17 15:25:58 UTC 2002

On Wednesday, October 16, 2002, at 11:21  PM, Till Straumann wrote:

> Hi Eric :-)
> I want to use soreceive() to avoid copying mbufs into a user buffer.
> I guess I have to hold the bsdnet_semaphore around soreceive().
> But once I got hold of the mbuf chain - is it safe to access / use / 
> release
> it without holding the semaphore (well, maybe I need to hold it
> for freeing the chain)?

I take it that you're doing this to provide 'zero-copy' network 
operation.    Perhaps we should think about adding a more general API 
for this (like the zero-copy I/O routines provided by pSOS+/pNA which 
specify a callback function to be invoked when I/O is complete).

Anyhow, I think you should be safe if you:

obtain network semahore
release network semaphore
do something with the received data
obtain network semahore
free mbufs()
release network semaphore

BTW -- what's your application that needs this high a level of network 
Eric Norum <eric.norum at>
Department of Electrical Engineering
University of Saskatchewan
Saskatoon, Canada.
Phone: (306) 966-5394   FAX:   (306) 966-5407

More information about the users mailing list