Error while opennig device file
Marcin Dawidowicz
marcin.dawidowicz at kontron.pl
Thu Jun 16 19:23:41 EST 2005
On Thursday 16 of June 2005 10:35, Garcia Jérémie wrote:
> static int test_open(struct inode *inode , struct file *file)
> {
> int ret_val = 0;
>
> if (Device_open != 0) <------
> return -EBUSY; <------
>
> Device_open++; <------
> printk("%d minor number!\n",MINOR(inode->i_rdev));
> MOD_INC_USE_COUNT;
>
> return ret_val;
> }
>
> Very traditionnal...
>
Have a look on marked lines.
> What error do you get on second open?
> --> I trace the execution of my programm and get the following :
> First opened succeeded, open() return code : 3
> Can't open second file, open() return code : -1 , errno = 16
>
> Looking in the errno.h, we have :
> #define EBUSY 16 /* Device or resource busy */
This is what I would expect. You can remove marked lines and try again...
Regards,
Marcin
More information about the Linuxppc-dev
mailing list