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

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Tue Sep 29 12:42:13 GMT 2026



On 26/09/26 00:40, Matt Turner wrote:
> 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.

Even though it is a conforming implementation, as Andreas has pointed out,
there is no clear advantage of making alpha an outlier.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  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



More information about the Libc-alpha mailing list