On Wed, Aug 19, 2009 at 03:48:06PM -0700, David Pacheco wrote:
> Sorry to reply to my own mail, but it's worse than I thought. The man
> page is obviously wrong in the most literal reading (we don't return
> ETIME if nget is updated...), but after looking at the code, I'm not
> even sure what it's supposed to be saying. The code in the kernel
> appears to return early with ETIME without consuming events in some
> cases, but other times it goes and consumes events even after getting
> ETIME. See:

> http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/portfs/port.c#1325
> 
> Note the check on line 1339. If it falls through because flags = 0
> (which it is in the common case for port_getn), we check for events
> without modifying error. It's unclear if that's intentional - i.e. is
> the code wrong in addition to the man page or just the man page?

To my reading you have these possible conditions:

 - max == 0 and port_getn() returns 0 -> *nget will have been set to the
   number of events available.

 - port_getn() returns 0, or it returns -1 && errno is one of ETIME,
   EINTR, or EBADFD -> events may have been consumed and placed in
   list[], and *nget will have been set to the number of consumed
   events.

 - port_getn() returns -1 && errno is one of EBADF or EINVAL -> no
   events will have been consumed, list[] and *nget remain untouched.

 - port_getn() returns -1 && errno is EFAULT -> events will have been
   consumed, *nget will be set to the number of events consumed, and
   list[] is undefined.

Nico
-- 
_______________________________________________
networking-discuss mailing list
networking-discuss@opensolaris.org

Reply via email to