This matches pipe(2).
Signed-off-by: Sage Weil <sage@redhat.com>
std::string OutputDataSocket::create_shutdown_pipe(int *pipe_rd, int *pipe_wr)
{
int pipefd[2];
- if (pipe_cloexec(pipefd) < 0) {
+ if (pipe_cloexec(pipefd, 0) < 0) {
int e = errno;
ostringstream oss;
oss << "OutputDataSocket::create_shutdown_pipe error: " << cpp_strerror(e);
int ret = 0;
- if ((stdin_op == PIPE && pipe_cloexec(ipipe) == -1) ||
- (stdout_op == PIPE && pipe_cloexec(opipe) == -1) ||
- (stderr_op == PIPE && pipe_cloexec(epipe) == -1)) {
+ if ((stdin_op == PIPE && pipe_cloexec(ipipe, 0) == -1) ||
+ (stdout_op == PIPE && pipe_cloexec(opipe, 0) == -1) ||
+ (stderr_op == PIPE && pipe_cloexec(epipe, 0) == -1)) {
ret = -errno;
errstr << "pipe failed: " << cpp_strerror(errno);
goto fail;
std::string AdminSocket::create_shutdown_pipe(int *pipe_rd, int *pipe_wr)
{
int pipefd[2];
- if (pipe_cloexec(pipefd) < 0) {
+ if (pipe_cloexec(pipefd, 0) < 0) {
int e = errno;
ostringstream oss;
oss << "AdminSocket::create_shutdown_pipe error: " << cpp_strerror(e);
#endif
}
-int pipe_cloexec(int pipefd[2])
+int pipe_cloexec(int pipefd[2], int flags)
{
#if defined(HAVE_PIPE2)
- return pipe2(pipefd, O_CLOEXEC);
+ return pipe2(pipefd, O_CLOEXEC | flags);
#else
if (pipe(pipefd) == -1)
return -1;
SignalHandler() {
// create signal pipe
- int r = pipe_cloexec(pipefd);
+ int r = pipe_cloexec(pipefd, 0);
ceph_assert(r == 0);
r = fcntl(pipefd[0], F_SETFL, O_NONBLOCK);
ceph_assert(r == 0);
safe_handler *h = new safe_handler;
- r = pipe_cloexec(h->pipefd);
+ r = pipe_cloexec(h->pipefd, 0);
ceph_assert(r == 0);
r = fcntl(h->pipefd[0], F_SETFL, O_NONBLOCK);
ceph_assert(r == 0);
int ceph_posix_fallocate(int fd, off_t offset, off_t len);
-int pipe_cloexec(int pipefd[2]);
+int pipe_cloexec(int pipefd[2], int flags);
#endif /* !CEPH_COMPAT_H */
return 0;
int fds[2];
- if (pipe_cloexec(fds) < 0) {
+ if (pipe_cloexec(fds, 0) < 0) {
int e = errno;
lderr(cct) << __func__ << " can't create notify pipe: " << cpp_strerror(e) << dendl;
return -e;
#ifdef CEPH_HAVE_SPLICE
if (backend->has_splice()) {
int pipefd[2];
- if (pipe_cloexec(pipefd) < 0) {
+ if (pipe_cloexec(pipefd, 0) < 0) {
int e = errno;
derr << " pipe " << " got " << cpp_strerror(e) << dendl;
return -e;
int pipefd[2];
loff_t off_in = 0;
int r;
- if (pipe_cloexec(pipefd) < 0) {
+ if (pipe_cloexec(pipefd, 0) < 0) {
int e = errno;
dout(0) << "detect_features: splice pipe met error " << cpp_strerror(e) << dendl;
} else {
int RGWHTTPManager::start()
{
- if (pipe_cloexec(thread_pipe) < 0) {
+ if (pipe_cloexec(thread_pipe, 0) < 0) {
int e = errno;
ldout(cct, 0) << "ERROR: pipe(): " << cpp_strerror(e) << dendl;
return -e;