Hello, I was trying to use ZMQ in a C++ program that also uses the STL to open regular files and that uses the open(2) and ioctl(2) syscalls of the Linux kernel for SPI communication (on an ARM platform). For certain combinations of opening and closing a regular file and binding to a TCP or Inproc socket, a subsequent ioctl call fails with either "No such device" or "Resource temporarily unavailable".
My first guess is that somehow ZMQ is messing up the file descriptors it uses, but I am certainly not ready to rule out bugs in the STL, Kernel or (least probably): my own code :-) Could anyone give me a suggestion on how continue debugging this? This is my demo code of the problem. The code uses the C++ binding for ZMQ (cppzmq) for brevity, but it should work the same for the native C interface. #include <sys/ioctl.h> #include <zmq.hpp> //#define ADDR "tcp://127.0.0.1:8000" #define ADDR "inproc://addr" /* * The program works fine if D is present and it shows the problem if * D is commented out for the following permutations of the blocks: * - A B C D * - A C B D * - C A B D * * The program always shows the problem (independent of the presence * of D) for the following permutations of the blocks: * - A C D B * - C A D B * - C D A B * * With the constraint that A must be before B and C before D, there * are no further valid permutations. * * For the TCP address, the error message is: No such device * For the inproc address, it is: Resource temporarily unavailable */ int main() { zmq::context_t ctx; /* A */ zmq::socket_t skt(ctx, ZMQ_PUB); /* B */ skt.bind(ADDR); std::fstream fs("log", std::ios::out); /* C */ fs.close(); /* D */ /* The following always last */ int fd = open("/dev/spidev32766.0", O_RDWR); struct spi_ioc_transfer pcks; memset(&pcks, 0, sizeof(struct spi_ioc_transfer)); ioctl(fd, SPI_IOC_MESSAGE(1), &pcks); std::cout << "errno: " << strerror(errno) << std::endl; return 0; } Thank you for any suggestion, Olaf Mandel -- Olaf Mandel phone: +49-89-189166-250 fax: +49-89-189166-111 Menlo Systems GmbH Am Klopferspitz 19a, D-82152 Martinsried Amtsgericht München HRB 138145 Geschäftsführung: Dr Michael Mei, Dr Ronald Holzwarth USt-IdNr. DE217772017, St.-Nr. 14316170324
signature.asc
Description: OpenPGP digital signature
_______________________________________________ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev