From: Klaus Schmidinger <Klaus.Schmidinger@tvdr.de>
To: linux-media@vger.kernel.org
Subject: DVB: EOPNOTSUPP vs. ENOTTY in ioctl(FE_READ_UNCORRECTED_BLOCKS)
Date: Thu, 14 Feb 2013 14:12:31 +0100 [thread overview]
Message-ID: <511CE2BF.8020905@tvdr.de> (raw)
In VDR I use an ioctl() call with FE_READ_UNCORRECTED_BLOCKS on a device (using stb0899).
After this call I check 'errno' for EOPNOTSUPP to determine whether this
device supports this call. This used to work just fine, until a few months
ago I noticed that my devices using stb0899 didn't display their signal
quality in VDR's OSD any more. After further investigation I found that
ioctl(FE_READ_UNCORRECTED_BLOCKS) no longer returns EOPNOTSUPP, but rather
ENOTTY. And since I stop getting the signal quality in case any unknown
errno value appears, this broke my signal quality query function.
Is there a reason why this has been changed?
Should a caller check against both EOPNOTSUPP *and* ENOTTY?
I searched through linux/drivers/media and found that both values are
used (EOPNOTSUPP 57 times and ENOTTY 71 times in the version I have in use).
While ENOTTY seems to apply here (at least from its description, not from
its name)
ENOTTY "Inappropriate ioctl for device" (originally "Not a typewriter")
and I can see why this would be a reason for changing this, EOPNOTSUPP doesn't
really seem to apply, since there is, I assume, no "socket"
involved here:
EOPNOTSUPP "Operation not supported on socket"
The value I would actually expect to be used in case an operation is
not supported by a device is
ENOTSUP "Operation not supported"
Interestingly the driver source uses ENOTSUPP (note the double 'P') 8 times,
but that name is not defined according to man errno(3).
So the bottom line is that there appears to be some confusion as to which errno
value to return in case an operation is not supported.
Maybe all these return values should be set to ENOTSUP (with a single 'P' at the end)?
Klaus
next reply other threads:[~2013-02-14 13:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-14 13:12 Klaus Schmidinger [this message]
2013-02-14 15:52 ` DVB: EOPNOTSUPP vs. ENOTTY in ioctl(FE_READ_UNCORRECTED_BLOCKS) Antti Palosaari
2013-02-14 18:05 ` Manu Abraham
2013-02-14 19:16 ` Antti Palosaari
2013-02-14 19:50 ` Manu Abraham
2013-02-14 21:33 ` [linux-media] " Klaus Schmidinger
2013-02-15 14:10 ` Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=511CE2BF.8020905@tvdr.de \
--to=klaus.schmidinger@tvdr.de \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).