]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/ada/affinity.c
c++: Handle multiple aggregate overloads [PR95319].
[thirdparty/gcc.git] / gcc / ada / affinity.c
CommitLineData
c37cbdc3
AC
1/****************************************************************************
2 * *
3 * GNAT COMPILER COMPONENTS *
4 * *
5 * A F F I N I T Y *
6 * *
7 * C Implementation File *
8 * *
1d005acc 9 * Copyright (C) 2005-2019, Free Software Foundation, Inc. *
c37cbdc3
AC
10 * *
11 * GNAT is free software; you can redistribute it and/or modify it under *
12 * terms of the GNU General Public License as published by the Free Soft- *
71c4391e 13 * ware Foundation; either version 3, or (at your option) any later ver- *
c37cbdc3
AC
14 * sion. GNAT is distributed in the hope that it will be useful, but WITH- *
15 * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
71c4391e 16 * or FITNESS FOR A PARTICULAR PURPOSE. *
c37cbdc3 17 * *
71c4391e
AC
18 * As a special exception under Section 7 of GPL version 3, you are granted *
19 * additional permissions described in the GCC Runtime Library Exception, *
20 * version 3.1, as published by the Free Software Foundation. *
21 * *
22 * You should have received a copy of the GNU General Public License and *
23 * a copy of the GCC Runtime Library Exception along with this program; *
24 * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see *
25 * <http://www.gnu.org/licenses/>. *
c37cbdc3
AC
26 * *
27 * GNAT was originally developed by the GNAT team at New York University. *
28 * Extensive contributions were provided by Ada Core Technologies Inc. *
29 * *
30 ****************************************************************************/
31
32/* VxWorks SMP CPU affinity */
33
34#include "taskLib.h"
35#include "cpuset.h"
36
230ad369
AC
37extern int __gnat_set_affinity (TASK_ID tid, unsigned cpu);
38extern int __gnat_set_affinity_mask (TASK_ID tid, unsigned mask);
c37cbdc3
AC
39
40int
230ad369 41 __gnat_set_affinity (TASK_ID tid, unsigned cpu)
c37cbdc3
AC
42{
43 cpuset_t cpuset;
44
45 CPUSET_ZERO(cpuset);
46 CPUSET_SET(cpuset, cpu);
47 return taskCpuAffinitySet (tid, cpuset);
48}
49
50int
230ad369 51__gnat_set_affinity_mask (TASK_ID tid, unsigned mask)
c37cbdc3 52{
230ad369 53 unsigned index;
c37cbdc3
AC
54 cpuset_t cpuset;
55
56 CPUSET_ZERO(cpuset);
57
58 for (index = 0; index < sizeof (unsigned) * 8; index++)
59 if (mask & (1 << index))
60 CPUSET_SET(cpuset, index);
61
62 return taskCpuAffinitySet (tid, cpuset);
63}