Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Aug 2000 13:24:18 +0200 (CEST)
From:      "Ralf S. Engelschall" <rse@en1.engelschall.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/20677: slight prototype inconsistency for poll(2) 
Message-ID:  <200008171124.e7HBOI056286@en1.engelschall.com>

next in thread | raw e-mail | index | archive | help

>Number:         20677
>Category:       kern
>Synopsis:       slight prototype inconsistency for poll(2)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 17 04:30:01 PDT 2000
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200008171124.e7HBOI056286>