[Intel-gfx] [PATCH igt] lib/sysfs: Handle EINTR from vfprintf()
Chris Wilson
chris at chris-wilson.co.uk
Thu Dec 14 21:02:49 UTC 2017
Some write operations into sysfs may be slow and potentially interrupted
by a signal. So handle EINTR by repeating the vfprintf(). A partial is
reported back to the caller, as is any other error.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
lib/igt_sysfs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index e7c67dae3..030d1c6a5 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -399,7 +399,9 @@ int igt_sysfs_vprintf(int dir, const char *attr, const char *fmt, va_list ap)
file = fdopen(fd, "w");
if (file) {
- ret = vfprintf(file, fmt, ap);
+ do {
+ ret = vfprintf(file, fmt, ap);
+ } while (ret == -1 && errno == EINTR);
fclose(file);
}
close(fd);
--
2.15.1
More information about the Intel-gfx
mailing list