misc: Add time64 alias for ioctl

Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
This commit is contained in:
Florian Weimer 2021-07-21 11:42:31 +02:00
parent 39e8eb5973
commit 82c395d91e
26 changed files with 81 additions and 3 deletions

View File

@ -88,11 +88,14 @@ tests := tst-dirname tst-tsearch tst-fdset tst-mntent tst-hsearch \
tst-preadvwritev tst-preadvwritev64 tst-makedev tst-empty \ tst-preadvwritev tst-preadvwritev64 tst-makedev tst-empty \
tst-preadvwritev2 tst-preadvwritev64v2 tst-warn-wide \ tst-preadvwritev2 tst-preadvwritev64v2 tst-warn-wide \
tst-ldbl-warn tst-ldbl-error tst-dbl-efgcvt tst-ldbl-efgcvt \ 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 := \ tests-time64 := \
tst-select-time64 \ tst-select-time64 \
tst-pselect-time64 tst-pselect-time64 \
tst-ioctl-time64 \
# tests-time64
# Tests which need libdl. # Tests which need libdl.
ifeq (yes,$(build-shared)) ifeq (yes,$(build-shared))

View File

@ -38,7 +38,17 @@ __BEGIN_DECLS
/* Perform the I/O control operation specified by REQUEST on FD. /* Perform the I/O control operation specified by REQUEST on FD.
One argument may follow; its presence and type depend on REQUEST. One argument may follow; its presence and type depend on REQUEST.
Return value depends on REQUEST. Usually -1 indicates error. */ Return value depends on REQUEST. Usually -1 indicates error. */
#ifndef __USE_TIME_BITS64
extern int ioctl (int __fd, unsigned long int __request, ...) __THROW; 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 __END_DECLS

1
misc/tst-ioctl-time64.c Normal file
View File

@ -0,0 +1 @@
#include "tst-ioctl.c"

41
misc/tst-ioctl.c Normal file
View File

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

View File

@ -32,7 +32,7 @@ getrlimit - getrlimit i:ip __getrlimit getrlimit
getsockname - getsockname i:ibN __getsockname getsockname getsockname - getsockname i:ibN __getsockname getsockname
getsockopt - getsockopt i:iiiBN getsockopt getsockopt - getsockopt i:iiiBN getsockopt
getuid - getuid Ei: __getuid getuid 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 kill - kill i:ii __kill kill
link - link i:ss __link link link - link i:ss __link link
listen - listen i:ii __listen listen listen - listen i:ii __listen listen

View File

