2015-08-10 18:38:41 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* fs/vfs/fs_epoll.c
|
|
|
|
*
|
2021-09-01 13:36:03 +02:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2015-08-10 18:38:41 +02:00
|
|
|
*
|
2021-09-01 13:36:03 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2015-08-10 18:38:41 +02:00
|
|
|
*
|
2021-09-01 13:36:03 +02:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2015-08-10 18:38:41 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
2015-08-10 18:41:58 +02:00
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <sys/epoll.h>
|
|
|
|
|
2020-11-20 10:05:35 +01:00
|
|
|
#include <inttypes.h>
|
2015-08-10 18:38:41 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <poll.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
2015-08-10 18:41:58 +02:00
|
|
|
#include <debug.h>
|
2022-01-26 14:36:49 +01:00
|
|
|
#include <semaphore.h>
|
2015-08-10 18:38:41 +02:00
|
|
|
|
2020-12-23 03:45:10 +01:00
|
|
|
#include <nuttx/clock.h>
|
|
|
|
#include <nuttx/fs/fs.h>
|
2016-07-16 15:02:06 +02:00
|
|
|
#include <nuttx/kmalloc.h>
|
|
|
|
|
2021-03-12 08:52:19 +01:00
|
|
|
#include "inode/inode.h"
|
|
|
|
|
2020-08-20 19:37:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Private Types
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
struct epoll_head
|
|
|
|
{
|
|
|
|
int size;
|
|
|
|
int occupied;
|
2022-01-26 14:36:49 +01:00
|
|
|
int crefs;
|
|
|
|
sem_t sem;
|
2020-12-23 03:45:10 +01:00
|
|
|
struct file fp;
|
|
|
|
struct inode in;
|
2020-08-20 19:37:17 +02:00
|
|
|
FAR epoll_data_t *data;
|
|
|
|
FAR struct pollfd *poll;
|
|
|
|
};
|
|
|
|
|
2020-12-23 03:45:10 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Private Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
2022-01-26 14:36:49 +01:00
|
|
|
static int epoll_do_open(FAR struct file *filep);
|
2021-03-12 08:52:19 +01:00
|
|
|
static int epoll_do_close(FAR struct file *filep);
|
|
|
|
static int epoll_do_poll(FAR struct file *filep,
|
|
|
|
FAR struct pollfd *fds, bool setup);
|
2020-12-23 03:45:10 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Private Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
static const struct file_operations g_epoll_ops =
|
|
|
|
{
|
2022-01-26 14:36:49 +01:00
|
|
|
epoll_do_open, /* open */
|
2022-01-10 15:51:17 +01:00
|
|
|
epoll_do_close, /* close */
|
|
|
|
NULL, /* read */
|
|
|
|
NULL, /* write */
|
|
|
|
NULL, /* seek */
|
|
|
|
NULL, /* ioctl */
|
|
|
|
epoll_do_poll /* poll */
|
|
|
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
|
|
|
, NULL /* unlink */
|
|
|
|
#endif
|
2020-12-23 03:45:10 +01:00
|
|
|
};
|
|
|
|
|
2022-03-16 15:48:54 +01:00
|
|
|
static struct inode g_epoll_inode =
|
|
|
|
{
|
2022-03-26 21:51:22 +01:00
|
|
|
NULL, /* i_parent */
|
|
|
|
NULL, /* i_peer */
|
|
|
|
NULL, /* i_child */
|
|
|
|
1, /* i_crefs */
|
|
|
|
FSNODEFLAG_TYPE_DRIVER, /* i_flags */
|
|
|
|
{
|
|
|
|
&g_epoll_ops /* u */
|
|
|
|
}
|
2022-03-16 15:48:54 +01:00
|
|
|
};
|
|
|
|
|
2020-12-23 03:45:10 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Private Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-03-12 08:52:19 +01:00
|
|
|
static FAR struct epoll_head *epoll_head_from_fd(int fd)
|
2020-12-23 03:45:10 +01:00
|
|
|
{
|
2021-03-12 08:52:19 +01:00
|
|
|
FAR struct file *filep;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* Get file pointer by file descriptor */
|
|
|
|
|
|
|
|
ret = fs_getfilep(fd, &filep);
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
set_errno(-ret);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check fd come from us */
|
|
|
|
|
2021-07-23 11:30:05 +02:00
|
|
|
if (!filep->f_inode || filep->f_inode->u.i_ops != &g_epoll_ops)
|
2021-03-12 08:52:19 +01:00
|
|
|
{
|
|
|
|
set_errno(EBADF);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2022-03-16 15:48:54 +01:00
|
|
|
return (FAR struct epoll_head *)filep->f_priv;
|
2020-12-23 03:45:10 +01:00
|
|
|
}
|
|
|
|
|
2022-01-26 14:36:49 +01:00
|
|
|
static int epoll_do_open(FAR struct file *filep)
|
|
|
|
{
|
2022-03-16 15:48:54 +01:00
|
|
|
FAR struct epoll_head *eph = filep->f_priv;
|
2022-01-26 14:36:49 +01:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = nxsem_wait(&eph->sem);
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
eph->crefs++;
|
|
|
|
nxsem_post(&eph->sem);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2021-03-12 08:52:19 +01:00
|
|
|
static int epoll_do_close(FAR struct file *filep)
|
|
|
|
{
|
2022-03-16 15:48:54 +01:00
|
|
|
FAR struct epoll_head *eph = filep->f_priv;
|
2022-01-26 14:36:49 +01:00
|
|
|
int ret;
|
2015-08-10 18:38:41 +02:00
|
|
|
|
2022-01-26 14:36:49 +01:00
|
|
|
ret = nxsem_wait(&eph->sem);
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
eph->crefs--;
|
|
|
|
nxsem_post(&eph->sem);
|
|
|
|
if (eph->crefs <= 0)
|
|
|
|
{
|
|
|
|
kmm_free(eph);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2021-03-12 08:52:19 +01:00
|
|
|
}
|
2015-08-10 18:38:41 +02:00
|
|
|
|
2021-03-12 08:52:19 +01:00
|
|
|
static int epoll_do_poll(FAR struct file *filep,
|
|
|
|
FAR struct pollfd *fds, bool setup)
|
|
|
|
{
|
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int epoll_do_create(int size, int flags)
|
2015-08-10 18:38:41 +02:00
|
|
|
{
|
2020-12-23 03:45:10 +01:00
|
|
|
FAR struct epoll_head *eph;
|
|
|
|
int reserve = size + 1;
|
2021-03-12 08:52:19 +01:00
|
|
|
int fd;
|
2020-12-23 03:45:10 +01:00
|
|
|
|
|
|
|
eph = (FAR struct epoll_head *)
|
|
|
|
kmm_zalloc(sizeof(struct epoll_head) +
|
|
|
|
sizeof(epoll_data_t) * reserve +
|
|
|
|
sizeof(struct pollfd) * reserve);
|
2021-03-12 08:52:19 +01:00
|
|
|
if (eph == NULL)
|
|
|
|
{
|
|
|
|
set_errno(ENOMEM);
|
|
|
|
return -1;
|
|
|
|
}
|
2015-08-10 18:38:41 +02:00
|
|
|
|
2022-01-26 14:36:49 +01:00
|
|
|
nxsem_init(&eph->sem, 0, 0);
|
|
|
|
nxsem_set_protocol(&eph->sem, SEM_PRIO_NONE);
|
2015-08-10 18:38:41 +02:00
|
|
|
eph->size = size;
|
2020-08-20 19:37:17 +02:00
|
|
|
eph->data = (FAR epoll_data_t *)(eph + 1);
|
2020-12-23 03:45:10 +01:00
|
|
|
eph->poll = (FAR struct pollfd *)(eph->data + reserve);
|
|
|
|
|
|
|
|
INODE_SET_DRIVER(&eph->in);
|
|
|
|
eph->in.u.i_ops = &g_epoll_ops;
|
|
|
|
eph->fp.f_inode = &eph->in;
|
|
|
|
eph->in.i_private = eph;
|
|
|
|
|
|
|
|
eph->poll[0].ptr = &eph->fp;
|
|
|
|
eph->poll[0].events = POLLIN | POLLFILE;
|
2016-07-16 15:02:06 +02:00
|
|
|
|
2021-03-12 08:52:19 +01:00
|
|
|
/* Alloc the file descriptor */
|
|
|
|
|
2022-03-16 15:48:54 +01:00
|
|
|
fd = files_allocate(&g_epoll_inode, flags, 0, eph, 0);
|
2021-03-12 08:52:19 +01:00
|
|
|
if (fd < 0)
|
|
|
|
{
|
2022-01-26 14:36:49 +01:00
|
|
|
nxsem_destroy(&eph->sem);
|
2021-03-12 08:52:19 +01:00
|
|
|
kmm_free(eph);
|
|
|
|
set_errno(-fd);
|
|
|
|
return -1;
|
|
|
|
}
|
2015-08-10 18:38:41 +02:00
|
|
|
|
2022-03-16 15:48:54 +01:00
|
|
|
inode_addref(&g_epoll_inode);
|
2022-01-26 14:36:49 +01:00
|
|
|
nxsem_post(&eph->sem);
|
2021-03-12 08:52:19 +01:00
|
|
|
return fd;
|
2015-08-10 18:38:41 +02:00
|
|
|
}
|
|
|
|
|
2020-08-17 04:58:27 +02:00
|
|
|
/****************************************************************************
|
2021-03-12 08:52:19 +01:00
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: epoll_create
|
2020-08-17 04:58:27 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-03-12 08:52:19 +01:00
|
|
|
int epoll_create(int size)
|
2020-08-17 04:58:27 +02:00
|
|
|
{
|
2021-03-12 08:52:19 +01:00
|
|
|
return epoll_do_create(size, 0);
|
|
|
|
}
|
2020-08-17 04:58:27 +02:00
|
|
|
|
2021-03-12 08:52:19 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: epoll_create1
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2020-08-17 04:58:27 +02:00
|
|
|
|
2021-03-12 08:52:19 +01:00
|
|
|
int epoll_create1(int flags)
|
|
|
|
{
|
|
|
|
return epoll_do_create(CONFIG_FS_NEPOLL_DESCRIPTORS, flags);
|
2020-08-17 04:58:27 +02:00
|
|
|
}
|
|
|
|
|
2015-08-10 18:38:41 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: epoll_close
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void epoll_close(int epfd)
|
|
|
|
{
|
2021-03-12 08:52:19 +01:00
|
|
|
close(epfd);
|
2015-08-10 18:38:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: epoll_ctl
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int epoll_ctl(int epfd, int op, int fd, struct epoll_event *ev)
|
|
|
|
{
|
2021-03-12 08:52:19 +01:00
|
|
|
FAR struct epoll_head *eph;
|
2020-12-23 03:41:13 +01:00
|
|
|
int i;
|
2015-08-10 18:38:41 +02:00
|
|
|
|
2021-03-12 08:52:19 +01:00
|
|
|
eph = epoll_head_from_fd(epfd);
|
|
|
|
if (eph == NULL)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2015-08-10 18:38:41 +02:00
|
|
|
switch (op)
|
|
|
|
{
|
|
|
|
case EPOLL_CTL_ADD:
|
2020-11-20 10:05:35 +01:00
|
|
|
finfo("%08x CTL ADD(%d): fd=%d ev=%08" PRIx32 "\n",
|
2015-08-10 18:41:58 +02:00
|
|
|
epfd, eph->occupied, fd, ev->events);
|
2020-12-23 03:41:13 +01:00
|
|
|
if (eph->occupied >= eph->size)
|
|
|
|
{
|
|
|
|
set_errno(ENOMEM);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2020-12-23 03:45:10 +01:00
|
|
|
for (i = 1; i <= eph->occupied; i++)
|
2020-12-23 03:41:13 +01:00
|
|
|
{
|
|
|
|
if (eph->poll[i].fd == fd)
|
|
|
|
{
|
|
|
|
set_errno(EEXIST);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
2015-08-10 18:38:41 +02:00
|
|
|
|
2020-12-23 03:45:10 +01:00
|
|
|
eph->data[++eph->occupied] = ev->data;
|
2022-10-01 23:45:06 +02:00
|
|
|
eph->poll[eph->occupied].events = ev->events;
|
2020-12-23 03:45:10 +01:00
|
|
|
eph->poll[eph->occupied].fd = fd;
|
2020-12-23 03:41:13 +01:00
|
|
|
|
|
|
|
break;
|
2015-08-10 18:38:41 +02:00
|
|
|
|
|
|
|
case EPOLL_CTL_DEL:
|
2020-12-23 03:45:10 +01:00
|
|
|
for (i = 1; i <= eph->occupied; i++)
|
2020-12-23 03:41:13 +01:00
|
|
|
{
|
|
|
|
if (eph->poll[i].fd == fd)
|
|
|
|
{
|
2021-03-12 08:52:55 +01:00
|
|
|
if (i != eph->occupied)
|
2020-12-23 03:41:13 +01:00
|
|
|
{
|
|
|
|
memmove(&eph->data[i], &eph->data[i + 1],
|
|
|
|
sizeof(epoll_data_t) * (eph->occupied - i));
|
|
|
|
memmove(&eph->poll[i], &eph->poll[i + 1],
|
|
|
|
sizeof(struct pollfd) * (eph->occupied - i));
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-12 06:24:21 +01:00
|
|
|
if (i > eph->occupied)
|
|
|
|
{
|
|
|
|
set_errno(ENOENT);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
eph->occupied--;
|
|
|
|
break;
|
2015-08-10 18:38:41 +02:00
|
|
|
|
|
|
|
case EPOLL_CTL_MOD:
|
2020-12-23 03:41:13 +01:00
|
|
|
finfo("%08x CTL MOD(%d): fd=%d ev=%08" PRIx32 "\n",
|
|
|
|
epfd, eph->occupied, fd, ev->events);
|
2020-12-23 03:45:10 +01:00
|
|
|
for (i = 1; i <= eph->occupied; i++)
|
2020-12-23 03:41:13 +01:00
|
|
|
{
|
|
|
|
if (eph->poll[i].fd == fd)
|
|
|
|
{
|
|
|
|
eph->data[i] = ev->data;
|
2022-10-01 23:45:06 +02:00
|
|
|
eph->poll[i].events = ev->events;
|
2020-12-23 03:41:13 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-12 06:24:21 +01:00
|
|
|
if (i > eph->occupied)
|
|
|
|
{
|
|
|
|
set_errno(ENOENT);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
2020-12-23 03:41:13 +01:00
|
|
|
|
|
|
|
default:
|
|
|
|
set_errno(EINVAL);
|
|
|
|
return -1;
|
2015-08-10 18:38:41 +02:00
|
|
|
}
|
|
|
|
|
2022-10-01 23:49:40 +02:00
|
|
|
poll_notify(&eph->poll, 1, POLLIN);
|
2020-12-23 03:41:13 +01:00
|
|
|
return 0;
|
2015-08-10 18:38:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2020-08-16 19:00:36 +02:00
|
|
|
* Name: epoll_pwait
|
2015-08-10 18:38:41 +02:00
|
|
|
****************************************************************************/
|
|
|
|
|
2020-08-16 19:00:36 +02:00
|
|
|
int epoll_pwait(int epfd, FAR struct epoll_event *evs,
|
|
|
|
int maxevents, int timeout, FAR const sigset_t *sigmask)
|
2015-08-10 18:38:41 +02:00
|
|
|
{
|
2021-03-12 08:52:19 +01:00
|
|
|
FAR struct epoll_head *eph;
|
2020-12-23 03:45:10 +01:00
|
|
|
struct timespec expire;
|
|
|
|
struct timespec curr;
|
|
|
|
struct timespec diff;
|
2017-07-22 16:52:14 +02:00
|
|
|
int counter;
|
2015-08-10 18:38:41 +02:00
|
|
|
int rc;
|
2016-07-16 15:02:06 +02:00
|
|
|
int i;
|
2015-08-10 18:38:41 +02:00
|
|
|
|
2021-03-12 08:52:19 +01:00
|
|
|
eph = epoll_head_from_fd(epfd);
|
|
|
|
if (eph == NULL)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2020-12-23 03:45:10 +01:00
|
|
|
if (timeout >= 0)
|
|
|
|
{
|
|
|
|
expire.tv_sec = timeout / 1000;
|
|
|
|
expire.tv_nsec = timeout % 1000 * 1000;
|
|
|
|
|
2022-02-22 18:35:23 +01:00
|
|
|
clock_systime_timespec(&curr);
|
2020-12-23 03:45:10 +01:00
|
|
|
clock_timespec_add(&curr, &expire, &expire);
|
|
|
|
}
|
|
|
|
|
|
|
|
again:
|
2020-08-16 19:00:36 +02:00
|
|
|
if (timeout < 0)
|
|
|
|
{
|
2020-12-23 03:45:10 +01:00
|
|
|
rc = ppoll(eph->poll, eph->occupied + 1, NULL, sigmask);
|
2020-08-16 19:00:36 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-02-22 18:35:23 +01:00
|
|
|
clock_systime_timespec(&curr);
|
2020-12-23 03:45:10 +01:00
|
|
|
clock_timespec_subtract(&expire, &curr, &diff);
|
|
|
|
|
|
|
|
rc = ppoll(eph->poll, eph->occupied + 1, &diff, sigmask);
|
2020-08-16 19:00:36 +02:00
|
|
|
}
|
2015-08-10 18:38:41 +02:00
|
|
|
|
|
|
|
if (rc <= 0)
|
|
|
|
{
|
2020-12-23 03:45:10 +01:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
else if (eph->poll[0].revents != 0)
|
|
|
|
{
|
|
|
|
if (--rc == 0)
|
2015-08-10 18:38:41 +02:00
|
|
|
{
|
2020-12-23 03:45:10 +01:00
|
|
|
goto again;
|
2015-08-10 18:38:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-15 22:05:24 +02:00
|
|
|
if (rc > maxevents)
|
|
|
|
{
|
|
|
|
rc = maxevents;
|
|
|
|
}
|
|
|
|
|
2020-12-23 03:45:10 +01:00
|
|
|
/* Iterate over non NULL event fds */
|
|
|
|
|
|
|
|
for (i = 0, counter = 1; i < rc && counter <= eph->occupied; counter++)
|
2015-08-10 18:38:41 +02:00
|
|
|
{
|
2020-08-20 19:37:17 +02:00
|
|
|
if (eph->poll[counter].revents != 0)
|
2017-07-22 16:52:14 +02:00
|
|
|
{
|
2020-08-20 19:37:17 +02:00
|
|
|
evs[i].data = eph->data[counter];
|
|
|
|
evs[i++].events = eph->poll[counter].revents;
|
|
|
|
if (eph->poll[counter].events & EPOLLONESHOT)
|
2020-08-16 19:32:21 +02:00
|
|
|
{
|
2020-08-20 19:37:17 +02:00
|
|
|
eph->poll[counter].events = 0; /* Disable oneshot internally */
|
2020-08-16 19:32:21 +02:00
|
|
|
}
|
2017-07-22 16:52:14 +02:00
|
|
|
}
|
2015-08-10 18:38:41 +02:00
|
|
|
}
|
|
|
|
|
2017-07-22 16:52:14 +02:00
|
|
|
return i;
|
2015-08-10 18:38:41 +02:00
|
|
|
}
|
2020-08-16 19:00:36 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: epoll_wait
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int epoll_wait(int epfd, FAR struct epoll_event *evs,
|
|
|
|
int maxevents, int timeout)
|
|
|
|
{
|
|
|
|
return epoll_pwait(epfd, evs, maxevents, timeout, NULL);
|
|
|
|
}
|