VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/StdLib/BsdSocketLib/read.c@ 77775

Last change on this file since 77775 was 58459, checked in by vboxsync, 9 years ago

EFI/Firmware: 'svn merge /vendor/edk2/UDK2010.SR1 /vendor/edk2/current .', reverting and removing files+dirs listed in ReadMe.vbox, resolving conflicts with help from ../UDK2014.SP1/. This is a raw untested merge.

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1/** @file
2 Implement the read 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 Read support routine for sockets
20
21 The BslSocketRead routine is called indirectly by the read file
22 system routine. This routine is typically used for SOCK_STREAM
23 because it waits for receive data from the target system specified
24 in the ::connect call.
25
26 @param [in] pDescriptor Descriptor address for the file
27 @param [in] pOffset File offset
28 @param [in] LengthInBytes Number of bytes to read
29 @param [in] pBuffer Address of the buffer to receive the data
30
31 @return The number of bytes read or -1 if an error occurs.
32 In the case of an error, ::errno contains more details.
33
34**/
35ssize_t
36EFIAPI
37BslSocketRead (
38 struct __filedes *pDescriptor,
39 off_t * pOffset,
40 size_t LengthInBytes,
41 void * pBuffer
42 )
43{
44 ssize_t BytesRead;
45
46 //
47 // Receive the data from the remote system
48 //
49 BytesRead = recvfrom ( pDescriptor->MyFD,
50 pBuffer,
51 LengthInBytes,
52 0,
53 NULL,
54 NULL );
55
56 //
57 // Return the number of bytes read
58 //
59 return BytesRead;
60}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette