[PATCH igt] lib/sysfs: Handle EINTR from vfprintf()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux