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.
Modified files:
Index: src/sys/sys/endian.h
diff -u src/sys/sys/endian.h:1.32 src/sys/sys/endian.h:1.33
--- src/sys/sys/endian.h:1.32 Wed Jan 3 18:43:52 2024
+++ src/sys/sys/endian.h Mon Sep 9 15:22:50 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: endian.h,v 1.32 2024/01/03 18:43:52 christos Exp $ */
+/* $NetBSD: endian.h,v 1.33 2024/09/09 15:22:50 riastradh Exp $ */
/*
* Copyright (c) 1987, 1991, 1993
@@ -45,7 +45,9 @@
#define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#if defined(_XOPEN_SOURCE) || \
+ (_POSIX_C_SOURCE - 0) >= 200112L || \
+ defined(_NETBSD_SOURCE)
#ifndef _LOCORE
/* C-family endian-ness definitions */
@@ -72,7 +74,7 @@ uint16_t ntohs(uint16_t) __constfunc;
__END_DECLS
#endif /* !_LOCORE */
-#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
+#endif /* _XOPEN_SOURCE || _POSIX_C_SOURCE >= 200809L || _NETBSD_SOURCE */
#include <machine/endian_machdep.h>