diff options
author | Jose Ruiz <ruiz@adacore.com> | 2010-10-18 10:48:36 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-10-18 12:48:36 +0200 |
commit | ee1feb1499a5d8bc83e16906f2359c16443cbda7 (patch) | |
tree | be2d0e8e6399ebd9da97cde4e144b5cab6233d39 /gcc/ada/adaint.c | |
parent | c68015cdba5bdbea25a16f61561438e490af6a8b (diff) | |
download | gcc-ee1feb1499a5d8bc83e16906f2359c16443cbda7.zip gcc-ee1feb1499a5d8bc83e16906f2359c16443cbda7.tar.gz gcc-ee1feb1499a5d8bc83e16906f2359c16443cbda7.tar.bz2 |
adaint.c (__gnat_pthread_setaffinity_np, [...]): Add these wrappers which check the availability of the underlying OS...
2010-10-18 Jose Ruiz <ruiz@adacore.com>
* adaint.c (__gnat_pthread_setaffinity_np,
__gnat_pthread_attr_setaffinity_np): Add these wrappers which check the
availability of the underlying OS functionality before calling.
* s-osinte-linux.ads (pthread_setaffinity_np,
pthread_attr_setaffinity_np): Call a wrapper instead of the OS function
to perform a check of its availability.
* s-taprop-linux.adb (Create_Task): Remove the check to verify whether
the affinity functionality is available in the OS. Now done in a wrapper
* gcc-interface/Makefile.in: Remove vmshandler.asm, unused.
* gcc-interface/Make-lang.in: Update dependencies.
From-SVN: r165628
Diffstat (limited to 'gcc/ada/adaint.c')
-rw-r--r-- | gcc/ada/adaint.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index 3f4654f..11f6da0 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -3671,4 +3671,50 @@ void *__gnat_lwp_self (void) { return (void *) syscall (__NR_gettid); } + +/* For the affinity functions, there are systems which do not provide + the required support, so we create a wrapper to check its availability + before calling. */ + +extern int pthread_setaffinity_np (pthread_t th, + size_t cpusetsize, + const void *cpuset) + __attribute__((weak)); + +extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr, + size_t cpusetsize, + const void *cpuset) + __attribute__((weak)); + +int __gnat_pthread_setaffinity_np (pthread_t th, + size_t cpusetsize, + const void *cpuset); + +int __gnat_pthread_attr_setaffinity_np (pthread_attr_t *__attr, + size_t cpusetsize, + const void *cpuset); + +int +__gnat_pthread_setaffinity_np (pthread_t th, + size_t cpusetsize, + const void *cpuset) +{ + /* Call the underlying OS operation if available */ + if (pthread_setaffinity_np) + return pthread_setaffinity_np (th, cpusetsize, cpuset); + else + return 0; +} + +int +__gnat_pthread_attr_setaffinity_np (pthread_attr_t *__attr, + size_t cpusetsize, + const void *cpuset) +{ + /* Call the underlying OS operation if available */ + if (pthread_attr_setaffinity_np) + return pthread_attr_setaffinity_np (__attr, cpusetsize, cpuset); + else + return 0; +} #endif |