[DTrace-devel] [PATCH v2 3/4] EINTR: make safe under signal hits

Nick Alcock nick.alcock at oracle.com
Thu Nov 2 13:27:32 UTC 2023


On 1 Nov 2023, Eugene Loh via DTrace-devel stated:

> There were my comments to v1 of this patch.  Plus, there are leading
> spaces in cases, where leading tabs should be used. Also...

Ugh. Fixed. I wish I knew why my Emacs sometimes goes saboteur on me and
silently turns off indent-tabs-mode.

(There were a bunch in the previous series too, will be fixed in the
next posting.)

(If I had my druthers leading tabs would simply be banned across all
source trees in the C-using world. Easiest way to avoid ever having to
deal with this nonsense ever again, at trivial cost in disk space.)

>> +			timeout_msec -= ((end.tv_sec + ((unsigned long long) end.tv_nsec * NANOSEC)) -
>> +					 (start.tv_sec + ((unsigned long long) start.tv_nsec * NANOSEC))) /
>> +					MICROSEC;
>
> Is that conversion correct?  secs + nsecs * 1000000000?

That's (nsecs - nsecs) / usecs == msecs, right?

> Also, while dividing by MICROSEC gives the right result, strictly
> speaking one maybe wants to divide by (NANOSEC/MILLISEC).  And to be

Honestly that makes my head spin and I have to invert both the 1/'s to
make it make any sense to me at all. I'd rather not write code I can't
understand as I write it, though you're welcome to change it of course
:)

> stylistically consistent, use MILLISEC instead of the 1000.  (Or, just

Oops, I forgot about MILLISEC.

> dispense with NANOSEC and MICROSEC and use 1000000000 and 1000000
> instead.)

That's what I did originally, but it's too easy to miscount the zeroes
and I did so twice... 1000 is harder to mis-see, so I don't really see
any harm in using it directly, though MILLISEC is better for consistency
(so: adjusted).

-- 
NULL && (void)



More information about the DTrace-devel mailing list