Description
From Florian Weimer:
I went over tutorial and spotted a few typos (see below).
I think the SHA-1 example shouldn't use the static buffer because it
is not task-safe.
More significantly, the gettimeofday example still uses the wrong
types for time_t and suseconds_t. time_t is usually signed and not
always 64 bit (or the size of a machine word). suseconds_t can be a
32-bit type even on 64-bit machines, and the padding is in the wrong
place on big-endian machines. Not sure if rustc already works on
anything besides i386 and amd64 on GNU libc platforms. But even to
support these two, you need this:
type timeval = {mut tv_sec: c_long, mut tv_usec: c_long};
time_t and suseconds_t are two of the most problematic types for FFI.
It's difficult to find structs in POSIX which are essentially fixed.
struct pollfd appears to be one such type, but the example would have
to be larger.