in reply to Re: sysread/syswrite and O_DIRECT alignment problem (align)
in thread sysread/syswrite and O_DIRECT alignment problem

That doesn't work on my perl, where sizeof(UV) is 8 and sizeof(char*) is 4 :)
  • Comment on Re^2: sysread/syswrite and O_DIRECT alignment problem (align)

Replies are listed 'Best First'.
Re^3: sysread/syswrite and O_DIRECT alignment problem (sizes)
by tye (Sage) on Nov 27, 2007 at 16:22 UTC

    Yeah, I almost mentioned that "J" might not be the right choice. Previously I'd used "L", but I think there are also situations where that doesn't work. I almost switched to writing code to detect the system's endianness and just pull out the least-significant byte, but the possibility of a system with mixed endianness deterred me.

    If I were to put this code someplace like a module I'd probably compare things like length pack "p", "foo" and length pack "J", 0 to pick which format letter to use with unpack.

    - tye