Commit 2f97d24c by Arnaud Charlet

[multiple changes]

2015-10-27  Tristan Gingold  <gingold@adacore.com>

	* bindgen.adb (System_BB_CPU_Primitives_Multiprocessors_Used):
	New variable.
	(Gen_Adainit): Call Start_All_CPUs if the above
	variable is set to true.

2015-10-27  Emmanuel Briot  <briot@adacore.com>

	* adaint.c, s-os_lib.adb, s-os_lib.ads (Copy_File_Attributes): New
	subprogram.

From-SVN: r229429
parent 4e48e02b
2015-10-27 Tristan Gingold <gingold@adacore.com>
* bindgen.adb (System_BB_CPU_Primitives_Multiprocessors_Used):
New variable.
(Gen_Adainit): Call Start_All_CPUs if the above
variable is set to true.
2015-10-27 Emmanuel Briot <briot@adacore.com>
* adaint.c, s-os_lib.adb, s-os_lib.ads (Copy_File_Attributes): New
subprogram.
2015-10-27 Hristian Kirtchev <kirtchev@adacore.com> 2015-10-27 Hristian Kirtchev <kirtchev@adacore.com>
* namet.adb, namet.ads: Minor reformatting. * namet.adb, namet.ads: Minor reformatting.
......
...@@ -2902,6 +2902,8 @@ char __gnat_environment_char = '$'; ...@@ -2902,6 +2902,8 @@ char __gnat_environment_char = '$';
mode = 1 : In this mode, time stamps and read/write/execute attributes are mode = 1 : In this mode, time stamps and read/write/execute attributes are
copied. copied.
mode = 2 : In this mode, only read/write/execute attributes are copied
Returns 0 if operation was successful and -1 in case of error. */ Returns 0 if operation was successful and -1 in case of error. */
int int
...@@ -2921,10 +2923,14 @@ __gnat_copy_attribs (char *from ATTRIBUTE_UNUSED, char *to ATTRIBUTE_UNUSED, ...@@ -2921,10 +2923,14 @@ __gnat_copy_attribs (char *from ATTRIBUTE_UNUSED, char *to ATTRIBUTE_UNUSED,
S2WSC (wfrom, from, GNAT_MAX_PATH_LEN + 2); S2WSC (wfrom, from, GNAT_MAX_PATH_LEN + 2);
S2WSC (wto, to, GNAT_MAX_PATH_LEN + 2); S2WSC (wto, to, GNAT_MAX_PATH_LEN + 2);
/* Do we need to copy the timestamp ? */
if (mode != 2) {
/* retrieve from times */ /* retrieve from times */
hfrom = CreateFile hfrom = CreateFile
(wfrom, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); (wfrom, GENERIC_READ, 0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if (hfrom == INVALID_HANDLE_VALUE) if (hfrom == INVALID_HANDLE_VALUE)
return -1; return -1;
...@@ -2939,7 +2945,8 @@ __gnat_copy_attribs (char *from ATTRIBUTE_UNUSED, char *to ATTRIBUTE_UNUSED, ...@@ -2939,7 +2945,8 @@ __gnat_copy_attribs (char *from ATTRIBUTE_UNUSED, char *to ATTRIBUTE_UNUSED,
/* retrieve from times */ /* retrieve from times */
hto = CreateFile hto = CreateFile
(wto, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); (wto, GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if (hto == INVALID_HANDLE_VALUE) if (hto == INVALID_HANDLE_VALUE)
return -1; return -1;
...@@ -2950,10 +2957,12 @@ __gnat_copy_attribs (char *from ATTRIBUTE_UNUSED, char *to ATTRIBUTE_UNUSED, ...@@ -2950,10 +2957,12 @@ __gnat_copy_attribs (char *from ATTRIBUTE_UNUSED, char *to ATTRIBUTE_UNUSED,
if (res == 0) if (res == 0)
return -1; return -1;
}
/* Do we need to copy the permissions ? */
/* Set file attributes in full mode. */ /* Set file attributes in full mode. */
if (mode == 1) if (mode != 0)
{ {
DWORD attribs = GetFileAttributes (wfrom); DWORD attribs = GetFileAttributes (wfrom);
...@@ -2971,26 +2980,24 @@ __gnat_copy_attribs (char *from ATTRIBUTE_UNUSED, char *to ATTRIBUTE_UNUSED, ...@@ -2971,26 +2980,24 @@ __gnat_copy_attribs (char *from ATTRIBUTE_UNUSED, char *to ATTRIBUTE_UNUSED,
GNAT_STRUCT_STAT fbuf; GNAT_STRUCT_STAT fbuf;
struct utimbuf tbuf; struct utimbuf tbuf;
if (GNAT_STAT (from, &fbuf) == -1) if (GNAT_STAT (from, &fbuf) == -1) {
{
return -1; return -1;
} }
/* Do we need to copy timestamp ? */
if (mode != 2) {
tbuf.actime = fbuf.st_atime; tbuf.actime = fbuf.st_atime;
tbuf.modtime = fbuf.st_mtime; tbuf.modtime = fbuf.st_mtime;
if (utime (to, &tbuf) == -1) if (utime (to, &tbuf) == -1) {
{
return -1; return -1;
} }
}
if (mode == 1) /* Do we need to copy file permissions ? */
{ if (mode != 0 && (chmod (to, fbuf.st_mode) == -1)) {
if (chmod (to, fbuf.st_mode) == -1)
{
return -1; return -1;
} }
}
return 0; return 0;
#endif #endif
......
...@@ -88,6 +88,12 @@ package body Bindgen is ...@@ -88,6 +88,12 @@ package body Bindgen is
-- attach interrupt handlers at the end of the elaboration when partition -- attach interrupt handlers at the end of the elaboration when partition
-- elaboration policy is sequential. -- elaboration policy is sequential.
System_BB_CPU_Primitives_Multiprocessors_Used : Boolean := False;
-- Flag indicating wether the unit System.BB.CPU_Primitives.Multiprocessors
-- is in the closure of the partiation. This is set by procedure
-- Resolve_Binder_Options, and it is used to call a procedure that starts
-- slave processors.
Lib_Final_Built : Boolean := False; Lib_Final_Built : Boolean := False;
-- Flag indicating whether the finalize_library rountine has been built -- Flag indicating whether the finalize_library rountine has been built
...@@ -536,6 +542,13 @@ package body Bindgen is ...@@ -536,6 +542,13 @@ package body Bindgen is
WBI (" procedure Activate_All_Tasks_Sequential;"); WBI (" procedure Activate_All_Tasks_Sequential;");
WBI (" pragma Import (C, Activate_All_Tasks_Sequential," & WBI (" pragma Import (C, Activate_All_Tasks_Sequential," &
" ""__gnat_activate_all_tasks"");"); " ""__gnat_activate_all_tasks"");");
WBI ("");
end if;
if System_BB_CPU_Primitives_Multiprocessors_Used then
WBI (" procedure Start_Slave_CPUs;");
WBI (" pragma Import (C, Start_Slave_CPUs," &
" ""__gnat_start_slave_cpus"");");
end if; end if;
WBI (" begin"); WBI (" begin");
...@@ -944,6 +957,10 @@ package body Bindgen is ...@@ -944,6 +957,10 @@ package body Bindgen is
end if; end if;
end if; end if;
if System_BB_CPU_Primitives_Multiprocessors_Used then
WBI (" Start_Slave_CPUs;");
end if;
WBI (" end " & Ada_Init_Name.all & ";"); WBI (" end " & Ada_Init_Name.all & ";");
WBI (""); WBI ("");
end Gen_Adainit; end Gen_Adainit;
...@@ -2872,6 +2889,12 @@ package body Bindgen is ...@@ -2872,6 +2889,12 @@ package body Bindgen is
-- Ditto for the use of restrictions -- Ditto for the use of restrictions
Check_Package (System_Restrictions_Used, "system.restrictions%s"); Check_Package (System_Restrictions_Used, "system.restrictions%s");
-- Ditto for use of an SMP bareboard runtime
Check_Package (System_BB_CPU_Primitives_Multiprocessors_Used,
"system.bb.cpu_primitives.multiprocessors%s");
end loop; end loop;
end Resolve_Binder_Options; end Resolve_Binder_Options;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment