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