2

Recently, I've been playing around and, after a research of a problem, I've found that there is constant EMEDIUMTYPE defined in errno.h, with comment "Wrong medium type". Googled and haven't found a good explanation of what that actually means. I've encountered the term while programming a server using OpenSSL (this I'm writing just to provide some context) but not directly.

So, what does EMEDIUMTYPE mean in general and in this context (if there is any difference, of course)?

1
  • Per my experience this error is returned by media drivers, such as mmc, cd and so on.
    – LPs
    Aug 29, 2016 at 15:18

1 Answer 1

5

EMEDIUMTYPE is not defined by POSIX or the C standard. So, you must be looking at one of the Linux specific errno.h (as opposed to the standard errno.h) as listed here:

109  * These error are Linux extensions.
110  */
111 #define ENOMEDIUM       159     /* No medium found */
112 #define EMEDIUMTYPE     160     /* Wrong medium type */

From the Linux source code search, it appears to be an error code related to invalid operation on a medium ( that is, physical medium such as disks, CDs, etc) or an operation not supported by the medium.

5
  • So in the context of OpenSSL, the medium in question is presumably a network connection, or perhaps specifically an SSL channel. There are plenty of operations that are not supported on such media; the first that comes to mind is seeking. Aug 29, 2016 at 16:08
  • That is the problem for me. I am using it on the Dragino Yun and have no idea which operstion that OpenSSL uses could be unsupported. Don't think it's seeking since it works on another platform.
    – NMilev
    Aug 30, 2016 at 4:28
  • Back to the matter at hand, any idea WHY this kind of error was not defined in POSIX? I can imagine someone using incompatible operations on devices, seems kind of logical to standardize it.
    – NMilev
    Aug 30, 2016 at 6:31
  • @NMilev I have no idea why it's not in POSIX. Probably nobody suggested/requested it for consideration. But I can imagine that there are generic errnos that can be used for this (such as EPERM or EIO).
    – P.P
    Aug 30, 2016 at 8:12
  • Didn't really go through the list of error numbers but now it seems logical. However, it could be there. It would be nice to continue the discussion but the answer was provided. Thanks!
    – NMilev
    Aug 30, 2016 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.