https://bugs.dragonflybsd.org/https://bugs.dragonflybsd.org/favicon.ico?16293952082007-12-27T02:18:10ZDragonFlyBSD bugtrackerDragonFlyBSD - Bug #895: pselect(2) implementationhttps://bugs.dragonflybsd.org/issues/895?journal_id=40232007-12-27T02:18:10Znthery
<ul></ul><p>Attached test suite.</p> DragonFlyBSD - Bug #895: pselect(2) implementationhttps://bugs.dragonflybsd.org/issues/895?journal_id=40242007-12-27T08:49:02Znthery
<ul></ul><p>Please review the patch attached to<br /><a class="external" href="http://bugs.dragonflybsd.org/issue895">http://bugs.dragonflybsd.org/issue895</a>. If there are no objections I<br />will commit it on Thursday, Jan 10.</p>
<p>It seems all BSDs leave select()'s timeout argument unchanged on<br />return (contrary to linux), so I don't intend anymore to "fix" dfly<br />with that respect.</p>
<p>Cheers,<br />Nicolas</p> DragonFlyBSD - Bug #895: pselect(2) implementationhttps://bugs.dragonflybsd.org/issues/895?journal_id=40272007-12-28T03:52:01Zdillon
<ul></ul><p>:<br />:Please review the patch attached to<br />:http://bugs.dragonflybsd.org/issue895. If there are no objections I<br />:will commit it on Thursday, Jan 10.<br />:<br />:It seems all BSDs leave select()'s timeout argument unchanged on<br />:return (contrary to linux), so I don't intend anymore to "fix" dfly<br />:with that respect.<br />:<br />:Cheers,<br />:Nicolas</p>
<pre><code>It looks reasonable after a quick perusal.</code></pre>
<pre><code>select()'s timeout argument is always left unchanged. Linux originally<br /> adjusted it on return but I was under the impression that they<br /> reverted back to the BSD method of not touching it. The changing of<br /> the timeout argument was a major mistake that linux made in their<br /> implementation a long, long time ago.</code></pre>
<pre><code>-Matt</code></pre> DragonFlyBSD - Bug #895: pselect(2) implementationhttps://bugs.dragonflybsd.org/issues/895?journal_id=40282007-12-28T04:02:00Zhsu1
<ul></ul><p>Don't forget to add the hook to the Linux emulation layer for this system call.</p> DragonFlyBSD - Bug #895: pselect(2) implementationhttps://bugs.dragonflybsd.org/issues/895?journal_id=40392007-12-29T17:38:01Znthery
<ul></ul><p>Thanks for the remark. I completely forgot linux emulation. The<br />pselect syscall was introduced in linux 2 years ago:</p>
<p><a class="external" href="http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.23.y.git;a=commit;h=9f72949f679df06021c9e43886c9191494fdb007">http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.23.y.git;a=commit;h=9f72949f679df06021c9e43886c9191494fdb007</a></p>
<p>pselect() is still implemented by a wrapper in glibc though, at least<br />for debian 4.0. I'll try to implement the hook anyway.</p>
<p>Additionally, reading the linux pselect commit log revealed what<br />looks like a bug in my patch: if pselect() is interrupted by a signal<br />that was blocked prior to the call and unblocked by pselect(), the<br />syscall is interrupted but the signal handler is not called because<br />the patch restores the original mask before userret() is called.<br />pselect() should probably be implemented like sigsuspend() instead.</p> DragonFlyBSD - Bug #895: pselect(2) implementationhttps://bugs.dragonflybsd.org/issues/895?journal_id=40442007-12-30T06:15:13Znthery
<ul></ul><p>Here is a new version of the patch that restores the original signal mask only<br />after executing signal handlers (if any). This is similar to what is done in<br />sigsuspend() and deals correctly with the case where pselect() is interrupted by<br />a signal blocked in the original mask.</p> DragonFlyBSD - Bug #895: pselect(2) implementationhttps://bugs.dragonflybsd.org/issues/895?journal_id=41172008-01-11T19:30:30Znthery
<ul></ul><p>Committed to HEAD.</p> DragonFlyBSD - Bug #895: pselect(2) implementationhttps://bugs.dragonflybsd.org/issues/895?journal_id=41182008-01-11T19:34:00Znthery
<ul></ul><p>I discovered that DragonFly emulate linux 2.4.z but pselect was<br />introduced in linux 2.6.z. Furthermore, even recent distros (fedora<br />core 8) still implement pselect as a wrapper in glibc. So I can't<br />really add the pselect emulation hook for the time being.</p>
<p>Cheers,<br />Nicolas</p>