aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/adaint.c
diff options
context:
space:
mode:
authorJose Ruiz <ruiz@adacore.com>2011-09-01 13:40:48 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2011-09-01 15:40:48 +0200
commit9d1e0e72dbd7a6cd71bd18adeb8d4c8e5cd2d86f (patch)
tree43c635534492841d32b301dc46c16759c59ad6a5 /gcc/ada/adaint.c
parenta95be2d47a4e851e44f04765e549e34c43b2f006 (diff)
downloadgcc-9d1e0e72dbd7a6cd71bd18adeb8d4c8e5cd2d86f.zip
gcc-9d1e0e72dbd7a6cd71bd18adeb8d4c8e5cd2d86f.tar.gz
gcc-9d1e0e72dbd7a6cd71bd18adeb8d4c8e5cd2d86f.tar.bz2
adaint.c, adaint.h (__gnat_cpu_alloc, [...]): Create these wrappers around the CPU_ALLOC...
2011-09-01 Jose Ruiz <ruiz@adacore.com> * adaint.c, adaint.h (__gnat_cpu_alloc, __gnat_cpu_alloc_size, __gnat_cpu_set_free): Create these wrappers around the CPU_ALLOC, CPU_ALLOC_SIZE and CPU_FREE linux macros. (__gnat_cpu_zero, __gnat_cpu_set): Use the CPU_ZERO_S and CPU_SET_S respectively because we are now using dynamically allocated CPU sets which are more portable across different glibc versions. * s-osinte-linux.ads (cpu_set_t_ptr, CPU_ALLOC, CPU_ALLOC_SIZE, CPU_FREE): Add this type and subprograms to be able to create cpu_set_t masks dynamically according to the number of processors in the target platform. (CPU_ZERO, CPU_SET): They are now mapped to the CPU_ZERO_S and CPU_SET_S respectively, so we need to pass the size of the masks as parameters. * s-taprop-linux.adb (Create_Task, Set_Task_Affinity): Use dynamically created cpu_set_t masks with the number of processors available in the target platform, instead of static bit arrays. It enhances portability because it uses the information from the target platform. * sem_ch8.adb: (Attribute_Renaming): When checking whether we are using a restricted run-time library, use the flag Configurable_Run_Time_Mode instead of Restricted_Profile. From-SVN: r178416
Diffstat (limited to 'gcc/ada/adaint.c')
-rw-r--r--gcc/ada/adaint.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index adc702a..605cdaf 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -3790,16 +3790,31 @@ void *__gnat_lwp_self (void)
#include <sched.h>
-void __gnat_cpu_zero (cpu_set_t *set)
+cpu_set_t *__gnat_cpu_alloc (size_t count)
{
- CPU_ZERO (set);
+ return CPU_ALLOC (count);
}
-void __gnat_cpu_set (int cpu, cpu_set_t *set)
+size_t __gnat_cpu_alloc_size (size_t count)
+{
+ return CPU_ALLOC_SIZE (count);
+}
+
+void __gnat_cpu_free (cpu_set_t *set)
+{
+ CPU_FREE (set);
+}
+
+void __gnat_cpu_zero (size_t count, cpu_set_t *set)
+{
+ CPU_ZERO_S (count, set);
+}
+
+void __gnat_cpu_set (int cpu, size_t count, cpu_set_t *set)
{
/* Ada handles CPU numbers starting from 1, while C identifies the first
CPU by a 0, so we need to adjust. */
- CPU_SET (cpu - 1, set);
+ CPU_SET_S (cpu - 1, count, set);
}
#endif