]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/BsdSocketLib/getsockopt.c
Fix send to properly wait while long transmits are in progress
[mirror_edk2.git] / StdLib / BsdSocketLib / getsockopt.c
CommitLineData
d7ce7006 1/** @file\r
2 Implement the getsockopt 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 Get the socket options\r
20\r
21 @param [in] s Socket file descriptor returned from ::socket.\r
22 @param [in] level Option protocol level\r
23 @param [in] option_name Name of the option\r
24 @param [out] option_value Buffer to receive the option value\r
25 @param [in,out] option_len Length of the buffer in bytes,\r
26 upon return length of the option value in bytes\r
27\r
28 @retval Zero (0) upon success\r
29 @retval Minus one (-1) upon failure, errno set with additional error information\r
30\r
31**/\r
32int\r
33getsockopt (\r
34 IN int s,\r
35 IN int level,\r
36 IN int option_name,\r
37 OUT void * __restrict option_value,\r
38 IN OUT socklen_t * __restrict option_len\r
39 )\r
40{\r
41 int OptionStatus;\r
42 EFI_SOCKET_PROTOCOL * pSocketProtocol;\r
43 EFI_STATUS Status;\r
44 \r
45 //\r
46 // Locate the context for this socket\r
47 //\r
48 pSocketProtocol = BslFdToSocketProtocol ( s, NULL, &errno );\r
49 if ( NULL != pSocketProtocol ) {\r
50 //\r
51 // Get the socket option\r
52 //\r
53 Status = pSocketProtocol->pfnOptionGet ( pSocketProtocol,\r
54 level,\r
55 option_name,\r
56 option_value,\r
57 option_len,\r
58 &errno );\r
59 }\r
60 \r
61 //\r
62 // Return the operation stauts\r
63 //\r
64 OptionStatus = ( 0 == errno ) ? 0 : -1;\r
65 return OptionStatus;\r
66}\r