]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/BsdSocketLib/poll.c
IntelFsp2WrapperPkg: Update gFspWrapperTokenSpaceGuid to gIntelFsp2WrapperTokenSpaceGuid.
[mirror_edk2.git] / StdLib / BsdSocketLib / poll.c
CommitLineData
d7ce7006 1/** @file\r
2 Implement the poll API.\r
3\r
beaaa3b7
OM
4 Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials are licensed and made available under\r
6 the terms and conditions of the BSD License that accompanies this distribution.\r
7 The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php.\r
d7ce7006 9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
d7ce7006 12**/\r
d7ce7006 13#include <SocketInternals.h>\r
14\r
15\r
beaaa3b7 16/** Poll the socket for activity\r
d7ce7006 17\r
18 @param [in] pDescriptor Descriptor address for the file\r
d7ce7006 19 @param [in] Events Mask of events to detect\r
20\r
7dc13291 21 @return Detected events for the socket\r
d7ce7006 22 **/\r
23short\r
7700f0f5 24EFIAPI\r
d7ce7006 25BslSocketPoll (\r
26 IN struct __filedes * pDescriptor,\r
27 IN short Events\r
28 )\r
29{\r
beaaa3b7 30 short DetectedEvents;\r
d7ce7006 31 EFI_SOCKET_PROTOCOL * pSocketProtocol;\r
d7ce7006 32\r
d7ce7006 33 // Locate the socket protocol\r
d7ce7006 34 DetectedEvents = 0;\r
35 pSocketProtocol = BslValidateSocketFd ( pDescriptor, &errno );\r
36 if ( NULL != pSocketProtocol ) {\r
d7ce7006 37 // Poll the socket\r
beaaa3b7
OM
38 (void) pSocketProtocol->pfnPoll ( pSocketProtocol,\r
39 Events,\r
40 &DetectedEvents,\r
41 &errno );\r
d7ce7006 42 }\r
d7ce7006 43 // Return the detected events\r
d7ce7006 44 return DetectedEvents;\r
45}\r