Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello!
I'm the maintainer of GNU Midnight Commander (Norton Commander TM clone for POSIX systems). I'm often asked whether it's possible to make a port for BeOS. The problem is that select() doesn't work on regular file descriptors, or so it looks like from the headers and postings on the net. I also found references to BONE here and there, but it seems that normal users still cannot use it, so it's not an option.
I tried to reimplement select() for file descriptors. The idea was to use SIGIO and read 0 bytes, checking in the loop if SIGIO has arrived.
However, it is possible that select() is called more than once on the same descriptor. In this case, SIGIO is not triggered the second time.
I cannot use a table of descriptors that are "ready" because they can be accessed by read() between select() calls and I cannot think of any way to update the table or to reset the descriptor to the state, in which it will generate SIGIO again.
A very inoptimal solution would be to dup() the file descriptor, close() the original one and then create a pipe (BTW, do they exist in BeOS?) trying to get the same number that was just closed (if it fails, you lose) and then starting a process or thread that would bufferize the data and give the statistics needed for the select() implementation. But it's as ugly as it can get.
Does anybody know of any way to implement select() for file descriptors? Does anybody has an implementation?
I'm not interested in sockets at this point.
Thank you in advance.
Please write to my e-mail without "no-spam" or to mc-devel@gnome.org
Pavel Roskin

Thank you!
Unfortunately, it's not a drop-in replacement - it requires replacing read() and write(), but at least a dedicated porter should be able to get mc running.

![]() |
CMOS setup
|
Compiling BeWine
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |