+
+int fd_tracker_util_pipe_open_cloexec(struct fd_tracker *tracker,
+ const char *name, int *pipe)
+{
+ int ret;
+ const char *name_prefix;
+ char *names[2];
+
+ name_prefix = name ? name : "Unknown pipe";
+ ret = asprintf(&names[0], "%s (read end)", name_prefix);
+ if (ret < 0) {
+ goto end;
+ }
+ ret = asprintf(&names[1], "%s (write end)", name_prefix);
+ if (ret < 0) {
+ goto end;
+ }
+
+ ret = fd_tracker_open_unsuspendable_fd(tracker, pipe,
+ (const char **) names, 2, open_pipe_cloexec, NULL);
+ free(names[0]);
+ free(names[1]);
+end:
+ return ret;
+}
+
+int fd_tracker_util_pipe_close(struct fd_tracker *tracker, int *pipe)
+{
+ return fd_tracker_close_unsuspendable_fd(tracker,
+ pipe, 2, close_pipe, NULL);
+}