MCPcopy Create free account
hub / github.com/ceph/ceph / pipe_cloexec

Function pipe_cloexec

src/common/compat.cc:113–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113int pipe_cloexec(int pipefd[2], int flags)
114{
115#if defined(HAVE_PIPE2)
116 return pipe2(pipefd, O_CLOEXEC | flags);
117#else
118 if (pipe(pipefd) == -1)
119 return -1;
120
121# ifdef _WIN32
122 return 0;
123# else
124 /*
125 * The old-fashioned, race-condition prone way that we have to fall
126 * back on if pipe2 does not exist.
127 */
128 if (fcntl(pipefd[0], F_SETFD, FD_CLOEXEC) < 0) {
129 goto fail;
130 }
131
132 if (fcntl(pipefd[1], F_SETFD, FD_CLOEXEC) < 0) {
133 goto fail;
134 }
135
136 return 0;
137
138fail:
139 int save_errno = errno;
140 VOID_TEMP_FAILURE_RETRY(close(pipefd[0]));
141 VOID_TEMP_FAILURE_RETRY(close(pipefd[1]));
142 return (errno = save_errno, -1);
143# endif
144#endif
145}
146
147
148int socket_cloexec(int domain, int type, int protocol)

Callers 7

startMethod · 0.85
Event.ccFile · 0.85
spawnMethod · 0.85
create_shutdown_pipeMethod · 0.85
admin_socket.ccFile · 0.85
SignalHandlerMethod · 0.85
register_handlerMethod · 0.85

Calls 1

pipeFunction · 0.85

Tested by

no test coverage detected