Subject: Re: fixing send(2) semantics (kern/29750)
To: None <tech-kern@netbsd.org>
From: Matthew Mondor <mm_lists@pulsar-zone.net>
List: tech-kern
Date: 03/26/2005 19:23:32
On Sun, 27 Mar 2005 00:28:34 +0100
manu@netbsd.org (Emmanuel Dreyfus) wrote:

I still consider myself a NetBSD kernel newbie (studying it though), so
if my comments are wrong I would appreciate explanation details for my
own sake, thanks in advance :)

> Here is a first attempt at dealing with the problem:
> http://ftp.espci.fr/shadow/manu/send.diff
[...]

>+		if (sleep) {						\
>+			splx((s));					\
>+			tsleep((ifq), PCATCH|PRIBIO, 			\
>+			    "ifq_enqueue", 0);				\
>+			(s) = splnet();					\
[...]

I am not sure of this, but is it possible that splx() is not necessary
here (two instances of this in the code), since most code I saw using
tsleep() appears to assume that it automically uses normal priority when
sleeping, restoring previous one upon return/wakeup?

At first view I thought that possibly using a flag to know we triggered
sleep when calling wakeup() would be nice to not call it always, but I
think that the condition only happens if we indeed put the process to
sleep, since it otherwise would have errored with ENOBUF if in
non-blocking mode right?

Thanks,
Matt

-- 
Note: Please only reply on the list since other mail is blocked by default.
Private messages from your address can be allowed by first asking, however.