Bug #895
closed
pselect(2) implementation
Added by nthery almost 17 years ago.
Updated about 16 years ago.
Description
Kernel-side pselect(2) implementation:
Add pselect() system call.
Factor out in doselect() code shared between select and pselect (was in
sys_select()).
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.
Test Strategy:
make buildworld && make buildkernel
Ran small test suite that could be submitted to /usr/src/test if needed.
Files
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.
Cheers,
Nicolas
:
: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.
:
:Cheers,
:Nicolas
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.
-Matt
Don't forget to add the hook to the Linux emulation layer for this system call.
Thanks for the remark. I completely forgot linux emulation. The
pselect syscall was introduced in linux 2 years ago:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.23.y.git;a=commit;h=9f72949f679df06021c9e43886c9191494fdb007
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.
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.
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.
Cheers,
Nicolas
Also available in: Atom
PDF