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:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 01 19:30:00 +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!

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.