@ -229,6 +229,7 @@ libc {
__globfree64_time64; __globfree64_time64;
__gmtime64; __gmtime64;
__gmtime64_r; __gmtime64_r;
__ioctl_time64;
__localtime64; __localtime64;
__localtime64_r; __localtime64_r;
__lstat64_time64; __lstat64_time64;

View File

@ -222,6 +222,7 @@ GLIBC_2.34 __glob64_time64 F
GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __globfree64_time64 F
GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64 F
GLIBC_2.34 __gmtime64_r F GLIBC_2.34 __gmtime64_r F
GLIBC_2.34 __ioctl_time64 F
GLIBC_2.34 __libc_start_main F GLIBC_2.34 __libc_start_main F
GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64 F
GLIBC_2.34 __localtime64_r F GLIBC_2.34 __localtime64_r F

View File

@ -219,6 +219,7 @@ GLIBC_2.34 __glob64_time64 F
GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __globfree64_time64 F
GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64 F
GLIBC_2.34 __gmtime64_r F GLIBC_2.34 __gmtime64_r F
GLIBC_2.34 __ioctl_time64 F
GLIBC_2.34 __libc_start_main F GLIBC_2.34 __libc_start_main F
GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64 F
GLIBC_2.34 __localtime64_r F GLIBC_2.34 __localtime64_r F

View File

@ -2378,6 +2378,7 @@ GLIBC_2.34 __glob64_time64 F
GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __globfree64_time64 F
GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64 F
GLIBC_2.34 __gmtime64_r F GLIBC_2.34 __gmtime64_r F
GLIBC_2.34 __ioctl_time64 F
GLIBC_2.34 __libc_start_main F GLIBC_2.34 __libc_start_main F
GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64 F
GLIBC_2.34 __localtime64_r F GLIBC_2.34 __localtime64_r F

View File

@ -2329,6 +2329,7 @@ GLIBC_2.34 __glob64_time64 F
GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __globfree64_time64 F
GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64 F
GLIBC_2.34 __gmtime64_r F GLIBC_2.34 __gmtime64_r F
GLIBC_2.34 __ioctl_time64 F
GLIBC_2.34 __libc_start_main F GLIBC_2.34 __libc_start_main F
GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64 F
GLIBC_2.34 __localtime64_r F GLIBC_2.34 __localtime64_r F

View File

@ -2512,6 +2512,7 @@ GLIBC_2.34 __glob64_time64 F
GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __globfree64_time64 F
GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64 F
GLIBC_2.34 __gmtime64_r F GLIBC_2.34 __gmtime64_r F
GLIBC_2.34 __ioctl_time64 F
GLIBC_2.34 __isnanf128 F GLIBC_2.34 __isnanf128 F
GLIBC_2.34 __libc_start_main F GLIBC_2.34 __libc_start_main F
GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64 F

View File

@ -223,6 +223,7 @@ GLIBC_2.34 __glob64_time64 F
GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __globfree64_time64 F
GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64 F
GLIBC_2.34 __gmtime64_r F GLIBC_2.34 __gmtime64_r F
GLIBC_2.34 __ioctl_time64 F
GLIBC_2.34 __libc_start_main F GLIBC_2.34 __libc_start_main F
GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64 F
GLIBC_2.34 __localtime64_r F GLIBC_2.34 __localtime64_r F

View File

@ -2456,6 +2456,7 @@ GLIBC_2.34 __glob64_time64 F
GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __globfree64_time64 F
GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64 F
GLIBC_2.34 __gmtime64_r F GLIBC_2.34 __gmtime64_r F
GLIBC_2.34 __ioctl_time64 F
GLIBC_2.34 __libc_start_main F GLIBC_2.34 __libc_start_main F
GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64 F
GLIBC_2.34 __localtime64_r F GLIBC_2.34 __localtime64_r F

View File

@ -2429,6 +2429,7 @@ GLIBC_2.34 __glob64_time64 F
GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __globfree64_time64 F
GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64 F
GLIBC_2.34 __gmtime64_r F GLIBC_2.34 __gmtime64_r F
GLIBC_2.34 __ioctl_time64 F
GLIBC_2.34 __libc_start_main F GLIBC_2.34 __libc_start_main F
GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64 F
GLIBC_2.34 __localtime64_r F GLIBC_2.34 __localtime64_r F

View File

@ -2426,6 +2426,7 @@ GLIBC_2.34 __glob64_time64 F
GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __globfree64_time64 F
GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64 F
GLIBC_2.34 __gmtime64_r F GLIBC_2.34 __gmtime64_r F
GLIBC_2.34 __ioctl_time64 F
GLIBC_2.34 __libc_start_main F GLIBC_2.34 __libc_start_main F
GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64 F
GLIBC_2.34 __localtime64_r F GLIBC_2.34 __localtime64_r F

View File

@ -2421,6 +2421,7 @@ GLIBC_2.34 __glob64_time64 F
GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __globfree64_time64 F
GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64 F
GLIBC_2.34 __gmtime64_r F GLIBC_2.34 __gmtime64_r F
GLIBC_2.34 __ioctl_time64 F
GLIBC_2.34 __libc_start_main F GLIBC_2.34 __libc_start_main F
GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64 F
GLIBC_2.34 __localtime64_r F GLIBC_2.34 __localtime64_r F

View File

@ -2419,6 +2419,7 @@ GLIBC_2.34 __glob64_time64 F
GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __globfree64_time64 F
GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64 F
GLIBC_2.34 __gmtime64_r F GLIBC_2.34 __gmtime64_r F
GLIBC_2.34 __ioctl_time64 F
GLIBC_2.34 __libc_start_main F GLIBC_2.34 __libc_start_main F
GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64 F
GLIBC_2.34 __localtime64_r F GLIBC_2.34 __localtime64_r F

View File

@ -2427,6 +2427,7 @@ GLIBC_2.34 __glob64_time64 F
GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __globfree64_time64 F
GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64 F
GLIBC_2.34 __gmtime64_r F GLIBC_2.34 __gmtime64_r F
GLIBC_2.34 __ioctl_time64 F
GLIBC_2.34 __libc_start_main F GLIBC_2.34 __libc_start_main F
GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64 F
GLIBC_2.34 __localtime64_r F GLIBC_2.34 __localtime64_r F

View File

@ -2468,6 +2468,7 @@ GLIBC_2.34 __glob64_time64 F
GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __globfree64_time64 F
GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64 F
GLIBC_2.34 __gmtime64_r F GLIBC_2.34 __gmtime64_r F
GLIBC_2.34 __ioctl_time64 F
GLIBC_2.34 __libc_start_main F GLIBC_2.34 __libc_start_main F
GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64 F
GLIBC_2.34 __localtime64_r F GLIBC_2.34 __localtime64_r F

View File

@ -63,3 +63,6 @@ __ioctl (int fd, unsigned long int request, ...)
} }
libc_hidden_def (__ioctl) libc_hidden_def (__ioctl)
weak_alias (__ioctl, ioctl) weak_alias (__ioctl, ioctl)
#if __TIMESIZE != 64
weak_alias (__ioctl, __ioctl_time64)
#endif

