trusty: wrap syscalls in TEMP_FAILURE_RETRY

Needed to handle EINTR robustly.

Test: m libtrusty
Change-Id: I46a58ae911fd8db3d3528e24edbb6013d807b48c
diff --git a/trusty/libtrusty/trusty.c b/trusty/libtrusty/trusty.c
index 1a440a3..f44f8b4 100644
--- a/trusty/libtrusty/trusty.c
+++ b/trusty/libtrusty/trusty.c
@@ -33,14 +33,14 @@
     int fd;
     int rc;
 
-    fd = open(dev_name, O_RDWR);
+    fd = TEMP_FAILURE_RETRY(open(dev_name, O_RDWR));
     if (fd < 0) {
         rc = -errno;
         ALOGE("%s: cannot open tipc device \"%s\": %s\n", __func__, dev_name, strerror(errno));
         return rc < 0 ? rc : -1;
     }
 
-    rc = ioctl(fd, TIPC_IOC_CONNECT, srv_name);
+    rc = TEMP_FAILURE_RETRY(ioctl(fd, TIPC_IOC_CONNECT, srv_name));
     if (rc < 0) {
         rc = -errno;
         ALOGE("%s: can't connect to tipc service \"%s\" (err=%d)\n", __func__, srv_name, errno);
@@ -60,7 +60,7 @@
     req.shm = (__u64)shms;
     req.shm_cnt = (__u64)shmcnt;
 
-    int rc = ioctl(fd, TIPC_IOC_SEND_MSG, &req);
+    int rc = TEMP_FAILURE_RETRY(ioctl(fd, TIPC_IOC_SEND_MSG, &req));
     if (rc < 0) {
         ALOGE("%s: failed to send message (err=%d)\n", __func__, rc);
     }