dup() and dup2() support for socket descriptors

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1884 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2009-06-15 18:58:22 +00:00
parent 613d405fd4
commit fdf76b48bc
23 changed files with 948 additions and 126 deletions
+12 -1
View File
@@ -149,6 +149,14 @@ static int accept_interrupt(struct uip_conn *listener, struct uip_conn *conn)
pstate->acpt_newconn = conn;
pstate->acpt_result = OK;
/* Set a reference of one on the new connection */
DEBUGASSERT(conn->crefs == 0);
conn->crefs = 1;
/* Wake-up the waiting caller thread */
sem_post(&pstate->acpt_sem);
/* Stop any further callbacks */
@@ -405,7 +413,10 @@ int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
}
irqrestore(save);
/* Initialize the socket structure and mark the socket as connected */
/* Initialize the socket structure and mark the socket as connected.
* (The reference count on the new connection structure was set in the
* interrupt handler).
*/
pnewsock->s_type = SOCK_STREAM;
pnewsock->s_conn = state.acpt_newconn;