]> git.proxmox.com Git - ceph.git/blob - ceph/src/include/sock_compat.h
update sources to 12.2.10
[ceph.git] / ceph / src / include / sock_compat.h
1 /*
2 * Ceph - scalable distributed file system
3 *
4 * Copyright (C) 2018 Red Hat, Inc.
5 *
6 * This is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License version 2.1, as published by the Free Software
9 * Foundation. See file COPYING.
10 */
11
12 #ifndef CEPH_SOCK_COMPAT_H
13 #define CEPH_SOCK_COMPAT_H
14
15 #include "include/compat.h"
16 #include <sys/socket.h>
17
18 /*
19 * This optimization may not be available on all platforms (e.g. OSX).
20 * Apparently a similar approach based on TCP_CORK can be used.
21 */
22 #ifndef MSG_MORE
23 # define MSG_MORE 0
24 #endif
25
26 /*
27 * On BSD SO_NOSIGPIPE can be set via setsockopt to block SIGPIPE.
28 */
29 #ifndef MSG_NOSIGNAL
30 # define MSG_NOSIGNAL 0
31 # ifdef SO_NOSIGPIPE
32 # define CEPH_USE_SO_NOSIGPIPE
33 # else
34 # define CEPH_USE_SIGPIPE_BLOCKER
35 # warning "Using SIGPIPE blocking instead of suppression; this is not well-tested upstream!"
36 # endif
37 #endif
38
39 int socket_cloexec(int domain, int type, int protocol);
40 int socketpair_cloexec(int domain, int type, int protocol, int sv[2]);
41 int accept_cloexec(int sockfd, struct sockaddr* addr, socklen_t* addrlen);
42
43 #endif