mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-23 03:13:58 +08:00
dhcpcd: Honour file descriptor maximum
This commit is contained in:
parent
9a583a94d3
commit
7ec4d8760d
@ -35,18 +35,32 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "pollts.h"
|
#include "pollts.h"
|
||||||
|
#ifdef __rtems__
|
||||||
|
#include <string.h>
|
||||||
|
#include <rtems/libio_.h>
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
int
|
int
|
||||||
pollts(struct pollfd *restrict fds, nfds_t nfds,
|
pollts(struct pollfd *restrict fds, nfds_t nfds,
|
||||||
const struct timespec *restrict ts, const sigset_t *restrict sigmask)
|
const struct timespec *restrict ts, const sigset_t *restrict sigmask)
|
||||||
{
|
{
|
||||||
|
#ifndef __rtems__
|
||||||
fd_set read_fds;
|
fd_set read_fds;
|
||||||
|
#else /* __rtems__ */
|
||||||
|
fd_set big_enough_read_fs[howmany(rtems_libio_number_iops,
|
||||||
|
sizeof(fd_set) * 8)];
|
||||||
|
#define read_fds (*(fd_set *)(&big_enough_read_fs[0]))
|
||||||
|
#endif /* __rtems__ */
|
||||||
nfds_t n;
|
nfds_t n;
|
||||||
int maxfd, r;
|
int maxfd, r;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
struct timeval *tvp;
|
struct timeval *tvp;
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
FD_ZERO(&read_fds);
|
FD_ZERO(&read_fds);
|
||||||
|
#else /* __rtems__ */
|
||||||
|
memset(big_enough_read_fs, 0, sizeof(big_enough_read_fs));
|
||||||
|
#endif /* __rtems__ */
|
||||||
maxfd = 0;
|
maxfd = 0;
|
||||||
for (n = 0; n < nfds; n++) {
|
for (n = 0; n < nfds; n++) {
|
||||||
if (fds[n].events & POLLIN) {
|
if (fds[n].events & POLLIN) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user