[PATCH] Remove gethostname from sysdeps/unix/syscalls.list

Matt Turner mattst88@gmail.com
Sat Sep 26 03:40:52 GMT 2026


Commit 9d7d648088 ("alpha: Use the generic gethostname") removed the
alpha gethostname.c to use sysdeps/posix/gethostname.c, but
sysdeps/unix precedes sysdeps/posix and its syscalls.list has a
gethostname entry. alpha is the only Linux target defining
__NR_gethostname, so it now gets a raw syscall wrapper. The kernel
truncates the name and returns 0, so a too-small buffer is no longer
an error:

  tst-gethostname.c:95: not true: gethostname (hostname, HOST_NAME_MAX) == -1

nss/test-netdb crashes because gethostname (NULL, 0) now succeeds.
qemu-user does not show this; it implements the syscall with the
host's gethostname.

No other target uses the entry: other Linux targets lack
__NR_gethostname and Hurd has its own gethostname.c.
---
 sysdeps/unix/syscalls.list | 1 -
 1 file changed, 1 deletion(-)

diff --git ./sysdeps/unix/syscalls.list ./sysdeps/unix/syscalls.list
index 10bd409eef..67c82783a1 100644
--- ./sysdeps/unix/syscalls.list
+++ ./sysdeps/unix/syscalls.list
@@ -24,7 +24,6 @@ getdomain	-	getdomainname	i:si	getdomainname
 getgid		-	getgid		Ei:	__getgid	getgid
 getgroups	-	getgroups	i:ip	__getgroups	getgroups
 gethostid	-	gethostid	i:	gethostid
-gethostname	-	gethostname	i:bn	__gethostname	gethostname
 getpeername	-	getpeername	i:ibN	__getpeername	getpeername
 getpid		-	getpid		Ei:	__getpid	getpid
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
-- 
2.54.0



More information about the Libc-alpha mailing list