Commit Graph

16 Commits

Author SHA1 Message Date
Pierre Ossman d9df5689c2
Avoid assuming layout of fd_set
POSIX doesn't specify the internal layout of the fd_set object, so let's
not assume it is just a bit mask. This increases compatibility with
systems that have a different layout.

The assumption is also worthless as we already refuse to use file
descriptors over FD_SETSIZE anyway. Meaning that the default size of
fd_set is quite sufficient.
2022-11-08 19:33:47 +11:00
Darren Tucker 90452c8b69 Only return events from ppoll that were requested.
If the underlying system's select() returns bits that were not in the
request set, our ppoll() implementation can return revents for events
not requested, which can apparently cause a hang.  Only return revents
for activity in the requested event set.  bz#3416, analysis and fix by
yaroslav.kuzmin at vmssoftware com, ok djm@
2022-04-01 23:38:44 +11:00
Darren Tucker a4b325a3fc Include sys/param.h if present.
Needed for howmany() on MUSL systems such as Alpine.
2022-02-22 12:27:07 +11:00
Damien Miller a1d42a6ce0 fix edge case in poll(2) wrapper
Correct handling of select(2) exceptfds. These should only be consulted
for POLLPRI flagged pfds and not unconditionally converted to POLLERR.

with and ok dtucker@
2022-01-14 14:09:38 +11:00
Damien Miller 61a1a6af22 OS X poll(2) is broken; use compat replacement
Darwin's poll(2) implementation is broken. For character-special
devices like /dev/null, it returns POLLNVAL when polled with
POLLIN.

Apparently this is Apple bug 3710161, which is AFAIK not public,
but a websearch will find other OSS projects rediscovering it
periodically since it was first identified in 2005 (!!)
2022-01-12 09:02:36 +11:00
Darren Tucker 5a0f461904 Correct ifdef to activate poll() only if needed. 2021-11-28 15:31:37 +11:00
Darren Tucker b7ffbb17e3 Allow for fd = -1 in compat ppoll overflow check.
Fixes tests on at least FreeBSD 6, possibly others.
2021-11-19 18:54:34 +11:00
Darren Tucker d902d728df Correct calculation of tv_nsec in poll(). 2021-11-18 23:44:07 +11:00
Darren Tucker 21dd5a9a3f Add compat implementation of ppoll using pselect. 2021-11-18 23:11:37 +11:00
Darren Tucker 1e8013a17f Remove obsolete CVS $Id from source files.
Since -portable switched to git the CVS $Id tags are no longer being
updated and are becoming increasingly misleading.  Remove them.
2016-08-17 14:08:42 +10:00
Darren Tucker 8d36f9ac71 - (dtucker) [openbsd-compat/bsd-poll.c] Don't bother checking for non-NULL
before freeing since free(NULL) is a no-op.  ok djm.
2014-02-06 10:44:13 +11:00
Darren Tucker 8c333ec23b - (dtucker) [openbsd-compat/bsd-poll.c] Add headers to prevent compile
warnings.
2013-11-08 21:12:58 +11:00
Darren Tucker 661f63b7d2 - (dtucker) [openbsd-compat/bsd-poll.c] correctly check for number of FDs
larger than FD_SETSIZE (OpenSSH only ever uses poll with one fd).  Patch
   from Nicholas Marriott.
2008-08-30 07:32:37 +10:00
Damien Miller 55754fb002 - (djm) [openbsd-compat/bsd-poll.c] Include stdlib.h to avoid compile-
time warnings on LynxOS. Patch from ops AT iki.fi
2008-04-04 16:16:35 +11:00
Darren Tucker 7ec8733247 - (dtucker) [openbsd-compat/bsd-poll.c] We don't check for select(2) in
configure (and there's not much point, as openssh won't work without it)
   so HAVE_SELECT is not defined and the poll(2) compat code doesn't get
   built in.  Remove HAVE_SELECT so we can build on platforms without poll.
2008-02-29 13:57:47 +11:00
Darren Tucker febf0f5668 - (dtucker) [atomicio.c configure.ac openbsd-compat/Makefile.in
openbsd-compat/bsd-poll.{c,h} openbsd-compat/openbsd-compat.h]
   Add an implementation of poll() built on top of select(2).  Code from
   OpenNTPD with changes suggested by djm.  ok djm@
2007-06-25 22:15:12 +10:00