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 <ch...@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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to