View File

@ -2483,6 +2483,7 @@ GLIBC_2.34 __glob64_time64 F
GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __globfree64_time64 F
GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64 F
GLIBC_2.34 __gmtime64_r F GLIBC_2.34 __gmtime64_r F
GLIBC_2.34 __ioctl_time64 F
GLIBC_2.34 __libc_start_main F GLIBC_2.34 __libc_start_main F
GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64 F
GLIBC_2.34 __localtime64_r F GLIBC_2.34 __localtime64_r F

View File

@ -2516,6 +2516,7 @@ GLIBC_2.34 __glob64_time64 F
GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __globfree64_time64 F
GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64 F
GLIBC_2.34 __gmtime64_r F GLIBC_2.34 __gmtime64_r F
GLIBC_2.34 __ioctl_time64 F
GLIBC_2.34 __libc_start_main F GLIBC_2.34 __libc_start_main F
GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64 F
GLIBC_2.34 __localtime64_r F GLIBC_2.34 __localtime64_r F

View File

@ -2481,6 +2481,7 @@ GLIBC_2.34 __glob64_time64 F
GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __globfree64_time64 F
GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64 F
GLIBC_2.34 __gmtime64_r F GLIBC_2.34 __gmtime64_r F
GLIBC_2.34 __ioctl_time64 F
GLIBC_2.34 __libc_start_main F GLIBC_2.34 __libc_start_main F
GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64 F
GLIBC_2.34 __localtime64_r F GLIBC_2.34 __localtime64_r F

View File

@ -2336,6 +2336,7 @@ GLIBC_2.34 __glob64_time64 F
GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __globfree64_time64 F
GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64 F
GLIBC_2.34 __gmtime64_r F GLIBC_2.34 __gmtime64_r F
GLIBC_2.34 __ioctl_time64 F
GLIBC_2.34 __libc_start_main F GLIBC_2.34 __libc_start_main F
GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64 F
GLIBC_2.34 __localtime64_r F GLIBC_2.34 __localtime64_r F

View File

@ -2333,6 +2333,7 @@ GLIBC_2.34 __glob64_time64 F
GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __globfree64_time64 F
GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64 F
GLIBC_2.34 __gmtime64_r F GLIBC_2.34 __gmtime64_r F
GLIBC_2.34 __ioctl_time64 F
GLIBC_2.34 __libc_start_main F GLIBC_2.34 __libc_start_main F
GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64 F
GLIBC_2.34 __localtime64_r F GLIBC_2.34 __localtime64_r F

View File

@ -2476,6 +2476,7 @@ GLIBC_2.34 __glob64_time64 F
GLIBC_2.34 __globfree64_time64 F GLIBC_2.34 __globfree64_time64 F
GLIBC_2.34 __gmtime64 F GLIBC_2.34 __gmtime64 F
GLIBC_2.34 __gmtime64_r F GLIBC_2.34 __gmtime64_r F
GLIBC_2.34 __ioctl_time64 F
GLIBC_2.34 __libc_start_main F GLIBC_2.34 __libc_start_main F
GLIBC_2.34 __localtime64 F GLIBC_2.34 __localtime64 F
GLIBC_2.34 __localtime64_r F GLIBC_2.34 __localtime64_r F