Changeset 133 in flair-src
- Timestamp:
- Feb 9, 2017, 11:08:31 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ReleaseNotes
r124 r133 7 7 See also https://devel.hds.utc.fr/software/flair/wiki/hds_users 8 8 - added demos/OpticalFlow: stabilization using optical flow (vertical camera) 9 - resolved https://devel.hds.utc.fr/software/flair/ticket/8 9 10 - Uav class is now a singleton 10 11 - VrpnClient class is now a singleton -
trunk/lib/FlairCore/src/ConditionVariable_impl.cpp
r15 r133 33 33 status = pthread_cond_init(&m_ResumeCond, 0); 34 34 #endif 35 if (status != 0) 36 self->Err("error creating condition variable (%s)\n", strerror(-status)); 35 if (status != 0) { 36 char errorMsg[256]; 37 self->Err("error creating condition variable (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 38 } 37 39 } 38 40 … … 45 47 status = pthread_cond_destroy(&m_ResumeCond); 46 48 #endif 47 if (status != 0) 48 self->Err("error destroying condition variable (%s)\n", strerror(-status)); 49 if (status != 0) { 50 char errorMsg[256]; 51 self->Err("error destroying condition variable (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 52 } 49 53 } 50 54 … … 57 61 status = pthread_cond_wait(&m_ResumeCond, &self->Mutex::pimpl_->mutex); 58 62 #endif 59 if (status != 0) 60 self->Err("error (%s)\n", strerror(-status)); 63 if (status != 0) { 64 char errorMsg[256]; 65 self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 66 } 61 67 } 62 68 … … 74 80 if (status == 0) 75 81 return true; 76 if (status != ETIMEDOUT) 77 self->Err("error (%s)\n", strerror(-status)); 82 if (status != ETIMEDOUT) { 83 char errorMsg[256]; 84 self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 85 } 78 86 return false; 79 87 } … … 86 94 status = pthread_cond_signal(&m_ResumeCond); 87 95 #endif 88 if (status != 0) 89 self->Err("error (%s)\n", strerror(-status)); 96 if (status != 0) { 97 char errorMsg[256]; 98 self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 99 } 90 100 } -
trunk/lib/FlairCore/src/FrameworkManager_impl.cpp
r122 r133 132 132 int status = rt_task_shadow(NULL, task_name.c_str(), 10, 0); 133 133 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))); 135 136 } 136 137 … … 147 148 // Printf("destruction FrameworkManager_impl\n"); 148 149 int status; 149 150 char errorMsg[256]; 151 150 152 SafeStop(); 151 153 Join(); … … 160 162 status = DeletePipe(&cmd_pipe); 161 163 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))); 163 165 } 164 166 status = DeletePipe(&data_pipe); 165 167 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))); 167 169 } 168 170 … … 170 172 status = rt_heap_delete(&log_heap); 171 173 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))); 173 175 } 174 176 #endif … … 561 563 562 564 void FrameworkManager_impl::SetupLogger(string log_path) { 563 if (logger_defined == true) { 565 char errorMsg[256]; 566 567 if (logger_defined == true) { 564 568 Warn("SetupLogger() was already called.\n"); 565 569 return; … … 570 574 int status = CreatePipe(&cmd_pipe, "log_cmd"); 571 575 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))); 573 577 return; 574 578 } … … 576 580 status = CreatePipe(&data_pipe, "log_data"); 577 581 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))); 579 583 return; 580 584 } … … 585 589 status = rt_heap_create(&log_heap, tmp_name.c_str(), LOG_HEAP, H_FIFO); 586 590 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))); 588 592 return; 589 593 } … … 675 679 676 680 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))); 678 683 nb_err++; 679 684 logs.at(i).running = false; … … 708 713 709 714 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))); 711 717 return; 712 718 } else if (written != sizeof(log_desc_t)) { … … 727 733 int status = rt_heap_alloc(&log_heap, sz, TM_NONBLOCK, &ptr); 728 734 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))); 730 737 ptr = NULL; 731 738 } … … 741 748 742 749 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))); 744 752 } 745 753 #else … … 758 766 759 767 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))); 761 770 } else if (written != (ssize_t)size) { 762 Err("err eur write pipe %ld/%ld\n", written, size);771 Err("error write pipe %ld/%ld\n", written, size); 763 772 } 764 773 } … … 776 785 777 786 #ifdef __XENO__ 787 char errorMsg[256]; 778 788 filename = NRT_PIPE_PATH + caller->self->ObjectName() + "-log_cmd"; 779 789 while (cmd_pipe < 0) { 780 790 cmd_pipe = open(filename.c_str(), O_RDWR); 781 791 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))); 783 793 usleep(1000); 784 794 } … … 787 797 data_pipe = open(filename.c_str(), O_RDWR); 788 798 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))); 790 800 usleep(1000); 791 801 } -
trunk/lib/FlairCore/src/Mutex_impl.cpp
r15 r133 27 27 #ifdef __XENO__ 28 28 int status = rt_mutex_create(&mutex, NULL); 29 if (status != 0) 30 self->Err("rt_mutex_create error (%s)\n", strerror(-status)); 29 if (status != 0) { 30 char errorMsg[256]; 31 self->Err("rt_mutex_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 32 } 31 33 #else 32 34 // flag_locked=false;//revoir l'implementation nrt du is_locked … … 49 51 Mutex_impl::~Mutex_impl() { 50 52 int status; 53 char errorMsg[256]; 54 51 55 #ifdef __XENO__ 52 56 status = rt_mutex_delete(&mutex); … … 55 59 #endif 56 60 if (status != 0) 57 self->Err("error destroying mutex (%s)\n", strerror (-status));61 self->Err("error destroying mutex (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 58 62 } 59 63 60 64 void Mutex_impl::GetMutex(void) { 61 65 int status; 66 char errorMsg[256]; 67 62 68 #ifdef __XENO__ 63 69 status = rt_mutex_acquire(&mutex, TM_INFINITE); … … 67 73 #endif 68 74 if (status != 0) 69 self->Err("error (%s)\n", strerror (-status));75 self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 70 76 } 71 77 72 78 void Mutex_impl::ReleaseMutex(void) { 73 79 int status; 80 74 81 #ifdef __XENO__ 75 82 status = rt_mutex_release(&mutex); … … 78 85 // flag_locked=false; 79 86 #endif 80 if (status != 0) 81 self->Err("error (%s)\n", strerror(-status)); 87 if (status != 0) { 88 char errorMsg[256]; 89 self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 90 } 82 91 } 83 92 … … 88 97 RT_MUTEX_INFO info; 89 98 int status=rt_mutex_inquire(&mutex_rt,&info); 90 if(status!=0) mutex->Err("erreur rt_mutex_inquire 91 (%s)\n",strerror(-status)); 99 if(status!=0) mutex->Err("erreur rt_mutex_inquire (%s)\n",strerror_r(-status, errorMsg, sizeof(errorMsg))); 92 100 if(info.locked>0) return true; 93 101 return false; -
trunk/lib/FlairCore/src/RTDM_I2cPort.cpp
r15 r133 21 21 22 22 #include <rtdm/rti2c.h> 23 #include <errno.h>24 23 #include <cstring> 25 24 … … 37 36 fd = rt_dev_open(device.c_str(), 0); 38 37 if (fd < 0) { 39 Err("rt_dev_open (%s)\n", ObjectName().c_str(), strerror(-fd)); 38 char errorMsg[256]; 39 Err("rt_dev_open (%s)\n", ObjectName().c_str(), strerror_r(-fd, errorMsg, sizeof(errorMsg))); 40 40 } 41 41 … … 50 50 err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_CONFIG, &write_config); 51 51 if (err) { 52 char errorMsg[256]; 52 53 Err("rt_dev_ioctl RTI2C_RTIOC_SET_CONFIG error (%s)\n", 53 ObjectName().c_str(), strerror (-err));54 ObjectName().c_str(), strerror_r(-err, errorMsg, sizeof(errorMsg))); 54 55 } 55 56 } … … 60 61 int err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_SLAVE, &address); 61 62 if (err) { 62 Err("rt_dev_ioctl RTI2C_RTIOC_SET_SLAVE error (%s)\n", strerror(-err)); 63 char errorMsg[256]; 64 Err("rt_dev_ioctl RTI2C_RTIOC_SET_SLAVE error (%s)\n", strerror_r(-err, errorMsg, sizeof(errorMsg))); 63 65 } 64 66 … … 74 76 int err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_CONFIG, &write_config); 75 77 if (err) { 78 char errorMsg[256]; 76 79 Err("rt_dev_ioctl RTI2C_RTIOC_SET_CONFIG (%s)\n", ObjectName().c_str(), 77 strerror (-err));80 strerror_r(-err, errorMsg, sizeof(errorMsg))); 78 81 } 79 82 } … … 87 90 int err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_CONFIG, &write_config); 88 91 if (err) { 92 char errorMsg[256]; 89 93 Err("rt_dev_ioctl RTI2C_RTIOC_SET_CONFIG (%s)\n", ObjectName().c_str(), 90 strerror (-err));94 strerror_r(-err, errorMsg, sizeof(errorMsg))); 91 95 } 92 96 } -
trunk/lib/FlairCore/src/RTDM_SerialPort.cpp
r15 r133 21 21 22 22 #include <rtdm/rtserial.h> 23 #include <errno.h>24 23 #include <cstring> 25 24 … … 41 40 fd = rt_dev_open(device.c_str(), 0); 42 41 if (fd < 0) { 43 Err("erreur rt_dev_open (%s)\n", strerror(-fd)); 42 char errorMsg[256]; 43 Err("error rt_dev_open (%s)\n", strerror_r(-fd, errorMsg, sizeof(errorMsg))); 44 44 } 45 45 … … 47 47 int err = rt_dev_ioctl(fd, RTSER_RTIOC_SET_CONFIG, &write_config); 48 48 if (err) { 49 Err("erreur rt_dev_ioctl RTSER_RTIOC_SET_CONFIG (%s)\n", strerror(-err)); 49 char errorMsg[256]; 50 Err("error rt_dev_ioctl RTSER_RTIOC_SET_CONFIG (%s)\n", strerror_r(-err, errorMsg, sizeof(errorMsg))); 50 51 } 51 52 } … … 63 64 int err = rt_dev_ioctl(fd, RTSER_RTIOC_SET_CONFIG, &write_config); 64 65 if (err) { 65 Err("erreur rt_dev_ioctl RTSER_RTIOC_SET_CONFIG (%s)\n", strerror(-err)); 66 char errorMsg[256]; 67 Err("error rt_dev_ioctl RTSER_RTIOC_SET_CONFIG (%s)\n", strerror_r(-err, errorMsg, sizeof(errorMsg))); 66 68 } 67 69 } … … 77 79 int err = rt_dev_ioctl(fd, RTSER_RTIOC_SET_CONFIG, &write_config); 78 80 if (err) { 79 Err("erreur rt_dev_ioctl RTSER_RTIOC_SET_CONFIG (%s)\n", strerror(-err)); 81 char errorMsg[256]; 82 Err("error rt_dev_ioctl RTSER_RTIOC_SET_CONFIG (%s)\n", strerror_r(-err, errorMsg, sizeof(errorMsg))); 80 83 } 81 84 } -
trunk/lib/FlairCore/src/Semaphore_impl.cpp
r126 r133 28 28 this->self = self; 29 29 int status; 30 char errorMsg[256]; 31 30 32 #ifdef __XENO__ 31 33 status = rt_sem_create(&semaphore, NULL, initialValue, S_FIFO); … … 34 36 #endif 35 37 if (status != 0) { 36 self->Err("error creating semaphore (%s)\n", strerror (-status));38 self->Err("error creating semaphore (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 37 39 } 38 40 } … … 40 42 Semaphore_impl::~Semaphore_impl() { 41 43 int status; 44 char errorMsg[256]; 45 42 46 #ifdef __XENO__ 43 47 status = rt_sem_delete(&semaphore); … … 46 50 #endif 47 51 if (status != 0) 48 self->Err("error destroying semaphore (%s)\n", strerror (-status));52 self->Err("error destroying semaphore (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 49 53 } 50 54 … … 73 77 self->Warn("warning : semaphore timedout\n"); 74 78 } else { 75 self->Err("error getting the semaphore (%s)\n", strerror(-status)); 79 char errorMsg[256]; 80 self->Err("error getting the semaphore (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 76 81 } 77 82 returnValue = false; … … 89 94 #endif 90 95 if (status != 0) { 91 self->Err("error releasing the semaphore (%s)\n", strerror(-status)); 96 char errorMsg[256]; 97 self->Err("error releasing the semaphore (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 92 98 returnValue = false; 93 99 } -
trunk/lib/FlairCore/src/SharedMem_impl.cpp
r15 r133 30 30 this->size = size; 31 31 this->self = self; 32 char errorMsg[256]; 32 33 33 34 #ifdef __XENO__ … … 40 41 } 41 42 if (status != 0) { 42 self->Err("rt_heap_create error (%s)\n", strerror (-status));43 self->Err("rt_heap_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 43 44 return; 44 45 } … … 47 48 status = rt_heap_alloc(&heap, 0, TM_NONBLOCK, &ptr); 48 49 if (status != 0) { 49 self->Err("rt_heap_alloc error (%s)\n", strerror (-status));50 self->Err("rt_heap_alloc error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 50 51 } 51 52 mem_segment = (char *)ptr; … … 59 60 } 60 61 if (status != 0) { 61 self->Err("rt_mutex_create error (%s)\n", strerror (-status));62 self->Err("rt_mutex_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 62 63 return; 63 64 } … … 87 88 SharedMem_impl::~SharedMem_impl() { 88 89 int status; 90 char errorMsg[256]; 91 89 92 #ifdef __XENO__ 90 93 /* unnecessary because heap is opened in H_SINGLE mode … … 92 95 if(status!=0) 93 96 { 94 self->Err("rt_heap_free error (%s)\n",strerror (-status));97 self->Err("rt_heap_free error (%s)\n",strerror_r(-status, errorMsg, sizeof(errorMsg))); 95 98 } 96 99 */ … … 99 102 status = rt_heap_delete(&heap); 100 103 if (status != 0) { 101 self->Err("rt_heap_delete error (%s)\n", strerror (-status));104 self->Err("rt_heap_delete error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 102 105 } 103 106 } … … 106 109 status = rt_mutex_delete(&mutex); 107 110 if (status != 0) { 108 self->Err("error destroying mutex (%s)\n", strerror (-status));111 self->Err("error destroying mutex (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 109 112 } 110 113 } … … 112 115 status = munmap(mem_segment, size); 113 116 if (status != 0) { 114 self->Err("Failed to unmap memory (%s)\n", strerror (-status));117 self->Err("Failed to unmap memory (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 115 118 } 116 119 117 120 status = close(fd); 118 121 if (status != 0) { 119 self->Err("Failed to close file (%s)\n", strerror (-status));122 self->Err("Failed to close file (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 120 123 } 121 124 … … 124 127 if(status!=0) 125 128 { 126 self->Err("Failed to unlink memory (%s)\n",strerror (-status));129 self->Err("Failed to unlink memory (%s)\n",strerror_r(-status, errorMsg, sizeof(errorMsg))); 127 130 } 128 131 */ … … 131 134 if(status!=0) 132 135 { 133 self->Err("Failed to unlink semaphore (%s)\n",strerror (-status));136 self->Err("Failed to unlink semaphore (%s)\n",strerror_r(-status, errorMsg, sizeof(errorMsg))); 134 137 }*/ 135 138 136 139 status = sem_close(sem); 137 140 if (status != 0) { 138 self->Err("Failed to close semaphore (%s)\n", strerror (-status));141 self->Err("Failed to close semaphore (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 139 142 } 140 143 #endif … … 144 147 #ifdef __XENO__ 145 148 int status = rt_mutex_acquire(&mutex, TM_INFINITE); 146 if (status != 0) 147 self->Err("error (%s)\n", strerror(-status)); 149 if (status != 0) { 150 char errorMsg[256]; 151 self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 152 } 148 153 memcpy(mem_segment, buf, size); 149 154 status = rt_mutex_release(&mutex); 150 if (status != 0) 151 self->Err("error (%s)\n", strerror(-status)); 155 if (status != 0) { 156 char errorMsg[256]; 157 self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 158 } 152 159 #else 153 160 sem_wait(sem); … … 160 167 #ifdef __XENO__ 161 168 int status = rt_mutex_acquire(&mutex, TM_INFINITE); 162 if (status != 0) 163 self->Err("error (%s)\n", strerror(-status)); 169 if (status != 0) { 170 char errorMsg[256]; 171 self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 172 } 164 173 memcpy(buf, mem_segment, size); 165 174 status = rt_mutex_release(&mutex); 166 if (status != 0) 167 self->Err("error (%s)\n", strerror(-status)); 175 if (status != 0) { 176 char errorMsg[256]; 177 self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 178 } 168 179 #else 169 180 sem_wait(sem); -
trunk/lib/FlairCore/src/Socket_impl.cpp
r93 r133 103 103 #endif 104 104 if (status != 0) { 105 self->Err("rt_pipe_create error (%s)\n", strerror(-status)); 105 char errorMsg[256]; 106 self->Err("rt_pipe_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 106 107 } 107 108 … … 148 149 pthread_join(user_thread, NULL); 149 150 int status = rt_pipe_delete(&pipe); 150 if (status != 0) 151 self->Err("rt_pipe_delete error (%s)\n", strerror(-status)); 152 151 if (status != 0) { 152 char errorMsg[256]; 153 self->Err("rt_pipe_delete error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 154 } 153 155 #endif 154 156 close(fd); … … 158 160 ssize_t written; 159 161 string to_send; 162 char errorMsg[256]; 160 163 161 164 if (broadcast == true) { … … 170 173 171 174 if (written < 0) { 172 self->Err("rt_pipe_write error (%s)\n", strerror (-written));175 self->Err("rt_pipe_write error (%s)\n", strerror_r(-written, errorMsg, sizeof(errorMsg))); 173 176 } else if (written != (ssize_t)src_len) { 174 177 self->Err("rt_pipe_write error %i/%i\n", written, to_send.size()); … … 178 181 sendto(fd, src, src_len, 0, (struct sockaddr *)&sock_in, sizeof(sock_in)); 179 182 if(written==-1) { 180 self->Err("sendto error (%s)\n",strerror(-errno)); 183 char errorMsg[256]; 184 self->Err("sendto error (%s)\n",strerror_r(errno, errorMsg, sizeof(errorMsg))); 181 185 } else if (written != (ssize_t)src_len) { 182 186 self->Err("sendto error %i/%i\n",written,src_len); … … 195 199 196 200 if (written < 0) { 197 self->Err("rt_pipe_write error (%s)\n", strerror(-written)); 201 char errorMsg[256]; 202 self->Err("rt_pipe_write error (%s)\n", strerror_r(-written, errorMsg, sizeof(errorMsg))); 198 203 } else if (written != (ssize_t)message.size()) { 199 204 self->Err("rt_pipe_write error %i/%i\n", written, message.size()); … … 295 300 while (pipe_fd < 0) { 296 301 pipe_fd = open(devname.c_str(), O_RDWR); 297 if (pipe_fd < 0 && errno != ENOENT) 298 caller->self->Err("open pipe_fd error (%s)\n", strerror(-errno)); 302 if (pipe_fd < 0 && errno != ENOENT) { 303 char errorMsg[256]; 304 caller->self->Err("open pipe_fd error (%s)\n", strerror_r(errno, errorMsg, sizeof(errorMsg))); 305 } 299 306 usleep(1000); 300 307 } -
trunk/lib/FlairCore/src/Thread.cpp
r15 r133 87 87 #ifdef __XENO__ 88 88 int status = rt_task_sleep_until(time); 89 if (status != 0) 89 if (status != 0) { 90 char errorMsg[256]; 90 91 Err("%s, error rt_task_sleep_until (%s), resume time: %lld, actual time: " 91 "%lld\n", 92 ObjectName().c_str(), strerror(-status), time, GetTime()); 92 "%lld\n", ObjectName().c_str(), strerror_r(-status, errorMsg, sizeof(errorMsg)), time, GetTime()); 93 } 93 94 // Printf("rt_task_sleep_until, resume time: %lld, actual time: 94 95 // %lld\n",time,GetTime()); … … 104 105 #ifdef __XENO__ 105 106 int status = rt_task_sleep(time * 1000 * 1000); 106 if (status != 0) 107 Err("erreur rt_task_sleep (%s)\n", strerror(-status)); 107 if (status != 0) { 108 char errorMsg[256]; 109 Err("erreur rt_task_sleep (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 110 } 108 111 #else 109 112 usleep(time * 1000); … … 114 117 #ifdef __XENO__ 115 118 int status = rt_task_sleep(time * 1000); 116 if (status != 0) 117 Err("erreur rt_task_sleep (%s)\n", strerror(-status)); 119 if (status != 0) { 120 char errorMsg[256]; 121 Err("erreur rt_task_sleep (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 122 } 118 123 #else 119 124 usleep(time); -
trunk/lib/FlairCore/src/Thread_impl.cpp
r118 r133 78 78 void Thread_impl::Start(void) { 79 79 int status; 80 char errorMsg[256]; 80 81 81 82 isRunning = true; … … 94 95 #endif // RT_STACK_SIZE 95 96 if (status != 0) { 96 self->Err("rt_task_create error (%s)\n", strerror (-status));97 self->Err("rt_task_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 97 98 } else { 98 99 //_printf("rt_task_create ok %s\n",th_name); … … 101 102 status = rt_task_start(&task_rt, &main_rt, (void *)this); 102 103 if (status != 0) { 103 self->Err("rt_task_start error (%s)\n", strerror (-status));104 self->Err("rt_task_start error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 104 105 } else { 105 106 //_printf("rt_task_start ok %s\n",th_name); … … 178 179 #ifdef __XENO__ 179 180 int status = rt_task_set_periodic(&task_rt, TM_NOW, period * 1000); 180 if (status != 0) 181 self->Err("Error rt_task_set_periodic %s\n", strerror(-status)); 181 if (status != 0) { 182 char errorMsg[256]; 183 self->Err("Error rt_task_set_periodic %s\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 184 } 182 185 #else 183 186 next_time -= period; … … 198 201 #ifdef __XENO__ 199 202 int status = rt_task_set_periodic(&task_rt, TM_NOW, period * 1000 * 1000); 200 if (status != 0) 201 self->Err("Error rt_task_set_periodic %s\n", strerror(-status)); 203 if (status != 0) { 204 char errorMsg[256]; 205 self->Err("Error rt_task_set_periodic %s\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 206 } 202 207 #else 203 208 next_time -= period; … … 218 223 unsigned long overruns_r; 219 224 int status = rt_task_wait_period(&overruns_r); 220 if (status != 0) 221 self->Err("Error rt_task_wait_period %s\n", strerror(-status)); 222 if (status == -ETIMEDOUT) 225 if (status != 0) { 226 char errorMsg[256]; 227 self->Err("Error rt_task_wait_period %s\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 228 } 229 if (status == -ETIMEDOUT) { 223 230 self->Err("overrun: %lld\n", overruns_r); 231 } 224 232 #else 225 233 self->SleepUntil(next_time); … … 310 318 int status = rt_task_inquire(NULL, &info); 311 319 if (status != 0) { 312 self->Err("Error rt_task_inquire %s\n", strerror(-status)); 320 char errorMsg[256]; 321 self->Err("Error rt_task_inquire %s\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 313 322 } else 314 323 #endif … … 348 357 if (isRunning == true) { 349 358 int status; 359 char errorMsg[256]; 350 360 351 361 #ifdef __XENO__ … … 355 365 #endif 356 366 if (status != 0) 357 self->Err("error %s\n", strerror (-status));367 self->Err("error %s\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 358 368 isRunning = false; 359 369 } -
trunk/lib/FlairCore/src/Unix_I2cPort.cpp
r15 r133 17 17 18 18 #include "Unix_I2cPort.h" 19 #include <errno.h>20 19 #include <fcntl.h> /* File control definitions */ 21 20 #include <unistd.h> -
trunk/lib/FlairCore/src/Widget_impl.cpp
r15 r133 24 24 #ifdef __XENO__ 25 25 #include <native/heap.h> 26 #else27 #include <errno.h>28 #include <cstring>29 26 #endif 30 27 … … 45 42 46 43 if (status != 0) { 47 printf("libxml2: rt_heap_free error (%s)\n", strerror(-status)); 44 char errorMsg[256]; 45 printf("libxml2: rt_heap_free error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 48 46 } 49 47 } … … 54 52 int status = rt_heap_alloc(&xml_heap, sz, TM_NONBLOCK, &ptr); 55 53 if (status != 0) { 56 printf("libxml2: rt_heap_alloc error (%s)\n", strerror(-status)); 54 char errorMsg[256]; 55 printf("libxml2: rt_heap_alloc error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 57 56 } 58 57 // Printf("alloc %x %i\n",ptr,sz); … … 106 105 int status = rt_heap_create(&xml_heap, tmp_name.c_str(), XML_HEAP, H_FIFO); 107 106 if (status != 0) { 108 self->Err("rt_heap_create error (%s)\n", strerror(-status)); 107 char errorMsg[256]; 108 self->Err("rt_heap_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 109 109 } 110 110 … … 188 188 #ifdef __XENO__ 189 189 int status; 190 char errorMsg[256]; 190 191 RT_HEAP_INFO info; 191 192 status = rt_heap_inquire(&xml_heap, &info); 192 193 if (status != 0) { 193 self->Err("rt_heap_inquire error (%s)\n", strerror (-status));194 self->Err("rt_heap_inquire error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 194 195 } 195 196 if (info.usedmem != 0) … … 198 199 status = rt_heap_delete(&xml_heap); 199 200 if (status != 0) { 200 self->Err("rt_heap_delete error (%s)\n", strerror (-status));201 self->Err("rt_heap_delete error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 201 202 } 202 203 #endif -
trunk/lib/FlairCore/src/ui_com.cpp
r15 r133 70 70 71 71 if (status != 0) { 72 Err("rt_pipe_create error (%s)\n", strerror(-status)); 72 char errorMsg[256]; 73 Err("rt_pipe_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 73 74 // return -1; 74 75 } … … 125 126 126 127 int status = rt_pipe_delete(&pipe); 127 if (status != 0) 128 Err("rt_pipe_delete error (%s)\n", strerror(-status)); 128 if (status != 0) { 129 char errorMsg[256]; 130 Err("rt_pipe_delete error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg))); 131 } 129 132 #endif 130 133 … … 160 163 161 164 if (nb_write < 0) { 162 Err("rt_pipe_write error (%s)\n", strerror(-nb_write)); 165 char errorMsg[256]; 166 Err("rt_pipe_write error (%s)\n", strerror_r(-nb_write, errorMsg, sizeof(errorMsg))); 163 167 } else if (nb_write != size) { 164 168 Err("rt_pipe_write error %i/%i\n", nb_write, size); … … 326 330 while (pipe_fd < 0) { 327 331 pipe_fd = open(devname.c_str(), O_RDWR); 328 if (pipe_fd < 0 && errno != ENOENT) 329 caller->Err("open pipe_fd error (%s)\n", strerror(-errno)); 332 if (pipe_fd < 0 && errno != ENOENT) { 333 char errorMsg[256]; 334 caller->Err("open pipe_fd error (%s)\n", strerror_r(errno, errorMsg, sizeof(errorMsg))); 335 } 330 336 usleep(1000); 331 337 }
Note:
See TracChangeset
for help on using the changeset viewer.