4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Implement the close API.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Copyright (c) 2011, Intel Corporation
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync All rights reserved. This program and the accompanying materials
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync are licensed and made available under the terms and conditions of the BSD License
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync which accompanies this distribution. The full text of the license may be found at
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Worker routine to close the socket.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] pSocketProtocol Socket protocol structure address
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] pErrno Address of the ::errno variable
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_SUCCESS Successfully closed the socket
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Start closing the socket
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Status = pSocketProtocol->pfnCloseStart ( pSocketProtocol,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Wait for the socket to close or an error
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Status = pSocketProtocol->pfnClosePoll ( pSocketProtocol,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Locate the socket protocol
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Status = gBS->LocateProtocol ( &gEfiSocketServiceBindingProtocolGuid,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Release the handle
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Status = pServiceBinding->DestroyChild ( pServiceBinding,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync "ERROR - Failed to close the socket: %r\r\n",
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Return the close status
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Close the socket
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The BslSocketClose routine is called indirectly from the close file
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync system routine. This routine closes the socket and returns the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync status to the caller.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] pDescriptor Descriptor address for the file
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return This routine returns 0 upon success and -1 upon failure.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync In the case of failure, ::errno contains more information.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Locate the socket protocol
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pSocketProtocol = BslValidateSocketFd ( pDescriptor, &errno );
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Close the socket
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Return the close status