From 4d466d8adaa02bd45c3d36cb910046c23c83a6f9 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sat, 22 Apr 2017 22:44:56 +0200 Subject: remove unused HP_TIMING_AVAIL and header cleanup unused and unsupported code. --- libpthread/nptl/allocatestack.c | 48 ------------------ libpthread/nptl/descr.h | 6 --- libpthread/nptl/init.c | 3 -- libpthread/nptl/pthread_clock_gettime.c | 67 -------------------------- libpthread/nptl/pthread_clock_settime.c | 54 --------------------- libpthread/nptl/pthread_create.c | 7 --- libpthread/nptl/sysdeps/unix/sysv/linux/fork.c | 9 ---- 7 files changed, 194 deletions(-) delete mode 100644 libpthread/nptl/pthread_clock_gettime.c delete mode 100644 libpthread/nptl/pthread_clock_settime.c (limited to 'libpthread') diff --git a/libpthread/nptl/allocatestack.c b/libpthread/nptl/allocatestack.c index ccf34d6f6..290051796 100644 --- a/libpthread/nptl/allocatestack.c +++ b/libpthread/nptl/allocatestack.c @@ -880,54 +880,6 @@ __reclaim_stacks (void) } -#if HP_TIMING_AVAIL -# undef __find_thread_by_id -/* Find a thread given the thread ID. */ -attribute_hidden -struct pthread * -__find_thread_by_id (pid_t tid) -{ - struct pthread *result = NULL; - - lll_lock (stack_cache_lock, LLL_PRIVATE); - - /* Iterate over the list with system-allocated threads first. */ - list_t *runp; - list_for_each (runp, &stack_used) - { - struct pthread *curp; - - curp = list_entry (runp, struct pthread, list); - - if (curp->tid == tid) - { - result = curp; - goto out; - } - } - - /* Now the list with threads using user-allocated stacks. */ - list_for_each (runp, &__stack_user) - { - struct pthread *curp; - - curp = list_entry (runp, struct pthread, list); - - if (curp->tid == tid) - { - result = curp; - goto out; - } - } - - out: - lll_unlock (stack_cache_lock, LLL_PRIVATE); - - return result; -} -#endif - - static void internal_function setxid_mark_thread (struct xid_command *cmdp, struct pthread *t) diff --git a/libpthread/nptl/descr.h b/libpthread/nptl/descr.h index 06fdbee4b..218be9669 100644 --- a/libpthread/nptl/descr.h +++ b/libpthread/nptl/descr.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -310,11 +309,6 @@ struct pthread /* Lock for synchronizing setxid calls. */ int setxid_futex; -#if HP_TIMING_AVAIL - /* Offset of the CPU clock at start thread start time. */ - hp_timing_t cpuclock_offset; -#endif - /* If the thread waits to join another one the ID of the latter is stored here. diff --git a/libpthread/nptl/init.c b/libpthread/nptl/init.c index 09220c220..74d30c739 100644 --- a/libpthread/nptl/init.c +++ b/libpthread/nptl/init.c @@ -174,9 +174,6 @@ __pthread_initialize_minimal_internal (void) THREAD_SETMEM (pd, user_stack, true); if (LLL_LOCK_INITIALIZER != 0) THREAD_SETMEM (pd, lock, LLL_LOCK_INITIALIZER); -#if HP_TIMING_AVAIL - THREAD_SETMEM (pd, cpuclock_offset, GL(dl_cpuclock_offset)); -#endif /* Initialize the robust mutex data. */ #ifdef __PTHREAD_MUTEX_HAVE_PREV diff --git a/libpthread/nptl/pthread_clock_gettime.c b/libpthread/nptl/pthread_clock_gettime.c deleted file mode 100644 index 35f8e8a05..000000000 --- a/libpthread/nptl/pthread_clock_gettime.c +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (C) 2001, 2002, 2003 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; see the file COPYING.LIB. If - not, see . */ - -#include -#include -#include -#include "pthreadP.h" - - -#if HP_TIMING_AVAIL -int -__pthread_clock_gettime (clockid_t clock_id, hp_timing_t freq, - struct timespec *tp) -{ - hp_timing_t tsc; - - /* Get the current counter. */ - HP_TIMING_NOW (tsc); - - /* This is the ID of the thread we are looking for. */ - pid_t tid = ((unsigned int) clock_id) >> CLOCK_IDFIELD_SIZE; - - /* Compute the offset since the start time of the process. */ - if (tid == 0 || tid == THREAD_GETMEM (THREAD_SELF, tid)) - /* Our own clock. */ - tsc -= THREAD_GETMEM (THREAD_SELF, cpuclock_offset); - else - { - /* This is more complicated. We have to locate the thread based - on the ID. This means walking the list of existing - threads. */ - struct pthread *thread = __find_thread_by_id (tid); - if (thread == NULL) - { - __set_errno (EINVAL); - return -1; - } - - /* There is a race here. The thread might terminate and the stack - become unusable. But this is the user's problem. */ - tsc -= thread->cpuclock_offset; - } - - /* Compute the seconds. */ - tp->tv_sec = tsc / freq; - - /* And the nanoseconds. This computation should be stable until - we get machines with about 16GHz frequency. */ - tp->tv_nsec = ((tsc % freq) * 1000000000ull) / freq; - - return 0; -} -#endif diff --git a/libpthread/nptl/pthread_clock_settime.c b/libpthread/nptl/pthread_clock_settime.c deleted file mode 100644 index 65aac4f1d..000000000 --- a/libpthread/nptl/pthread_clock_settime.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 2001, 2002, 2003 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; see the file COPYING.LIB. If - not, see . */ - -#include -#include -#include -#include "pthreadP.h" - - -#if HP_TIMING_AVAIL -int -__pthread_clock_settime (clockid_t clock_id, hp_timing_t offset) -{ - /* This is the ID of the thread we are looking for. */ - pid_t tid = ((unsigned int) clock_id) >> CLOCK_IDFIELD_SIZE; - - /* Compute the offset since the start time of the process. */ - if (tid == 0 || tid == THREAD_GETMEM (THREAD_SELF, tid)) - /* Our own clock. */ - THREAD_SETMEM (THREAD_SELF, cpuclock_offset, offset); - else - { - /* This is more complicated. We have to locate the thread based - on the ID. This means walking the list of existing - threads. */ - struct pthread *thread = __find_thread_by_id (tid); - if (thread == NULL) - { - __set_errno (EINVAL); - return -1; - } - - /* There is a race here. The thread might terminate and the stack - become unusable. But this is the user's problem. */ - thread->cpuclock_offset = offset; - } - - return 0; -} -#endif diff --git a/libpthread/nptl/pthread_create.c b/libpthread/nptl/pthread_create.c index d39cb278c..b11265f7c 100644 --- a/libpthread/nptl/pthread_create.c +++ b/libpthread/nptl/pthread_create.c @@ -21,7 +21,6 @@ #include #include #include "pthreadP.h" -#include #include #include #include @@ -225,12 +224,6 @@ start_thread (void *arg) { struct pthread *pd = (struct pthread *) arg; -#if HP_TIMING_AVAIL - /* Remember the time when the thread was started. */ - hp_timing_t now; - HP_TIMING_NOW (now); - THREAD_SETMEM (pd, cpuclock_offset, now); -#endif #if defined __UCLIBC_HAS_RESOLVER_SUPPORT__ /* Initialize resolver state pointer. */ __resp = &pd->res; diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c index 49806dab9..8b4b03677 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c @@ -24,7 +24,6 @@ #include #include #include "fork.h" -#include #include #include #include @@ -152,14 +151,6 @@ fork (void) if (__fork_generation_pointer != NULL) *__fork_generation_pointer += 4; -#if HP_TIMING_AVAIL - /* The CPU clock of the thread and process have to be set to zero. */ - hp_timing_t now; - HP_TIMING_NOW (now); - THREAD_SETMEM (self, cpuclock_offset, now); - GL(dl_cpuclock_offset) = now; -#endif - /* Reset the file list. These are recursive mutexes. */ fresetlockfiles (); -- cgit v1.2.3