Is it legal for open() to return -EBUSY?
In LDD3, Chapter 6, Section "Restricting Access to a Single User at a Time", the example code returns -EBUSY when the chardev is in use by another user. However, I "man 3p open" and "man 2 open", finding that ERRORS section of either manual didn't mention about EBUSY.
I would like to ask if it's legal for open() to return -EBUSY.
Zheng Lv
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
* Zheng Lv <[email protected]> wrote (on 2017-09-26 10:45:39 +0000):
Quoted 3 lines
In LDD3, Chapter 6, Section "Restricting Access to a Single User at a Time", the example code returns
-EBUSYwhen the chardev is in use by another user. However, I "man 3p open" and "man 2 open", finding that ERRORS section of either manual didn't mention about EBUSY.I would like to ask if it's legal for
open()to return-EBUSY.
Yes, it is legal. Many drivers return EBUSY when they are only supposed to be opened once. Probably some vga/drm/audio drivers etc. The open man page is mostly directed towards (filesystem) files and directories, so all kinds of errors are not covered.
Imagine a case where a device requires a interrupt line that can't be shared, in which case EBUSY would be the right thing to return.
Thanks,
Santosh
Quoted 7 lines
Zheng Lv
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
Signature · 5 lines
-- To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs