Kernel-side pselect(2) implementation:
Add pselect() system call.
Factor out in doselect() code shared between select and pselect (was in
Add pselect() wrapper in libthread_xu that uses the pselect() syscall.
Add pselect() wrapper in libc_r that uses poll() syscall (see XXX comment in
code and BUGS in pselect man page).
Add pselect man page (taken from FreeBSD).
Changed libbind to use system pselect instead of locally defined wrapper.
Note: The current select() implementation does not update the timeout parameter
on return as specified in
http://www.opengroup.org/onlinepubs/000095399/functions/select.html. I intend
to fix this in a separate patch.
make buildworld && make buildkernel
Ran small test suite that could be submitted to /usr/src/test if needed.
#2 Updated by nthery almost 9 years ago
Please review the patch attached to
http://bugs.dragonflybsd.org/issue895. If there are no objections I
will commit it on Thursday, Jan 10.
It seems all BSDs leave select()'s timeout argument unchanged on
return (contrary to linux), so I don't intend anymore to "fix" dfly
with that respect.
#3 Updated by dillon almost 9 years ago
:Please review the patch attached to
:http://bugs.dragonflybsd.org/issue895. If there are no objections I
:will commit it on Thursday, Jan 10.
:It seems all BSDs leave select()'s timeout argument unchanged on
:return (contrary to linux), so I don't intend anymore to "fix" dfly
:with that respect.
It looks reasonable after a quick perusal.
select()'s timeout argument is always left unchanged. Linux originally
adjusted it on return but I was under the impression that they
reverted back to the BSD method of not touching it. The changing of
the timeout argument was a major mistake that linux made in their
implementation a long, long time ago.
#5 Updated by nthery almost 9 years ago
Thanks for the remark. I completely forgot linux emulation. The
pselect syscall was introduced in linux 2 years ago:
pselect() is still implemented by a wrapper in glibc though, at least
for debian 4.0. I'll try to implement the hook anyway.
Additionally, reading the linux pselect commit log revealed what
looks like a bug in my patch: if pselect() is interrupted by a signal
that was blocked prior to the call and unblocked by pselect(), the
syscall is interrupted but the signal handler is not called because
the patch restores the original mask before userret() is called.
pselect() should probably be implemented like sigsuspend() instead.
#6 Updated by nthery almost 9 years ago
Here is a new version of the patch that restores the original signal mask only
after executing signal handlers (if any). This is similar to what is done in
sigsuspend() and deals correctly with the case where pselect() is interrupted by
a signal blocked in the original mask.
#8 Updated by nthery almost 9 years ago
I discovered that DragonFly emulate linux 2.4.z but pselect was
introduced in linux 2.6.z. Furthermore, even recent distros (fedora
core 8) still implement pselect as a wrapper in glibc. So I can't
really add the pselect emulation hook for the time being.