Macosx uses a different layout for struct flock.

The changes in #662, #814 break on macosx because apparently flock has a different layout there:

i.e. on mac:

```C++
struct flock {
        off_t   l_start;        /* starting offset */
        off_t   l_len;          /* len = 0 means until end of file */
        pid_t   l_pid;          /* lock owner */                                                                                                                                                                                                          
        short   l_type;         /* lock type: read/write, etc. */
        short   l_whence;       /* type of l_start */
};
```

vs on linux:

```C++
struct flock {
        short   l_type;
        short   l_whence;
        off_t   l_start;
        off_t   l_len;                                                                                                                                                                                                                                    
        pid_t   l_pid;
        __ARCH_FLOCK_PAD
};
```

this change adds an helper which takes care of the layout.