This commit modifies the Unix domain local socket design. Local sockets are built on top of pipes. The Local socket implementation maintained file descriptors to interrupt with the pipes. File descriptors have the bad property that they are valid only while running on the thread within the task that created the local socket.

As a policy, all internal OS implementations must use "detached" files which are valid in any context and do not depend on the validity of a file descriptor at any point in time.  This commit converts the usage of file descriptors to detached files throughout the local socket implementation.

Squashed commit of the following:

    net/local: Finish change to eliminate use of file descriptors.
    net/local:  A little more of the conversion.
    net/local: Beginning of chnages to eliminate use of file descriptors in the local socket implementeation. poll() will be a problem.
This commit is contained in:
Gregory Nutt
2017-11-02 08:23:38 -06:00
parent e5d7e4a12b
commit 21041af8a7
13 changed files with 121 additions and 104 deletions
+4 -4
View File
@@ -182,7 +182,7 @@ static int inline local_stream_connect(FAR struct local_conn_s *client,
goto errout_with_fifos;
}
DEBUGASSERT(client->lc_outfd >= 0);
DEBUGASSERT(client->lc_outfile.f_inode != NULL);
/* Add ourself to the list of waiting connections and notify the server. */
@@ -225,13 +225,13 @@ static int inline local_stream_connect(FAR struct local_conn_s *client,
goto errout_with_outfd;
}
DEBUGASSERT(client->lc_infd >= 0);
DEBUGASSERT(client->lc_infile.f_inode != NULL);
client->lc_state = LOCAL_STATE_CONNECTED;
return OK;
errout_with_outfd:
(void)close(client->lc_outfd);
client->lc_outfd = -1;
(void)file_close_detached(&client->lc_outfile);
client->lc_outfile.f_inode = NULL;
errout_with_fifos:
(void)local_release_fifos(client);