jeudi 3 juillet 2014

How to set errno in Linux device driver?


Vote count:

0




I am designing a Linux character device driver. I want to set errno when error occurs in ioctl() system call.



long my_own_ioctl(struct file *file, unsigned int req, unsigned long arg)
{
long ret = 0;
BOOL isErr = FALSE;

// some operation
// ...

if (isErr)
{
// set errno
// ... <--- What should I do?
ret = -1;
}

return ret;
}


What should I do to achieve that? Thank you at advance!



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire