Linux: Add time64 alias for prctl

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 8a40aff86b
commit b39ffab860
25 changed files with 72 additions and 1 deletions

View File

@ -120,7 +120,9 @@ tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
tst-timerfd tst-ppoll \
tst-clock_adjtime tst-adjtimex tst-ntp_adjtime tst-ntp_gettime \
tst-ntp_gettimex tst-sigtimedwait tst-misalign-clone \
tst-close_range
tst-close_range \
tst-prctl \
# tests
# Test for the symbol version of fcntl that was replaced in glibc 2.28.
ifeq ($(have-GLIBC_2.27)$(build-shared),yesyes)
@ -138,6 +140,8 @@ tests-time64 += \
tst-ppoll-time64 \
tst-sigtimedwait-time64 \
tst-timerfd-time64 \
tst-prctl-time64 \
# tests-time64
tests-clone-internal = \
tst-align-clone-internal \

View File

@ -245,6 +245,7 @@ libc {
__ntp_gettime64;
__ntp_gettimex64;
__ppoll64;
__prctl_time64;
__pselec64;
__pselect64;
__pthread_clockjoin_np64;

View File

@ -240,6 +240,7 @@ GLIBC_2.34 __nftw64_time64 F
GLIBC_2.34 __ntp_gettime64 F
GLIBC_2.34 __ntp_gettimex64 F
GLIBC_2.34 __ppoll64 F
GLIBC_2.34 __prctl_time64 F
GLIBC_2.34 __pselect64 F
GLIBC_2.34 __pthread_cleanup_routine F
GLIBC_2.34 __pthread_clockjoin_np64 F

View File

@ -237,6 +237,7 @@ GLIBC_2.34 __nftw64_time64 F
GLIBC_2.34 __ntp_gettime64 F
GLIBC_2.34 __ntp_gettimex64 F
GLIBC_2.34 __ppoll64 F
GLIBC_2.34 __prctl_time64 F
GLIBC_2.34 __pselect64 F
GLIBC_2.34 __pthread_cleanup_routine F
GLIBC_2.34 __pthread_clockjoin_np64 F

View File

@ -2396,6 +2396,7 @@ GLIBC_2.34 __nftw64_time64 F
GLIBC_2.34 __ntp_gettime64 F
GLIBC_2.34 __ntp_gettimex64 F
GLIBC_2.34 __ppoll64 F
GLIBC_2.34 __prctl_time64 F
GLIBC_2.34 __pselect64 F
GLIBC_2.34 __pthread_cleanup_routine F
GLIBC_2.34 __pthread_clockjoin_np64 F

View File

@ -2347,6 +2347,7 @@ GLIBC_2.34 __nftw64_time64 F
GLIBC_2.34 __ntp_gettime64 F
GLIBC_2.34 __ntp_gettimex64 F
GLIBC_2.34 __ppoll64 F
GLIBC_2.34 __prctl_time64 F
GLIBC_2.34 __pselect64 F
GLIBC_2.34 __pthread_cleanup_routine F
GLIBC_2.34 __pthread_clockjoin_np64 F

View File

@ -2531,6 +2531,7 @@ GLIBC_2.34 __nftw64_time64 F
GLIBC_2.34 __ntp_gettime64 F
GLIBC_2.34 __ntp_gettimex64 F
GLIBC_2.34 __ppoll64 F
GLIBC_2.34 __prctl_time64 F
GLIBC_2.34 __pselect64 F
GLIBC_2.34 __pthread_cleanup_routine F
GLIBC_2.34 __pthread_clockjoin_np64 F

View File

@ -241,6 +241,7 @@ GLIBC_2.34 __nftw64_time64 F
GLIBC_2.34 __ntp_gettime64 F
GLIBC_2.34 __ntp_gettimex64 F
GLIBC_2.34 __ppoll64 F
GLIBC_2.34 __prctl_time64 F
GLIBC_2.34 __pselect64 F
GLIBC_2.34 __pthread_cleanup_routine F
GLIBC_2.34 __pthread_clockjoin_np64 F

View File

@ -2474,6 +2474,7 @@ GLIBC_2.34 __nftw64_time64 F
GLIBC_2.34 __ntp_gettime64 F
GLIBC_2.34 __ntp_gettimex64 F
GLIBC_2.34 __ppoll64 F
GLIBC_2.34 __prctl_time64 F
GLIBC_2.34 __pselect64 F
GLIBC_2.34 __pthread_cleanup_routine F
GLIBC_2.34 __pthread_clockjoin_np64 F

View File

@ -2447,6 +2447,7 @@ GLIBC_2.34 __nftw64_time64 F
GLIBC_2.34 __ntp_gettime64 F
GLIBC_2.34 __ntp_gettimex64 F
GLIBC_2.34 __ppoll64 F
GLIBC_2.34 __prctl_time64 F
GLIBC_2.34 __pselect64 F
GLIBC_2.34 __pthread_cleanup_routine F
GLIBC_2.34 __pthread_clockjoin_np64 F

View File

@ -2444,6 +2444,7 @@ GLIBC_2.34 __nftw64_time64 F
GLIBC_2.34 __ntp_gettime64 F
GLIBC_2.34 __ntp_gettimex64 F
GLIBC_2.34 __ppoll64 F
GLIBC_2.34 __prctl_time64 F
GLIBC_2.34 __pselect64 F
GLIBC_2.34 __pthread_cleanup_routine F
GLIBC_2.34 __pthread_clockjoin_np64 F

View File

@ -2439,6 +2439,7 @@ GLIBC_2.34 __nftw64_time64 F
GLIBC_2.34 __ntp_gettime64 F
GLIBC_2.34 __ntp_gettimex64 F
GLIBC_2.34 __ppoll64 F
GLIBC_2.34 __prctl_time64 F
GLIBC_2.34 __pselect64 F
GLIBC_2.34 __pthread_cleanup_routine F
GLIBC_2.34 __pthread_clockjoin_np64 F

View File

@ -2437,6 +2437,7 @@ GLIBC_2.34 __nftw64_time64 F
GLIBC_2.34 __ntp_gettime64 F
GLIBC_2.34 __ntp_gettimex64 F
GLIBC_2.34 __ppoll64 F
GLIBC_2.34 __prctl_time64 F
GLIBC_2.34 __pselect64 F
GLIBC_2.34 __pthread_cleanup_routine F
GLIBC_2.34 __pthread_clockjoin_np64 F

View File

@ -2445,6 +2445,7 @@ GLIBC_2.34 __nftw64_time64 F
GLIBC_2.34 __ntp_gettime64 F
GLIBC_2.34 __ntp_gettimex64 F
GLIBC_2.34 __ppoll64 F
GLIBC_2.34 __prctl_time64 F
GLIBC_2.34 __pselect64 F
GLIBC_2.34 __pthread_cleanup_routine F
GLIBC_2.34 __pthread_clockjoin_np64 F

View File

@ -2486,6 +2486,7 @@ GLIBC_2.34 __nftw64_time64 F
GLIBC_2.34 __ntp_gettime64 F
GLIBC_2.34 __ntp_gettimex64 F
GLIBC_2.34 __ppoll64 F
GLIBC_2.34 __prctl_time64 F
GLIBC_2.34 __pselect64 F
GLIBC_2.34 __pthread_cleanup_routine F
GLIBC_2.34 __pthread_clockjoin_np64 F

View File

@ -2501,6 +2501,7 @@ GLIBC_2.34 __nftw64_time64 F
GLIBC_2.34 __ntp_gettime64 F
GLIBC_2.34 __ntp_gettimex64 F
GLIBC_2.34 __ppoll64 F
GLIBC_2.34 __prctl_time64 F
GLIBC_2.34 __pselect64 F
GLIBC_2.34 __pthread_cleanup_routine F
GLIBC_2.34 __pthread_clockjoin_np64 F

View File

@ -2534,6 +2534,7 @@ GLIBC_2.34 __nftw64_time64 F
GLIBC_2.34 __ntp_gettime64 F
GLIBC_2.34 __ntp_gettimex64 F
GLIBC_2.34 __ppoll64 F
GLIBC_2.34 __prctl_time64 F
GLIBC_2.34 __pselect64 F
GLIBC_2.34 __pthread_cleanup_routine F
GLIBC_2.34 __pthread_clockjoin_np64 F

View File

@ -40,3 +40,6 @@ __prctl (int option, ...)
libc_hidden_def (__prctl)
weak_alias (__prctl, prctl)
#if __TIMESIZE != 64
weak_alias (__prctl, __prctl_time64)
#endif

View File

@ -2499,6 +2499,7 @@ GLIBC_2.34 __nftw64_time64 F
GLIBC_2.34 __ntp_gettime64 F
GLIBC_2.34 __ntp_gettimex64 F
GLIBC_2.34 __ppoll64 F
GLIBC_2.34 __prctl_time64 F
GLIBC_2.34 __pselect64 F
GLIBC_2.34 __pthread_cleanup_routine F
GLIBC_2.34 __pthread_clockjoin_np64 F

View File

@ -2354,6 +2354,7 @@ GLIBC_2.34 __nftw64_time64 F
GLIBC_2.34 __ntp_gettime64 F
GLIBC_2.34 __ntp_gettimex64 F
GLIBC_2.34 __ppoll64 F
GLIBC_2.34 __prctl_time64 F
GLIBC_2.34 __pselect64 F
GLIBC_2.34 __pthread_cleanup_routine F
GLIBC_2.34 __pthread_clockjoin_np64 F

View File

@ -2351,6 +2351,7 @@ GLIBC_2.34 __nftw64_time64 F
GLIBC_2.34 __ntp_gettime64 F
GLIBC_2.34 __ntp_gettimex64 F
GLIBC_2.34 __ppoll64 F
GLIBC_2.34 __prctl_time64 F
GLIBC_2.34 __pselect64 F
GLIBC_2.34 __pthread_cleanup_routine F
GLIBC_2.34 __pthread_clockjoin_np64 F

View File

@ -2494,6 +2494,7 @@ GLIBC_2.34 __nftw64_time64 F
GLIBC_2.34 __ntp_gettime64 F
GLIBC_2.34 __ntp_gettimex64 F
GLIBC_2.34 __ppoll64 F
GLIBC_2.34 __prctl_time64 F
GLIBC_2.34 __pselect64 F
GLIBC_2.34 __pthread_cleanup_routine F
GLIBC_2.34 __pthread_clockjoin_np64 F

View File

@ -38,7 +38,17 @@
__BEGIN_DECLS
/* Control process execution. */
#ifndef __USE_TIME_BITS64
extern int prctl (int __option, ...) __THROW;
#else
# ifdef __REDIRECT
extern int __REDIRECT (prctl, (int __option, ...), __prctl_time64) __THROW;
# else
extern int __prctl_time64 (int __option,d ...) __THROW;
# define ioctl __prctl_time64
# endif
#endif
__END_DECLS

View File

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

View File

@ -0,0 +1,33 @@
/* Smoke test for prctl.
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 <sys/prctl.h>
#include <support/check.h>
static int
do_test (void)
{
TEST_COMPARE (prctl (PR_SET_NAME, "thread name", 0, 0, 0), 0);
char buffer[16] = { 0, };
TEST_COMPARE (prctl (PR_GET_NAME, buffer, 0, 0, 0), 0);
char expected[16] = "thread name";
TEST_COMPARE_BLOB (buffer, sizeof (buffer), expected, sizeof (expected));
return 0;
}
#include <support/test-driver.c>