* [NEWBIE] Is it legal for open() to return -EBUSY?
@ 2017-09-26 10:45 Zheng Lv
2017-09-27 8:09 ` Santosh Sivaraj
0 siblings, 1 reply; 2+ messages in thread
From: Zheng Lv @ 2017-09-26 10:45 UTC (permalink / raw)
To: linux-newbie
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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [NEWBIE] Is it legal for open() to return -EBUSY?
2017-09-26 10:45 [NEWBIE] Is it legal for open() to return -EBUSY? Zheng Lv
@ 2017-09-27 8:09 ` Santosh Sivaraj
0 siblings, 0 replies; 2+ messages in thread
From: Santosh Sivaraj @ 2017-09-27 8:09 UTC (permalink / raw)
To: Zheng Lv; +Cc: linux-newbie
* Zheng Lv <lv.zheng.2015@gmail.com> wrote (on 2017-09-26 10:45:39 +0000):
> 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.
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
>
> Zheng Lv
> --
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.linux-learn.org/faqs
--
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-27 8:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-26 10:45 [NEWBIE] Is it legal for open() to return -EBUSY? Zheng Lv
2017-09-27 8:09 ` Santosh Sivaraj
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox