This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Declare gethostname for XPG4 (bug 20054)

unistd.h declares gethostname for __USE_UNIX98 || __USE_XOPEN2K.  But
it's also in XPG4 (XNS volume - C438 - not the main definitions of
system interfaces and headers in C435).  This patch corrects the

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

[The conform/Makefile XFAIL removal depends on
<> and
<> (pending
review) also being applied.]

2016-05-06  Joseph Myers  <>

	[BZ #20054]
	* posix/unistd.h (gethostname): Declare if [__USE_XOPEN_EXTENDED],
	not [__USE_UNIX98].
	* conform/data/unistd.h-data (gethostname): Do not expect for
	* conform/Makefile (test-xfail-XPG4/unistd.h/conform): Remove

diff --git a/conform/Makefile b/conform/Makefile
index e68753f..a6bf54a 100644
--- a/conform/Makefile
+++ b/conform/Makefile
@@ -188,7 +188,6 @@ test-xfail-XPG4/sys/types.h/conform = yes
 test-xfail-XPG4/sys/wait.h/conform = yes
 test-xfail-XPG4/termios.h/conform = yes
 test-xfail-XPG4/ucontext.h/conform = yes
-test-xfail-XPG4/unistd.h/conform = yes
 test-xfail-POSIX/sys/wait.h/conform = yes
 test-xfail-UNIX98/arpa/inet.h/conform = yes
 test-xfail-UNIX98/netdb.h/conform = yes
diff --git a/conform/data/unistd.h-data b/conform/data/unistd.h-data
index 9c00d44..5958ff7 100644
--- a/conform/data/unistd.h-data
+++ b/conform/data/unistd.h-data
@@ -490,7 +490,7 @@ function int getgroups (int, gid_t[])
 #if !defined POSIX && !defined POSIX2008
 function long gethostid (void)
-#if !defined POSIX
+#if !defined POSIX && !defined XPG3
 function int gethostname (char*, size_t)
 function {char*} getlogin (void)
diff --git a/posix/unistd.h b/posix/unistd.h
index 8956022..9f7994b 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -874,7 +874,7 @@ extern int setlogin (const char *__name) __THROW __nonnull ((1));
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
+#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
 /* Put the name of the current host in no more than LEN bytes of NAME.
    The result is null-terminated if LEN is large enough for the full
    name and the terminator.  */

Joseph S. Myers

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]