On 17 November 2016 at 16:46, Juri Lelli juri.lelli@arm.com wrote:
On 17/11/16 15:54, Vincent Guittot wrote:
On 17 November 2016 at 11:35, Juri Lelli juri.lelli@arm.com wrote:
On 14/11/16 16:02, Vincent Guittot wrote:
On 11 November 2016 at 10:17, Juri Lelli juri.lelli@arm.com wrote:
[...]
@@ -274,7 +274,7 @@ void ftrace_write(int mark_fd, const char *fmt, ...)
/* If it worked return success */ if (n > -1 && n < size) {
write(mark_fd, tmp, n);
ret = write(mark_fd, tmp, n);
This remove the warning but the ret is useless, we should better loop on the write until we have written all data or an error happens
Right, something like this better?
src/rt-app_utils.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/src/rt-app_utils.c b/src/rt-app_utils.c index 0791291bcd81..fa574935fbaa 100644 --- a/src/rt-app_utils.c +++ b/src/rt-app_utils.c @@ -19,6 +19,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+#include <errno.h> +#include <string.h> #include "rt-app_utils.h"
unsigned long @@ -291,6 +293,11 @@ void ftrace_write(int mark_fd, const char *fmt, ...) if (n > -1 && n < size) { ret = write(mark_fd, tmp, n);
ret can be different than n meaning that all data have not been written
Right. Do you think we could safely ignore such cases (as we've done since now) and maybe report them for debug purposes only?
Yes at least report it for debug purpose but we should fix that to prevent lost of data in a next step
src/rt-app_utils.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/src/rt-app_utils.c b/src/rt-app_utils.c index 8d2c8fd4f324..c40eed55109d 100644 --- a/src/rt-app_utils.c +++ b/src/rt-app_utils.c @@ -292,6 +292,8 @@ void ftrace_write(int mark_fd, const char *fmt, ...) log_error("Cannot write mark_fd: %s\n", strerror(errno)); exit(EXIT_FAILURE);
} else if (ret < n) {
log_debug("Cannot write all bytes at once into mark_fd\n"); } return; }