[PATCH v2] alpha: Use the generic gethostname
Magnus Lindholm
linmag7@gmail.com
Sun Aug 9 22:08:02 GMT 2026
alpha was the only target implementing gethostname with the syscall
rather than through uname. Its only behavioural difference was the errno
for a too-small buffer: it reported EOVERFLOW where the generic
implementation, gethostname(2) and misc/tst-gethostname expect
ENAMETOOLONG, so alpha failed that test:
tst-gethostname.c:96: numeric comparison failure
left: 112 (0x70, EOVERFLOW); from: errno
right: 63 (0x3f); from: ENAMETOOLONG
The file contains nothing but that function, so removing it lets the
sysdeps search fall through to sysdeps/posix/gethostname.c, which
produces the same buffer contents and the expected errno.
misc/tst-gethostname passes on alpha with it.
Suggested-by: Florian Weimer <fw@deneb.enyo.de>
Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
---
v1: https://inbox.sourceware.org/libc-alpha/20260809205317.3278454-1-linmag7@gmail.com/
v2: remove the file rather than change the errno, per review.
sysdeps/unix/sysv/linux/alpha/gethostname.c | 44 ---------------------
1 file changed, 44 deletions(-)
delete mode 100644 sysdeps/unix/sysv/linux/alpha/gethostname.c
diff --git a/sysdeps/unix/sysv/linux/alpha/gethostname.c b/sysdeps/unix/sysv/linux/alpha/gethostname.c
deleted file mode 100644
index d2bd213c24..0000000000
--- a/sysdeps/unix/sysv/linux/alpha/gethostname.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright (C) 2001-2026 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-int
-__gethostname (char *name, size_t len)
-{
- int result;
-
- result = INLINE_SYSCALL (gethostname, 2, name, len);
-
- if (result == 0
- /* See whether the string is terminated. If not we will return
- an error. */
- && memchr (name, '\0', len) == NULL)
- {
- __set_errno (EOVERFLOW);
- result = -1;
- }
-
- return result;
-}
-
-weak_alias (__gethostname, gethostname)
--
2.55.0
More information about the Libc-alpha
mailing list