Set the Storage socket sizes to be system defined

Some systems (Solaris, OpenBSD, AIX) change their definitions of
sockaddr_storage to be larger than 128 bytes. This comment adds a new
constant in the `sockaddr` that defines the size for every system.

Fixes #9759
This commit is contained in:
Stephen Gregoratto 2021-09-15 10:43:45 +10:00 committed by Veikka Tuominen
parent db940a2c81
commit 506f24cac2
9 changed files with 9 additions and 1 deletions

View File

@ -291,6 +291,7 @@ pub const sockaddr = extern struct {
family: sa_family_t,
data: [14]u8,
pub const SS_MAXSIZE = 128;
pub const storage = std.x.os.Socket.Address.Native.Storage;
pub const in = extern struct {
len: u8 = @sizeOf(in),

View File

@ -465,6 +465,7 @@ pub const sockaddr = extern struct {
family: u8,
data: [14]u8,
pub const SS_MAXSIZE = 128;
pub const storage = std.x.os.Socket.Address.Native.Storage;
pub const in = extern struct {

View File

@ -323,6 +323,7 @@ pub const sockaddr = extern struct {
/// actually longer; address value
data: [14]u8,
pub const SS_MAXSIZE = 128;
pub const storage = std.x.os.Socket.Address.Native.Storage;
pub const in = extern struct {

View File

@ -339,6 +339,7 @@ pub const sockaddr = extern struct {
/// actually longer; address value
data: [14]u8,
pub const SS_MAXSIZE = 128;
pub const storage = std.x.os.Socket.Address.Native.Storage;
pub const in = extern struct {

View File

@ -476,6 +476,7 @@ pub const sockaddr = extern struct {
/// actually longer; address value
data: [14]u8,
pub const SS_MAXSIZE = 128;
pub const storage = std.x.os.Socket.Address.Native.Storage;
pub const in = extern struct {

View File

@ -279,6 +279,7 @@ pub const sockaddr = extern struct {
/// actually longer; address value
data: [14]u8,
pub const SS_MAXSIZE = 256;
pub const storage = std.x.os.Socket.Address.Native.Storage;
pub const in = extern struct {

View File

@ -2923,6 +2923,7 @@ pub const sockaddr = extern struct {
family: sa_family_t,
data: [14]u8,
pub const SS_MAXSIZE = 128;
pub const storage = std.x.os.Socket.Address.Native.Storage;
/// IPv4 socket address

View File

@ -1105,6 +1105,7 @@ pub const sockaddr = extern struct {
family: ADDRESS_FAMILY,
data: [14]u8,
pub const SS_MAXSIZE = 128;
pub const storage = std.x.os.Socket.Address.Native.Storage;
/// IPv4 socket address

View File

@ -37,7 +37,7 @@ pub const Socket = struct {
/// POSIX `sockaddr.storage`. The expected size and alignment is specified in IETF RFC 2553.
pub const Storage = extern struct {
pub const expected_size = 128;
pub const expected_size = os.sockaddr.SS_MAXSIZE;
pub const expected_alignment = 8;
pub const padding_size = expected_size -