1 /* vi: set sw=4 ts=4: */
5 * Copyright (C) 2007 by Denys Vlasenko <vda.linux@googlemail.com>
7 * Licensed under GPLv2, see file LICENSE in this source tree.
11 /* Wrapper which restarts poll on EINTR or ENOMEM.
12 * On other errors does perror("poll") and returns.
13 * Warning! May take longer than timeout_ms to return! */
14 int FAST_FUNC safe_poll(struct pollfd *ufds, nfds_t nfds, int timeout)
17 int n = poll(ufds, nfds, timeout);
20 /* Make sure we inch towards completion */
23 /* E.g. strace causes poll to return this */
26 /* Kernel is very low on memory. Retry. */
27 /* I doubt many callers would handle this correctly! */
30 bb_simple_perror_msg("poll");