]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/BsdSocketLib/write.c
Fix some errors detected by the GCC 4.4 compiler.
[mirror_edk2.git] / StdLib / BsdSocketLib / write.c
CommitLineData
d7ce7006 1/** @file\r
2 Implement the write 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 Write support routine for sockets\r
20\r
21 @param [in] pDescriptor Descriptor address for the file\r
22 @param [in] pOffset File offset\r
23 @param [in] LengthInBytes Number of bytes to write\r
24 @param [in] pBuffer Address of the data\r
25\r
7dc13291 26 @return The number of bytes written or -1 if an error occurs.\r
a88c3163 27 In the case of an error, ::errno contains more details.\r
d7ce7006 28\r
29**/\r
30ssize_t\r
31BslSocketWrite (\r
32 struct __filedes *pDescriptor,\r
33 off_t * pOffset,\r
34 size_t LengthInBytes,\r
35 const void * pBuffer\r
36 )\r
37{\r
38 ssize_t BytesWritten;\r
39\r
40 //\r
41 // Send the data using the socket\r
42 //\r
43 BytesWritten = send ( pDescriptor->MyFD,\r
44 pBuffer,\r
45 LengthInBytes,\r
46 0 );\r
47\r
48 //\r
49 // Return the number of bytes written\r
50 //\r
51 return BytesWritten;\r
52}\r