A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Last corrections of Tesh tool.
[simgrid.git]
/
tools
/
tesh2
/
src
/
writer.c
diff --git
a/tools/tesh2/src/writer.c
b/tools/tesh2/src/writer.c
index
419a11f
..
bb9b445
100644
(file)
--- a/
tools/tesh2/src/writer.c
+++ b/
tools/tesh2/src/writer.c
@@
-14,6
+14,7
@@
\r
#include <writer.h>
\r
#include <command.h>
\r
\r
#include <writer.h>
\r
#include <command.h>
\r
+#include <unit.h>
\r
\r
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(tesh);
\r
\r
\r
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(tesh);
\r
\r
@@
-41,12
+42,15
@@
writer_new(command_t command)
int
\r
writer_free(writer_t* ptr)
\r
{
\r
int
\r
writer_free(writer_t* ptr)
\r
{
\r
- /* TODO : check the parameter */
\r
+
\r
+ if((*ptr)->written)
\r
+ xbt_os_sem_destroy((*ptr)->written);
\r
\r
\r
- /*xbt_os_sem_destroy((*writer)->started);
\r
- xbt_os_sem_destroy((*writer)->can_write);*/
\r
+ if((*ptr)->can_write)
\r
+ xbt_os_sem_destroy((*ptr)->can_write);
\r
\r
free(*ptr);
\r
\r
free(*ptr);
\r
+
\r
*ptr = NULL;
\r
\r
return 0;
\r
*ptr = NULL;
\r
\r
return 0;
\r
@@
-92,11
+96,15
@@
writer_start_routine(void* p)
\r
if(writer->failed && !command->successeded && !command->failed && !command->interrupted)
\r
{
\r
\r
if(writer->failed && !command->successeded && !command->failed && !command->interrupted)
\r
{
\r
- error_register("Write failure", errno, command->context->command_line, command->unit->fstream->name);
\r
+ ERROR2("[%s] Error while writing input to child `%s'", command->context->pos, command->context->command_line);
\r
+ unit_set_error(command->unit, (int)GetLastError(), 0);
\r
command_handle_failure(command, csr_write_failure);
\r
}
\r
/*else if(writer->broken_pipe && !command->successeded && !command->failed && !command->interrupted)
\r
{
\r
command_handle_failure(command, csr_write_failure);
\r
}
\r
/*else if(writer->broken_pipe && !command->successeded && !command->failed && !command->interrupted)
\r
{
\r
+
\r
+ ERROR2("[%s] Pipe broken while writing input to child `%s'", command->context->pos, command->context->command_line);
\r
+ unit_set_error(command->unit, (int)GetLastError(), 0);
\r
command_kill(command);
\r
command_handle_failure(command, csr_write_pipe_broken);
\r
}*/
\r
command_kill(command);
\r
command_handle_failure(command, csr_write_pipe_broken);
\r
}*/
\r
@@
-176,12
+184,16
@@
writer_start_routine(void* p)
if(writer->failed && !command->successeded && !command->failed && !command->interrupted)
\r
{
\r
command_kill(command);
\r
if(writer->failed && !command->successeded && !command->failed && !command->interrupted)
\r
{
\r
command_kill(command);
\r
- error_register("Write failure", errno, command->context->command_line, command->unit->fstream->name);
\r
+ ERROR2("[%s] Error while writing input to child `%s'", command->context->pos, command->context->command_line);
\r
+
\r
+ unit_set_error(command->unit, errno, 0);
\r
command_handle_failure(command, csr_write_failure);
\r
}
\r
else if(writer->broken_pipe && !command->successeded && !command->failed && !command->interrupted)
\r
{
\r
command_handle_failure(command, csr_write_failure);
\r
}
\r
else if(writer->broken_pipe && !command->successeded && !command->failed && !command->interrupted)
\r
{
\r
- error_register("write() function failed", errno, command->context->command_line, command->unit->fstream->name);
\r
+ ERROR2("[%s] Pipe broken while writing input to child `%s'", command->context->pos, command->context->command_line);
\r
+
\r
+ unit_set_error(command->unit, errno, 0);
\r
command_kill(command);
\r
command_handle_failure(command, csr_write_pipe_broken);
\r
}
\r
command_kill(command);
\r
command_handle_failure(command, csr_write_pipe_broken);
\r
}
\r