From ino-Edb7a9ff@spotteswoode.dnsalias.org  Mon Jan 14 15:38:03 2002
Return-Path: <ino-Edb7a9ff@spotteswoode.dnsalias.org>
Received: from mailout05.sul.t-online.com (mailout05.sul.t-online.com [194.25.134.82])
	by hub.freebsd.org (Postfix) with ESMTP id 47D4737B417
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 14 Jan 2002 15:38:00 -0800 (PST)
Received: from fwd08.sul.t-online.de 
	by mailout05.sul.t-online.com with smtp 
	id 16QGfv-0006VX-04; Tue, 15 Jan 2002 00:37:59 +0100
Received: from spotteswoode.dnsalias.org (520082050842-0001@[62.226.125.156]) by fmrl08.sul.t-online.com
	with smtp id 16QGfr-0M7bwuC; Tue, 15 Jan 2002 00:37:55 +0100
Received: (qmail 17340 invoked by uid 0); 14 Jan 2002 23:37:54 -0000
Message-Id: <20020114233754.GO590@spotteswoode.dnsalias.org>
Date: Tue, 15 Jan 2002 00:37:54 +0100
From: clemensF <ino-Edb7a9ff@spotteswoode.dnsalias.org>
To: FreeBSD-gnats-submit@freebsd.org
Subject: poll(2) on fifos is broken
X-Send-Pr-Version: 3.113

>Number:         33903
>Category:       kern
>Synopsis:       poll(2) on fifos is broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 14 15:40:02 PST 2002
>Closed-Date:    Thu Jan 24 03:06:42 PST 2002
>Last-Modified:  Wed Oct 26 05:08:14 GMT 2005
>Originator:     
>Release:        
>Organization:
>Environment:
>Description:
 Submitter-Id:	current-users
 Originator:	Tip Chap
 Organization:	no
 Confidential:	no <FreeBSD PRs are public data>
 Synopsis:	programs fail that poll(2) on fifos
 Severity:	serious
 Priority:	medium
 Category:	kern
 Class:		sw-bug
 Release:	FreeBSD 4.3-RELEASE i386
 Environment:
 System: FreeBSD spotteswoode.dnsalias.org 4.3-RELEASE FreeBSD 4.3-RELEASE #13: Sun Jan 13 11:53:26 CET 2002 root@spotteswoode.dnsalias.org:/usr/src/sys/compile/n1 i386
 
 
 Description:
 
 the programs below are meant to communicate a state change to multiple
 processes.  the original idea is from paul jarc.  several variants of the
 waiters were tested (selecting, blocking, polling).
 
 How-To-Repeat:
 
 0 p1 root #./pipe-wait pipe & ./pipe-wait pipe & ./pipe-wait pipe &
 [1] 16768
 [2] 16769
 [3] 16770
 [1]  16768 Running                 ./pipe-wait pipe &
 [2]- 16769 Running                 ./pipe-wait pipe &
 [3]+ 16770 Running                 ./pipe-wait pipe &
 
 0 p1 root #
 [1]  16768 Done                    ./pipe-wait pipe
 [2]- 16769 Done                    ./pipe-wait pipe
 [3]+ 16770 Done                    ./pipe-wait pipe
 
 this behaviour is wrong, no matter which of the pipe-wait* programs is
 wrong.  what i want to achieve is having any number of poll-wait's wait
 until pipe-signal is invoked.  this doesn't happen, as the waiters exit
 immediately with no error, which is obviously wrong.
 
 0 p1 root #ll pipe
 pipe|              pipe-wait*         pipe-wait-poll*
 pipe-signal*       pipe-wait-block*   pipe-wait-poll.c*
 pipe-signal.c*     pipe-wait-block.c* pipe-wait.c*
 
 0 p1 root #ll pipe
 29165 prw-r--r--  1 root  wheel  - 0 13 Jan 18:32 pipe|
 
 0 p1 root #./pipe-signal
 
 1 p1 root #./pipe-signal pipe
 
 Fix:
 
 the kernel for version 4.3 needs fixing.  i am not sure if this issue has
 been resolved in -current.
 
 clemens fischer
 
 -------------------- 8< -----------------------
 
 /* pipe-wait.c */
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <unistd.h>
 #include <fcntl.h>
 
 int main(int argc, char* argv[]) {
   int fd;
   fd_set set, empty;
   if (argc<2) return 1;
   fd=open(argv[1], O_RDONLY|O_NDELAY);
   if (fd<0) return 2;
   FD_ZERO(&empty);
   FD_ZERO(&set);
   FD_SET(fd, &set);
   if (select(fd+1, &set, &empty, &empty, NULL)!=1) return 3;
   return 0;
 }
 
 -------------------- 8< -----------------------
 /* pipe-wait-block.c */
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <unistd.h>
 #include <fcntl.h>
 
 int main(int argc, char* argv[]) {
   int fd;
   fd_set set, empty;
   if (argc<2) return 1;
   fd=open(argv[1], O_RDONLY|O_NDELAY);
   if (fd<0) return 2;
   if (fcntl(fd, F_SETFL, O_RDONLY)!=0) return 3;
   FD_ZERO(&empty);
   FD_ZERO(&set);
   FD_SET(fd, &set);
   if (select(fd+1, &set, &empty, &empty, NULL)!=1) return 4;
   return 0;
 }
 
 -------------------- 8< -----------------------
 /* pipe-wait-poll.c */
 #include <sys/types.h>
 #include <poll.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <fcntl.h>
 
 int main(int argc, char* argv[]) {
   int fd;
   struct pollfd x;
   if (argc<2) return 1;
   fd=open(argv[1], O_RDONLY|O_NDELAY);
   if (fd<0) return 2;
   if (fcntl(fd, F_SETFL, O_RDONLY)!=0) return 3;
   x.fd=fd;
   x.events=POLLIN;
   if (poll(&x, 1, -1)!=1) return 4;
   if (x.revents&POLLIN==0) return 5;
   return 0;
 }
 
 -------------------- 8< -----------------------
 /* pipe-signal.c */
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
 
 int main(int argc, char* argv[]) {
   if (argc<2) return 1;
   if (open(argv[1], O_WRONLY|O_NDELAY)<0 && errno!=ENXIO) return 2;
   return 0;
 }
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->freebsd-bugs 
Responsible-Changed-By: keramida 
Responsible-Changed-When: Wed Jan 23 16:34:35 PST 2002 
Responsible-Changed-Why:  
Misfiled PR. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=33903 
State-Changed-From-To: open->closed 
State-Changed-By: keramida 
State-Changed-When: Thu Jan 24 03:06:42 PST 2002 
State-Changed-Why:  
A duplicate of 34020. 
Noticed by: maxim@@macomnet.ru 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=33903 
>Unformatted:
