d7ce7006 |
1 | /** @file\r |
2 | Implement the poll API.\r |
3 | \r |
4 | Copyright (c) 2011, Intel Corporation\r |
5 | All rights reserved. This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r |
7 | which accompanies this distribution. The full text of the license may be found at\r |
8 | http://opensource.org/licenses/bsd-license.php\r |
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 |
12 | \r |
13 | **/\r |
14 | \r |
15 | #include <SocketInternals.h>\r |
16 | \r |
17 | \r |
18 | /**\r |
19 | Poll the socket for activity\r |
20 | \r |
21 | @param [in] pDescriptor Descriptor address for the file\r |
22 | \r |
23 | @param [in] Events Mask of events to detect\r |
24 | \r |
7dc13291 |
25 | @return Detected events for the socket\r |
d7ce7006 |
26 | \r |
27 | **/\r |
28 | short\r |
29 | BslSocketPoll (\r |
30 | IN struct __filedes * pDescriptor,\r |
31 | IN short Events\r |
32 | )\r |
33 | {\r |
34 | short DetectedEvents;\r |
35 | EFI_SOCKET_PROTOCOL * pSocketProtocol;\r |
36 | EFI_STATUS Status;\r |
37 | \r |
38 | //\r |
39 | // Locate the socket protocol\r |
40 | //\r |
41 | DetectedEvents = 0;\r |
42 | pSocketProtocol = BslValidateSocketFd ( pDescriptor, &errno );\r |
43 | if ( NULL != pSocketProtocol ) {\r |
44 | //\r |
45 | // Poll the socket\r |
46 | //\r |
47 | Status = pSocketProtocol->pfnPoll ( pSocketProtocol,\r |
48 | Events,\r |
49 | &DetectedEvents,\r |
50 | &errno );\r |
51 | }\r |
52 | \r |
53 | //\r |
54 | // Return the detected events\r |
55 | //\r |
56 | return DetectedEvents;\r |
57 | }\r |