rproc: Make state update errors more helpful

Include the reason for the failure to update the "state" sysfs
attribtue in the error message.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
Bjorn Andersson
2020-12-07 08:16:18 -08:00
parent 3449744146
commit 8a1d24a704

12
rproc.c
View File

@@ -176,8 +176,10 @@ static void *do_rproc_start(void *unused)
ssize_t ret; ssize_t ret;
ret = pwrite(rproc_state_fd, "start", 5, 0); ret = pwrite(rproc_state_fd, "start", 5, 0);
if (ret < 4) if (ret < 4) {
fprintf(stderr, "failed to update start state\n"); fprintf(stderr, "failed to update start state: %s\n",
strerror(errno));
}
return NULL; return NULL;
} }
@@ -192,8 +194,10 @@ static void *do_rproc_stop(void *unused)
ssize_t ret; ssize_t ret;
ret = pwrite(rproc_state_fd, "stop", 4, 0); ret = pwrite(rproc_state_fd, "stop", 4, 0);
if (ret < 4) if (ret < 4) {
fprintf(stderr, "failed to update stop state\n"); fprintf(stderr, "failed to update stop state: %s\n",
strerror(errno));
}
ret = write(rproc_pipe[1], "Y", 1); ret = write(rproc_pipe[1], "Y", 1);
if (ret != 1) { if (ret != 1) {