Update the sockets library code
* Passes conformance and functional tests. * Builds with GCC 4.4 compiler. Signed-off by: lpleahy git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12497 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -16,29 +16,30 @@
|
||||
|
||||
|
||||
/**
|
||||
Worker routine for ::Accept and ::AcceptNB
|
||||
Worker routine for ::accept and ::AcceptNB
|
||||
|
||||
@param [in] s Socket file descriptor returned from ::socket.
|
||||
@param [in] s Socket file descriptor returned from ::socket.
|
||||
|
||||
@param [in] bBlocking TRUE if this is a blocking call
|
||||
@param [in] address Address of a buffer to receive the remote network address.
|
||||
@param [in] bBlockingAllowed TRUE if this is a blocking call
|
||||
@param [in] address Address of a buffer to receive the remote network address.
|
||||
|
||||
@param [in, out] address_len Address of a buffer containing the Length in bytes
|
||||
of the remote network address buffer. Upon return,
|
||||
contains the length of the remote network address.
|
||||
|
||||
@return ::accept returns zero if successful and -1 when an error occurs.
|
||||
In the case of an error, errno contains more details.
|
||||
@return AcceptWork returns zero if successful and -1 when an error occurs.
|
||||
In the case of an error, ::errno contains more details.
|
||||
|
||||
**/
|
||||
int
|
||||
AcceptWork (
|
||||
int s,
|
||||
BOOLEAN bBlocking,
|
||||
BOOLEAN bBlockingAllowed,
|
||||
struct sockaddr * address,
|
||||
socklen_t * address_len
|
||||
)
|
||||
{
|
||||
BOOLEAN bBlocking;
|
||||
INT32 NewSocketFd;
|
||||
struct __filedes * pDescriptor;
|
||||
EFI_SOCKET_PROTOCOL * pNewSocket;
|
||||
@@ -58,8 +59,10 @@ AcceptWork (
|
||||
&errno );
|
||||
if ( NULL != pSocketProtocol ) {
|
||||
//
|
||||
// TODO: Update bBlocking by anding with check for NON_BLOCKING
|
||||
// Determine if the operation is blocking
|
||||
//
|
||||
bBlocking = (BOOLEAN)( 0 == ( pDescriptor->Oflags & O_NONBLOCK ));
|
||||
bBlocking &= bBlockingAllowed;
|
||||
|
||||
//
|
||||
// Attempt to accept a new network connection
|
||||
@@ -75,12 +78,14 @@ AcceptWork (
|
||||
//
|
||||
// Convert the protocol to a socket
|
||||
//
|
||||
NewSocketFd = BslSocketProtocolToFd ( pNewSocket, &errno );
|
||||
if ( -1 == NewSocketFd ) {
|
||||
//
|
||||
// Close the socket
|
||||
//
|
||||
BslSocketCloseWork ( pNewSocket, NULL );
|
||||
if ( !EFI_ERROR ( Status )) {
|
||||
NewSocketFd = BslSocketProtocolToFd ( pNewSocket, &errno );
|
||||
if ( -1 == NewSocketFd ) {
|
||||
//
|
||||
// Close the socket
|
||||
//
|
||||
BslSocketCloseWork ( pNewSocket, NULL );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,9 +99,10 @@ AcceptWork (
|
||||
/**
|
||||
Accept a network connection.
|
||||
|
||||
The ::accept routine waits for a network connection to the socket.
|
||||
It is able to return the remote network address to the caller if
|
||||
requested. The
|
||||
The accept routine waits for a network connection to the socket.
|
||||
It returns the remote network address to the caller if requested.
|
||||
|
||||
The
|
||||
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html">POSIX</a>
|
||||
documentation is available online.
|
||||
|
||||
@@ -108,8 +114,8 @@ AcceptWork (
|
||||
of the remote network address buffer. Upon return,
|
||||
contains the length of the remote network address.
|
||||
|
||||
@return ::accept returns zero if successful and -1 when an error occurs.
|
||||
In the case of an error, errno contains more details.
|
||||
@return The accept routine returns zero if successful and -1 when an error occurs.
|
||||
In the case of an error, ::errno contains more details.
|
||||
|
||||
**/
|
||||
int
|
||||
@@ -127,9 +133,7 @@ accept (
|
||||
|
||||
|
||||
/**
|
||||
Non blocking version of accept.
|
||||
|
||||
See ::accept
|
||||
Non blocking version of ::accept.
|
||||
|
||||
@param [in] s Socket file descriptor returned from ::socket.
|
||||
|
||||
@@ -140,7 +144,7 @@ accept (
|
||||
contains the length of the remote network address.
|
||||
|
||||
@return This routine returns zero if successful and -1 when an error occurs.
|
||||
In the case of an error, errno contains more details.
|
||||
In the case of an error, ::errno contains more details.
|
||||
|
||||
**/
|
||||
int
|
||||
|
Reference in New Issue
Block a user