| Summary: | system queue is cleared when a port or pipe is rebinded to another user processor. | ||
|---|---|---|---|
| Product: | Base System | Reporter: | xshen <xshen> |
| Component: | kern | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 3.1-RELEASE | ||
| Hardware: | Any | ||
| OS: | Any | ||
Responsible Changed From-To: gnats-admin->freebsd-bugs Misfiled PR State Changed From-To: open->closed This is a question, not a problem report. |
* run a small server-client program based on UNIX Domain Socket on FreeBSD; * server close the listen socket after the completion of one connection; * client forks several children to connect to the server concurrently; * Not all the clients' connections will be handled by the server because the closing listening socket causes kernel clear the system queue and all other requests in it. * run the same program on Linux and Solaris the contents of the system queue can be preserved for a while, and the system queue has nothing to do with close() by user processes. * If I want to keep the contents of the queue on FreeBSD, what should I do? Fix: Not available yet. How-To-Repeat: Server: char LINK_FILE[]="foo"; int listen_socket, conn_socket, clilen; fd_set rset; sockaddr_un addr1, addr2; for(;;){ unlink(LINK_FILE); listen_socket = socket(AF_UNIX, SOCK_STREAM, 0); bzero(&addr1, sizeof(addr1)); addr1.sun_family = AF_UNIX; strncpy(addr1.sun_path, LINK_FILE, sizeof(addr1.sun_path)-1); bind(listen_socket, (struct sockaddr *)&addr1, SUN_LEN(&addr1)); FD_ZERO(&rset); listen(listen_socket, 5); FD_SET(listen_socket, &rset); if((nready=select(listen_socket+1,&rset,NULL,NULL,NULL))>0){ if(FD_ISSET(listen_socket, &rset)){ clilen = sizeof(addr2); conn_socket=accept(listen_socket,(struct sockaddr *)&addr2,&clilen); read(conn_socket, pin, 1024); write(conn_socket, pout, 1024); close(conn_socket); close(listen_socket); } } } client: int total, child, sock; for(total=0; total<child; total++){ if(!fork()){ sock = open_socket(total); write(sock, pout, 1024); read(sock, pin, 1024); close(sock); } } do{ wait(&status); k++; }while(k<child);