[Toybox] [PATCH] ping: print ttl

enh enh at google.com
Mon Mar 2 17:00:56 PST 2020


On Mon, Mar 2, 2020 at 4:06 PM Rob Landley <rob at landley.net> wrote:
>
> On 2/28/20 9:45 AM, anatasluo wrote:
> > Signed-off-by: anatasluo <luolongjuna at gmail.com>
> > ---
> >  lib/lib.h       |  2 ++
> >  lib/net.c       | 22 ++++++++++++++++++++++
> >  toys/net/ping.c | 40 +++++++++++++++++++++++++++++++++-------
> >  3 files changed, 57 insertions(+), 7 deletions(-)
>
> Sorry for the delay, I've been trying to see if there's a way to do this
> _without_ using an iovec to read the data. (Which means I'm reading the kernel
> code implementing it, among the half-dozen other things I'm currently juggling...)
>
> But I did want to point out:
>
> > -    xsetsockopt(TT.sock, SOL_SOCKET, SO_MARK, &len, 4);
> > +    xsetsockopt(TT.sock, SOL_SOCKET, SO_MARK, &len, sizeof(len));
> >    }
>
> LP64 is a standard introduced during the 32->64 bit transition somewhere around
> Y2 that says sizeof(char) = 1, sizeof(short) = 2, sizeof(int) = 3, and

or sometimes 4. usually 4. actually, always 4. :-)

> sizeof(long) == sizeof(pointer), and sizeof(long long) is "at least" 64 bits (in
> practice always exactly 8 bytes, but they should _specify_).
>
> Linux, BSD, MacOSX, iOS, and Android all adhere to this standard. Windows does
> _not_ (they went with LLP64 instead) for insane legacy reasons described... darn
> it, the downside of discussing 20 year old things is all the pointers moved. I
> should update the links on the design.html page, but here's Microsoft's insane
> legacy reasons for going with LLP64 for the Win64 API:
>
>   https://devblogs.microsoft.com/oldnewthing/20050131-00/?p=36563

huh. i see what he's saying, but i wouldn't have made that decision
myself. still, that's better than my previously-assumed reason of
"just to be different".

> Here, I just updated the design.html section to use archive.org for the unix.org
> links:
>
>   http://landley.net/toybox/design.html#bits
>
> Rob
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net



More information about the Toybox mailing list