diff options
author | Florian Weimer <fweimer@redhat.com> | 2021-07-21 11:42:31 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2021-07-21 11:58:09 +0200 |
commit | 82c395d91ea4f69120d453aeec398e3042cad5fc (patch) | |
tree | 303dc68a9a65b06962c834932cd02c72f35a2432 | |
parent | 39e8eb597303fb8bea07d87f82f4df1cf1586c1c (diff) | |
download | glibc-82c395d91ea4f69120d453aeec398e3042cad5fc.tar.gz glibc-82c395d91ea4f69120d453aeec398e3042cad5fc.tar.xz glibc-82c395d91ea4f69120d453aeec398e3042cad5fc.zip |
misc: Add time64 alias for ioctl
Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
26 files changed, 81 insertions, 3 deletions
diff --git a/misc/Makefile b/misc/Makefile index ae03e26f1b..22923efde9 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -88,11 +88,14 @@ tests := tst-dirname tst-tsearch tst-fdset tst-mntent tst-hsearch \ tst-preadvwritev tst-preadvwritev64 tst-makedev tst-empty \ tst-preadvwritev2 tst-preadvwritev64v2 tst-warn-wide \ tst-ldbl-warn tst-ldbl-error tst-dbl-efgcvt tst-ldbl-efgcvt \ - tst-mntent-autofs tst-syscalls tst-mntent-escape tst-select + tst-mntent-autofs tst-syscalls tst-mntent-escape tst-select \ + tst-ioctl tests-time64 := \ tst-select-time64 \ - tst-pselect-time64 + tst-pselect-time64 \ + tst-ioctl-time64 \ + # tests-time64 # Tests which need libdl. ifeq (yes,$(build-shared)) diff --git a/misc/sys/ioctl.h b/misc/sys/ioctl.h index ddd204d95f..6884d9925f 100644 --- a/misc/sys/ioctl.h +++ b/misc/sys/ioctl.h @@ -38,7 +38,17 @@ __BEGIN_DECLS /* Perform the I/O control operation specified by REQUEST on FD. One argument may follow; its presence and type depend on REQUEST. Return value depends on REQUEST. Usually -1 indicates error. */ +#ifndef __USE_TIME_BITS64 extern int ioctl (int __fd, unsigned long int __request, ...) __THROW; +#else +# ifdef __REDIRECT +extern int __REDIRECT (ioctl, (int __fd, unsigned long int __request, ...), + __ioctl_time64) __THROW; +# else +extern int __ioctl_time64 (int __fd, unsigned long int __request, ...) __THROW; +# define ioctl __ioctl_time64 +# endif +#endif __END_DECLS diff --git a/misc/tst-ioctl-time64.c b/misc/tst-ioctl-time64.c new file mode 100644 index 0000000000..c73e8f649b --- /dev/null +++ b/misc/tst-ioctl-time64.c @@ -0,0 +1 @@ +#include "tst-ioctl.c" diff --git a/misc/tst-ioctl.c b/misc/tst-ioctl.c new file mode 100644 index 0000000000..a09b8ae836 --- /dev/null +++ b/misc/tst-ioctl.c @@ -0,0 +1,41 @@ +/* Smoke test for ioctl. + Copyright (C) 2021 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 <support/check.h> +#include <support/xunistd.h> +#include <sys/ioctl.h> +#include <sys/socket.h> + +static int +do_test (void) +{ + int pair[2]; + TEST_COMPARE (socketpair (AF_UNIX, SOCK_STREAM, 0, pair), 0); + TEST_COMPARE (write (pair[0], "buffer", sizeof ("buffer")), + sizeof ("buffer")); + int value; + TEST_COMPARE (ioctl (pair[1], FIONREAD, &value), 0); + TEST_COMPARE (value, sizeof ("buffer")); + TEST_COMPARE (ioctl (pair[0], FIONREAD, &value), 0); + TEST_COMPARE (value, 0); + xclose (pair[0]); + xclose (pair[1]); + return 0; +} + +#include <support/test-driver.c> diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list index 341eec20f1..10bd409eef 100644 --- a/sysdeps/unix/syscalls.list +++ b/sysdeps/unix/syscalls.list @@ -32,7 +32,7 @@ getrlimit - getrlimit i:ip __getrlimit getrlimit getsockname - getsockname i:ibN __getsockname getsockname getsockopt - getsockopt i:iiiBN getsockopt getuid - getuid Ei: __getuid getuid -ioctl - ioctl i:iiI __ioctl ioctl +ioctl - ioctl i:iiI __ioctl ioctl __ioctl_time64 kill - kill i:ii __kill kill link - link i:ss __link link listen - listen i:ii __listen listen diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions index 4884216825..a78bf880e0 100644 --- a/sysdeps/unix/sysv/linux/Versions +++ b/sysdeps/unix/sysv/linux/Versions @@ -229,6 +229,7 @@ libc { __globfree64_time64; __gmtime64; __gmtime64_r; + __ioctl_time64; __localtime64; __localtime64_r; __lstat64_time64; diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist index 1e73617837..bfb5d09693 100644 --- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist +++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist @@ -222,6 +222,7 @@ GLIBC_2.34 __glob64_time64 F GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64_r F +GLIBC_2.34 __ioctl_time64 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64_r F diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist index 2bd1f4a0f4..cd64167174 100644 --- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist +++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist @@ -219,6 +219,7 @@ GLIBC_2.34 __glob64_time64 F GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64_r F +GLIBC_2.34 __ioctl_time64 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64_r F diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist index 0b3a2310f4..121e5ad9f5 100644 --- a/sysdeps/unix/sysv/linux/csky/libc.abilist +++ b/sysdeps/unix/sysv/linux/csky/libc.abilist @@ -2378,6 +2378,7 @@ GLIBC_2.34 __glob64_time64 F GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64_r F +GLIBC_2.34 __ioctl_time64 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64_r F diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist index 230eb0c85a..1ef566907a 100644 --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist @@ -2329,6 +2329,7 @@ GLIBC_2.34 __glob64_time64 F GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64_r F +GLIBC_2.34 __ioctl_time64 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64_r F diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist index d58620d817..287cd4e574 100644 --- a/sysdeps/unix/sysv/linux/i386/libc.abilist +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist @@ -2512,6 +2512,7 @@ GLIBC_2.34 __glob64_time64 F GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64_r F +GLIBC_2.34 __ioctl_time64 F GLIBC_2.34 __isnanf128 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __localtime64 F diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist index 9b9d0dff9d..f01a129159 100644 --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist @@ -223,6 +223,7 @@ GLIBC_2.34 __glob64_time64 F GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64_r F +GLIBC_2.34 __ioctl_time64 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64_r F diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist index 6d48dc726c..beb2453809 100644 --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist @@ -2456,6 +2456,7 @@ GLIBC_2.34 __glob64_time64 F GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64_r F +GLIBC_2.34 __ioctl_time64 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64_r F diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist index 6abbed158e..5ab2304162 100644 --- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist @@ -2429,6 +2429,7 @@ GLIBC_2.34 __glob64_time64 F GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64_r F +GLIBC_2.34 __ioctl_time64 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64_r F diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist index 8b9ae1f072..c3a61c96f0 100644 --- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist +++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist @@ -2426,6 +2426,7 @@ GLIBC_2.34 __glob64_time64 F GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64_r F +GLIBC_2.34 __ioctl_time64 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64_r F diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist index 095c2ea5da..1e66953b64 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist @@ -2421,6 +2421,7 @@ GLIBC_2.34 __glob64_time64 F GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64_r F +GLIBC_2.34 __ioctl_time64 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64_r F diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist index bc1a353726..cd26df6cc0 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist @@ -2419,6 +2419,7 @@ GLIBC_2.34 __glob64_time64 F GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64_r F +GLIBC_2.34 __ioctl_time64 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64_r F diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist index 63db2192c9..a5002c8f67 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist @@ -2427,6 +2427,7 @@ GLIBC_2.34 __glob64_time64 F GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64_r F +GLIBC_2.34 __ioctl_time64 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64_r F diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist index 2303e12935..04f33cafcb 100644 --- a/sysdeps/unix/sysv/linux/nios2/libc.abilist +++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist @@ -2468,6 +2468,7 @@ GLIBC_2.34 __glob64_time64 F GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64_r F +GLIBC_2.34 __ioctl_time64 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64_r F diff --git a/sysdeps/unix/sysv/linux/powerpc/ioctl.c b/sysdeps/unix/sysv/linux/powerpc/ioctl.c index 1ee9d19d4d..a81c7ba54c 100644 --- a/sysdeps/unix/sysv/linux/powerpc/ioctl.c +++ b/sysdeps/unix/sysv/linux/powerpc/ioctl.c @@ -63,3 +63,6 @@ __ioctl (int fd, unsigned long int request, ...) } libc_hidden_def (__ioctl) weak_alias (__ioctl, ioctl) +#if __TIMESIZE != 64 +weak_alias (__ioctl, __ioctl_time64) +#endif diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist index b51067a81f..089577f914 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist @@ -2483,6 +2483,7 @@ GLIBC_2.34 __glob64_time64 F GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64_r F +GLIBC_2.34 __ioctl_time64 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64_r F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist index c5112da9e5..fc97125521 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist @@ -2516,6 +2516,7 @@ GLIBC_2.34 __glob64_time64 F GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64_r F +GLIBC_2.34 __ioctl_time64 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64_r F diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist index f803a1093c..e16ddd9010 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist @@ -2481,6 +2481,7 @@ GLIBC_2.34 __glob64_time64 F GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64_r F +GLIBC_2.34 __ioctl_time64 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64_r F diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist index fcb9c99713..343784350d 100644 --- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist +++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist @@ -2336,6 +2336,7 @@ GLIBC_2.34 __glob64_time64 F GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64_r F +GLIBC_2.34 __ioctl_time64 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64_r F diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist index aa294c7685..4e7c6bac01 100644 --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist @@ -2333,6 +2333,7 @@ GLIBC_2.34 __glob64_time64 F GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64_r F +GLIBC_2.34 __ioctl_time64 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64_r F diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist index f5f6bf24fd..9274380630 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist @@ -2476,6 +2476,7 @@ GLIBC_2.34 __glob64_time64 F GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64_r F +GLIBC_2.34 __ioctl_time64 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64_r F |