[glibc] alpha: Use the generic gethostname
Florian Weimer via Glibc-cvs <[email protected]>
| Newsgroups | gmane.comp.lib.glibc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9d7d6480880064cb5219aa267894ffabd0c2b20c commit 9d7d6480880064cb5219aa267894ffabd0c2b20c Author: Magnus Lindholm <[email protected]> Date: Mon Aug 10 00:08:02 2026 +0200 alpha: Use the generic gethostname 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 <[email protected]> Signed-off-by: Magnus Lindholm <[email protected]> Reviewed-by: Florian Weimer <[email protected]> Diff: --- sysdeps/unix/sysv/linux/alpha/gethostname.c | 44 ----------------------------- 1 file changed, 44 deletions(-) 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)