Module Name: src Committed By: kre Date: Fri Sep 20 15:52:12 UTC 2024
Modified Files: src/include: unistd.h Log Message: The gethostname() function is (from when it was added to POSIX) a base function, not an XSI optional extension, so it should be made visible whenever _POSIX_C_SOURCE is >= 200112 (Posix Issue 6), and not only for _XOPEN_SOURCE >= 600 (which would be for an XSI function added then). Move the prototype for gethostname() to the right section of the file. Note this makes the visibility of gethostname() wider, it will remain visible everywhere it was visible before - the only conceivable issue would be if someone was abusing the name in a context where they shouldn't be. (Some non NetBSD application, as all of NetBSD is compiled with _NetBSD_SOURCE defined, everything tends to be visible, so no change at all for the NetBSD source tree). Issue pointed out by Thomas Klausner (wiz@) To generate a diff of this commit: cvs rdiff -u -r1.167 -r1.168 src/include/unistd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/include/unistd.h diff -u src/include/unistd.h:1.167 src/include/unistd.h:1.168 --- src/include/unistd.h:1.167 Thu Aug 15 23:44:49 2024 +++ src/include/unistd.h Fri Sep 20 15:52:12 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: unistd.h,v 1.167 2024/08/15 23:44:49 riastradh Exp $ */ +/* $NetBSD: unistd.h,v 1.168 2024/09/20 15:52:12 kre Exp $ */ /*- * Copyright (c) 1998, 1999, 2008 The NetBSD Foundation, Inc. @@ -173,6 +173,7 @@ ssize_t readlink(const char * __restric */ #if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 600 || \ defined(_NETBSD_SOURCE) +int gethostname(char *, size_t); int setegid(gid_t); int seteuid(uid_t); #endif @@ -266,7 +267,6 @@ int fchown(int, uid_t, gid_t); #endif int getdtablesize(void); long gethostid(void); -int gethostname(char *, size_t); __pure int getpagesize(void); /* legacy */ pid_t getpgid(pid_t);