1f71fd49623eda113386fc1dd8ed7471cf318234
2 * Copyright (C) 2018 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: GPL-2.0-only
8 #include <common/fd-tracker/utils.h>
9 #include <common/utils.h>
14 static int open_pipe_cloexec(void *data
, int *fds
)
16 return utils_create_pipe_cloexec(fds
);
19 static int close_pipe(void *data
, int *pipe
)
21 utils_close_pipe(pipe
);
22 pipe
[0] = pipe
[1] = -1;
26 int fd_tracker_util_close_fd(void *unused
, int *fd
)
31 int fd_tracker_util_pipe_open_cloexec(
32 struct fd_tracker
*tracker
, const char *name
, int *pipe
)
35 const char *name_prefix
;
38 name_prefix
= name
? name
: "Unknown pipe";
39 ret
= asprintf(&names
[0], "%s (read end)", name_prefix
);
43 ret
= asprintf(&names
[1], "%s (write end)", name_prefix
);
48 ret
= fd_tracker_open_unsuspendable_fd(tracker
, pipe
,
49 (const char **) names
, 2, open_pipe_cloexec
, NULL
);
56 int fd_tracker_util_pipe_close(struct fd_tracker
*tracker
, int *pipe
)
58 return fd_tracker_close_unsuspendable_fd(
59 tracker
, pipe
, 2, close_pipe
, NULL
);
This page took 0.031484 seconds and 4 git commands to generate.