chunkd: use port xxx82 to build
Hi Jeff,
There is support for all sorts of byte swaping. And swapping bytes works in both directions, big to little or little to big is the same operation. ntohll is a 64 bit byte swap, but might not naturally work based on architecture. Check out be64_to_cpu and friends. They are in the tree and should work reliably, regardless of architecture.
I've been dealing with issues that seem to be related to Fedora8. Fixing them one at a time seems counter productive, as some of the libraries are not exactly backward compatible. What OS/release and libraries do you use to build Hail?
Cheers,
- Rick
Quoted 34 lines
From: Jeff Garzik <[email protected]>
Sent: Aug 12, 2009 8:11 PM
To: Rick Peralta <[email protected]>
Cc: Pete Zaitcev <[email protected]>, Project Hail List <[email protected]>
Subject: Re: [Patch] chunkd: use port xxx82 to buildQuoted 1 line · Rick Peralta
There is code to byte swap in the network stack.
ntoh()and friends should do the job.Unfortunately that isn't the best solution for us, for a few reasons:
* There is no 64-bit variant, which we need.
* The system platform definitions of
ntohl()etc. can vary between macros and function calls depending on compiler's -O settings, which complicates debugging (at least for me).*
ntohl()forces big endian. Given the current landscape of commodity hardware, I intentionally chose little endian over big endian. That will completely eliminate byte-swapping for the primary platforms' byte order.We use the GLib byte order facilities, which provide little endian variants and are portable (along with the rest of GLib) across modern platforms. But GUINT*_{FROM,TO}_LE macros come with the minor disadvantages of all macros, namely a lack of type safety, problems with multiple evaluation, etc.
Regards,
Jeff
Quoted 3 lines · Rick Peralta
Hi Jeff,
There is support for all sorts of byte swaping. And swapping bytes works in both directions, big to little or little to big is the same operation. ntohll is a 64 bit byte swap, but might not naturally work based on architecture. Check out
be64_to_cpuand friends. They are in the tree and should work reliably, regardless of architecture.
ntohll does not appear to be part of glibc, but rather nspr. Adding a dependency on nspr would duplicate existing functionality in existing dependency GLib.
be64_to_cpu and friends come from /usr/include/linux, which is Linux-specific. That doesn't work, because the project currently works on FreeBSD and Solaris, in addition to Linux.
In both cases, GLib provides idioms that are more portable, without adding additional dependencies to this project.
Certainly the underlying swap16/swap32/swap64 code is the same for big or little endian, but the APIs you cite (ntohl, ntohll, etc.) will compile to no-op on big endian, and swap on little endian, which gives the opposite result of the stated design choice (fixed little endian to match commodity hardware).
Quoted 1 line
I've been dealing with issues that seem to be related to Fedora8. Fixing them one at a time seems counter productive, as some of the libraries are not exactly backward compatible. What OS/release and libraries do you use to build Hail?
Can you detail those issues?
Just like we support other OS's, I would like to either (a) support an older Linux distro, or (b) have configure fail gracefully, giving a helpful message about why configure did not like your system.
Jeff