OS2 World Community Forum
OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: Jochen Schäfer on June 23, 2017, 09:58:10 pm
-
I'm trying to port multitail, but it seems that select() as well as poll() doesn't seem to work.
I have attached my test programs, which both should work. Both return with EINVAL.
So, am I missing something or is the OS/2 implementation buggy?
Can somebody point me to some already ported code, which uses poll or select?
-
OS/2 implementation of select() supports sockets, only. Not files.
-
That explains a lot.
Do we have an OS/2 API for something like this?
-
You could create a separate threads for polling each file descriptor, and posting a semaphore if ready. Then use DosWaitMuxWaitSem (http://www.edm2.com/index.php/OS2_API:CPI:DosWaitMuxWaitSem) on a set of those semaphores, for example. Or, create your own select/poll implementation supporting files under the hood.
-
Hi Jochen.
Talking about the API I'm trying my best to update the OS/2 API Project on the EDM/2 wiki (http://www.edm2.com/index.php/The_OS/2_API_Project), but seems too be too much work for one man. Check that page, and even that it may be incomplete, it may give you the pointers to find the rest of the documentation online.
Regards
-
That explains a lot.
Do we have an OS/2 API for something like this?
No, the current select is basically the native OS/2 one. EMX had a much better select() if you wanted to go that route, but it is missing a lot of current stuff, default GCC was 2.8.1 and newest on it was 3.03.
Libcx has a poll() implementation, if your building with the YUM/RPM environment, probably a good idea to add -lcx to LDFLAGS
-
I should have stated that my setup relies on YUM.
Yes, I used the libcx version of poll, but that also doesn't work.
If EMX had a better version, perhaps I should look into the sources to get some hints.
-
I should have stated that my setup relies on YUM.
Yes, I used the libcx version of poll, but that also doesn't work.
If EMX had a better version, perhaps I should look into the sources to get some hints.
The sources and binaries are at http://hobbes.nmsu.edu/h-browse.php?dir=/pub/os2/dev/emx/v0.9d (http://hobbes.nmsu.edu/h-browse.php?dir=/pub/os2/dev/emx/v0.9d).
The problem is licence incompatibility. kLIBC which yum installs is BSD and LGPL while the EMX libc is pure GPL. kLIBC does use a lot of EMX utilities and is mostly compatible but the libc itself was contracted by IBM to not be GPL. kLIBC was written mostly for one purpose, compiling Mozilla.
-
Thanks for the hints.
I think, I will need to reimplement that part of multitail. So, I need some hints, which OS/2 APIs are required.
But I also will look at klibc source.
-
Hey Jochen,
I'm trying to port multitail, but it seems that select() as well as poll() doesn't seem to work.
I have attached my test programs, which both should work. Both return with EINVAL.
So, am I missing something or is the OS/2 implementation buggy?
Can somebody point me to some already ported code, which uses poll or select?
Check for pipe() usage - klibc select() won't work on a pipe()'d socket - replace pipe with socketpair....
Cheers,
Paul
-
I suggest to talk to Dmitriy Kuminov about the implementation in libcx.
We had to deal with the same problem on Samba.
-
Hey Jochen,
I don't think that multitail opens sockets, it just observes some files.
Check for pipe() usage - klibc select() won't work on a pipe()'d socket - replace pipe with socketpair....
Cheers,
Paul
I don't thick that multitail opens any sockets, it just observes some files.
-
I suggest to talk to Dmitriy Kuminov about the implementation in libcx.
How?
Edit: I meant, how can I contact him?
-
I suggest to talk to Dmitriy Kuminov about the implementation in libcx.
How?
In English (http://www.os2world.com/forum/index.php?action=pm;sa=send;u=406)?