Read Joystick from Julia

How would you translate this to Julia:

size_t get_axis_count(int fd)
{
    __u8 axes;

    if (ioctl(fd, JSIOCGAXES, &axes) == -1)
        return 0;

    return axes;
}

I just need a starting point.

Update:
Found this discussion: Ccall() to ioctl - #17 by yuyichao