Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/ExeBy/exe_root.../usr/include/bsock
File: bsock_unix.h
/*
[0] Fix | Delete
* bsock_unix - unix domain socket sendmsg and recvmsg wrappers
[1] Fix | Delete
*
[2] Fix | Delete
* Copyright (c) 2011, Glue Logic LLC. All rights reserved. code()gluelogic.com
[3] Fix | Delete
*
[4] Fix | Delete
* Redistribution and use in source and binary forms, with or without
[5] Fix | Delete
* modification, are permitted provided that the following conditions are met:
[6] Fix | Delete
* * Redistributions of source code must retain the above copyright
[7] Fix | Delete
* notice, this list of conditions and the following disclaimer.
[8] Fix | Delete
* * Redistributions in binary form must reproduce the above copyright
[9] Fix | Delete
* notice, this list of conditions and the following disclaimer in the
[10] Fix | Delete
* documentation and/or other materials provided with the distribution.
[11] Fix | Delete
* * Neither the name of Glue Logic LLC nor the names of its contributors
[12] Fix | Delete
* may be used to endorse or promote products derived from this software
[13] Fix | Delete
* without specific prior written permission.
[14] Fix | Delete
*
[15] Fix | Delete
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
[16] Fix | Delete
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
[17] Fix | Delete
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
[18] Fix | Delete
* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
[19] Fix | Delete
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
[20] Fix | Delete
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
[21] Fix | Delete
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
[22] Fix | Delete
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
[23] Fix | Delete
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
[24] Fix | Delete
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[25] Fix | Delete
*/
[26] Fix | Delete
[27] Fix | Delete
#ifndef INCLUDED_BSOCK_UNIX_H
[28] Fix | Delete
#define INCLUDED_BSOCK_UNIX_H
[29] Fix | Delete
[30] Fix | Delete
#include <sys/types.h>
[31] Fix | Delete
#include <sys/uio.h>
[32] Fix | Delete
[33] Fix | Delete
#ifdef __cplusplus
[34] Fix | Delete
extern "C" {
[35] Fix | Delete
#endif
[36] Fix | Delete
[37] Fix | Delete
/* bsock stack allocation for recvmsg() ancillary data
[38] Fix | Delete
* On Linux, maximum length of ancillary data and user control data is set in
[39] Fix | Delete
* /proc/sys/net/core/optmem_max (man 3 cmsg, man 7 socket); customarily 10240.
[40] Fix | Delete
* RFC 3542: Advanced Sockets Application Program Interface (API) for IPv6
[41] Fix | Delete
* RFC 3542 min ancillary data is 10240; recommends getsockopt SO_SNDBUF
[42] Fix | Delete
* (traditional BSD mbuf is 108, which is way too small for RFC 3542 spec)
[43] Fix | Delete
*
[44] Fix | Delete
* The reason this setting is important is because a client can send many file
[45] Fix | Delete
* descriptors. On Linux, even if recvmsg() reports MSG_CTRUNC, the file
[46] Fix | Delete
* descriptors that the client sent are still received by the server process
[47] Fix | Delete
* (up to sysconf(_SC_OPEN_MAX)), resulting in leakage of file descriptors
[48] Fix | Delete
* unless process takes extra measures to close fds it does not know about.
[49] Fix | Delete
* Such an undertaking is difficult to do correctly since process might not
[50] Fix | Delete
* know which fds have been opened by lower-level libraries, e.g. to syslog,
[51] Fix | Delete
* nscd, /etc/protocols, /etc/services, etc. Setting this buffer size to the
[52] Fix | Delete
* maximum allowed means that MSG_CTRUNC should not be possible. (Take care
[53] Fix | Delete
* if increasing size since buffer is allocated on stack (as of this writing.)
[54] Fix | Delete
* On Linux, client can send the same descriptor many times and it will be
[55] Fix | Delete
* dup'd and received many times by server. On Linux, there appears to be a
[56] Fix | Delete
* maximum of 255 file descriptors that can be sent with sendmsg() over unix
[57] Fix | Delete
* domain sockets, whether in one or many separate ancillary control buffers.
[58] Fix | Delete
* On Linux, these ancillary control buffers appear to be independent of
[59] Fix | Delete
* SO_RCVBUF and SO_SNDBUF sizes of either client or server; limiting size of
[60] Fix | Delete
* SO_RCVBUF and SO_SNDBUF has no effect on size of ancillary control buffers.
[61] Fix | Delete
* In any case, allocating /proc/sys/net/core/optmem_max for ancillary control
[62] Fix | Delete
* buffers prevents the possibility of MSG_CTRUNC on Linux.
[63] Fix | Delete
*/
[64] Fix | Delete
#ifndef BSOCK_ANCILLARY_DATA_MAX
[65] Fix | Delete
#define BSOCK_ANCILLARY_DATA_MAX 10240
[66] Fix | Delete
#endif
[67] Fix | Delete
[68] Fix | Delete
int __attribute__((nonnull))
[69] Fix | Delete
bsock_unix_socket_connect (const char * const restrict sockpath);
[70] Fix | Delete
[71] Fix | Delete
int __attribute__((nonnull))
[72] Fix | Delete
bsock_unix_socket_bind_listen (const char * const restrict sockpath,
[73] Fix | Delete
int * const restrict bound);
[74] Fix | Delete
[75] Fix | Delete
ssize_t __attribute__((nonnull (4)))
[76] Fix | Delete
bsock_unix_recv_fds (const int fd,
[77] Fix | Delete
int * const restrict rfds,
[78] Fix | Delete
unsigned int * const restrict nrfds,
[79] Fix | Delete
struct iovec * const restrict iov,
[80] Fix | Delete
const size_t iovlen);
[81] Fix | Delete
[82] Fix | Delete
ssize_t __attribute__((nonnull (4,6)))
[83] Fix | Delete
bsock_unix_recv_fds_ex (const int fd,
[84] Fix | Delete
int * const restrict rfds,
[85] Fix | Delete
unsigned int * const restrict nrfds,
[86] Fix | Delete
struct iovec * const restrict iov,
[87] Fix | Delete
const size_t iovlen,
[88] Fix | Delete
char * const restrict ctrlbuf,
[89] Fix | Delete
const size_t ctrlbuf_sz);
[90] Fix | Delete
[91] Fix | Delete
ssize_t __attribute__((nonnull (4)))
[92] Fix | Delete
bsock_unix_send_fds (const int fd,
[93] Fix | Delete
const int * const restrict sfds,
[94] Fix | Delete
unsigned int nsfds,
[95] Fix | Delete
struct iovec * const restrict iov,
[96] Fix | Delete
const size_t iovlen);
[97] Fix | Delete
[98] Fix | Delete
int __attribute__((nonnull))
[99] Fix | Delete
bsock_unix_getpeereid (const int s,
[100] Fix | Delete
uid_t * const restrict euid,
[101] Fix | Delete
gid_t * const restrict egid);
[102] Fix | Delete
[103] Fix | Delete
#ifdef __cplusplus
[104] Fix | Delete
}
[105] Fix | Delete
#endif
[106] Fix | Delete
[107] Fix | Delete
#endif
[108] Fix | Delete
[109] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function