]>
Commit | Line | Data |
---|---|---|
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 | |
30 | ssize_t\r | |
7700f0f5 | 31 | EFIAPI\r |
d7ce7006 | 32 | BslSocketWrite (\r |
33 | struct __filedes *pDescriptor,\r | |
34 | off_t * pOffset,\r | |
35 | size_t LengthInBytes,\r | |
36 | const void * pBuffer\r | |
37 | )\r | |
38 | {\r | |
39 | ssize_t BytesWritten;\r | |
40 | \r | |
41 | //\r | |
42 | // Send the data using the socket\r | |
43 | //\r | |
44 | BytesWritten = send ( pDescriptor->MyFD,\r | |
45 | pBuffer,\r | |
46 | LengthInBytes,\r | |
47 | 0 );\r | |
48 | \r | |
49 | //\r | |
50 | // Return the number of bytes written\r | |
51 | //\r | |
52 | return BytesWritten;\r | |
53 | }\r |