>Number:         162379
>Category:       kern
>Synopsis:       When select(2) closed writing pipe, it will sticks.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 08 17:00:25 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Yui NARUSE
>Release:        FreeBSD 8.2
>Organization:
>Environment:
FreeBSD freebsd82-64 8.2-RELEASE-p3 FreeBSD 8.2-RELEASE-p3 #0: Tue Sep 27 
18:45:57 UTC 2011     
r...@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
When select(2) closed writing pipe, it will sticks.

FreeBSD 9.0-RC1 also reproduces this.
>How-To-Repeat:
Run following program, it will sticks.

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/select.h>
#define max(x,y) ((x > y) ? x : y)
int
main(void) {
    int pipes[2];
    int res = pipe(pipes);
    if (res != 0) abort();
    int r = pipes[0];
    int w = pipes[1];
    res = close(w);
    if (res != 0) abort();
    fd_set readfds; FD_ZERO(&readfds);
    fd_set writefds; FD_ZERO(&writefds);
    fd_set exceptfds; FD_ZERO(&exceptfds);
    FD_SET(w, &writefds);
    res = select(max(r,w)+1, &readfds, &writefds, &exceptfds, NULL);
    if (res) perror("select");
    return 0;
}
>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to