Usually when ioctls
fail, they use a standard code from include/uapi/asm-generic/errno-base.h
. The meaning of each error is then documented for each specific ioctl
.
In your case, you will probably want to return ENOENT
or EINVAL
. If the argument of your ioctl
is a PID
it will be obvious enough that ENOENT
means that this PID
doesn't exist. And you'd better document this behavior somewhere. A good example can be found in man console_ioctl
.