Move transport declarations into transport.h.
There are a few cloexec issues in here as an added bonus.
Change-Id: I1699d719d733f47878bdba0454230cf5ab6a60b6
diff --git a/adb/framebuffer_service.c b/adb/framebuffer_service.c
index 61578aa..5665a56 100644
--- a/adb/framebuffer_service.c
+++ b/adb/framebuffer_service.c
@@ -14,21 +14,23 @@
* limitations under the License.
*/
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
#include <errno.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "fdevent.h"
-#include "adb.h"
-
+#include <fcntl.h>
#include <linux/fb.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+#include "sysdeps.h"
+
+#include "adb.h"
+#include "fdevent.h"
+#include "transport.h"
/* TODO:
** - sync with vsync to avoid tearing
@@ -68,15 +70,15 @@
if (pid == 0) {
dup2(fds[1], STDOUT_FILENO);
- close(fds[0]);
- close(fds[1]);
+ adb_close(fds[0]);
+ adb_close(fds[1]);
const char* command = "screencap";
const char *args[2] = {command, NULL};
execvp(command, (char**)args);
exit(1);
}
- close(fds[1]);
+ adb_close(fds[1]);
fd_screencap = fds[0];
/* read w, h & format */
@@ -174,9 +176,9 @@
}
done:
- close(fds[0]);
+ adb_close(fds[0]);
TEMP_FAILURE_RETRY(waitpid(pid, NULL, 0));
pipefail:
- close(fd);
+ adb_close(fd);
}