NetBSD Problem Report #57806

From www@netbsd.org  Mon Jan  1 19:25:56 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 428E21A9238
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  1 Jan 2024 19:25:56 +0000 (UTC)
Message-Id: <20240101192525.72E281A9239@mollari.NetBSD.org>
Date: Mon,  1 Jan 2024 19:25:25 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: #include <arpa/inet.h> fails to define htonl/htons/ntohl/ntohs under _POSIX_C_SOURCE=200809L
X-Send-Pr-Version: www-1.0

>Number:         57806
>Category:       standards
>Synopsis:       #include <arpa/inet.h> fails to define htonl/htons/ntohl/ntohs under _POSIX_C_SOURCE=200809L
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    standards-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 01 19:30:00 +0000 2024
>Closed-Date:    Fri Oct 11 19:12:18 +0000 2024
>Last-Modified:  Mon Oct 14 06:30:01 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The <arpa/inet.h> Foundation
>Environment:
>Description:
POSIX and NetBSD both document htonl/htons/ntohl/ntohs as being provided by #include <arpa/inet.h>, but this doesn't provide them when _POSIX_C_SOURCE is defined to be 200809L.
>How-To-Repeat:
$ cat pr.c
#define	_POSIX_C_SOURCE	200809L
#include <arpa/inet.h>
int myntohl(int x) { return ntohl(x); }
$ make pr.o
cc -O2   -c pr.c
pr.c: In function ‘myntohl’:
pr.c:3:29: warning: implicit declaration of function ‘ntohl’; did you mean ‘myntohl’? [-Wimplicit-function-declaration]
 int myntohl(int x) { return ntohl(x); }
                             ^~~~~
                             myntohl
>Fix:
Yes, please!

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Mon, 09 Sep 2024 15:23:40 +0000
State-Changed-Why:
fixed in HEAD, needs pullup-10 and pullup-9


From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57806 CVS commit: src/sys/sys
Date: Mon, 9 Sep 2024 15:22:50 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Mon Sep  9 15:22:50 UTC 2024

 Modified Files:
 	src/sys/sys: endian.h

 Log Message:
 arpa/inet.h: Define htonl &c. under _POSIX_C_SOURCE >= 200112L too.

 These do not require _XOPEN_SOURCE as of POSIX 2001:

 https://pubs.opengroup.org/onlinepubs/009696799/functions/htonl.html

 XXX Since this change is actually sys/endian.h, in principle it might
 bleed into header files than just arpa/inet.h.  But sys/endian.h is
 not used by anything that looks especially risky to me.

 PR standards/57806: #include <arpa/inet.h> fails to define
 htonl/htons/ntohl/ntohs under _POSIX_C_SOURCE=200809L


 To generate a diff of this commit:
 cvs rdiff -u -r1.32 -r1.33 src/sys/sys/endian.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Fri, 11 Oct 2024 18:56:20 +0000
State-Changed-Why:
pullup-10 #952 https://releng.netbsd.org/cgi-bin/req-10.cgi?show=952
pullup-9 is probably not worth the risk


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57806 CVS commit: [netbsd-10] src/sys/sys
Date: Fri, 11 Oct 2024 19:07:20 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Fri Oct 11 19:07:20 UTC 2024

 Modified Files:
 	src/sys/sys [netbsd-10]: endian.h

 Log Message:
 Pull up following revision(s) (requested by riastradh in ticket #952):

 	sys/sys/endian.h: revision 1.32
 	sys/sys/endian.h: revision 1.33
 	sys/sys/endian.h: revision 1.34
 	sys/sys/endian.h: revision 1.35

 break the cycle: this does not need <sys/types.h> it only needs <sys/stdint.h>

 arpa/inet.h: Define htonl &c. under _POSIX_C_SOURCE >= 200112L too.
 These do not require _XOPEN_SOURCE as of POSIX 2001:
 https://pubs.opengroup.org/onlinepubs/009696799/functions/htonl.html

 XXX Since this change is actually sys/endian.h, in principle it might
 bleed into header files than just arpa/inet.h.  But sys/endian.h is
 not used by anything that looks especially risky to me.

 PR standards/57806: #include <arpa/inet.h> fails to define
 htonl/htons/ntohl/ntohs under _POSIX_C_SOURCE=200809L

 sys/endian.h: Hide le32enc/be32enc/... under _NETBSD_SOURCE.
 These are non-standard extensions, so they should not be exposed by,
 e.g., _XOPEN_SOURCE=700.

 PR standards/57807: #include <arpa/inet.h> spuriously defines
 le32enc/be32enc/... under _XOPEN_SOURCE=700

 sys/endian.h: sync comment with code


 To generate a diff of this commit:
 cvs rdiff -u -r1.31 -r1.31.4.1 src/sys/sys/endian.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Fri, 11 Oct 2024 19:12:18 +0000
State-Changed-Why:
fixed in HEAD, pulled up to 10, not worth risk for 9


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57806 CVS commit: [netbsd-10] src/sys/sys
Date: Mon, 14 Oct 2024 04:47:55 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Mon Oct 14 04:47:55 UTC 2024

 Modified Files:
 	src/sys/sys [netbsd-10]: rbtree.h

 Log Message:
 Actually pull up

 	sys/sys/rbtree.h					1.9

 as I tried in previous commit but typoed the revision number.

 Ticket #952: sys/endian.h: PR 57806 + 57807: fix declaration visibility.


 To generate a diff of this commit:
 cvs rdiff -u -r1.5.30.1 -r1.5.30.2 src/sys/sys/rbtree.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57806 CVS commit: [netbsd-10] src/usr.sbin/tprof
Date: Mon, 14 Oct 2024 06:28:20 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Mon Oct 14 06:28:20 UTC 2024

 Modified Files:
 	src/usr.sbin/tprof [netbsd-10]: tprof_top.c

 Log Message:
 Additionally pull up

 	usr.sbin/tprof/tprof_top.c		1.10

 for ticket #952: sys/endian.h: PR 57806 + 57807: fix declaration visibility.

 This needs <stdbool.h> - it used to come from <sys/rbtree.h> (inappropriately)
 but no longer (normally).    This should unbreak the builds.


 To generate a diff of this commit:
 cvs rdiff -u -r1.7.2.2 -r1.7.2.3 src/usr.sbin/tprof/tprof_top.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.