strace seg with select and -ve nfds

Dmitry V. Levin ldv at altlinux.org
Mon Nov 11 14:43:33 UTC 2013


On Fri, Nov 08, 2013 at 12:27:18PM +0100, Denys Vlasenko wrote:
> On 11/06/2013 01:06 AM, Dmitry V. Levin wrote:
> > Looks like all FD_ISSET implementations just test the n-th bit in the
> > array of long ints.  I've pushed a commit with yet another FD_ISSET
> > implementation that hopefully does the same.
> > 
> >> On the related note, how are we doing in "stracing 32-bit app
> >> with 64-bit strace on a big-endian machine" case?
> >> In that case, sizeof(long) is important...
> >> I dread to think about that:(
> > 
> > We cannot make things worse than they were since the beginning. :)
> 
> Testing each bit with FD_ISSET is silly in any case, so I attempted to fix
> both "bit-endian wordsize bug" and performance problem in one go,
> by introducing a next_set_bit() function which just gives us
> a next bit's position.
> 
> It skips over entire zero bytes. By using bytes instead of words,
> it can walk bytes in big-endian sequence suitable for current_wordsize
> without the need of awkward code to access a runtime-variable-width word.
> 
> It also skips zero bytes even in not-fully zeroed words,
> which may be a win on speed.
> 
> Run-tested, although I do not have the environment to reproduce
> the bit-endian wordsize bug.
> 
> Dmitry, please review.
> Patch #2 just syncs up select decoding in pathtrace.c with the main one.

Nice fix, thanks.  There is a typo in comment, though. :)


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20131111/5d535c8e/attachment.bin>


More information about the Strace-devel mailing list