0

I'm porting some code to OpenVMS and have stumbled upon a limitation.

There is a poll() function checking an array of sockets for events, but unfortunately, one of the file descriptors is created via pipe() function. This is then causing a problem and poll() returns with errno = ENOTSOCK.

Reason for pipes file descriptor is to intentionally interrupt/cancel poll() by writing a single byte to its input side.

Is there a way how to create something similar to pipe but with sockets?

Thanks and regards.

  • 1
    Are you sure it's `poll(2)` that is failing? There is nothing requiring `poll(2)` to return an error if the descriptor is not a socket, this is probably a bug with the rest of the code that deals with events. – Filipe Gonçalves Aug 28 '15 at 10:13
  • I'm sure. Code that works flawlessly on linux is failing on OpenVMS. – Tomas Soltys Aug 28 '15 at 10:20
  • @TomasSoltys Well, that doesn't mean it's poll failing. It could e.g. be recv() if you use that, as it doesn't support pipes on OpenVMS - while OpenVMS poll() is documented to support pipes. If you still need a workaround, use a socket instead of a pipe. A TCP connection is the one most similar to a pipe, but if all you need is interuptions, you could monitor a UDP socket in your poll() call , and send off a packet to yourself when you need to. – nos Aug 28 '15 at 11:02
  • 1980 called and wants its operating system back. – larsks Aug 28 '15 at 13:37

0 Answers0