adaint.c (__gnat_pthread_setaffinity_np, [...]): Remove wrappers, no longer needed.

2010-10-18  Jose Ruiz  <ruiz@adacore.com>

	* adaint.c (__gnat_pthread_setaffinity_np,
	__gnat_pthread_attr_setaffinity_np): Remove wrappers, no longer needed.
	* s-osinte-linux.ads (pthread_setaffinity_np,
	pthread_attr_setaffinity_np): Remove use of wrappers.
	* s-taprop-linux.adb (Create_Task, Initialize): Restore check to verify
	whether the affinity functionality is available in the OS.
	* gcc-interface/utils.c: Set TREE_STATIC on functions only when there
	are defined.

From-SVN: r165635
This commit is contained in:
Jose Ruiz 2010-10-18 13:54:23 +00:00 committed by Arnaud Charlet
parent 3fd9f17cdc
commit 0ae44446c2
5 changed files with 33 additions and 56 deletions

View File

@ -1,3 +1,14 @@
2010-10-18 Jose Ruiz <ruiz@adacore.com>
* adaint.c (__gnat_pthread_setaffinity_np,
__gnat_pthread_attr_setaffinity_np): Remove wrappers, no longer needed.
* s-osinte-linux.ads (pthread_setaffinity_np,
pthread_attr_setaffinity_np): Remove use of wrappers.
* s-taprop-linux.adb (Create_Task, Initialize): Restore check to verify
whether the affinity functionality is available in the OS.
* gcc-interface/utils.c: Set TREE_STATIC on functions only when there
are defined.
2010-10-18 Robert Dewar <dewar@adacore.com>
* einfo.ads, einfo.adb: Minor reformatting.

View File

@ -3671,50 +3671,4 @@ 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

View File

@ -1783,7 +1783,6 @@ create_subprog_decl (tree subprog_name, tree asm_name,
DECL_EXTERNAL (subprog_decl) = extern_flag;
TREE_PUBLIC (subprog_decl) = public_flag;
TREE_STATIC (subprog_decl) = 1;
TREE_READONLY (subprog_decl) = TYPE_READONLY (subprog_type);
TREE_THIS_VOLATILE (subprog_decl) = TYPE_VOLATILE (subprog_type);
TREE_SIDE_EFFECTS (subprog_decl) = TYPE_VOLATILE (subprog_type);
@ -1831,6 +1830,9 @@ begin_subprog_body (tree subprog_decl)
announce_function (subprog_decl);
/* This function is being defined. */
TREE_STATIC (subprog_decl) = 1;
current_function_decl = subprog_decl;
/* Enter a new binding level and show that all the parameters belong to

View File

@ -490,18 +490,20 @@ package System.OS_Interface is
(thread : pthread_t;
cpusetsize : size_t;
cpuset : access cpu_set_t) return int;
pragma Import (C, pthread_setaffinity_np, "__gnat_pthread_setaffinity_np");
-- Use a wrapper because this function may be available or not, depending
-- on the version of the system.
pragma Import (C, pthread_setaffinity_np, "pthread_setaffinity_np");
pragma Weak_External (pthread_setaffinity_np);
-- Use a weak symbol because this function may be available or not,
-- depending on the version of the system.
function pthread_attr_setaffinity_np
(attr : access pthread_attr_t;
cpusetsize : size_t;
cpuset : access cpu_set_t) return int;
pragma Import (C, pthread_attr_setaffinity_np,
"__gnat_pthread_attr_setaffinity_np");
-- Use a wrapper because this function may be available or not, depending
-- on the version of the system.
"pthread_attr_setaffinity_np");
pragma Weak_External (pthread_attr_setaffinity_np);
-- Use a weak symbol because this function may be available or not,
-- depending on the version of the system.
private

View File

@ -851,7 +851,14 @@ package body System.Task_Primitives.Operations is
-- not behaving as expected. Setting the required attributes for the
-- creation of the thread works correctly and it is more appropriate.
if T.Common.Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU then
-- Do nothing if required support not provided by the operating system
if pthread_attr_setaffinity_np'Address = System.Null_Address then
null;
-- Support is available
elsif T.Common.Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU then
declare
CPU_Set : aliased cpu_set_t := (bits => (others => False));
begin
@ -1326,8 +1333,9 @@ package body System.Task_Primitives.Operations is
-- pragma CPU for the environment task
if Environment_Task.Common.Base_CPU /=
System.Multiprocessors.Not_A_Specific_CPU
if pthread_setaffinity_np'Address /= System.Null_Address
and then Environment_Task.Common.Base_CPU /=
System.Multiprocessors.Not_A_Specific_CPU
then
declare
CPU_Set : aliased cpu_set_t := (bits => (others => False));