4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-02 04:20:28 +08:00

Cygwin: AF_UNIX: move the definition of class af_unix_pkt_hdr_t

It is needed in select.cc, so move the definition from
fhandler_socket_unix.cc to fhandler.h.
This commit is contained in:
Ken Brown 2020-10-21 19:28:06 -04:00
parent 533c9b05b8
commit 58205dc374
2 changed files with 25 additions and 26 deletions

View File

@ -997,7 +997,31 @@ class af_unix_shmem_t
struct ucred *peer_cred () { return &_peer_cred; }
};
struct af_unix_pkt_hdr_t;
/* See the commentary in fhandler_socket_unix.cc. */
class af_unix_pkt_hdr_t
{
public:
uint16_t pckt_len; /* size of packet including header */
bool admin_pkt : 1; /* admin packets are marked as such */
shut_state shut_info : 2; /* _SHUT_RECV /_SHUT_SEND. */
uint8_t name_len; /* size of name, a sockaddr_un */
uint16_t cmsg_len; /* size of ancillary data block */
uint16_t data_len; /* size of user data */
af_unix_pkt_hdr_t (bool a, shut_state s, uint8_t n, uint16_t c, uint16_t d)
{ init (a, s, n, c, d); }
void init (bool a, shut_state s, uint8_t n, uint16_t c, uint16_t d)
{
admin_pkt = a;
shut_info = s;
name_len = n;
cmsg_len = c;
data_len = d;
pckt_len = sizeof (*this) + name_len + cmsg_len + data_len;
}
};
#define MAX_AF_PKT_LEN 65536
class fhandler_socket_unix : public fhandler_socket
{

View File

@ -84,31 +84,6 @@ GUID __cygwin_socket_guid = {
A bound DGRAM socket sends its sun_path with each sendmsg/sendto.
*/
#define MAX_AF_PKT_LEN 65536
class af_unix_pkt_hdr_t
{
public:
uint16_t pckt_len; /* size of packet including header */
bool admin_pkt : 1; /* admin packets are marked as such */
shut_state shut_info : 2; /* _SHUT_RECV /_SHUT_SEND. */
uint8_t name_len; /* size of name, a sockaddr_un */
uint16_t cmsg_len; /* size of ancillary data block */
uint16_t data_len; /* size of user data */
af_unix_pkt_hdr_t (bool a, shut_state s, uint8_t n, uint16_t c, uint16_t d)
{ init (a, s, n, c, d); }
void init (bool a, shut_state s, uint8_t n, uint16_t c, uint16_t d)
{
admin_pkt = a;
shut_info = s;
name_len = n;
cmsg_len = c;
data_len = d;
pckt_len = sizeof (*this) + name_len + cmsg_len + data_len;
}
};
static inline ptrdiff_t
AF_UNIX_PKT_OFFSETOF_NAME (af_unix_pkt_hdr_t *phdr)
{