According to the ioctl man page, the first argument d must be an open file descriptor.