summaryrefslogtreecommitdiffstats
path: root/base/posix
diff options
context:
space:
mode:
Diffstat (limited to 'base/posix')
-rw-r--r--base/posix/unix_domain_socket.cc6
-rw-r--r--base/posix/unix_domain_socket.h5
2 files changed, 7 insertions, 4 deletions
diff --git a/base/posix/unix_domain_socket.cc b/base/posix/unix_domain_socket.cc
index da8be63..bd11292 100644
--- a/base/posix/unix_domain_socket.cc
+++ b/base/posix/unix_domain_socket.cc
@@ -14,6 +14,8 @@
#include "base/pickle.h"
#include "base/stl_util.h"
+const size_t UnixDomainSocket::kMaxFileDescriptors = 16;
+
// static
bool UnixDomainSocket::SendMsg(int fd,
const void* buf,
@@ -52,8 +54,6 @@ ssize_t UnixDomainSocket::RecvMsg(int fd,
void* buf,
size_t length,
std::vector<int>* fds) {
- static const unsigned kMaxDescriptors = 16;
-
fds->clear();
struct msghdr msg;
@@ -62,7 +62,7 @@ ssize_t UnixDomainSocket::RecvMsg(int fd,
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
- char control_buffer[CMSG_SPACE(sizeof(int) * kMaxDescriptors)];
+ char control_buffer[CMSG_SPACE(sizeof(int) * kMaxFileDescriptors)];
msg.msg_control = control_buffer;
msg.msg_controllen = sizeof(control_buffer);
diff --git a/base/posix/unix_domain_socket.h b/base/posix/unix_domain_socket.h
index d08d170..cb2a0b8 100644
--- a/base/posix/unix_domain_socket.h
+++ b/base/posix/unix_domain_socket.h
@@ -15,6 +15,9 @@ class Pickle;
class BASE_EXPORT UnixDomainSocket {
public:
+ // Maximum number of file descriptors that can be read by RecvMsg().
+ static const size_t kMaxFileDescriptors;
+
// Use sendmsg to write the given msg and include a vector of file
// descriptors. Returns true if successful.
static bool SendMsg(int fd,
@@ -23,7 +26,7 @@ class BASE_EXPORT UnixDomainSocket {
const std::vector<int>& fds);
// Use recvmsg to read a message and an array of file descriptors. Returns
- // -1 on failure. Note: will read, at most, 16 descriptors.
+ // -1 on failure. Note: will read, at most, |kMaxFileDescriptors| descriptors.
static ssize_t RecvMsg(int fd,
void* msg,
size_t length,