2008-11-16 19:48:29 +01:00
|
|
|
/****************************************************************************
|
2014-06-29 01:25:18 +02:00
|
|
|
* net/socket/net_poll.c
|
2008-11-16 19:48:29 +01:00
|
|
|
*
|
2021-02-19 12:45:37 +01: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
|
2008-11-16 19:48:29 +01:00
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2008-11-16 19:48:29 +01:00
|
|
|
*
|
2021-02-19 12:45:37 +01: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.
|
2008-11-16 19:48:29 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
2017-07-14 18:57:38 +02:00
|
|
|
#include <assert.h>
|
2008-11-16 19:48:29 +01:00
|
|
|
#include <errno.h>
|
2008-11-18 23:14:25 +01:00
|
|
|
|
2017-07-14 18:57:38 +02:00
|
|
|
#include <nuttx/net/net.h>
|
|
|
|
|
2014-06-29 01:25:18 +02:00
|
|
|
#include "socket/socket.h"
|
2008-11-16 19:48:29 +01:00
|
|
|
|
2008-11-18 18:30:30 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
2008-11-16 19:48:29 +01:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2017-04-22 00:33:14 +02:00
|
|
|
* Name: psock_poll
|
2008-11-16 19:48:29 +01:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* The standard poll() operation redirects operations on socket descriptors
|
|
|
|
* to this function.
|
|
|
|
*
|
2008-11-18 18:30:30 +01:00
|
|
|
* Input Parameters:
|
2013-01-24 20:19:38 +01:00
|
|
|
* psock - An instance of the internal socket structure.
|
2008-11-19 19:43:50 +01:00
|
|
|
* fds - The structure describing the events to be monitored, OR NULL if
|
|
|
|
* this is a request to stop monitoring events.
|
2009-12-15 16:57:25 +01:00
|
|
|
* setup - true: Setup up the poll; false: Teardown the poll
|
2008-11-16 19:48:29 +01:00
|
|
|
*
|
|
|
|
* Returned Value:
|
2008-11-18 18:30:30 +01:00
|
|
|
* 0: Success; Negated errno on failure
|
2008-11-16 19:48:29 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2013-01-24 20:19:38 +01:00
|
|
|
int psock_poll(FAR struct socket *psock, FAR struct pollfd *fds, bool setup)
|
2008-11-16 19:48:29 +01:00
|
|
|
{
|
2017-07-14 18:57:38 +02:00
|
|
|
DEBUGASSERT(psock != NULL && fds != NULL);
|
2017-03-31 16:58:14 +02:00
|
|
|
|
2017-07-14 18:57:38 +02:00
|
|
|
/* Let the address family's poll() method handle the operation */
|
2013-05-23 15:16:46 +02:00
|
|
|
|
2017-07-14 18:57:38 +02:00
|
|
|
DEBUGASSERT(psock->s_sockif != NULL && psock->s_sockif->si_poll != NULL);
|
|
|
|
return psock->s_sockif->si_poll(psock, fds, setup);
|
2013-01-24 20:19:38 +01:00
|
|
|
}
|