Regarding the -1 -- yes, you are correct -- conventionally anything < 0 is an error.  I was just being explicit because of the ioctl documentation here:

```Usually, on success zero is returned. A few ioctl() requests use the return value as an output parameter and return a nonnegative value on success. On error, -1 is returned, and errno is set appropriately.
```

http://linux.die.net/man/2/ioctl

It could go either way.  I'm happy to change it if needed.