]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/BsdSocketLib/close.c
StdLib: Move GetPass.c out of Uefi and into PosixLib. Create LibPosix to contain...
[mirror_edk2.git] / StdLib / BsdSocketLib / close.c
index 7d70e4f12647b75b1e2b471fcf3635fafa715eb8..01eb48ecb58991a0f298eeaff86184532489ff27 100644 (file)
@@ -18,9 +18,9 @@
 /**\r
   Worker routine to close the socket.\r
 \r
-  @param [in] pSocketProtocol   Socket protocol structure address\r
+  @param[in] pSocketProtocol   Socket protocol structure address\r
 \r
-  @param [in] pErrno            Address of the errno variable\r
+  @param[in] pErrno            Address of the ::errno variable\r
 \r
   @retval EFI_SUCCESS   Successfully closed the socket\r
 \r
@@ -31,7 +31,6 @@ BslSocketCloseWork (
   IN int * pErrno\r
   )\r
 {\r
-  EFI_SERVICE_BINDING_PROTOCOL * pServiceBinding;\r
   EFI_STATUS Status;\r
 \r
   //\r
@@ -50,21 +49,9 @@ BslSocketCloseWork (
   }\r
   if ( !EFI_ERROR ( Status )) {\r
     //\r
-    //  Locate the socket protocol\r
+    //  Release the socket resources\r
     //\r
-    Status = gBS->LocateProtocol ( &gEfiSocketServiceBindingProtocolGuid,\r
-                                   NULL,\r
-                                   (VOID **) &pServiceBinding );\r
-    if ( !EFI_ERROR ( Status )) {\r
-      //\r
-      //  Release the handle\r
-      //\r
-      Status = pServiceBinding->DestroyChild ( pServiceBinding,\r
-                                               pSocketProtocol->SocketHandle );\r
-    }\r
-    if ( EFI_ERROR ( Status )) {\r
-      *pErrno = EIO;\r
-    }\r
+    *pErrno = EslServiceFreeProtocol ( pSocketProtocol );\r
   }\r
   else {\r
     DEBUG (( DEBUG_ERROR,\r
@@ -83,13 +70,18 @@ BslSocketCloseWork (
 /**\r
   Close the socket\r
 \r
-  @param [in] pDescriptor Descriptor address for the file\r
+  The BslSocketClose routine is called indirectly from the close file\r
+  system routine.  This routine closes the socket and returns the\r
+  status to the caller.\r
 \r
-  @returns  This routine returns 0 upon success and -1 upon failure.\r
-            In the case of failure, errno contains more information.\r
+  @param[in] pDescriptor Descriptor address for the file\r
+\r
+  @return   This routine returns 0 upon success and -1 upon failure.\r
+            In the case of failure, ::errno contains more information.\r
 \r
 **/\r
 int\r
+EFIAPI\r
 BslSocketClose (\r
   struct __filedes * pDescriptor\r
   )\r