From rse@en1.engelschall.com  Thu Aug 17 04:27:33 2000
Return-Path: <rse@en1.engelschall.com>
Received: from slarti.muc.de (slarti.muc.de [193.149.48.10])
	by hub.freebsd.org (Postfix) with SMTP id 193F737B43C
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 17 Aug 2000 04:27:32 -0700 (PDT)
Received: (qmail 26213 invoked by uid 66); 17 Aug 2000 11:35:37 -0000
Received: from en by slarti with UUCP; Thu Aug 17 11:35:37 2000 -0000
Received: by en1.engelschall.com (Sendmail 8.11.0+)
	id e7HBOI056286; Thu, 17 Aug 2000 13:24:18 +0200 (CEST)
Message-Id: <200008171124.e7HBOI056286@en1.engelschall.com>
Date: Thu, 17 Aug 2000 13:24:18 +0200 (CEST)
From: "Ralf S. Engelschall" <rse@en1.engelschall.com>
Reply-To: rse@engelschall.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: slight prototype inconsistency for poll(2) 
X-Send-Pr-Version: 3.2

>Number:         20677
>Category:       kern
>Synopsis:       slight prototype inconsistency for poll(2)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    sheldonh
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 17 04:30:01 PDT 2000
>Closed-Date:    Mon Aug 21 05:26:32 PDT 2000
>Last-Modified:  Mon Aug 21 05:26:45 PDT 2000
>Originator:     Ralf S. Engelschall
>Release:        FreeBSD 4.1-STABLE i386
>Organization:
Engelschall, Germany.
>Environment:

FreeBSD en1.engelschall.com 4.1-STABLE FreeBSD 4.1-STABLE #0: Sun Aug 13
15:33:17 CEST 2000     rse@en1.engelschall.com:/usr/obj/usr/src/sys/EN1  i386

>Description:

Under FreeBSD 4.1-STABLE (and also under 5.0-CURRENT if I had tried),
the Autoconf stuff of my GNU Portable Threads reports:

|    :
| checking for type of argument 2 for poll()... unsigned
| checking for fallback nfds_t... unsigned
|    :

And as a result my generated pth.h header then has a "typedef unsigned
nfds_t;", although I would have expected (both for cleanness and by reading
the poll(2) manpage) that the result is "typedef unsigned int nfds_t;" (note
the explicit "int").  This is caused because the prototype for poll() in
/usr/include/poll.h is not 100% syntactically equivalent to the one in the
manpage poll(2): it lacks the implicit "int" keyword.

Sure, I know that "unsigned" and "unsigned int" are semantically the same in
ANSI C, of course. But for consistency reasons I would appreciate that our
header poll.h exactly reflects the prototype from the manpage unless we
provide the more standardized (SUSv2) "nfds_t" type.

>How-To-Repeat:

:> grep "unsigned _nfds" /usr/include/sys/poll.h 
int     poll __P((struct pollfd *_pfd, unsigned _nfds, int _timeout));
:> gunzip </usr/share/man/man2/poll.2.gz | grep unsigned
.Fn poll "struct pollfd *fds" "unsigned int nfds" "int timeout"

>Fix:

Index: src/sys/sys/poll.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/poll.h,v
retrieving revision 1.6
diff -u -d -r1.6 poll.h
--- poll.h	1999/12/29 04:24:45	1.6
+++ poll.h	2000/08/17 11:08:38
@@ -100,7 +100,7 @@
  * XXX poll() has "unsigned long" nfds on SVR4, not unsigned as on the
  * other BSDs.
  */
-int	poll __P((struct pollfd *_pfd, unsigned _nfds, int _timeout));
+int	poll __P((struct pollfd *_pfd, unsigned int _nfds, int _timeout));
 __END_DECLS
 
 #endif /* !_KERNEL */


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: sheldonh 
State-Changed-When: Thu Aug 17 10:04:34 PDT 2000 
State-Changed-Why:  
Waiting for feedback from bde. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=20677 

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: bde@FreeBSD.org
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: kern/20677: slight prototype inconsistency for poll(2) 
Date: Thu, 17 Aug 2000 19:04:27 +0200

 On Thu, 17 Aug 2000 13:24:18 +0200, "Ralf S. Engelschall" wrote:
 
 > >Number:         20677
 > >Category:       kern
 > >Synopsis:       slight prototype inconsistency for poll(2)
 
 > -int	poll __P((struct pollfd *_pfd, unsigned _nfds, int _timeout));
 > +int	poll __P((struct pollfd *_pfd, unsigned int _nfds, int _timeout));
 
 Hi Bruce,
 
 You changed the type of the _nfds argument from u_int to unsigned in rev
 1.4 of poll.h.  Can we change it to unsigned int to match the manual
 page?
 
 Ciao,
 Sheldon.
 

From: Bruce Evans <bde@zeta.org.au>
To: Sheldon Hearn <sheldonh@uunet.co.za>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: kern/20677: slight prototype inconsistency for poll(2) 
Date: Sat, 19 Aug 2000 06:48:56 +1000 (EST)

 >  > -int	poll __P((struct pollfd *_pfd, unsigned _nfds, int _timeout));
 >  > +int	poll __P((struct pollfd *_pfd, unsigned int _nfds, int _timeout));
 
 >  You changed the type of the _nfds argument from u_int to unsigned in rev
 >  1.4 of poll.h.  Can we change it to unsigned int to match the manual
 >  page?
 
 OK (but I would have used "unsigned" in both).
 
 Bruce
 
 
Responsible-Changed-From-To: freebsd-bugs->sheldonh 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Mon Aug 21 05:26:14 PDT 2000 
Responsible-Changed-Why:  
I'll take this nit. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20677 
State-Changed-From-To: feedback->closed 
State-Changed-By: sheldonh 
State-Changed-When: Mon Aug 21 05:26:32 PDT 2000 
State-Changed-Why:  
Committed, thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20677 
>Unformatted:
