Ignore:
Timestamp:
Feb 9, 2017, 11:08:31 AM (5 years ago)
Author:
Sanahuja Guillaume
Message:

modif sterror

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/FrameworkManager_impl.cpp

    r122 r133  
    132132  int status = rt_task_shadow(NULL, task_name.c_str(), 10, 0);
    133133  if (status != 0) {
    134     self->Err("rt_task_shadow error (%s)\n", strerror(-status));
     134                char errorMsg[256];
     135    self->Err("rt_task_shadow error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    135136  }
    136137
     
    147148  // Printf("destruction FrameworkManager_impl\n");
    148149  int status;
    149 
     150        char errorMsg[256];
     151       
    150152  SafeStop();
    151153  Join();
     
    160162    status = DeletePipe(&cmd_pipe);
    161163    if (status != 0) {
    162       Err("Error deleting pipe (%s)\n", strerror(-status));
     164      Err("Error deleting pipe (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    163165    }
    164166    status = DeletePipe(&data_pipe);
    165167    if (status != 0) {
    166       Err("Error deleting pipe (%s)\n", strerror(-status));
     168      Err("Error deleting pipe (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    167169    }
    168170
     
    170172    status = rt_heap_delete(&log_heap);
    171173    if (status != 0) {
    172       Err("rt_heap_delete error (%s)\n", strerror(-status));
     174      Err("rt_heap_delete error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    173175    }
    174176#endif
     
    561563
    562564void FrameworkManager_impl::SetupLogger(string log_path) {
    563   if (logger_defined == true) {
     565  char errorMsg[256];
     566       
     567        if (logger_defined == true) {
    564568    Warn("SetupLogger() was already called.\n");
    565569    return;
     
    570574  int status = CreatePipe(&cmd_pipe, "log_cmd");
    571575  if (status != 0) {
    572     Err("Error creating pipe (%s)\n", strerror(-status));
     576    Err("Error creating pipe (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    573577    return;
    574578  }
     
    576580  status = CreatePipe(&data_pipe, "log_data");
    577581  if (status != 0) {
    578     Err("Error creating pipe (%s)\n", strerror(-status));
     582    Err("Error creating pipe (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    579583    return;
    580584  }
     
    585589  status = rt_heap_create(&log_heap, tmp_name.c_str(), LOG_HEAP, H_FIFO);
    586590  if (status != 0) {
    587     Err("rt_heap_create error (%s)\n", strerror(-status));
     591    Err("rt_heap_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    588592    return;
    589593  }
     
    675679
    676680      if (written < 0) {
    677         Err("write pipe error (%s)\n", strerror(-written));
     681                                char errorMsg[256];
     682        Err("write pipe error (%s)\n", strerror_r(-written, errorMsg, sizeof(errorMsg)));
    678683        nb_err++;
    679684        logs.at(i).running = false;
     
    708713
    709714    if (written < 0) {
    710       Err("write pipe error (%s)\n", strerror(-written));
     715                        char errorMsg[256];
     716      Err("write pipe error (%s)\n", strerror_r(-written, errorMsg, sizeof(errorMsg)));
    711717      return;
    712718    } else if (written != sizeof(log_desc_t)) {
     
    727733  int status = rt_heap_alloc(&log_heap, sz, TM_NONBLOCK, &ptr);
    728734  if (status != 0) {
    729     Err("rt_heap_alloc error (%s)\n", strerror(-status));
     735                char errorMsg[256];
     736    Err("rt_heap_alloc error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    730737    ptr = NULL;
    731738  }
     
    741748
    742749  if (status != 0) {
    743     Err("rt_heap_free error (%s)\n", strerror(-status));
     750                char errorMsg[256];
     751    Err("rt_heap_free error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
    744752  }
    745753#else
     
    758766
    759767  if (written < 0) {
    760     Err("erreur write pipe (%s)\n", strerror(-written));
     768                char errorMsg[256];
     769    Err("error write pipe (%s)\n", strerror_r(-written, errorMsg, sizeof(errorMsg)));
    761770  } else if (written != (ssize_t)size) {
    762     Err("erreur write pipe %ld/%ld\n", written, size);
     771    Err("error write pipe %ld/%ld\n", written, size);
    763772  }
    764773}
     
    776785
    777786#ifdef __XENO__
     787        char errorMsg[256];
    778788  filename = NRT_PIPE_PATH + caller->self->ObjectName() + "-log_cmd";
    779789  while (cmd_pipe < 0) {
    780790    cmd_pipe = open(filename.c_str(), O_RDWR);
    781791    if (cmd_pipe < 0 && errno != ENOENT)
    782       caller->self->Err("open rt_pipe error: %s %i\n", filename.c_str(), errno);
     792      caller->self->Err("open rt_pipe error: %s %s\n", filename.c_str(), strerror_r(errno, errorMsg, sizeof(errorMsg)));
    783793    usleep(1000);
    784794  }
     
    787797    data_pipe = open(filename.c_str(), O_RDWR);
    788798    if (data_pipe < 0 && errno != ENOENT)
    789       caller->self->Err("open rt_pipe error: %s %i\n", filename.c_str(), errno);
     799      caller->self->Err("open rt_pipe error: %s %s\n", filename.c_str(), strerror_r(errno, errorMsg, sizeof(errorMsg)));
    790800    usleep(1000);
    791801  }
Note: See TracChangeset for help on using the changeset viewer.