Issue with SELECT

Hi,

I am facing a strange issue while doing select on two files.

I have developed a resource manager, which handles the /dev/resmgr directory and any file created in this directory. So I created one file /dev/resmgr/dev_1 through the application. The same appliction oepns another file /tmp/dev_2.

Now I am doing the SELECT on these FD’s, but I am not receiving any notification for the file /dev/resmgr/dev_1 in this SELECT. And on the other hand, for device /tmp/dev_2 I am always getting the notification and while reading it shows the “0 bytes” data.

Any idea, where I am doing the things wrong!!!

Thanks in advance,

-Dheeraj

Without seeing code it’s really hard to tell what is wrong.

Hi,

Two things come to mind:

  1. Remember you have to explicitly support SELECT in your resource manager by implementing io_notify callback and the issuing iofunc_notify_trigger() when the conditions are met, in order to wake up the client. It does not happen automatically.

  2. Remenber you must pass max_fd+1 !!! into select() (weird UNIX legacy)

Another issue with select(): When you issue select() in your application and the call blocks because the conditions you are asking for are not met in the underlying resource manager, then you block. If some time later this resource manager dies for any reason, select() does not return automatically, so your application blocks forever. Anybody knows a way to circumvent this?

Regards,
Albrecht

Hi,

Actually I was using two file systems, means /tmp/dev_2 was handled by the FLASH file system, and /dev/resmgr was habdled by the QNX file system.
And when we changed the /tmp/dev_2 device to the UDP socket, the SELECT worked.

I am wondering how two different file system could cause such error. Because eventually these calls go through the Kernal, and the kernel has to decide that the passed FD belongs to which file system.

Please correct me if I am wrong!!

Thanks,
Dheeraj