]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/glibc/glibc-rh929302.patch
Merge branch 'bird' into next
[ipfire-2.x.git] / src / patches / glibc / glibc-rh929302.patch
1 From decadad73858bc108828eed5540c7955dc2a977b Mon Sep 17 00:00:00 2001
2 From: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
3 Date: Fri, 7 Jun 2013 14:44:58 -0500
4 Subject: [PATCH 1/2] PowerPC: Change sched_getcpu to use vDSO getcpu instead of syscall.
5
6 Backport of d5e0b9bd6e296f3ec5263fa296d39f3fed9b8fa2 from master.
7 ---
8 sysdeps/unix/sysv/linux/powerpc/Versions | 1 +
9 sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h | 2 +
10 sysdeps/unix/sysv/linux/powerpc/init-first.c | 3 ++
11 sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c | 30 ++++++++++++++++++++++
12 4 files changed, 36 insertions(+), 0 deletions(-)
13 create mode 100644 sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c
14
15 diff --git a/sysdeps/unix/sysv/linux/powerpc/Versions b/sysdeps/unix/sysv/linux/powerpc/Versions
16 index 1ef53b9..396a423 100644
17 --- a/sysdeps/unix/sysv/linux/powerpc/Versions
18 +++ b/sysdeps/unix/sysv/linux/powerpc/Versions
19 @@ -3,5 +3,6 @@ libc {
20 __vdso_get_tbfreq;
21 __vdso_clock_gettime;
22 __vdso_clock_getres;
23 + __vdso_getcpu;
24 }
25 }
26 diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h b/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h
27 index 746d9ce..c3026d5 100644
28 --- a/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h
29 +++ b/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h
30 @@ -31,6 +31,8 @@ extern void *__vdso_clock_getres;
31
32 extern void *__vdso_get_tbfreq;
33
34 +extern void *__vdso_getcpu;
35 +
36 #endif
37
38 #endif /* _LIBC_VDSO_H */
39 diff --git a/sysdeps/unix/sysv/linux/powerpc/init-first.c b/sysdeps/unix/sysv/linux/powerpc/init-first.c
40 index 92dacc7..cfed655 100644
41 --- a/sysdeps/unix/sysv/linux/powerpc/init-first.c
42 +++ b/sysdeps/unix/sysv/linux/powerpc/init-first.c
43 @@ -27,6 +27,7 @@ void *__vdso_gettimeofday attribute_hidden;
44 void *__vdso_clock_gettime;
45 void *__vdso_clock_getres;
46 void *__vdso_get_tbfreq;
47 +void *__vdso_getcpu;
48
49
50 static inline void
51 @@ -41,6 +42,8 @@ _libc_vdso_platform_setup (void)
52 __vdso_clock_getres = _dl_vdso_vsym ("__kernel_clock_getres", &linux2615);
53
54 __vdso_get_tbfreq = _dl_vdso_vsym ("__kernel_vdso_get_tbfreq", &linux2615);
55 +
56 + __vdso_getcpu = _dl_vdso_vsym ("__kernel_getcpu", &linux2615);
57 }
58
59 # define VDSO_SETUP _libc_vdso_platform_setup
60 diff --git a/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c b/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c
61 new file mode 100644
62 index 0000000..617e6f1
63 --- /dev/null
64 +++ b/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c
65 @@ -0,0 +1,30 @@
66 +/* Copyright (C) 2013 Free Software Foundation, Inc.
67 + This file is part of the GNU C Library.
68 +
69 + The GNU C Library is free software; you can redistribute it and/or
70 + modify it under the terms of the GNU Lesser General Public
71 + License as published by the Free Software Foundation; either
72 + version 2.1 of the License, or (at your option) any later version.
73 +
74 + The GNU C Library is distributed in the hope that it will be useful,
75 + but WITHOUT ANY WARRANTY; without even the implied warranty of
76 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
77 + Lesser General Public License for more details.
78 +
79 + You should have received a copy of the GNU Lesser General Public
80 + License along with the GNU C Library; if not, see
81 + <http://www.gnu.org/licenses/>. */
82 +
83 +#include <sched.h>
84 +#include <sysdep.h>
85 +#include <bits/libc-vdso.h>
86 +
87 +
88 +int
89 +sched_getcpu (void)
90 +{
91 + unsigned int cpu;
92 + int r = INLINE_VSYSCALL (getcpu, 3, &cpu, NULL, NULL);
93 +
94 + return r == -1 ? r : cpu;
95 +}
96 --
97 1.7.1
98